@iotize/device-com-ble.cordova 3.2.1 → 3.3.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/README.md +174 -177
- package/bundles/iotize-device-com-ble.cordova.umd.js +102 -69
- package/bundles/iotize-device-com-ble.cordova.umd.js.map +1 -1
- package/bundles/iotize-device-com-ble.cordova.umd.min.js +16 -0
- package/bundles/iotize-device-com-ble.cordova.umd.min.js.map +1 -0
- package/esm2015/lib/ble-com-protocol.js +10 -10
- package/esm2015/lib/ble-com-protocol.js.map +1 -1
- package/esm2015/lib/cordova-ble-error.js +11 -2
- package/esm2015/lib/cordova-ble-error.js.map +1 -1
- package/esm2015/lib/cordova-interface.js.map +1 -1
- package/esm2015/lib/cordova-service-adapter.js +15 -14
- package/esm2015/lib/cordova-service-adapter.js.map +1 -1
- package/esm2015/lib/cordova-service-adapter.metadata.json +1 -1
- package/esm2015/lib/definitions.js +0 -2
- package/esm2015/lib/definitions.js.map +1 -1
- package/esm2015/lib/iotize-ble-cordova-plugin.js +59 -51
- package/esm2015/lib/iotize-ble-cordova-plugin.js.map +1 -1
- package/esm2015/lib/iotize-ble-cordova-plugin.metadata.json +1 -1
- package/esm2015/lib/iotize-ble-cordova-plugin.ngsummary.json +1 -1
- package/esm2015/lib/logger.js +1 -1
- package/esm2015/lib/logger.js.map +1 -1
- package/esm2015/lib/scanner.js +14 -12
- package/esm2015/lib/scanner.js.map +1 -1
- package/esm2015/lib/scanner.metadata.json +1 -1
- package/esm2015/lib/utility.js +1 -1
- package/esm2015/lib/utility.js.map +1 -1
- package/esm2015/public_api.js +4 -4
- package/esm2015/public_api.js.map +1 -1
- package/fesm2015/iotize-device-com-ble.cordova.js +93 -74
- package/fesm2015/iotize-device-com-ble.cordova.js.map +1 -1
- package/iotize-device-com-ble.cordova.metadata.json +1 -1
- package/lib/ble-com-protocol.d.ts +4 -4
- package/lib/cordova-ble-error.d.ts +12 -3
- package/lib/cordova-service-adapter.d.ts +1 -1
- package/lib/definitions.d.ts +1 -1
- package/lib/iotize-ble-cordova-plugin.d.ts +4 -3
- package/lib/scanner.d.ts +4 -4
- package/package.json +1 -1
- package/plugin.xml +66 -63
- package/public_api.d.ts +5 -5
- 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/build.gradle +1 -0
- package/src/android/src/ble/BLECom.java +559 -558
- package/src/ios/BLECom.swift +732 -732
- package/src/windows/IoTizeBLE.pdb +0 -0
- package/src/windows/IoTizeBLE.pri +0 -0
- package/src/windows/iotize-ble-com.js +159 -179
- package/www/plugin.js +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iotize-device-com-ble.cordova.js","sources":["../../../../src/lib/logger.ts","../../../../src/lib/cordova-ble-error.ts","../../../../src/lib/utility.ts","../../../../src/lib/ble-com-protocol.ts","../../../../src/lib/cordova-service-adapter.ts","../../../../src/lib/scanner.ts","../../../../src/lib/iotize-ble-cordova-plugin.ts","../../../../src/iotize-device-com-ble.cordova.ts"],"sourcesContent":["import { createDebugger } from '@iotize/common/debug';\r\n\r\nexport const debug = createDebugger(`@iotize/device-com-ble.cordova`);","import { CodeError } from \"@iotize/common/error\";\r\n\r\nexport class CordovaBLEError extends CodeError {\r\n static invalidErrorResult(errObject: { code?: string | undefined; message?: string | undefined; }): CordovaBLEError {\r\n return new CordovaBLEError(\r\n `Internal error: ble cordova plugin returned an unexpected error object`,\r\n CordovaBLEError.Code.InternalError\r\n )\r\n }\r\n\r\n static invalidErrorCode(errObject: { code?: string | undefined; message?: string | undefined; }): CordovaBLEError {\r\n return new CordovaBLEError(\r\n `Internal error: ble cordova plugin returned an invalid error code ${errObject.code} with message ${errObject.message}`,\r\n CordovaBLEError.Code.InternalError\r\n )\r\n }\r\n\r\n static invalidNativeCallResult(result: any, cause: Error): CordovaBLEError {\r\n return new CordovaBLEError(\r\n `Internal error: native call returned an invalid data type. ${cause.message}`,\r\n CordovaBLEError.Code.InternalError\r\n )\r\n }\r\n\r\n static isValidErrorCode(code: string): code is (keyof typeof CordovaBLEError.Code) {\r\n return (code in CordovaBLEError.Code);\r\n }\r\n\r\n\r\n static iotizeBLEMissing() {\r\n return new CordovaBLEError(\r\n `iotizeBLE global variable does not exist. Are you sure app is running inside a Cordova application ?`,\r\n CordovaBLEError.Code.InternalError\r\n );\r\n }\r\n\r\n}\r\n\r\n/* istanbul ignore next */\r\nexport namespace CordovaBLEError {\r\n export enum Code {\r\n InternalError = 'CordovaBLEErrorInternalError',\r\n IllegalArgument = \"CordovaBLEErrorIllegalArgument\"\r\n }\r\n}","import { CordovaBLEError } from \"./cordova-ble-error\";\r\nimport { IoTizeBleCordovaPlugin } from \"./iotize-ble-cordova-plugin\";\r\n\r\ndeclare var iotizeBLE: IoTizeBleCordovaPlugin;\r\n\r\nexport function getIoTizeBleCordovaPlugin(): IoTizeBleCordovaPlugin {\r\n if (typeof iotizeBLE !== 'object') {\r\n throw CordovaBLEError.iotizeBLEMissing();\r\n } \r\n return iotizeBLE;\r\n}","//\r\n// Copyright 2018 IoTize SAS Inc. Licensed under the MIT license.\r\n//\r\n// ble-com-protocol.ts\r\n// device-com-ble.cordova BLE Cordova Plugin\r\n//\r\nimport {\r\n ComProtocolConnectOptions,\r\n ComProtocolDisconnectOptions,\r\n ComProtocolOptions,\r\n ComProtocolSendOptions,\r\n ConnectionState,\r\n} from '@iotize/tap/protocol/api';\r\nimport { QueueComProtocol } from '@iotize/tap/protocol/core';\r\nimport { defer, Observable } from 'rxjs';\r\nimport { filter, first, tap } from 'rxjs/operators';\r\nimport { IoTizeBleCordovaPlugin } from './iotize-ble-cordova-plugin';\r\nimport { debug } from './logger';\r\nimport { getIoTizeBleCordovaPlugin } from './utility';\r\n\r\nexport class BLEComProtocol extends QueueComProtocol {\r\n /**\r\n * Lazy reference to iotizeBLE.\r\n * We don't want to reference iotizeBLE in constructor as it may be referenced\r\n * before cordova plugin is loaded\r\n */\r\n private get pluginInterface(): IoTizeBleCordovaPlugin {\r\n return this.cordovaInterfaceOverwrite || getIoTizeBleCordovaPlugin();\r\n }\r\n\r\n constructor(\r\n private deviceId: string,\r\n comProtocolOptions?: ComProtocolOptions,\r\n public readonly cordovaInterfaceOverwrite?: IoTizeBleCordovaPlugin\r\n ) {\r\n super();\r\n if (comProtocolOptions) {\r\n this.options = comProtocolOptions;\r\n } else {\r\n this.options.connect.timeout = 60000;\r\n }\r\n }\r\n\r\n _connect(options?: ComProtocolConnectOptions): Observable<any> {\r\n debug('_connect', options);\r\n return this.pluginInterface\r\n .connectAndDiscoverTapServices(this.deviceId)\r\n .pipe(\r\n tap((state) => {\r\n this.setConnectionState(state);\r\n }),\r\n filter((state) => state === ConnectionState.CONNECTED),\r\n first()\r\n );\r\n }\r\n\r\n _disconnect(options?: ComProtocolDisconnectOptions): Observable<any> {\r\n debug('_disconnect', options);\r\n return defer(() => this.pluginInterface.disConnect(this.deviceId));\r\n }\r\n\r\n async write(data: Uint8Array): Promise<any> {\r\n throw new Error('Method not implemented.');\r\n }\r\n\r\n async read(): Promise<Uint8Array> {\r\n throw new Error('Method not implemented.');\r\n }\r\n\r\n send(\r\n data: Uint8Array,\r\n options?: ComProtocolSendOptions\r\n ): Observable<Uint8Array> {\r\n return defer(() => this.pluginInterface.send(this.deviceId, data));\r\n }\r\n}\r\n","import { ConnectionState } from \"@iotize/tap/protocol/api\";\r\nimport { CharacteristicAdapterInterface, PeripheralAdapterInterface, ServiceAdapterInterface, DescriptorAdapterInterface, BleComError, CharacteristicProperties } from \"@iotize/tap/protocol/ble/common\";\r\nimport { BehaviorSubject, Observable, Subscription } from \"rxjs\";\r\nimport { distinctUntilChanged, filter, first, map, shareReplay } from \"rxjs/operators\";\r\nimport { CharacteristicDescription, DescriptorDescription, ServiceDescription, ServiceList } from \"./definitions\";\r\nimport { IoTizeBleCordovaPlugin } from './iotize-ble-cordova-plugin';\r\nimport { getIoTizeBleCordovaPlugin } from \"./utility\";\r\n\r\nexport class CordovaPeripheralAdapter implements PeripheralAdapterInterface<CordovaServiceAdapter> {\r\n\r\n private _stateChange = new BehaviorSubject<ConnectionState>(ConnectionState.DISCONNECTED);\r\n private connectionStateSubscription?: Subscription;\r\n private serviceListCache?: ServiceList;\r\n\r\n get stateChange() {\r\n return this._stateChange.asObservable().pipe(distinctUntilChanged());\r\n }\r\n\r\n get name() {\r\n // TODO device name ? \r\n return this.id;\r\n }\r\n\r\n get id() {\r\n return this.deviceId;\r\n }\r\n\r\n constructor(\r\n public readonly deviceId: string,\r\n public readonly cordovaPlugin: IoTizeBleCordovaPlugin = getIoTizeBleCordovaPlugin()) {\r\n\r\n }\r\n\r\n get state(): string {\r\n return ConnectionState[this._stateChange.value];\r\n }\r\n\r\n async discoverServices<Key extends string = string>(serviceUUIDs?: Key[]): Promise<Partial<Record<Key, CordovaServiceAdapter>>> {\r\n this.serviceListCache = await this.cordovaPlugin.discoverServices(this.deviceId);\r\n const result: Partial<Record<Key, CordovaServiceAdapter>> = {};\r\n if (serviceUUIDs) {\r\n for (const uuid of serviceUUIDs) {\r\n const servicDefinition = this.serviceListCache.find(def => def.uuid === uuid);\r\n if (servicDefinition) {\r\n result[uuid] = new CordovaServiceAdapter(servicDefinition, this);\r\n }\r\n }\r\n }\r\n else {\r\n for (const serviceDefinition of this.serviceListCache) {\r\n result[serviceDefinition.uuid as Key] = new CordovaServiceAdapter(serviceDefinition, this);\r\n }\r\n }\r\n return result;\r\n }\r\n\r\n async connect(): Promise<void> {\r\n this.connectionStateSubscription?.unsubscribe();\r\n const connectObservable = this.cordovaPlugin.connect(this.deviceId).pipe(shareReplay());\r\n this.connectionStateSubscription = connectObservable\r\n .subscribe(state => {\r\n this._stateChange.next(state);\r\n });\r\n await connectObservable\r\n .pipe(\r\n filter(state => state === ConnectionState.CONNECTED),\r\n first()\r\n )\r\n .toPromise();\r\n }\r\n\r\n async disconnect(): Promise<void> {\r\n await this.cordovaPlugin.disConnect(this.deviceId);\r\n this._stateChange.next(ConnectionState.DISCONNECTED);\r\n this.connectionStateSubscription?.unsubscribe();\r\n }\r\n\r\n async close(): Promise<void> {\r\n await this.cordovaPlugin.close(this.deviceId);\r\n this._stateChange.next(ConnectionState.DISCONNECTED);\r\n this.connectionStateSubscription?.unsubscribe();\r\n }\r\n\r\n async getService(uuid: string): Promise<CordovaServiceAdapter> {\r\n if (!this.serviceListCache) {\r\n await this.discoverServices([uuid]);\r\n }\r\n const serviceDefinition = this.serviceListCache!.find(s => s.uuid === uuid);\r\n if (!serviceDefinition) {\r\n throw BleComError.serviceNotFound(uuid);\r\n }\r\n return new CordovaServiceAdapter(serviceDefinition, this);\r\n }\r\n\r\n}\r\n\r\n\r\nexport class CordovaServiceAdapter implements ServiceAdapterInterface {\r\n\r\n get uuid() {\r\n return this.config.uuid;\r\n }\r\n\r\n constructor(private readonly config: ServiceDescription, public readonly peripheral: CordovaPeripheralAdapter) {\r\n\r\n }\r\n\r\n async getCharacteristic(charcUUID: string): Promise<CordovaCharacteristicAdapter> {\r\n const characteristicDescription = this.config.characteristics?.find(c => c.uuid === charcUUID);\r\n if (!characteristicDescription) {\r\n throw BleComError.charcacteristicNotFound(charcUUID);\r\n }\r\n return new CordovaCharacteristicAdapter(this, characteristicDescription);\r\n }\r\n\r\n async getCharacteristics(): Promise<CordovaCharacteristicAdapter[]> {\r\n if (!this.config.characteristics) {\r\n return [];\r\n }\r\n return this.config.characteristics.map(c => new CordovaCharacteristicAdapter(this, c));\r\n }\r\n\r\n}\r\n\r\nexport class CordovaCharacteristicAdapter implements CharacteristicAdapterInterface {\r\n private _dataStream?: Observable<Uint8Array>;\r\n\r\n get uuid() {\r\n return this.config.uuid;\r\n }\r\n\r\n constructor(public readonly service: CordovaServiceAdapter, public readonly config: CharacteristicDescription) {\r\n }\r\n \r\n get properties(): CharacteristicProperties {\r\n return this.config.properties;\r\n }\r\n\r\n get data(): Observable<{ data: Uint8Array; isNotification: boolean; }> {\r\n return this.setupDataStreamIfRequired().pipe(\r\n map(data => ({\r\n data,\r\n isNotification: true\r\n }))\r\n )\r\n }\r\n\r\n protected get deviceId() {\r\n return this.service.peripheral.deviceId;\r\n }\r\n\r\n protected get pluginInterface() {\r\n return this.service.peripheral.cordovaPlugin;\r\n }\r\n\r\n async read(): Promise<Uint8Array> {\r\n return this.pluginInterface.characteristicReadValue(\r\n this.deviceId,\r\n this.service.uuid,\r\n this.uuid\r\n );\r\n }\r\n\r\n async getDescriptor(): Promise<CordovaDescriptorAdapter> {\r\n throw new Error(`Not implemented yet`);\r\n }\r\n\r\n async getDescriptors(): Promise<DescriptorAdapterInterface[]> {\r\n if (!this.config.descriptors) {\r\n return [];\r\n }\r\n return this.config.descriptors.map(descriptor => new CordovaDescriptorAdapter(descriptor, this));\r\n }\r\n\r\n async write(data: Uint8Array, writeWithoutResponse: boolean): Promise<Uint8Array> {\r\n if (writeWithoutResponse) {\r\n await this.pluginInterface.characteristicWriteWithoutResponse(\r\n this.deviceId,\r\n this.service.uuid,\r\n this.uuid,\r\n data\r\n );\r\n }\r\n else {\r\n await this.pluginInterface.characteristicWrite(\r\n this.deviceId,\r\n this.service.uuid,\r\n this.uuid,\r\n data\r\n )\r\n }\r\n return data;\r\n }\r\n\r\n async enableNotifications(enabled?: boolean): Promise<void> {\r\n if (enabled) {\r\n this.setupDataStreamIfRequired();\r\n await this.pluginInterface.characteristicStartNotification(\r\n this.deviceId,\r\n this.service.uuid,\r\n this.uuid\r\n );\r\n }\r\n else {\r\n await this.pluginInterface.characteristicStopNotification(\r\n this.deviceId,\r\n this.service.uuid,\r\n this.uuid\r\n )\r\n }\r\n }\r\n\r\n setupDataStreamIfRequired() {\r\n if (!this._dataStream) {\r\n this._dataStream = this.pluginInterface.characteristicChanged(\r\n this.deviceId,\r\n this.service.uuid,\r\n this.uuid\r\n );\r\n }\r\n return this._dataStream;\r\n }\r\n\r\n}\r\n\r\nexport class CordovaDescriptorAdapter implements DescriptorAdapterInterface {\r\n\r\n get uuid() {\r\n return this.config.uuid;\r\n }\r\n\r\n constructor(public readonly config: DescriptorDescription, public readonly characteristic: CordovaCharacteristicAdapter) { }\r\n\r\n async readValue(): Promise<Uint8Array> {\r\n throw new Error(`Reading descriptor value is not implemented yet`);\r\n }\r\n\r\n async writeValue(data: Uint8Array): Promise<void> {\r\n throw new Error(`Writing descriptor value is not implemented yet`);\r\n }\r\n\r\n}","//\r\n// Copyright 2018 IoTize SAS Inc. Licensed under the MIT license. \r\n//\r\n// scanner.ts\r\n// device-com-ble.cordova BLE Cordova Plugin\r\n//\r\n\r\nimport { BleComError } from '@iotize/tap/protocol/ble/common';\r\nimport { DeviceScanner, DeviceScannerOptions } from '@iotize/tap/scanner/api';\r\nimport { BehaviorSubject, Observable, Subscription } from 'rxjs';\r\nimport { CordovaBLEScanResult, RequestDeviceOptions } from './definitions';\r\nimport { IoTizeBleCordovaPlugin } from './iotize-ble-cordova-plugin';\r\nimport { debug } from './logger';\r\nimport { getIoTizeBleCordovaPlugin } from './utility';\r\n\r\n/**\r\n * BLE Tap scanner for cordova apps\r\n */\r\nexport class BLEScanner implements DeviceScanner<CordovaBLEScanResult> {\r\n\r\n private _results = new BehaviorSubject<CordovaBLEScanResult[]>([]);\r\n private _scanning$ = new BehaviorSubject<boolean>(false);\r\n private scanSubscription?: Subscription;\r\n\r\n /**\r\n * Lazy reference to iotizeBLE.\r\n * We don't want to reference iotizeBLE in constructor as it may be referenced\r\n * before cordova plugin is loaded\r\n */\r\n private get cordovaInterface(): IoTizeBleCordovaPlugin {\r\n return this.cordovaInterfaceOverwrite || getIoTizeBleCordovaPlugin()\r\n }\r\n\r\n /**\r\n * \r\n * @param cordovaInterfaceOverwrite overwrite cordova interface. Used for testing\r\n */\r\n constructor(private cordovaInterfaceOverwrite?: IoTizeBleCordovaPlugin,\r\n /**\r\n * Request device options used to filter scan results \r\n */\r\n readonly requestDeviceOptions?: RequestDeviceOptions) {\r\n\r\n }\r\n\r\n get scanning(): Observable<boolean> {\r\n return this._scanning$.asObservable();\r\n }\r\n\r\n get isScanning(): boolean {\r\n return this._scanning$.value;\r\n }\r\n\r\n /**\r\n * Gets the observable on the devices$ Subject\r\n * @return\r\n */\r\n get results(): Observable<CordovaBLEScanResult[]> {\r\n return this._results.asObservable();\r\n }\r\n\r\n\r\n /**\r\n * Launches the scan for BLE devices\r\n * Throws if BLE is not available\r\n */\r\n async start(options?: DeviceScannerOptions): Promise<void> {\r\n this.scanSubscription?.unsubscribe();\r\n this.scanSubscription = undefined;\r\n this.clearResults();\r\n const isAvailable = await this.checkAvailable();\r\n if (!isAvailable) {\r\n throw BleComError.bleNotAvailable(`BLE is not available. Make sure that BLE is enabled on your device`);\r\n }\r\n debug(\"Start Scanning ...\");\r\n this._scanning$.next(true);\r\n return new Promise<void>((resolve, reject) => {\r\n this.scanSubscription = this.cordovaInterface.startScan(this.requestDeviceOptions)\r\n .subscribe(result => {\r\n if (result == 'Ok') {\r\n resolve();\r\n return;\r\n }\r\n this.addOrRefreshDevice(result);\r\n }, error => {\r\n debug('Start scan failed with error: ', error);\r\n this.cordovaInterface\r\n .getLastError()\r\n .then((lasterror) => {\r\n debug(\"Last BLE error \" + lasterror);\r\n })\r\n .catch((err) => {\r\n debug('Cannot get last BLE error: ', err);\r\n });\r\n reject(error);\r\n this._scanning$.next(false);\r\n });\r\n });\r\n }\r\n\r\n /**\r\n * \r\n */\r\n async stop(): Promise<void> {\r\n debug(\"Stop Scanning ...\");\r\n try {\r\n this.scanSubscription?.unsubscribe();\r\n this.scanSubscription = undefined;\r\n await this.cordovaInterface.stopScan();\r\n this._scanning$.next(false);\r\n return;\r\n } catch (err) {\r\n this._scanning$.next(false);\r\n throw err;\r\n }\r\n }\r\n\r\n /**\r\n * Returns true if this scanner is available\r\n */\r\n checkAvailable(): Promise<boolean> {\r\n return this.cordovaInterface.checkAvailable();\r\n }\r\n\r\n private get devices() {\r\n return this._results.value;\r\n }\r\n\r\n private clearResults() {\r\n this._results.next([]);\r\n }\r\n\r\n private addOrRefreshDevice(newDevice: CordovaBLEScanResult) {\r\n let storedDeviceIndex = this.devices.findIndex((entry) => entry.address == newDevice.address);\r\n if (storedDeviceIndex >= 0) {\r\n let storedDevice = this.devices[storedDeviceIndex];\r\n if (storedDevice.name != newDevice.name || storedDevice.rssi != newDevice.rssi) {\r\n debug(`Updating device at index ${storedDeviceIndex}, name=${storedDevice.name} with rssi=${storedDevice.rssi}`);\r\n this.devices[storedDeviceIndex] = newDevice;\r\n // this.devices = [...this.devices];\r\n this._results.next(this.devices);\r\n }\r\n }\r\n else {\r\n debug(`Adding new device name=${newDevice.name} with rssi=${newDevice.rssi}`);\r\n this.devices.push(newDevice);\r\n this._results.next(this.devices);\r\n }\r\n }\r\n}\r\n","import { bufferToHexString, hexStringToBuffer as hexStringToBufferCore} from \"@iotize/common/byte-converter\";\r\nimport { safeEnumValue } from \"@iotize/common/utility\";\r\nimport { ConnectionState } from \"@iotize/tap/protocol/api\";\r\nimport { Observable, Subject } from \"rxjs\";\r\nimport { map } from \"rxjs/operators\";\r\nimport { CordovaInterface } from \"./cordova-interface\";\r\nimport { CordovaBLEScanResult, RequestDeviceOptions, ServiceList } from \"./definitions\";\r\nimport { CordovaBLEError } from './cordova-ble-error';\r\n\r\n\r\nfunction hexStringToBuffer(str: string): Uint8Array {\r\n try {\r\n return hexStringToBufferCore(str);\r\n }\r\n catch (err) {\r\n throw CordovaBLEError.invalidNativeCallResult(str, err as Error);\r\n }\r\n}\r\n\r\ndeclare var cordova: CordovaInterface;\r\n\r\nexport class IoTizeBleCordovaPlugin {\r\n\r\n checkAvailable(): Promise<boolean> {\r\n return this.execSingleResult<boolean>('checkAvailable', []);\r\n }\r\n\r\n requestEnableBle(): Promise<'OK'> {\r\n return this.execSingleResult<'OK'>('enable', []);\r\n }\r\n\r\n startScan(requestDeviceOptions: RequestDeviceOptions | undefined): Observable<CordovaBLEScanResult | \"Ok\"> {\r\n return this.execMultipleResult<CordovaBLEScanResult | \"Ok\">('startScan', [\r\n JSON.stringify(requestDeviceOptions)\r\n ]);\r\n }\r\n\r\n stopScan() {\r\n return this.execSingleResult<'OK'>('stopScan', []);\r\n }\r\n\r\n connect(deviceId: string): Observable<ConnectionState> {\r\n return this.execMultipleResult<string>('connect', [deviceId])\r\n .pipe(\r\n map(state => {\r\n if (!(state in ConnectionState)) {\r\n console.warn(`Plugin native code returned an invalid connection state: \"${state}\".`);\r\n }\r\n return safeEnumValue(ConnectionState, state);\r\n })\r\n );\r\n }\r\n\r\n requestMTU(deviceId: string, mtu: number) {\r\n return this.execSingleResult<'OK'>('requestMTU', [deviceId, mtu]);\r\n }\r\n \r\n connectAndDiscoverTapServices(deviceId: string): Observable<ConnectionState> {\r\n return this.execMultipleResult<string>('connectAndDiscoverTapServices', [deviceId])\r\n .pipe(\r\n map(state => {\r\n if (!(state in ConnectionState)) {\r\n console.warn(`Plugin native code returned an invalid connection state: \"${state}\".`);\r\n }\r\n return safeEnumValue(ConnectionState, state);\r\n })\r\n );\r\n }\r\n\r\n disConnect(deviceId: string) {\r\n return this.execSingleResult<'OK'>('disConnect', [deviceId]);\r\n }\r\n\r\n close(deviceId: string) {\r\n return this.execSingleResult<'OK'>('close', [deviceId]);\r\n }\r\n\r\n isConnected(deviceId: string) {\r\n return this.execSingleResult<boolean>('isConnected', [deviceId]);\r\n }\r\n\r\n async send(deviceId: string, data: Uint8Array) {\r\n const hexString = await this.execSingleResult<string>('sendRequest', [deviceId, bufferToHexString(data)]);\r\n return hexStringToBuffer(hexString);\r\n }\r\n\r\n getLastError() {\r\n return this.execSingleResult<string>('getLastError', []);\r\n }\r\n\r\n characteristicStartNotification(deviceId: string, serviceId: string, characId: string) {\r\n return this.execSingleResult<'OK'>('characteristicStartNotification', [\r\n deviceId,\r\n serviceId,\r\n characId\r\n ]);\r\n }\r\n\r\n characteristicChanged(deviceId: string, serviceId: string, characId: string): Observable<Uint8Array> {\r\n return this.execMultipleResult<string>('characteristicChanged', [\r\n deviceId,\r\n serviceId,\r\n characId\r\n ])\r\n .pipe(\r\n map(hexString => {\r\n return hexStringToBuffer(hexString)\r\n })\r\n );\r\n }\r\n\r\n characteristicStopNotification(deviceId: string, serviceId: string, characId: string) {\r\n return this.execSingleResult<'OK'>('characteristicStopNotification', [\r\n deviceId,\r\n serviceId,\r\n characId\r\n ]);\r\n }\r\n\r\n async characteristicReadValue(deviceId: string, serviceId: string, characId: string): Promise<Uint8Array> {\r\n const hexString = await this.execSingleResult<string>('characteristicRead', [\r\n deviceId,\r\n serviceId,\r\n characId\r\n ]);\r\n return hexStringToBuffer(hexString);\r\n }\r\n\r\n characteristicWrite(deviceId: string, serviceId: string, characId: string, data: Uint8Array) {\r\n return this.execSingleResult<'OK'>('characteristicWrite', [\r\n deviceId,\r\n serviceId,\r\n characId,\r\n bufferToHexString(data)\r\n ]);\r\n }\r\n\r\n characteristicWriteWithoutResponse(deviceId: string, serviceId: string, characId: string, data: Uint8Array) {\r\n return this.execSingleResult<'OK'>('characteristicWriteWithoutResponse', [\r\n deviceId,\r\n serviceId,\r\n characId,\r\n bufferToHexString(data)\r\n ]);\r\n }\r\n\r\n async discoverServices(deviceId: string): Promise<ServiceList> {\r\n const services = await this.execSingleResult<ServiceList>('discoverServices', [\r\n deviceId\r\n ]);\r\n return services;\r\n }\r\n\r\n private execSingleResult<T extends string | void | boolean | Object>(methodName: string, args: any[]): Promise<T> {\r\n return new Promise<T>((resolve, reject) => {\r\n cordova.exec(resolve, (errObject: { code?: string; message?: string }) => {\r\n reject(objectErrorToError(errObject));\r\n }, 'BLECom', methodName, args);\r\n });\r\n }\r\n\r\n\r\n private execMultipleResult<T>(methodName: string, args: any[]): Observable<T> {\r\n const subject = new Subject<T>();\r\n cordova.exec<T>((data) => {\r\n subject.next(data);\r\n }, (err) => {\r\n subject.error(objectErrorToError(err))\r\n }, 'BLECom', methodName, args);\r\n return subject.asObservable();\r\n }\r\n\r\n}\r\n\r\n\r\nfunction objectErrorToError(errObject: { code?: string; message?: string }) {\r\n if (typeof errObject !== 'object' || !errObject.code || !errObject.message) {\r\n return CordovaBLEError.invalidErrorResult(errObject);\r\n }\r\n if (!CordovaBLEError.isValidErrorCode(errObject.code)) {\r\n return CordovaBLEError.invalidErrorCode(errObject);\r\n }\r\n return new CordovaBLEError(\r\n errObject.message,\r\n CordovaBLEError.Code[errObject.code]\r\n );\r\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n\nexport {CharacteristicDescription as ɵb,ServiceDescription as ɵa} from './lib/definitions';\nexport {IoTizeBleCordovaPlugin as ɵc} from './lib/iotize-ble-cordova-plugin';"],"names":["hexStringToBufferCore"],"mappings":";;;;;;;;;;AAEO,MAAM,KAAK,GAAG,cAAc,CAAC,gCAAgC,CAAC;;MCAxD,eAAgB,SAAQ,SAAS;IAC1C,OAAO,kBAAkB,CAAC,SAAuE;QAC7F,OAAO,IAAI,eAAe,CACtB,wEAAwE,EACxE,eAAe,CAAC,IAAI,CAAC,aAAa,CACrC,CAAA;KACJ;IAED,OAAO,gBAAgB,CAAC,SAAuE;QAC3F,OAAO,IAAI,eAAe,CACtB,qEAAqE,SAAS,CAAC,IAAI,iBAAiB,SAAS,CAAC,OAAO,EAAE,EACvH,eAAe,CAAC,IAAI,CAAC,aAAa,CACrC,CAAA;KACJ;IAED,OAAO,uBAAuB,CAAC,MAAW,EAAE,KAAY;QACpD,OAAO,IAAI,eAAe,CACtB,8DAA8D,KAAK,CAAC,OAAO,EAAE,EAC7E,eAAe,CAAC,IAAI,CAAC,aAAa,CACrC,CAAA;KACJ;IAED,OAAO,gBAAgB,CAAC,IAAY;QAChC,QAAQ,IAAI,IAAI,eAAe,CAAC,IAAI,EAAE;KACzC;IAGD,OAAO,gBAAgB;QACnB,OAAO,IAAI,eAAe,CACtB,sGAAsG,EACtG,eAAe,CAAC,IAAI,CAAC,aAAa,CACrC,CAAC;KACL;CAEJ;AAED;AACA,WAAiB,eAAe;IAC5B,IAAY,IAGX;IAHD,WAAY,IAAI;QACZ,sDAA8C,CAAA;QAC9C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EAAK,CAAC;QACjC,OAAO,CAAC,IAAI,CAAI,CAAC,IAAI;YACjB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACtB,EAAE,CAAC,GAAG;YACH,OAAO,CAAC,KAAK,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAA;SACzC,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;QAC/B,OAAO,OAAO,CAAC,YAAY,EAAE,CAAC;KACjC;CAEJ;AAGD,SAAS,kBAAkB,CAAC,SAA8C;IACtE,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE;QACxE,OAAO,eAAe,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC;KACxD;IACD,IAAI,CAAC,eAAe,CAAC,gBAAgB,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE;QACnD,OAAO,eAAe,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;KACtD;IACD,OAAO,IAAI,eAAe,CACtB,SAAS,CAAC,OAAO,EACjB,eAAe,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CACvC,CAAC;AACN;;AC1LA;;;;;;"}
|
|
1
|
+
{"version":3,"file":"iotize-device-com-ble.cordova.js","sources":["../../../../src/lib/logger.ts","../../../../src/lib/cordova-ble-error.ts","../../../../src/lib/utility.ts","../../../../src/lib/ble-com-protocol.ts","../../../../src/lib/cordova-service-adapter.ts","../../../../src/lib/scanner.ts","../../../../src/lib/iotize-ble-cordova-plugin.ts","../../../../src/iotize-device-com-ble.cordova.ts"],"sourcesContent":["import { createDebugger } from \"@iotize/common/debug\";\n\nexport const debug = createDebugger(`@iotize/device-com-ble.cordova`);\n","import { CodeError } from '@iotize/common/error';\n\nexport class CordovaBLEError extends CodeError {\n static invalidErrorResult(errObject: {\n code?: string | undefined;\n message?: string | undefined;\n }): CordovaBLEError {\n return new CordovaBLEError(\n `Internal error: ble cordova plugin returned an unexpected error object`,\n CordovaBLEError.Code.InternalError\n );\n }\n\n static invalidErrorCode(errObject: {\n code?: string | undefined;\n message?: string | undefined;\n }): CordovaBLEError {\n return new CordovaBLEError(\n `Internal error: ble cordova plugin returned an invalid error code ${errObject.code} with message ${errObject.message}`,\n CordovaBLEError.Code.InternalError\n );\n }\n\n static invalidNativeCallResult(result: any, cause: Error): CordovaBLEError {\n return new CordovaBLEError(\n `Internal error: native call returned an invalid data type. ${cause.message}`,\n CordovaBLEError.Code.InternalError\n );\n }\n\n static isValidErrorCode(\n code: string\n ): code is keyof typeof CordovaBLEError.Code {\n return code in CordovaBLEError.Code;\n }\n\n static iotizeBLEMissing() {\n return new CordovaBLEError(\n `iotizeBLE global variable does not exist. Are you sure app is running inside a Cordova application ?`,\n CordovaBLEError.Code.InternalError\n );\n }\n}\n\n/* istanbul ignore next */\nexport namespace CordovaBLEError {\n export enum Code {\n InternalError = 'CordovaBLEErrorInternalError',\n IllegalArgument = 'CordovaBLEErrorIllegalArgument',\n BLENotAvailable = 'CordovaBLEErrorBLENotAvailable',\n InvalidMacAddress = 'InvalidMacAddressInvalidMacAddress',\n ConnectionError = 'CordovaBLEErrorConnectionError',\n RequestError = 'CordovaBLEErrorRequestError',\n LocationServiceDisabled = 'CordovaBLEErrorLocationServiceDisabled',\n DisconnectError = 'CordovaBLEErrorDisconnectError',\n IllegalAction = 'CordovaBLEErrorIllegalAction',\n NotConnectedError = 'CordovaBLEErrorNotConnectedError',\n StatusCodeError = 'CordovaBLEErrorStatusCodeError',\n }\n}\n","import { CordovaBLEError } from \"./cordova-ble-error\";\nimport { IoTizeBleCordovaPlugin } from \"./iotize-ble-cordova-plugin\";\n\ndeclare var iotizeBLE: IoTizeBleCordovaPlugin;\n\nexport function getIoTizeBleCordovaPlugin(): IoTizeBleCordovaPlugin {\n if (typeof iotizeBLE !== \"object\") {\n throw CordovaBLEError.iotizeBLEMissing();\n }\n return iotizeBLE;\n}\n","//\n// Copyright 2018 IoTize SAS Inc. Licensed under the MIT license.\n//\n// ble-com-protocol.ts\n// device-com-ble.cordova BLE Cordova Plugin\n//\nimport {\n ComProtocolConnectOptions,\n ComProtocolDisconnectOptions,\n ComProtocolOptions,\n ComProtocolSendOptions,\n ConnectionState,\n} from \"@iotize/tap/protocol/api\";\nimport { QueueComProtocol } from \"@iotize/tap/protocol/core\";\nimport { defer, Observable } from \"rxjs\";\nimport { filter, first, tap } from \"rxjs/operators\";\nimport { IoTizeBleCordovaPlugin } from \"./iotize-ble-cordova-plugin\";\nimport { debug } from \"./logger\";\nimport { getIoTizeBleCordovaPlugin } from \"./utility\";\n\nexport class BLEComProtocol extends QueueComProtocol {\n /**\n * Lazy reference to iotizeBLE.\n * We don't want to reference iotizeBLE in constructor as it may be referenced\n * before cordova plugin is loaded\n */\n private get pluginInterface(): IoTizeBleCordovaPlugin {\n return this.cordovaInterfaceOverwrite || getIoTizeBleCordovaPlugin();\n }\n\n constructor(\n private deviceId: string,\n comProtocolOptions?: ComProtocolOptions,\n public readonly cordovaInterfaceOverwrite?: IoTizeBleCordovaPlugin\n ) {\n super();\n if (comProtocolOptions) {\n this.options = comProtocolOptions;\n } else {\n this.options.connect.timeout = 60000;\n }\n }\n\n _connect(options?: ComProtocolConnectOptions): Observable<any> {\n debug(\"_connect\", options);\n return this.pluginInterface\n .connectAndDiscoverTapServices(this.deviceId)\n .pipe(\n tap((state) => {\n this.setConnectionState(state);\n }),\n filter((state) => state === ConnectionState.CONNECTED),\n first()\n );\n }\n\n _disconnect(options?: ComProtocolDisconnectOptions): Observable<any> {\n debug(\"_disconnect\", options);\n return defer(() => this.pluginInterface.disConnect(this.deviceId));\n }\n\n async write(data: Uint8Array): Promise<any> {\n throw new Error(\"Method not implemented.\");\n }\n\n async read(): Promise<Uint8Array> {\n throw new Error(\"Method not implemented.\");\n }\n\n send(\n data: Uint8Array,\n options?: ComProtocolSendOptions\n ): Observable<Uint8Array> {\n return defer(() => this.pluginInterface.send(this.deviceId, data));\n }\n}\n","import { ConnectionState } from \"@iotize/tap/protocol/api\";\nimport {\n CharacteristicAdapterInterface,\n PeripheralAdapterInterface,\n ServiceAdapterInterface,\n DescriptorAdapterInterface,\n BleComError,\n CharacteristicProperties,\n} from \"@iotize/tap/protocol/ble/common\";\nimport { BehaviorSubject, Observable, Subscription } from \"rxjs\";\nimport {\n distinctUntilChanged,\n filter,\n first,\n map,\n shareReplay,\n} from \"rxjs/operators\";\nimport {\n CharacteristicDescription,\n DescriptorDescription,\n ServiceDescription,\n ServiceList,\n} from \"./definitions\";\nimport { IoTizeBleCordovaPlugin } from \"./iotize-ble-cordova-plugin\";\nimport { getIoTizeBleCordovaPlugin } from \"./utility\";\n\nexport class CordovaPeripheralAdapter\n implements PeripheralAdapterInterface<CordovaServiceAdapter>\n{\n private _stateChange = new BehaviorSubject<ConnectionState>(\n ConnectionState.DISCONNECTED\n );\n private connectionStateSubscription?: Subscription;\n private serviceListCache?: ServiceList;\n\n get stateChange() {\n return this._stateChange.asObservable().pipe(distinctUntilChanged());\n }\n\n get name() {\n // TODO device name ?\n return this.id;\n }\n\n get id() {\n return this.deviceId;\n }\n\n constructor(\n public readonly deviceId: string,\n public readonly cordovaPlugin: IoTizeBleCordovaPlugin = getIoTizeBleCordovaPlugin()\n ) {}\n\n get state(): string {\n return ConnectionState[this._stateChange.value];\n }\n\n async discoverServices<Key extends string = string>(\n serviceUUIDs?: Key[]\n ): Promise<Partial<Record<Key, CordovaServiceAdapter>>> {\n this.serviceListCache = await this.cordovaPlugin.discoverServices(\n this.deviceId\n );\n const result: Partial<Record<Key, CordovaServiceAdapter>> = {};\n if (serviceUUIDs) {\n for (const uuid of serviceUUIDs) {\n const servicDefinition = this.serviceListCache.find(\n (def) => def.uuid === uuid\n );\n if (servicDefinition) {\n result[uuid] = new CordovaServiceAdapter(servicDefinition, this);\n }\n }\n } else {\n for (const serviceDefinition of this.serviceListCache) {\n result[serviceDefinition.uuid as Key] = new CordovaServiceAdapter(\n serviceDefinition,\n this\n );\n }\n }\n return result;\n }\n\n async connect(): Promise<void> {\n this.connectionStateSubscription?.unsubscribe();\n const connectObservable = this.cordovaPlugin\n .connect(this.deviceId)\n .pipe(shareReplay());\n this.connectionStateSubscription = connectObservable.subscribe((state) => {\n this._stateChange.next(state);\n });\n await connectObservable\n .pipe(\n filter((state) => state === ConnectionState.CONNECTED),\n first()\n )\n .toPromise();\n }\n\n async disconnect(): Promise<void> {\n await this.cordovaPlugin.disConnect(this.deviceId);\n this._stateChange.next(ConnectionState.DISCONNECTED);\n this.connectionStateSubscription?.unsubscribe();\n }\n\n async close(): Promise<void> {\n await this.cordovaPlugin.close(this.deviceId);\n this._stateChange.next(ConnectionState.DISCONNECTED);\n this.connectionStateSubscription?.unsubscribe();\n }\n\n async getService(uuid: string): Promise<CordovaServiceAdapter> {\n if (!this.serviceListCache) {\n await this.discoverServices([uuid]);\n }\n const serviceDefinition = this.serviceListCache!.find(\n (s) => s.uuid === uuid\n );\n if (!serviceDefinition) {\n throw BleComError.serviceNotFound(uuid);\n }\n return new CordovaServiceAdapter(serviceDefinition, this);\n }\n}\n\nexport class CordovaServiceAdapter implements ServiceAdapterInterface {\n get uuid() {\n return this.config.uuid;\n }\n\n constructor(\n private readonly config: ServiceDescription,\n public readonly peripheral: CordovaPeripheralAdapter\n ) {}\n\n async getCharacteristic(\n charcUUID: string\n ): Promise<CordovaCharacteristicAdapter> {\n const characteristicDescription = this.config.characteristics?.find(\n (c) => c.uuid === charcUUID\n );\n if (!characteristicDescription) {\n throw BleComError.charcacteristicNotFound(charcUUID);\n }\n return new CordovaCharacteristicAdapter(this, characteristicDescription);\n }\n\n async getCharacteristics(): Promise<CordovaCharacteristicAdapter[]> {\n if (!this.config.characteristics) {\n return [];\n }\n return this.config.characteristics.map(\n (c) => new CordovaCharacteristicAdapter(this, c)\n );\n }\n}\n\nexport class CordovaCharacteristicAdapter\n implements CharacteristicAdapterInterface\n{\n private _dataStream?: Observable<Uint8Array>;\n\n get uuid() {\n return this.config.uuid;\n }\n\n constructor(\n public readonly service: CordovaServiceAdapter,\n public readonly config: CharacteristicDescription\n ) {}\n\n get properties(): CharacteristicProperties {\n return this.config.properties;\n }\n\n get data(): Observable<{ data: Uint8Array; isNotification: boolean }> {\n return this.setupDataStreamIfRequired().pipe(\n map((data) => ({\n data,\n isNotification: true,\n }))\n );\n }\n\n protected get deviceId() {\n return this.service.peripheral.deviceId;\n }\n\n protected get pluginInterface() {\n return this.service.peripheral.cordovaPlugin;\n }\n\n async read(): Promise<Uint8Array> {\n return this.pluginInterface.characteristicReadValue(\n this.deviceId,\n this.service.uuid,\n this.uuid\n );\n }\n\n async getDescriptor(): Promise<CordovaDescriptorAdapter> {\n throw new Error(`Not implemented yet`);\n }\n\n async getDescriptors(): Promise<DescriptorAdapterInterface[]> {\n if (!this.config.descriptors) {\n return [];\n }\n return this.config.descriptors.map(\n (descriptor) => new CordovaDescriptorAdapter(descriptor, this)\n );\n }\n\n async write(\n data: Uint8Array,\n writeWithoutResponse: boolean\n ): Promise<Uint8Array> {\n if (writeWithoutResponse) {\n await this.pluginInterface.characteristicWriteWithoutResponse(\n this.deviceId,\n this.service.uuid,\n this.uuid,\n data\n );\n } else {\n await this.pluginInterface.characteristicWrite(\n this.deviceId,\n this.service.uuid,\n this.uuid,\n data\n );\n }\n return data;\n }\n\n async enableNotifications(enabled?: boolean): Promise<void> {\n if (enabled) {\n this.setupDataStreamIfRequired();\n await this.pluginInterface.characteristicStartNotification(\n this.deviceId,\n this.service.uuid,\n this.uuid\n );\n } else {\n await this.pluginInterface.characteristicStopNotification(\n this.deviceId,\n this.service.uuid,\n this.uuid\n );\n }\n }\n\n setupDataStreamIfRequired() {\n if (!this._dataStream) {\n this._dataStream = this.pluginInterface.characteristicChanged(\n this.deviceId,\n this.service.uuid,\n this.uuid\n );\n }\n return this._dataStream;\n }\n}\n\nexport class CordovaDescriptorAdapter implements DescriptorAdapterInterface {\n get uuid() {\n return this.config.uuid;\n }\n\n constructor(\n public readonly config: DescriptorDescription,\n public readonly characteristic: CordovaCharacteristicAdapter\n ) {}\n\n async readValue(): Promise<Uint8Array> {\n throw new Error(`Reading descriptor value is not implemented yet`);\n }\n\n async writeValue(data: Uint8Array): Promise<void> {\n throw new Error(`Writing descriptor value is not implemented yet`);\n }\n}\n","//\n// Copyright 2018 IoTize SAS Inc. Licensed under the MIT license.\n//\n// scanner.ts\n// device-com-ble.cordova BLE Cordova Plugin\n//\n\nimport { BleComError } from \"@iotize/tap/protocol/ble/common\";\nimport { DeviceScanner, DeviceScannerOptions } from \"@iotize/tap/scanner/api\";\nimport { BehaviorSubject, Observable, Subscription } from \"rxjs\";\nimport { CordovaBLEScanResult, RequestDeviceOptions } from \"./definitions\";\nimport { IoTizeBleCordovaPlugin } from \"./iotize-ble-cordova-plugin\";\nimport { debug } from \"./logger\";\nimport { getIoTizeBleCordovaPlugin } from \"./utility\";\n\n/**\n * BLE Tap scanner for cordova apps\n */\nexport class BLEScanner implements DeviceScanner<CordovaBLEScanResult> {\n private _results = new BehaviorSubject<CordovaBLEScanResult[]>([]);\n private _scanning$ = new BehaviorSubject<boolean>(false);\n private scanSubscription?: Subscription;\n\n /**\n * Lazy reference to iotizeBLE.\n * We don't want to reference iotizeBLE in constructor as it may be referenced\n * before cordova plugin is loaded\n */\n private get cordovaInterface(): IoTizeBleCordovaPlugin {\n return this.cordovaInterfaceOverwrite || getIoTizeBleCordovaPlugin();\n }\n\n /**\n *\n * @param cordovaInterfaceOverwrite overwrite cordova interface. Used for testing\n */\n constructor(\n private cordovaInterfaceOverwrite?: IoTizeBleCordovaPlugin,\n /**\n * Request device options used to filter scan results\n */\n readonly requestDeviceOptions?: RequestDeviceOptions\n ) {}\n\n get scanning(): Observable<boolean> {\n return this._scanning$.asObservable();\n }\n\n get isScanning(): boolean {\n return this._scanning$.value;\n }\n\n /**\n * Gets the observable on the devices$ Subject\n * @return\n */\n get results(): Observable<CordovaBLEScanResult[]> {\n return this._results.asObservable();\n }\n\n /**\n * Launches the scan for BLE devices\n * Throws if BLE is not available\n */\n async start(options?: DeviceScannerOptions): Promise<void> {\n this.scanSubscription?.unsubscribe();\n this.scanSubscription = undefined;\n this.clearResults();\n const isAvailable = await this.checkAvailable();\n if (!isAvailable) {\n throw BleComError.bleNotAvailable(\n `BLE is not available. Make sure that BLE is enabled on your device`\n );\n }\n debug(\"Start Scanning ...\");\n this._scanning$.next(true);\n return new Promise<void>((resolve, reject) => {\n this.scanSubscription = this.cordovaInterface\n .startScan(this.requestDeviceOptions)\n .subscribe(\n (result) => {\n if (result == \"Ok\") {\n resolve();\n return;\n }\n this.addOrRefreshDevice(result);\n },\n (error) => {\n debug(\"Start scan failed with error: \", error);\n this.cordovaInterface\n .getLastError()\n .then((lasterror) => {\n debug(\"Last BLE error \" + lasterror);\n })\n .catch((err) => {\n debug(\"Cannot get last BLE error: \", err);\n });\n reject(error);\n this._scanning$.next(false);\n }\n );\n });\n }\n\n /**\n *\n */\n async stop(): Promise<void> {\n debug(\"Stop Scanning ...\");\n try {\n this.scanSubscription?.unsubscribe();\n this.scanSubscription = undefined;\n await this.cordovaInterface.stopScan();\n this._scanning$.next(false);\n return;\n } catch (err) {\n this._scanning$.next(false);\n throw err;\n }\n }\n\n /**\n * Returns true if this scanner is available\n */\n checkAvailable(): Promise<boolean> {\n return this.cordovaInterface.checkAvailable();\n }\n\n private get devices() {\n return this._results.value;\n }\n\n private clearResults() {\n this._results.next([]);\n }\n\n private addOrRefreshDevice(newDevice: CordovaBLEScanResult) {\n let storedDeviceIndex = this.devices.findIndex(\n (entry) => entry.address == newDevice.address\n );\n if (storedDeviceIndex >= 0) {\n let storedDevice = this.devices[storedDeviceIndex];\n if (\n storedDevice.name != newDevice.name ||\n storedDevice.rssi != newDevice.rssi\n ) {\n debug(\n `Updating device at index ${storedDeviceIndex}, name=${storedDevice.name} with rssi=${storedDevice.rssi}`\n );\n this.devices[storedDeviceIndex] = newDevice;\n // this.devices = [...this.devices];\n this._results.next(this.devices);\n }\n } else {\n debug(\n `Adding new device name=${newDevice.name} with rssi=${newDevice.rssi}`\n );\n this.devices.push(newDevice);\n this._results.next(this.devices);\n }\n }\n}\n","import {\n bufferToHexString,\n hexStringToBuffer as hexStringToBufferCore,\n} from \"@iotize/common/byte-converter\";\nimport { safeEnumValue } from \"@iotize/common/utility\";\nimport { ConnectionState } from \"@iotize/tap/protocol/api\";\nimport { Observable, Subject, defer } from \"rxjs\";\nimport { switchMap } from \"rxjs/operators\";\nimport { map } from \"rxjs/operators\";\nimport { CordovaInterface } from \"./cordova-interface\";\nimport {\n CordovaBLEScanResult,\n RequestDeviceOptions,\n ServiceList,\n} from \"./definitions\";\nimport { CordovaBLEError } from \"./cordova-ble-error\";\n\nfunction hexStringToBuffer(str: string): Uint8Array {\n try {\n return hexStringToBufferCore(str);\n } catch (err) {\n throw CordovaBLEError.invalidNativeCallResult(str, err as Error);\n }\n}\n\ndeclare var cordova: CordovaInterface;\n\nexport class IoTizeBleCordovaPlugin {\n checkAvailable(): Promise<boolean> {\n return this.execSingleResult<boolean>(\"checkAvailable\", []);\n }\n\n requestEnableBle(): Promise<\"OK\"> {\n return this.execSingleResult<\"OK\">(\"enable\", []);\n }\n\n startScan(\n requestDeviceOptions: RequestDeviceOptions | undefined\n ): Observable<CordovaBLEScanResult | \"Ok\"> {\n return this.execMultipleResult<CordovaBLEScanResult | \"Ok\">(\"startScan\", [\n JSON.stringify(requestDeviceOptions),\n ]);\n }\n\n stopScan() {\n return this.execSingleResult<\"OK\">(\"stopScan\", []);\n }\n\n connect(\n deviceId: string,\n enableBleIfNot: boolean = true\n ): Observable<ConnectionState> {\n return this.askBleEnable(enableBleIfNot).pipe(\n switchMap(() => {\n return this.execMultipleResult<string>(\"connect\", [deviceId]).pipe(\n map((state) => {\n if (!(state in ConnectionState)) {\n console.warn(\n `Plugin native code returned an invalid connection state: \"${state}\".`\n );\n }\n return safeEnumValue(ConnectionState, state);\n })\n );\n })\n );\n }\n\n askBleEnable(askEnable: boolean): Observable<void> {\n return defer(async () => {\n if (askEnable) {\n if (!(await this.checkAvailable())) {\n await this.requestEnableBle();\n }\n }\n });\n }\n\n requestMTU(deviceId: string, mtu: number) {\n return this.execSingleResult<\"OK\">(\"requestMTU\", [deviceId, mtu]);\n }\n\n connectAndDiscoverTapServices(\n deviceId: string,\n enableBleIfNot: boolean = true\n ): Observable<ConnectionState> {\n return this.askBleEnable(enableBleIfNot).pipe(\n switchMap(() => {\n return this.execMultipleResult<string>(\n \"connectAndDiscoverTapServices\",\n [deviceId]\n ).pipe(\n map((state) => {\n if (!(state in ConnectionState)) {\n console.warn(\n `Plugin native code returned an invalid connection state: \"${state}\".`\n );\n }\n return safeEnumValue(ConnectionState, state);\n })\n );\n })\n );\n }\n\n disConnect(deviceId: string) {\n return this.execSingleResult<\"OK\">(\"disConnect\", [deviceId]);\n }\n\n close(deviceId: string) {\n return this.execSingleResult<\"OK\">(\"close\", [deviceId]);\n }\n\n isConnected(deviceId: string) {\n return this.execSingleResult<boolean>(\"isConnected\", [deviceId]);\n }\n\n async send(deviceId: string, data: Uint8Array) {\n const hexString = await this.execSingleResult<string>(\"sendRequest\", [\n deviceId,\n bufferToHexString(data),\n ]);\n return hexStringToBuffer(hexString);\n }\n\n getLastError() {\n return this.execSingleResult<string>(\"getLastError\", []);\n }\n\n characteristicStartNotification(\n deviceId: string,\n serviceId: string,\n characId: string\n ) {\n return this.execSingleResult<\"OK\">(\"characteristicStartNotification\", [\n deviceId,\n serviceId,\n characId,\n ]);\n }\n\n characteristicChanged(\n deviceId: string,\n serviceId: string,\n characId: string\n ): Observable<Uint8Array> {\n return this.execMultipleResult<string>(\"characteristicChanged\", [\n deviceId,\n serviceId,\n characId,\n ]).pipe(\n map((hexString) => {\n return hexStringToBuffer(hexString);\n })\n );\n }\n\n characteristicStopNotification(\n deviceId: string,\n serviceId: string,\n characId: string\n ) {\n return this.execSingleResult<\"OK\">(\"characteristicStopNotification\", [\n deviceId,\n serviceId,\n characId,\n ]);\n }\n\n async characteristicReadValue(\n deviceId: string,\n serviceId: string,\n characId: string\n ): Promise<Uint8Array> {\n const hexString = await this.execSingleResult<string>(\n \"characteristicRead\",\n [deviceId, serviceId, characId]\n );\n return hexStringToBuffer(hexString);\n }\n\n characteristicWrite(\n deviceId: string,\n serviceId: string,\n characId: string,\n data: Uint8Array\n ) {\n return this.execSingleResult<\"OK\">(\"characteristicWrite\", [\n deviceId,\n serviceId,\n characId,\n bufferToHexString(data),\n ]);\n }\n\n characteristicWriteWithoutResponse(\n deviceId: string,\n serviceId: string,\n characId: string,\n data: Uint8Array\n ) {\n return this.execSingleResult<\"OK\">(\"characteristicWriteWithoutResponse\", [\n deviceId,\n serviceId,\n characId,\n bufferToHexString(data),\n ]);\n }\n\n async discoverServices(deviceId: string): Promise<ServiceList> {\n const services = await this.execSingleResult<ServiceList>(\n \"discoverServices\",\n [deviceId]\n );\n return services;\n }\n\n private execSingleResult<T extends string | void | boolean | Object>(\n methodName: string,\n args: any[]\n ): Promise<T> {\n return new Promise<T>((resolve, reject) => {\n cordova.exec(\n resolve,\n (errObject: { code?: string; message?: string }) => {\n reject(objectErrorToError(errObject));\n },\n \"BLECom\",\n methodName,\n args\n );\n });\n }\n\n private execMultipleResult<T>(\n methodName: string,\n args: any[]\n ): Observable<T> {\n const subject = new Subject<T>();\n cordova.exec<T>(\n (data) => {\n subject.next(data);\n },\n (err) => {\n subject.error(objectErrorToError(err));\n },\n \"BLECom\",\n methodName,\n args\n );\n return subject.asObservable();\n }\n}\n\nfunction objectErrorToError(errObject: { code?: string; message?: string }) {\n if (typeof errObject !== \"object\" || !errObject.code || !errObject.message) {\n return CordovaBLEError.invalidErrorResult(errObject);\n }\n if (!CordovaBLEError.isValidErrorCode(errObject.code)) {\n return CordovaBLEError.invalidErrorCode(errObject);\n }\n return new CordovaBLEError(\n errObject.message,\n CordovaBLEError.Code[errObject.code]\n );\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n\nexport {CharacteristicDescription as ɵb,ServiceDescription as ɵa} from './lib/definitions';\nexport {IoTizeBleCordovaPlugin as ɵc} from './lib/iotize-ble-cordova-plugin';"],"names":["hexStringToBufferCore"],"mappings":";;;;;;;;;;AAEO,MAAM,KAAK,GAAG,cAAc,CAAC,CAAA,8BAAA,CAAgC,CAAC;;ACA/D,MAAO,eAAgB,SAAQ,SAAS,CAAA;IAC5C,OAAO,kBAAkB,CAAC,SAGzB,EAAA;QACC,OAAO,IAAI,eAAe,CACxB,CAAwE,sEAAA,CAAA,EACxE,eAAe,CAAC,IAAI,CAAC,aAAa,CACnC,CAAC;KACH;IAED,OAAO,gBAAgB,CAAC,SAGvB,EAAA;AACC,QAAA,OAAO,IAAI,eAAe,CACxB,qEAAqE,SAAS,CAAC,IAAI,CAAiB,cAAA,EAAA,SAAS,CAAC,OAAO,CAAA,CAAE,EACvH,eAAe,CAAC,IAAI,CAAC,aAAa,CACnC,CAAC;KACH;AAED,IAAA,OAAO,uBAAuB,CAAC,MAAW,EAAE,KAAY,EAAA;AACtD,QAAA,OAAO,IAAI,eAAe,CACxB,CAAA,2DAAA,EAA8D,KAAK,CAAC,OAAO,CAAE,CAAA,EAC7E,eAAe,CAAC,IAAI,CAAC,aAAa,CACnC,CAAC;KACH;IAED,OAAO,gBAAgB,CACrB,IAAY,EAAA;AAEZ,QAAA,OAAO,IAAI,IAAI,eAAe,CAAC,IAAI,CAAC;KACrC;AAED,IAAA,OAAO,gBAAgB,GAAA;QACrB,OAAO,IAAI,eAAe,CACxB,CAAsG,oGAAA,CAAA,EACtG,eAAe,CAAC,IAAI,CAAC,aAAa,CACnC,CAAC;KACH;AACF,CAAA;AAED;AACA,CAAA,UAAiB,eAAe,EAAA;AAC9B,IAAA,IAAY,IAYX,CAAA;AAZD,IAAA,CAAA,UAAY,IAAI,EAAA;AACd,QAAA,IAAA,CAAA,eAAA,CAAA,GAAA,8BAA8C,CAAA;AAC9C,QAAA,IAAA,CAAA,iBAAA,CAAA,GAAA,gCAAkD,CAAA;AAClD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,eAAe,CAAC,gBAAgB,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE;AACrD,QAAA,OAAO,eAAe,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;AACpD,KAAA;AACD,IAAA,OAAO,IAAI,eAAe,CACxB,SAAS,CAAC,OAAO,EACjB,eAAe,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CACrC,CAAC;AACJ;;ACzQA;;AAEG;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"__symbolic":"module","version":4,"metadata":{"BLEComProtocol":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"@iotize/tap/protocol/core","name":"QueueComProtocol","line":20,"character":36},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","module":"@iotize/tap/protocol/api","name":"ComProtocolOptions","line":32,"character":25},{"__symbolic":"reference","name":"ɵc"}]}],"_connect":[{"__symbolic":"method"}],"_disconnect":[{"__symbolic":"method"}],"write":[{"__symbolic":"method"}],"read":[{"__symbolic":"method"}],"send":[{"__symbolic":"method"}]}},"CordovaCharacteristicAdapter":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"CordovaServiceAdapter"},{"__symbolic":"reference","name":"ɵb"}]}],"read":[{"__symbolic":"method"}],"getDescriptor":[{"__symbolic":"method"}],"getDescriptors":[{"__symbolic":"method"}],"write":[{"__symbolic":"method"}],"enableNotifications":[{"__symbolic":"method"}],"setupDataStreamIfRequired":[{"__symbolic":"method"}]}},"CordovaPeripheralAdapter":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"ɵc"}]}],"discoverServices":[{"__symbolic":"method"}],"connect":[{"__symbolic":"method"}],"disconnect":[{"__symbolic":"method"}],"close":[{"__symbolic":"method"}],"getService":[{"__symbolic":"method"}]}},"CordovaServiceAdapter":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"ɵa"},{"__symbolic":"reference","name":"CordovaPeripheralAdapter"}]}],"getCharacteristic":[{"__symbolic":"method"}],"getCharacteristics":[{"__symbolic":"method"}]}},"ɵa":{"__symbolic":"interface"},"ɵb":{"__symbolic":"interface"},"CordovaBLEScanResult":{"__symbolic":"interface"},"RequestDeviceOptions":{"__symbolic":"interface"},"BLEScanner":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"ɵc"},{"__symbolic":"reference","name":"RequestDeviceOptions"}]}],"start":[{"__symbolic":"method"}],"stop":[{"__symbolic":"method"}],"checkAvailable":[{"__symbolic":"method"}],"clearResults":[{"__symbolic":"method"}],"addOrRefreshDevice":[{"__symbolic":"method"}]}},"getIoTizeBleCordovaPlugin":{"__symbolic":"function"},"ɵc":{"__symbolic":"class","members":{"checkAvailable":[{"__symbolic":"method"}],"requestEnableBle":[{"__symbolic":"method"}],"startScan":[{"__symbolic":"method"}],"stopScan":[{"__symbolic":"method"}],"connect":[{"__symbolic":"method"}],"requestMTU":[{"__symbolic":"method"}],"connectAndDiscoverTapServices":[{"__symbolic":"method"}],"disConnect":[{"__symbolic":"method"}],"close":[{"__symbolic":"method"}],"isConnected":[{"__symbolic":"method"}],"send":[{"__symbolic":"method"}],"getLastError":[{"__symbolic":"method"}],"characteristicStartNotification":[{"__symbolic":"method"}],"characteristicChanged":[{"__symbolic":"method"}],"characteristicStopNotification":[{"__symbolic":"method"}],"characteristicReadValue":[{"__symbolic":"method"}],"characteristicWrite":[{"__symbolic":"method"}],"characteristicWriteWithoutResponse":[{"__symbolic":"method"}],"discoverServices":[{"__symbolic":"method"}],"execSingleResult":[{"__symbolic":"method"}],"execMultipleResult":[{"__symbolic":"method"}]}}},"origins":{"BLEComProtocol":"./lib/ble-com-protocol","CordovaCharacteristicAdapter":"./lib/cordova-service-adapter","CordovaPeripheralAdapter":"./lib/cordova-service-adapter","CordovaServiceAdapter":"./lib/cordova-service-adapter","ɵa":"./lib/definitions","ɵb":"./lib/definitions","CordovaBLEScanResult":"./lib/definitions","RequestDeviceOptions":"./lib/definitions","BLEScanner":"./lib/scanner","getIoTizeBleCordovaPlugin":"./lib/utility","ɵc":"./lib/iotize-ble-cordova-plugin"},"importAs":"@iotize/device-com-ble.cordova"}
|
|
1
|
+
{"__symbolic":"module","version":4,"metadata":{"BLEComProtocol":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"@iotize/tap/protocol/core","name":"QueueComProtocol","line":20,"character":36},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","module":"@iotize/tap/protocol/api","name":"ComProtocolOptions","line":32,"character":25},{"__symbolic":"reference","name":"ɵc"}]}],"_connect":[{"__symbolic":"method"}],"_disconnect":[{"__symbolic":"method"}],"write":[{"__symbolic":"method"}],"read":[{"__symbolic":"method"}],"send":[{"__symbolic":"method"}]}},"CordovaCharacteristicAdapter":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"CordovaServiceAdapter"},{"__symbolic":"reference","name":"ɵb"}]}],"read":[{"__symbolic":"method"}],"getDescriptor":[{"__symbolic":"method"}],"getDescriptors":[{"__symbolic":"method"}],"write":[{"__symbolic":"method"}],"enableNotifications":[{"__symbolic":"method"}],"setupDataStreamIfRequired":[{"__symbolic":"method"}]}},"CordovaPeripheralAdapter":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"ɵc"}]}],"discoverServices":[{"__symbolic":"method"}],"connect":[{"__symbolic":"method"}],"disconnect":[{"__symbolic":"method"}],"close":[{"__symbolic":"method"}],"getService":[{"__symbolic":"method"}]}},"CordovaServiceAdapter":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"ɵa"},{"__symbolic":"reference","name":"CordovaPeripheralAdapter"}]}],"getCharacteristic":[{"__symbolic":"method"}],"getCharacteristics":[{"__symbolic":"method"}]}},"ɵa":{"__symbolic":"interface"},"ɵb":{"__symbolic":"interface"},"CordovaBLEScanResult":{"__symbolic":"interface"},"RequestDeviceOptions":{"__symbolic":"interface"},"BLEScanner":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"ɵc"},{"__symbolic":"reference","name":"RequestDeviceOptions"}]}],"start":[{"__symbolic":"method"}],"stop":[{"__symbolic":"method"}],"checkAvailable":[{"__symbolic":"method"}],"clearResults":[{"__symbolic":"method"}],"addOrRefreshDevice":[{"__symbolic":"method"}]}},"getIoTizeBleCordovaPlugin":{"__symbolic":"function"},"ɵc":{"__symbolic":"class","members":{"checkAvailable":[{"__symbolic":"method"}],"requestEnableBle":[{"__symbolic":"method"}],"startScan":[{"__symbolic":"method"}],"stopScan":[{"__symbolic":"method"}],"connect":[{"__symbolic":"method"}],"askBleEnable":[{"__symbolic":"method"}],"requestMTU":[{"__symbolic":"method"}],"connectAndDiscoverTapServices":[{"__symbolic":"method"}],"disConnect":[{"__symbolic":"method"}],"close":[{"__symbolic":"method"}],"isConnected":[{"__symbolic":"method"}],"send":[{"__symbolic":"method"}],"getLastError":[{"__symbolic":"method"}],"characteristicStartNotification":[{"__symbolic":"method"}],"characteristicChanged":[{"__symbolic":"method"}],"characteristicStopNotification":[{"__symbolic":"method"}],"characteristicReadValue":[{"__symbolic":"method"}],"characteristicWrite":[{"__symbolic":"method"}],"characteristicWriteWithoutResponse":[{"__symbolic":"method"}],"discoverServices":[{"__symbolic":"method"}],"execSingleResult":[{"__symbolic":"method"}],"execMultipleResult":[{"__symbolic":"method"}]}}},"origins":{"BLEComProtocol":"./lib/ble-com-protocol","CordovaCharacteristicAdapter":"./lib/cordova-service-adapter","CordovaPeripheralAdapter":"./lib/cordova-service-adapter","CordovaServiceAdapter":"./lib/cordova-service-adapter","ɵa":"./lib/definitions","ɵb":"./lib/definitions","CordovaBLEScanResult":"./lib/definitions","RequestDeviceOptions":"./lib/definitions","BLEScanner":"./lib/scanner","getIoTizeBleCordovaPlugin":"./lib/utility","ɵc":"./lib/iotize-ble-cordova-plugin"},"importAs":"@iotize/device-com-ble.cordova"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ComProtocolConnectOptions, ComProtocolDisconnectOptions, ComProtocolOptions, ComProtocolSendOptions } from
|
|
2
|
-
import { QueueComProtocol } from
|
|
3
|
-
import { Observable } from
|
|
4
|
-
import { IoTizeBleCordovaPlugin } from
|
|
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
5
|
export declare class BLEComProtocol extends QueueComProtocol {
|
|
6
6
|
private deviceId;
|
|
7
7
|
readonly cordovaInterfaceOverwrite?: IoTizeBleCordovaPlugin | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CodeError } from
|
|
1
|
+
import { CodeError } from '@iotize/common/error';
|
|
2
2
|
export declare class CordovaBLEError extends CodeError {
|
|
3
3
|
static invalidErrorResult(errObject: {
|
|
4
4
|
code?: string | undefined;
|
|
@@ -9,12 +9,21 @@ export declare class CordovaBLEError extends CodeError {
|
|
|
9
9
|
message?: string | undefined;
|
|
10
10
|
}): CordovaBLEError;
|
|
11
11
|
static invalidNativeCallResult(result: any, cause: Error): CordovaBLEError;
|
|
12
|
-
static isValidErrorCode(code: string): code is
|
|
12
|
+
static isValidErrorCode(code: string): code is keyof typeof CordovaBLEError.Code;
|
|
13
13
|
static iotizeBLEMissing(): CordovaBLEError;
|
|
14
14
|
}
|
|
15
15
|
export declare namespace CordovaBLEError {
|
|
16
16
|
enum Code {
|
|
17
17
|
InternalError = "CordovaBLEErrorInternalError",
|
|
18
|
-
IllegalArgument = "CordovaBLEErrorIllegalArgument"
|
|
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"
|
|
19
28
|
}
|
|
20
29
|
}
|
|
@@ -2,7 +2,7 @@ import { ConnectionState } from "@iotize/tap/protocol/api";
|
|
|
2
2
|
import { CharacteristicAdapterInterface, PeripheralAdapterInterface, ServiceAdapterInterface, DescriptorAdapterInterface, CharacteristicProperties } from "@iotize/tap/protocol/ble/common";
|
|
3
3
|
import { Observable } from "rxjs";
|
|
4
4
|
import { CharacteristicDescription, DescriptorDescription, ServiceDescription } from "./definitions";
|
|
5
|
-
import { IoTizeBleCordovaPlugin } from
|
|
5
|
+
import { IoTizeBleCordovaPlugin } from "./iotize-ble-cordova-plugin";
|
|
6
6
|
export declare class CordovaPeripheralAdapter implements PeripheralAdapterInterface<CordovaServiceAdapter> {
|
|
7
7
|
readonly deviceId: string;
|
|
8
8
|
readonly cordovaPlugin: IoTizeBleCordovaPlugin;
|
package/lib/definitions.d.ts
CHANGED
|
@@ -3,12 +3,13 @@ import { Observable } from "rxjs";
|
|
|
3
3
|
import { CordovaBLEScanResult, RequestDeviceOptions, ServiceList } from "./definitions";
|
|
4
4
|
export declare class IoTizeBleCordovaPlugin {
|
|
5
5
|
checkAvailable(): Promise<boolean>;
|
|
6
|
-
requestEnableBle(): Promise<
|
|
6
|
+
requestEnableBle(): Promise<"OK">;
|
|
7
7
|
startScan(requestDeviceOptions: RequestDeviceOptions | undefined): Observable<CordovaBLEScanResult | "Ok">;
|
|
8
8
|
stopScan(): Promise<"OK">;
|
|
9
|
-
connect(deviceId: string): Observable<ConnectionState>;
|
|
9
|
+
connect(deviceId: string, enableBleIfNot?: boolean): Observable<ConnectionState>;
|
|
10
|
+
askBleEnable(askEnable: boolean): Observable<void>;
|
|
10
11
|
requestMTU(deviceId: string, mtu: number): Promise<"OK">;
|
|
11
|
-
connectAndDiscoverTapServices(deviceId: string): Observable<ConnectionState>;
|
|
12
|
+
connectAndDiscoverTapServices(deviceId: string, enableBleIfNot?: boolean): Observable<ConnectionState>;
|
|
12
13
|
disConnect(deviceId: string): Promise<"OK">;
|
|
13
14
|
close(deviceId: string): Promise<"OK">;
|
|
14
15
|
isConnected(deviceId: string): Promise<boolean>;
|
package/lib/scanner.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { DeviceScanner, DeviceScannerOptions } from
|
|
2
|
-
import { Observable } from
|
|
3
|
-
import { CordovaBLEScanResult, RequestDeviceOptions } from
|
|
4
|
-
import { IoTizeBleCordovaPlugin } from
|
|
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
5
|
/**
|
|
6
6
|
* BLE Tap scanner for cordova apps
|
|
7
7
|
*/
|
package/package.json
CHANGED
package/plugin.xml
CHANGED
|
@@ -1,63 +1,66 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" id="@iotize/device-com-ble.cordova" version="2.0.0">
|
|
3
|
-
|
|
4
|
-
<name>@iotize/device-com-ble.cordova</name>
|
|
5
|
-
<description>Bluetooth Low Energy (BLE) Plugin for IoTize devices</description>
|
|
6
|
-
<license>MIT</license>
|
|
7
|
-
<keywords>bluetooth, BLE, bluetooth low energy, TapNLink, IoTize</keywords>
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
<js-module src="www/plugin.js" name="iotizeBLE">
|
|
11
|
-
<clobbers target="iotizeBLE" />
|
|
12
|
-
</js-module>
|
|
13
|
-
|
|
14
|
-
<platform name="android">
|
|
15
|
-
<config-file target="res/xml/config.xml" parent="/*">
|
|
16
|
-
<feature name="BLECom">
|
|
17
|
-
<param name="android-package" value="com.iotize.plugin.cordova.ble.BLECom"/>
|
|
18
|
-
</feature>
|
|
19
|
-
</config-file>
|
|
20
|
-
<framework src="src/android/build.gradle" custom="true" type="gradleReference" />
|
|
21
|
-
<source-file src="src/android/src/ble" target-dir="java/com/iotize/plugin/cordova"/>
|
|
22
|
-
<config-file target="AndroidManifest.xml" parent="/manifest">
|
|
23
|
-
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
|
24
|
-
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
|
25
|
-
<uses-permission android:name="android.permission.BLUETOOTH"/>
|
|
26
|
-
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
|
|
27
|
-
</config-file>
|
|
28
|
-
</platform>
|
|
29
|
-
|
|
30
|
-
<platform name="windows">
|
|
31
|
-
<js-module src="src/windows/iotize-ble-com.js" name="BLECom">
|
|
32
|
-
<merges target="" />
|
|
33
|
-
</js-module>
|
|
34
|
-
<framework src="src/windows/ioTizeBLE.winmd" custom="true"/>
|
|
35
|
-
<config-file target="package.appxmanifest" parent="/Package/Capabilities">
|
|
36
|
-
<DeviceCapability Name="bluetooth"/>
|
|
37
|
-
<DeviceCapability Name="radios"/>
|
|
38
|
-
</config-file>
|
|
39
|
-
</platform>
|
|
40
|
-
|
|
41
|
-
<platform name="ios">
|
|
42
|
-
<dependency id="cordova-plugin-add-swift-support"/>
|
|
43
|
-
<config-file target="config.xml" parent="/*">
|
|
44
|
-
<feature name="BLECom">
|
|
45
|
-
<param name="ios-package" value="BLECom" />
|
|
46
|
-
</feature>
|
|
47
|
-
</config-file>
|
|
48
|
-
<source-file src="src/ios/BLECom.swift" />
|
|
49
|
-
<source-file src="src/ios/BLEManager.swift" />
|
|
50
|
-
<source-file src="src/ios/BLETapPeripheral.swift" />
|
|
51
|
-
<source-file src="src/ios/BLEGenericPeripheral.swift" />
|
|
52
|
-
<source-file src="src/ios/CBPeripheralConverter.swift" />
|
|
53
|
-
<source-file src="src/ios/Queue.swift" />
|
|
54
|
-
|
|
55
|
-
<config-file target="*-Info.plist" parent="NSBluetoothAlwaysUsageDescription">
|
|
56
|
-
<string>Communicate with IoTize BLE Devices</string>
|
|
57
|
-
</config-file>
|
|
58
|
-
<config-file target="*-Info.plist" parent="NSBluetoothPeripheralUsageDescription">
|
|
59
|
-
<string>Communicate with IoTize BLE Devices</string>
|
|
60
|
-
</config-file>
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
</
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" id="@iotize/device-com-ble.cordova" version="2.0.0">
|
|
3
|
+
|
|
4
|
+
<name>@iotize/device-com-ble.cordova</name>
|
|
5
|
+
<description>Bluetooth Low Energy (BLE) Plugin for IoTize devices</description>
|
|
6
|
+
<license>MIT</license>
|
|
7
|
+
<keywords>bluetooth, BLE, bluetooth low energy, TapNLink, IoTize</keywords>
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
<js-module src="www/plugin.js" name="iotizeBLE">
|
|
11
|
+
<clobbers target="iotizeBLE" />
|
|
12
|
+
</js-module>
|
|
13
|
+
|
|
14
|
+
<platform name="android">
|
|
15
|
+
<config-file target="res/xml/config.xml" parent="/*">
|
|
16
|
+
<feature name="BLECom">
|
|
17
|
+
<param name="android-package" value="com.iotize.plugin.cordova.ble.BLECom"/>
|
|
18
|
+
</feature>
|
|
19
|
+
</config-file>
|
|
20
|
+
<framework src="src/android/build.gradle" custom="true" type="gradleReference" />
|
|
21
|
+
<source-file src="src/android/src/ble" target-dir="java/com/iotize/plugin/cordova"/>
|
|
22
|
+
<config-file target="AndroidManifest.xml" parent="/manifest">
|
|
23
|
+
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
|
24
|
+
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
|
25
|
+
<uses-permission android:name="android.permission.BLUETOOTH"/>
|
|
26
|
+
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
|
|
27
|
+
</config-file>
|
|
28
|
+
</platform>
|
|
29
|
+
|
|
30
|
+
<platform name="windows">
|
|
31
|
+
<js-module src="src/windows/iotize-ble-com.js" name="BLECom">
|
|
32
|
+
<merges target="" />
|
|
33
|
+
</js-module>
|
|
34
|
+
<framework src="src/windows/ioTizeBLE.winmd" custom="true"/>
|
|
35
|
+
<config-file target="package.appxmanifest" parent="/Package/Capabilities">
|
|
36
|
+
<DeviceCapability Name="bluetooth"/>
|
|
37
|
+
<DeviceCapability Name="radios"/>
|
|
38
|
+
</config-file>
|
|
39
|
+
</platform>
|
|
40
|
+
|
|
41
|
+
<platform name="ios">
|
|
42
|
+
<dependency id="cordova-plugin-add-swift-support"/>
|
|
43
|
+
<config-file target="config.xml" parent="/*">
|
|
44
|
+
<feature name="BLECom">
|
|
45
|
+
<param name="ios-package" value="BLECom" />
|
|
46
|
+
</feature>
|
|
47
|
+
</config-file>
|
|
48
|
+
<source-file src="src/ios/BLECom.swift" />
|
|
49
|
+
<source-file src="src/ios/BLEManager.swift" />
|
|
50
|
+
<source-file src="src/ios/BLETapPeripheral.swift" />
|
|
51
|
+
<source-file src="src/ios/BLEGenericPeripheral.swift" />
|
|
52
|
+
<source-file src="src/ios/CBPeripheralConverter.swift" />
|
|
53
|
+
<source-file src="src/ios/Queue.swift" />
|
|
54
|
+
|
|
55
|
+
<config-file target="*-Info.plist" parent="NSBluetoothAlwaysUsageDescription">
|
|
56
|
+
<string>Communicate with IoTize BLE Devices</string>
|
|
57
|
+
</config-file>
|
|
58
|
+
<config-file target="*-Info.plist" parent="NSBluetoothPeripheralUsageDescription">
|
|
59
|
+
<string>Communicate with IoTize BLE Devices</string>
|
|
60
|
+
</config-file>
|
|
61
|
+
<config-file target="*-Info.plist" parent="NSLocationWhenInUseUsageDescription">
|
|
62
|
+
<string>Communicate with IoTize BLE Devices</string>
|
|
63
|
+
</config-file>
|
|
64
|
+
</platform>
|
|
65
|
+
|
|
66
|
+
</plugin>
|
package/public_api.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { BLEComProtocol } from
|
|
2
|
-
export { CordovaCharacteristicAdapter, CordovaPeripheralAdapter, CordovaServiceAdapter } from
|
|
3
|
-
export { CordovaBLEScanResult, RequestDeviceOptions } from
|
|
4
|
-
export { BLEScanner } from
|
|
5
|
-
export { getIoTizeBleCordovaPlugin } from
|
|
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 } from "./lib/utility";
|
|
Binary file
|
|
Binary file
|