1- import { ENV_OBJ } from '../../../common/js'
1+ import { ENV_OBJ , envError } from '../../../common/js'
22
33function closeBLEConnection ( options = { } ) {
44 return ENV_OBJ . disconnectBLEDevice ( options )
@@ -12,8 +12,73 @@ function onBLEConnectionStateChange (callback) {
1212 return ENV_OBJ . onBLEConnectionStateChanged ( callback )
1313}
1414
15+ function offBLEConnectionStateChange ( callback ) {
16+ return ENV_OBJ . offBLEConnectionStateChanged ( callback )
17+ }
18+
19+ const openBluetoothAdapter = ENV_OBJ . openBluetoothAdapter || envError ( 'openBluetoothAdapter' )
20+
21+ const closeBluetoothAdapter = ENV_OBJ . closeBluetoothAdapter || envError ( 'closeBluetoothAdapter' )
22+
23+ const startBluetoothDevicesDiscovery = ENV_OBJ . startBluetoothDevicesDiscovery || envError ( 'startBluetoothDevicesDiscovery' )
24+
25+ const stopBluetoothDevicesDiscovery = ENV_OBJ . stopBluetoothDevicesDiscovery || envError ( 'stopBluetoothDevicesDiscovery' )
26+
27+ const onBluetoothDeviceFound = ENV_OBJ . onBluetoothDeviceFound || envError ( 'onBluetoothDeviceFound' )
28+
29+ const offBluetoothDeviceFound = ENV_OBJ . offBluetoothDeviceFound || envError ( 'offBluetoothDeviceFound' )
30+
31+ const getConnectedBluetoothDevices = ENV_OBJ . getConnectedBluetoothDevices || envError ( 'getConnectedBluetoothDevices' )
32+
33+ const getBluetoothAdapterState = ENV_OBJ . getBluetoothAdapterState || envError ( 'getBluetoothAdapterState' )
34+
35+ const onBluetoothAdapterStateChange = ENV_OBJ . onBluetoothAdapterStateChange || envError ( 'onBluetoothAdapterStateChange' )
36+
37+ const offBluetoothAdapterStateChange = ENV_OBJ . offBluetoothAdapterStateChange || envError ( 'offBluetoothAdapterStateChange' )
38+
39+ const getBluetoothDevices = ENV_OBJ . getBluetoothDevices || envError ( 'getBluetoothDevices' )
40+
41+ const writeBLECharacteristicValue = ENV_OBJ . writeBLECharacteristicValue || envError ( 'writeBLECharacteristicValue' )
42+
43+ const readBLECharacteristicValue = ENV_OBJ . readBLECharacteristicValue || envError ( 'readBLECharacteristicValue' )
44+
45+ const notifyBLECharacteristicValueChange = ENV_OBJ . notifyBLECharacteristicValueChange || envError ( 'notifyBLECharacteristicValueChange' )
46+
47+ const onBLECharacteristicValueChange = ENV_OBJ . onBLECharacteristicValueChange || envError ( 'onBLECharacteristicValueChange' )
48+
49+ const offBLECharacteristicValueChange = ENV_OBJ . offBLECharacteristicValueChange || envError ( 'offBLECharacteristicValueChange' )
50+
51+ const setBLEMTU = ENV_OBJ . setBLEMTU || envError ( 'setBLEMTU' )
52+
53+ const getBLEDeviceRSSI = ENV_OBJ . getBLEDeviceRSSI || envError ( 'getBLEDeviceRSSI' )
54+
55+ const getBLEDeviceServices = ENV_OBJ . getBLEDeviceServices || envError ( 'getBLEDeviceServices' )
56+
57+ const getBLEDeviceCharacteristics = ENV_OBJ . getBLEDeviceCharacteristics || envError ( 'getBLEDeviceCharacteristics' )
58+
1559export {
1660 closeBLEConnection ,
1761 createBLEConnection ,
18- onBLEConnectionStateChange
62+ onBLEConnectionStateChange ,
63+ offBLEConnectionStateChange ,
64+ openBluetoothAdapter ,
65+ closeBluetoothAdapter ,
66+ startBluetoothDevicesDiscovery ,
67+ stopBluetoothDevicesDiscovery ,
68+ onBluetoothDeviceFound ,
69+ offBluetoothDeviceFound ,
70+ getConnectedBluetoothDevices ,
71+ getBluetoothAdapterState ,
72+ onBluetoothAdapterStateChange ,
73+ offBluetoothAdapterStateChange ,
74+ getBluetoothDevices ,
75+ writeBLECharacteristicValue ,
76+ readBLECharacteristicValue ,
77+ notifyBLECharacteristicValueChange ,
78+ onBLECharacteristicValueChange ,
79+ offBLECharacteristicValueChange ,
80+ setBLEMTU ,
81+ getBLEDeviceRSSI ,
82+ getBLEDeviceServices ,
83+ getBLEDeviceCharacteristics
1984}
0 commit comments