react-native-ble-manager 12.4.2 → 12.4.4
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/android/src/main/java/it/innove/Peripheral.java +28 -9
- package/dist/cjs/index.d.ts +213 -72
- package/dist/cjs/index.js +202 -65
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types.d.ts +59 -65
- package/dist/cjs/types.js +11 -32
- package/dist/cjs/types.js.map +1 -1
- package/dist/esm/index.d.ts +213 -72
- package/dist/esm/index.js +202 -65
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types.d.ts +59 -65
- package/dist/esm/types.js +10 -31
- package/dist/esm/types.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +233 -87
- package/src/types.ts +59 -65
|
@@ -1099,15 +1099,34 @@ public class Peripheral extends BluetoothGattCallback {
|
|
|
1099
1099
|
writeCallbacks.addLast(callback);
|
|
1100
1100
|
}
|
|
1101
1101
|
return enqueue(() -> {
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1102
|
+
try {
|
|
1103
|
+
if (!isConnected() || gatt == null) {
|
|
1104
|
+
if (withResponse && callback != null) {
|
|
1105
|
+
if (writeCallbacks.removeLastOccurrence(callback)) {
|
|
1106
|
+
try {
|
|
1107
|
+
callback.invoke("Device is not connected", null);
|
|
1108
|
+
} catch (Exception callbackException) {
|
|
1109
|
+
Log.e(BleManager.LOG_TAG, "Error invoking write callback for disconnected device", callbackException);
|
|
1110
|
+
}
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
completedCommand();
|
|
1114
|
+
return;
|
|
1115
|
+
}
|
|
1116
|
+
doWrite(characteristic, copyOfData);
|
|
1117
|
+
} catch (Exception e) {
|
|
1118
|
+
Log.e(BleManager.LOG_TAG, "Error in enqueueWrite lambda", e);
|
|
1119
|
+
if (withResponse && callback != null) {
|
|
1120
|
+
if (writeCallbacks.removeLastOccurrence(callback)) {
|
|
1121
|
+
try {
|
|
1122
|
+
callback.invoke("Write failed: " + e.getMessage(), null);
|
|
1123
|
+
} catch (Exception callbackException) {
|
|
1124
|
+
Log.e(BleManager.LOG_TAG, "Error invoking write callback", callbackException);
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
completedCommand();
|
|
1129
|
+
}
|
|
1111
1130
|
});
|
|
1112
1131
|
}
|
|
1113
1132
|
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,108 +1,162 @@
|
|
|
1
1
|
import { EventSubscription } from 'react-native';
|
|
2
|
-
import { BleState, ConnectOptions, ConnectionPriority, CompanionScanOptions, Peripheral, PeripheralInfo, ScanOptions, StartOptions } from './types';
|
|
2
|
+
import { BleState, ConnectOptions, ConnectionPriority, CompanionScanOptions, Peripheral, PeripheralInfo, ScanOptions, StartOptions, EventCallback, BleConnectPeripheralEvent, BleDiscoverPeripheralEvent, BleStopScanEvent, BleManagerDidUpdateStateEvent, BleDisconnectPeripheralEvent, BleManagerDidUpdateValueForCharacteristicEvent, BleBondedPeripheralEvent, BleManagerCentralManagerWillRestoreState, BleManagerDidUpdateNotificationStateForEvent, BleManagerCompanionPeripheral } from './types';
|
|
3
3
|
export * from './types';
|
|
4
4
|
declare class BleManager {
|
|
5
5
|
constructor();
|
|
6
6
|
/**
|
|
7
|
+
* Read the current value of the specified characteristic, you need to call `retrieveServices` method before.
|
|
7
8
|
*
|
|
8
|
-
* @param peripheralId
|
|
9
|
-
* @param serviceUUID
|
|
10
|
-
* @param characteristicUUID
|
|
11
|
-
* @returns
|
|
9
|
+
* @param peripheralId The id/mac address of the peripheral.
|
|
10
|
+
* @param serviceUUID The UUID of the service.
|
|
11
|
+
* @param characteristicUUID The UUID of the characteristic.
|
|
12
|
+
* @returns Data as an array of numbers (which can be converted back to a Uint8Array (ByteArray) using something like [Buffer.from()](https://github.com/feross/buffer))
|
|
12
13
|
*/
|
|
13
14
|
read(peripheralId: string, serviceUUID: string, characteristicUUID: string): Promise<number[]>;
|
|
14
15
|
/**
|
|
16
|
+
* Read the current value of the specified descriptor, you need to call `retrieveServices` method before.
|
|
15
17
|
*
|
|
16
|
-
* @param peripheralId
|
|
17
|
-
* @param serviceUUID
|
|
18
|
-
* @param characteristicUUID
|
|
19
|
-
* @param descriptorUUID
|
|
18
|
+
* @param peripheralId The id/mac address of the peripheral.
|
|
19
|
+
* @param serviceUUID The UUID of the service.
|
|
20
|
+
* @param characteristicUUID The UUID of the characteristic.
|
|
21
|
+
* @param descriptorUUID The UUID of the descriptor.
|
|
20
22
|
* @returns data as an array of numbers (which can be converted back to a Uint8Array (ByteArray) using something like [Buffer.from()](https://github.com/feross/buffer))
|
|
21
23
|
*/
|
|
22
24
|
readDescriptor(peripheralId: string, serviceUUID: string, characteristicUUID: string, descriptorUUID: string): Promise<number[]>;
|
|
23
25
|
/**
|
|
26
|
+
* Write a value to the specified descriptor, you need to call `retrieveServices` method before.
|
|
24
27
|
*
|
|
25
|
-
* @param peripheralId
|
|
26
|
-
* @param serviceUUID
|
|
27
|
-
* @param characteristicUUID
|
|
28
|
-
* @param descriptorUUID
|
|
29
|
-
* @param data
|
|
28
|
+
* @param peripheralId The id/mac address of the peripheral.
|
|
29
|
+
* @param serviceUUID The UUID of the service.
|
|
30
|
+
* @param characteristicUUID The UUID of the characteristic.
|
|
31
|
+
* @param descriptorUUID The UUID of the descriptor.
|
|
32
|
+
* @param data Data to write as an array of numbers (which can be converted from a Uint8Array (ByteArray) using something like [Buffer.toJSON().data](https://github.com/feross/buffer))
|
|
30
33
|
* @returns
|
|
31
34
|
*/
|
|
32
35
|
writeDescriptor(peripheralId: string, serviceUUID: string, characteristicUUID: string, descriptorUUID: string, data: number[]): Promise<void>;
|
|
33
36
|
/**
|
|
37
|
+
* Read the current value of the RSSI.
|
|
34
38
|
*
|
|
35
|
-
* @param peripheralId
|
|
36
|
-
* @returns
|
|
39
|
+
* @param peripheralId The id/mac address of the peripheral.
|
|
40
|
+
* @returns A promise resolving with the updated RSSI (`number`) if it succeeds.
|
|
37
41
|
*/
|
|
38
42
|
readRSSI(peripheralId: string): Promise<number>;
|
|
39
43
|
/**
|
|
40
44
|
* [Android only]
|
|
41
|
-
*
|
|
42
|
-
*
|
|
45
|
+
*
|
|
46
|
+
* Refreshes the peripheral's services and characteristics cache.
|
|
47
|
+
*
|
|
48
|
+
* @param peripheralId The id/mac address of the peripheral.
|
|
49
|
+
* @returns A promise that resolves to a boolean indicating if gatt was successfully refreshed or not.
|
|
43
50
|
*/
|
|
44
51
|
refreshCache(peripheralId: string): Promise<boolean>;
|
|
45
52
|
/**
|
|
53
|
+
* Retrieve the peripheral's services and characteristics.
|
|
46
54
|
*
|
|
47
|
-
* @param peripheralId
|
|
48
|
-
* @param serviceUUIDs [iOS only]
|
|
55
|
+
* @param peripheralId The id/mac address of the peripheral.
|
|
56
|
+
* @param serviceUUIDs [iOS only] Optional filter of services to retrieve.
|
|
49
57
|
* @returns
|
|
50
58
|
*/
|
|
51
59
|
retrieveServices(peripheralId: string, serviceUUIDs?: string[]): Promise<PeripheralInfo>;
|
|
52
60
|
/**
|
|
61
|
+
* Write with response to the specified characteristic, you need to call `retrieveServices` method before.
|
|
53
62
|
*
|
|
54
|
-
* @param peripheralId
|
|
55
|
-
* @param serviceUUID
|
|
56
|
-
* @param characteristicUUID
|
|
57
|
-
* @param data
|
|
58
|
-
* @param maxByteSize
|
|
63
|
+
* @param peripheralId The id/mac address of the peripheral.
|
|
64
|
+
* @param serviceUUID The UUID of the service.
|
|
65
|
+
* @param characteristicUUID The UUID of the characteristic.
|
|
66
|
+
* @param data Data to write as an array of numbers (which can be converted from a Uint8Array (ByteArray) using something like [Buffer.toJSON().data](https://github.com/feross/buffer))
|
|
67
|
+
* @param maxByteSize Optional, defaults to 20
|
|
59
68
|
* @returns
|
|
60
69
|
*/
|
|
61
70
|
write(peripheralId: string, serviceUUID: string, characteristicUUID: string, data: number[], maxByteSize?: number): Promise<void>;
|
|
62
71
|
/**
|
|
72
|
+
* Write without response to the specified characteristic, you need to call `retrieveServices` method before.
|
|
63
73
|
*
|
|
64
|
-
* @param peripheralId
|
|
65
|
-
* @param serviceUUID
|
|
66
|
-
* @param characteristicUUID
|
|
67
|
-
* @param data
|
|
68
|
-
* @param maxByteSize
|
|
69
|
-
* @param queueSleepTime
|
|
74
|
+
* @param peripheralId The id/mac address of the peripheral.
|
|
75
|
+
* @param serviceUUID The UUID of the service.
|
|
76
|
+
* @param characteristicUUID The UUID of the characteristic.
|
|
77
|
+
* @param data Data to write as an array of numbers (which can be converted from a Uint8Array (ByteArray) using something like [Buffer.toJSON().data](https://github.com/feross/buffer))
|
|
78
|
+
* @param maxByteSize Optional, defaults to 20
|
|
79
|
+
* @param queueSleepTime Optional, defaults to 10. Only useful if data length is greater than maxByteSize.
|
|
70
80
|
* @returns
|
|
71
81
|
*/
|
|
72
82
|
writeWithoutResponse(peripheralId: string, serviceUUID: string, characteristicUUID: string, data: number[], maxByteSize?: number, queueSleepTime?: number): Promise<void>;
|
|
83
|
+
/**
|
|
84
|
+
* Attempts to connect to a peripheral. In many case if you can't connect you have to scan for the peripheral before.
|
|
85
|
+
*
|
|
86
|
+
* > In iOS, attempts to connect to a peripheral do not time out (please see [Apple's doc](https://developer.apple.com/documentation/corebluetooth/cbcentralmanager/1518766-connect)), so you might need to set a timer explicitly if you don't want this behavior.
|
|
87
|
+
*/
|
|
73
88
|
connect(peripheralId: string, options?: ConnectOptions): Promise<void>;
|
|
74
89
|
/**
|
|
75
90
|
* [Android only]
|
|
76
|
-
*
|
|
77
|
-
*
|
|
91
|
+
*
|
|
92
|
+
* Start the bonding (pairing) process with the remote device.
|
|
93
|
+
* If you pass peripheralPin (optional), bonding will be auto (without manually entering the pin).
|
|
94
|
+
* > Ensure to make one bond request at a time.
|
|
95
|
+
*
|
|
96
|
+
* @param peripheralId The id/mac address of the peripheral.
|
|
97
|
+
* @param peripheralPin Optional. will be used to auto-bond if possible.
|
|
78
98
|
* @returns
|
|
79
99
|
*/
|
|
80
100
|
createBond(peripheralId: string, peripheralPin?: string | null): Promise<void>;
|
|
81
101
|
/**
|
|
82
102
|
* [Android only]
|
|
83
|
-
*
|
|
103
|
+
*
|
|
104
|
+
* Remove a paired device.
|
|
105
|
+
*
|
|
106
|
+
* @param peripheralId The id/mac address of the peripheral
|
|
84
107
|
* @returns
|
|
85
108
|
*/
|
|
86
109
|
removeBond(peripheralId: string): Promise<void>;
|
|
87
110
|
/**
|
|
111
|
+
* Disconnect from a peripheral.
|
|
88
112
|
*
|
|
89
|
-
* @param peripheralId
|
|
90
|
-
* @param force [Android only]
|
|
113
|
+
* @param peripheralId The id/mac address of the peripheral to disconnect.
|
|
114
|
+
* @param force [Android only] Defaults to true. Don't wait for the disconnect state to close the Gatt client.
|
|
91
115
|
* @returns
|
|
92
116
|
*/
|
|
93
117
|
disconnect(peripheralId: string, force?: boolean): Promise<void>;
|
|
118
|
+
/**
|
|
119
|
+
* Start the notification on the specified characteristic, you need to call `retrieveServices` method before.
|
|
120
|
+
*
|
|
121
|
+
* Events will be send to `onDidUpdateValueForCharacteristic` when the peripheral notifies a new value for the characteristic.
|
|
122
|
+
*
|
|
123
|
+
* @param peripheralId The id/mac address of the peripheral.
|
|
124
|
+
* @param serviceUUID The UUID of the service.
|
|
125
|
+
* @param characteristicUUID The UUID of the characteristic.
|
|
126
|
+
* @returns
|
|
127
|
+
*/
|
|
94
128
|
startNotification(peripheralId: string, serviceUUID: string, characteristicUUID: string): Promise<void>;
|
|
95
129
|
/**
|
|
96
130
|
* [Android only]
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
131
|
+
*
|
|
132
|
+
* Start the notification on the specified characteristic, you need to call `retrieveServices` method before.
|
|
133
|
+
* The buffer collect messages until the buffer of messages bytes reaches the limit defined with the `buffer` argument and then emit all the collected data.
|
|
134
|
+
* Useful to reduce the number of calls between the native and the react-native part in case of many messages.
|
|
135
|
+
*
|
|
136
|
+
* @param peripheralId The id/mac address of the peripheral.
|
|
137
|
+
* @param serviceUUID The UUID of the service.
|
|
138
|
+
* @param characteristicUUID The UUID of the characteristic.
|
|
139
|
+
* @param buffer The capacity of the buffer (bytes) stored before emitting the data for the characteristic.
|
|
101
140
|
* @returns
|
|
102
141
|
*/
|
|
103
142
|
startNotificationWithBuffer(peripheralId: string, serviceUUID: string, characteristicUUID: string, buffer: number): Promise<void>;
|
|
143
|
+
/**
|
|
144
|
+
* Stop the notification on the specified characteristic.
|
|
145
|
+
*
|
|
146
|
+
* @param peripheralId The id/mac address of the peripheral.
|
|
147
|
+
* @param serviceUUID The UUID of the service.
|
|
148
|
+
* @param characteristicUUID The UUID of the characteristic.
|
|
149
|
+
* @returns
|
|
150
|
+
*/
|
|
104
151
|
stopNotification(peripheralId: string, serviceUUID: string, characteristicUUID: string): Promise<void>;
|
|
152
|
+
/**
|
|
153
|
+
* Force the module to check the state of the native BLE manager and trigger an event for `onDidUpdateState`.
|
|
154
|
+
* @returns A promise containing the current BleState
|
|
155
|
+
*/
|
|
105
156
|
checkState(): Promise<BleState>;
|
|
157
|
+
/**
|
|
158
|
+
* Init the module. Don't call this multiple times.
|
|
159
|
+
*/
|
|
106
160
|
start(options?: StartOptions): Promise<void>;
|
|
107
161
|
/**
|
|
108
162
|
* Check if the BLE manager has been started.
|
|
@@ -110,14 +164,19 @@ declare class BleManager {
|
|
|
110
164
|
*/
|
|
111
165
|
isStarted(): Promise<boolean>;
|
|
112
166
|
/**
|
|
167
|
+
* Scan for available peripherals.
|
|
113
168
|
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
169
|
+
* See `onDiscoverPeripheral` to get live updates of devices being discovered.
|
|
170
|
+
*
|
|
171
|
+
* See `getDiscoveredPeripherals` to get a list of discovered devices after a scan is completed.
|
|
172
|
+
*
|
|
173
|
+
* @param scanningOptions Optional map of properties to fine-tune scan behavior, see DOCS.
|
|
118
174
|
* @returns
|
|
119
175
|
*/
|
|
120
176
|
scan(scanningOptions?: ScanOptions): Promise<void>;
|
|
177
|
+
/**
|
|
178
|
+
* Stop the scanning.
|
|
179
|
+
*/
|
|
121
180
|
stopScan(): Promise<void>;
|
|
122
181
|
/**
|
|
123
182
|
* [Android only] triggers an ENABLE_REQUEST intent to the end-user to enable bluetooth.
|
|
@@ -125,57 +184,81 @@ declare class BleManager {
|
|
|
125
184
|
*/
|
|
126
185
|
enableBluetooth(): Promise<void>;
|
|
127
186
|
/**
|
|
187
|
+
* Return the connected peripherals.
|
|
188
|
+
*
|
|
189
|
+
* > In Android, Peripherals "advertising" property can be not set!
|
|
190
|
+
* > Will be available if peripheral was found through scan before connect.
|
|
191
|
+
* > This matches to current Android Bluetooth design specification.
|
|
128
192
|
*
|
|
129
|
-
* @param serviceUUIDs [
|
|
193
|
+
* @param serviceUUIDs [iOS only] Optional, only retrieve peripherals with these services. Ignored in Android.
|
|
130
194
|
* @returns
|
|
131
195
|
*/
|
|
132
196
|
getConnectedPeripherals(serviceUUIDs?: string[]): Promise<Peripheral[]>;
|
|
133
197
|
/**
|
|
134
198
|
* [Android only]
|
|
199
|
+
*
|
|
200
|
+
* Return the bonded peripherals.
|
|
201
|
+
*
|
|
135
202
|
* @returns
|
|
136
203
|
*/
|
|
137
204
|
getBondedPeripherals(): Promise<Peripheral[]>;
|
|
205
|
+
/**
|
|
206
|
+
* Return the discovered peripherals after a scan.
|
|
207
|
+
*/
|
|
138
208
|
getDiscoveredPeripherals(): Promise<Peripheral[]>;
|
|
139
209
|
/**
|
|
140
210
|
* [Android only]
|
|
141
|
-
*
|
|
211
|
+
*
|
|
212
|
+
* Removes a disconnected peripheral from the cached list.
|
|
213
|
+
* It is useful if the device is turned off, because it will be re-discovered upon turning on again.
|
|
214
|
+
*
|
|
215
|
+
* @param peripheralId The id/mac address of the peripheral.
|
|
142
216
|
* @returns
|
|
143
217
|
*/
|
|
144
218
|
removePeripheral(peripheralId: string): Promise<void>;
|
|
145
219
|
/**
|
|
146
|
-
*
|
|
147
|
-
*
|
|
220
|
+
* Check whether a specific peripheral is connected and return `true` or `false`.
|
|
221
|
+
*
|
|
222
|
+
* @param peripheralId The id/mac address of the peripheral.
|
|
223
|
+
* @param serviceUUIDs [iOS only] Optional, only retrieve peripherals with these services. Ignored in Android.
|
|
148
224
|
* @returns
|
|
149
225
|
*/
|
|
150
226
|
isPeripheralConnected(peripheralId: string, serviceUUIDs?: string[]): Promise<boolean>;
|
|
151
227
|
/**
|
|
152
|
-
*
|
|
153
|
-
* @param serviceUUIDs [optional] not used on android, optional on ios.
|
|
228
|
+
* Checks whether the scan is in progress and return `true` or `false`.
|
|
154
229
|
* @returns
|
|
155
230
|
*/
|
|
156
231
|
isScanning(): Promise<boolean>;
|
|
157
232
|
/**
|
|
158
233
|
* [Android only, API 21+]
|
|
159
|
-
* @param peripheralId
|
|
160
|
-
* @param connectionPriority
|
|
161
|
-
* @returns
|
|
234
|
+
* @param peripheralId The id/mac address of the peripheral.
|
|
235
|
+
* @param connectionPriority The connection priority to be requested
|
|
236
|
+
* @returns A promise that resolves with a boolean indicating of the connection priority was changed successfully, or rejects with an error message.
|
|
162
237
|
*/
|
|
163
238
|
requestConnectionPriority(peripheralId: string, connectionPriority: ConnectionPriority): Promise<boolean>;
|
|
164
239
|
/**
|
|
165
240
|
* [Android only, API 21+]
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
241
|
+
*
|
|
242
|
+
* Request an MTU size used for a given connection.
|
|
243
|
+
*
|
|
244
|
+
* @param peripheralId The id/mac address of the peripheral.
|
|
245
|
+
* @param mtu Size to be requested, in bytes.
|
|
246
|
+
* @returns A promise resolving with the negotiated MTU if it succeeded. Beware that it might not be the one requested due to device's BLE limitations on both side of the negotiation.
|
|
169
247
|
*/
|
|
170
248
|
requestMTU(peripheralId: string, mtu: number): Promise<number>;
|
|
171
249
|
/**
|
|
172
250
|
* [Android only, API 26+]
|
|
173
251
|
*
|
|
252
|
+
* Retrieve associated peripherals (from companion manager).
|
|
253
|
+
*
|
|
174
254
|
* @returns
|
|
175
255
|
*/
|
|
176
256
|
getAssociatedPeripherals(): Promise<Peripheral[]>;
|
|
177
257
|
/**
|
|
178
258
|
* [Android only, API 26+]
|
|
259
|
+
*
|
|
260
|
+
* Remove an associated peripheral.
|
|
261
|
+
*
|
|
179
262
|
* @param peripheralId Peripheral to remove
|
|
180
263
|
* @returns Promise that resolves once the peripheral has been removed. Rejects
|
|
181
264
|
* if no association is found.
|
|
@@ -184,7 +267,7 @@ declare class BleManager {
|
|
|
184
267
|
/**
|
|
185
268
|
* [Android only]
|
|
186
269
|
*
|
|
187
|
-
* Check if current device supports companion device manager.
|
|
270
|
+
* Check if current device supports the companion device manager.
|
|
188
271
|
*
|
|
189
272
|
* @return Promise resolving to a boolean.
|
|
190
273
|
*/
|
|
@@ -192,38 +275,96 @@ declare class BleManager {
|
|
|
192
275
|
/**
|
|
193
276
|
* [Android only, API 26+]
|
|
194
277
|
*
|
|
195
|
-
*
|
|
278
|
+
* Scan for companion devices.
|
|
279
|
+
*
|
|
280
|
+
* Rejects if the companion device manager is not supported on this device.
|
|
281
|
+
*
|
|
282
|
+
* The promise it will eventually resolve with either:
|
|
283
|
+
*
|
|
284
|
+
* 1. peripheral if user selects one
|
|
285
|
+
* 2. null if user "cancels" (i.e. doesn't select anything)
|
|
286
|
+
*
|
|
287
|
+
* See `BleManager.supportsCompanion`.
|
|
288
|
+
*
|
|
289
|
+
* See: https://developer.android.com/develop/connectivity/bluetooth/companion-device-pairing
|
|
290
|
+
*
|
|
291
|
+
* @param serviceUUIDs List of service UUIDs to use as a filter
|
|
196
292
|
*/
|
|
197
293
|
companionScan(serviceUUIDs: string[], options?: CompanionScanOptions): Promise<Peripheral | null>;
|
|
198
294
|
/**
|
|
199
295
|
* [Android only]
|
|
296
|
+
*
|
|
297
|
+
* Create the request to set the name of the bluetooth adapter. (https://developer.android.com/reference/android/bluetooth/BluetoothAdapter#setName(java.lang.String))
|
|
298
|
+
*
|
|
200
299
|
* @param name
|
|
201
300
|
*/
|
|
202
301
|
setName(name: string): void;
|
|
203
302
|
/**
|
|
204
303
|
* [iOS only]
|
|
205
|
-
* @param peripheralId
|
|
304
|
+
* @param peripheralId The id/mac address of the peripheral.
|
|
206
305
|
* @returns
|
|
207
306
|
*/
|
|
208
307
|
getMaximumWriteValueLengthForWithoutResponse(peripheralId: string): Promise<number>;
|
|
209
308
|
/**
|
|
210
309
|
* [iOS only]
|
|
211
|
-
* @param peripheralId
|
|
310
|
+
* @param peripheralId The id/mac address of the peripheral.
|
|
212
311
|
* @returns
|
|
213
312
|
*/
|
|
214
313
|
getMaximumWriteValueLengthForWithResponse(peripheralId: string): Promise<number>;
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
314
|
+
/**
|
|
315
|
+
* The scanning found a new peripheral.
|
|
316
|
+
*/
|
|
317
|
+
onDiscoverPeripheral(callback: EventCallback<BleDiscoverPeripheralEvent>): EventSubscription;
|
|
318
|
+
/**
|
|
319
|
+
* The scanning for peripherals is ended.
|
|
320
|
+
*/
|
|
321
|
+
onStopScan(callback: EventCallback<BleStopScanEvent>): EventSubscription;
|
|
322
|
+
/**
|
|
323
|
+
* The BLE state changed.
|
|
324
|
+
*/
|
|
325
|
+
onDidUpdateState(callback: EventCallback<BleManagerDidUpdateStateEvent>): EventSubscription;
|
|
326
|
+
/**
|
|
327
|
+
* A peripheral was connected.
|
|
328
|
+
*/
|
|
329
|
+
onConnectPeripheral(callback: EventCallback<BleConnectPeripheralEvent>): EventSubscription;
|
|
330
|
+
/**
|
|
331
|
+
* A peripheral was disconnected.
|
|
332
|
+
*/
|
|
333
|
+
onDisconnectPeripheral(callback: EventCallback<BleDisconnectPeripheralEvent>): EventSubscription;
|
|
334
|
+
/**
|
|
335
|
+
* A characteristic notified a new value.
|
|
336
|
+
*
|
|
337
|
+
* > Event will only be emitted after successful `startNotification`.
|
|
338
|
+
*/
|
|
339
|
+
onDidUpdateValueForCharacteristic(callback: EventCallback<BleManagerDidUpdateValueForCharacteristicEvent>): EventSubscription;
|
|
340
|
+
/**
|
|
341
|
+
* A bond with a peripheral was established.
|
|
342
|
+
*/
|
|
343
|
+
onPeripheralDidBond(callback: EventCallback<BleBondedPeripheralEvent>): EventSubscription;
|
|
344
|
+
/**
|
|
345
|
+
* [iOS only]
|
|
346
|
+
*
|
|
347
|
+
* This is fired when [`centralManager:WillRestoreState:`](https://developer.apple.com/documentation/corebluetooth/cbcentralmanagerdelegate/1518819-centralmanager) is called (app relaunched in the background to handle a bluetooth event).
|
|
348
|
+
*
|
|
349
|
+
* _For more on performing long-term bluetooth actions in the background:_
|
|
350
|
+
*
|
|
351
|
+
* [iOS Bluetooth State Preservation and Restoration](https://developer.apple.com/library/archive/documentation/NetworkingInternetWeb/Conceptual/CoreBluetooth_concepts/CoreBluetoothBackgroundProcessingForIOSApps/PerformingTasksWhileYourAppIsInTheBackground.html#//apple_ref/doc/uid/TP40013257-CH7-SW10)
|
|
352
|
+
*
|
|
353
|
+
* [iOS Relaunch Conditions](https://developer.apple.com/documentation/technotes/tn3115-bluetooth-state-restoration-app-relaunch-rules/)
|
|
354
|
+
*/
|
|
355
|
+
onCentralManagerWillRestoreState(callback: EventCallback<BleManagerCentralManagerWillRestoreState>): EventSubscription;
|
|
356
|
+
/**
|
|
357
|
+
* [iOS only]
|
|
358
|
+
*
|
|
359
|
+
* The peripheral received a request to start or stop providing notifications for a specified characteristic's value.
|
|
360
|
+
*/
|
|
361
|
+
onDidUpdateNotificationStateFor(callback: EventCallback<BleManagerDidUpdateNotificationStateForEvent>): EventSubscription;
|
|
362
|
+
/**
|
|
363
|
+
* User picked a device to associate with.
|
|
364
|
+
*
|
|
365
|
+
* Null if the request was cancelled by the user.
|
|
366
|
+
*/
|
|
367
|
+
onCompanionPeripheral(callback: EventCallback<BleManagerCompanionPeripheral>): EventSubscription;
|
|
227
368
|
}
|
|
228
369
|
declare const _default: BleManager;
|
|
229
370
|
export default _default;
|