@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.
Files changed (176) hide show
  1. package/CHANGELOG.md +143 -0
  2. package/package.json +7 -21
  3. package/packages/common/byte-converter/src/lib/byte-converter.d.ts +30 -0
  4. package/packages/common/byte-converter/src/public_api.d.ts +1 -0
  5. package/packages/common/byte-stream/src/lib/kaitai/kaitai-stream-reader.d.ts +155 -0
  6. package/packages/common/byte-stream/src/lib/kaitai/kaitai-stream-writer.d.ts +76 -0
  7. package/packages/common/byte-stream/src/lib/kaitai/kaitai-stream.d.ts +209 -0
  8. package/packages/common/byte-stream/src/lib/utility.d.ts +16 -0
  9. package/packages/common/byte-stream/src/public_api.d.ts +4 -0
  10. package/packages/common/converter/api/src/lib/converter.interface.d.ts +3 -0
  11. package/packages/common/converter/api/src/lib/decoder.interface.d.ts +4 -0
  12. package/packages/common/converter/api/src/lib/encoder-decoder.interface.d.ts +5 -0
  13. package/packages/common/converter/api/src/lib/encoder.interface.d.ts +4 -0
  14. package/packages/common/converter/api/src/public_api.d.ts +4 -0
  15. package/packages/common/debug/src/lib/debug.d.ts +7 -0
  16. package/packages/common/debug/src/public_api.d.ts +1 -0
  17. package/packages/common/error/src/lib/base-error.d.ts +3 -0
  18. package/packages/common/error/src/lib/code-error.d.ts +9 -0
  19. package/packages/common/error/src/public_api.d.ts +2 -0
  20. package/packages/common/promise/src/lib/promise-delay.d.ts +6 -0
  21. package/packages/common/promise/src/lib/promise-serial.d.ts +6 -0
  22. package/packages/common/promise/src/lib/promise-timeout.d.ts +10 -0
  23. package/packages/common/promise/src/public_api.d.ts +3 -0
  24. package/packages/common/task-manager/src/lib/cancelable-task.d.ts +22 -0
  25. package/packages/common/task-manager/src/lib/debug.d.ts +2 -0
  26. package/packages/common/task-manager/src/lib/definitions.d.ts +16 -0
  27. package/packages/common/task-manager/src/lib/step-operations.d.ts +112 -0
  28. package/packages/common/task-manager/src/lib/task-queue.d.ts +28 -0
  29. package/packages/common/task-manager/src/public_api.d.ts +4 -0
  30. package/packages/common/tlv/src/lib/debug.d.ts +2 -0
  31. package/packages/common/tlv/src/lib/tlv.d.ts +65 -0
  32. package/packages/common/tlv/src/public_api.d.ts +1 -0
  33. package/packages/common/utility/src/lib/assert-error.d.ts +1 -0
  34. package/packages/common/utility/src/lib/deep-copy.d.ts +14 -0
  35. package/packages/common/utility/src/lib/enum-util.d.ts +23 -0
  36. package/packages/common/utility/src/lib/sleep.d.ts +1 -0
  37. package/packages/common/utility/src/lib/utility.d.ts +1 -0
  38. package/packages/common/utility/src/public_api.d.ts +5 -0
  39. package/{lib → packages/device-com-ble.cordova/src/lib}/ble-com-protocol.d.ts +20 -20
  40. package/{lib → packages/device-com-ble.cordova/src/lib}/cordova-ble-error.d.ts +29 -29
  41. package/{lib → packages/device-com-ble.cordova/src/lib}/cordova-interface.d.ts +5 -5
  42. package/{lib → packages/device-com-ble.cordova/src/lib}/cordova-service-adapter.d.ts +58 -58
  43. package/{lib → packages/device-com-ble.cordova/src/lib}/definitions.d.ts +43 -43
  44. package/{lib → packages/device-com-ble.cordova/src/lib}/iotize-ble-cordova-plugin.d.ts +27 -27
  45. package/packages/device-com-ble.cordova/src/lib/logger.d.ts +2 -0
  46. package/{lib → packages/device-com-ble.cordova/src/lib}/scanner.d.ts +55 -55
  47. package/{lib → packages/device-com-ble.cordova/src/lib}/utility.d.ts +6 -6
  48. package/packages/device-com-ble.cordova/src/plugin.d.ts +7 -0
  49. package/packages/tap/client/api/src/lib/converter/definitions.d.ts +7 -0
  50. package/packages/tap/client/api/src/lib/definitions.d.ts +20 -0
  51. package/packages/tap/client/api/src/lib/generated/models.d.ts +150 -0
  52. package/packages/tap/client/api/src/lib/result-code.d.ts +170 -0
  53. package/packages/tap/client/api/src/lib/tap-client.interface.d.ts +28 -0
  54. package/packages/tap/client/api/src/public_api.d.ts +6 -0
  55. package/packages/tap/client/impl/src/lib/apdu/tap-apdu-request-builder.d.ts +2 -0
  56. package/packages/tap/client/impl/src/lib/converter/body/array-converter.d.ts +15 -0
  57. package/packages/tap/client/impl/src/lib/converter/body/boolean-decoder.d.ts +12 -0
  58. package/packages/tap/client/impl/src/lib/converter/body/byte-swap-converter.d.ts +26 -0
  59. package/packages/tap/client/impl/src/lib/converter/body/enum-converter.d.ts +23 -0
  60. package/packages/tap/client/impl/src/lib/converter/body/float-converter.d.ts +20 -0
  61. package/packages/tap/client/impl/src/lib/converter/body/hex-string.d.ts +8 -0
  62. package/packages/tap/client/impl/src/lib/converter/body/ipv4-string-decoder.d.ts +8 -0
  63. package/packages/tap/client/impl/src/lib/converter/body/mac-address-string-decoder.d.ts +7 -0
  64. package/packages/tap/client/impl/src/lib/converter/body/multiple-mask-decoder.d.ts +15 -0
  65. package/packages/tap/client/impl/src/lib/converter/body/number-converter.d.ts +54 -0
  66. package/packages/tap/client/impl/src/lib/converter/body/pipe-converter.d.ts +29 -0
  67. package/packages/tap/client/impl/src/lib/converter/body/string-converter.d.ts +44 -0
  68. package/packages/tap/client/impl/src/lib/converter/body/string-version-converter.d.ts +6 -0
  69. package/packages/tap/client/impl/src/lib/converter/body/tlv-bundle-converter.d.ts +22 -0
  70. package/packages/tap/client/impl/src/lib/converter/body/uniq-mask-decoder.d.ts +29 -0
  71. package/packages/tap/client/impl/src/lib/converter/crypted-frame-converter.d.ts +13 -0
  72. package/packages/tap/client/impl/src/lib/converter/error.d.ts +15 -0
  73. package/packages/tap/client/impl/src/lib/converter/tlv-converter.d.ts +9 -0
  74. package/packages/tap/client/impl/src/lib/converters.d.ts +13 -0
  75. package/packages/tap/client/impl/src/lib/debug.d.ts +2 -0
  76. package/packages/tap/client/impl/src/lib/error-detection/checksum.d.ts +3 -0
  77. package/packages/tap/client/impl/src/lib/error-detection/crc.d.ts +12 -0
  78. package/packages/tap/client/impl/src/lib/frame/import-adapter.d.ts +1 -0
  79. package/packages/tap/client/impl/src/lib/frame/tap-stream-core.d.ts +41 -0
  80. package/packages/tap/client/impl/src/lib/frame/tap-stream-encoder-decoder.d.ts +5 -0
  81. package/packages/tap/client/impl/src/lib/frame/tap-stream-extended.d.ts +2 -0
  82. package/packages/tap/client/impl/src/lib/generated/converter-stream-extension.d.ts +30 -0
  83. package/packages/tap/client/impl/src/lib/generated/converter.d.ts +35 -0
  84. package/packages/tap/client/impl/src/lib/generated-adapter.d.ts +2 -0
  85. package/packages/tap/client/impl/src/lib/interceptors/interceptor-chain.d.ts +9 -0
  86. package/packages/tap/client/impl/src/lib/model/models.extensions.d.ts +2 -0
  87. package/packages/tap/client/impl/src/lib/request/tap-request-builder.d.ts +13 -0
  88. package/packages/tap/client/impl/src/lib/request/tap-request-helper.d.ts +9 -0
  89. package/packages/tap/client/impl/src/lib/response/result-code-translation.d.ts +170 -0
  90. package/packages/tap/client/impl/src/lib/response/tap-response-builder.d.ts +6 -0
  91. package/packages/tap/client/impl/src/lib/response/tap-response-status-to-string.d.ts +1 -0
  92. package/packages/tap/client/impl/src/lib/tap-client-error.d.ts +33 -0
  93. package/packages/tap/client/impl/src/lib/tap-client.d.ts +74 -0
  94. package/packages/tap/client/impl/src/public_api.d.ts +39 -0
  95. package/packages/tap/protocol/api/src/lib/com-protocol.interface.d.ts +76 -0
  96. package/packages/tap/protocol/api/src/lib/definitions.d.ts +6 -0
  97. package/packages/tap/protocol/api/src/public_api.d.ts +2 -0
  98. package/packages/tap/protocol/ble/common/src/lib/abstract-ble-protocol.d.ts +49 -0
  99. package/packages/tap/protocol/ble/common/src/lib/ble-config.d.ts +20 -0
  100. package/packages/tap/protocol/ble/common/src/lib/ble-packet-builder.d.ts +31 -0
  101. package/packages/tap/protocol/ble/common/src/lib/ble-packet-splitter.d.ts +34 -0
  102. package/packages/tap/protocol/ble/common/src/lib/debug.d.ts +2 -0
  103. package/packages/tap/protocol/ble/common/src/lib/errors.d.ts +28 -0
  104. package/packages/tap/protocol/ble/common/src/lib/universal-ble-protocol-adapter.d.ts +146 -0
  105. package/packages/tap/protocol/ble/common/src/lib/util.d.ts +1 -0
  106. package/packages/tap/protocol/ble/common/src/public_api.d.ts +6 -0
  107. package/packages/tap/protocol/core/src/lib/abstract-com-protocol.d.ts +23 -0
  108. package/packages/tap/protocol/core/src/lib/debug.d.ts +2 -0
  109. package/packages/tap/protocol/core/src/lib/queue-com-protocol.d.ts +35 -0
  110. package/packages/tap/protocol/core/src/public_api.d.ts +2 -0
  111. package/packages/tap/scanner/api/src/lib/definitions.d.ts +35 -0
  112. package/packages/tap/scanner/api/src/public_api.d.ts +1 -0
  113. package/plugin.cjs +9057 -0
  114. package/plugin.js +9047 -0
  115. package/plugin.xml +8 -3
  116. package/src/android/build.gradle +2 -11
  117. package/src/android/libs/iotize-device-com-ble-1.0.0-alpha.9.aar +0 -0
  118. package/src/windows/iotize-ble-com.js +11 -11
  119. package/LICENSE +0 -23
  120. package/README.md +0 -174
  121. package/bundles/iotize-device-com-ble.cordova.umd.js +0 -1418
  122. package/bundles/iotize-device-com-ble.cordova.umd.js.map +0 -1
  123. package/bundles/iotize-device-com-ble.cordova.umd.min.js +0 -2
  124. package/bundles/iotize-device-com-ble.cordova.umd.min.js.map +0 -1
  125. package/esm2015/iotize-device-com-ble.cordova.js +0 -6
  126. package/esm2015/iotize-device-com-ble.cordova.js.map +0 -1
  127. package/esm2015/iotize-device-com-ble.cordova.metadata.json +0 -1
  128. package/esm2015/iotize-device-com-ble.cordova.ngsummary.json +0 -1
  129. package/esm2015/lib/ble-com-protocol.js +0 -76
  130. package/esm2015/lib/ble-com-protocol.js.map +0 -1
  131. package/esm2015/lib/ble-com-protocol.metadata.json +0 -1
  132. package/esm2015/lib/ble-com-protocol.ngsummary.json +0 -1
  133. package/esm2015/lib/cordova-ble-error.js +0 -36
  134. package/esm2015/lib/cordova-ble-error.js.map +0 -1
  135. package/esm2015/lib/cordova-ble-error.metadata.json +0 -1
  136. package/esm2015/lib/cordova-ble-error.ngsummary.json +0 -1
  137. package/esm2015/lib/cordova-interface.js +0 -2
  138. package/esm2015/lib/cordova-interface.js.map +0 -1
  139. package/esm2015/lib/cordova-interface.metadata.json +0 -1
  140. package/esm2015/lib/cordova-interface.ngsummary.json +0 -1
  141. package/esm2015/lib/cordova-service-adapter.js +0 -214
  142. package/esm2015/lib/cordova-service-adapter.js.map +0 -1
  143. package/esm2015/lib/cordova-service-adapter.metadata.json +0 -1
  144. package/esm2015/lib/cordova-service-adapter.ngsummary.json +0 -1
  145. package/esm2015/lib/definitions.js +0 -2
  146. package/esm2015/lib/definitions.js.map +0 -1
  147. package/esm2015/lib/definitions.metadata.json +0 -1
  148. package/esm2015/lib/definitions.ngsummary.json +0 -1
  149. package/esm2015/lib/iotize-ble-cordova-plugin.js +0 -170
  150. package/esm2015/lib/iotize-ble-cordova-plugin.js.map +0 -1
  151. package/esm2015/lib/iotize-ble-cordova-plugin.metadata.json +0 -1
  152. package/esm2015/lib/iotize-ble-cordova-plugin.ngsummary.json +0 -1
  153. package/esm2015/lib/logger.js +0 -3
  154. package/esm2015/lib/logger.js.map +0 -1
  155. package/esm2015/lib/logger.metadata.json +0 -1
  156. package/esm2015/lib/logger.ngsummary.json +0 -1
  157. package/esm2015/lib/scanner.js +0 -151
  158. package/esm2015/lib/scanner.js.map +0 -1
  159. package/esm2015/lib/scanner.metadata.json +0 -1
  160. package/esm2015/lib/scanner.ngsummary.json +0 -1
  161. package/esm2015/lib/utility.js +0 -26
  162. package/esm2015/lib/utility.js.map +0 -1
  163. package/esm2015/lib/utility.metadata.json +0 -1
  164. package/esm2015/lib/utility.ngsummary.json +0 -1
  165. package/esm2015/public_api.js +0 -5
  166. package/esm2015/public_api.js.map +0 -1
  167. package/esm2015/public_api.metadata.json +0 -1
  168. package/esm2015/public_api.ngsummary.json +0 -1
  169. package/fesm2015/iotize-device-com-ble.cordova.js +0 -660
  170. package/fesm2015/iotize-device-com-ble.cordova.js.map +0 -1
  171. package/iotize-device-com-ble.cordova.d.ts +0 -6
  172. package/iotize-device-com-ble.cordova.metadata.json +0 -1
  173. package/lib/logger.d.ts +0 -1
  174. package/public_api.d.ts +0 -5
  175. package/www/plugin.js +0 -2
  176. package/www/plugin.js.LICENSE.txt +0 -14
