@capacitor-community/bluetooth-le 7.0.0 → 7.1.0

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.
Files changed (55) hide show
  1. package/CapacitorCommunityBluetoothLe.podspec +17 -17
  2. package/LICENSE +21 -21
  3. package/README.md +95 -26
  4. package/android/build.gradle +68 -68
  5. package/android/src/main/AndroidManifest.xml +22 -22
  6. package/android/src/main/java/com/capacitorjs/community/plugins/bluetoothle/BluetoothLe.kt +1061 -1009
  7. package/android/src/main/java/com/capacitorjs/community/plugins/bluetoothle/Conversion.kt +51 -51
  8. package/android/src/main/java/com/capacitorjs/community/plugins/bluetoothle/Device.kt +720 -718
  9. package/android/src/main/java/com/capacitorjs/community/plugins/bluetoothle/DeviceList.kt +28 -28
  10. package/android/src/main/java/com/capacitorjs/community/plugins/bluetoothle/DeviceScanner.kt +189 -189
  11. package/dist/docs.json +892 -78
  12. package/dist/esm/bleClient.d.ts +277 -277
  13. package/dist/esm/bleClient.js +349 -349
  14. package/dist/esm/bleClient.js.map +1 -1
  15. package/dist/esm/config.d.ts +53 -53
  16. package/dist/esm/config.js +2 -2
  17. package/dist/esm/config.js.map +1 -1
  18. package/dist/esm/conversion.d.ts +34 -34
  19. package/dist/esm/conversion.js +84 -84
  20. package/dist/esm/conversion.js.map +1 -1
  21. package/dist/esm/definitions.d.ts +301 -292
  22. package/dist/esm/definitions.js +42 -42
  23. package/dist/esm/definitions.js.map +1 -1
  24. package/dist/esm/index.d.ts +5 -5
  25. package/dist/esm/index.js +5 -5
  26. package/dist/esm/index.js.map +1 -1
  27. package/dist/esm/plugin.d.ts +2 -2
  28. package/dist/esm/plugin.js +4 -4
  29. package/dist/esm/plugin.js.map +1 -1
  30. package/dist/esm/queue.d.ts +3 -3
  31. package/dist/esm/queue.js +17 -17
  32. package/dist/esm/queue.js.map +1 -1
  33. package/dist/esm/timeout.d.ts +1 -1
  34. package/dist/esm/timeout.js +9 -9
  35. package/dist/esm/timeout.js.map +1 -1
  36. package/dist/esm/validators.d.ts +1 -1
  37. package/dist/esm/validators.js +11 -11
  38. package/dist/esm/validators.js.map +1 -1
  39. package/dist/esm/web.d.ts +56 -56
  40. package/dist/esm/web.js +340 -335
  41. package/dist/esm/web.js.map +1 -1
  42. package/dist/plugin.cjs.js +841 -834
  43. package/dist/plugin.cjs.js.map +1 -1
  44. package/dist/plugin.js +841 -834
  45. package/dist/plugin.js.map +1 -1
  46. package/ios/Plugin/Conversion.swift +83 -83
  47. package/ios/Plugin/Device.swift +423 -423
  48. package/ios/Plugin/DeviceManager.swift +401 -349
  49. package/ios/Plugin/Info.plist +24 -24
  50. package/ios/Plugin/Logging.swift +8 -8
  51. package/ios/Plugin/Plugin.h +10 -10
  52. package/ios/Plugin/Plugin.m +41 -41
  53. package/ios/Plugin/Plugin.swift +682 -636
  54. package/ios/Plugin/ThreadSafeDictionary.swift +13 -13
  55. package/package.json +101 -101
