@iotize/device-com-ble.cordova 3.2.1 → 3.3.2
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/README.md +174 -177
- package/bundles/iotize-device-com-ble.cordova.umd.js +102 -69
- package/bundles/iotize-device-com-ble.cordova.umd.js.map +1 -1
- package/bundles/iotize-device-com-ble.cordova.umd.min.js +16 -0
- package/bundles/iotize-device-com-ble.cordova.umd.min.js.map +1 -0
- package/esm2015/lib/ble-com-protocol.js +10 -10
- package/esm2015/lib/ble-com-protocol.js.map +1 -1
- package/esm2015/lib/cordova-ble-error.js +11 -2
- package/esm2015/lib/cordova-ble-error.js.map +1 -1
- package/esm2015/lib/cordova-interface.js.map +1 -1
- package/esm2015/lib/cordova-service-adapter.js +15 -14
- package/esm2015/lib/cordova-service-adapter.js.map +1 -1
- package/esm2015/lib/cordova-service-adapter.metadata.json +1 -1
- package/esm2015/lib/definitions.js +0 -2
- package/esm2015/lib/definitions.js.map +1 -1
- package/esm2015/lib/iotize-ble-cordova-plugin.js +59 -51
- package/esm2015/lib/iotize-ble-cordova-plugin.js.map +1 -1
- package/esm2015/lib/iotize-ble-cordova-plugin.metadata.json +1 -1
- package/esm2015/lib/iotize-ble-cordova-plugin.ngsummary.json +1 -1
- package/esm2015/lib/logger.js +1 -1
- package/esm2015/lib/logger.js.map +1 -1
- package/esm2015/lib/scanner.js +14 -12
- package/esm2015/lib/scanner.js.map +1 -1
- package/esm2015/lib/scanner.metadata.json +1 -1
- package/esm2015/lib/utility.js +1 -1
- package/esm2015/lib/utility.js.map +1 -1
- package/esm2015/public_api.js +4 -4
- package/esm2015/public_api.js.map +1 -1
- package/fesm2015/iotize-device-com-ble.cordova.js +93 -74
- package/fesm2015/iotize-device-com-ble.cordova.js.map +1 -1
- package/iotize-device-com-ble.cordova.metadata.json +1 -1
- package/lib/ble-com-protocol.d.ts +4 -4
- package/lib/cordova-ble-error.d.ts +12 -3
- package/lib/cordova-service-adapter.d.ts +1 -1
- package/lib/definitions.d.ts +1 -1
- package/lib/iotize-ble-cordova-plugin.d.ts +4 -3
- package/lib/scanner.d.ts +4 -4
- package/package.json +1 -1
- package/plugin.xml +66 -63
- package/public_api.d.ts +5 -5
- package/src/android/.gradle/4.8.1/fileHashes/fileHashes.bin +0 -0
- package/src/android/.gradle/4.8.1/fileHashes/fileHashes.lock +0 -0
- package/src/android/build.gradle +1 -0
- package/src/android/src/ble/BLECom.java +559 -558
- package/src/ios/BLECom.swift +732 -732
- package/src/windows/IoTizeBLE.pdb +0 -0
- package/src/windows/IoTizeBLE.pri +0 -0
- package/src/windows/iotize-ble-com.js +159 -179
- package/www/plugin.js +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@iotize/tap/protocol/api'), require('@iotize/tap/protocol/core'), require('rxjs'), require('rxjs/operators'), require('@iotize/common/debug'), require('@iotize/common/error'), require('@iotize/tap/protocol/ble/common'), require('@iotize/common/byte-converter'), require('@iotize/common/utility')) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define('@iotize/device-com-ble.cordova', ['exports', '@iotize/tap/protocol/api', '@iotize/tap/protocol/core', 'rxjs', 'rxjs/operators', '@iotize/common/debug', '@iotize/common/error', '@iotize/tap/protocol/ble/common', '@iotize/common/byte-converter', '@iotize/common/utility'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.iotize = global.iotize || {}, global.iotize[
|
|
5
|
-
}(this, (function (exports, api, core, rxjs, operators, debug$1, error, common, byteConverter, utility) { 'use strict';
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.iotize = global.iotize || {}, global.iotize["device-com-ble"] = global.iotize["device-com-ble"] || {}, global.iotize["device-com-ble"].cordova = {}), global.api, global.core, global.rxjs, global.rxjs.operators, global.debug$1, global.error, global.common, global.byteConverter, global.utility));
|
|
5
|
+
})(this, (function (exports, api, core, rxjs, operators, debug$1, error, common, byteConverter, utility) { 'use strict';
|
|
6
6
|
|
|
7
7
|
/*! *****************************************************************************
|
|
8
8
|
Copyright (c) Microsoft Corporation.
|
|
@@ -313,7 +313,7 @@
|
|
|
313
313
|
return new CordovaBLEError("Internal error: native call returned an invalid data type. " + cause.message, CordovaBLEError.Code.InternalError);
|
|
314
314
|
};
|
|
315
315
|
CordovaBLEError.isValidErrorCode = function (code) {
|
|
316
|
-
return
|
|
316
|
+
return code in CordovaBLEError.Code;
|
|
317
317
|
};
|
|
318
318
|
CordovaBLEError.iotizeBLEMissing = function () {
|
|
319
319
|
return new CordovaBLEError("iotizeBLE global variable does not exist. Are you sure app is running inside a Cordova application ?", CordovaBLEError.Code.InternalError);
|
|
@@ -326,11 +326,20 @@
|
|
|
326
326
|
(function (Code) {
|
|
327
327
|
Code["InternalError"] = "CordovaBLEErrorInternalError";
|
|
328
328
|
Code["IllegalArgument"] = "CordovaBLEErrorIllegalArgument";
|
|
329
|
+
Code["BLENotAvailable"] = "CordovaBLEErrorBLENotAvailable";
|
|
330
|
+
Code["InvalidMacAddress"] = "InvalidMacAddressInvalidMacAddress";
|
|
331
|
+
Code["ConnectionError"] = "CordovaBLEErrorConnectionError";
|
|
332
|
+
Code["RequestError"] = "CordovaBLEErrorRequestError";
|
|
333
|
+
Code["LocationServiceDisabled"] = "CordovaBLEErrorLocationServiceDisabled";
|
|
334
|
+
Code["DisconnectError"] = "CordovaBLEErrorDisconnectError";
|
|
335
|
+
Code["IllegalAction"] = "CordovaBLEErrorIllegalAction";
|
|
336
|
+
Code["NotConnectedError"] = "CordovaBLEErrorNotConnectedError";
|
|
337
|
+
Code["StatusCodeError"] = "CordovaBLEErrorStatusCodeError";
|
|
329
338
|
})(Code = CordovaBLEError.Code || (CordovaBLEError.Code = {}));
|
|
330
339
|
})(CordovaBLEError || (CordovaBLEError = {}));
|
|
331
340
|
|
|
332
341
|
function getIoTizeBleCordovaPlugin() {
|
|
333
|
-
if (typeof iotizeBLE !==
|
|
342
|
+
if (typeof iotizeBLE !== "object") {
|
|
334
343
|
throw CordovaBLEError.iotizeBLEMissing();
|
|
335
344
|
}
|
|
336
345
|
return iotizeBLE;
|
|
@@ -383,7 +392,7 @@
|
|
|
383
392
|
});
|
|
384
393
|
BLEComProtocol.prototype._connect = function (options) {
|
|
385
394
|
var _this = this;
|
|
386
|
-
debug(
|
|
395
|
+
debug("_connect", options);
|
|
387
396
|
return this.pluginInterface
|
|
388
397
|
.connectAndDiscoverTapServices(this.deviceId)
|
|
389
398
|
.pipe(operators.tap(function (state) {
|
|
@@ -392,20 +401,20 @@
|
|
|
392
401
|
};
|
|
393
402
|
BLEComProtocol.prototype._disconnect = function (options) {
|
|
394
403
|
var _this = this;
|
|
395
|
-
debug(
|
|
404
|
+
debug("_disconnect", options);
|
|
396
405
|
return rxjs.defer(function () { return _this.pluginInterface.disConnect(_this.deviceId); });
|
|
397
406
|
};
|
|
398
407
|
BLEComProtocol.prototype.write = function (data) {
|
|
399
408
|
return __awaiter$3(this, void 0, void 0, function () {
|
|
400
409
|
return __generator(this, function (_a) {
|
|
401
|
-
throw new Error(
|
|
410
|
+
throw new Error("Method not implemented.");
|
|
402
411
|
});
|
|
403
412
|
});
|
|
404
413
|
};
|
|
405
414
|
BLEComProtocol.prototype.read = function () {
|
|
406
415
|
return __awaiter$3(this, void 0, void 0, function () {
|
|
407
416
|
return __generator(this, function (_a) {
|
|
408
|
-
throw new Error(
|
|
417
|
+
throw new Error("Method not implemented.");
|
|
409
418
|
});
|
|
410
419
|
});
|
|
411
420
|
};
|
|
@@ -451,7 +460,7 @@
|
|
|
451
460
|
});
|
|
452
461
|
Object.defineProperty(CordovaPeripheralAdapter.prototype, "name", {
|
|
453
462
|
get: function () {
|
|
454
|
-
// TODO device name ?
|
|
463
|
+
// TODO device name ?
|
|
455
464
|
return this.id;
|
|
456
465
|
},
|
|
457
466
|
enumerable: false,
|
|
@@ -534,9 +543,10 @@
|
|
|
534
543
|
switch (_b.label) {
|
|
535
544
|
case 0:
|
|
536
545
|
(_a = this.connectionStateSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
537
|
-
connectObservable = this.cordovaPlugin
|
|
538
|
-
|
|
539
|
-
.
|
|
546
|
+
connectObservable = this.cordovaPlugin
|
|
547
|
+
.connect(this.deviceId)
|
|
548
|
+
.pipe(operators.shareReplay());
|
|
549
|
+
this.connectionStateSubscription = connectObservable.subscribe(function (state) {
|
|
540
550
|
_this._stateChange.next(state);
|
|
541
551
|
});
|
|
542
552
|
return [4 /*yield*/, connectObservable
|
|
@@ -663,7 +673,7 @@
|
|
|
663
673
|
get: function () {
|
|
664
674
|
return this.setupDataStreamIfRequired().pipe(operators.map(function (data) { return ({
|
|
665
675
|
data: data,
|
|
666
|
-
isNotification: true
|
|
676
|
+
isNotification: true,
|
|
667
677
|
}); }));
|
|
668
678
|
},
|
|
669
679
|
enumerable: false,
|
|
@@ -785,7 +795,7 @@
|
|
|
785
795
|
}());
|
|
786
796
|
|
|
787
797
|
//
|
|
788
|
-
// Copyright 2018 IoTize SAS Inc. Licensed under the MIT license.
|
|
798
|
+
// Copyright 2018 IoTize SAS Inc. Licensed under the MIT license.
|
|
789
799
|
//
|
|
790
800
|
// scanner.ts
|
|
791
801
|
// device-com-ble.cordova BLE Cordova Plugin
|
|
@@ -888,22 +898,23 @@
|
|
|
888
898
|
debug("Start Scanning ...");
|
|
889
899
|
this._scanning$.next(true);
|
|
890
900
|
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
891
|
-
_this.scanSubscription = _this.cordovaInterface
|
|
901
|
+
_this.scanSubscription = _this.cordovaInterface
|
|
902
|
+
.startScan(_this.requestDeviceOptions)
|
|
892
903
|
.subscribe(function (result) {
|
|
893
|
-
if (result ==
|
|
904
|
+
if (result == "Ok") {
|
|
894
905
|
resolve();
|
|
895
906
|
return;
|
|
896
907
|
}
|
|
897
908
|
_this.addOrRefreshDevice(result);
|
|
898
909
|
}, function (error) {
|
|
899
|
-
debug(
|
|
910
|
+
debug("Start scan failed with error: ", error);
|
|
900
911
|
_this.cordovaInterface
|
|
901
912
|
.getLastError()
|
|
902
913
|
.then(function (lasterror) {
|
|
903
914
|
debug("Last BLE error " + lasterror);
|
|
904
915
|
})
|
|
905
916
|
.catch(function (err) {
|
|
906
|
-
debug(
|
|
917
|
+
debug("Cannot get last BLE error: ", err);
|
|
907
918
|
});
|
|
908
919
|
reject(error);
|
|
909
920
|
_this._scanning$.next(false);
|
|
@@ -963,7 +974,8 @@
|
|
|
963
974
|
var storedDeviceIndex = this.devices.findIndex(function (entry) { return entry.address == newDevice.address; });
|
|
964
975
|
if (storedDeviceIndex >= 0) {
|
|
965
976
|
var storedDevice = this.devices[storedDeviceIndex];
|
|
966
|
-
if (storedDevice.name != newDevice.name ||
|
|
977
|
+
if (storedDevice.name != newDevice.name ||
|
|
978
|
+
storedDevice.rssi != newDevice.rssi) {
|
|
967
979
|
debug("Updating device at index " + storedDeviceIndex + ", name=" + storedDevice.name + " with rssi=" + storedDevice.rssi);
|
|
968
980
|
this.devices[storedDeviceIndex] = newDevice;
|
|
969
981
|
// this.devices = [...this.devices];
|
|
@@ -1010,55 +1022,83 @@
|
|
|
1010
1022
|
function IoTizeBleCordovaPlugin() {
|
|
1011
1023
|
}
|
|
1012
1024
|
IoTizeBleCordovaPlugin.prototype.checkAvailable = function () {
|
|
1013
|
-
return this.execSingleResult(
|
|
1025
|
+
return this.execSingleResult("checkAvailable", []);
|
|
1014
1026
|
};
|
|
1015
1027
|
IoTizeBleCordovaPlugin.prototype.requestEnableBle = function () {
|
|
1016
|
-
return this.execSingleResult(
|
|
1028
|
+
return this.execSingleResult("enable", []);
|
|
1017
1029
|
};
|
|
1018
1030
|
IoTizeBleCordovaPlugin.prototype.startScan = function (requestDeviceOptions) {
|
|
1019
|
-
return this.execMultipleResult(
|
|
1020
|
-
JSON.stringify(requestDeviceOptions)
|
|
1031
|
+
return this.execMultipleResult("startScan", [
|
|
1032
|
+
JSON.stringify(requestDeviceOptions),
|
|
1021
1033
|
]);
|
|
1022
1034
|
};
|
|
1023
1035
|
IoTizeBleCordovaPlugin.prototype.stopScan = function () {
|
|
1024
|
-
return this.execSingleResult(
|
|
1036
|
+
return this.execSingleResult("stopScan", []);
|
|
1025
1037
|
};
|
|
1026
|
-
IoTizeBleCordovaPlugin.prototype.connect = function (deviceId) {
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1038
|
+
IoTizeBleCordovaPlugin.prototype.connect = function (deviceId, enableBleIfNot) {
|
|
1039
|
+
var _this = this;
|
|
1040
|
+
if (enableBleIfNot === void 0) { enableBleIfNot = true; }
|
|
1041
|
+
return this.askBleEnable(enableBleIfNot).pipe(operators.switchMap(function () {
|
|
1042
|
+
return _this.execMultipleResult("connect", [deviceId]).pipe(operators.map(function (state) {
|
|
1043
|
+
if (!(state in api.ConnectionState)) {
|
|
1044
|
+
console.warn("Plugin native code returned an invalid connection state: \"" + state + "\".");
|
|
1045
|
+
}
|
|
1046
|
+
return utility.safeEnumValue(api.ConnectionState, state);
|
|
1047
|
+
}));
|
|
1033
1048
|
}));
|
|
1034
1049
|
};
|
|
1050
|
+
IoTizeBleCordovaPlugin.prototype.askBleEnable = function (askEnable) {
|
|
1051
|
+
var _this = this;
|
|
1052
|
+
return rxjs.defer(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
1053
|
+
return __generator(this, function (_a) {
|
|
1054
|
+
switch (_a.label) {
|
|
1055
|
+
case 0:
|
|
1056
|
+
if (!askEnable) return [3 /*break*/, 3];
|
|
1057
|
+
return [4 /*yield*/, this.checkAvailable()];
|
|
1058
|
+
case 1:
|
|
1059
|
+
if (!!(_a.sent())) return [3 /*break*/, 3];
|
|
1060
|
+
return [4 /*yield*/, this.requestEnableBle()];
|
|
1061
|
+
case 2:
|
|
1062
|
+
_a.sent();
|
|
1063
|
+
_a.label = 3;
|
|
1064
|
+
case 3: return [2 /*return*/];
|
|
1065
|
+
}
|
|
1066
|
+
});
|
|
1067
|
+
}); });
|
|
1068
|
+
};
|
|
1035
1069
|
IoTizeBleCordovaPlugin.prototype.requestMTU = function (deviceId, mtu) {
|
|
1036
|
-
return this.execSingleResult(
|
|
1070
|
+
return this.execSingleResult("requestMTU", [deviceId, mtu]);
|
|
1037
1071
|
};
|
|
1038
|
-
IoTizeBleCordovaPlugin.prototype.connectAndDiscoverTapServices = function (deviceId) {
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1072
|
+
IoTizeBleCordovaPlugin.prototype.connectAndDiscoverTapServices = function (deviceId, enableBleIfNot) {
|
|
1073
|
+
var _this = this;
|
|
1074
|
+
if (enableBleIfNot === void 0) { enableBleIfNot = true; }
|
|
1075
|
+
return this.askBleEnable(enableBleIfNot).pipe(operators.switchMap(function () {
|
|
1076
|
+
return _this.execMultipleResult("connectAndDiscoverTapServices", [deviceId]).pipe(operators.map(function (state) {
|
|
1077
|
+
if (!(state in api.ConnectionState)) {
|
|
1078
|
+
console.warn("Plugin native code returned an invalid connection state: \"" + state + "\".");
|
|
1079
|
+
}
|
|
1080
|
+
return utility.safeEnumValue(api.ConnectionState, state);
|
|
1081
|
+
}));
|
|
1045
1082
|
}));
|
|
1046
1083
|
};
|
|
1047
1084
|
IoTizeBleCordovaPlugin.prototype.disConnect = function (deviceId) {
|
|
1048
|
-
return this.execSingleResult(
|
|
1085
|
+
return this.execSingleResult("disConnect", [deviceId]);
|
|
1049
1086
|
};
|
|
1050
1087
|
IoTizeBleCordovaPlugin.prototype.close = function (deviceId) {
|
|
1051
|
-
return this.execSingleResult(
|
|
1088
|
+
return this.execSingleResult("close", [deviceId]);
|
|
1052
1089
|
};
|
|
1053
1090
|
IoTizeBleCordovaPlugin.prototype.isConnected = function (deviceId) {
|
|
1054
|
-
return this.execSingleResult(
|
|
1091
|
+
return this.execSingleResult("isConnected", [deviceId]);
|
|
1055
1092
|
};
|
|
1056
1093
|
IoTizeBleCordovaPlugin.prototype.send = function (deviceId, data) {
|
|
1057
1094
|
return __awaiter(this, void 0, void 0, function () {
|
|
1058
1095
|
var hexString;
|
|
1059
1096
|
return __generator(this, function (_a) {
|
|
1060
1097
|
switch (_a.label) {
|
|
1061
|
-
case 0: return [4 /*yield*/, this.execSingleResult(
|
|
1098
|
+
case 0: return [4 /*yield*/, this.execSingleResult("sendRequest", [
|
|
1099
|
+
deviceId,
|
|
1100
|
+
byteConverter.bufferToHexString(data),
|
|
1101
|
+
])];
|
|
1062
1102
|
case 1:
|
|
1063
1103
|
hexString = _a.sent();
|
|
1064
1104
|
return [2 /*return*/, hexStringToBuffer(hexString)];
|
|
@@ -1067,30 +1107,29 @@
|
|
|
1067
1107
|
});
|
|
1068
1108
|
};
|
|
1069
1109
|
IoTizeBleCordovaPlugin.prototype.getLastError = function () {
|
|
1070
|
-
return this.execSingleResult(
|
|
1110
|
+
return this.execSingleResult("getLastError", []);
|
|
1071
1111
|
};
|
|
1072
1112
|
IoTizeBleCordovaPlugin.prototype.characteristicStartNotification = function (deviceId, serviceId, characId) {
|
|
1073
|
-
return this.execSingleResult(
|
|
1113
|
+
return this.execSingleResult("characteristicStartNotification", [
|
|
1074
1114
|
deviceId,
|
|
1075
1115
|
serviceId,
|
|
1076
|
-
characId
|
|
1116
|
+
characId,
|
|
1077
1117
|
]);
|
|
1078
1118
|
};
|
|
1079
1119
|
IoTizeBleCordovaPlugin.prototype.characteristicChanged = function (deviceId, serviceId, characId) {
|
|
1080
|
-
return this.execMultipleResult(
|
|
1120
|
+
return this.execMultipleResult("characteristicChanged", [
|
|
1081
1121
|
deviceId,
|
|
1082
1122
|
serviceId,
|
|
1083
|
-
characId
|
|
1084
|
-
])
|
|
1085
|
-
.pipe(operators.map(function (hexString) {
|
|
1123
|
+
characId,
|
|
1124
|
+
]).pipe(operators.map(function (hexString) {
|
|
1086
1125
|
return hexStringToBuffer(hexString);
|
|
1087
1126
|
}));
|
|
1088
1127
|
};
|
|
1089
1128
|
IoTizeBleCordovaPlugin.prototype.characteristicStopNotification = function (deviceId, serviceId, characId) {
|
|
1090
|
-
return this.execSingleResult(
|
|
1129
|
+
return this.execSingleResult("characteristicStopNotification", [
|
|
1091
1130
|
deviceId,
|
|
1092
1131
|
serviceId,
|
|
1093
|
-
characId
|
|
1132
|
+
characId,
|
|
1094
1133
|
]);
|
|
1095
1134
|
};
|
|
1096
1135
|
IoTizeBleCordovaPlugin.prototype.characteristicReadValue = function (deviceId, serviceId, characId) {
|
|
@@ -1098,11 +1137,7 @@
|
|
|
1098
1137
|
var hexString;
|
|
1099
1138
|
return __generator(this, function (_a) {
|
|
1100
1139
|
switch (_a.label) {
|
|
1101
|
-
case 0: return [4 /*yield*/, this.execSingleResult(
|
|
1102
|
-
deviceId,
|
|
1103
|
-
serviceId,
|
|
1104
|
-
characId
|
|
1105
|
-
])];
|
|
1140
|
+
case 0: return [4 /*yield*/, this.execSingleResult("characteristicRead", [deviceId, serviceId, characId])];
|
|
1106
1141
|
case 1:
|
|
1107
1142
|
hexString = _a.sent();
|
|
1108
1143
|
return [2 /*return*/, hexStringToBuffer(hexString)];
|
|
@@ -1111,19 +1146,19 @@
|
|
|
1111
1146
|
});
|
|
1112
1147
|
};
|
|
1113
1148
|
IoTizeBleCordovaPlugin.prototype.characteristicWrite = function (deviceId, serviceId, characId, data) {
|
|
1114
|
-
return this.execSingleResult(
|
|
1149
|
+
return this.execSingleResult("characteristicWrite", [
|
|
1115
1150
|
deviceId,
|
|
1116
1151
|
serviceId,
|
|
1117
1152
|
characId,
|
|
1118
|
-
byteConverter.bufferToHexString(data)
|
|
1153
|
+
byteConverter.bufferToHexString(data),
|
|
1119
1154
|
]);
|
|
1120
1155
|
};
|
|
1121
1156
|
IoTizeBleCordovaPlugin.prototype.characteristicWriteWithoutResponse = function (deviceId, serviceId, characId, data) {
|
|
1122
|
-
return this.execSingleResult(
|
|
1157
|
+
return this.execSingleResult("characteristicWriteWithoutResponse", [
|
|
1123
1158
|
deviceId,
|
|
1124
1159
|
serviceId,
|
|
1125
1160
|
characId,
|
|
1126
|
-
byteConverter.bufferToHexString(data)
|
|
1161
|
+
byteConverter.bufferToHexString(data),
|
|
1127
1162
|
]);
|
|
1128
1163
|
};
|
|
1129
1164
|
IoTizeBleCordovaPlugin.prototype.discoverServices = function (deviceId) {
|
|
@@ -1131,9 +1166,7 @@
|
|
|
1131
1166
|
var services;
|
|
1132
1167
|
return __generator(this, function (_a) {
|
|
1133
1168
|
switch (_a.label) {
|
|
1134
|
-
case 0: return [4 /*yield*/, this.execSingleResult(
|
|
1135
|
-
deviceId
|
|
1136
|
-
])];
|
|
1169
|
+
case 0: return [4 /*yield*/, this.execSingleResult("discoverServices", [deviceId])];
|
|
1137
1170
|
case 1:
|
|
1138
1171
|
services = _a.sent();
|
|
1139
1172
|
return [2 /*return*/, services];
|
|
@@ -1145,7 +1178,7 @@
|
|
|
1145
1178
|
return new Promise(function (resolve, reject) {
|
|
1146
1179
|
cordova.exec(resolve, function (errObject) {
|
|
1147
1180
|
reject(objectErrorToError(errObject));
|
|
1148
|
-
},
|
|
1181
|
+
}, "BLECom", methodName, args);
|
|
1149
1182
|
});
|
|
1150
1183
|
};
|
|
1151
1184
|
IoTizeBleCordovaPlugin.prototype.execMultipleResult = function (methodName, args) {
|
|
@@ -1154,13 +1187,13 @@
|
|
|
1154
1187
|
subject.next(data);
|
|
1155
1188
|
}, function (err) {
|
|
1156
1189
|
subject.error(objectErrorToError(err));
|
|
1157
|
-
},
|
|
1190
|
+
}, "BLECom", methodName, args);
|
|
1158
1191
|
return subject.asObservable();
|
|
1159
1192
|
};
|
|
1160
1193
|
return IoTizeBleCordovaPlugin;
|
|
1161
1194
|
}());
|
|
1162
1195
|
function objectErrorToError(errObject) {
|
|
1163
|
-
if (typeof errObject !==
|
|
1196
|
+
if (typeof errObject !== "object" || !errObject.code || !errObject.message) {
|
|
1164
1197
|
return CordovaBLEError.invalidErrorResult(errObject);
|
|
1165
1198
|
}
|
|
1166
1199
|
if (!CordovaBLEError.isValidErrorCode(errObject.code)) {
|
|
@@ -1179,9 +1212,9 @@
|
|
|
1179
1212
|
exports.CordovaPeripheralAdapter = CordovaPeripheralAdapter;
|
|
1180
1213
|
exports.CordovaServiceAdapter = CordovaServiceAdapter;
|
|
1181
1214
|
exports.getIoTizeBleCordovaPlugin = getIoTizeBleCordovaPlugin;
|
|
1182
|
-
exports
|
|
1215
|
+
exports["ɵc"] = IoTizeBleCordovaPlugin;
|
|
1183
1216
|
|
|
1184
1217
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
1185
1218
|
|
|
1186
|
-
}))
|
|
1219
|
+
}));
|
|
1187
1220
|
//# sourceMappingURL=iotize-device-com-ble.cordova.umd.js.map
|