incyclist-devices 1.4.31 → 1.4.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/ble/ble-device.js +1 -1
- package/lib/ble/ble-interface.js +2 -2
- package/lib/ble/ble.d.ts +1 -0
- package/lib/ble/ble.js +10 -0
- package/package.json +1 -1
package/lib/ble/ble-device.js
CHANGED
|
@@ -89,7 +89,7 @@ class BleDevice extends ble_1.BleDeviceClass {
|
|
|
89
89
|
characteristics.forEach(c => {
|
|
90
90
|
if (c.properties.find(p => p === 'notify')) {
|
|
91
91
|
c.on('data', (data, _isNotification) => {
|
|
92
|
-
this.onData(c.uuid, data);
|
|
92
|
+
this.onData(ble_1.uuid(c.uuid), data);
|
|
93
93
|
});
|
|
94
94
|
c.subscribe((err) => {
|
|
95
95
|
if (err)
|
package/lib/ble/ble-interface.js
CHANGED
|
@@ -173,10 +173,10 @@ class BleInterface extends ble_1.BleInterfaceClass {
|
|
|
173
173
|
});
|
|
174
174
|
};
|
|
175
175
|
if (typeof services === 'string') {
|
|
176
|
-
return get(deviceTypes, (s) => s === services);
|
|
176
|
+
return get(deviceTypes, (s) => s === ble_1.uuid(services));
|
|
177
177
|
}
|
|
178
178
|
if (Array.isArray(services)) {
|
|
179
|
-
return get(deviceTypes, s => services.includes(s));
|
|
179
|
+
return get(deviceTypes, s => services.map(ble_1.uuid).includes(s));
|
|
180
180
|
}
|
|
181
181
|
return [];
|
|
182
182
|
}
|
package/lib/ble/ble.d.ts
CHANGED
package/lib/ble/ble.js
CHANGED
|
@@ -49,3 +49,13 @@ var BleState;
|
|
|
49
49
|
BleState["POWERED_OFF"] = "poweredOff";
|
|
50
50
|
BleState["POWERED_ON"] = "poweredOn";
|
|
51
51
|
})(BleState = exports.BleState || (exports.BleState = {}));
|
|
52
|
+
exports.uuid = (s) => {
|
|
53
|
+
if (s) {
|
|
54
|
+
if (s.includes('-')) {
|
|
55
|
+
const parts = s.split('-');
|
|
56
|
+
const uuidNo = parseInt('0x' + parts[0]);
|
|
57
|
+
return uuidNo.toString(16);
|
|
58
|
+
}
|
|
59
|
+
return s;
|
|
60
|
+
}
|
|
61
|
+
};
|