UNPKG

@iotize/device-com-ble.cordova

Version:

Bluetooth Low Energy (BLE) for IoTize modules Plugin

56 lines (55 loc) 1.84 kB
import { DeviceScanner, DeviceScannerOptions } from "@iotize/tap/scanner/api"; import { Observable } from "rxjs"; import { CordovaBLEScanResult, RequestDeviceOptions } from "./definitions"; import { IoTizeBleCordovaPlugin } from "./iotize-ble-cordova-plugin"; /** * BLE Tap scanner for cordova apps */ export declare class BLEScanner implements DeviceScanner<CordovaBLEScanResult> { private cordovaInterfaceOverwrite?; /** * Request device options used to filter scan results */ readonly requestDeviceOptions?: RequestDeviceOptions | undefined; private _results; private _scanning$; private scanSubscription?; /** * Lazy reference to iotizeBLE. * We don't want to reference iotizeBLE in constructor as it may be referenced * before cordova plugin is loaded */ private get cordovaInterface(); /** * * @param cordovaInterfaceOverwrite overwrite cordova interface. Used for testing */ constructor(cordovaInterfaceOverwrite?: IoTizeBleCordovaPlugin | undefined, /** * Request device options used to filter scan results */ requestDeviceOptions?: RequestDeviceOptions | undefined); get scanning(): Observable<boolean>; get isScanning(): boolean; /** * Gets the observable on the devices$ Subject * @return */ get results(): Observable<CordovaBLEScanResult[]>; /** * Launches the scan for BLE devices * Throws if BLE is not available */ start(options?: DeviceScannerOptions): Promise<void>; /** * */ stop(): Promise<void>; /** * Returns true if this scanner is available */ checkAvailable(): Promise<boolean>; private get devices(); private clearResults; private addOrRefreshDevice; }