react-native-ble-nitro 1.3.1 → 1.4.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.
- package/README.md +24 -0
- package/android/src/main/java/com/margelo/nitro/co/zyke/ble/BleNitroBleManager.kt +6 -0
- package/ios/BleNitroBleManager.swift +84 -2
- package/lib/commonjs/index.d.ts +4 -194
- package/lib/commonjs/index.d.ts.map +1 -1
- package/lib/commonjs/index.js +6 -441
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/manager.d.ts +204 -0
- package/lib/commonjs/manager.d.ts.map +1 -0
- package/lib/commonjs/manager.js +469 -0
- package/lib/commonjs/manager.js.map +1 -0
- package/lib/commonjs/specs/NativeBleNitro.nitro.d.ts +2 -0
- package/lib/commonjs/specs/NativeBleNitro.nitro.d.ts.map +1 -1
- package/lib/index.d.ts +4 -194
- package/lib/index.js +3 -436
- package/lib/manager.d.ts +203 -0
- package/lib/manager.js +455 -0
- package/lib/specs/NativeBleNitro.nitro.d.ts +2 -0
- package/nitrogen/generated/android/BleNitroOnLoad.cpp +2 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__vector_BLEDevice_.hpp +102 -0
- package/nitrogen/generated/android/c++/JHybridNativeBleNitroSpec.cpp +6 -1
- package/nitrogen/generated/android/c++/JHybridNativeBleNitroSpec.hpp +1 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/Func_void_std__vector_BLEDevice_.kt +81 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/HybridNativeBleNitroSpec.kt +9 -0
- package/nitrogen/generated/ios/BleNitro-Swift-Cxx-Bridge.cpp +8 -0
- package/nitrogen/generated/ios/BleNitro-Swift-Cxx-Bridge.hpp +38 -16
- package/nitrogen/generated/ios/c++/HybridNativeBleNitroSpecSwift.hpp +15 -9
- package/nitrogen/generated/ios/swift/Func_void_std__vector_BLEDevice_.swift +47 -0
- package/nitrogen/generated/ios/swift/HybridNativeBleNitroSpec.swift +1 -0
- package/nitrogen/generated/ios/swift/HybridNativeBleNitroSpec_cxx.swift +22 -0
- package/nitrogen/generated/shared/c++/HybridNativeBleNitroSpec.cpp +1 -0
- package/nitrogen/generated/shared/c++/HybridNativeBleNitroSpec.hpp +6 -5
- package/package.json +9 -1
- package/src/__tests__/index.test.ts +19 -15
- package/src/index.ts +24 -609
- package/src/manager.ts +627 -0
- package/src/specs/NativeBleNitro.nitro.ts +4 -0
package/README.md
CHANGED
|
@@ -330,6 +330,30 @@ const fullUUIDs = BleNitro.normalizeGattUUIDs(['180d', '180f']);
|
|
|
330
330
|
// Returns: ['0000180d-0000-1000-8000-00805f9b34fb', '0000180f-0000-1000-8000-00805f9b34fb']
|
|
331
331
|
```
|
|
332
332
|
|
|
333
|
+
### iOS Restore State
|
|
334
|
+
|
|
335
|
+
There are two ways to handle state restoration on iOS:
|
|
336
|
+
|
|
337
|
+
```typescript
|
|
338
|
+
// Enable state restoration in BleNitro singleton
|
|
339
|
+
const ble = BleNitro.instance();
|
|
340
|
+
ble.onRestoreState((peripherals) => {
|
|
341
|
+
console.log('Restored peripherals:', peripherals);
|
|
342
|
+
});
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
```typescript
|
|
346
|
+
// Or use BleNitroManager with options
|
|
347
|
+
// This way you have to assure that only one instance of BleNitroManager is created and that you always use this instance.
|
|
348
|
+
import { BleNitroManager, BLEDevice } from 'react-native-ble-nitro/manager';
|
|
349
|
+
|
|
350
|
+
const customBleInstance = new BleNitroManager({
|
|
351
|
+
onRestoreState: (peripherals: BLEDevice[]) => {
|
|
352
|
+
console.log('Restored peripherals:', peripherals);
|
|
353
|
+
}
|
|
354
|
+
});
|
|
355
|
+
```
|
|
356
|
+
|
|
333
357
|
### TypeScript Types
|
|
334
358
|
|
|
335
359
|
```typescript
|
|
@@ -37,6 +37,7 @@ class BleNitroBleManager : HybridNativeBleNitroSpec() {
|
|
|
37
37
|
private var bluetoothAdapter: BluetoothAdapter? = null
|
|
38
38
|
private var stateCallback: ((state: BLEState) -> Unit)? = null
|
|
39
39
|
private var bluetoothStateReceiver: BroadcastReceiver? = null
|
|
40
|
+
private var restoreStateCallback: ((devices: List<BLEDevice>) -> Unit)? = null
|
|
40
41
|
|
|
41
42
|
// BLE Scanning
|
|
42
43
|
private var bleScanner: BluetoothLeScanner? = null
|
|
@@ -304,6 +305,11 @@ class BleNitroBleManager : HybridNativeBleNitroSpec() {
|
|
|
304
305
|
}
|
|
305
306
|
}
|
|
306
307
|
|
|
308
|
+
override fun setRestoreStateCallback(callback: (restoredPeripherals: Array<BLEDevice>) -> Unit) {
|
|
309
|
+
restoreStateCallback = { devices -> callback(devices.toTypedArray()) }
|
|
310
|
+
return
|
|
311
|
+
}
|
|
312
|
+
|
|
307
313
|
// Scanning operations
|
|
308
314
|
override fun startScan(filter: com.margelo.nitro.co.zyke.ble.ScanFilter, callback: (device: BLEDevice?, error: String?) -> Unit) {
|
|
309
315
|
try {
|
|
@@ -5,7 +5,13 @@ import NitroModules
|
|
|
5
5
|
* iOS implementation of the BLE Nitro Manager
|
|
6
6
|
* Implements the HybridNativeBleNitroSpec protocol for Core Bluetooth operations
|
|
7
7
|
*/
|
|
8
|
-
public class BleNitroBleManager:
|
|
8
|
+
public class BleNitroBleManager: HybridNativeBleNitroSpec_base, HybridNativeBleNitroSpec_protocol {
|
|
9
|
+
|
|
10
|
+
// MARK: - Constants
|
|
11
|
+
private static let restoreStateIdentifier = "react-native-ble-nitro"
|
|
12
|
+
|
|
13
|
+
// MARK: - Static Properties
|
|
14
|
+
private static var globalRestoreStateCallback: (([BLEDevice]) -> Void)?
|
|
9
15
|
|
|
10
16
|
// MARK: - Private Properties
|
|
11
17
|
private var centralManager: CBCentralManager!
|
|
@@ -18,6 +24,9 @@ public class BleNitroBleManager: HybridNativeBleNitroSpec {
|
|
|
18
24
|
private var isCurrentlyScanning = false
|
|
19
25
|
private var currentScanFilter: ScanFilter?
|
|
20
26
|
private var centralManagerDelegate: BleCentralManagerDelegate!
|
|
27
|
+
|
|
28
|
+
// MARK: - Restore State Properties
|
|
29
|
+
private var restoreStateCallback: (([BLEDevice]) -> Void)?
|
|
21
30
|
|
|
22
31
|
// MARK: - Initialization
|
|
23
32
|
public override init() {
|
|
@@ -27,9 +36,16 @@ public class BleNitroBleManager: HybridNativeBleNitroSpec {
|
|
|
27
36
|
|
|
28
37
|
private func setupCentralManager() {
|
|
29
38
|
centralManagerDelegate = BleCentralManagerDelegate(manager: self)
|
|
30
|
-
|
|
39
|
+
|
|
40
|
+
// Create options dictionary for central manager with fixed restore identifier
|
|
41
|
+
let options: [String: Any] = [
|
|
42
|
+
CBCentralManagerOptionRestoreIdentifierKey: BleNitroBleManager.restoreStateIdentifier
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
centralManager = CBCentralManager(delegate: centralManagerDelegate, queue: DispatchQueue.main, options: options)
|
|
31
46
|
}
|
|
32
47
|
|
|
48
|
+
|
|
33
49
|
// MARK: - State Management
|
|
34
50
|
public func state() throws -> BLEState {
|
|
35
51
|
let bleState = mapCBManagerStateToBLEState(centralManager.state)
|
|
@@ -54,6 +70,15 @@ public class BleNitroBleManager: HybridNativeBleNitroSpec {
|
|
|
54
70
|
return OperationResult(success: true, error: nil)
|
|
55
71
|
}
|
|
56
72
|
|
|
73
|
+
// MARK: - Restore State Management
|
|
74
|
+
public func setRestoreStateCallback(callback: @escaping ([BLEDevice]) -> Void) throws {
|
|
75
|
+
print("🔄 setRestoreStateCallback called")
|
|
76
|
+
// Set both static and instance variables
|
|
77
|
+
BleNitroBleManager.globalRestoreStateCallback = callback
|
|
78
|
+
self.restoreStateCallback = callback
|
|
79
|
+
print("🔄 Callback set successfully")
|
|
80
|
+
}
|
|
81
|
+
|
|
57
82
|
// MARK: - Scanning Operations
|
|
58
83
|
public func startScan(filter: ScanFilter, callback: @escaping (BLEDevice?, String?) -> Void) throws {
|
|
59
84
|
guard centralManager.state == .poweredOn else {
|
|
@@ -435,6 +460,59 @@ public class BleNitroBleManager: HybridNativeBleNitroSpec {
|
|
|
435
460
|
stateChangeCallback?(state)
|
|
436
461
|
}
|
|
437
462
|
|
|
463
|
+
internal func handleStateRestoration(_ dict: [String: Any]) {
|
|
464
|
+
// Restore connected peripherals
|
|
465
|
+
if let peripherals = dict[CBCentralManagerRestoredStatePeripheralsKey] as? [CBPeripheral] {
|
|
466
|
+
var restoredDevices: [BLEDevice] = []
|
|
467
|
+
|
|
468
|
+
for peripheral in peripherals {
|
|
469
|
+
let deviceId = peripheral.identifier.uuidString
|
|
470
|
+
|
|
471
|
+
// Add to our tracking dictionaries
|
|
472
|
+
discoveredPeripherals[deviceId] = peripheral
|
|
473
|
+
if peripheral.state == .connected {
|
|
474
|
+
connectedPeripherals[deviceId] = peripheral
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
// Create BLE device for the callback
|
|
478
|
+
let device = BLEDevice(
|
|
479
|
+
id: deviceId,
|
|
480
|
+
name: peripheral.name ?? "Restored Device",
|
|
481
|
+
rssi: 0, // RSSI not available for restored peripherals
|
|
482
|
+
manufacturerData: ManufacturerData(companyIdentifiers: []),
|
|
483
|
+
serviceUUIDs: peripheral.services?.map { $0.uuid.uuidString } ?? [],
|
|
484
|
+
isConnectable: true
|
|
485
|
+
)
|
|
486
|
+
restoredDevices.append(device)
|
|
487
|
+
|
|
488
|
+
// Set up delegate for restored peripheral
|
|
489
|
+
let delegate = BlePeripheralDelegate(deviceId: deviceId, manager: self)
|
|
490
|
+
peripheralDelegates[deviceId] = delegate
|
|
491
|
+
peripheral.delegate = delegate
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
// Call the restore state callback if set (prioritize static over instance)
|
|
495
|
+
let callback = BleNitroBleManager.globalRestoreStateCallback ?? restoreStateCallback
|
|
496
|
+
callback?(restoredDevices)
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
// Restore scanning state if it was active
|
|
500
|
+
if let scanServiceUUIDs = dict[CBCentralManagerRestoredStateScanServicesKey] as? [CBUUID] {
|
|
501
|
+
// The system was scanning when the app was terminated
|
|
502
|
+
// We can choose to resume scanning or let the app decide
|
|
503
|
+
isCurrentlyScanning = true
|
|
504
|
+
|
|
505
|
+
// Note: We don't automatically resume scanning here to give the app control
|
|
506
|
+
// The app can check isScanning() and decide whether to resume or stop
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
// Restore scan options if available
|
|
510
|
+
if let scanOptions = dict[CBCentralManagerRestoredStateScanOptionsKey] as? [String: Any] {
|
|
511
|
+
// Store scan options for potential resume
|
|
512
|
+
// This information can be used if the app decides to resume scanning
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
|
|
438
516
|
internal func handleDeviceDiscovered(
|
|
439
517
|
_ peripheral: CBPeripheral,
|
|
440
518
|
advertisementData: [String: Any],
|
|
@@ -613,4 +691,8 @@ class BleCentralManagerDelegate: NSObject, CBCentralManagerDelegate {
|
|
|
613
691
|
func centralManager(_ central: CBCentralManager, didDisconnectPeripheral peripheral: CBPeripheral, error: Error?) {
|
|
614
692
|
manager?.handleDeviceDisconnected(peripheral, error: error)
|
|
615
693
|
}
|
|
694
|
+
|
|
695
|
+
func centralManager(_ central: CBCentralManager, willRestoreState dict: [String: Any]) {
|
|
696
|
+
manager?.handleStateRestoration(dict)
|
|
697
|
+
}
|
|
616
698
|
}
|
package/lib/commonjs/index.d.ts
CHANGED
|
@@ -1,196 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
allowDuplicates?: boolean;
|
|
6
|
-
androidScanMode?: AndroidScanMode;
|
|
1
|
+
import { BleNitroManager } from "./manager";
|
|
2
|
+
export { type ByteArray, type ScanFilter, type BLEDevice, type ScanCallback, type ManufacturerDataEntry, type ManufacturerData, type ConnectionCallback, type DisconnectEventCallback, type OperationCallback, type CharacteristicUpdateCallback, type Subscription, type BleNitroManager, type BleNitroManagerOptions, BLEState, AndroidScanMode, } from "./manager";
|
|
3
|
+
export declare class BleNitro extends BleNitroManager {
|
|
4
|
+
static instance(): BleNitroManager;
|
|
7
5
|
}
|
|
8
|
-
export interface ManufacturerDataEntry {
|
|
9
|
-
id: string;
|
|
10
|
-
data: ByteArray;
|
|
11
|
-
}
|
|
12
|
-
export interface ManufacturerData {
|
|
13
|
-
companyIdentifiers: ManufacturerDataEntry[];
|
|
14
|
-
}
|
|
15
|
-
export interface BLEDevice {
|
|
16
|
-
id: string;
|
|
17
|
-
name: string;
|
|
18
|
-
rssi: number;
|
|
19
|
-
manufacturerData: ManufacturerData;
|
|
20
|
-
serviceUUIDs: string[];
|
|
21
|
-
isConnectable: boolean;
|
|
22
|
-
}
|
|
23
|
-
export type ScanCallback = (device: BLEDevice) => void;
|
|
24
|
-
export type RestoreStateCallback = (connectedPeripherals: BLEDevice[]) => void;
|
|
25
|
-
export type ConnectionCallback = (success: boolean, deviceId: string, error: string) => void;
|
|
26
|
-
export type DisconnectEventCallback = (deviceId: string, interrupted: boolean, error: string) => void;
|
|
27
|
-
export type OperationCallback = (success: boolean, error: string) => void;
|
|
28
|
-
export type CharacteristicUpdateCallback = (characteristicId: string, data: ByteArray) => void;
|
|
29
|
-
export type Subscription = {
|
|
30
|
-
remove: () => void;
|
|
31
|
-
};
|
|
32
|
-
export declare enum BLEState {
|
|
33
|
-
Unknown = "Unknown",
|
|
34
|
-
Resetting = "Resetting",
|
|
35
|
-
Unsupported = "Unsupported",
|
|
36
|
-
Unauthorized = "Unauthorized",
|
|
37
|
-
PoweredOff = "PoweredOff",
|
|
38
|
-
PoweredOn = "PoweredOn"
|
|
39
|
-
}
|
|
40
|
-
export declare enum AndroidScanMode {
|
|
41
|
-
LowLatency = "LowLatency",
|
|
42
|
-
Balanced = "Balanced",
|
|
43
|
-
LowPower = "LowPower",
|
|
44
|
-
Opportunistic = "Opportunistic"
|
|
45
|
-
}
|
|
46
|
-
export type BleNitroOptions = {
|
|
47
|
-
restoreStateIdentifier?: string;
|
|
48
|
-
onRestoreState?: RestoreStateCallback;
|
|
49
|
-
};
|
|
50
|
-
export declare class BleNitro {
|
|
51
|
-
private _isScanning;
|
|
52
|
-
private _connectedDevices;
|
|
53
|
-
static instance(): BleNitro;
|
|
54
|
-
/**
|
|
55
|
-
* Converts a 16- oder 32-Bit UUID to a 128-Bit UUID
|
|
56
|
-
*
|
|
57
|
-
* @param uuid 16-, 32- or 128-Bit UUID as string
|
|
58
|
-
* @returns Full 128-Bit UUID
|
|
59
|
-
*/
|
|
60
|
-
static normalizeGattUUID(uuid: string): string;
|
|
61
|
-
static normalizeGattUUIDs(uuids: string[]): string[];
|
|
62
|
-
/**
|
|
63
|
-
* Start scanning for Bluetooth devices
|
|
64
|
-
* @param filter Optional scan filter
|
|
65
|
-
* @param callback Callback function called when a device is found
|
|
66
|
-
* @returns Promise resolving to success state
|
|
67
|
-
*/
|
|
68
|
-
startScan(filter: ScanFilter | undefined, callback: ScanCallback, onError?: (error: string) => void): void;
|
|
69
|
-
/**
|
|
70
|
-
* Stop scanning for Bluetooth devices
|
|
71
|
-
* @returns Promise resolving to success state
|
|
72
|
-
*/
|
|
73
|
-
stopScan(): void;
|
|
74
|
-
/**
|
|
75
|
-
* Check if currently scanning for devices
|
|
76
|
-
* @returns Promise resolving to scanning state
|
|
77
|
-
*/
|
|
78
|
-
isScanning(): boolean;
|
|
79
|
-
/**
|
|
80
|
-
* Get all currently connected devices
|
|
81
|
-
* @param services Optional list of service UUIDs to filter by
|
|
82
|
-
* @returns Array of connected devices
|
|
83
|
-
*/
|
|
84
|
-
getConnectedDevices(services?: string[]): BLEDevice[];
|
|
85
|
-
/**
|
|
86
|
-
* Connect to a Bluetooth device
|
|
87
|
-
* @param deviceId ID of the device to connect to
|
|
88
|
-
* @param onDisconnect Optional callback for disconnect events
|
|
89
|
-
* @returns Promise resolving when connected
|
|
90
|
-
*/
|
|
91
|
-
connect(deviceId: string, onDisconnect?: DisconnectEventCallback): Promise<string>;
|
|
92
|
-
/**
|
|
93
|
-
* Disconnect from a Bluetooth device
|
|
94
|
-
* @param deviceId ID of the device to disconnect from
|
|
95
|
-
* @returns Promise resolving when disconnected
|
|
96
|
-
*/
|
|
97
|
-
disconnect(deviceId: string): Promise<void>;
|
|
98
|
-
/**
|
|
99
|
-
* Check if connected to a device
|
|
100
|
-
* @param deviceId ID of the device to check
|
|
101
|
-
* @returns Promise resolving to connection state
|
|
102
|
-
*/
|
|
103
|
-
isConnected(deviceId: string): boolean;
|
|
104
|
-
/**
|
|
105
|
-
* Request a new MTU size
|
|
106
|
-
* @param deviceId ID of the device
|
|
107
|
-
* @param mtu New MTU size, min is 23, max is 517
|
|
108
|
-
* @returns On Android: new MTU size; on iOS: current MTU size as it is handled by iOS itself; on error: -1
|
|
109
|
-
*/
|
|
110
|
-
requestMTU(deviceId: string, mtu: number): number;
|
|
111
|
-
/**
|
|
112
|
-
* Discover services for a connected device
|
|
113
|
-
* @param deviceId ID of the device
|
|
114
|
-
* @returns Promise resolving when services are discovered
|
|
115
|
-
*/
|
|
116
|
-
discoverServices(deviceId: string): Promise<boolean>;
|
|
117
|
-
/**
|
|
118
|
-
* Get services for a connected device
|
|
119
|
-
* @param deviceId ID of the device
|
|
120
|
-
* @returns Promise resolving to array of service UUIDs
|
|
121
|
-
*/
|
|
122
|
-
getServices(deviceId: string): Promise<string[]>;
|
|
123
|
-
/**
|
|
124
|
-
* Get characteristics for a service
|
|
125
|
-
* @param deviceId ID of the device
|
|
126
|
-
* @param serviceId ID of the service
|
|
127
|
-
* @returns Promise resolving to array of characteristic UUIDs
|
|
128
|
-
*/
|
|
129
|
-
getCharacteristics(deviceId: string, serviceId: string): string[];
|
|
130
|
-
/**
|
|
131
|
-
* Read a characteristic value
|
|
132
|
-
* @param deviceId ID of the device
|
|
133
|
-
* @param serviceId ID of the service
|
|
134
|
-
* @param characteristicId ID of the characteristic
|
|
135
|
-
* @returns Promise resolving to the characteristic data as ArrayBuffer
|
|
136
|
-
*/
|
|
137
|
-
readCharacteristic(deviceId: string, serviceId: string, characteristicId: string): Promise<ByteArray>;
|
|
138
|
-
/**
|
|
139
|
-
* Write a value to a characteristic
|
|
140
|
-
* @param deviceId ID of the device
|
|
141
|
-
* @param serviceId ID of the service
|
|
142
|
-
* @param characteristicId ID of the characteristic
|
|
143
|
-
* @param data Data to write as ByteArray (number[])
|
|
144
|
-
* @param withResponse Whether to wait for response
|
|
145
|
-
* @returns Promise resolving when write is complete
|
|
146
|
-
*/
|
|
147
|
-
writeCharacteristic(deviceId: string, serviceId: string, characteristicId: string, data: ByteArray, withResponse?: boolean): Promise<boolean>;
|
|
148
|
-
/**
|
|
149
|
-
* Subscribe to characteristic notifications
|
|
150
|
-
* @param deviceId ID of the device
|
|
151
|
-
* @param serviceId ID of the service
|
|
152
|
-
* @param characteristicId ID of the characteristic
|
|
153
|
-
* @param callback Callback function called when notification is received
|
|
154
|
-
* @returns Promise resolving when subscription is complete
|
|
155
|
-
*/
|
|
156
|
-
subscribeToCharacteristic(deviceId: string, serviceId: string, characteristicId: string, callback: CharacteristicUpdateCallback): Subscription;
|
|
157
|
-
/**
|
|
158
|
-
* Unsubscribe from characteristic notifications
|
|
159
|
-
* @param deviceId ID of the device
|
|
160
|
-
* @param serviceId ID of the service
|
|
161
|
-
* @param characteristicId ID of the characteristic
|
|
162
|
-
* @returns Promise resolving when unsubscription is complete
|
|
163
|
-
*/
|
|
164
|
-
unsubscribeFromCharacteristic(deviceId: string, serviceId: string, characteristicId: string): Promise<void>;
|
|
165
|
-
/**
|
|
166
|
-
* Check if Bluetooth is enabled
|
|
167
|
-
* @returns Promise resolving to Bluetooth state
|
|
168
|
-
*/
|
|
169
|
-
isBluetoothEnabled(): boolean;
|
|
170
|
-
/**
|
|
171
|
-
* Request to enable Bluetooth (Android only)
|
|
172
|
-
* @returns Promise resolving when Bluetooth is enabled
|
|
173
|
-
*/
|
|
174
|
-
requestBluetoothEnable(): Promise<boolean>;
|
|
175
|
-
/**
|
|
176
|
-
* Get the current Bluetooth state
|
|
177
|
-
* @returns Promise resolving to Bluetooth state
|
|
178
|
-
* @see BLEState
|
|
179
|
-
*/
|
|
180
|
-
state(): BLEState;
|
|
181
|
-
/**
|
|
182
|
-
* Subscribe to Bluetooth state changes
|
|
183
|
-
* @param callback Callback function called when state changes
|
|
184
|
-
* @param emitInitial Whether to emit initial state callback
|
|
185
|
-
* @returns Promise resolving when subscription is complete
|
|
186
|
-
* @see BLEState
|
|
187
|
-
*/
|
|
188
|
-
subscribeToStateChange(callback: (state: BLEState) => void, emitInitial?: boolean): Subscription;
|
|
189
|
-
/**
|
|
190
|
-
* Open Bluetooth settings
|
|
191
|
-
* @returns Promise resolving when settings are opened
|
|
192
|
-
*/
|
|
193
|
-
openSettings(): Promise<void>;
|
|
194
|
-
}
|
|
195
|
-
export declare const ble: BleNitro;
|
|
196
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,OAAO,EACL,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,EACtB,KAAK,4BAA4B,EACjC,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,QAAQ,EACR,eAAe,GAChB,MAAM,WAAW,CAAC;AAInB,qBAAa,QAAS,SAAQ,eAAe;WAC7B,QAAQ;CAMvB"}
|