@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,5 @@
|
|
|
1
|
+
import { Encoder } from './encoder.interface';
|
|
2
|
+
import { Decoder } from './decoder.interface';
|
|
3
|
+
export interface EncoderDecoder<InputType, OutputType> extends Encoder<InputType, OutputType>, Decoder<OutputType, InputType> {
|
|
4
|
+
}
|
|
5
|
+
export type EncoderDecoderFct<InputType, OutputType> = (input: InputType) => OutputType;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './lib/debug';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseError } from './base-error';
|
|
2
|
+
/**
|
|
3
|
+
* Error class with code property
|
|
4
|
+
*/
|
|
5
|
+
export declare class CodeError<CodeType = string> extends BaseError {
|
|
6
|
+
code: CodeType;
|
|
7
|
+
constructor(msg: string, code: CodeType);
|
|
8
|
+
}
|
|
9
|
+
export declare function isCodeError<OError extends CodeError, CodeType = string>(code: CodeType, err: Error | OError | unknown): err is OError;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run promise one after another (sequentially)
|
|
3
|
+
* @param tasks
|
|
4
|
+
* @param fn promise factory function. Will take task as parameter an returns a Promise
|
|
5
|
+
*/
|
|
6
|
+
export declare function promiseSerial<T = any>(tasks: T[], fn: (task: T, index: number) => Promise<any>): Promise<any>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns promise that will be rejected with Timeout error if not resolved in time
|
|
3
|
+
* @param ms timeout value in milliseconds. if <= 0, will be immediatly rejected
|
|
4
|
+
* @param promise
|
|
5
|
+
* @param errorFactory function to create the error when timeout occurs
|
|
6
|
+
*/
|
|
7
|
+
export declare function promiseTimeout<T>(ms: number, promise: Promise<T>, errorFactory?: (args: {
|
|
8
|
+
timeout: number;
|
|
9
|
+
startTime: Date;
|
|
10
|
+
}) => Error): Promise<T>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { TaskInterface } from './definitions';
|
|
3
|
+
export declare class CancelableTask<T> implements TaskInterface<T> {
|
|
4
|
+
private operation;
|
|
5
|
+
private _canceled;
|
|
6
|
+
private _executed;
|
|
7
|
+
private _subject;
|
|
8
|
+
get isCanceled(): boolean;
|
|
9
|
+
constructor(operation: () => Observable<T>);
|
|
10
|
+
/**
|
|
11
|
+
* If canceled is called before the execute => do nothing
|
|
12
|
+
* otherwise reject pending request
|
|
13
|
+
* If canceled is called more than once, do nothing
|
|
14
|
+
*/
|
|
15
|
+
cancel(withError?: Error): void;
|
|
16
|
+
/**
|
|
17
|
+
* If execute is called after cancel => return Operation cancelled exception
|
|
18
|
+
* If already executing, return the current execution promise
|
|
19
|
+
*/
|
|
20
|
+
execute(): Observable<T>;
|
|
21
|
+
toObservable(): Observable<T>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
export interface TaskInterface<T> {
|
|
3
|
+
cancel(withError?: Error): void;
|
|
4
|
+
execute(): Observable<T>;
|
|
5
|
+
toObservable(): Observable<T>;
|
|
6
|
+
}
|
|
7
|
+
export declare class TaskError extends Error {
|
|
8
|
+
code: TaskError.Code;
|
|
9
|
+
constructor(code: TaskError.Code, msg: string);
|
|
10
|
+
static operationCancelled(task: TaskInterface<any>): TaskError;
|
|
11
|
+
}
|
|
12
|
+
export declare namespace TaskError {
|
|
13
|
+
enum Code {
|
|
14
|
+
TASK_OPERATION_CANCELLED = "TASK_OPERATION_CANCELLED"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { Observable, Observer, Subject } from 'rxjs';
|
|
2
|
+
/**
|
|
3
|
+
* Step operation execution manager
|
|
4
|
+
*
|
|
5
|
+
* Template type T: the event type. It's the return type of each operations
|
|
6
|
+
* Template type DataType: context additional DataType
|
|
7
|
+
* @experimental
|
|
8
|
+
*/
|
|
9
|
+
export declare class StepOperations<T, DataType extends Record<string, any>> {
|
|
10
|
+
private operationContainers;
|
|
11
|
+
private _state;
|
|
12
|
+
_taskErrorHandler?: StepOperations.ErrorHandler;
|
|
13
|
+
_currentExecutionEvents?: Subject<T>;
|
|
14
|
+
_events: Subject<any>;
|
|
15
|
+
get isCancelled(): boolean;
|
|
16
|
+
get isCompleted(): boolean;
|
|
17
|
+
get state(): StepOperations.State;
|
|
18
|
+
get events(): Observable<any>;
|
|
19
|
+
set taskErrorHandler(errorHandler: StepOperations.ErrorHandler | undefined);
|
|
20
|
+
get operations(): StepOperations.Operation<T, DataType>[];
|
|
21
|
+
constructor(operationContainers: StepOperations.OperationContainer<T, DataType>[]);
|
|
22
|
+
static createSequentialContainers<EventType, DataType extends Record<string, any> = any>(operations: StepOperations.OperationType<EventType, DataType>[]): StepOperations.OperationContainer<EventType, DataType>[];
|
|
23
|
+
static sequential<EventType, DataType extends Record<string, any> = any>(operations: StepOperations.OperationType<EventType, DataType>[]): StepOperations<EventType, DataType>;
|
|
24
|
+
runEvents(): Observable<T>;
|
|
25
|
+
/**
|
|
26
|
+
* Reset as if operations were never executed.
|
|
27
|
+
* Will call onReset callback for each Operation if defined.
|
|
28
|
+
* @returns this
|
|
29
|
+
*/
|
|
30
|
+
reset(): this;
|
|
31
|
+
/**
|
|
32
|
+
* Will retry from the last failed operation.
|
|
33
|
+
* Call 'onRetry' callback for each Operation if definied.
|
|
34
|
+
*
|
|
35
|
+
* If all operations where successfully executed, it will do nothing.
|
|
36
|
+
*
|
|
37
|
+
* Call reset() first if you want to run operations again.
|
|
38
|
+
*/
|
|
39
|
+
retry(): Observable<T>;
|
|
40
|
+
/**
|
|
41
|
+
* Execute operations
|
|
42
|
+
* If it already running, do nothing
|
|
43
|
+
*
|
|
44
|
+
*/
|
|
45
|
+
run(): Observable<T>;
|
|
46
|
+
/**
|
|
47
|
+
* Cancel running operations
|
|
48
|
+
*/
|
|
49
|
+
cancel(): void;
|
|
50
|
+
/**
|
|
51
|
+
* Transform this operation as an observable
|
|
52
|
+
* Subscribe to observable to run operation
|
|
53
|
+
* Unsubscribe to cancel operation
|
|
54
|
+
*
|
|
55
|
+
* Each time you call this method, a new observable is created
|
|
56
|
+
*/
|
|
57
|
+
asObservable(): Observable<T>;
|
|
58
|
+
private checkIsCancelled;
|
|
59
|
+
private checkIsRunning;
|
|
60
|
+
private _onTaskError;
|
|
61
|
+
private _start;
|
|
62
|
+
private onComplete;
|
|
63
|
+
private onError;
|
|
64
|
+
}
|
|
65
|
+
export declare class StepOperationsError extends Error {
|
|
66
|
+
code: string;
|
|
67
|
+
constructor(code: string, msg: string);
|
|
68
|
+
static cancel(): StepOperationsError;
|
|
69
|
+
static unknown(msg: string): StepOperationsError;
|
|
70
|
+
}
|
|
71
|
+
export declare namespace StepOperationsError {
|
|
72
|
+
enum Code {
|
|
73
|
+
UNKNOWN_ERROR = "STEP_OPERATION_UNKNOWN_ERROR",
|
|
74
|
+
STEP_OPERATION_CANCEL = "STEP_OPERATION_CANCEL"
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
export declare namespace StepOperations {
|
|
78
|
+
interface OperationContainer<T, DataType extends Record<string, any>> {
|
|
79
|
+
index: number;
|
|
80
|
+
done?: boolean;
|
|
81
|
+
result?: T;
|
|
82
|
+
error?: Error;
|
|
83
|
+
operation: Operation<T, DataType>;
|
|
84
|
+
}
|
|
85
|
+
interface ErrorHandler {
|
|
86
|
+
handle(err: Error, context: Context): void;
|
|
87
|
+
}
|
|
88
|
+
type OperationFct<T, DataType extends Record<string, any> = any> = (observer: Observer<T>, context: Context<DataType>) => Promise<any>;
|
|
89
|
+
interface Operation<T, DataType extends Record<string, any> = any> {
|
|
90
|
+
alias?: string;
|
|
91
|
+
onRetry?: () => void;
|
|
92
|
+
onReset?: () => void;
|
|
93
|
+
perform(observer: Observer<T>, context: Context<DataType>): Promise<any>;
|
|
94
|
+
}
|
|
95
|
+
type OperationType<EventType, DataType extends Record<string, any> = any> = Operation<EventType, DataType> | OperationFct<EventType, DataType> | Observable<EventType>;
|
|
96
|
+
interface Context<DataType extends Record<string, any> = any> {
|
|
97
|
+
position: number;
|
|
98
|
+
total: number;
|
|
99
|
+
index: number;
|
|
100
|
+
prevOperation?: StepOperations.OperationContainer<any, DataType>;
|
|
101
|
+
data: DataType;
|
|
102
|
+
}
|
|
103
|
+
enum State {
|
|
104
|
+
PENDING = "PENDING",
|
|
105
|
+
RUNNING = "RUNNING",
|
|
106
|
+
COMPLETED = "COMPLETED",
|
|
107
|
+
CANCELED = "CANCELED",
|
|
108
|
+
ERRORED = "ERRORED"
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
export declare class IgnoreErrorStrategy {
|
|
112
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { TaskInterface } from './definitions';
|
|
3
|
+
/**
|
|
4
|
+
* Task queue is used to run async task sequentially
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* ```typescript
|
|
8
|
+
* const taskQueue = new TaskQueue();
|
|
9
|
+
*
|
|
10
|
+
* taskQueue.addExecutor(() => of('Task 1 finished').pipe(delay(100))).subscribe(console.log);
|
|
11
|
+
* taskQueue.addExecutor(() => of('Task 2 finished').pipe(delay(1))).subscribe(console.log);
|
|
12
|
+
*
|
|
13
|
+
* // Will output
|
|
14
|
+
* Task 1 finished
|
|
15
|
+
* Task 2 finished
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare class TaskQueue {
|
|
19
|
+
tasks: TaskInterface<any>[];
|
|
20
|
+
private _subscription?;
|
|
21
|
+
private set workingState(value);
|
|
22
|
+
currentTask?: TaskInterface<any>;
|
|
23
|
+
constructor();
|
|
24
|
+
addExecutor(executor: () => Observable<any>): Observable<any>;
|
|
25
|
+
addTask(task: TaskInterface<any>): Observable<any>;
|
|
26
|
+
cancelAll(withError?: Error): void;
|
|
27
|
+
private processNext;
|
|
28
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { KaitaiStreamWriter } from '@iotize/common/byte-stream';
|
|
2
|
+
export declare namespace TLV {
|
|
3
|
+
interface TlvNode {
|
|
4
|
+
header: Header;
|
|
5
|
+
children?: Array<TlvNode>;
|
|
6
|
+
payload?: Uint8Array;
|
|
7
|
+
}
|
|
8
|
+
interface Schema {
|
|
9
|
+
validate: any;
|
|
10
|
+
resources: {
|
|
11
|
+
[key: string]: Resource;
|
|
12
|
+
};
|
|
13
|
+
id: {
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
enum DataType {
|
|
18
|
+
String = "String",
|
|
19
|
+
Integer = "Integer",
|
|
20
|
+
Float = "Float",
|
|
21
|
+
Boolean = "Boolean",
|
|
22
|
+
Opaque = "Opaque",
|
|
23
|
+
Time = "Time",
|
|
24
|
+
Array = "Array"
|
|
25
|
+
}
|
|
26
|
+
interface Resource {
|
|
27
|
+
id: string;
|
|
28
|
+
type: DataType | Array<any>;
|
|
29
|
+
}
|
|
30
|
+
interface Header {
|
|
31
|
+
id: number;
|
|
32
|
+
len: number;
|
|
33
|
+
type: IdentifierType;
|
|
34
|
+
}
|
|
35
|
+
enum IdentifierType {
|
|
36
|
+
OBJECT_INSTANCE = 0,
|
|
37
|
+
RESOURCE_INSTANCE = 1,
|
|
38
|
+
MULTIPLE_RESOURCE = 2,
|
|
39
|
+
RESOURCE_VALUE = 3
|
|
40
|
+
}
|
|
41
|
+
function tlvType(type: number, id: number, len: number): number;
|
|
42
|
+
class Parser {
|
|
43
|
+
private buffer;
|
|
44
|
+
position: number;
|
|
45
|
+
schema?: Schema;
|
|
46
|
+
constructor(schema?: Schema);
|
|
47
|
+
/**
|
|
48
|
+
*
|
|
49
|
+
* @param buf
|
|
50
|
+
* @param offset
|
|
51
|
+
* @param tlv
|
|
52
|
+
*/
|
|
53
|
+
readHeader(): Header;
|
|
54
|
+
readNextRecord(): TlvNode;
|
|
55
|
+
append(header: Header, type: DataType): any;
|
|
56
|
+
readAllRecords(endPosition: number): TlvNode[];
|
|
57
|
+
parse(data: Uint8Array): TlvNode;
|
|
58
|
+
private debug;
|
|
59
|
+
}
|
|
60
|
+
class Serializer {
|
|
61
|
+
serialize(obj: TLV.TlvNode, stream?: KaitaiStreamWriter): Uint8Array;
|
|
62
|
+
private writeHeader;
|
|
63
|
+
serializeObj(obj: Record<string, any>, schema?: Schema): Uint8Array;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './lib/tlv';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function assertError(msg: string): void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deep copy given object.
|
|
3
|
+
* It supports
|
|
4
|
+
* - primitive types (number, string, array)
|
|
5
|
+
* - Uint8Array
|
|
6
|
+
* - objects
|
|
7
|
+
* - Date
|
|
8
|
+
*
|
|
9
|
+
* It may loose type for others...
|
|
10
|
+
*
|
|
11
|
+
* @param T Generic type of target/copied value.
|
|
12
|
+
* @param target Target value to be copied.
|
|
13
|
+
*/
|
|
14
|
+
export declare const deepCopy: <T>(target: T, hash?: WeakMap<any, any>) => T;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare function safeEnumValue<T extends {
|
|
2
|
+
[key: string]: string | number;
|
|
3
|
+
}>(enumData: T, key: string | keyof T): T[keyof T];
|
|
4
|
+
/**
|
|
5
|
+
* List enum keys. It works for string and number enum where Object.keys will returns both key and values.
|
|
6
|
+
*
|
|
7
|
+
* ```typescript
|
|
8
|
+
* enum EnumString {
|
|
9
|
+
* A = 'MyValueA',
|
|
10
|
+
* B = 'MyValueB
|
|
11
|
+
* }
|
|
12
|
+
*
|
|
13
|
+
* expect(listEnumKeys(EnumString)).to.be.eq(['A', 'B']);
|
|
14
|
+
* expect(Object.keys(EnumString)).to.be.eq(['A', 'B', 'MyValueA', 'MyValueB']);
|
|
15
|
+
* ```
|
|
16
|
+
* @param enumType
|
|
17
|
+
*/
|
|
18
|
+
export declare function listEnumKeys<T>(enumType: T): string[];
|
|
19
|
+
/**
|
|
20
|
+
* List enum values
|
|
21
|
+
* @param enumType
|
|
22
|
+
*/
|
|
23
|
+
export declare function listEnumValues<T>(enumType: T): (string | number)[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function sleep(duration: number): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function deepEqual(x: any, y: any, hash?: WeakMap<any, boolean>): boolean;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { ComProtocolConnectOptions, ComProtocolDisconnectOptions, ComProtocolOptions, ComProtocolSendOptions } from '@iotize/tap/protocol/api';
|
|
2
|
-
import { QueueComProtocol } from '@iotize/tap/protocol/core';
|
|
3
|
-
import { Observable } from 'rxjs';
|
|
4
|
-
import { IoTizeBleCordovaPlugin } from './iotize-ble-cordova-plugin';
|
|
5
|
-
export declare class BLEComProtocol extends QueueComProtocol {
|
|
6
|
-
private deviceId;
|
|
7
|
-
readonly cordovaInterfaceOverwrite?: IoTizeBleCordovaPlugin | undefined;
|
|
8
|
-
/**
|
|
9
|
-
* Lazy reference to iotizeBLE.
|
|
10
|
-
* We don't want to reference iotizeBLE in constructor as it may be referenced
|
|
11
|
-
* before cordova plugin is loaded
|
|
12
|
-
*/
|
|
13
|
-
private get pluginInterface();
|
|
14
|
-
constructor(deviceId: string, comProtocolOptions?: ComProtocolOptions, cordovaInterfaceOverwrite?: IoTizeBleCordovaPlugin | undefined);
|
|
15
|
-
_connect(options?: ComProtocolConnectOptions): Observable<any>;
|
|
16
|
-
_disconnect(options?: ComProtocolDisconnectOptions): Observable<any>;
|
|
17
|
-
write(data: Uint8Array): Promise<any>;
|
|
18
|
-
read(): Promise<Uint8Array>;
|
|
19
|
-
send(data: Uint8Array, options?: ComProtocolSendOptions): Observable<Uint8Array>;
|
|
20
|
-
}
|
|
1
|
+
import { ComProtocolConnectOptions, ComProtocolDisconnectOptions, ComProtocolOptions, ComProtocolSendOptions } from '@iotize/tap/protocol/api';
|
|
2
|
+
import { QueueComProtocol } from '@iotize/tap/protocol/core';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
import { IoTizeBleCordovaPlugin } from './iotize-ble-cordova-plugin';
|
|
5
|
+
export declare class BLEComProtocol extends QueueComProtocol {
|
|
6
|
+
private deviceId;
|
|
7
|
+
readonly cordovaInterfaceOverwrite?: IoTizeBleCordovaPlugin | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* Lazy reference to iotizeBLE.
|
|
10
|
+
* We don't want to reference iotizeBLE in constructor as it may be referenced
|
|
11
|
+
* before cordova plugin is loaded
|
|
12
|
+
*/
|
|
13
|
+
private get pluginInterface();
|
|
14
|
+
constructor(deviceId: string, comProtocolOptions?: ComProtocolOptions, cordovaInterfaceOverwrite?: IoTizeBleCordovaPlugin | undefined);
|
|
15
|
+
_connect(options?: ComProtocolConnectOptions): Observable<any>;
|
|
16
|
+
_disconnect(options?: ComProtocolDisconnectOptions): Observable<any>;
|
|
17
|
+
write(data: Uint8Array): Promise<any>;
|
|
18
|
+
read(): Promise<Uint8Array>;
|
|
19
|
+
send(data: Uint8Array, options?: ComProtocolSendOptions): Observable<Uint8Array>;
|
|
20
|
+
}
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { CodeError } from '@iotize/common/error';
|
|
2
|
-
export declare class CordovaBLEError extends CodeError {
|
|
3
|
-
static invalidErrorResult(errObject: {
|
|
4
|
-
code?: string | undefined;
|
|
5
|
-
message?: string | undefined;
|
|
6
|
-
}): CordovaBLEError;
|
|
7
|
-
static invalidErrorCode(errObject: {
|
|
8
|
-
code?: string | undefined;
|
|
9
|
-
message?: string | undefined;
|
|
10
|
-
}): CordovaBLEError;
|
|
11
|
-
static invalidNativeCallResult(result: any, cause: Error): CordovaBLEError;
|
|
12
|
-
static isValidErrorCode(code: string): code is keyof typeof CordovaBLEError.Code;
|
|
13
|
-
static iotizeBLEMissing(): CordovaBLEError;
|
|
14
|
-
}
|
|
15
|
-
export declare namespace CordovaBLEError {
|
|
16
|
-
enum Code {
|
|
17
|
-
InternalError = "CordovaBLEErrorInternalError",
|
|
18
|
-
IllegalArgument = "CordovaBLEErrorIllegalArgument",
|
|
19
|
-
BLENotAvailable = "CordovaBLEErrorBLENotAvailable",
|
|
20
|
-
InvalidMacAddress = "InvalidMacAddressInvalidMacAddress",
|
|
21
|
-
ConnectionError = "CordovaBLEErrorConnectionError",
|
|
22
|
-
RequestError = "CordovaBLEErrorRequestError",
|
|
23
|
-
LocationServiceDisabled = "CordovaBLEErrorLocationServiceDisabled",
|
|
24
|
-
DisconnectError = "CordovaBLEErrorDisconnectError",
|
|
25
|
-
IllegalAction = "CordovaBLEErrorIllegalAction",
|
|
26
|
-
NotConnectedError = "CordovaBLEErrorNotConnectedError",
|
|
27
|
-
StatusCodeError = "CordovaBLEErrorStatusCodeError"
|
|
28
|
-
}
|
|
29
|
-
}
|
|
1
|
+
import { CodeError } from '@iotize/common/error';
|
|
2
|
+
export declare class CordovaBLEError extends CodeError {
|
|
3
|
+
static invalidErrorResult(errObject: {
|
|
4
|
+
code?: string | undefined;
|
|
5
|
+
message?: string | undefined;
|
|
6
|
+
}): CordovaBLEError;
|
|
7
|
+
static invalidErrorCode(errObject: {
|
|
8
|
+
code?: string | undefined;
|
|
9
|
+
message?: string | undefined;
|
|
10
|
+
}): CordovaBLEError;
|
|
11
|
+
static invalidNativeCallResult(result: any, cause: Error): CordovaBLEError;
|
|
12
|
+
static isValidErrorCode(code: string): code is keyof typeof CordovaBLEError.Code;
|
|
13
|
+
static iotizeBLEMissing(): CordovaBLEError;
|
|
14
|
+
}
|
|
15
|
+
export declare namespace CordovaBLEError {
|
|
16
|
+
enum Code {
|
|
17
|
+
InternalError = "CordovaBLEErrorInternalError",
|
|
18
|
+
IllegalArgument = "CordovaBLEErrorIllegalArgument",
|
|
19
|
+
BLENotAvailable = "CordovaBLEErrorBLENotAvailable",
|
|
20
|
+
InvalidMacAddress = "InvalidMacAddressInvalidMacAddress",
|
|
21
|
+
ConnectionError = "CordovaBLEErrorConnectionError",
|
|
22
|
+
RequestError = "CordovaBLEErrorRequestError",
|
|
23
|
+
LocationServiceDisabled = "CordovaBLEErrorLocationServiceDisabled",
|
|
24
|
+
DisconnectError = "CordovaBLEErrorDisconnectError",
|
|
25
|
+
IllegalAction = "CordovaBLEErrorIllegalAction",
|
|
26
|
+
NotConnectedError = "CordovaBLEErrorNotConnectedError",
|
|
27
|
+
StatusCodeError = "CordovaBLEErrorStatusCodeError"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export interface CordovaInterface {
|
|
2
|
-
exec<T>(success: SuccessCallback<T>, error: ErrorCallback, className: string, action: string, ...args: any[]): void;
|
|
3
|
-
}
|
|
4
|
-
export
|
|
5
|
-
export
|
|
1
|
+
export interface CordovaInterface {
|
|
2
|
+
exec<T>(success: SuccessCallback<T>, error: ErrorCallback, className: string, action: string, ...args: any[]): void;
|
|
3
|
+
}
|
|
4
|
+
export type ErrorCallback = (err: Error) => void;
|
|
5
|
+
export type SuccessCallback<T> = (data: T) => void;
|
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
import { ConnectionState } from
|
|
2
|
-
import { CharacteristicAdapterInterface, PeripheralAdapterInterface, ServiceAdapterInterface, DescriptorAdapterInterface, CharacteristicProperties } from
|
|
3
|
-
import { Observable } from
|
|
4
|
-
import { CharacteristicDescription, DescriptorDescription, ServiceDescription } from
|
|
5
|
-
import { IoTizeBleCordovaPlugin } from
|
|
6
|
-
export declare class CordovaPeripheralAdapter implements PeripheralAdapterInterface<CordovaServiceAdapter> {
|
|
7
|
-
readonly deviceId: string;
|
|
8
|
-
readonly cordovaPlugin: IoTizeBleCordovaPlugin;
|
|
9
|
-
private _stateChange;
|
|
10
|
-
private connectionStateSubscription?;
|
|
11
|
-
private serviceListCache?;
|
|
12
|
-
get stateChange(): Observable<ConnectionState>;
|
|
13
|
-
get name(): string;
|
|
14
|
-
get id(): string;
|
|
15
|
-
constructor(deviceId: string, cordovaPlugin?: IoTizeBleCordovaPlugin);
|
|
16
|
-
get state(): string;
|
|
17
|
-
discoverServices<Key extends string = string>(serviceUUIDs?: Key[]): Promise<Partial<Record<Key, CordovaServiceAdapter>>>;
|
|
18
|
-
connect(): Promise<void>;
|
|
19
|
-
disconnect(): Promise<void>;
|
|
20
|
-
close(): Promise<void>;
|
|
21
|
-
getService(uuid: string): Promise<CordovaServiceAdapter>;
|
|
22
|
-
}
|
|
23
|
-
export declare class CordovaServiceAdapter implements ServiceAdapterInterface {
|
|
24
|
-
private readonly config;
|
|
25
|
-
readonly peripheral: CordovaPeripheralAdapter;
|
|
26
|
-
get uuid(): string;
|
|
27
|
-
constructor(config: ServiceDescription, peripheral: CordovaPeripheralAdapter);
|
|
28
|
-
getCharacteristic(charcUUID: string): Promise<CordovaCharacteristicAdapter>;
|
|
29
|
-
getCharacteristics(): Promise<CordovaCharacteristicAdapter[]>;
|
|
30
|
-
}
|
|
31
|
-
export declare class CordovaCharacteristicAdapter implements CharacteristicAdapterInterface {
|
|
32
|
-
readonly service: CordovaServiceAdapter;
|
|
33
|
-
readonly config: CharacteristicDescription;
|
|
34
|
-
private _dataStream?;
|
|
35
|
-
get uuid(): string;
|
|
36
|
-
constructor(service: CordovaServiceAdapter, config: CharacteristicDescription);
|
|
37
|
-
get properties(): CharacteristicProperties;
|
|
38
|
-
get data(): Observable<{
|
|
39
|
-
data: Uint8Array;
|
|
40
|
-
isNotification: boolean;
|
|
41
|
-
}>;
|
|
42
|
-
protected get deviceId(): string;
|
|
43
|
-
protected get pluginInterface(): IoTizeBleCordovaPlugin;
|
|
44
|
-
read(): Promise<Uint8Array>;
|
|
45
|
-
getDescriptor(): Promise<CordovaDescriptorAdapter>;
|
|
46
|
-
getDescriptors(): Promise<DescriptorAdapterInterface[]>;
|
|
47
|
-
write(data: Uint8Array, writeWithoutResponse: boolean): Promise<Uint8Array>;
|
|
48
|
-
enableNotifications(enabled?: boolean): Promise<void>;
|
|
49
|
-
setupDataStreamIfRequired(): Observable<Uint8Array
|
|
50
|
-
}
|
|
51
|
-
export declare class CordovaDescriptorAdapter implements DescriptorAdapterInterface {
|
|
52
|
-
readonly config: DescriptorDescription;
|
|
53
|
-
readonly characteristic: CordovaCharacteristicAdapter;
|
|
54
|
-
get uuid(): string;
|
|
55
|
-
constructor(config: DescriptorDescription, characteristic: CordovaCharacteristicAdapter);
|
|
56
|
-
readValue(): Promise<Uint8Array>;
|
|
57
|
-
writeValue(data: Uint8Array): Promise<void>;
|
|
58
|
-
}
|
|
1
|
+
import { ConnectionState } from '@iotize/tap/protocol/api';
|
|
2
|
+
import { CharacteristicAdapterInterface, PeripheralAdapterInterface, ServiceAdapterInterface, DescriptorAdapterInterface, CharacteristicProperties } from '@iotize/tap/protocol/ble/common';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
import { CharacteristicDescription, DescriptorDescription, ServiceDescription } from './definitions';
|
|
5
|
+
import { IoTizeBleCordovaPlugin } from './iotize-ble-cordova-plugin';
|
|
6
|
+
export declare class CordovaPeripheralAdapter implements PeripheralAdapterInterface<CordovaServiceAdapter> {
|
|
7
|
+
readonly deviceId: string;
|
|
8
|
+
readonly cordovaPlugin: IoTizeBleCordovaPlugin;
|
|
9
|
+
private _stateChange;
|
|
10
|
+
private connectionStateSubscription?;
|
|
11
|
+
private serviceListCache?;
|
|
12
|
+
get stateChange(): Observable<ConnectionState>;
|
|
13
|
+
get name(): string;
|
|
14
|
+
get id(): string;
|
|
15
|
+
constructor(deviceId: string, cordovaPlugin?: IoTizeBleCordovaPlugin);
|
|
16
|
+
get state(): string;
|
|
17
|
+
discoverServices<Key extends string = string>(serviceUUIDs?: Key[]): Promise<Partial<Record<Key, CordovaServiceAdapter>>>;
|
|
18
|
+
connect(): Promise<void>;
|
|
19
|
+
disconnect(): Promise<void>;
|
|
20
|
+
close(): Promise<void>;
|
|
21
|
+
getService(uuid: string): Promise<CordovaServiceAdapter>;
|
|
22
|
+
}
|
|
23
|
+
export declare class CordovaServiceAdapter implements ServiceAdapterInterface {
|
|
24
|
+
private readonly config;
|
|
25
|
+
readonly peripheral: CordovaPeripheralAdapter;
|
|
26
|
+
get uuid(): string;
|
|
27
|
+
constructor(config: ServiceDescription, peripheral: CordovaPeripheralAdapter);
|
|
28
|
+
getCharacteristic(charcUUID: string): Promise<CordovaCharacteristicAdapter>;
|
|
29
|
+
getCharacteristics(): Promise<CordovaCharacteristicAdapter[]>;
|
|
30
|
+
}
|
|
31
|
+
export declare class CordovaCharacteristicAdapter implements CharacteristicAdapterInterface {
|
|
32
|
+
readonly service: CordovaServiceAdapter;
|
|
33
|
+
readonly config: CharacteristicDescription;
|
|
34
|
+
private _dataStream?;
|
|
35
|
+
get uuid(): string;
|
|
36
|
+
constructor(service: CordovaServiceAdapter, config: CharacteristicDescription);
|
|
37
|
+
get properties(): CharacteristicProperties;
|
|
38
|
+
get data(): Observable<{
|
|
39
|
+
data: Uint8Array;
|
|
40
|
+
isNotification: boolean;
|
|
41
|
+
}>;
|
|
42
|
+
protected get deviceId(): string;
|
|
43
|
+
protected get pluginInterface(): IoTizeBleCordovaPlugin;
|
|
44
|
+
read(): Promise<Uint8Array>;
|
|
45
|
+
getDescriptor(): Promise<CordovaDescriptorAdapter>;
|
|
46
|
+
getDescriptors(): Promise<DescriptorAdapterInterface[]>;
|
|
47
|
+
write(data: Uint8Array, writeWithoutResponse: boolean): Promise<Uint8Array>;
|
|
48
|
+
enableNotifications(enabled?: boolean): Promise<void>;
|
|
49
|
+
setupDataStreamIfRequired(): Observable<Uint8Array<ArrayBuffer>>;
|
|
50
|
+
}
|
|
51
|
+
export declare class CordovaDescriptorAdapter implements DescriptorAdapterInterface {
|
|
52
|
+
readonly config: DescriptorDescription;
|
|
53
|
+
readonly characteristic: CordovaCharacteristicAdapter;
|
|
54
|
+
get uuid(): string;
|
|
55
|
+
constructor(config: DescriptorDescription, characteristic: CordovaCharacteristicAdapter);
|
|
56
|
+
readValue(): Promise<Uint8Array>;
|
|
57
|
+
writeValue(data: Uint8Array): Promise<void>;
|
|
58
|
+
}
|