forked from MY01Inc/react-native-ble-plx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
2020 lines (1867 loc) · 70.6 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
declare module '@onekeyfe/react-native-ble-plx' {
// TypeDefinition.js *************************************************************************************************
/**
* [Android only] ConnectionOptions parameter to describe when to call BluetoothGatt.refresh()
*/
export type RefreshGattMoment = 'OnConnected'
/**
* Base64 value
*/
export type Base64 = string
/**
* Bluetooth UUID
*/
export type UUID = string
/**
* Unique identifier for BLE objects.
*/
export type Identifier = number
/**
* Bluetooth device id.
*/
export type DeviceId = string
/**
* Transaction identifier. All transaction identifiers in numeric form are reserved for internal use.
*/
export type TransactionId = string
/**
* Subscription
* @interface
*/
export interface Subscription {
/**
* Removes subscription
* @memberof Subscription
* @ignore
*/
remove(): void
}
/**
* Type of error code mapping table
*/
export type BleErrorCodeMessageMapping = { [key in BleErrorCode]: string }
/**
* Options which can be passed to when creating BLE Manager
*/
export interface BleManagerOptions {
/**
* BLE State restoration identifier used to restore state.
* @memberof BleManagerOptions
* @instance
*/
restoreStateIdentifier?: string
/**
* Optional function which is used to properly restore state of your BLE Manager. Callback
* is emitted in the beginning of BleManager creation and optional {@link BleRestoreState}
* is passed. When value is `null` application is launching for the first time, otherwise
* it contains saved state which may be used by developer to continue working with
* connected peripherals.
* @memberof BleManagerOptions
* @instance
*/
restoreStateFunction?: (restoredState: BleRestoredState | null) => void
/**
* Optional mapping of error codes to error messages. Uses {@link BleErrorCodeMessage}
* by default.
*
* To override logging UUIDs or MAC adresses in error messages copy the original object
* and overwrite values of interest to you.
*
* @memberof BleManagerOptions
* @instance
*/
errorCodesToMessagesMapping?: BleErrorCodeMessageMapping
}
/**
* Object representing information about restored BLE state after application relaunch.
*/
export interface BleRestoredState {
/**
* List of connected devices after state restoration.
* @type {Array<Device>}
* @instance
* @memberof BleRestoredState
*/
connectedPeripherals: Device[]
}
/**
* Scan mode for Bluetooth LE scan.
*/
export enum ScanMode {
/**
* A special Bluetooth LE scan mode. Applications using this scan mode will passively listen for
* other scan results without starting BLE scans themselves.
*/
Opportunistic = -1,
/**
* Perform Bluetooth LE scan in low power mode. This is the default scan mode as it consumes the
* least power. [default value]
*/
LowPower = 0,
/**
* Perform Bluetooth LE scan in balanced power mode. Scan results are returned at a rate that
* provides a good trade-off between scan frequency and power consumption.
*/
Balanced = 1,
/**
* Scan using highest duty cycle. It's recommended to only use this mode when the application is
* running in the foreground.
*/
LowLatency = 2
}
/**
* Scan callback type for Bluetooth LE scan.
* @name ScanCallbackType
*/
export enum ScanCallbackType {
/**
* Trigger a callback for every Bluetooth advertisement found that matches the filter criteria.
* If no filter is active, all advertisement packets are reported. [default value]
*/
AllMatches = 1,
/**
* A result callback is only triggered for the first advertisement packet received that matches
* the filter criteria.
*/
FirstMatch = 2,
/**
* Receive a callback when advertisements are no longer received from a device that has been
* previously reported by a first match callback.
*/
MatchLost = 4
}
/**
* Options which can be passed to scanning function
* @name ScanOptions
*/
export interface ScanOptions {
/**
* By allowing duplicates scanning records are received more frequently [iOS only]
*/
allowDuplicates?: boolean
/**
* Scan mode for Bluetooth LE scan [Android only]
*/
scanMode?: ScanMode
/**
* Scan callback type for Bluetooth LE scan [Android only]
*/
callbackType?: ScanCallbackType
}
/**
* Connection specific options to be passed before connection happen. [Not used]
*/
export interface ConnectionOptions {
/**
* Whether to directly connect to the remote device (false) or to automatically connect as soon as the remote device
* becomes available (true). [Android only]
* @memberof ConnectionOptions
* @instance
*/
autoConnect?: boolean
/**
* Whether MTU size will be negotiated to this value. It is not guaranteed to get it after connection is successful.
*
* @memberof ConnectionOptions
* @instance
*/
requestMTU?: number
/**
* Whether action will be taken to reset services cache. This option may be useful when a peripheral's firmware was
* updated and it's services/characteristics were added/removed/altered. [Android only]
* {@link https://stackoverflow.com/questions/22596951/how-to-programmatically-force-bluetooth-low-energy-service-discovery-on-android}
* @memberof ConnectionOptions
* @instance
*/
refreshGatt?: RefreshGattMoment
/**
* Number of milliseconds after connection is automatically timed out. In case of race condition were connection is
* established right after timeout event, device will be disconnected immediately. Time out may happen earlier then
* specified due to OS specific behavior.
*
* @memberof ConnectionOptions
* @instance
*/
timeout?: number
}
/**
* Device Bluetooth Low Energy state. It's keys are used to check {@link #blemanagerstate} values
* received by {@link BleManager}
*/
export enum State {
/**
* The current state of the manager is unknown; an update is imminent.
*/
Unknown = 'Unknown',
/**
* The connection with the system service was momentarily lost; an update is imminent.
*/
Resetting = 'Resetting',
/**
* The platform does not support Bluetooth low energy.
*/
Unsupported = 'Unsupported',
/**
* The app is not authorized to use Bluetooth low energy.
*/
Unauthorized = 'Unauthorized',
/**
* Bluetooth is currently powered off.
*/
PoweredOff = 'PoweredOff',
/**
* Bluetooth is currently powered on and available to use.
*/
PoweredOn = 'PoweredOn'
}
/**
* Native module logging log level. By default it is set to None.
* @name LogLevel
*/
export enum LogLevel {
/**
* Logging in native module is disabled
*/
None = 'None',
/**
* All logs in native module are shown
*/
Verbose = 'Verbose',
/**
* Only debug logs and of higher importance are shown in native module.
*/
Debug = 'Debug',
/**
* Only info logs and of higher importance are shown in native module.
*/
Info = 'Info',
/**
* Only warning logs and of higher importance are shown in native module.
*/
Warning = 'Warning',
/**
* Only error logs and of higher importance are shown in native module.
*/
Error = 'Error'
}
/**
* Connection priority of BLE link determining the balance between power consumption and data throughput.
* @name ConnectionPriority
*/
export enum ConnectionPriority {
/**
* Default, recommended option balanced between power consumption and data throughput.
*/
Balanced = 0,
/**
* High priority, low latency connection, which increases transfer speed at the expense of power consumption.
*/
High = 1,
/**
* Low power, reduced data rate connection setup.
*/
LowPower = 2
}
// Utils.js **********************************************************************************************************
/**
* Converts UUID to full 128bit, lowercase format which should be used to compare UUID values.
*
* @param {UUID} uuid 16bit, 32bit or 128bit UUID.
* @returns {UUID} 128bit lowercase UUID.
*/
export function fullUUID(uuid: UUID): UUID
// BleError.js *******************************************************************************************************
export interface NativeBleError {
errorCode: BleErrorCode
attErrorCode: BleATTErrorCode | null
iosErrorCode: BleIOSErrorCode | null
androidErrorCode: BleAndroidErrorCode | null
reason: string | null
deviceID?: string
serviceUUID?: string
characteristicUUID?: string
descriptorUUID?: string
internalMessage?: string
}
/**
* BleError is an error class which is guaranteed to be thrown by all functions of this
* library. It contains additional properties which help to identify problems in
* platform independent way.
*/
export class BleError extends Error {
/**
* Platform independent error code. Possible values are defined in {@link BleErrorCode}.
*/
errorCode: BleErrorCode
/**
* Platform independent error code related to ATT errors.
*/
attErrorCode: BleATTErrorCode | null
/**
* iOS specific error code (if not an ATT error).
*/
iosErrorCode: BleATTErrorCode | null
/**
* Android specific error code (if not an ATT error).
*/
androidErrorCode: BleAndroidErrorCode | null
/**
* Platform specific error message.
*/
reason: string | null
constructor(nativeBleError: NativeBleError | string, errorMessageMapping: BleErrorCodeMessageMapping)
}
/**
* Platform independent error code map adjusted to this library's use cases.
*/
export enum BleErrorCode {
// Implementation specific errors ----------------------------------------------------------------------------------
/**
* This error can be thrown when unexpected error occurred and in most cases it is related to implementation bug.
* Original message is available in {@link #bleerrorreason|reason} property.
*/
UnknownError = 0,
/**
* Current promise failed to finish due to BleManager shutdown. It means that user called
* {@link #blemanagerdestroy|manager.destroy()} function before all operations completed.
*/
BluetoothManagerDestroyed = 1,
/**
* Promise was explicitly cancelled by a user with {@link #blemanagercanceltransaction|manager.cancelTransaction()}
* function call.
*/
OperationCancelled = 2,
/**
* Operation timed out and was cancelled.
*/
OperationTimedOut = 3,
/**
* Native module couldn't start operation due to internal state, which doesn't allow to do that.
*/
OperationStartFailed = 4,
/**
* Invalid UUIDs or IDs were passed to API call.
*/
InvalidIdentifiers = 5,
// Bluetooth global states -----------------------------------------------------------------------------------------
/**
* Bluetooth is not supported for this particular device. It may happen on iOS simulator for example.
*/
BluetoothUnsupported = 100,
/**
* There are no granted permissions which allow to use BLE functionality. On Android it may require
* android.permission.ACCESS_COARSE_LOCATION permission or android.permission.ACCESS_FINE_LOCATION permission.
*/
BluetoothUnauthorized = 101,
/**
* BLE is powered off on device. All previous operations and their state is invalidated.
*/
BluetoothPoweredOff = 102,
/**
* BLE stack is in unspecified state.
*/
BluetoothInUnknownState = 103,
/**
* BLE stack is resetting.
*/
BluetoothResetting = 104,
/**
* BLE state change failed.
*/
BluetoothStateChangeFailed = 105,
// Peripheral errors. ----------------------------------------------------------------------------------------------
/**
* Couldn't connect to specified device.
*/
DeviceConnectionFailed = 200,
/**
* Device was disconnected.
*/
DeviceDisconnected = 201,
/**
* Couldn't read RSSI from device.
*/
DeviceRSSIReadFailed = 202,
/**
* Device is already connected. It is not allowed to connect twice to the same device.
*/
DeviceAlreadyConnected = 203,
/**
* Couldn't find device with specified ID.
*/
DeviceNotFound = 204,
/**
* Operation failed because device has to be connected to perform it.
*/
DeviceNotConnected = 205,
/**
* Device could not change MTU value.
*/
DeviceMTUChangeFailed = 206,
// Services --------------------------------------------------------------------------------------------------------
/**
* Couldn't discover services for specified device.
*/
ServicesDiscoveryFailed = 300,
/**
* Couldn't discover included services for specified service.
*/
IncludedServicesDiscoveryFailed = 301,
/**
* Service with specified ID or UUID couldn't be found. User may need to call
* {@link #blemanagerdiscoverallservicesandcharacteristicsfordevice|manager.discoverAllServicesAndCharacteristicsForDevice}
* to cache them.
*/
ServiceNotFound = 302,
/**
* Services were not discovered. User may need to call
* {@link #blemanagerdiscoverallservicesandcharacteristicsfordevice|manager.discoverAllServicesAndCharacteristicsForDevice}
* to cache them.
*/
ServicesNotDiscovered = 303,
// Characteristics -------------------------------------------------------------------------------------------------
/**
* Couldn't discover characteristics for specified service.
*/
CharacteristicsDiscoveryFailed = 400,
/**
* Couldn't write to specified characteristic. Make sure that
* {@link #characteristiciswritablewithresponse|characteristic.isWritableWithResponse}
* or {@link #characteristiciswritablewithoutresponse|characteristic.isWritableWithoutResponse} is set to true.
*/
CharacteristicWriteFailed = 401,
/**
* Couldn't read from specified characteristic. Make sure that
* {@link #characteristicisreadable|characteristic.isReadable} is set to true.
*/
CharacteristicReadFailed = 402,
/**
* Couldn't set notification or indication for specified characteristic. Make sure that
* {@link #characteristicisnotifiable|characteristic.isNotifiable} or
* {@link #characteristicisindicatable|characteristic.isIndicatable} is set to true.
*/
CharacteristicNotifyChangeFailed = 403,
/**
* Characteristic with specified ID or UUID couldn't be found. User may need to call
* {@link #blemanagerdiscoverallservicesandcharacteristicsfordevice|manager.discoverAllServicesAndCharacteristicsForDevice}
* to cache them.
*/
CharacteristicNotFound = 404,
/**
* Characteristic were not discovered for specified service. User may need to call
* {@link #blemanagerdiscoverallservicesandcharacteristicsfordevice|manager.discoverAllServicesAndCharacteristicsForDevice}
* to cache them.
*/
CharacteristicsNotDiscovered = 405,
/**
* Invalid Base64 format was passed to characteristic API function call.
*/
CharacteristicInvalidDataFormat = 406,
// Characteristics -------------------------------------------------------------------------------------------------
/**
* Couldn't discover descriptor for specified characteristic.
*/
DescriptorsDiscoveryFailed = 500,
/**
* Couldn't write to specified descriptor.
*/
DescriptorWriteFailed = 501,
/**
* Couldn't read from specified descriptor.
*/
DescriptorReadFailed = 502,
/**
* Couldn't find specified descriptor.
*/
DescriptorNotFound = 503,
/**
* Descriptors are not discovered for specified characteristic.
*/
DescriptorsNotDiscovered = 504,
/**
* Invalid Base64 format was passed to descriptor API function call.
*/
DescriptorInvalidDataFormat = 505,
/**
* Issued a write to a descriptor, which is handled by OS.
*/
DescriptorWriteNotAllowed = 506,
// Scanning errors -------------------------------------------------------------------------------------------------
/**
* Cannot start scanning operation.
*/
ScanStartFailed = 600,
/**
* Location services are disabled.
*/
LocationServicesDisabled = 601
}
/**
* Error codes for ATT errors.
* @name BleATTErrorCode
*/
export enum BleATTErrorCode {
/**
* The ATT command or request successfully completed.
*/
Success = 0,
/**
* The attribute handle is invalid on this device.
*/
InvalidHandle = 1,
/**
* The attribute’s value cannot be read.
*/
ReadNotPermitted = 2,
/**
* The attribute’s value cannot be written.
*/
WriteNotPermitted = 3,
/**
* The attribute Protocol Data Unit (PDU) or “message” is invalid.
*/
InvalidPdu = 4,
/**
* The attribute requires authentication before its value can be read or written.
*/
InsufficientAuthentication = 5,
/**
* The attribute server does not support the request received by the client.
*/
RequestNotSupported = 6,
/**
* The specified offset value was past the end of the attribute’s value.
*/
InvalidOffset = 7,
/**
* The attribute requires authorization before its value can be read or written.
*/
InsufficientAuthorization = 8,
/**
* The prepare queue is full, because too many prepare write requests have been queued.
*/
PrepareQueueFull = 9,
/**
* The attribute is not found within the specified attribute handle range.
*/
AttributeNotFound = 10,
/**
* The attribute cannot be read or written using the ATT read blob request.
*/
AttributeNotLong = 11,
/**
* The encryption key size used for encrypting this link is insufficient.
*/
InsufficientEncryptionKeySize = 12,
/**
* The length of the attribute’s value is invalid for the intended operation.
*/
InvalidAttributeValueLength = 13,
/**
* The ATT request has encountered an unlikely error and therefore could not be completed.
*/
UnlikelyError = 14,
/**
* The attribute requires encryption before its value can be read or written.
*/
InsufficientEncryption = 15,
/**
* The attribute type is not a supported grouping attribute as defined by a higher-layer specification.
*/
UnsupportedGroupType = 16,
/**
* Resources are insufficient to complete the ATT request.
*/
InsufficientResources = 17
// Values 0x012 – 0x7F are reserved for future use.
}
/**
* iOS specific error codes.
* @name BleIOSErrorCode
*/
export enum BleIOSErrorCode {
/**
* An unknown error occurred.
*/
Unknown = 0,
/**
* The specified parameters are invalid.
*/
InvalidParameters = 1,
/**
* The specified attribute handle is invalid.
*/
InvalidHandle = 2,
/**
* The device is not currently connected.
*/
NotConnected = 3,
/**
* The device has run out of space to complete the intended operation.
*/
OutOfSpace = 4,
/**
* The operation is canceled.
*/
OperationCancelled = 5,
/**
* The connection timed out.
*/
ConnectionTimeout = 6,
/**
* The peripheral disconnected.
*/
PeripheralDisconnected = 7,
/**
* The specified UUID is not permitted.
*/
UuidNotAllowed = 8,
/**
* The peripheral is already advertising.
*/
AlreadyAdvertising = 9,
/**
* The connection failed.
*/
ConnectionFailed = 10,
/**
* The device already has the maximum number of connections.
*/
ConnectionLimitReached = 11,
/**
* Unknown device.
*/
UnknownDevice = 12
}
/**
* Android specific error codes.
* @name BleAndroidErrorCode
*/
export enum BleAndroidErrorCode {
/**
* The device has insufficient resources to complete the intended operation.
*/
NoResources = 0x80,
/**
* Internal error occurred which may happen due to implementation error in BLE stack.
*/
InternalError = 0x81,
/**
* BLE stack implementation entered illegal state and operation couldn't complete.
*/
WrongState = 0x82,
/**
* BLE stack didn't allocate sufficient memory buffer for internal caches.
*/
DbFull = 0x83,
/**
* Maximum number of pending operations was exceeded.
*/
Busy = 0x84,
/**
* Generic BLE stack error.
*/
Error = 0x85,
/**
* Command is already queued up in GATT.
*/
CmdStarted = 0x86,
/**
* Illegal parameter was passed to internal BLE stack function.
*/
IllegalParameter = 0x87,
/**
* Operation is pending.
*/
Pending = 0x88,
/**
* Authorization failed before performing read or write operation.
*/
AuthFail = 0x89,
/**
* More cache entries were loaded then expected.
*/
More = 0x8a,
/**
* Invalid configuration
*/
InvalidCfg = 0x8b,
/**
* GATT service already started.
*/
ServiceStarted = 0x8c,
/**
* GATT link is encrypted but prone to man in the middle attacks.
*/
EncrypedNoMitm = 0x8d,
/**
* GATT link is not encrypted.
*/
NotEncrypted = 0x8e,
/**
* ATT command was sent but channel is congested.
*/
Congested = 0x8f
}
// BleModule.js ******************************************************************************************************
/**
* Native device object passed from BleModule.
* @private
*/
export interface NativeDevice {
/**
* Device identifier: MAC address on Android and UUID on iOS.
* @private
*/
id: DeviceId
/**
* Device name if present
* @private
*/
name: string | null
/**
* Current Received Signal Strength Indication of device
* @private
*/
rssi: number | null
/**
* Current Maximum Transmission Unit for this device. When device is not connected
* default value of 23 is used.
* @private
*/
mtu: number
// Advertisement
/**
* Device's custom manufacturer data. Its format is defined by manufacturer.
* @private
*/
manufacturerData: Base64 | null
/**
* Map od service UUIDs with associated data.
* @private
*/
serviceData: { [uuid: string]: Base64 } | null
/**
* List of available services visible during scanning.
* @private
*/
serviceUUIDs: UUID[] | null
/**
* User friendly name of device.
* @private
*/
localName: string | null
/**
* Transmission power level of device.
* @private
*/
txPowerLevel: number | null
/**
* List of solicited service UUIDs.
* @private
*/
solicitedServiceUUIDs: UUID[] | null
/**
* Is device connectable.
* @private
*/
isConnectable: boolean | null
/**
* List of overflow service UUIDs.
* @private
*/
overflowServiceUUIDs: UUID[] | null
}
/**
* Native service object passed from BleModule.
* @private
*/
export interface NativeService {
/**
* Service unique identifier
* @private
*/
id: Identifier
/**
* Service UUID
* @private
*/
uuid: UUID
/**
* Device's ID to which service belongs
* @private
*/
deviceID: DeviceId
/**
* Value indicating whether the type of service is primary or secondary.
* @private
*/
isPrimary: boolean
}
/**
* Native characteristic object passed from BleModule.
* @private
*/
export interface NativeCharacteristic {
/**
* Characteristic unique identifier
* @private
*/
id: Identifier
/**
* Characteristic UUID
* @private
*/
uuid: UUID
/**
* Service's ID to which characteristic belongs
* @private
*/
serviceID: Identifier
/**
* Service's UUID to which characteristic belongs
* @private
*/
serviceUUID: UUID
/**
* Device's ID to which characteristic belongs
* @private
*/
deviceID: DeviceId
/**
* True if characteristic can be read
* @private
*/
isReadable: boolean
/**
* True if characteristic can be written with response
* @private
*/
isWritableWithResponse: boolean
/**
* True if characteristic can be written without response
* @private
*/
isWritableWithoutResponse: boolean
/**
* True if characteristic can monitor value changes.
* @private
*/
isNotifiable: boolean
/**
* True if characteristic is monitoring value changes without ACK.
* @private
*/
isNotifying: boolean
/**
* True if characteristic is monitoring value changes with ACK.
* @private
*/
isIndicatable: boolean
/**
* Characteristic value if present
* @private
*/
value: Base64 | null
}
/**
* Native descriptor object passed from BleModule.
* @private
*/
export interface NativeDescriptor {
/**
* Descriptor unique identifier
* @private
*/
id: Identifier
/**
* Descriptor UUID
* @private
*/
uuid: UUID
/**
* Characteristic's ID to which descriptor belongs
* @private
*/
characteristicID: Identifier
/**
* Characteristic's UUID to which descriptor belongs
* @private
*/
characteristicUUID: UUID
/**
* Service's ID to which descriptor belongs
* @private
*/
serviceID: Identifier
/**
* Service's UUID to which descriptor belongs
* @private
*/
serviceUUID: UUID
/**
* Device's ID to which descriptor belongs
* @private
*/
deviceID: DeviceId
/**
* Descriptor value if present
* @private
*/
value: Base64 | null
}
/**
* Object representing information about restored BLE state after application relaunch.
* @private
*/
export interface NativeBleRestoredState {
/**
* List of connected devices after state restoration.
* @type {Array<NativeDevice>}
* @instance
* @memberof NativeBleRestoredState
* @private
*/
connectedPeripherals: NativeDevice[]
}
// BleManager.js *****************************************************************************************************
/**
*
* BleManager is an entry point for react-native-ble-plx library. It provides all means to discover and work with
* {@link Device} instances. It should be initialized only once with `new` keyword and method
* {@link #blemanagerdestroy|destroy()} should be called on its instance when user wants to deallocate all resources.
*
* In case you want to properly support Background Mode, you should provide `restoreStateIdentifier` and
* `restoreStateFunction` in {@link BleManagerOptions}.
*
* @example
* const manager = new BleManager();
* // ... work with BLE manager ...
* manager.destroy();
*/
export class BleManager {
/**