@@ -1,43 +1,43 @@
1
- import { CharacteristicProperties } from '@iotize/tap/protocol/ble/common';
2
- export interface CordovaBLEScanResult {
3
- name: string;
4
- address: string;
5
- rssi?: number;
6
- txPower?: number;
7
- scanRecord?: number[];
8
- }
9
- /**
10
- * @deprecated
11
- * use CordovaBLEScanResult instead
12
- */
13
- export declare type DiscoveredDeviceType = CordovaBLEScanResult;
14
- export interface RequestDeviceOptions {
15
- filters: BluetoothLEScanFilter[];
16
- optionalServices?: BluetoothServiceUUID[] | undefined;
17
- optionalManufacturerData?: number[] | undefined;
18
- }
19
- interface BluetoothLEScanFilter {
20
- readonly services?: BluetoothServiceUUID[] | undefined;
21
- }
22
- declare type BluetoothServiceUUID = string;
23
- declare type BluetoothCharacteristicUUID = string;
24
- declare type BluetoothDescriptorUUID = string;
25
- export interface ServiceDescription {
26
- uuid: BluetoothServiceUUID;
27
- characteristics?: CharacteristicList;
28
- [key: string]: any;
29
- }
30
- export declare type ServiceList = ServiceDescription[];
31
- export interface CharacteristicDescription {
32
- uuid: BluetoothCharacteristicUUID;
33
- descriptors?: DescriptorList;
34
- properties: CharacteristicProperties;
35
- [key: string]: any;
36
- }
37
- export declare type CharacteristicList = CharacteristicDescription[];
38
- export interface DescriptorDescription {
39
- uuid: BluetoothDescriptorUUID;
40
- [key: string]: any;
41
- }
42
- export declare type DescriptorList = DescriptorDescription[];
43
- export {};
1
+ import { CharacteristicProperties } from '@iotize/tap/protocol/ble/common';
2
+ export interface CordovaBLEScanResult {
3
+ name: string;
4
+ address: string;
5
+ rssi?: number;
6
+ txPower?: number;
7
+ scanRecord?: number[];
8
+ }
9
+ /**
10
+ * @deprecated
11
+ * use CordovaBLEScanResult instead
12
+ */
13
+ export type DiscoveredDeviceType = CordovaBLEScanResult;
14
+ export interface RequestDeviceOptions {
15
+ filters: BluetoothLEScanFilter[];
16
+ optionalServices?: BluetoothServiceUUID[] | undefined;
17
+ optionalManufacturerData?: number[] | undefined;
18
+ }
19
+ interface BluetoothLEScanFilter {
20
+ readonly services?: BluetoothServiceUUID[] | undefined;
21
+ }
22
+ type BluetoothServiceUUID = string;
23
+ type BluetoothCharacteristicUUID = string;
24
+ type BluetoothDescriptorUUID = string;
25
+ export interface ServiceDescription {
26
+ uuid: BluetoothServiceUUID;
27
+ characteristics?: CharacteristicList;
28
+ [key: string]: any;
29
+ }
30
+ export type ServiceList = ServiceDescription[];
31
+ export interface CharacteristicDescription {
32
+ uuid: BluetoothCharacteristicUUID;
33
+ descriptors?: DescriptorList;
34
+ properties: CharacteristicProperties;
35
+ [key: string]: any;
36
+ }
37
+ export type CharacteristicList = CharacteristicDescription[];
38
+ export interface DescriptorDescription {
39
+ uuid: BluetoothDescriptorUUID;
40
+ [key: string]: any;
41
+ }
42
+ export type DescriptorList = DescriptorDescription[];
43
+ export {};
@@ -1,27 +1,27 @@
1
- import { ConnectionState } from "@iotize/tap/protocol/api";
2
- import { Observable } from "rxjs";
3
- import { CordovaBLEScanResult, RequestDeviceOptions, ServiceList } from "./definitions";
4
- export declare class IoTizeBleCordovaPlugin {
5
- checkAvailable(): Promise<boolean>;
6
- requestEnableBle(): Promise<"OK">;
7
- startScan(requestDeviceOptions: RequestDeviceOptions | undefined): Observable<CordovaBLEScanResult | "Ok">;
8
- stopScan(): Promise<"OK">;
9
- connect(deviceId: string, enableBleIfNot?: boolean): Observable<ConnectionState>;
10
- askBleEnable(askEnable: boolean): Observable<void>;
11
- requestMTU(deviceId: string, mtu: number): Promise<"OK">;
12
- connectAndDiscoverTapServices(deviceId: string, enableBleIfNot?: boolean): Observable<ConnectionState>;
13
- disConnect(deviceId: string): Promise<"OK">;
14
- close(deviceId: string): Promise<"OK">;
15
- isConnected(deviceId: string): Promise<boolean>;
16
- send(deviceId: string, data: Uint8Array): Promise<Uint8Array>;
17
- getLastError(): Promise<string>;
18
- characteristicStartNotification(deviceId: string, serviceId: string, characId: string): Promise<"OK">;
19
- characteristicChanged(deviceId: string, serviceId: string, characId: string): Observable<Uint8Array>;
20
- characteristicStopNotification(deviceId: string, serviceId: string, characId: string): Promise<"OK">;
21
- characteristicReadValue(deviceId: string, serviceId: string, characId: string): Promise<Uint8Array>;
22
- characteristicWrite(deviceId: string, serviceId: string, characId: string, data: Uint8Array): Promise<"OK">;
23
- characteristicWriteWithoutResponse(deviceId: string, serviceId: string, characId: string, data: Uint8Array): Promise<"OK">;
24
- discoverServices(deviceId: string): Promise<ServiceList>;
25
- private execSingleResult;
26
- private execMultipleResult;
27
- }
1
+ import { ConnectionState } from '@iotize/tap/protocol/api';
2
+ import { Observable } from 'rxjs';
3
+ import { CordovaBLEScanResult, RequestDeviceOptions, ServiceList } from './definitions';
4
+ export declare class IoTizeBleCordovaPlugin {
5
+ checkAvailable(): Promise<boolean>;
6
+ requestEnableBle(): Promise<'OK'>;
7
+ startScan(requestDeviceOptions: RequestDeviceOptions | undefined): Observable<CordovaBLEScanResult | 'Ok'>;
8
+ stopScan(): Promise<"OK">;
9
+ connect(deviceId: string, enableBleIfNot?: boolean): Observable<ConnectionState>;
10
+ askBleEnable(askEnable: boolean): Observable<void>;
11
+ requestMTU(deviceId: string, mtu: number): Promise<"OK">;
12
+ connectAndDiscoverTapServices(deviceId: string, enableBleIfNot?: boolean): Observable<ConnectionState>;
13
+ disConnect(deviceId: string): Promise<"OK">;
14
+ close(deviceId: string): Promise<"OK">;
15
+ isConnected(deviceId: string): Promise<boolean>;
16
+ send(deviceId: string, data: Uint8Array): Promise<Uint8Array<ArrayBuffer>>;
17
+ getLastError(): Promise<string>;
18
+ characteristicStartNotification(deviceId: string, serviceId: string, characId: string): Promise<"OK">;
19
+ characteristicChanged(deviceId: string, serviceId: string, characId: string): Observable<Uint8Array>;
20
+ characteristicStopNotification(deviceId: string, serviceId: string, characId: string): Promise<"OK">;
21
+ characteristicReadValue(deviceId: string, serviceId: string, characId: string): Promise<Uint8Array>;
22
+ characteristicWrite(deviceId: string, serviceId: string, characId: string, data: Uint8Array): Promise<"OK">;
23
+ characteristicWriteWithoutResponse(deviceId: string, serviceId: string, characId: string, data: Uint8Array): Promise<"OK">;
24
+ discoverServices(deviceId: string): Promise<ServiceList>;
25
+ private execSingleResult;
26
+ private execMultipleResult;
27
+ }
@@ -0,0 +1,2 @@
1
+ import { createDebugger } from '@iotize/common/debug';
2
+ export declare const debug: createDebugger.Debugger;
@@ -1,55 +1,55 @@
1
- import { DeviceScanner, DeviceScannerOptions } from "@iotize/tap/scanner/api";
2
- import { Observable } from "rxjs";
3
- import { CordovaBLEScanResult, RequestDeviceOptions } from "./definitions";
4
- import { IoTizeBleCordovaPlugin } from "./iotize-ble-cordova-plugin";
5
- /**
6
- * BLE Tap scanner for cordova apps
7
- */
8
- export declare class BLEScanner implements DeviceScanner<CordovaBLEScanResult> {
9
- private cordovaInterfaceOverwrite?;
10
- /**
11
- * Request device options used to filter scan results
12
- */
13
- readonly requestDeviceOptions?: RequestDeviceOptions | undefined;
14
- private _results;
15
- private _scanning$;
16
- private scanSubscription?;
17
- /**
18
- * Lazy reference to iotizeBLE.
19
- * We don't want to reference iotizeBLE in constructor as it may be referenced
20
- * before cordova plugin is loaded
21
- */
22
- private get cordovaInterface();
23
- /**
24
- *
25
- * @param cordovaInterfaceOverwrite overwrite cordova interface. Used for testing
26
- */
27
- constructor(cordovaInterfaceOverwrite?: IoTizeBleCordovaPlugin | undefined,
28
- /**
29
- * Request device options used to filter scan results
30
- */
31
- requestDeviceOptions?: RequestDeviceOptions | undefined);
32
- get scanning(): Observable<boolean>;
33
- get isScanning(): boolean;
34
- /**
35
- * Gets the observable on the devices$ Subject
36
- * @return
37
- */
38
- get results(): Observable<CordovaBLEScanResult[]>;
39
- /**
40
- * Launches the scan for BLE devices
41
- * Throws if BLE is not available
42
- */
43
- start(options?: DeviceScannerOptions): Promise<void>;
44
- /**
45
- *
46
- */
47
- stop(): Promise<void>;
48
- /**
49
- * Returns true if this scanner is available
50
- */
51
- checkAvailable(): Promise<boolean>;
52
- private get devices();
53
- private clearResults;
54
- private addOrRefreshDevice;
55
- }
1
+ import type { DeviceScanner, DeviceScannerOptions } from '@iotize/tap/scanner/api';
2
+ import { Observable } from 'rxjs';
3
+ import { CordovaBLEScanResult, RequestDeviceOptions } from './definitions';
4
+ import { IoTizeBleCordovaPlugin } from './iotize-ble-cordova-plugin';
5
+ /**
6
+ * BLE Tap scanner for cordova apps
7
+ */
8
+ export declare class BLEScanner implements DeviceScanner<CordovaBLEScanResult> {
9
+ private cordovaInterfaceOverwrite?;
10
+ /**
11
+ * Request device options used to filter scan results
12
+ */
13
+ readonly requestDeviceOptions?: RequestDeviceOptions | undefined;
14
+ private _results;
15
+ private _scanning$;
16
+ private scanSubscription?;
17
+ /**
18
+ * Lazy reference to iotizeBLE.
19
+ * We don't want to reference iotizeBLE in constructor as it may be referenced
20
+ * before cordova plugin is loaded
21
+ */
22
+ private get cordovaInterface();
23
+ /**
24
+ *
25
+ * @param cordovaInterfaceOverwrite overwrite cordova interface. Used for testing
26
+ */
27
+ constructor(cordovaInterfaceOverwrite?: IoTizeBleCordovaPlugin | undefined,
28
+ /**
29
+ * Request device options used to filter scan results
30
+ */
31
+ requestDeviceOptions?: RequestDeviceOptions | undefined);
32
+ get scanning(): Observable<boolean>;
33
+ get isScanning(): boolean;
34
+ /**
35
+ * Gets the observable on the devices$ Subject
36
+ * @return
37
+ */
38
+ get results(): Observable<CordovaBLEScanResult[]>;
39
+ /**
40
+ * Launches the scan for BLE devices
41
+ * Throws if BLE is not available
42
+ */
43
+ start(options?: DeviceScannerOptions): Promise<void>;
44
+ /**
45
+ *
46
+ */
47
+ stop(): Promise<void>;
48
+ /**
49
+ * Returns true if this scanner is available
50
+ */
51
+ checkAvailable(): Promise<boolean>;
52
+ private get devices();
53
+ private clearResults;
54
+ private addOrRefreshDevice;
55
+ }
@@ -1,6 +1,6 @@
1
- import { IoTizeBleCordovaPlugin } from "./iotize-ble-cordova-plugin";
2
- export declare function getIoTizeBleCordovaPlugin(): IoTizeBleCordovaPlugin;
3
- export declare function getScanRecordsFromBytes(bytes: Uint8Array): {
4
- type: number;
5
- data: Uint8Array;
6
- }[];
1
+ import { IoTizeBleCordovaPlugin } from './iotize-ble-cordova-plugin';
2
+ export declare function getIoTizeBleCordovaPlugin(): IoTizeBleCordovaPlugin;
3
+ export declare function getScanRecordsFromBytes(bytes: Uint8Array): {
4
+ type: number;
5
+ data: Uint8Array;
6
+ }[];
@@ -0,0 +1,7 @@
1
+ export { BLEComProtocol } from './lib/ble-com-protocol';
2
+ export { CordovaCharacteristicAdapter, CordovaPeripheralAdapter, CordovaServiceAdapter, } from './lib/cordova-service-adapter';
3
+ export { CordovaBLEScanResult, RequestDeviceOptions } from './lib/definitions';
4
+ export { BLEScanner } from './lib/scanner';
5
+ export { getIoTizeBleCordovaPlugin, getScanRecordsFromBytes, } from './lib/utility';
6
+ import { IoTizeBleCordovaPlugin } from './lib/iotize-ble-cordova-plugin';
7
+ export declare const iotizeBLE: IoTizeBleCordovaPlugin;
@@ -0,0 +1,7 @@
1
+ import { Decoder, Encoder } from '@iotize/common/converter/api';
2
+ export interface BodyEncoder<OutputType> extends Encoder<OutputType, Uint8Array> {
3
+ }
4
+ export interface BodyDecoder<OutputType> extends Decoder<Uint8Array, OutputType> {
5
+ }
6
+ export interface BodyConverter<OutputType> extends BodyDecoder<OutputType>, BodyEncoder<OutputType> {
7
+ }
@@ -0,0 +1,20 @@
1
+ import { Decoder, Encoder } from '@iotize/common/converter/api';
2
+ import { Observable } from 'rxjs';
3
+ import { TapRequestFrame, TapResponseFrame } from './generated/models';
4
+ import { TapClientInterface } from './tap-client.interface';
5
+ export interface EncryptionAlgo extends Encoder<Uint8Array, Uint8Array>, Decoder<Uint8Array, Uint8Array> {
6
+ setOptions(options: any): void;
7
+ }
8
+ export interface ExecutionContext {
9
+ request: TapRequestFrame;
10
+ bodyDecoder?: any;
11
+ client: TapClientInterface;
12
+ }
13
+ export interface RequestHandler {
14
+ handle(req: ExecutionContext): Observable<TapResponseFrame>;
15
+ }
16
+ export interface RequestInterceptor {
17
+ intercept(req: ExecutionContext, next: RequestHandler): Observable<TapResponseFrame>;
18
+ }
19
+ export type RequestInterceptorFct = (req: ExecutionContext, next: RequestHandler) => Observable<TapResponseFrame>;
20
+ export type RequestInterceptorType = RequestInterceptorFct | RequestInterceptor;
@@ -0,0 +1,150 @@
1
+ /**
2
+ * This file was automatically generated by json-schema-to-typescript.
3
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
4
+ * and run json-schema-to-typescript to regenerate this file.
5
+ */
6
+ export interface ApduRequest {
7
+ header: ApduRequest.Header;
8
+ data: Uint8Array;
9
+ }
10
+ export declare namespace ApduRequest {
11
+ /**
12
+ * This file was automatically generated by json-schema-to-typescript.
13
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
14
+ * and run json-schema-to-typescript to regenerate this file.
15
+ */
16
+ interface Header {
17
+ cla: number;
18
+ /**
19
+ * Instruction
20
+ */
21
+ ins: number;
22
+ /**
23
+ * Parameter 1
24
+ */
25
+ p1: number;
26
+ /**
27
+ * Parameter 2
28
+ */
29
+ p2: number;
30
+ /**
31
+ * Length
32
+ */
33
+ lc: number;
34
+ }
35
+ }
36
+ /**
37
+ * This file was automatically generated by json-schema-to-typescript.
38
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
39
+ * and run json-schema-to-typescript to regenerate this file.
40
+ */
41
+ export interface ApduResponse {
42
+ data: Uint8Array;
43
+ status: number;
44
+ }
45
+ export declare namespace ApduResponse {
46
+ /**
47
+ * This file was automatically generated by json-schema-to-typescript.
48
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
49
+ * and run json-schema-to-typescript to regenerate this file.
50
+ */
51
+ enum Status {
52
+ OK = 36864
53
+ }
54
+ }
55
+ /**
56
+ * This file was automatically generated by json-schema-to-typescript.
57
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
58
+ * and run json-schema-to-typescript to regenerate this file.
59
+ */
60
+ export interface TapRequestEncrypted {
61
+ header: ApduRequest.Header;
62
+ request: TapRequestFrame;
63
+ }
64
+ /**
65
+ * This file was automatically generated by json-schema-to-typescript.
66
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
67
+ * and run json-schema-to-typescript to regenerate this file.
68
+ */
69
+ export interface TapApduRequest {
70
+ }
71
+ export declare namespace TapApduRequest {
72
+ /**
73
+ * This file was automatically generated by json-schema-to-typescript.
74
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
75
+ * and run json-schema-to-typescript to regenerate this file.
76
+ */
77
+ enum MethodType {
78
+ GET = 202,
79
+ PUT_OR_POST = 218
80
+ }
81
+ /**
82
+ * This file was automatically generated by json-schema-to-typescript.
83
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
84
+ * and run json-schema-to-typescript to regenerate this file.
85
+ */
86
+ enum Default {
87
+ CLA = 162
88
+ }
89
+ }
90
+ /**
91
+ * This file was automatically generated by json-schema-to-typescript.
92
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
93
+ * and run json-schema-to-typescript to regenerate this file.
94
+ */
95
+ export interface TapEncryptedFrame {
96
+ id: number;
97
+ len: number;
98
+ payload: Uint8Array;
99
+ padding?: Uint8Array;
100
+ crc?: number;
101
+ }
102
+ /**
103
+ * This file was automatically generated by json-schema-to-typescript.
104
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
105
+ * and run json-schema-to-typescript to regenerate this file.
106
+ */
107
+ export interface TapRequestFrame {
108
+ header: TapRequestFrame.Header;
109
+ payload: Uint8Array;
110
+ }
111
+ export declare namespace TapRequestFrame {
112
+ /**
113
+ * This file was automatically generated by json-schema-to-typescript.
114
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
115
+ * and run json-schema-to-typescript to regenerate this file.
116
+ */
117
+ interface Header {
118
+ methodType: TapRequestFrame.MethodType;
119
+ path: TapRequestFrame.Path;
120
+ }
121
+ /**
122
+ * This file was automatically generated by json-schema-to-typescript.
123
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
124
+ * and run json-schema-to-typescript to regenerate this file.
125
+ */
126
+ interface Path {
127
+ objectId: number;
128
+ objectInstanceId: number;
129
+ resourceId: number;
130
+ }
131
+ /**
132
+ * This file was automatically generated by json-schema-to-typescript.
133
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
134
+ * and run json-schema-to-typescript to regenerate this file.
135
+ */
136
+ enum MethodType {
137
+ GET = 1,
138
+ POST = 2,
139
+ PUT = 3
140
+ }
141
+ }
142
+ /**
143
+ * This file was automatically generated by json-schema-to-typescript.
144
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
145
+ * and run json-schema-to-typescript to regenerate this file.
146
+ */
147
+ export interface TapResponseFrame {
148
+ status: number;
149
+ data: Uint8Array;
150
+ }
@@ -0,0 +1,170 @@
1
+ /**
2
+ * Generated file. Do not edit
3
+ */
4
+ export declare class ResultCode {
5
+ /**
6
+ * The request was successful
7
+ * hex: 0x0 / decimal: 0
8
+ */
9
+ static OK: number;
10
+ /**
11
+ * Create request was successful
12
+ * hex: 0x41 / decimal: 65
13
+ */
14
+ static CREATED: number;
15
+ /**
16
+ * Delete request was successful
17
+ * hex: 0x42 / decimal: 66
18
+ */
19
+ static DELETED: number;
20
+ /**
21
+ * Update request was successful
22
+ * hex: 0x44 / decimal: 68
23
+ */
24
+ static CHANGED: number;
25
+ /**
26
+ * The server has fulfilled the request and sent a response
27
+ * hex: 0x45 / decimal: 69
28
+ */
29
+ static CONTENT: number;
30
+ /**
31
+ * The server is busy
32
+ * hex: 0x46 / decimal: 70
33
+ */
34
+ static BUSY: number;
35
+ /**
36
+ * Bad request. Meaning device cannot understand your request.
37
+ * hex: 0x80 / decimal: 128
38
+ */
39
+ static BAD_REQUEST: number;
40
+ /**
41
+ * Current user is not authorized to access this ressource
42
+ * hex: 0x81 / decimal: 129
43
+ */
44
+ static UNAUTHORIZED: number;
45
+ /**
46
+ * The server has not found anything matching the Request
47
+ * hex: 0x84 / decimal: 132
48
+ */
49
+ static NOT_FOUND: number;
50
+ /**
51
+ * Current user is not authorized to access this ressource
52
+ * hex: 0x85 / decimal: 133
53
+ */
54
+ static METHOD_NOT_ALLOWED: number;
55
+ /**
56
+ * Given parameters are not acceptable
57
+ * hex: 0x86 / decimal: 134
58
+ */
59
+ static NOT_ACCEPTABLE: number;
60
+ /**
61
+ * Given resource is not available with the current TAP configuration.
62
+ * hex: 0x87 / decimal: 135
63
+ */
64
+ static RESOURCE_LOCKED: number;
65
+ /**
66
+ * Internal server error
67
+ * hex: 0xa0 / decimal: 160
68
+ */
69
+ static INTERNAL_SERVER_ERROR: number;
70
+ /**
71
+ * This resource has not been implemented yet
72
+ * hex: 0xa1 / decimal: 161
73
+ */
74
+ static NOT_IMPLEMENTED: number;
75
+ /**
76
+ * Service is currently unavailable. Try again later.
77
+ * hex: 0xa3 / decimal: 163
78
+ */
79
+ static SERVICE_UNAVAILABLE: number;
80
+ /**
81
+ * Writing non volatible memory failed
82
+ * hex: 0xa4 / decimal: 164
83
+ */
84
+ static NVM_ERROR: number;
85
+ /**
86
+ * Tap was not able to connect to the target
87
+ * hex: 0xa5 / decimal: 165
88
+ */
89
+ static UNABLE_TO_CONNECT_TO_TARGET: number;
90
+ /**
91
+ * Target power failure
92
+ * hex: 0xa6 / decimal: 166
93
+ */
94
+ static TARGET_POWER_FAILURE: number;
95
+ /**
96
+ * Non volatile memory is full
97
+ * hex: 0xa7 / decimal: 167
98
+ */
99
+ static NVM_FULL: number;
100
+ /**
101
+ * It means we can't access this resource because someone is already connected to this device and he has the priority over us.
102
+ * hex: 0xa8 / decimal: 168
103
+ */
104
+ static DEVICE_UNAVAILABLE: number;
105
+ /**
106
+ * Response is bigger than you current protocol limit
107
+ * hex: 0xa9 / decimal: 169
108
+ */
109
+ static RESPONSE_TOO_LARGE: number;
110
+ /**
111
+ * Target protocol error
112
+ * hex: 0xb0 / decimal: 176
113
+ */
114
+ static TARGET_PROTOCOL_ERROR: number;
115
+ /**
116
+ * Target protocol is busy
117
+ * hex: 0xb1 / decimal: 177
118
+ */
119
+ static TARGET_PROTOCOL_BUSY: number;
120
+ /**
121
+ * Target protocol error
122
+ * hex: 0xb2 / decimal: 178
123
+ */
124
+ static TARGET_PROTOCOL_REAL: number;
125
+ /**
126
+ * Target protocol parameters are not valid
127
+ * hex: 0xb3 / decimal: 179
128
+ */
129
+ static TARGET_PROTOCOL_WRONG_PARAM: number;
130
+ /**
131
+ * Target protocol is forbidden
132
+ * hex: 0xb4 / decimal: 180
133
+ */
134
+ static TARGET_PROTOCOL_FORBIDDEN: number;
135
+ /**
136
+ * Target protocol data are not the one expected. For example a CRC error.
137
+ * hex: 0xb5 / decimal: 181
138
+ */
139
+ static TARGET_PROTOCOL_DATA: number;
140
+ /**
141
+ * Target protocol communication error
142
+ * hex: 0xb6 / decimal: 182
143
+ */
144
+ static TARGET_PROTOCOL_COM: number;
145
+ /**
146
+ * Target protocol lost communication
147
+ * hex: 0xb7 / decimal: 183
148
+ */
149
+ static TARGET_PROTOCOL_LOST_COM: number;
150
+ /**
151
+ * Target protocol invalid parameter
152
+ * hex: 0xb8 / decimal: 184
153
+ */
154
+ static TARGET_PROTOCOL_PARAM: number;
155
+ /**
156
+ * Internal error with target communication
157
+ * hex: 0xb9 / decimal: 185
158
+ */
159
+ static TARGET_PROTOCOL_INT: number;
160
+ /**
161
+ * Operation aborted because one of the command did not return the expected result code.
162
+ * hex: 0xba / decimal: 186
163
+ */
164
+ static TARGET_PROTOCOL_ABORT: number;
165
+ /**
166
+ * Target protocol is not implemented
167
+ * hex: 0xbb / decimal: 187
168
+ */
169
+ static TARGET_PROTOCOL_NOT_IMPLEMENTED: number;
170
+ }
@@ -0,0 +1,28 @@
1
+ import { Decoder, Encoder } from '@iotize/common/converter/api';
2
+ import { ComProtocol, ConnectionStateChangeEvent } from '@iotize/tap/protocol/api';
3
+ import { Observable } from 'rxjs';
4
+ import { RequestInterceptorType } from './definitions';
5
+ import { TapRequestFrame, TapResponseFrame } from './generated/models';
6
+ export interface ProtocolChangeEvent {
7
+ newProtocol: ComProtocol;
8
+ oldProtocol?: ComProtocol;
9
+ }
10
+ export interface TapClientInterface {
11
+ commandEncoder: Encoder<TapRequestFrame, Uint8Array>;
12
+ responseDecoder: Decoder<Uint8Array, TapResponseFrame>;
13
+ /**
14
+ * Get current protocol
15
+ * @throw an error if no protocol
16
+ */
17
+ getCurrentProtocol(): ComProtocol;
18
+ addComProtocol(newProtocol: ComProtocol, id: string): this;
19
+ switchProtocol(type: string): this;
20
+ useComProtocol(protocol: ComProtocol | string): this;
21
+ connect(): Observable<any>;
22
+ disconnect(): Observable<any>;
23
+ request<T>(request: TapRequestFrame): Observable<TapResponseFrame>;
24
+ onConnectionStateChange(): Observable<ConnectionStateChangeEvent>;
25
+ isConnected(): boolean;
26
+ send<T>(dataIn: Uint8Array): Observable<TapResponseFrame>;
27
+ addInterceptor(interceptor: RequestInterceptorType): this;
28
+ }
@@ -0,0 +1,6 @@
1
+ export * from './lib/definitions';
2
+ export { type TapClientInterface, type ProtocolChangeEvent, } from './lib/tap-client.interface';
3
+ export * from './lib/converter/definitions';
4
+ export { ResultCode } from './lib/result-code';
5
+ export * from './lib/generated/models';
6
+ export declare const TAP_REQUEST_FRAME_HEADER_LENGTH = 7;
@@ -0,0 +1,2 @@
1
+ import { ApduRequest, TapRequestFrame } from '@iotize/tap/client/api';
2
+ export declare function createApduFromTapRequest(request: TapRequestFrame): ApduRequest;