@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
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated file. Do not edit
|
|
3
|
+
*/
|
|
4
|
+
export declare const ResultCodeTranslation: {
|
|
5
|
+
/**
|
|
6
|
+
* OK
|
|
7
|
+
* decimal: 0
|
|
8
|
+
*/
|
|
9
|
+
0: string;
|
|
10
|
+
/**
|
|
11
|
+
* CREATED
|
|
12
|
+
* decimal: 65
|
|
13
|
+
*/
|
|
14
|
+
65: string;
|
|
15
|
+
/**
|
|
16
|
+
* DELETED
|
|
17
|
+
* decimal: 66
|
|
18
|
+
*/
|
|
19
|
+
66: string;
|
|
20
|
+
/**
|
|
21
|
+
* CHANGED
|
|
22
|
+
* decimal: 68
|
|
23
|
+
*/
|
|
24
|
+
68: string;
|
|
25
|
+
/**
|
|
26
|
+
* CONTENT
|
|
27
|
+
* decimal: 69
|
|
28
|
+
*/
|
|
29
|
+
69: string;
|
|
30
|
+
/**
|
|
31
|
+
* BUSY
|
|
32
|
+
* decimal: 70
|
|
33
|
+
*/
|
|
34
|
+
70: string;
|
|
35
|
+
/**
|
|
36
|
+
* BAD_REQUEST
|
|
37
|
+
* decimal: 128
|
|
38
|
+
*/
|
|
39
|
+
128: string;
|
|
40
|
+
/**
|
|
41
|
+
* UNAUTHORIZED
|
|
42
|
+
* decimal: 129
|
|
43
|
+
*/
|
|
44
|
+
129: string;
|
|
45
|
+
/**
|
|
46
|
+
* NOT_FOUND
|
|
47
|
+
* decimal: 132
|
|
48
|
+
*/
|
|
49
|
+
132: string;
|
|
50
|
+
/**
|
|
51
|
+
* METHOD_NOT_ALLOWED
|
|
52
|
+
* decimal: 133
|
|
53
|
+
*/
|
|
54
|
+
133: string;
|
|
55
|
+
/**
|
|
56
|
+
* NOT_ACCEPTABLE
|
|
57
|
+
* decimal: 134
|
|
58
|
+
*/
|
|
59
|
+
134: string;
|
|
60
|
+
/**
|
|
61
|
+
* RESOURCE_LOCKED
|
|
62
|
+
* decimal: 135
|
|
63
|
+
*/
|
|
64
|
+
135: string;
|
|
65
|
+
/**
|
|
66
|
+
* INTERNAL_SERVER_ERROR
|
|
67
|
+
* decimal: 160
|
|
68
|
+
*/
|
|
69
|
+
160: string;
|
|
70
|
+
/**
|
|
71
|
+
* NOT_IMPLEMENTED
|
|
72
|
+
* decimal: 161
|
|
73
|
+
*/
|
|
74
|
+
161: string;
|
|
75
|
+
/**
|
|
76
|
+
* SERVICE_UNAVAILABLE
|
|
77
|
+
* decimal: 163
|
|
78
|
+
*/
|
|
79
|
+
163: string;
|
|
80
|
+
/**
|
|
81
|
+
* NVM_ERROR
|
|
82
|
+
* decimal: 164
|
|
83
|
+
*/
|
|
84
|
+
164: string;
|
|
85
|
+
/**
|
|
86
|
+
* UNABLE_TO_CONNECT_TO_TARGET
|
|
87
|
+
* decimal: 165
|
|
88
|
+
*/
|
|
89
|
+
165: string;
|
|
90
|
+
/**
|
|
91
|
+
* TARGET_POWER_FAILURE
|
|
92
|
+
* decimal: 166
|
|
93
|
+
*/
|
|
94
|
+
166: string;
|
|
95
|
+
/**
|
|
96
|
+
* NVM_FULL
|
|
97
|
+
* decimal: 167
|
|
98
|
+
*/
|
|
99
|
+
167: string;
|
|
100
|
+
/**
|
|
101
|
+
* DEVICE_UNAVAILABLE
|
|
102
|
+
* decimal: 168
|
|
103
|
+
*/
|
|
104
|
+
168: string;
|
|
105
|
+
/**
|
|
106
|
+
* RESPONSE_TOO_LARGE
|
|
107
|
+
* decimal: 169
|
|
108
|
+
*/
|
|
109
|
+
169: string;
|
|
110
|
+
/**
|
|
111
|
+
* TARGET_PROTOCOL_ERROR
|
|
112
|
+
* decimal: 176
|
|
113
|
+
*/
|
|
114
|
+
176: string;
|
|
115
|
+
/**
|
|
116
|
+
* TARGET_PROTOCOL_BUSY
|
|
117
|
+
* decimal: 177
|
|
118
|
+
*/
|
|
119
|
+
177: string;
|
|
120
|
+
/**
|
|
121
|
+
* TARGET_PROTOCOL_REAL
|
|
122
|
+
* decimal: 178
|
|
123
|
+
*/
|
|
124
|
+
178: string;
|
|
125
|
+
/**
|
|
126
|
+
* TARGET_PROTOCOL_WRONG_PARAM
|
|
127
|
+
* decimal: 179
|
|
128
|
+
*/
|
|
129
|
+
179: string;
|
|
130
|
+
/**
|
|
131
|
+
* TARGET_PROTOCOL_FORBIDDEN
|
|
132
|
+
* decimal: 180
|
|
133
|
+
*/
|
|
134
|
+
180: string;
|
|
135
|
+
/**
|
|
136
|
+
* TARGET_PROTOCOL_DATA
|
|
137
|
+
* decimal: 181
|
|
138
|
+
*/
|
|
139
|
+
181: string;
|
|
140
|
+
/**
|
|
141
|
+
* TARGET_PROTOCOL_COM
|
|
142
|
+
* decimal: 182
|
|
143
|
+
*/
|
|
144
|
+
182: string;
|
|
145
|
+
/**
|
|
146
|
+
* TARGET_PROTOCOL_LOST_COM
|
|
147
|
+
* decimal: 183
|
|
148
|
+
*/
|
|
149
|
+
183: string;
|
|
150
|
+
/**
|
|
151
|
+
* TARGET_PROTOCOL_PARAM
|
|
152
|
+
* decimal: 184
|
|
153
|
+
*/
|
|
154
|
+
184: string;
|
|
155
|
+
/**
|
|
156
|
+
* TARGET_PROTOCOL_INT
|
|
157
|
+
* decimal: 185
|
|
158
|
+
*/
|
|
159
|
+
185: string;
|
|
160
|
+
/**
|
|
161
|
+
* TARGET_PROTOCOL_ABORT
|
|
162
|
+
* decimal: 186
|
|
163
|
+
*/
|
|
164
|
+
186: string;
|
|
165
|
+
/**
|
|
166
|
+
* TARGET_PROTOCOL_NOT_IMPLEMENTED
|
|
167
|
+
* decimal: 187
|
|
168
|
+
*/
|
|
169
|
+
187: string;
|
|
170
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { TapResponseFrame } from '@iotize/tap/client/api';
|
|
2
|
+
export declare class TapResponseFrameBuilder {
|
|
3
|
+
static SUCCESS(data?: Uint8Array): TapResponseFrame;
|
|
4
|
+
static ERROR(status?: number, data?: Uint8Array): TapResponseFrame;
|
|
5
|
+
static create(status: number, data?: Uint8Array): TapResponseFrame;
|
|
6
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function tapResponseStatusToString(status: number): any;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { CodeError } from '@iotize/common/error';
|
|
2
|
+
import { ApduResponse, TapRequestFrame, TapResponseFrame } from '@iotize/tap/client/api';
|
|
3
|
+
export declare class TapClientError extends CodeError<TapClientError.Code> {
|
|
4
|
+
cause?: Error | undefined;
|
|
5
|
+
constructor(code: TapClientError.Code, message: string, cause?: Error | undefined);
|
|
6
|
+
static illegalArgument(msg: string): TapClientError;
|
|
7
|
+
static illegalStateError(msg: string): TapClientError;
|
|
8
|
+
static encodeRequestError(command: TapRequestFrame, cause: Error): TapClientError;
|
|
9
|
+
static decodeResponseError(cause: Error, frameOrCommand: Uint8Array | TapRequestFrame): TapClientError;
|
|
10
|
+
static notConnectedError(): TapClientError;
|
|
11
|
+
static cannotDecodeResponseError(err: Error, bufferData: Uint8Array): TapClientError;
|
|
12
|
+
static unexpectedApduStatusCode(apduResponse: ApduResponse): TapClientError;
|
|
13
|
+
static cannotEncodeRequest(err: Error, tapRequest: TapRequestFrame): TapClientError;
|
|
14
|
+
}
|
|
15
|
+
export declare namespace TapClientError {
|
|
16
|
+
enum Code {
|
|
17
|
+
NotConnectedError = "TapClientErrorNotConnected",
|
|
18
|
+
EncodeRequestError = "TapClientErrorEncodeRequest",
|
|
19
|
+
IllegalArgumentError = "TapClientErrorIllegalArgument",
|
|
20
|
+
IllegalStateError = "TapClientErrorIllegalState",
|
|
21
|
+
DecodeResponseError = "TapClientErrorDecodeResponse",
|
|
22
|
+
UnexpectedTapResponse = "TapClientErrorUnexpectedTapResponse",
|
|
23
|
+
UnexpectedApduResponseStatus = "TapClientErrorUnexpectedApduResponseStatus",
|
|
24
|
+
CannotEncodeRequest = "TapClientErrorCannotEncodeRequest",
|
|
25
|
+
TapClientResponseStatusError = "TapClientErrorResponseStatus"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export declare class TapClientResponseStatusError extends TapClientError {
|
|
29
|
+
response: TapResponseFrame;
|
|
30
|
+
request?: TapRequestFrame | undefined;
|
|
31
|
+
constructor(response: TapResponseFrame, request?: TapRequestFrame | undefined);
|
|
32
|
+
static createErrorMessage(response: TapResponseFrame, request?: TapRequestFrame): string;
|
|
33
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Decoder, Encoder } from '@iotize/common/converter/api';
|
|
2
|
+
import { ProtocolChangeEvent, RequestInterceptorType, TapClientInterface, TapRequestFrame, TapResponseFrame } from '@iotize/tap/client/api';
|
|
3
|
+
import { ComProtocol, ConnectionStateChangeEvent } from '@iotize/tap/protocol/api';
|
|
4
|
+
import { Observable } from 'rxjs';
|
|
5
|
+
import { InterceptorChain } from './interceptors/interceptor-chain';
|
|
6
|
+
export declare class TapClient implements TapClientInterface {
|
|
7
|
+
private _commandEncoder;
|
|
8
|
+
private _responseDecoder;
|
|
9
|
+
private _onProtocolChange;
|
|
10
|
+
private protocols;
|
|
11
|
+
private currentProtocolId?;
|
|
12
|
+
private _interceptorChain;
|
|
13
|
+
static create(protocol?: ComProtocol): TapClient;
|
|
14
|
+
constructor(requestEncoder: Encoder<TapRequestFrame, Uint8Array>, responseDecoder: Decoder<Uint8Array, TapResponseFrame>);
|
|
15
|
+
get interceptorChain(): InterceptorChain;
|
|
16
|
+
addInterceptor(interceptor: RequestInterceptorType): this;
|
|
17
|
+
isConnected(): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* see {@link getCurrentProtocol}
|
|
20
|
+
*/
|
|
21
|
+
get protocol(): ComProtocol;
|
|
22
|
+
get commandEncoder(): Encoder<TapRequestFrame, Uint8Array>;
|
|
23
|
+
get responseDecoder(): Decoder<Uint8Array<ArrayBuffer>, TapResponseFrame>;
|
|
24
|
+
/**
|
|
25
|
+
* Get current protocol or throw an error if no protocol
|
|
26
|
+
*/
|
|
27
|
+
getCurrentProtocol(): ComProtocol;
|
|
28
|
+
/**
|
|
29
|
+
* Register/replace a communication protocol with given id
|
|
30
|
+
* If no communication protocol is selected yet, it will select it.
|
|
31
|
+
* @param newProtocol
|
|
32
|
+
* @param id
|
|
33
|
+
*/
|
|
34
|
+
addComProtocol(newProtocol: ComProtocol, id?: string): this;
|
|
35
|
+
/**
|
|
36
|
+
* Switch to given communication protocol identifier
|
|
37
|
+
* @throws if protocol identifier does not exist
|
|
38
|
+
* @param name
|
|
39
|
+
*/
|
|
40
|
+
switchProtocol(name: string): this;
|
|
41
|
+
/**
|
|
42
|
+
* Change communication protocol
|
|
43
|
+
* @throws if protocol identifier does not exist
|
|
44
|
+
* @param protocol can either be the communication protocol instance or a string identifier
|
|
45
|
+
*/
|
|
46
|
+
useComProtocol(protocol: ComProtocol | string): this;
|
|
47
|
+
/**
|
|
48
|
+
* Return true if protocol identifier is registered
|
|
49
|
+
* @param id
|
|
50
|
+
*/
|
|
51
|
+
hasProtocol(id: any): boolean;
|
|
52
|
+
connect(): Observable<any>;
|
|
53
|
+
disconnect(): Observable<any>;
|
|
54
|
+
/**
|
|
55
|
+
* Send request
|
|
56
|
+
* @param request
|
|
57
|
+
* @param bodyDecoder
|
|
58
|
+
*/
|
|
59
|
+
request<T>(request: TapRequestFrame): Observable<TapResponseFrame>;
|
|
60
|
+
/**
|
|
61
|
+
* Send raw request
|
|
62
|
+
* No interceptors/No encryption will be triggered
|
|
63
|
+
* @param dataIn request bytes
|
|
64
|
+
* @param bodyDecoder optional body decoder to use
|
|
65
|
+
*/
|
|
66
|
+
send<T>(dataIn: Uint8Array): Observable<TapResponseFrame>;
|
|
67
|
+
/**
|
|
68
|
+
* Listen to connection state change event
|
|
69
|
+
* We have to resubscribe when protocol change..
|
|
70
|
+
*/
|
|
71
|
+
onConnectionStateChange(): Observable<ConnectionStateChangeEvent>;
|
|
72
|
+
onProtocolChange(): Observable<ProtocolChangeEvent>;
|
|
73
|
+
protected _command<T>(command: TapRequestFrame): Observable<TapResponseFrame>;
|
|
74
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import './lib/generated-adapter';
|
|
2
|
+
export { TapClient } from './lib/tap-client';
|
|
3
|
+
export { TapClientError } from './lib/tap-client-error';
|
|
4
|
+
export { TapRequestFrameBuilder } from './lib/request/tap-request-builder';
|
|
5
|
+
export { TapRequestHelper } from './lib/request/tap-request-helper';
|
|
6
|
+
export { TapResponseFrameBuilder } from './lib/response/tap-response-builder';
|
|
7
|
+
export { ResultCodeTranslation } from './lib/response/result-code-translation';
|
|
8
|
+
export { tapResponseStatusToString } from './lib/response/tap-response-status-to-string';
|
|
9
|
+
export { createApduFromTapRequest } from './lib/apdu/tap-apdu-request-builder';
|
|
10
|
+
export { ArrayConverter, type ArrayConverterOptions, } from './lib/converter/body/array-converter';
|
|
11
|
+
export { BooleanConverter } from './lib/converter/body/boolean-decoder';
|
|
12
|
+
export { ByteSwapConverter } from './lib/converter/body/byte-swap-converter';
|
|
13
|
+
export { ConverterError } from './lib/converter/error';
|
|
14
|
+
export { CryptedFrameConverter } from './lib/converter/crypted-frame-converter';
|
|
15
|
+
export { EnumConverter } from './lib/converter/body/enum-converter';
|
|
16
|
+
export { EnumListConverter } from './lib/converter/body/enum-converter';
|
|
17
|
+
export { FixedSizeEnumConverter } from './lib/converter/body/enum-converter';
|
|
18
|
+
export { FloatConverter, type FloatConverterOptions, } from './lib/converter/body/float-converter';
|
|
19
|
+
export { HexStringConverter } from './lib/converter/body/hex-string';
|
|
20
|
+
export { Ipv4StringConverter } from './lib/converter/body/ipv4-string-decoder';
|
|
21
|
+
export { MacAddressStringConverter } from './lib/converter/body/mac-address-string-decoder';
|
|
22
|
+
export { MultipleMaskConverter } from './lib/converter/body/multiple-mask-decoder';
|
|
23
|
+
export { NumberConverter } from './lib/converter/body/number-converter';
|
|
24
|
+
export { type NumberDecoderOptions } from './lib/converter/body/number-converter';
|
|
25
|
+
export { PipeConverter } from './lib/converter/body/pipe-converter';
|
|
26
|
+
export { PipeConverterBuilder } from './lib/converter/body/pipe-converter';
|
|
27
|
+
export { StringConverter } from './lib/converter/body/string-converter';
|
|
28
|
+
export { TLVConverter } from './lib/converter/tlv-converter';
|
|
29
|
+
export { TlvBundleConverter } from './lib/converter/body/tlv-bundle-converter';
|
|
30
|
+
export { UniqMaskConverter } from './lib/converter/body/uniq-mask-decoder';
|
|
31
|
+
export { StringVersionConverter } from './lib/converter/body/string-version-converter';
|
|
32
|
+
export { TapApduResponseConverter, TapApduRequestConverter, } from './lib/converters';
|
|
33
|
+
export { TAP_REQUEST_FRAME_CONVERTER, TAP_RESPONSE_FRAME_CONVERTER, } from './lib/converters';
|
|
34
|
+
export { createTapEncryptedFrame } from './lib/model/models.extensions';
|
|
35
|
+
export { TapStreamReader, TapStreamWriter, enumKeyOrValueToNumber, } from './lib/frame/tap-stream-core';
|
|
36
|
+
export { CRC } from './lib/error-detection/crc';
|
|
37
|
+
export { Checksum } from './lib/error-detection/checksum';
|
|
38
|
+
export * from './lib/generated-adapter';
|
|
39
|
+
export { type TapStreamEncoderDecoder } from './lib/frame/tap-stream-encoder-decoder';
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { ConnectionState } from './definitions';
|
|
3
|
+
export interface ConnectionStateChangeEvent {
|
|
4
|
+
newState: ConnectionState;
|
|
5
|
+
oldState: ConnectionState;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Communication protocol options
|
|
9
|
+
*/
|
|
10
|
+
export interface ComProtocolOptions {
|
|
11
|
+
connect: ComProtocolConnectOptions;
|
|
12
|
+
disconnect: ComProtocolDisconnectOptions;
|
|
13
|
+
send: ComProtocolSendOptions;
|
|
14
|
+
}
|
|
15
|
+
export interface ComProtocolConnectOptions {
|
|
16
|
+
timeout: number;
|
|
17
|
+
}
|
|
18
|
+
export interface ComProtocolDisconnectOptions {
|
|
19
|
+
timeout: number;
|
|
20
|
+
}
|
|
21
|
+
export interface ComProtocolSendOptions {
|
|
22
|
+
timeout: number;
|
|
23
|
+
}
|
|
24
|
+
export interface ComProtocol {
|
|
25
|
+
/**
|
|
26
|
+
* @return connection state (connected or not)
|
|
27
|
+
*/
|
|
28
|
+
getConnectionState(): ConnectionState;
|
|
29
|
+
/**
|
|
30
|
+
* @return true if connection to device has been made
|
|
31
|
+
*/
|
|
32
|
+
isConnected(): boolean;
|
|
33
|
+
connect(options?: ComProtocolConnectOptions): Observable<any>;
|
|
34
|
+
disconnect(options?: ComProtocolConnectOptions): Observable<any>;
|
|
35
|
+
/**
|
|
36
|
+
* Send data and wait for response
|
|
37
|
+
* @param data
|
|
38
|
+
* @param options
|
|
39
|
+
*/
|
|
40
|
+
send(data: Uint8Array, options?: ComProtocolSendOptions): Observable<Uint8Array>;
|
|
41
|
+
write(data: Uint8Array): Promise<any>;
|
|
42
|
+
read(): Promise<Uint8Array>;
|
|
43
|
+
/**
|
|
44
|
+
* Message stream. Any message received by the protocol will be notify on this stream
|
|
45
|
+
*/
|
|
46
|
+
receiveStream(): Observable<Uint8Array>;
|
|
47
|
+
/**
|
|
48
|
+
* Observe connection state changes
|
|
49
|
+
*/
|
|
50
|
+
onConnectionStateChange(): Observable<ConnectionStateChangeEvent>;
|
|
51
|
+
}
|
|
52
|
+
export declare namespace ComProtocol {
|
|
53
|
+
class Errors extends Error {
|
|
54
|
+
code: ErrorCode;
|
|
55
|
+
static operationCanceled(): Errors;
|
|
56
|
+
static notConnected(info: {
|
|
57
|
+
protocol: ComProtocol;
|
|
58
|
+
}): Errors;
|
|
59
|
+
static timeoutError(info: {
|
|
60
|
+
msg?: string;
|
|
61
|
+
protocol: ComProtocol;
|
|
62
|
+
timeout: number;
|
|
63
|
+
startTime: Date;
|
|
64
|
+
}): Errors;
|
|
65
|
+
static operationInProgress(msg: string): Errors;
|
|
66
|
+
static unknownError(): Errors;
|
|
67
|
+
private constructor();
|
|
68
|
+
}
|
|
69
|
+
enum ErrorCode {
|
|
70
|
+
ProtocolNotConnected = "ProtocolNotConnected",
|
|
71
|
+
TimeoutError = "TimeoutError",
|
|
72
|
+
UnknownError = "UnknownError",
|
|
73
|
+
OperationCancelled = "OperationCancelled",
|
|
74
|
+
OperationInProgress = "ComProtocolOperationInProgress"
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { QueueComProtocol } from '@iotize/tap/protocol/core';
|
|
2
|
+
import { BLEPacketBuilder } from './ble-packet-builder';
|
|
3
|
+
import { BLEPacketSplitter } from './ble-packet-splitter';
|
|
4
|
+
import { BleComError } from './errors';
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated use UniversalBleProtocolAdpater
|
|
7
|
+
* Abstract class for BLE communication
|
|
8
|
+
*
|
|
9
|
+
* With ble communication, data is split into sub packets.
|
|
10
|
+
* This class handles creation of packet chunks.
|
|
11
|
+
*
|
|
12
|
+
* - You must only implement the function to send one packet chunk writeLwm2mPacketChunk()
|
|
13
|
+
* -
|
|
14
|
+
*/
|
|
15
|
+
export declare abstract class AbstractBleProtocol extends QueueComProtocol {
|
|
16
|
+
bleOptions: {
|
|
17
|
+
mtu: number;
|
|
18
|
+
};
|
|
19
|
+
static RECEIVED_BUFFER_LENGTH: number;
|
|
20
|
+
protected packetBuilder?: BLEPacketBuilder;
|
|
21
|
+
protected packetSplitter?: BLEPacketSplitter;
|
|
22
|
+
protected _readReject?: (reason?: any) => void;
|
|
23
|
+
protected _pendingRead?: Uint8Array;
|
|
24
|
+
protected _readResolve?: (value: Uint8Array | PromiseLike<Uint8Array>) => void;
|
|
25
|
+
protected _readPromise?: Promise<Uint8Array>;
|
|
26
|
+
/**
|
|
27
|
+
* Actual implementation to send a packet chunk with ble
|
|
28
|
+
*/
|
|
29
|
+
abstract writeLwm2mPacketChunk(data: Uint8Array): Promise<Uint8Array>;
|
|
30
|
+
/**
|
|
31
|
+
* Actual implementation to listen ble messages coming from LWM2M IoTize device
|
|
32
|
+
*/
|
|
33
|
+
abstract subscribeToLwm2mMessage(): void;
|
|
34
|
+
constructor(bleOptions?: {
|
|
35
|
+
mtu: number;
|
|
36
|
+
});
|
|
37
|
+
onNewLwm2mMessage(data: Uint8Array): void;
|
|
38
|
+
onNewLwm2mMessageError(err: Error): void;
|
|
39
|
+
onLwm2mDataChunkError(error: BleComError): void;
|
|
40
|
+
getLwm2mResponsePromise(): Promise<Uint8Array<ArrayBuffer>>;
|
|
41
|
+
createLwm2mResponsePromise(): Promise<Uint8Array>;
|
|
42
|
+
read(): Promise<Uint8Array>;
|
|
43
|
+
write(data: Uint8Array): Promise<any>;
|
|
44
|
+
/**
|
|
45
|
+
*
|
|
46
|
+
* @param data data chunk
|
|
47
|
+
*/
|
|
48
|
+
onNewLwm2mPacket(data: Uint8Array): void;
|
|
49
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const BleConfig: {
|
|
2
|
+
maxPacketLengthWithoutOffset: number;
|
|
3
|
+
services: {
|
|
4
|
+
upgrade: {
|
|
5
|
+
service: string;
|
|
6
|
+
charac: string;
|
|
7
|
+
};
|
|
8
|
+
lwm2m: {
|
|
9
|
+
service: string;
|
|
10
|
+
charac: string;
|
|
11
|
+
};
|
|
12
|
+
fastLwm2m: {
|
|
13
|
+
service: string;
|
|
14
|
+
charac: string;
|
|
15
|
+
};
|
|
16
|
+
standardClientConfig: {
|
|
17
|
+
service: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Created by IoTize on 19/04/2018.
|
|
3
|
+
* <p>
|
|
4
|
+
* Glue packet chunk to build the original ble packet
|
|
5
|
+
* @param {number} bufferLength
|
|
6
|
+
* @class
|
|
7
|
+
*/
|
|
8
|
+
export declare class BLEPacketBuilder {
|
|
9
|
+
bufferOffset: number;
|
|
10
|
+
protected data: Uint8Array;
|
|
11
|
+
dataLength: number;
|
|
12
|
+
constructor(bufferLength: number);
|
|
13
|
+
/**
|
|
14
|
+
* Append new chunk of data into the builder
|
|
15
|
+
* @param {Array} dataChunk the data chunk. The first byte must be the position offset of this chunk in the buffer (in bytes)
|
|
16
|
+
*/
|
|
17
|
+
append(dataChunk: Uint8Array): void;
|
|
18
|
+
reset(): void;
|
|
19
|
+
hasAllChunks(): boolean;
|
|
20
|
+
isChecksumValid(): boolean;
|
|
21
|
+
getComputedChecksum(): number;
|
|
22
|
+
getExpectedChecksum(): number;
|
|
23
|
+
/**
|
|
24
|
+
* @return {Array} the result data without the checksum
|
|
25
|
+
*/
|
|
26
|
+
getData(): Uint8Array;
|
|
27
|
+
/**
|
|
28
|
+
* @return {Array} the buffer (with the checksum)
|
|
29
|
+
*/
|
|
30
|
+
getBuffer(): Uint8Array;
|
|
31
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Created by IoTize on 19/04/2018.
|
|
3
|
+
*
|
|
4
|
+
* Split data into chunks with a size of maxPacketSize + 1
|
|
5
|
+
* @param {Array} data
|
|
6
|
+
* @param {number} maxPacketSize
|
|
7
|
+
* @class
|
|
8
|
+
*/
|
|
9
|
+
export declare class BLEPacketSplitter {
|
|
10
|
+
lastPacketSize: number;
|
|
11
|
+
data: Uint8Array;
|
|
12
|
+
maxPacketSize: number;
|
|
13
|
+
currentPacketIndex: number;
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
* @param data
|
|
17
|
+
* @param maxPacketSize
|
|
18
|
+
*/
|
|
19
|
+
constructor(data: Uint8Array, maxPacketSize: number);
|
|
20
|
+
/**
|
|
21
|
+
* Create a BLEPacketSplitter instance from data and add the checksum at the end
|
|
22
|
+
* @param {Array} data body data
|
|
23
|
+
* @param {number} maxPacketSize packet size
|
|
24
|
+
* @return {BLEPacketSplitter} the new instance
|
|
25
|
+
*/
|
|
26
|
+
static wrapWithChecksum(data: Uint8Array, maxPacketSize: number): BLEPacketSplitter;
|
|
27
|
+
getTotalNumberOfPacket(): number;
|
|
28
|
+
getLastPacketSize(): number;
|
|
29
|
+
getPackets(): Uint8Array[];
|
|
30
|
+
getNextPacket(): Uint8Array;
|
|
31
|
+
hasNextPacket(): boolean;
|
|
32
|
+
static computeChecksum(data: Uint8Array): number;
|
|
33
|
+
getTotalSize(): number;
|
|
34
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { CodeError } from '@iotize/common/error';
|
|
2
|
+
import { BLEPacketBuilder } from './ble-packet-builder';
|
|
3
|
+
export declare class BleComError extends CodeError<BleComError.Code> {
|
|
4
|
+
static invalidBleChunkChecksum(packetBuilder: BLEPacketBuilder): InvalidBleFrameChecksum;
|
|
5
|
+
static writeSizeAboveMTU(data: Uint8Array, mtu: number): BleComError;
|
|
6
|
+
static serviceNotFound(uuid: string): BleComError;
|
|
7
|
+
static charcacteristicNotFound(uuid: string): BleComError;
|
|
8
|
+
static bleNotAvailable(msg?: string): BleComError;
|
|
9
|
+
static gattServerNotAvailable(): BleComError;
|
|
10
|
+
static gattServerConnectionFailed(): BleComError;
|
|
11
|
+
constructor(code: BleComError.Code, msg: string);
|
|
12
|
+
}
|
|
13
|
+
export declare class InvalidBleFrameChecksum extends BleComError {
|
|
14
|
+
packetBuilder: BLEPacketBuilder;
|
|
15
|
+
constructor(packetBuilder: BLEPacketBuilder);
|
|
16
|
+
static create(packetBuilder: BLEPacketBuilder): InvalidBleFrameChecksum;
|
|
17
|
+
}
|
|
18
|
+
export declare namespace BleComError {
|
|
19
|
+
enum Code {
|
|
20
|
+
InvalidChecksum = "InvalidChecksum",
|
|
21
|
+
BleGattServiceNotFound = "BleGattServiceNotFound",
|
|
22
|
+
BleGattCharacteristicNotFound = "BleGattCharacteristicNotFound",
|
|
23
|
+
BleWriteSizeAboveMTU = "BleWriteSizeAboveMTU",
|
|
24
|
+
GATTServerNotAvailable = "BleComErrorGATTServerNotAvailable",
|
|
25
|
+
GATTServerConnectionFailed = "BleComErrorGATTServerConnectionFailed",
|
|
26
|
+
NotAvailable = "BleComErrorNotAvailable"
|
|
27
|
+
}
|
|
28
|
+
}
|