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/src/index.ts CHANGED
@@ -12,6 +12,17 @@ import {
12
12
  PeripheralInfo,
13
13
  ScanOptions,
14
14
  StartOptions,
15
+ EventCallback,
16
+ BleConnectPeripheralEvent,
17
+ BleDiscoverPeripheralEvent,
18
+ BleStopScanEvent,
19
+ BleManagerDidUpdateStateEvent,
20
+ BleDisconnectPeripheralEvent,
21
+ BleManagerDidUpdateValueForCharacteristicEvent,
22
+ BleBondedPeripheralEvent,
23
+ BleManagerCentralManagerWillRestoreState,
24
+ BleManagerDidUpdateNotificationStateForEvent,
25
+ BleManagerCompanionPeripheral,
15
26
  } from './types';
16
27
  import { CallbackError } from './NativeBleManager';
17
28
  export * from './types';
@@ -32,11 +43,12 @@ class BleManager {
32
43
  }
33
44
 
34
45
  /**
35
- *
36
- * @param peripheralId
37
- * @param serviceUUID
38
- * @param characteristicUUID
39
- * @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))
46
+ * Read the current value of the specified characteristic, you need to call `retrieveServices` method before.
47
+ *
48
+ * @param peripheralId The id/mac address of the peripheral.
49
+ * @param serviceUUID The UUID of the service.
50
+ * @param characteristicUUID The UUID of the characteristic.
51
+ * @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))
40
52
  */
