@iotize/device-com-ble.cordova 3.7.2 → 4.0.0-alpha.2
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/plugin.cjs +35 -0
- package/plugin.js +35 -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/{lib → src/lib}/ble-com-protocol.d.ts +20 -20
- package/{lib → src/lib}/cordova-ble-error.d.ts +29 -29
- package/{lib → src/lib}/cordova-interface.d.ts +5 -5
- package/{lib → src/lib}/cordova-service-adapter.d.ts +58 -58
- package/{lib → src/lib}/definitions.d.ts +43 -43
- package/{lib → src/lib}/iotize-ble-cordova-plugin.d.ts +27 -27
- package/src/lib/logger.d.ts +2 -0
- package/{lib → src/lib}/scanner.d.ts +55 -55
- package/{lib → src/lib}/utility.d.ts +6 -6
- package/src/plugin.d.ts +8 -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/src/android/.gradle/4.8.1/fileChanges/last-build.bin +0 -0
- package/src/android/.gradle/4.8.1/fileHashes/fileHashes.bin +0 -0
- package/src/android/.gradle/4.8.1/fileHashes/fileHashes.lock +0 -0
- package/src/android/.gradle/6.8.2/fileChanges/last-build.bin +0 -0
- package/src/android/.gradle/6.8.2/fileHashes/fileHashes.lock +0 -0
- package/src/android/.gradle/6.8.2/gc.properties +0 -0
- package/src/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/src/android/.gradle/buildOutputCleanup/cache.properties +0 -2
- package/src/android/.gradle/checksums/checksums.lock +0 -0
- package/src/android/.gradle/configuration-cache/gc.properties +0 -0
- package/src/android/.gradle/vcs-1/gc.properties +0 -0
- package/src/android/.gradle/vcsWorkingDirs/gc.properties +0 -0
- package/src/android/.idea/android.iml +0 -9
- package/src/android/.idea/gradle.xml +0 -16
- package/src/android/.idea/modules.xml +0 -8
- package/src/android/.idea/vcs.xml +0 -6
- package/www/plugin.js +0 -2
- package/www/plugin.js.LICENSE.txt +0 -14
|
@@ -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
|
+
}
|
|
@@ -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
|
|
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
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
export interface ServiceDescription {
|
|
26
|
-
uuid: BluetoothServiceUUID;
|
|
27
|
-
characteristics?: CharacteristicList;
|
|
28
|
-
[key: string]: any;
|
|
29
|
-
}
|
|
30
|
-
export
|
|
31
|
-
export interface CharacteristicDescription {
|
|
32
|
-
uuid: BluetoothCharacteristicUUID;
|
|
33
|
-
descriptors?: DescriptorList;
|
|
34
|
-
properties: CharacteristicProperties;
|
|
35
|
-
[key: string]: any;
|
|
36
|
-
}
|
|
37
|
-
export
|
|
38
|
-
export interface DescriptorDescription {
|
|
39
|
-
uuid: BluetoothDescriptorUUID;
|
|
40
|
-
[key: string]: any;
|
|
41
|
-
}
|
|
42
|
-
export
|
|
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
|
|
2
|
-
import { Observable } from
|
|
3
|
-
import { CordovaBLEScanResult, RequestDeviceOptions, ServiceList } from
|
|
4
|
-
export declare class IoTizeBleCordovaPlugin {
|
|
5
|
-
checkAvailable(): Promise<boolean>;
|
|
6
|
-
requestEnableBle(): Promise<
|
|
7
|
-
startScan(requestDeviceOptions: RequestDeviceOptions | undefined): Observable<CordovaBLEScanResult |
|
|
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
|
+
}
|
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import { DeviceScanner, DeviceScannerOptions } from
|
|
2
|
-
import { Observable } from
|
|
3
|
-
import { CordovaBLEScanResult, RequestDeviceOptions } from
|
|
4
|
-
import { IoTizeBleCordovaPlugin } from
|
|
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
|
|
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
|
+
}[];
|
package/src/plugin.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { BLEComProtocol } from './lib/ble-com-protocol';
|
|
2
|
+
export { CordovaCharacteristicAdapter, CordovaPeripheralAdapter, CordovaServiceAdapter, } from './lib/cordova-service-adapter';
|
|
3
|
+
export * 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 { IoTizeBleCordovaPlugin };
|
|
8
|
+
export declare const iotizeBLE: IoTizeBleCordovaPlugin;
|
|
@@ -30,10 +30,10 @@ function handleConnectionErrorCallback() {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
cordova.commandProxy.add(
|
|
33
|
+
cordova.commandProxy.add('BLECom', {
|
|
34
34
|
getLastError: function (successCallback, errorCallback) {
|
|
35
35
|
if (!checkProxy()) {
|
|
36
|
-
errorCallback(
|
|
36
|
+
errorCallback('Internal Error!');
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
39
|
|
|
@@ -42,7 +42,7 @@ cordova.commandProxy.add("BLECom", {
|
|
|
42
42
|
|
|
43
43
|
startScan: function (successCallback, errorCallback) {
|
|
44
44
|
if (!checkProxy()) {
|
|
45
|
-
errorCallback(
|
|
45
|
+
errorCallback('Internal Error!');
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
48
|
|
|
@@ -56,13 +56,13 @@ cordova.commandProxy.add("BLECom", {
|
|
|
56
56
|
|
|
57
57
|
stopScan: function (successCallback, errorCallback) {
|
|
58
58
|
if (!checkProxy()) {
|
|
59
|
-
errorCallback(
|
|
59
|
+
errorCallback('Internal Error!');
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
var res = iotizeProxy.stopScan();
|
|
64
64
|
if (res == true) {
|
|
65
|
-
successCallback(
|
|
65
|
+
successCallback('Ok');
|
|
66
66
|
} else {
|
|
67
67
|
errorCallback(iotizeProxy.getLastError());
|
|
68
68
|
}
|
|
@@ -70,7 +70,7 @@ cordova.commandProxy.add("BLECom", {
|
|
|
70
70
|
|
|
71
71
|
connect: async function (successCallback, errorCallback, device) {
|
|
72
72
|
if (!checkProxy()) {
|
|
73
|
-
errorCallback(
|
|
73
|
+
errorCallback('Internal Error!');
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
76
|
|
|
@@ -87,7 +87,7 @@ cordova.commandProxy.add("BLECom", {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
if (success) {
|
|
90
|
-
successCallback(
|
|
90
|
+
successCallback('Ok');
|
|
91
91
|
} else {
|
|
92
92
|
handleConnectionErrorCallback();
|
|
93
93
|
}
|
|
@@ -95,7 +95,7 @@ cordova.commandProxy.add("BLECom", {
|
|
|
95
95
|
|
|
96
96
|
disConnect: async function (successCallback, errorCallback, device) {
|
|
97
97
|
if (!checkProxy()) {
|
|
98
|
-
errorCallback(
|
|
98
|
+
errorCallback('Internal Error!');
|
|
99
99
|
return;
|
|
100
100
|
}
|
|
101
101
|
var success = false;
|
|
@@ -106,7 +106,7 @@ cordova.commandProxy.add("BLECom", {
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
if (success) {
|
|
109
|
-
successCallback(
|
|
109
|
+
successCallback('Ok');
|
|
110
110
|
} else {
|
|
111
111
|
errorCallback(iotizeProxy.getLastError());
|
|
112
112
|
}
|
|
@@ -114,7 +114,7 @@ cordova.commandProxy.add("BLECom", {
|
|
|
114
114
|
|
|
115
115
|
isConnected: async function (successCallback, errorCallback, device) {
|
|
116
116
|
if (!checkProxy()) {
|
|
117
|
-
errorCallback(
|
|
117
|
+
errorCallback('Internal Error!');
|
|
118
118
|
return;
|
|
119
119
|
}
|
|
120
120
|
var success = false;
|
|
@@ -145,7 +145,7 @@ cordova.commandProxy.add("BLECom", {
|
|
|
145
145
|
|
|
146
146
|
sendRequest: async function (successCallback, errorCallback, request) {
|
|
147
147
|
if (!checkProxy()) {
|
|
148
|
-
errorCallback(
|
|
148
|
+
errorCallback('Internal Error!');
|
|
149
149
|
return;
|
|
150
150
|
}
|
|
151
151
|
|
package/LICENSE
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
Copyright 2018 IoTize SAS
|
|
2
|
-
http://iotize.com
|
|
3
|
-
|
|
4
|
-
MIT License
|
|
5
|
-
|
|
6
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
7
|
-
a copy of this software and associated documentation files (the
|
|
8
|
-
"Software"), to deal in the Software without restriction, including
|
|
9
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
10
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
11
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
12
|
-
the following conditions:
|
|
13
|
-
|
|
14
|
-
The above copyright notice and this permission notice shall be
|
|
15
|
-
included in all copies or substantial portions of the Software.
|
|
16
|
-
|
|
17
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
18
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
19
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
20
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
21
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
22
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
23
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|