@iotize/device-com-ble.cordova 3.7.2 → 4.0.0-alpha.1
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/CHANGELOG.md +143 -0
- package/package.json +7 -21
- package/packages/common/byte-converter/src/lib/byte-converter.d.ts +30 -0
- package/packages/common/byte-converter/src/public_api.d.ts +1 -0
- package/packages/common/byte-stream/src/lib/kaitai/kaitai-stream-reader.d.ts +155 -0
- package/packages/common/byte-stream/src/lib/kaitai/kaitai-stream-writer.d.ts +76 -0
- package/packages/common/byte-stream/src/lib/kaitai/kaitai-stream.d.ts +209 -0
- package/packages/common/byte-stream/src/lib/utility.d.ts +16 -0
- package/packages/common/byte-stream/src/public_api.d.ts +4 -0
- package/packages/common/converter/api/src/lib/converter.interface.d.ts +3 -0
- package/packages/common/converter/api/src/lib/decoder.interface.d.ts +4 -0
- package/packages/common/converter/api/src/lib/encoder-decoder.interface.d.ts +5 -0
- package/packages/common/converter/api/src/lib/encoder.interface.d.ts +4 -0
- package/packages/common/converter/api/src/public_api.d.ts +4 -0
- package/packages/common/debug/src/lib/debug.d.ts +7 -0
- package/packages/common/debug/src/public_api.d.ts +1 -0
- package/packages/common/error/src/lib/base-error.d.ts +3 -0
- package/packages/common/error/src/lib/code-error.d.ts +9 -0
- package/packages/common/error/src/public_api.d.ts +2 -0
- package/packages/common/promise/src/lib/promise-delay.d.ts +6 -0
- package/packages/common/promise/src/lib/promise-serial.d.ts +6 -0
- package/packages/common/promise/src/lib/promise-timeout.d.ts +10 -0
- package/packages/common/promise/src/public_api.d.ts +3 -0
- package/packages/common/task-manager/src/lib/cancelable-task.d.ts +22 -0
- package/packages/common/task-manager/src/lib/debug.d.ts +2 -0
- package/packages/common/task-manager/src/lib/definitions.d.ts +16 -0
- package/packages/common/task-manager/src/lib/step-operations.d.ts +112 -0
- package/packages/common/task-manager/src/lib/task-queue.d.ts +28 -0
- package/packages/common/task-manager/src/public_api.d.ts +4 -0
- package/packages/common/tlv/src/lib/debug.d.ts +2 -0
- package/packages/common/tlv/src/lib/tlv.d.ts +65 -0
- package/packages/common/tlv/src/public_api.d.ts +1 -0
- package/packages/common/utility/src/lib/assert-error.d.ts +1 -0
- package/packages/common/utility/src/lib/deep-copy.d.ts +14 -0
- package/packages/common/utility/src/lib/enum-util.d.ts +23 -0
- package/packages/common/utility/src/lib/sleep.d.ts +1 -0
- package/packages/common/utility/src/lib/utility.d.ts +1 -0
- package/packages/common/utility/src/public_api.d.ts +5 -0
- package/{lib → packages/device-com-ble.cordova/src/lib}/ble-com-protocol.d.ts +20 -20
- package/{lib → packages/device-com-ble.cordova/src/lib}/cordova-ble-error.d.ts +29 -29
- package/{lib → packages/device-com-ble.cordova/src/lib}/cordova-interface.d.ts +5 -5
- package/{lib → packages/device-com-ble.cordova/src/lib}/cordova-service-adapter.d.ts +58 -58
- package/{lib → packages/device-com-ble.cordova/src/lib}/definitions.d.ts +43 -43
- package/{lib → packages/device-com-ble.cordova/src/lib}/iotize-ble-cordova-plugin.d.ts +27 -27
- package/packages/device-com-ble.cordova/src/lib/logger.d.ts +2 -0
- package/{lib → packages/device-com-ble.cordova/src/lib}/scanner.d.ts +55 -55
- package/{lib → packages/device-com-ble.cordova/src/lib}/utility.d.ts +6 -6
- package/packages/device-com-ble.cordova/src/plugin.d.ts +7 -0
- package/packages/tap/client/api/src/lib/converter/definitions.d.ts +7 -0
- package/packages/tap/client/api/src/lib/definitions.d.ts +20 -0
- package/packages/tap/client/api/src/lib/generated/models.d.ts +150 -0
- package/packages/tap/client/api/src/lib/result-code.d.ts +170 -0
- package/packages/tap/client/api/src/lib/tap-client.interface.d.ts +28 -0
- package/packages/tap/client/api/src/public_api.d.ts +6 -0
- package/packages/tap/client/impl/src/lib/apdu/tap-apdu-request-builder.d.ts +2 -0
- package/packages/tap/client/impl/src/lib/converter/body/array-converter.d.ts +15 -0
- package/packages/tap/client/impl/src/lib/converter/body/boolean-decoder.d.ts +12 -0
- package/packages/tap/client/impl/src/lib/converter/body/byte-swap-converter.d.ts +26 -0
- package/packages/tap/client/impl/src/lib/converter/body/enum-converter.d.ts +23 -0
- package/packages/tap/client/impl/src/lib/converter/body/float-converter.d.ts +20 -0
- package/packages/tap/client/impl/src/lib/converter/body/hex-string.d.ts +8 -0
- package/packages/tap/client/impl/src/lib/converter/body/ipv4-string-decoder.d.ts +8 -0
- package/packages/tap/client/impl/src/lib/converter/body/mac-address-string-decoder.d.ts +7 -0
- package/packages/tap/client/impl/src/lib/converter/body/multiple-mask-decoder.d.ts +15 -0
- package/packages/tap/client/impl/src/lib/converter/body/number-converter.d.ts +54 -0
- package/packages/tap/client/impl/src/lib/converter/body/pipe-converter.d.ts +29 -0
- package/packages/tap/client/impl/src/lib/converter/body/string-converter.d.ts +44 -0
- package/packages/tap/client/impl/src/lib/converter/body/string-version-converter.d.ts +6 -0
- package/packages/tap/client/impl/src/lib/converter/body/tlv-bundle-converter.d.ts +22 -0
- package/packages/tap/client/impl/src/lib/converter/body/uniq-mask-decoder.d.ts +29 -0
- package/packages/tap/client/impl/src/lib/converter/crypted-frame-converter.d.ts +13 -0
- package/packages/tap/client/impl/src/lib/converter/error.d.ts +15 -0
- package/packages/tap/client/impl/src/lib/converter/tlv-converter.d.ts +9 -0
- package/packages/tap/client/impl/src/lib/converters.d.ts +13 -0
- package/packages/tap/client/impl/src/lib/debug.d.ts +2 -0
- package/packages/tap/client/impl/src/lib/error-detection/checksum.d.ts +3 -0
- package/packages/tap/client/impl/src/lib/error-detection/crc.d.ts +12 -0
- package/packages/tap/client/impl/src/lib/frame/import-adapter.d.ts +1 -0
- package/packages/tap/client/impl/src/lib/frame/tap-stream-core.d.ts +41 -0
- package/packages/tap/client/impl/src/lib/frame/tap-stream-encoder-decoder.d.ts +5 -0
- package/packages/tap/client/impl/src/lib/frame/tap-stream-extended.d.ts +2 -0
- package/packages/tap/client/impl/src/lib/generated/converter-stream-extension.d.ts +30 -0
- package/packages/tap/client/impl/src/lib/generated/converter.d.ts +35 -0
- package/packages/tap/client/impl/src/lib/generated-adapter.d.ts +2 -0
- package/packages/tap/client/impl/src/lib/interceptors/interceptor-chain.d.ts +9 -0
- package/packages/tap/client/impl/src/lib/model/models.extensions.d.ts +2 -0
- package/packages/tap/client/impl/src/lib/request/tap-request-builder.d.ts +13 -0
- package/packages/tap/client/impl/src/lib/request/tap-request-helper.d.ts +9 -0
- package/packages/tap/client/impl/src/lib/response/result-code-translation.d.ts +170 -0
- package/packages/tap/client/impl/src/lib/response/tap-response-builder.d.ts +6 -0
- package/packages/tap/client/impl/src/lib/response/tap-response-status-to-string.d.ts +1 -0
- package/packages/tap/client/impl/src/lib/tap-client-error.d.ts +33 -0
- package/packages/tap/client/impl/src/lib/tap-client.d.ts +74 -0
- package/packages/tap/client/impl/src/public_api.d.ts +39 -0
- package/packages/tap/protocol/api/src/lib/com-protocol.interface.d.ts +76 -0
- package/packages/tap/protocol/api/src/lib/definitions.d.ts +6 -0
- package/packages/tap/protocol/api/src/public_api.d.ts +2 -0
- package/packages/tap/protocol/ble/common/src/lib/abstract-ble-protocol.d.ts +49 -0
- package/packages/tap/protocol/ble/common/src/lib/ble-config.d.ts +20 -0
- package/packages/tap/protocol/ble/common/src/lib/ble-packet-builder.d.ts +31 -0
- package/packages/tap/protocol/ble/common/src/lib/ble-packet-splitter.d.ts +34 -0
- package/packages/tap/protocol/ble/common/src/lib/debug.d.ts +2 -0
- package/packages/tap/protocol/ble/common/src/lib/errors.d.ts +28 -0
- package/packages/tap/protocol/ble/common/src/lib/universal-ble-protocol-adapter.d.ts +146 -0
- package/packages/tap/protocol/ble/common/src/lib/util.d.ts +1 -0
- package/packages/tap/protocol/ble/common/src/public_api.d.ts +6 -0
- package/packages/tap/protocol/core/src/lib/abstract-com-protocol.d.ts +23 -0
- package/packages/tap/protocol/core/src/lib/debug.d.ts +2 -0
- package/packages/tap/protocol/core/src/lib/queue-com-protocol.d.ts +35 -0
- package/packages/tap/protocol/core/src/public_api.d.ts +2 -0
- package/packages/tap/scanner/api/src/lib/definitions.d.ts +35 -0
- package/packages/tap/scanner/api/src/public_api.d.ts +1 -0
- package/plugin.cjs +9057 -0
- package/plugin.js +9047 -0
- package/plugin.xml +8 -3
- package/src/android/build.gradle +2 -11
- package/src/android/libs/iotize-device-com-ble-1.0.0-alpha.9.aar +0 -0
- package/src/windows/iotize-ble-com.js +11 -11
- package/LICENSE +0 -23
- package/README.md +0 -174
- package/bundles/iotize-device-com-ble.cordova.umd.js +0 -1418
- package/bundles/iotize-device-com-ble.cordova.umd.js.map +0 -1
- package/bundles/iotize-device-com-ble.cordova.umd.min.js +0 -2
- package/bundles/iotize-device-com-ble.cordova.umd.min.js.map +0 -1
- package/esm2015/iotize-device-com-ble.cordova.js +0 -6
- package/esm2015/iotize-device-com-ble.cordova.js.map +0 -1
- package/esm2015/iotize-device-com-ble.cordova.metadata.json +0 -1
- package/esm2015/iotize-device-com-ble.cordova.ngsummary.json +0 -1
- package/esm2015/lib/ble-com-protocol.js +0 -76
- package/esm2015/lib/ble-com-protocol.js.map +0 -1
- package/esm2015/lib/ble-com-protocol.metadata.json +0 -1
- package/esm2015/lib/ble-com-protocol.ngsummary.json +0 -1
- package/esm2015/lib/cordova-ble-error.js +0 -36
- package/esm2015/lib/cordova-ble-error.js.map +0 -1
- package/esm2015/lib/cordova-ble-error.metadata.json +0 -1
- package/esm2015/lib/cordova-ble-error.ngsummary.json +0 -1
- package/esm2015/lib/cordova-interface.js +0 -2
- package/esm2015/lib/cordova-interface.js.map +0 -1
- package/esm2015/lib/cordova-interface.metadata.json +0 -1
- package/esm2015/lib/cordova-interface.ngsummary.json +0 -1
- package/esm2015/lib/cordova-service-adapter.js +0 -214
- package/esm2015/lib/cordova-service-adapter.js.map +0 -1
- package/esm2015/lib/cordova-service-adapter.metadata.json +0 -1
- package/esm2015/lib/cordova-service-adapter.ngsummary.json +0 -1
- package/esm2015/lib/definitions.js +0 -2
- package/esm2015/lib/definitions.js.map +0 -1
- package/esm2015/lib/definitions.metadata.json +0 -1
- package/esm2015/lib/definitions.ngsummary.json +0 -1
- package/esm2015/lib/iotize-ble-cordova-plugin.js +0 -170
- package/esm2015/lib/iotize-ble-cordova-plugin.js.map +0 -1
- package/esm2015/lib/iotize-ble-cordova-plugin.metadata.json +0 -1
- package/esm2015/lib/iotize-ble-cordova-plugin.ngsummary.json +0 -1
- package/esm2015/lib/logger.js +0 -3
- package/esm2015/lib/logger.js.map +0 -1
- package/esm2015/lib/logger.metadata.json +0 -1
- package/esm2015/lib/logger.ngsummary.json +0 -1
- package/esm2015/lib/scanner.js +0 -151
- package/esm2015/lib/scanner.js.map +0 -1
- package/esm2015/lib/scanner.metadata.json +0 -1
- package/esm2015/lib/scanner.ngsummary.json +0 -1
- package/esm2015/lib/utility.js +0 -26
- package/esm2015/lib/utility.js.map +0 -1
- package/esm2015/lib/utility.metadata.json +0 -1
- package/esm2015/lib/utility.ngsummary.json +0 -1
- package/esm2015/public_api.js +0 -5
- package/esm2015/public_api.js.map +0 -1
- package/esm2015/public_api.metadata.json +0 -1
- package/esm2015/public_api.ngsummary.json +0 -1
- package/fesm2015/iotize-device-com-ble.cordova.js +0 -660
- package/fesm2015/iotize-device-com-ble.cordova.js.map +0 -1
- package/iotize-device-com-ble.cordova.d.ts +0 -6
- package/iotize-device-com-ble.cordova.metadata.json +0 -1
- package/lib/logger.d.ts +0 -1
- package/public_api.d.ts +0 -5
- package/www/plugin.js +0 -2
- package/www/plugin.js.LICENSE.txt +0 -14
package/plugin.xml
CHANGED
|
@@ -7,11 +7,13 @@
|
|
|
7
7
|
<keywords>bluetooth, BLE, bluetooth low energy, TapNLink, IoTize</keywords>
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
<js-module src="
|
|
11
|
-
<
|
|
10
|
+
<js-module src="plugin.cjs" name="iotizeBLE">
|
|
11
|
+
<runs />
|
|
12
12
|
</js-module>
|
|
13
13
|
|
|
14
14
|
<platform name="android">
|
|
15
|
+
<dependency id="@iotize/device-com-android-shared.cordova" version="0.0.3"/>
|
|
16
|
+
|
|
15
17
|
<config-file target="res/xml/config.xml" parent="/*">
|
|
16
18
|
<feature name="BLECom">
|
|
17
19
|
<param name="android-package" value="com.iotize.plugin.cordova.ble.BLECom"/>
|
|
@@ -19,6 +21,9 @@
|
|
|
19
21
|
</config-file>
|
|
20
22
|
<framework src="src/android/build.gradle" custom="true" type="gradleReference" />
|
|
21
23
|
<source-file src="src/android/src/ble" target-dir="java/com/iotize/plugin/cordova"/>
|
|
24
|
+
|
|
25
|
+
<source-file src="src/android/libs/iotize-device-com-ble-1.0.0-alpha.9.aar" target-dir="libs"/>
|
|
26
|
+
|
|
22
27
|
<config-file target="AndroidManifest.xml" parent="/manifest">
|
|
23
28
|
<uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30" />
|
|
24
29
|
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" android:maxSdkVersion="30" />
|
|
@@ -65,4 +70,4 @@
|
|
|
65
70
|
</config-file>
|
|
66
71
|
</platform>
|
|
67
72
|
|
|
68
|
-
</plugin>
|
|
73
|
+
</plugin>
|
package/src/android/build.gradle
CHANGED
|
@@ -3,24 +3,15 @@ repositories{
|
|
|
3
3
|
flatDir {
|
|
4
4
|
dirs 'libs'
|
|
5
5
|
}
|
|
6
|
-
maven {
|
|
7
|
-
url "http://repo.iotize.com/artifactory/gradle-release"
|
|
8
|
-
allowInsecureProtocol = true
|
|
9
|
-
content {
|
|
10
|
-
includeGroupByRegex "com\\.iotize\\.android"
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
6
|
}
|
|
14
7
|
|
|
15
8
|
dependencies {
|
|
16
9
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.3.61"
|
|
17
10
|
implementation 'org.apache.commons:commons-collections4:4.4'
|
|
18
|
-
implementation 'com.iotize.android:iotize-core:1.0.0-alpha.9'
|
|
19
|
-
implementation 'com.iotize.android:iotize-client:1.0.0-alpha.9'
|
|
20
|
-
implementation 'com.iotize.android:iotize-device-api:1.0.0-alpha.9'
|
|
21
|
-
implementation 'com.iotize.android:iotize-device-com-ble:1.0.0-alpha.9'
|
|
22
11
|
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
|
|
23
12
|
implementation 'com.google.code.gson:gson:2.8.5'
|
|
13
|
+
|
|
14
|
+
implementation fileTree(dir: 'libs', include: ['*.jar','*.aar'])
|
|
24
15
|
}
|
|
25
16
|
|
|
26
17
|
android {
|
|
Binary file
|
|
@@ -30,10 +30,10 @@ function handleConnectionErrorCallback() {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
cordova.commandProxy.add(
|
|
33
|
+
cordova.commandProxy.add('BLECom', {
|
|
34
34
|
getLastError: function (successCallback, errorCallback) {
|
|
35
35
|
if (!checkProxy()) {
|
|
36
|
-
errorCallback(
|
|
36
|
+
errorCallback('Internal Error!');
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
39
|
|
|
@@ -42,7 +42,7 @@ cordova.commandProxy.add("BLECom", {
|
|
|
42
42
|
|
|
43
43
|
startScan: function (successCallback, errorCallback) {
|
|
44
44
|
if (!checkProxy()) {
|
|
45
|
-
errorCallback(
|
|
45
|
+
errorCallback('Internal Error!');
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
48
|
|
|
@@ -56,13 +56,13 @@ cordova.commandProxy.add("BLECom", {
|
|
|
56
56
|
|
|
57
57
|
stopScan: function (successCallback, errorCallback) {
|
|
58
58
|
if (!checkProxy()) {
|
|
59
|
-
errorCallback(
|
|
59
|
+
errorCallback('Internal Error!');
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
var res = iotizeProxy.stopScan();
|
|
64
64
|
if (res == true) {
|
|
65
|
-
successCallback(
|
|
65
|
+
successCallback('Ok');
|
|
66
66
|
} else {
|
|
67
67
|
errorCallback(iotizeProxy.getLastError());
|
|
68
68
|
}
|
|
@@ -70,7 +70,7 @@ cordova.commandProxy.add("BLECom", {
|
|
|
70
70
|
|
|
71
71
|
connect: async function (successCallback, errorCallback, device) {
|
|
72
72
|
if (!checkProxy()) {
|
|
73
|
-
errorCallback(
|
|
73
|
+
errorCallback('Internal Error!');
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
76
|
|
|
@@ -87,7 +87,7 @@ cordova.commandProxy.add("BLECom", {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
if (success) {
|
|
90
|
-
successCallback(
|
|
90
|
+
successCallback('Ok');
|
|
91
91
|
} else {
|
|
92
92
|
handleConnectionErrorCallback();
|
|
93
93
|
}
|
|
@@ -95,7 +95,7 @@ cordova.commandProxy.add("BLECom", {
|
|
|
95
95
|
|
|
96
96
|
disConnect: async function (successCallback, errorCallback, device) {
|
|
97
97
|
if (!checkProxy()) {
|
|
98
|
-
errorCallback(
|
|
98
|
+
errorCallback('Internal Error!');
|
|
99
99
|
return;
|
|
100
100
|
}
|
|
101
101
|
var success = false;
|
|
@@ -106,7 +106,7 @@ cordova.commandProxy.add("BLECom", {
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
if (success) {
|
|
109
|
-
successCallback(
|
|
109
|
+
successCallback('Ok');
|
|
110
110
|
} else {
|
|
111
111
|
errorCallback(iotizeProxy.getLastError());
|
|
112
112
|
}
|
|
@@ -114,7 +114,7 @@ cordova.commandProxy.add("BLECom", {
|
|
|
114
114
|
|
|
115
115
|
isConnected: async function (successCallback, errorCallback, device) {
|
|
116
116
|
if (!checkProxy()) {
|
|
117
|
-
errorCallback(
|
|
117
|
+
errorCallback('Internal Error!');
|
|
118
118
|
return;
|
|
119
119
|
}
|
|
120
120
|
var success = false;
|
|
@@ -145,7 +145,7 @@ cordova.commandProxy.add("BLECom", {
|
|
|
145
145
|
|
|
146
146
|
sendRequest: async function (successCallback, errorCallback, request) {
|
|
147
147
|
if (!checkProxy()) {
|
|
148
|
-
errorCallback(
|
|
148
|
+
errorCallback('Internal Error!');
|
|
149
149
|
return;
|
|
150
150
|
}
|
|
151
151
|
|
package/LICENSE
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
Copyright 2018 IoTize SAS
|
|
2
|
-
http://iotize.com
|
|
3
|
-
|
|
4
|
-
MIT License
|
|
5
|
-
|
|
6
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
7
|
-
a copy of this software and associated documentation files (the
|
|
8
|
-
"Software"), to deal in the Software without restriction, including
|
|
9
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
10
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
11
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
12
|
-
the following conditions:
|
|
13
|
-
|
|
14
|
-
The above copyright notice and this permission notice shall be
|
|
15
|
-
included in all copies or substantial portions of the Software.
|
|
16
|
-
|
|
17
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
18
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
19
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
20
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
21
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
22
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
23
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
DELETED
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
# Bluetooth Low Energy (BLE) for IoTize devices Plugin for Apache Cordova
|
|
2
|
-
|
|
3
|
-
This plugin enables communication between a mobile and a BLE enabled IOTIZE device.
|
|
4
|
-
|
|
5
|
-
The plugin provides a simple [JavaScript API](#api) for iOS, Android and Windows.
|
|
6
|
-
|
|
7
|
-
- Scan for ble iotize devices
|
|
8
|
-
- Connect to a device
|
|
9
|
-
- Send a Request and returns the reponse from the device
|
|
10
|
-
|
|
11
|
-
## Supported Platforms
|
|
12
|
-
|
|
13
|
-
- iOS
|
|
14
|
-
- Android ()
|
|
15
|
-
- Windows (10)
|
|
16
|
-
|
|
17
|
-
# Installing
|
|
18
|
-
|
|
19
|
-
### Cordova
|
|
20
|
-
|
|
21
|
-
$ cordova plugin add @iotize/device-com-ble.cordova
|
|
22
|
-
$ ionic cordova plugin add @iotize/device-com-ble.cordova
|
|
23
|
-
for iOS since the plugin is in swift language, before using iotize-ble plugin , cordova-plugin-add-swift-support:https://github.com/akofman/cordova-plugin-add-swift-support should be installed.
|
|
24
|
-
|
|
25
|
-
# API
|
|
26
|
-
|
|
27
|
-
## Methods
|
|
28
|
-
|
|
29
|
-
- [iotize-ble.checkAvailable](#checkAvailable)
|
|
30
|
-
- [iotize-ble.startScan](#startScan)
|
|
31
|
-
- [iotize-ble.stopScan](#stopScan)
|
|
32
|
-
- [iotize-ble.connect](#connect)
|
|
33
|
-
- [iotize-ble.disConnect](#disConnect)
|
|
34
|
-
- [iotize-ble.isConnected](#isConnected)
|
|
35
|
-
- [iotize-ble.send](#send)
|
|
36
|
-
|
|
37
|
-
## checkAvailable
|
|
38
|
-
|
|
39
|
-
Check availability of BLE.
|
|
40
|
-
|
|
41
|
-
iotize-ble.checkAvailable(success, failure);
|
|
42
|
-
|
|
43
|
-
### Description
|
|
44
|
-
|
|
45
|
-
Function `checkAvailable` returns true or false upon the availability of BLE on device.
|
|
46
|
-
|
|
47
|
-
For Android, BLE is available from version 4.3.
|
|
48
|
-
iOS platform has had support for BLE since iPhone 4s and iOs 5.
|
|
49
|
-
For Windows, BLE GATT and GAP roles have been introduced in Windows 10 version 1703.
|
|
50
|
-
|
|
51
|
-
## startScan
|
|
52
|
-
|
|
53
|
-
Start scanning for Iotize BLE devices.
|
|
54
|
-
|
|
55
|
-
iotize-ble.startScan(success, failure);
|
|
56
|
-
|
|
57
|
-
### Description
|
|
58
|
-
|
|
59
|
-
Function `startScan` scans for IoTize BLE devices. Scanning will continue until `stopScan` is called or a connection is established. The success callback is called each time a new peripheral is discovered.
|
|
60
|
-
|
|
61
|
-
Advertising information is different depending on your platform. For Android and Windows, the device is identified with its MAC address and for iOS the device is identified with a unique UUID. The success callback is called at each discovery with returning an object containing the following information:
|
|
62
|
-
|
|
63
|
-
- name: name of the peripheral.
|
|
64
|
-
- address: UUID or MAC address of the peripheral.
|
|
65
|
-
- rssi: the threshold RSSI in dBm.
|
|
66
|
-
|
|
67
|
-
### Parameters
|
|
68
|
-
|
|
69
|
-
- **success**: Success callback function that is invoked upon each discovery. The callback is called with the device information as parameter.
|
|
70
|
-
- **failure**: Error callback function, invoked when error occurs. The error string is passed as a parameter.
|
|
71
|
-
|
|
72
|
-
## stopScan
|
|
73
|
-
|
|
74
|
-
Stop scanning for BLE peripherals.
|
|
75
|
-
|
|
76
|
-
iotize-ble.stopScan(success, failure);
|
|
77
|
-
|
|
78
|
-
### Description
|
|
79
|
-
|
|
80
|
-
Function `stopScan` stops scanning for BLE devices.
|
|
81
|
-
|
|
82
|
-
### Parameters
|
|
83
|
-
|
|
84
|
-
- **success**: Success callback function, invoked when scanning is stopped.
|
|
85
|
-
- **failure**: Error callback function, invoked when error occurs.
|
|
86
|
-
|
|
87
|
-
### Quick Example
|
|
88
|
-
|
|
89
|
-
iotize-ble.startScan([], function(device) {
|
|
90
|
-
console.log(device);
|
|
91
|
-
}, failure);
|
|
92
|
-
|
|
93
|
-
setTimeout(function() {
|
|
94
|
-
iotize-ble.stopScan(
|
|
95
|
-
function() { console.log("Scan complete"); },
|
|
96
|
-
function() { console.log("stopScan failed"); }
|
|
97
|
-
);
|
|
98
|
-
}, 2000);
|
|
99
|
-
|
|
100
|
-
## connect
|
|
101
|
-
|
|
102
|
-
Connect to a peripheral.
|
|
103
|
-
|
|
104
|
-
iotize-ble.connect(device_id, connectCallback, connectionErrorCallback);
|
|
105
|
-
|
|
106
|
-
### Description
|
|
107
|
-
|
|
108
|
-
Function `connect` connects to an iotize BLE peripheral. The connectCallback callback will be called when the connection is successful.
|
|
109
|
-
|
|
110
|
-
The connectionErrorCallback callback is called if the connection fails, or later if the peripheral disconnects for any reason. The connectionErrorCallback callback is only called when the peripheral initates the disconnection.
|
|
111
|
-
|
|
112
|
-
### Scanning before connecting
|
|
113
|
-
|
|
114
|
-
Devices should be scanned before connection. Please note that for this version only one device at a time could be connected.
|
|
115
|
-
|
|
116
|
-
### Parameters
|
|
117
|
-
|
|
118
|
-
- **device_id**: Mac address or UUID of the ble device.
|
|
119
|
-
- **connectCallback**: Connect callback function that is invoked when the connection is successful.
|
|
120
|
-
- **connectionErrorCallback**: Disconnect callback function, invoked when the peripheral disconnects or an error occurs.
|
|
121
|
-
|
|
122
|
-
## disconnect
|
|
123
|
-
|
|
124
|
-
Disconnect.
|
|
125
|
-
|
|
126
|
-
iotize-ble.disConnect(device_id, success, failure);
|
|
127
|
-
|
|
128
|
-
### Description
|
|
129
|
-
|
|
130
|
-
Function `disConnect` disconnects the selected device.
|
|
131
|
-
|
|
132
|
-
### Parameters
|
|
133
|
-
|
|
134
|
-
- **device_id**: Mac address or UUID of the device.
|
|
135
|
-
- **success**: Success callback function that is invoked when the connection is successful.
|
|
136
|
-
- **failure**: Error callback function, invoked when error occurs.
|
|
137
|
-
|
|
138
|
-
## send
|
|
139
|
-
|
|
140
|
-
sends a frame of byte to ioTize device using SPP characteristic.
|
|
141
|
-
|
|
142
|
-
iotize-ble.send(device_id, __data__, success, failure);
|
|
143
|
-
|
|
144
|
-
### Parameters
|
|
145
|
-
|
|
146
|
-
- **device_id**: Mac address or UUID of the device.
|
|
147
|
-
- **data**: binary data as a string ex:"A2CA000007010003FFFF0002"
|
|
148
|
-
- **success**: Success callback function that is invoked when the connection is successful. The result parameter is the response as a string :"45496F547A50723030343130303030313039429000"
|
|
149
|
-
- **failure**: Error callback function, invoked when error occurs.
|
|
150
|
-
|
|
151
|
-
### Quick Example
|
|
152
|
-
|
|
153
|
-
// read data from a characteristic, do something with received data
|
|
154
|
-
iotize-ble.send(
|
|
155
|
-
name,
|
|
156
|
-
data,
|
|
157
|
-
function successHandler(result) {
|
|
158
|
-
console.log("received result " + result);
|
|
159
|
-
observer.complete();
|
|
160
|
-
},
|
|
161
|
-
function errorHandler(err) {
|
|
162
|
-
observer.error(err);
|
|
163
|
-
});
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
# Testing the Plugin
|
|
167
|
-
|
|
168
|
-
# License
|
|
169
|
-
|
|
170
|
-
MIT
|
|
171
|
-
|
|
172
|
-
# Feedback
|
|
173
|
-
|
|
174
|
-
Try the code. If you find an problem or missing feature pluease contact Iotize support team .
|