@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,146 @@
|
|
|
1
|
+
import { ConnectionState } from '@iotize/tap/protocol/api';
|
|
2
|
+
import { QueueComProtocol } from '@iotize/tap/protocol/core';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
export declare namespace UniversalBleProtocolAdapter {
|
|
5
|
+
interface Options {
|
|
6
|
+
/**
|
|
7
|
+
* Force BLE maximum transfer unit size (in bytes)
|
|
8
|
+
*/
|
|
9
|
+
mtu?: number;
|
|
10
|
+
/**
|
|
11
|
+
* Maximum buffer length when response is splitted into multiple chunck
|
|
12
|
+
* (only used for legacy ble service)
|
|
13
|
+
*/
|
|
14
|
+
maximumBufferLength: number;
|
|
15
|
+
/**
|
|
16
|
+
* True to wait for write characteristic acknowledge
|
|
17
|
+
* According to firmware implementation, write acknowledge is not
|
|
18
|
+
* always returns, leading to a timeout exception in client
|
|
19
|
+
*/
|
|
20
|
+
waitForWriteAcknowledge: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* TapNLinks may have 2 different BLE characteristic to communicate
|
|
23
|
+
* You can define which one should be used in priority
|
|
24
|
+
* If it does not exist, it will use the other one
|
|
25
|
+
*/
|
|
26
|
+
preferedComServiceType?: 'legacy' | 'large-frame';
|
|
27
|
+
/**
|
|
28
|
+
* True if you want to remove '-' character from ID
|
|
29
|
+
*/
|
|
30
|
+
sanitizeUUID?: boolean;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export declare const DEFAULT_BLE_OPTIONS: UniversalBleProtocolAdapter.Options;
|
|
34
|
+
/**
|
|
35
|
+
* BLE communication
|
|
36
|
+
*
|
|
37
|
+
* With ble communication, data is split into sub packets.
|
|
38
|
+
* This class handles creation of packet chunks.
|
|
39
|
+
*
|
|
40
|
+
* - You must only implement the function to send one packet chunk writeLwm2mPacketChunk()
|
|
41
|
+
* -
|
|
42
|
+
*/
|
|
43
|
+
export declare class UniversalBleProtocolAdapter<T extends ServiceAdapterInterface = ServiceAdapterInterface> extends QueueComProtocol {
|
|
44
|
+
peripheral: PeripheralAdapterInterface<T>;
|
|
45
|
+
private _lwm2mCharc?;
|
|
46
|
+
private _useSplitter;
|
|
47
|
+
private _readPromise?;
|
|
48
|
+
bleOptions: UniversalBleProtocolAdapter.Options;
|
|
49
|
+
private _unexpectedBleDisconnection;
|
|
50
|
+
constructor(peripheral: PeripheralAdapterInterface<T>, bleOptions?: Partial<UniversalBleProtocolAdapter.Options>);
|
|
51
|
+
get lwm2mCharc(): CharacteristicAdapterInterface;
|
|
52
|
+
private sanitizeUUID;
|
|
53
|
+
_connect(): Observable<any>;
|
|
54
|
+
_disconnect(): Observable<any>;
|
|
55
|
+
private setupLwm2mCharacteristic;
|
|
56
|
+
private _selectLwm2mCharacteristic;
|
|
57
|
+
private _getLargeFrameLwm2mCharacteristic;
|
|
58
|
+
private _getLegacyLwm2mCharacteristic;
|
|
59
|
+
read(): Promise<Uint8Array>;
|
|
60
|
+
readUnit(): Promise<Uint8Array>;
|
|
61
|
+
write(data: Uint8Array): Promise<any>;
|
|
62
|
+
get useSplitter(): boolean;
|
|
63
|
+
get chunkSize(): number;
|
|
64
|
+
writeUnit(data: Uint8Array): Promise<any>;
|
|
65
|
+
private _createReadPromise;
|
|
66
|
+
}
|
|
67
|
+
export interface PeripheralAdapterInterface<T extends ServiceAdapterInterface = ServiceAdapterInterface> {
|
|
68
|
+
state: string;
|
|
69
|
+
stateChange: Observable<ConnectionState>;
|
|
70
|
+
name?: string;
|
|
71
|
+
id: string;
|
|
72
|
+
/**
|
|
73
|
+
* Discover services
|
|
74
|
+
* @param serviceUUIDs if not provided it will discover all services, if provided it will discover the given services
|
|
75
|
+
* @returns returns a map of services discovered. If a listed service is not discovered, it will be set to undefined
|
|
76
|
+
*/
|
|
77
|
+
discoverServices<Key extends string = string>(serviceUUIDs?: Key[]): Promise<Partial<Record<Key, T>>>;
|
|
78
|
+
connect(): Promise<void>;
|
|
79
|
+
disconnect(): Promise<void>;
|
|
80
|
+
getService(uuid: string): Promise<T>;
|
|
81
|
+
}
|
|
82
|
+
export interface CharacteristicProperties {
|
|
83
|
+
readonly broadcast: boolean;
|
|
84
|
+
readonly read: boolean;
|
|
85
|
+
readonly writeWithoutResponse: boolean;
|
|
86
|
+
readonly write: boolean;
|
|
87
|
+
readonly notify: boolean;
|
|
88
|
+
readonly indicate: boolean;
|
|
89
|
+
readonly authenticatedSignedWrites: boolean;
|
|
90
|
+
readonly reliableWrite: boolean;
|
|
91
|
+
readonly writableAuxiliaries: boolean;
|
|
92
|
+
}
|
|
93
|
+
export interface ServiceAdapterInterface<CharacteristicType extends CharacteristicAdapterInterface = CharacteristicAdapterInterface> {
|
|
94
|
+
uuid: string;
|
|
95
|
+
/**
|
|
96
|
+
* Get characteristic identified by the given UUID
|
|
97
|
+
* @throws if characteristic does not exist
|
|
98
|
+
*
|
|
99
|
+
* @param charcUUID
|
|
100
|
+
*/
|
|
101
|
+
getCharacteristic(charcUUID: string): Promise<CharacteristicType>;
|
|
102
|
+
getCharacteristics(): Promise<CharacteristicType[]>;
|
|
103
|
+
}
|
|
104
|
+
export interface CharacteristicAdapterInterface<DescriptorType extends DescriptorAdapterInterface = DescriptorAdapterInterface> {
|
|
105
|
+
uuid: string;
|
|
106
|
+
properties: CharacteristicProperties;
|
|
107
|
+
data: Observable<{
|
|
108
|
+
data: Uint8Array;
|
|
109
|
+
isNotification: boolean;
|
|
110
|
+
}>;
|
|
111
|
+
/**
|
|
112
|
+
* Write characteristic value
|
|
113
|
+
* If successful, returns the written data
|
|
114
|
+
* @param data
|
|
115
|
+
* @param writeWithoutResponse
|
|
116
|
+
*/
|
|
117
|
+
write(data: Uint8Array, writeWithoutResponse: boolean): Promise<Uint8Array>;
|
|
118
|
+
/**
|
|
119
|
+
* Read characteristic value
|
|
120
|
+
*/
|
|
121
|
+
read(): Promise<Uint8Array>;
|
|
122
|
+
/**
|
|
123
|
+
* Start/Stop notifications with indication or notification accordording to
|
|
124
|
+
* characteristic configuration
|
|
125
|
+
* @param enabled
|
|
126
|
+
*/
|
|
127
|
+
enableNotifications(enabled: boolean): Promise<void>;
|
|
128
|
+
/**
|
|
129
|
+
* Get descriptors
|
|
130
|
+
*/
|
|
131
|
+
getDescriptors(): Promise<DescriptorType[]>;
|
|
132
|
+
}
|
|
133
|
+
export interface DescriptorAdapterInterface {
|
|
134
|
+
/**
|
|
135
|
+
* Descriptor UUID
|
|
136
|
+
*/
|
|
137
|
+
uuid: string;
|
|
138
|
+
/**
|
|
139
|
+
* Write descriptor value
|
|
140
|
+
*/
|
|
141
|
+
writeValue(data: Uint8Array): Promise<void>;
|
|
142
|
+
/**
|
|
143
|
+
* Read descriptor value
|
|
144
|
+
*/
|
|
145
|
+
readValue(): Promise<Uint8Array>;
|
|
146
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function sanitizeUUID(input: string): string;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComProtocol, ComProtocolConnectOptions, ComProtocolOptions, ComProtocolSendOptions, ConnectionState, ConnectionStateChangeEvent } from '@iotize/tap/protocol/api';
|
|
2
|
+
import { Observable, Subject } from 'rxjs';
|
|
3
|
+
export declare abstract class AbstractComProtocol implements ComProtocol {
|
|
4
|
+
_connectionStateChange?: Subject<ConnectionStateChangeEvent>;
|
|
5
|
+
protected connectionState: ConnectionState;
|
|
6
|
+
protected _options: ComProtocolOptions;
|
|
7
|
+
get options(): ComProtocolOptions;
|
|
8
|
+
set options(options: ComProtocolOptions);
|
|
9
|
+
abstract write(data: Uint8Array): Promise<any>;
|
|
10
|
+
abstract read(): Promise<Uint8Array>;
|
|
11
|
+
abstract connect(options?: ComProtocolConnectOptions): Observable<any>;
|
|
12
|
+
abstract disconnect(options?: ComProtocolConnectOptions): Observable<any>;
|
|
13
|
+
abstract send(data: Uint8Array, options?: ComProtocolSendOptions): Observable<Uint8Array>;
|
|
14
|
+
constructor();
|
|
15
|
+
getConnectionState(): ConnectionState;
|
|
16
|
+
isConnected(): boolean;
|
|
17
|
+
setConnectionState(connectionState: ConnectionState): this;
|
|
18
|
+
/**
|
|
19
|
+
* Must be implemented in childs
|
|
20
|
+
*/
|
|
21
|
+
receiveStream(): Observable<Uint8Array>;
|
|
22
|
+
onConnectionStateChange(): Observable<ConnectionStateChangeEvent>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ComProtocolConnectOptions, ComProtocolDisconnectOptions, ComProtocolSendOptions } from '@iotize/tap/protocol/api';
|
|
2
|
+
import { Observable, Subscription } from 'rxjs';
|
|
3
|
+
import { AbstractComProtocol } from './abstract-com-protocol';
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
export declare abstract class QueueComProtocol extends AbstractComProtocol {
|
|
8
|
+
_disconnect$?: Observable<any>;
|
|
9
|
+
_connect$?: Observable<any>;
|
|
10
|
+
_connectionSubscription?: Subscription;
|
|
11
|
+
private _jobQueue;
|
|
12
|
+
abstract _connect(options?: ComProtocolConnectOptions): Observable<any>;
|
|
13
|
+
abstract _disconnect(options?: ComProtocolDisconnectOptions): Observable<any>;
|
|
14
|
+
_send(data: Uint8Array, options: ComProtocolSendOptions): Observable<Uint8Array>;
|
|
15
|
+
constructor();
|
|
16
|
+
/**
|
|
17
|
+
* Cancel pending requests
|
|
18
|
+
*/
|
|
19
|
+
cancel(): void;
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
* @param data
|
|
23
|
+
* @param options
|
|
24
|
+
*/
|
|
25
|
+
send(data: Uint8Array, options?: ComProtocolSendOptions): Observable<Uint8Array>;
|
|
26
|
+
/**
|
|
27
|
+
* Connect with timeout
|
|
28
|
+
*
|
|
29
|
+
* If connect has already been called or is in progress / no further action
|
|
30
|
+
*
|
|
31
|
+
* @param options
|
|
32
|
+
*/
|
|
33
|
+
connect(options?: ComProtocolConnectOptions): Observable<any>;
|
|
34
|
+
disconnect(options?: ComProtocolDisconnectOptions): Observable<any>;
|
|
35
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
/**
|
|
3
|
+
* Scan options provided when starting scan
|
|
4
|
+
*/
|
|
5
|
+
export interface DeviceScannerOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Timeout in milliseconds
|
|
8
|
+
*/
|
|
9
|
+
timeout?: number;
|
|
10
|
+
}
|
|
11
|
+
export interface DeviceScanner<DataType> {
|
|
12
|
+
/**
|
|
13
|
+
* Observable on scanner state (true = scanner is running)
|
|
14
|
+
*/
|
|
15
|
+
scanning: Observable<boolean>;
|
|
16
|
+
/**
|
|
17
|
+
* return true if scanner is currently running
|
|
18
|
+
*/
|
|
19
|
+
isScanning: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Emit scan results
|
|
22
|
+
*/
|
|
23
|
+
results: Observable<DataType[]>;
|
|
24
|
+
/**
|
|
25
|
+
* Start scan
|
|
26
|
+
* Will return an Observable that emitts @{link DeviceScanResult} each time
|
|
27
|
+
* a device is disoverd
|
|
28
|
+
* @param option
|
|
29
|
+
*/
|
|
30
|
+
start(option?: DeviceScannerOptions): Promise<any>;
|
|
31
|
+
/**
|
|
32
|
+
* Stop scan
|
|
33
|
+
*/
|
|
34
|
+
stop(): Promise<any>;
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './lib/definitions';
|