41
53
  read(peripheralId: string, serviceUUID: string, characteristicUUID: string) {
42
54
  return new Promise<number[]>((fulfill, reject) => {
@@ -56,11 +68,12 @@ class BleManager {
56
68
  }
57
69
 
58
70
  /**
59
- *
60
- * @param peripheralId
61
- * @param serviceUUID
62
- * @param characteristicUUID
63
- * @param descriptorUUID
71
+ * Read the current value of the specified descriptor, you need to call `retrieveServices` method before.
72
+ *
73
+ * @param peripheralId The id/mac address of the peripheral.
74
+ * @param serviceUUID The UUID of the service.
75
+ * @param characteristicUUID The UUID of the characteristic.
76
+ * @param descriptorUUID The UUID of the descriptor.
64
77
  * @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))
65
78
  */
66
79
  readDescriptor(
@@ -87,12 +100,13 @@ class BleManager {
87
100
  }
88
101
 
89
102
  /**
90
- *
91
- * @param peripheralId
92
- * @param serviceUUID
93
- * @param characteristicUUID
94
- * @param descriptorUUID
95
- * @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))
103
+ * Write a value to the specified descriptor, you need to call `retrieveServices` method before.
104
+ *
105
+ * @param peripheralId The id/mac address of the peripheral.
106
+ * @param serviceUUID The UUID of the service.
107
+ * @param characteristicUUID The UUID of the characteristic.
108
+ * @param descriptorUUID The UUID of the descriptor.
109
+ * @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))
96
110
  * @returns
97
111
  */
98
112
  writeDescriptor(
@@ -121,9 +135,10 @@ class BleManager {
121
135
  }
122
136
 
123
137
  /**
124
- *
125
- * @param peripheralId
126
- * @returns a promise resolving with the updated RSSI (`number`) if it succeeds.
138
+ * Read the current value of the RSSI.
139
+ *
140
+ * @param peripheralId The id/mac address of the peripheral.
141
+ * @returns A promise resolving with the updated RSSI (`number`) if it succeeds.
127
142
  */
128
143
  readRSSI(peripheralId: string) {
129
144
  return new Promise<number>((fulfill, reject) => {
@@ -142,8 +157,11 @@ class BleManager {
142
157
 
143
158
  /**
144
159
  * [Android only]
145
- * @param peripheralId
146
- * @returns a promise that resolves to a boolean indicating if gatt was successfully refreshed or not.
160
+ *
161
+ * Refreshes the peripheral's services and characteristics cache.
162
+ *
163
+ * @param peripheralId The id/mac address of the peripheral.
164
+ * @returns A promise that resolves to a boolean indicating if gatt was successfully refreshed or not.
147
165
  */
148
166
  refreshCache(peripheralId: string) {
149
167
  return new Promise<boolean>((fulfill, reject) => {
@@ -161,9 +179,10 @@ class BleManager {
161
179
  }
162
180
 
163
181
  /**
164
- *
165
- * @param peripheralId
166
- * @param serviceUUIDs [iOS only] optional filter of services to retrieve.
182
+ * Retrieve the peripheral's services and characteristics.
183
+ *
184
+ * @param peripheralId The id/mac address of the peripheral.
185
+ * @param serviceUUIDs [iOS only] Optional filter of services to retrieve.
167
186
  * @returns
168
187
  */
169
188
  retrieveServices(peripheralId: string, serviceUUIDs: string[] = []) {
@@ -183,12 +202,13 @@ class BleManager {
183
202
  }
184
203
 
185
204
  /**
186
- *
187
- * @param peripheralId
188
- * @param serviceUUID
189
- * @param characteristicUUID
190
- * @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))
191
- * @param maxByteSize optional, defaults to 20
205
+ * Write with response to the specified characteristic, you need to call `retrieveServices` method before.
206
+ *
207
+ * @param peripheralId The id/mac address of the peripheral.
208
+ * @param serviceUUID The UUID of the service.
209
+ * @param characteristicUUID The UUID of the characteristic.
210
+ * @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))
211
+ * @param maxByteSize Optional, defaults to 20
192
212
  * @returns
193
213
  */
194
214
  write(
@@ -217,13 +237,14 @@ class BleManager {
217
237
  }
218
238
 
219
239
  /**
220
- *
221
- * @param peripheralId
222
- * @param serviceUUID
223
- * @param characteristicUUID
224
- * @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))
225
- * @param maxByteSize optional, defaults to 20
226
- * @param queueSleepTime optional, defaults to 10. Only useful if data length is greater than maxByteSize.
240
+ * Write without response to the specified characteristic, you need to call `retrieveServices` method before.
241
+ *
242
+ * @param peripheralId The id/mac address of the peripheral.
243
+ * @param serviceUUID The UUID of the service.
244
+ * @param characteristicUUID The UUID of the characteristic.
245
+ * @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))
246
+ * @param maxByteSize Optional, defaults to 20
247
+ * @param queueSleepTime Optional, defaults to 10. Only useful if data length is greater than maxByteSize.
227
248
  * @returns
228
249
  */
229
250
  writeWithoutResponse(
@@ -253,6 +274,11 @@ class BleManager {
253
274
  });
254
275
  }
255
276
 
277
+ /**
278
+ * Attempts to connect to a peripheral. In many case if you can't connect you have to scan for the peripheral before.
279
+ *
280
+ * > 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.
281
+ */
256
282
  connect(peripheralId: string, options?: ConnectOptions) {
257
283
  return new Promise<void>((fulfill, reject) => {
258
284
  if (!options) {
@@ -274,8 +300,13 @@ class BleManager {
274
300
 
275
301
  /**
276
302
  * [Android only]
277
- * @param peripheralId
278
- * @param peripheralPin optional. will be used to auto-bond if possible.
303
+ *
304
+ * Start the bonding (pairing) process with the remote device.
305
+ * If you pass peripheralPin (optional), bonding will be auto (without manually entering the pin).
306
+ * > Ensure to make one bond request at a time.
307
+ *
308
+ * @param peripheralId The id/mac address of the peripheral.
309
+ * @param peripheralPin Optional. will be used to auto-bond if possible.
279
310
  * @returns
280
311
  */
281
312
  createBond(peripheralId: string, peripheralPin: string | null = null) {
@@ -296,7 +327,10 @@ class BleManager {
296
327
 
297
328
  /**
298
329
  * [Android only]
299
- * @param peripheralId
330
+ *
331
+ * Remove a paired device.
332
+ *
333
+ * @param peripheralId The id/mac address of the peripheral
300
334
  * @returns
301
335
  */
302
336
  removeBond(peripheralId: string) {
@@ -312,9 +346,10 @@ class BleManager {
312
346
  }
313
347
 
314
348
  /**
315
- *
316
- * @param peripheralId
317
- * @param force [Android only] defaults to true.
349
+ * Disconnect from a peripheral.
350
+ *
351
+ * @param peripheralId The id/mac address of the peripheral to disconnect.
352
+ * @param force [Android only] Defaults to true. Don't wait for the disconnect state to close the Gatt client.
318
353
  * @returns
319
354
  */
320
355
  disconnect(peripheralId: string, force: boolean = true) {
@@ -333,6 +368,16 @@ class BleManager {
333
368
  });
334
369
  }
335
370
 
371
+ /**
372
+ * Start the notification on the specified characteristic, you need to call `retrieveServices` method before.
373
+ *
374
+ * Events will be send to `onDidUpdateValueForCharacteristic` when the peripheral notifies a new value for the characteristic.
375
+ *
376
+ * @param peripheralId The id/mac address of the peripheral.
377
+ * @param serviceUUID The UUID of the service.
378
+ * @param characteristicUUID The UUID of the characteristic.
379
+ * @returns
380
+ */
336
381
  startNotification(
337
382
  peripheralId: string,
338
383
  serviceUUID: string,
@@ -356,10 +401,15 @@ class BleManager {
356
401
 
357
402
  /**
358
403
  * [Android only]
359
- * @param peripheralId
360
- * @param serviceUUID
361
- * @param characteristicUUID
362
- * @param buffer
404
+ *
405
+ * Start the notification on the specified characteristic, you need to call `retrieveServices` method before.
406
+ * 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.
407
+ * Useful to reduce the number of calls between the native and the react-native part in case of many messages.
408
+ *
409
+ * @param peripheralId The id/mac address of the peripheral.
410
+ * @param serviceUUID The UUID of the service.
411
+ * @param characteristicUUID The UUID of the characteristic.
412
+ * @param buffer The capacity of the buffer (bytes) stored before emitting the data for the characteristic.
363
413
  * @returns
364
414
  */
365
415
  startNotificationWithBuffer(
@@ -385,6 +435,14 @@ class BleManager {
385
435
  });
386
436
  }
387
437
 
438
+ /**
439
+ * Stop the notification on the specified characteristic.
440
+ *
441
+ * @param peripheralId The id/mac address of the peripheral.
442
+ * @param serviceUUID The UUID of the service.
443
+ * @param characteristicUUID The UUID of the characteristic.
444
+ * @returns
445
+ */
388
446
  stopNotification(
389
447
  peripheralId: string,
390
448
  serviceUUID: string,
@@ -406,6 +464,10 @@ class BleManager {
406
464
  });
407
465
  }
408
466
 
467
+ /**
468
+ * Force the module to check the state of the native BLE manager and trigger an event for `onDidUpdateState`.
469
+ * @returns A promise containing the current BleState
470
+ */
409
471
  checkState() {
410
472
  return new Promise<BleState>((fulfill, _) => {
411
473
  BleManagerModule.checkState((state: BleState) => {
@@ -414,6 +476,9 @@ class BleManager {
414
476
  });
415
477
  }
416
478
 
479
+ /**
480
+ * Init the module. Don't call this multiple times.
481
+ */
417
482
  start(options?: StartOptions) {
418
483
  return new Promise<void>((fulfill, reject) => {
419
484
  if (options == null) {
@@ -446,11 +511,13 @@ class BleManager {
446
511
  }
447
512
 
448
513
  /**
449
- *
450
- * @param serviceUUIDs
451
- * @param seconds amount of seconds to scan. if set to 0 or less, will scan until you call stopScan() or the OS stops the scan (background etc).
452
- * @param allowDuplicates [iOS only]
453
- * @param scanningOptions optional map of properties to fine-tune scan behavior, see DOCS.
514
+ * Scan for available peripherals.
515
+ *
516
+ * See `onDiscoverPeripheral` to get live updates of devices being discovered.
517
+ *
518
+ * See `getDiscoveredPeripherals` to get a list of discovered devices after a scan is completed.
519
+ *
520
+ * @param scanningOptions Optional map of properties to fine-tune scan behavior, see DOCS.
454
521
  * @returns
455
522
  */
456
523
  scan(scanningOptions: ScanOptions = {}) {
@@ -516,6 +583,9 @@ class BleManager {
516
583
  });
517
584
  }
518
585
 
586
+ /**
587
+ * Stop the scanning.
588
+ */
519
589
  stopScan() {
520
590
  return new Promise<void>((fulfill, reject) => {
521
591
  BleManagerModule.stopScan((error: string | null) => {
@@ -545,8 +615,13 @@ class BleManager {
545
615
  }
546
616
 
547
617
  /**
548
- *
549
- * @param serviceUUIDs [optional] not used on android, optional on ios.
618
+ * Return the connected peripherals.
619
+ *
620
+ * > In Android, Peripherals "advertising" property can be not set!
621
+ * > Will be available if peripheral was found through scan before connect.
622
+ * > This matches to current Android Bluetooth design specification.
623
+ *
624
+ * @param serviceUUIDs [iOS only] Optional, only retrieve peripherals with these services. Ignored in Android.
550
625
  * @returns
551
626
  */
552
627
  getConnectedPeripherals(serviceUUIDs: string[] = []) {
@@ -570,6 +645,9 @@ class BleManager {
570
645
 
571
646
  /**
572
647
  * [Android only]
648
+ *
649
+ * Return the bonded peripherals.
650
+ *
573
651
  * @returns
574
652
  */
575
653
  getBondedPeripherals() {
@@ -590,6 +668,9 @@ class BleManager {
590
668
  });
591
669
  }
592
670
 
671
+ /**
672
+ * Return the discovered peripherals after a scan.
673
+ */
593
674
  getDiscoveredPeripherals() {
594
675
  return new Promise<Peripheral[]>((fulfill, reject) => {
595
676
  BleManagerModule.getDiscoveredPeripherals(
@@ -610,7 +691,11 @@ class BleManager {
610
691
 
611
692
  /**
612
693
  * [Android only]
613
- * @param peripheralId
694
+ *
695
+ * Removes a disconnected peripheral from the cached list.
696
+ * It is useful if the device is turned off, because it will be re-discovered upon turning on again.
697
+ *
698
+ * @param peripheralId The id/mac address of the peripheral.
614
699
  * @returns
615
700
  */
616
701
  removePeripheral(peripheralId: string) {
@@ -629,8 +714,10 @@ class BleManager {
629
714
  }
630
715
 
631
716
  /**
632
- * @param peripheralId
633
- * @param serviceUUIDs [optional] not used on android, optional on ios.
717
+ * Check whether a specific peripheral is connected and return `true` or `false`.
718
+ *
719
+ * @param peripheralId The id/mac address of the peripheral.
720
+ * @param serviceUUIDs [iOS only] Optional, only retrieve peripherals with these services. Ignored in Android.
634
721
  * @returns
635
722
  */
636
723
  isPeripheralConnected(peripheralId: string, serviceUUIDs: string[] = []) {
@@ -644,8 +731,7 @@ class BleManager {
644
731
  }
645
732
 
646
733
  /**
647
- * @param peripheralId
648
- * @param serviceUUIDs [optional] not used on android, optional on ios.
734
+ * Checks whether the scan is in progress and return `true` or `false`.
649
735
  * @returns
650
736
  */
651
737
  isScanning() {
@@ -662,9 +748,9 @@ class BleManager {
662
748
 
663
749
  /**
664
750
  * [Android only, API 21+]
665
- * @param peripheralId
666
- * @param connectionPriority
667
- * @returns a promise that resolves with a boolean indicating of the connection priority was changed successfully, or rejects with an error message.
751
+ * @param peripheralId The id/mac address of the peripheral.
752
+ * @param connectionPriority The connection priority to be requested
753
+ * @returns A promise that resolves with a boolean indicating of the connection priority was changed successfully, or rejects with an error message.
668
754
  */
669
755
  requestConnectionPriority(
670
756
  peripheralId: string,
@@ -687,9 +773,12 @@ class BleManager {
687
773
 
688
774
  /**
689
775
  * [Android only, API 21+]
690
- * @param peripheralId
691
- * @param mtu size to be requested, in bytes.
692
- * @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.
776
+ *
777
+ * Request an MTU size used for a given connection.
778
+ *
779
+ * @param peripheralId The id/mac address of the peripheral.
780
+ * @param mtu Size to be requested, in bytes.
781
+ * @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.
693
782
  */
694
783
  requestMTU(peripheralId: string, mtu: number) {
695
784
  return new Promise<number>((fulfill, reject) => {
@@ -709,6 +798,8 @@ class BleManager {
709
798
 
710
799
  /**
711
800
  * [Android only, API 26+]
801
+ *
802
+ * Retrieve associated peripherals (from companion manager).
712
803
  *
713
804
  * @returns
714
805
  */
@@ -728,6 +819,9 @@ class BleManager {
728
819
 
729
820
  /**
730
821
  * [Android only, API 26+]
822
+ *
823
+ * Remove an associated peripheral.
824
+ *
731
825
  * @param peripheralId Peripheral to remove
732
826
  * @returns Promise that resolves once the peripheral has been removed. Rejects
733
827
  * if no association is found.
@@ -750,7 +844,7 @@ class BleManager {
750
844
  /**
751
845
  * [Android only]
752
846
  *
753
- * Check if current device supports companion device manager.
847
+ * Check if current device supports the companion device manager.
754
848
  *
755
849
  * @return Promise resolving to a boolean.
756
850
  */
@@ -765,7 +859,20 @@ class BleManager {
765
859
  /**
766
860
  * [Android only, API 26+]
767
861
  *
768
- * Start companion scan.
862
+ * Scan for companion devices.
863
+ *
864
+ * Rejects if the companion device manager is not supported on this device.
865
+ *
866
+ * The promise it will eventually resolve with either:
867
+ *
868
+ * 1. peripheral if user selects one
869
+ * 2. null if user "cancels" (i.e. doesn't select anything)
870
+ *
871
+ * See `BleManager.supportsCompanion`.
872
+ *
873
+ * See: https://developer.android.com/develop/connectivity/bluetooth/companion-device-pairing
874
+ *
875
+ * @param serviceUUIDs List of service UUIDs to use as a filter
769
876
  */
770
877
  companionScan(serviceUUIDs: string[], options: CompanionScanOptions = {}) {
771
878
  return new Promise<Peripheral | null>((fulfill, reject) => {
@@ -785,6 +892,9 @@ class BleManager {
785
892
 
786
893
  /**
787
894
  * [Android only]
895
+ *
896
+ * Create the request to set the name of the bluetooth adapter. (https://developer.android.com/reference/android/bluetooth/BluetoothAdapter#setName(java.lang.String))
897
+ *
788
898
  * @param name
789
899
  */
790
900
  setName(name: string) {
@@ -793,7 +903,7 @@ class BleManager {
793
903
 
794
904
  /**
795
905
  * [iOS only]
796
- * @param peripheralId
906
+ * @param peripheralId The id/mac address of the peripheral.
797
907
  * @returns
798
908
  */
799
909
  getMaximumWriteValueLengthForWithoutResponse(peripheralId: string) {
@@ -813,7 +923,7 @@ class BleManager {
813
923
 
814
924
  /**
815
925
  * [iOS only]
816
- * @param peripheralId
926
+ * @param peripheralId The id/mac address of the peripheral.
817
927
  * @returns
818
928
  */
819
929
  getMaximumWriteValueLengthForWithResponse(peripheralId: string) {
@@ -831,53 +941,89 @@ class BleManager {
831
941
  });
832
942
  }
833
943
 
834
- onDiscoverPeripheral(callback: any): EventSubscription {
944
+ /**
945
+ * The scanning found a new peripheral.
946
+ */
947
+ onDiscoverPeripheral(callback: EventCallback<BleDiscoverPeripheralEvent>): EventSubscription {
835
948
  return BleManagerModule.onDiscoverPeripheral(callback);
836
949
  }
837
950
 
838
- onStopScan(callback: any): EventSubscription {
951
+ /**
952
+ * The scanning for peripherals is ended.
953
+ */
954
+ onStopScan(callback: EventCallback<BleStopScanEvent>): EventSubscription {
839
955
  return BleManagerModule.onStopScan(callback);
840
956
  }
841
957
 
842
- onDidUpdateState(callback: any): EventSubscription {
958
+ /**
959
+ * The BLE state changed.
960
+ */
961
+ onDidUpdateState(callback: EventCallback<BleManagerDidUpdateStateEvent>): EventSubscription {
843
962
  return BleManagerModule.onDidUpdateState(callback);
844
963
  }
845
964
 
846
- onCentralManagerDidUpdateState(callback: any): EventSubscription {
847
- return BleManagerModule.onCentralManagerDidUpdateState(callback);
848
- }
849
-
850
- onConnectPeripheral(callback: any): EventSubscription {
965
+ /**
966
+ * A peripheral was connected.
967
+ */
968
+ onConnectPeripheral(callback: EventCallback<BleConnectPeripheralEvent>): EventSubscription {
851
969
  return BleManagerModule.onConnectPeripheral(callback);
852
970
  }
853
971
 
854
- onDisconnectPeripheral(callback: any): EventSubscription {
972
+ /**
973
+ * A peripheral was disconnected.
974
+ */
975
+ onDisconnectPeripheral(callback: EventCallback<BleDisconnectPeripheralEvent>): EventSubscription {
855
976
  return BleManagerModule.onDisconnectPeripheral(callback);
856
977
  }
857
978
 
858
- onDidUpdateValueForCharacteristic(callback: any): EventSubscription {
979
+ /**
980
+ * A characteristic notified a new value.
981
+ *
982
+ * > Event will only be emitted after successful `startNotification`.
983
+ */
984
+ onDidUpdateValueForCharacteristic(callback: EventCallback<BleManagerDidUpdateValueForCharacteristicEvent>): EventSubscription {
859
985
  return BleManagerModule.onDidUpdateValueForCharacteristic(callback);
860
986
  }
861
987
 
862
- onPeripheralDidBond(callback: any): EventSubscription {
988
+ /**
989
+ * A bond with a peripheral was established.
990
+ */
991
+ onPeripheralDidBond(callback: EventCallback<BleBondedPeripheralEvent>): EventSubscription {
863
992
  return BleManagerModule.onPeripheralDidBond(callback);
864
993
  }
865
994
 
866
- onCentralManagerWillRestoreState(callback: any): EventSubscription {
995
+ /**
996
+ * [iOS only]
997
+ *
998
+ * 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).
999
+ *
1000
+ * _For more on performing long-term bluetooth actions in the background:_
1001
+ *
1002
+ * [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)
1003
+ *
1004
+ * [iOS Relaunch Conditions](https://developer.apple.com/documentation/technotes/tn3115-bluetooth-state-restoration-app-relaunch-rules/)
1005
+ */
1006
+ onCentralManagerWillRestoreState(callback: EventCallback<BleManagerCentralManagerWillRestoreState>): EventSubscription {
867
1007
  return BleManagerModule.onCentralManagerWillRestoreState(callback);
868
1008
  }
869
1009
 
870
- onDidUpdateNotificationStateFor(callback: any): EventSubscription {
1010
+ /**
1011
+ * [iOS only]
1012
+ *
1013
+ * The peripheral received a request to start or stop providing notifications for a specified characteristic's value.
1014
+ */
1015
+ onDidUpdateNotificationStateFor(callback: EventCallback<BleManagerDidUpdateNotificationStateForEvent>): EventSubscription {
871
1016
  return BleManagerModule.onDidUpdateNotificationStateFor(callback);
872
1017
  }
873
1018
 
874
- onCompanionPeripheral(callback: any): EventSubscription {
1019
+ /**
1020
+ * User picked a device to associate with.
1021
+ *
1022
+ * Null if the request was cancelled by the user.
1023
+ */
1024
+ onCompanionPeripheral(callback: EventCallback<BleManagerCompanionPeripheral>): EventSubscription {
875
1025
  return BleManagerModule.onCompanionPeripheral(callback);
876
1026
  }
877
-
878
- onCompanionAvailability(callback: any): EventSubscription {
879
- return BleManagerModule.onCompanionAvailability(callback);
880
- }
881
1027
  }
882
1028
 
883
1029
  export default new BleManager();