Skip to content

Commit

Permalink
Bluetooth: remove sub brands
Browse files Browse the repository at this point in the history
  • Loading branch information
atrovato committed Nov 1, 2019
1 parent 58d67a9 commit 7666874
Show file tree
Hide file tree
Showing 17 changed files with 50 additions and 31 deletions.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { isRemote, isMesh } = require('../lib/awox.utils');
const { DEVICE_FEATURE_CATEGORIES, DEVICE_FEATURE_TYPES } = require('../../../../../utils/constants');
const { DEVICE_FEATURE_CATEGORIES, DEVICE_FEATURE_TYPES } = require('../../../utils/constants');

module.exports = {
name: 'rcum',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { isRemote, isMesh, isColor } = require('../lib/awox.utils');
const { DEVICE_FEATURE_CATEGORIES, DEVICE_FEATURE_TYPES } = require('../../../../../utils/constants');
const { DEVICE_FEATURE_CATEGORIES, DEVICE_FEATURE_TYPES } = require('../../../utils/constants');

module.exports = {
name: 'smlc',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { isRemote, isMesh, isColor } = require('../lib/awox.utils');
const { DEVICE_FEATURE_CATEGORIES, DEVICE_FEATURE_TYPES } = require('../../../../../utils/constants');
const { DEVICE_FEATURE_CATEGORIES, DEVICE_FEATURE_TYPES } = require('../../../utils/constants');

module.exports = {
name: 'smlcm',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { isRemote, isMesh, isWhite } = require('../lib/awox.utils');
const { connectAndSend } = require('../../../lib/utils/connectAndSend');
const { DEVICE_FEATURE_CATEGORIES, DEVICE_FEATURE_TYPES } = require('../../../../../utils/constants');
const { connectAndSend } = require('../../bluetooth/lib/utils/connectAndSend');
const { DEVICE_FEATURE_CATEGORIES, DEVICE_FEATURE_TYPES } = require('../../../utils/constants');

module.exports = {
name: 'smlw',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { isRemote, isMesh, isWhite } = require('../lib/awox.utils');
const { DEVICE_FEATURE_CATEGORIES, DEVICE_FEATURE_TYPES } = require('../../../../../utils/constants');
const { DEVICE_FEATURE_CATEGORIES, DEVICE_FEATURE_TYPES } = require('../../../utils/constants');

module.exports = {
name: 'smlwm',
Expand Down
16 changes: 16 additions & 0 deletions server/services/awox/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "gladys-awox",
"version": "1.0.0",
"main": "index.js",
"os": [
"darwin",
"linux",
"freebsd",
"win32"
],
"cpu": [
"x64",
"arm",
"arm64"
]
}
4 changes: 0 additions & 4 deletions server/services/bluetooth/lib/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// DEVICE IMPL
const nutDevice = require('../devices/nut');
const awoxDevice = require('../devices/awox');
const GenericDevice = require('../devices');

// EVENTS
Expand Down Expand Up @@ -40,8 +38,6 @@ const BluetoothManager = function BluetoothManager(noble, gladys, serviceId) {

// All types of device managed by implementations
this.availableBrands = new Map();
this.availableBrands.set('nut', new GenericDevice(nutDevice));
this.availableBrands.set('awox', new GenericDevice(awoxDevice));
};

// EVENTS
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { battery } = require('../../generic/generic.pollFeatures');
const { DEVICE_FEATURE_CATEGORIES, DEVICE_FEATURE_TYPES } = require('../../../../../utils/constants');
const { battery } = require('../../bluetooth/devices/generic/generic.pollFeatures');
const { DEVICE_FEATURE_CATEGORIES, DEVICE_FEATURE_TYPES } = require('../../../utils/constants');

module.exports = {
name: 'tracker',
Expand Down
16 changes: 16 additions & 0 deletions server/services/nut/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "gladys-nut",
"version": "1.0.0",
"main": "index.js",
"os": [
"darwin",
"linux",
"freebsd",
"win32"
],
"cpu": [
"x64",
"arm",
"arm64"
]
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
const { expect } = require('chai');
const sinon = require('sinon');

const awox = require('../../../../../services/bluetooth/devices/awox');
const awox = require('../../../services/awox');

const remote = require('../../../../../services/bluetooth/devices/awox/models/awox.remote.mesh');
const smlc = require('../../../../../services/bluetooth/devices/awox/models/awox.smlc');
const smlcm = require('../../../../../services/bluetooth/devices/awox/models/awox.smlc.mesh');
const smlw = require('../../../../../services/bluetooth/devices/awox/models/awox.smlw');
const smlwm = require('../../../../../services/bluetooth/devices/awox/models/awox.smlw.mesh');
const remote = require('../../../services/awox/models/awox.remote.mesh');
const smlc = require('../../../services/awox/models/awox.smlc');
const smlcm = require('../../../services/awox/models/awox.smlc.mesh');
const smlw = require('../../../services/awox/models/awox.smlw');
const smlwm = require('../../../services/awox/models/awox.smlw.mesh');

describe('Bluetooth AwoX -> getMatchingModels', () => {
beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,7 @@ describe('Bluetooth : verify all available brands', () => {

if (feature.min >= feature.max) {
assert.fail(
`Feature min (${feature.min}) should be lower than max (${
feature.max
}) for ${key} ${featureName} feature at position ${fIndex} (${modelName} model at position ${index})`,
`Feature min (${feature.min}) should be lower than max (${feature.max}) for ${key} ${featureName} feature at position ${fIndex} (${modelName} model at position ${index})`,
);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const event = new EventEmitter();
const BluetoothManager = require('../../../../../services/bluetooth/lib');

const GenericDevice = require('../../../../../services/bluetooth/devices');
const nutDevice = require('../../../../../services/bluetooth/devices/nut/models/nut.tracker');

const { EVENTS } = require('../../../../../utils/constants');

Expand Down Expand Up @@ -38,12 +37,6 @@ describe('BluetoothManager getMatchingDevices command', () => {
expect(result).deep.eq([]);
});

it('get single matching device', () => {
const charMap = { '2a00': 'nut' };
const result = bluetoothManager.getMatchingDevices(charMap);
expect(result).deep.eq([{ brand: 'nut', model: 'tracker', device: nutDevice.device }]);
});

it('get matching device but missing method', () => {
bluetoothManager.availableBrands.set('new', new GenericDevice({}));
const charMap = { '?': '?' };
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const { expect } = require('chai');
const sinon = require('sinon');

const nut = require('../../../../../services/bluetooth/devices/nut');
const nutDevice = require('../../../../../services/bluetooth/devices/nut/models/nut.tracker');
const nut = require('../../../services/nut');
const nutDevice = require('../../../services/nut/models/nut.tracker');

describe('Bluetooth Nut -> getMatchingModels', () => {
beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { expect } = require('chai');
const sinon = require('sinon');

const model = require('../../../../../../services/bluetooth/devices/nut/models/nut.tracker');
const model = require('../../../../services/nut/models/nut.tracker');

describe('Bluetooth model Tracker', () => {
beforeEach(() => {
Expand Down

0 comments on commit 7666874

Please sign in to comment.