@@ -1,292 +1,301 @@
1
- import type { PluginListenerHandle } from '@capacitor/core';
2
- import type { DisplayStrings } from './config';
3
- export interface InitializeOptions {
4
- /**
5
- * If your app doesn't use Bluetooth scan results to derive physical
6
- * location information, you can strongly assert that your app
7
- * doesn't derive physical location. (Android only)
8
- * Requires adding 'neverForLocation' to AndroidManifest.xml
9
- * https://developer.android.com/guide/topics/connectivity/bluetooth/permissions#assert-never-for-location
10
- * @default false
11
- */
12
- androidNeverForLocation?: boolean;
13
- }
14
- export interface RequestBleDeviceOptions {
15
- /**
16
- * Filter devices by service UUIDs.
17
- * UUIDs have to be specified as 128 bit UUID strings,
18
- * e.g. ['0000180d-0000-1000-8000-00805f9b34fb']
19
- * There is a helper function to convert numbers to UUIDs.
20
- * e.g. [numberToUUID(0x180f)]. (see [UUID format](#uuid-format))
21
- */
22
- services?: string[];
23
- /**
24
- * Filter devices by name
25
- */
26
- name?: string;
27
- /**
28
- * Filter devices by name prefix
29
- */
30
- namePrefix?: string;
31
- /**
32
- * For **web**, all services that will be used have to be listed under services or optionalServices,
33
- * e.g. [numberToUUID(0x180f)] (see [UUID format](#uuid-format))
34
- */
35
- optionalServices?: string[];
36
- /**
37
- * Normally scans will discard the second and subsequent advertisements from a single device.
38
- * If you need to receive them, set allowDuplicates to true (only applicable in `requestLEScan`).
39
- * (default: false)
40
- */
41
- allowDuplicates?: boolean;
42
- /**
43
- * Android scan mode (default: ScanMode.SCAN_MODE_BALANCED)
44
- */
45
- scanMode?: ScanMode;
46
- }
47
- /**
48
- * Android scan mode
49
- */
50
- export declare enum ScanMode {
51
- /**
52
- * Perform Bluetooth LE scan in low power mode. This mode is enforced if the scanning application is not in foreground.
53
- * https://developer.android.com/reference/android/bluetooth/le/ScanSettings#SCAN_MODE_LOW_POWER
54
- */
55
- SCAN_MODE_LOW_POWER = 0,
56
- /**
57
- * Perform Bluetooth LE scan in balanced power mode. (default) Scan results are returned at a rate that provides a good trade-off between scan frequency and power consumption.
58
- * https://developer.android.com/reference/android/bluetooth/le/ScanSettings#SCAN_MODE_BALANCED
59
- */
60
- SCAN_MODE_BALANCED = 1,
61
- /**
62
- * Scan using highest duty cycle. It's recommended to only use this mode when the application is running in the foreground.
63
- * https://developer.android.com/reference/android/bluetooth/le/ScanSettings#SCAN_MODE_LOW_LATENCY
64
- */
65
- SCAN_MODE_LOW_LATENCY = 2
66
- }
67
- /**
68
- * Android connection priority used in `requestConnectionPriority`
69
- */
70
- export declare enum ConnectionPriority {
71
- /**
72
- * Use the connection parameters recommended by the Bluetooth SIG. This is the default value if no connection parameter update is requested.
73
- * https://developer.android.com/reference/android/bluetooth/BluetoothGatt#CONNECTION_PRIORITY_BALANCED
74
- */
75
- CONNECTION_PRIORITY_BALANCED = 0,
76
- /**
77
- * Request a high priority, low latency connection. An application should only request high priority connection parameters to transfer large amounts of data over LE quickly. Once the transfer is complete, the application should request CONNECTION_PRIORITY_BALANCED connection parameters to reduce energy use.
78
- * https://developer.android.com/reference/android/bluetooth/BluetoothGatt#CONNECTION_PRIORITY_HIGH
79
- */
80
- CONNECTION_PRIORITY_HIGH = 1,
81
- /**
82
- * Request low power, reduced data rate connection parameters.
83
- * https://developer.android.com/reference/android/bluetooth/BluetoothGatt#CONNECTION_PRIORITY_LOW_POWER
84
- */
85
- CONNECTION_PRIORITY_LOW_POWER = 2
86
- }
87
- export interface BleDevice {
88
- /**
89
- * ID of the device, which will be needed for further calls.
90
- * On **Android** this is the BLE MAC address.
91
- * On **iOS** and **web** it is an identifier.
92
- */
93
- deviceId: string;
94
- /**
95
- * Name of the peripheral device.
96
- */
97
- name?: string;
98
- uuids?: string[];
99
- }
100
- export interface DeviceIdOptions {
101
- deviceId: string;
102
- }
103
- export interface TimeoutOptions {
104
- /**
105
- * Timeout in milliseconds for plugin call.
106
- * Default is 10000 for `connect` and 5000 for other plugin methods.
107
- */
108
- timeout?: number;
109
- }
110
- export interface RequestConnectionPriorityOptions extends DeviceIdOptions {
111
- connectionPriority: ConnectionPriority;
112
- }
113
- export interface GetDevicesOptions {
114
- deviceIds: string[];
115
- }
116
- export interface GetConnectedDevicesOptions {
117
- services: string[];
118
- }
119
- export interface BleService {
120
- readonly uuid: string;
121
- readonly characteristics: BleCharacteristic[];
122
- }
123
- export interface BleDescriptor {
124
- readonly uuid: string;
125
- }
126
- export interface BleCharacteristic {
127
- readonly uuid: string;
128
- readonly properties: BleCharacteristicProperties;
129
- readonly descriptors: BleDescriptor[];
130
- }
131
- export interface BleCharacteristicProperties {
132
- readonly broadcast: boolean;
133
- readonly read: boolean;
134
- readonly writeWithoutResponse: boolean;
135
- readonly write: boolean;
136
- readonly notify: boolean;
137
- readonly indicate: boolean;
138
- readonly authenticatedSignedWrites: boolean;
139
- readonly reliableWrite?: boolean;
140
- readonly writableAuxiliaries?: boolean;
141
- readonly extendedProperties?: boolean;
142
- readonly notifyEncryptionRequired?: boolean;
143
- readonly indicateEncryptionRequired?: boolean;
144
- }
145
- export interface BleServices {
146
- services: BleService[];
147
- }
148
- export interface ReadOptions {
149
- deviceId: string;
150
- service: string;
151
- characteristic: string;
152
- }
153
- export interface ReadDescriptorOptions {
154
- deviceId: string;
155
- service: string;
156
- characteristic: string;
157
- descriptor: string;
158
- }
159
- export type Data = DataView | string;
160
- export interface WriteOptions {
161
- deviceId: string;
162
- service: string;
163
- characteristic: string;
164
- /**
165
- * android, ios: string
166
- * web: DataView
167
- */
168
- value: Data;
169
- }
170
- export interface WriteDescriptorOptions {
171
- deviceId: string;
172
- service: string;
173
- characteristic: string;
174
- descriptor: string;
175
- /**
176
- * android, ios: string
177
- * web: DataView
178
- */
179
- value: Data;
180
- }
181
- export interface BooleanResult {
182
- value: boolean;
183
- }
184
- export interface GetDevicesResult {
185
- devices: BleDevice[];
186
- }
187
- export interface GetMtuResult {
188
- value: number;
189
- }
190
- export interface ReadRssiResult {
191
- value: string;
192
- }
193
- export interface ReadResult {
194
- /**
195
- * android, ios: string
196
- * web: DataView
197
- */
198
- value?: Data;
199
- }
200
- export interface ScanResultInternal<T = Data> {
201
- device: BleDevice;
202
- localName?: string;
203
- rssi?: number;
204
- txPower?: number;
205
- manufacturerData?: {
206
- [key: string]: T;
207
- };
208
- serviceData?: {
209
- [key: string]: T;
210
- };
211
- uuids?: string[];
212
- rawAdvertisement?: T;
213
- }
214
- export interface ScanResult {
215
- /**
216
- * The peripheral device that was found in the scan.
217
- * **Android** and **web**: `device.name` is always identical to `localName`.
218
- * **iOS**: `device.name` is identical to `localName` the first time a device is discovered, but after connecting `device.name` is the cached GAP name in subsequent scans.
219
- */
220
- device: BleDevice;
221
- /**
222
- * The name of the peripheral device from the advertisement data.
223
- */
224
- localName?: string;
225
- /**
226
- * Received Signal Strength Indication.
227
- */
228
- rssi?: number;
229
- /**
230
- * Transmit power in dBm. A value of 127 indicates that it is not available.
231
- */
232
- txPower?: number;
233
- /**
234
- * Manufacturer data, key is a company identifier and value is the data.
235
- */
236
- manufacturerData?: {
237
- [key: string]: DataView;
238
- };
239
- /**
240
- * Service data, key is a service UUID and value is the data.
241
- */
242
- serviceData?: {
243
- [key: string]: DataView;
244
- };
245
- /**
246
- * Advertised services.
247
- */
248
- uuids?: string[];
249
- /**
250
- * Raw advertisement data (**Android** only).
251
- */
252
- rawAdvertisement?: DataView;
253
- }
254
- export interface BluetoothLePlugin {
255
- initialize(options?: InitializeOptions): Promise<void>;
256
- isEnabled(): Promise<BooleanResult>;
257
- requestEnable(): Promise<void>;
258
- enable(): Promise<void>;
259
- disable(): Promise<void>;
260
- startEnabledNotifications(): Promise<void>;
261
- stopEnabledNotifications(): Promise<void>;
262
- isLocationEnabled(): Promise<BooleanResult>;
263
- openLocationSettings(): Promise<void>;
264
- openBluetoothSettings(): Promise<void>;
265
- openAppSettings(): Promise<void>;
266
- setDisplayStrings(displayStrings: DisplayStrings): Promise<void>;
267
- requestDevice(options?: RequestBleDeviceOptions): Promise<BleDevice>;
268
- requestLEScan(options?: RequestBleDeviceOptions): Promise<void>;
269
- stopLEScan(): Promise<void>;
270
- getDevices(options: GetDevicesOptions): Promise<GetDevicesResult>;
271
- getConnectedDevices(options: GetConnectedDevicesOptions): Promise<GetDevicesResult>;
272
- getBondedDevices(): Promise<GetDevicesResult>;
273
- addListener(eventName: 'onEnabledChanged', listenerFunc: (result: BooleanResult) => void): Promise<PluginListenerHandle>;
274
- addListener(eventName: string, listenerFunc: (event: ReadResult) => void): Promise<PluginListenerHandle>;
275
- addListener(eventName: 'onScanResult', listenerFunc: (result: ScanResultInternal) => void): Promise<PluginListenerHandle>;
276
- connect(options: DeviceIdOptions & TimeoutOptions): Promise<void>;
277
- createBond(options: DeviceIdOptions & TimeoutOptions): Promise<void>;
278
- isBonded(options: DeviceIdOptions): Promise<BooleanResult>;
279
- disconnect(options: DeviceIdOptions): Promise<void>;
280
- getServices(options: DeviceIdOptions): Promise<BleServices>;
281
- discoverServices(options: DeviceIdOptions): Promise<void>;
282
- getMtu(options: DeviceIdOptions): Promise<GetMtuResult>;
283
- requestConnectionPriority(options: RequestConnectionPriorityOptions): Promise<void>;
284
- readRssi(options: DeviceIdOptions): Promise<ReadRssiResult>;
285
- read(options: ReadOptions & TimeoutOptions): Promise<ReadResult>;
286
- write(options: WriteOptions & TimeoutOptions): Promise<void>;
287
- writeWithoutResponse(options: WriteOptions & TimeoutOptions): Promise<void>;
288
- readDescriptor(options: ReadDescriptorOptions & TimeoutOptions): Promise<ReadResult>;
289
- writeDescriptor(options: WriteDescriptorOptions & TimeoutOptions): Promise<void>;
290
- startNotifications(options: ReadOptions): Promise<void>;
291
- stopNotifications(options: ReadOptions): Promise<void>;
292
- }
1
+ import type { PluginListenerHandle } from '@capacitor/core';
2
+ import type { DisplayStrings } from './config';
3
+ export interface InitializeOptions {
4
+ /**
5
+ * If your app doesn't use Bluetooth scan results to derive physical
6
+ * location information, you can strongly assert that your app
7
+ * doesn't derive physical location. (Android only)
8
+ * Requires adding 'neverForLocation' to AndroidManifest.xml
9
+ * https://developer.android.com/guide/topics/connectivity/bluetooth/permissions#assert-never-for-location
10
+ * @default false
11
+ */
12
+ androidNeverForLocation?: boolean;
13
+ }
14
+ export interface RequestBleDeviceOptions {
15
+ /**
16
+ * Filter devices by service UUIDs.
17
+ * UUIDs have to be specified as 128 bit UUID strings,
18
+ * e.g. ['0000180d-0000-1000-8000-00805f9b34fb']
19
+ * There is a helper function to convert numbers to UUIDs.
20
+ * e.g. [numberToUUID(0x180f)]. (see [UUID format](#uuid-format))
21
+ */
22
+ services?: string[];
23
+ /**
24
+ * Filter devices by name
25
+ */
26
+ name?: string;
27
+ /**
28
+ * Filter devices by name prefix
29
+ */
30
+ namePrefix?: string;
31
+ /**
32
+ * For **web**, all services that will be used have to be listed under services or optionalServices,
33
+ * e.g. [numberToUUID(0x180f)] (see [UUID format](#uuid-format))
34
+ */
35
+ optionalServices?: string[];
36
+ /**
37
+ * Normally scans will discard the second and subsequent advertisements from a single device.
38
+ * If you need to receive them, set allowDuplicates to true (only applicable in `requestLEScan`).
39
+ * (default: false)
40
+ */
41
+ allowDuplicates?: boolean;
42
+ /**
43
+ * Android scan mode (default: ScanMode.SCAN_MODE_BALANCED)
44
+ */
45
+ scanMode?: ScanMode;
46
+ /**
47
+ * Allow scanning for devices with a specific manufacturer data
48
+ * https://developer.mozilla.org/en-US/docs/Web/API/Bluetooth/requestDevice#manufacturerdata
49
+ */
50
+ manufacturerData?: {
51
+ companyIdentifier: number;
52
+ dataPrefix?: Uint8Array;
53
+ mask?: Uint8Array;
54
+ }[];
55
+ }
56
+ /**
57
+ * Android scan mode
58
+ */
59
+ export declare enum ScanMode {
60
+ /**
61
+ * Perform Bluetooth LE scan in low power mode. This mode is enforced if the scanning application is not in foreground.
62
+ * https://developer.android.com/reference/android/bluetooth/le/ScanSettings#SCAN_MODE_LOW_POWER
63
+ */
64
+ SCAN_MODE_LOW_POWER = 0,
65
+ /**
66
+ * Perform Bluetooth LE scan in balanced power mode. (default) Scan results are returned at a rate that provides a good trade-off between scan frequency and power consumption.
67
+ * https://developer.android.com/reference/android/bluetooth/le/ScanSettings#SCAN_MODE_BALANCED
68
+ */
69
+ SCAN_MODE_BALANCED = 1,
70
+ /**
71
+ * Scan using highest duty cycle. It's recommended to only use this mode when the application is running in the foreground.
72
+ * https://developer.android.com/reference/android/bluetooth/le/ScanSettings#SCAN_MODE_LOW_LATENCY
73
+ */
74
+ SCAN_MODE_LOW_LATENCY = 2
75
+ }
76
+ /**
77
+ * Android connection priority used in `requestConnectionPriority`
78
+ */
79
+ export declare enum ConnectionPriority {
80
+ /**
81
+ * Use the connection parameters recommended by the Bluetooth SIG. This is the default value if no connection parameter update is requested.
82
+ * https://developer.android.com/reference/android/bluetooth/BluetoothGatt#CONNECTION_PRIORITY_BALANCED
83
+ */
84
+ CONNECTION_PRIORITY_BALANCED = 0,
85
+ /**
86
+ * Request a high priority, low latency connection. An application should only request high priority connection parameters to transfer large amounts of data over LE quickly. Once the transfer is complete, the application should request CONNECTION_PRIORITY_BALANCED connection parameters to reduce energy use.
87
+ * https://developer.android.com/reference/android/bluetooth/BluetoothGatt#CONNECTION_PRIORITY_HIGH
88
+ */
89
+ CONNECTION_PRIORITY_HIGH = 1,
90
+ /**
91
+ * Request low power, reduced data rate connection parameters.
92
+ * https://developer.android.com/reference/android/bluetooth/BluetoothGatt#CONNECTION_PRIORITY_LOW_POWER
93
+ */
94
+ CONNECTION_PRIORITY_LOW_POWER = 2
95
+ }
96
+ export interface BleDevice {
97
+ /**
98
+ * ID of the device, which will be needed for further calls.
99
+ * On **Android** this is the BLE MAC address.
100
+ * On **iOS** and **web** it is an identifier.
101
+ */
102
+ deviceId: string;
103
+ /**
104
+ * Name of the peripheral device.
105
+ */
106
+ name?: string;
107
+ uuids?: string[];
108
+ }
109
+ export interface DeviceIdOptions {
110
+ deviceId: string;
111
+ }
112
+ export interface TimeoutOptions {
113
+ /**
114
+ * Timeout in milliseconds for plugin call.
115
+ * Default is 10000 for `connect` and 5000 for other plugin methods.
116
+ */
117
+ timeout?: number;
118
+ }
119
+ export interface RequestConnectionPriorityOptions extends DeviceIdOptions {
120
+ connectionPriority: ConnectionPriority;
121
+ }
122
+ export interface GetDevicesOptions {
123
+ deviceIds: string[];
124
+ }
125
+ export interface GetConnectedDevicesOptions {
126
+ services: string[];
127
+ }
128
+ export interface BleService {
129
+ readonly uuid: string;
130
+ readonly characteristics: BleCharacteristic[];
131
+ }
132
+ export interface BleDescriptor {
133
+ readonly uuid: string;
134
+ }
135
+ export interface BleCharacteristic {
136
+ readonly uuid: string;
137
+ readonly properties: BleCharacteristicProperties;
138
+ readonly descriptors: BleDescriptor[];
139
+ }
140
+ export interface BleCharacteristicProperties {
141
+ readonly broadcast: boolean;
142
+ readonly read: boolean;
143
+ readonly writeWithoutResponse: boolean;
144
+ readonly write: boolean;
145
+ readonly notify: boolean;
146
+ readonly indicate: boolean;
147
+ readonly authenticatedSignedWrites: boolean;
148
+ readonly reliableWrite?: boolean;
149
+ readonly writableAuxiliaries?: boolean;
150
+ readonly extendedProperties?: boolean;
151
+ readonly notifyEncryptionRequired?: boolean;
152
+ readonly indicateEncryptionRequired?: boolean;
153
+ }
154
+ export interface BleServices {
155
+ services: BleService[];
156
+ }
157
+ export interface ReadOptions {
158
+ deviceId: string;
159
+ service: string;
160
+ characteristic: string;
161
+ }
162
+ export interface ReadDescriptorOptions {
163
+ deviceId: string;
164
+ service: string;
165
+ characteristic: string;
166
+ descriptor: string;
167
+ }
168
+ export type Data = DataView | string;
169
+ export interface WriteOptions {
170
+ deviceId: string;
171
+ service: string;
172
+ characteristic: string;
173
+ /**
174
+ * android, ios: string
175
+ * web: DataView
176
+ */
177
+ value: Data;
178
+ }
179
+ export interface WriteDescriptorOptions {
180
+ deviceId: string;
181
+ service: string;
182
+ characteristic: string;
183
+ descriptor: string;
184
+ /**
185
+ * android, ios: string
186
+ * web: DataView
187
+ */
188
+ value: Data;
189
+ }
190
+ export interface BooleanResult {
191
+ value: boolean;
192
+ }
193
+ export interface GetDevicesResult {
194
+ devices: BleDevice[];
195
+ }
196
+ export interface GetMtuResult {
197
+ value: number;
198
+ }
199
+ export interface ReadRssiResult {
200
+ value: string;
201
+ }
202
+ export interface ReadResult {
203
+ /**
204
+ * android, ios: string
205
+ * web: DataView
206
+ */
207
+ value?: Data;
208
+ }
209
+ export interface ScanResultInternal<T = Data> {
210
+ device: BleDevice;
211
+ localName?: string;
212
+ rssi?: number;
213
+ txPower?: number;
214
+ manufacturerData?: {
215
+ [key: string]: T;
216
+ };
217
+ serviceData?: {
218
+ [key: string]: T;
219
+ };
220
+ uuids?: string[];
221
+ rawAdvertisement?: T;
222
+ }
223
+ export interface ScanResult {
224
+ /**
225
+ * The peripheral device that was found in the scan.
226
+ * **Android** and **web**: `device.name` is always identical to `localName`.
227
+ * **iOS**: `device.name` is identical to `localName` the first time a device is discovered, but after connecting `device.name` is the cached GAP name in subsequent scans.
228
+ */
229
+ device: BleDevice;
230
+ /**
231
+ * The name of the peripheral device from the advertisement data.
232
+ */
233
+ localName?: string;
234
+ /**
235
+ * Received Signal Strength Indication.
236
+ */
237
+ rssi?: number;
238
+ /**
239
+ * Transmit power in dBm. A value of 127 indicates that it is not available.
240
+ */
241
+ txPower?: number;
242
+ /**
243
+ * Manufacturer data, key is a company identifier and value is the data.
244
+ */
245
+ manufacturerData?: {
246
+ [key: string]: DataView;
247
+ };
248
+ /**
249
+ * Service data, key is a service UUID and value is the data.
250
+ */
251
+ serviceData?: {
252
+ [key: string]: DataView;
253
+ };
254
+ /**
255
+ * Advertised services.
256
+ */
257
+ uuids?: string[];
258
+ /**
259
+ * Raw advertisement data (**Android** only).
260
+ */
261
+ rawAdvertisement?: DataView;
262
+ }
263
+ export interface BluetoothLePlugin {
264
+ initialize(options?: InitializeOptions): Promise<void>;
265
+ isEnabled(): Promise<BooleanResult>;
266
+ requestEnable(): Promise<void>;
267
+ enable(): Promise<void>;
268
+ disable(): Promise<void>;
269
+ startEnabledNotifications(): Promise<void>;
270
+ stopEnabledNotifications(): Promise<void>;
271
+ isLocationEnabled(): Promise<BooleanResult>;
272
+ openLocationSettings(): Promise<void>;
273
+ openBluetoothSettings(): Promise<void>;
274
+ openAppSettings(): Promise<void>;
275
+ setDisplayStrings(displayStrings: DisplayStrings): Promise<void>;
276
+ requestDevice(options?: RequestBleDeviceOptions): Promise<BleDevice>;
277
+ requestLEScan(options?: RequestBleDeviceOptions): Promise<void>;
278
+ stopLEScan(): Promise<void>;
279
+ getDevices(options: GetDevicesOptions): Promise<GetDevicesResult>;
280
+ getConnectedDevices(options: GetConnectedDevicesOptions): Promise<GetDevicesResult>;
281
+ getBondedDevices(): Promise<GetDevicesResult>;
282
+ addListener(eventName: 'onEnabledChanged', listenerFunc: (result: BooleanResult) => void): Promise<PluginListenerHandle>;
283
+ addListener(eventName: string, listenerFunc: (event: ReadResult) => void): Promise<PluginListenerHandle>;
284
+ addListener(eventName: 'onScanResult', listenerFunc: (result: ScanResultInternal) => void): Promise<PluginListenerHandle>;
285
+ connect(options: DeviceIdOptions & TimeoutOptions): Promise<void>;
286
+ createBond(options: DeviceIdOptions & TimeoutOptions): Promise<void>;
287
+ isBonded(options: DeviceIdOptions): Promise<BooleanResult>;
288
+ disconnect(options: DeviceIdOptions): Promise<void>;
289
+ getServices(options: DeviceIdOptions): Promise<BleServices>;
290
+ discoverServices(options: DeviceIdOptions): Promise<void>;
291
+ getMtu(options: DeviceIdOptions): Promise<GetMtuResult>;
292
+ requestConnectionPriority(options: RequestConnectionPriorityOptions): Promise<void>;
293
+ readRssi(options: DeviceIdOptions): Promise<ReadRssiResult>;
294
+ read(options: ReadOptions & TimeoutOptions): Promise<ReadResult>;
295
+ write(options: WriteOptions & TimeoutOptions): Promise<void>;
296
+ writeWithoutResponse(options: WriteOptions & TimeoutOptions): Promise<void>;
297
+ readDescriptor(options: ReadDescriptorOptions & TimeoutOptions): Promise<ReadResult>;
298
+ writeDescriptor(options: WriteDescriptorOptions & TimeoutOptions): Promise<void>;
299
+ startNotifications(options: ReadOptions): Promise<void>;
300
+ stopNotifications(options: ReadOptions): Promise<void>;
301
+ }