@psdk/device-ble-taro 0.2.58 → 0.2.59
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/build/connected.d.ts.map +1 -1
- package/build/connected.js +2 -0
- package/build/provider.d.ts.map +1 -1
- package/build/provider.js +21 -12
- package/package.json +4 -4
package/build/connected.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connected.d.ts","sourceRoot":"","sources":["../src/connected.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAE,eAAe,EAAE,WAAW,EAAC,MAAM,oBAAoB,CAAC;AAEjF,OAAO,IAAI,MAAM,cAAc,CAAC;AAEhC,qBAAa,sBAAuB,YAAW,eAAe;IAC5D,OAAO,CAAC,MAAM,CAA4D;IAC1E,OAAO,CAAC,MAAM,CAA4B;IAE1C,OAAO,CAAC,gBAAgB,CAAkB;IAC1C,OAAO,CAAC,UAAU,CAA4D;IAC9E,OAAO,CAAC,cAAc,CAAC,CAA+E;gBAEnF,OAAO,EAAE;QAC1B,MAAM,EAAE,IAAI,CAAC,sBAAsB,CAAC,6BAA6B,CAAC;QAClE,MAAM,EAAE,yBAAyB,CAAC;KACnC;IAQD,MAAM,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,8BAA8B,CAAC,cAAc,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;IAIpG,OAAO,CAAC,QAAQ;
|
|
1
|
+
{"version":3,"file":"connected.d.ts","sourceRoot":"","sources":["../src/connected.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAE,eAAe,EAAE,WAAW,EAAC,MAAM,oBAAoB,CAAC;AAEjF,OAAO,IAAI,MAAM,cAAc,CAAC;AAEhC,qBAAa,sBAAuB,YAAW,eAAe;IAC5D,OAAO,CAAC,MAAM,CAA4D;IAC1E,OAAO,CAAC,MAAM,CAA4B;IAE1C,OAAO,CAAC,gBAAgB,CAAkB;IAC1C,OAAO,CAAC,UAAU,CAA4D;IAC9E,OAAO,CAAC,cAAc,CAAC,CAA+E;gBAEnF,OAAO,EAAE;QAC1B,MAAM,EAAE,IAAI,CAAC,sBAAsB,CAAC,6BAA6B,CAAC;QAClE,MAAM,EAAE,yBAAyB,CAAC;KACnC;IAQD,MAAM,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,8BAA8B,CAAC,cAAc,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;IAIpG,OAAO,CAAC,QAAQ;YAsBF,QAAQ;IAuBtB,eAAe,IAAI,eAAe;IAIlC,UAAU,IAAI,MAAM;IAId,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAejC,OAAO,IAAI,OAAO;IAIZ,IAAI,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;IAsBhD,KAAK,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAqB5C,KAAK,IAAI,IAAI;CAId;AAED,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,IAAI,CAAC,oBAAoB,CAAC,UAAU,CAAC;IAC9C,KAAK,EAAE,IAAI,CAAC,2BAA2B,CAAC,iBAAiB,CAAC;IAC1D,IAAI,CAAC,EAAE,IAAI,CAAC,2BAA2B,CAAC,iBAAiB,CAAC;CAC3D"}
|
package/build/connected.js
CHANGED
|
@@ -28,6 +28,8 @@ class TaroBleConnectedDevice {
|
|
|
28
28
|
this.notifyCallback = callback;
|
|
29
29
|
}
|
|
30
30
|
doListen() {
|
|
31
|
+
if (this.scpair.read == null)
|
|
32
|
+
return;
|
|
31
33
|
taro_1.default.onBLECharacteristicValueChange((value) => __awaiter(this, void 0, void 0, function* () {
|
|
32
34
|
// this.dataOfRead.push(value)
|
|
33
35
|
if (this.notifyCallback) {
|
package/build/provider.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,cAAc,EACd,SAAS,EACT,eAAe,EACf,eAAe,EAEhB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAC,eAAe,EAAkB,MAAM,oBAAoB,CAAC;AAGpE,OAAO,IAAI,MAAM,cAAc,CAAC;AAEhC,qBAAa,gBAAiB,SAAQ,SAAS,CAAC,IAAI,CAAC,sBAAsB,CAAC,6BAA6B,CAAC;IAExG,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAkB;IAG3C,OAAO,CAAC,kBAAkB,CAAC,CAAgH;IAC3I,OAAO,CAAC,eAAe,CAAC,CAAyB;gBAErC,OAAO,CAAC,EAAE,eAAe;IAMrC,WAAW,IAAI,OAAO;IAMhB,qBAAqB,IAAI,OAAO,CAAC,qBAAqB,CAAC;IAUvD,OAAO,CACX,MAAM,EAAE,eAAe,CAAC,IAAI,CAAC,sBAAsB,CAAC,6BAA6B,CAAC,EAClF,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,eAAe,CAAC;IA2B3B,UAAU,CACR,QAAQ,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,sBAAsB,CAAC,6BAA6B,CAAC,CAAC,KAChG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;IAIrB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IA0B/B,aAAa,IAAI,OAAO,CAAC,YAAY,CAAC;YAY9B,oBAAoB;YAgBpB,qBAAqB;IAgBnC,OAAO,CAAC,sBAAsB;YA0BhB,mBAAmB;YAYnB,oBAAoB;YAkBpB,2BAA2B;YAmB3B,eAAe;YAgBf,UAAU;
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,cAAc,EACd,SAAS,EACT,eAAe,EACf,eAAe,EAEhB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAC,eAAe,EAAkB,MAAM,oBAAoB,CAAC;AAGpE,OAAO,IAAI,MAAM,cAAc,CAAC;AAEhC,qBAAa,gBAAiB,SAAQ,SAAS,CAAC,IAAI,CAAC,sBAAsB,CAAC,6BAA6B,CAAC;IAExG,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAkB;IAG3C,OAAO,CAAC,kBAAkB,CAAC,CAAgH;IAC3I,OAAO,CAAC,eAAe,CAAC,CAAyB;gBAErC,OAAO,CAAC,EAAE,eAAe;IAMrC,WAAW,IAAI,OAAO;IAMhB,qBAAqB,IAAI,OAAO,CAAC,qBAAqB,CAAC;IAUvD,OAAO,CACX,MAAM,EAAE,eAAe,CAAC,IAAI,CAAC,sBAAsB,CAAC,6BAA6B,CAAC,EAClF,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,eAAe,CAAC;IA2B3B,UAAU,CACR,QAAQ,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,sBAAsB,CAAC,6BAA6B,CAAC,CAAC,KAChG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;IAIrB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IA0B/B,aAAa,IAAI,OAAO,CAAC,YAAY,CAAC;YAY9B,oBAAoB;YAgBpB,qBAAqB;IAgBnC,OAAO,CAAC,sBAAsB;YA0BhB,mBAAmB;YAYnB,oBAAoB;YAkBpB,2BAA2B;YAmB3B,eAAe;YAgBf,UAAU;CAkHzB"}
|
package/build/provider.js
CHANGED
|
@@ -239,7 +239,7 @@ class TaroBleBluetooth extends device_bluetooth_traits_1.Jluetooth {
|
|
|
239
239
|
});
|
|
240
240
|
}
|
|
241
241
|
findSCPair(options) {
|
|
242
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
242
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
243
243
|
return __awaiter(this, void 0, void 0, function* () {
|
|
244
244
|
// fill data
|
|
245
245
|
const _characteristicsMap = new Map();
|
|
@@ -251,27 +251,36 @@ class TaroBleBluetooth extends device_bluetooth_traits_1.Jluetooth {
|
|
|
251
251
|
_characteristicsMap.set(service.uuid, characteristics);
|
|
252
252
|
}
|
|
253
253
|
// use special first
|
|
254
|
-
if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.
|
|
254
|
+
if (((_a = this.options) === null || _a === void 0 ? void 0 : _a.allowedWriteCharacteristic) && ((_b = this.options) === null || _b === void 0 ? void 0 : _b.allowedReadCharacteristic)) {
|
|
255
255
|
for (const service of options.services) {
|
|
256
|
-
if (!device_bluetooth_traits_1.TBluetoothHelpers.isAllowServices(service.uuid, (
|
|
256
|
+
if (!device_bluetooth_traits_1.TBluetoothHelpers.isAllowServices(service.uuid, (_c = this.options) === null || _c === void 0 ? void 0 : _c.allowServices)) {
|
|
257
257
|
continue;
|
|
258
258
|
}
|
|
259
259
|
const characteristics = _characteristicsMap.get(service.uuid);
|
|
260
|
+
let writeCharacteristic = null;
|
|
261
|
+
let readCharacteristic = null;
|
|
260
262
|
for (const characteristic of characteristics) {
|
|
261
|
-
if (((
|
|
262
|
-
|
|
263
|
-
|
|
263
|
+
if (((_d = this.options) === null || _d === void 0 ? void 0 : _d.allowedWriteCharacteristic.toLowerCase()) == characteristic.uuid.toLowerCase()) {
|
|
264
|
+
writeCharacteristic = characteristic;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
for (const characteristic of characteristics) {
|
|
268
|
+
if (((_e = this.options) === null || _e === void 0 ? void 0 : _e.allowedReadCharacteristic.toLowerCase()) == characteristic.uuid.toLowerCase()) {
|
|
269
|
+
readCharacteristic = characteristic;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
if (writeCharacteristic != null && readCharacteristic != null) {
|
|
264
273
|
return {
|
|
265
274
|
service,
|
|
266
|
-
write:
|
|
267
|
-
read:
|
|
275
|
+
write: writeCharacteristic,
|
|
276
|
+
read: readCharacteristic,
|
|
268
277
|
};
|
|
269
278
|
}
|
|
270
279
|
}
|
|
271
280
|
}
|
|
272
281
|
// choose best characteristic
|
|
273
282
|
for (const service of options.services) {
|
|
274
|
-
if (!device_bluetooth_traits_1.TBluetoothHelpers.isAllowServices(service.uuid, (
|
|
283
|
+
if (!device_bluetooth_traits_1.TBluetoothHelpers.isAllowServices(service.uuid, (_f = this.options) === null || _f === void 0 ? void 0 : _f.allowServices)) {
|
|
275
284
|
continue;
|
|
276
285
|
}
|
|
277
286
|
const characteristics = _characteristicsMap.get(service.uuid);
|
|
@@ -290,10 +299,10 @@ class TaroBleBluetooth extends device_bluetooth_traits_1.Jluetooth {
|
|
|
290
299
|
};
|
|
291
300
|
}
|
|
292
301
|
}
|
|
293
|
-
if ((
|
|
302
|
+
if ((_h = (_g = this.options) === null || _g === void 0 ? void 0 : _g.allowDetectDifferentCharacteristic) !== null && _h !== void 0 ? _h : true) {
|
|
294
303
|
// choose different characteristic with write and read properties
|
|
295
304
|
for (const service of options.services) {
|
|
296
|
-
if (!device_bluetooth_traits_1.TBluetoothHelpers.isAllowServices(service.uuid, (
|
|
305
|
+
if (!device_bluetooth_traits_1.TBluetoothHelpers.isAllowServices(service.uuid, (_j = this.options) === null || _j === void 0 ? void 0 : _j.allowServices)) {
|
|
297
306
|
continue;
|
|
298
307
|
}
|
|
299
308
|
const characteristics = _characteristicsMap.get(service.uuid);
|
|
@@ -318,7 +327,7 @@ class TaroBleBluetooth extends device_bluetooth_traits_1.Jluetooth {
|
|
|
318
327
|
else {
|
|
319
328
|
// only write
|
|
320
329
|
for (const service of options.services) {
|
|
321
|
-
if (!device_bluetooth_traits_1.TBluetoothHelpers.isAllowServices(service.uuid, (
|
|
330
|
+
if (!device_bluetooth_traits_1.TBluetoothHelpers.isAllowServices(service.uuid, (_k = this.options) === null || _k === void 0 ? void 0 : _k.allowServices)) {
|
|
322
331
|
continue;
|
|
323
332
|
}
|
|
324
333
|
const characteristics = _characteristicsMap.get(service.uuid);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@psdk/device-ble-taro",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.59",
|
|
4
4
|
"description": "psdk",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -46,13 +46,13 @@
|
|
|
46
46
|
"webpack-cli": "^4.9.2"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@psdk/device-bluetooth-traits": "0.2.
|
|
50
|
-
"@psdk/frame-father": "0.2.
|
|
49
|
+
"@psdk/device-bluetooth-traits": "0.2.59",
|
|
50
|
+
"@psdk/frame-father": "0.2.59",
|
|
51
51
|
"await-timeout": "^1.1.1"
|
|
52
52
|
},
|
|
53
53
|
"files": [
|
|
54
54
|
"build",
|
|
55
55
|
"!build/browser/psdk*"
|
|
56
56
|
],
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "5f2a48ddd7c5a15ec63854fa5dc086b60617e972"
|
|
58
58
|
}
|