react-native-ble-nitro 1.0.0-beta.16 → 1.0.0-beta.17

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.
@@ -12,7 +12,7 @@ import NitroModules
12
12
  * Minimal BLE Manager implementation stub for iOS
13
13
  * TODO: Implement full CoreBluetooth integration
14
14
  */
15
- public class BleNitroBleManager: NSObject, HybridBleManagerSpec {
15
+ public class BleNitroBleManager: HybridBleManagerSpec {
16
16
 
17
17
  public var memorySize: Int {
18
18
  return MemorySize.MemorySize_estimate(self)
@@ -20,156 +20,129 @@ public class BleNitroBleManager: NSObject, HybridBleManagerSpec {
20
20
 
21
21
  // MARK: - HybridBleManagerSpec Implementation (Stubs)
22
22
 
23
- public func destroy() async throws {
24
- // TODO: Implement destroy
23
+ public func destroy() throws -> Promise<Void> {
24
+ return Promise.resolve(withResult: ())
25
25
  }
26
26
 
27
- public func initialize(options: BleManagerNitroOptions) async throws {
28
- // TODO: Implement initialize
27
+ public func initialize(options: BleManagerNitroOptions) throws -> Promise<Void> {
29
28
  print("BleNitro: iOS implementation not yet complete")
29
+ return Promise.resolve(withResult: ())
30
30
  }
31
31
 
32
- public func getRestoredState() async throws -> BleRestoredState? {
33
- // TODO: Implement getRestoredState
34
- return nil
32
+ public func getRestoredState() throws -> Promise<BleRestoredState?> {
33
+ return Promise.resolve(withResult: nil)
35
34
  }
36
35
 
37
- public func setLogLevel(logLevel: BleLogLevel) async throws -> BleLogLevel {
38
- // TODO: Implement setLogLevel
39
- return logLevel
36
+ public func setLogLevel(logLevel: BleLogLevel) throws -> Promise<BleLogLevel> {
37
+ return Promise.resolve(withResult: logLevel)
40
38
  }
41
39
 
42
- public func logLevel() async throws -> BleLogLevel {
43
- // TODO: Implement logLevel
44
- return .none
40
+ public func logLevel() throws -> Promise<BleLogLevel> {
41
+ return Promise.resolve(withResult: .none)
45
42
  }
46
43
 
47
- public func cancelTransaction(transactionId: String) async throws {
48
- // TODO: Implement cancelTransaction
44
+ public func cancelTransaction(transactionId: String) throws -> Promise<Void> {
45
+ return Promise.resolve(withResult: ())
49
46
  }
50
47
 
51
- public func enable(transactionId: String?) async throws {
52
- // TODO: Implement enable
53
- throw BleError.notImplemented("enable not implemented on iOS yet")
48
+ public func enable(transactionId: String?) throws -> Promise<Void> {
49
+ return Promise.reject(error: BleError.notImplemented("enable not implemented on iOS yet"))
54
50
  }
55
51
 
56
- public func disable(transactionId: String?) async throws {
57
- // TODO: Implement disable
58
- throw BleError.notImplemented("disable not implemented on iOS yet")
52
+ public func disable(transactionId: String?) throws -> Promise<Void> {
53
+ return Promise.reject(error: BleError.notImplemented("disable not implemented on iOS yet"))
59
54
  }
60
55
 
61
- public func state() async throws -> State {
62
- // TODO: Implement state
63
- return .unknown
56
+ public func state() throws -> Promise<State> {
57
+ return Promise.resolve(withResult: .unknown)
64
58
  }
65
59
 
66
60
  public func onStateChange(listener: @escaping (State) -> Void, emitCurrentState: Bool?) throws -> Subscription {
67
- // TODO: Implement onStateChange
68
61
  return Subscription(remove: {})
69
62
  }
70
63
 
71
- public func startDeviceScan(uuids: [String]?, options: ScanOptions?, listener: @escaping (NativeBleError?, NativeDevice?) -> Void) async throws {
72
- // TODO: Implement startDeviceScan
73
- throw BleError.notImplemented("startDeviceScan not implemented on iOS yet")
64
+ public func startDeviceScan(uuids: [String]?, options: ScanOptions?, listener: @escaping (NativeBleError?, NativeDevice?) -> Void) throws -> Promise<Void> {
65
+ return Promise.reject(error: BleError.notImplemented("startDeviceScan not implemented on iOS yet"))
74
66
  }
75
67
 
76
- public func stopDeviceScan() async throws {
77
- // TODO: Implement stopDeviceScan
68
+ public func stopDeviceScan() throws -> Promise<Void> {
69
+ return Promise.resolve(withResult: ())
78
70
  }
79
71
 
80
- public func requestConnectionPriorityForDevice(deviceIdentifier: String, connectionPriority: ConnectionPriority, transactionId: String?) async throws -> NativeDevice {
81
- // TODO: Implement requestConnectionPriorityForDevice
82
- throw BleError.notImplemented("requestConnectionPriorityForDevice not implemented on iOS yet")
72
+ public func requestConnectionPriorityForDevice(deviceIdentifier: String, connectionPriority: ConnectionPriority, transactionId: String?) throws -> Promise<NativeDevice> {
73
+ return Promise.reject(error: BleError.notImplemented("requestConnectionPriorityForDevice not implemented on iOS yet"))
83
74
  }
84
75
 
85
- public func readRSSIForDevice(deviceIdentifier: String, transactionId: String?) async throws -> NativeDevice {
86
- // TODO: Implement readRSSIForDevice
87
- throw BleError.notImplemented("readRSSIForDevice not implemented on iOS yet")
76
+ public func readRSSIForDevice(deviceIdentifier: String, transactionId: String?) throws -> Promise<NativeDevice> {
77
+ return Promise.reject(error: BleError.notImplemented("readRSSIForDevice not implemented on iOS yet"))
88
78
  }
89
79
 
90
- public func requestMTUForDevice(deviceIdentifier: String, mtu: Double, transactionId: String?) async throws -> NativeDevice {
91
- // TODO: Implement requestMTUForDevice
92
- throw BleError.notImplemented("requestMTUForDevice not implemented on iOS yet")
80
+ public func requestMTUForDevice(deviceIdentifier: String, mtu: Double, transactionId: String?) throws -> Promise<NativeDevice> {
81
+ return Promise.reject(error: BleError.notImplemented("requestMTUForDevice not implemented on iOS yet"))
93
82
  }
94
83
 
95
- public func devices(deviceIdentifiers: [String]) async throws -> [NativeDevice] {
96
- // TODO: Implement devices
97
- return []
84
+ public func devices(deviceIdentifiers: [String]) throws -> Promise<[NativeDevice]> {
85
+ return Promise.resolve(withResult: [])
98
86
  }
99
87
 
100
- public func connectedDevices(serviceUUIDs: [String]) async throws -> [NativeDevice] {
101
- // TODO: Implement connectedDevices
102
- return []
88
+ public func connectedDevices(serviceUUIDs: [String]) throws -> Promise<[NativeDevice]> {
89
+ return Promise.resolve(withResult: [])
103
90
  }
104
91
 
105
- public func connectToDevice(deviceIdentifier: String, options: ConnectionOptions?) async throws -> NativeDevice {
106
- // TODO: Implement connectToDevice
107
- throw BleError.notImplemented("connectToDevice not implemented on iOS yet")
92
+ public func connectToDevice(deviceIdentifier: String, options: ConnectionOptions?) throws -> Promise<NativeDevice> {
93
+ return Promise.reject(error: BleError.notImplemented("connectToDevice not implemented on iOS yet"))
108
94
  }
109
95
 
110
- public func cancelDeviceConnection(deviceIdentifier: String) async throws -> NativeDevice {
111
- // TODO: Implement cancelDeviceConnection
112
- throw BleError.notImplemented("cancelDeviceConnection not implemented on iOS yet")
96
+ public func cancelDeviceConnection(deviceIdentifier: String) throws -> Promise<NativeDevice> {
97
+ return Promise.reject(error: BleError.notImplemented("cancelDeviceConnection not implemented on iOS yet"))
113
98
  }
114
99
 
115
100
  public func onDeviceDisconnected(deviceIdentifier: String, listener: @escaping (NativeBleError?, NativeDevice?) -> Void) throws -> Subscription {
116
- // TODO: Implement onDeviceDisconnected
117
101
  return Subscription(remove: {})
118
102
  }
119
103
 
120
- public func isDeviceConnected(deviceIdentifier: String) async throws -> Bool {
121
- // TODO: Implement isDeviceConnected
122
- return false
104
+ public func isDeviceConnected(deviceIdentifier: String) throws -> Promise<Bool> {
105
+ return Promise.resolve(withResult: false)
123
106
  }
124
107
 
125
- public func discoverAllServicesAndCharacteristicsForDevice(deviceIdentifier: String, transactionId: String?) async throws -> NativeDevice {
126
- // TODO: Implement discoverAllServicesAndCharacteristicsForDevice
127
- throw BleError.notImplemented("discoverAllServicesAndCharacteristicsForDevice not implemented on iOS yet")
108
+ public func discoverAllServicesAndCharacteristicsForDevice(deviceIdentifier: String, transactionId: String?) throws -> Promise<NativeDevice> {
109
+ return Promise.reject(error: BleError.notImplemented("discoverAllServicesAndCharacteristicsForDevice not implemented on iOS yet"))
128
110
  }
129
111
 
130
- public func servicesForDevice(deviceIdentifier: String) async throws -> [NativeService] {
131
- // TODO: Implement servicesForDevice
132
- return []
112
+ public func servicesForDevice(deviceIdentifier: String) throws -> Promise<[NativeService]> {
113
+ return Promise.resolve(withResult: [])
133
114
  }
134
115
 
135
- public func characteristicsForDevice(deviceIdentifier: String, serviceUUID: String) async throws -> [NativeCharacteristic] {
136
- // TODO: Implement characteristicsForDevice
137
- return []
116
+ public func characteristicsForDevice(deviceIdentifier: String, serviceUUID: String) throws -> Promise<[NativeCharacteristic]> {
117
+ return Promise.resolve(withResult: [])
138
118
  }
139
119
 
140
- public func readCharacteristicForDevice(deviceIdentifier: String, serviceUUID: String, characteristicUUID: String, transactionId: String?) async throws -> NativeCharacteristic {
141
- // TODO: Implement readCharacteristicForDevice
142
- throw BleError.notImplemented("readCharacteristicForDevice not implemented on iOS yet")
120
+ public func readCharacteristicForDevice(deviceIdentifier: String, serviceUUID: String, characteristicUUID: String, transactionId: String?) throws -> Promise<NativeCharacteristic> {
121
+ return Promise.reject(error: BleError.notImplemented("readCharacteristicForDevice not implemented on iOS yet"))
143
122
  }
144
123
 
145
- public func writeCharacteristicWithResponseForDevice(deviceIdentifier: String, serviceUUID: String, characteristicUUID: String, base64Value: String, transactionId: String?) async throws -> NativeCharacteristic {
146
- // TODO: Implement writeCharacteristicWithResponseForDevice
147
- throw BleError.notImplemented("writeCharacteristicWithResponseForDevice not implemented on iOS yet")
124
+ public func writeCharacteristicWithResponseForDevice(deviceIdentifier: String, serviceUUID: String, characteristicUUID: String, base64Value: String, transactionId: String?) throws -> Promise<NativeCharacteristic> {
125
+ return Promise.reject(error: BleError.notImplemented("writeCharacteristicWithResponseForDevice not implemented on iOS yet"))
148
126
  }
149
127
 
150
- public func writeCharacteristicWithoutResponseForDevice(deviceIdentifier: String, serviceUUID: String, characteristicUUID: String, base64Value: String, transactionId: String?) async throws -> NativeCharacteristic {
151
- // TODO: Implement writeCharacteristicWithoutResponseForDevice
152
- throw BleError.notImplemented("writeCharacteristicWithoutResponseForDevice not implemented on iOS yet")
128
+ public func writeCharacteristicWithoutResponseForDevice(deviceIdentifier: String, serviceUUID: String, characteristicUUID: String, base64Value: String, transactionId: String?) throws -> Promise<NativeCharacteristic> {
129
+ return Promise.reject(error: BleError.notImplemented("writeCharacteristicWithoutResponseForDevice not implemented on iOS yet"))
153
130
  }
154
131
 
155
132
  public func monitorCharacteristicForDevice(deviceIdentifier: String, serviceUUID: String, characteristicUUID: String, listener: @escaping (NativeBleError?, NativeCharacteristic?) -> Void, transactionId: String?, subscriptionType: CharacteristicSubscriptionType?) throws -> Subscription {
156
- // TODO: Implement monitorCharacteristicForDevice
157
133
  return Subscription(remove: {})
158
134
  }
159
135
 
160
- public func descriptorsForDevice(deviceIdentifier: String, serviceUUID: String, characteristicUUID: String) async throws -> [NativeDescriptor] {
161
- // TODO: Implement descriptorsForDevice
162
- return []
136
+ public func descriptorsForDevice(deviceIdentifier: String, serviceUUID: String, characteristicUUID: String) throws -> Promise<[NativeDescriptor]> {
137
+ return Promise.resolve(withResult: [])
163
138
  }
164
139
 
165
- public func readDescriptorForDevice(deviceIdentifier: String, serviceUUID: String, characteristicUUID: String, descriptorUUID: String, transactionId: String?) async throws -> NativeDescriptor {
166
- // TODO: Implement readDescriptorForDevice
167
- throw BleError.notImplemented("readDescriptorForDevice not implemented on iOS yet")
140
+ public func readDescriptorForDevice(deviceIdentifier: String, serviceUUID: String, characteristicUUID: String, descriptorUUID: String, transactionId: String?) throws -> Promise<NativeDescriptor> {
141
+ return Promise.reject(error: BleError.notImplemented("readDescriptorForDevice not implemented on iOS yet"))
168
142
  }
169
143
 
170
- public func writeDescriptorForDevice(deviceIdentifier: String, serviceUUID: String, characteristicUUID: String, descriptorUUID: String, valueBase64: String, transactionId: String?) async throws -> NativeDescriptor {
171
- // TODO: Implement writeDescriptorForDevice
172
- throw BleError.notImplemented("writeDescriptorForDevice not implemented on iOS yet")
144
+ public func writeDescriptorForDevice(deviceIdentifier: String, serviceUUID: String, characteristicUUID: String, descriptorUUID: String, valueBase64: String, transactionId: String?) throws -> Promise<NativeDescriptor> {
145
+ return Promise.reject(error: BleError.notImplemented("writeDescriptorForDevice not implemented on iOS yet"))
173
146
  }
174
147
  }
175
148
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-ble-nitro",
3
- "version": "1.0.0-beta.16",
3
+ "version": "1.0.0-beta.17",
4
4
  "description": "High-performance React Native BLE library built on Nitro Modules - drop-in replacement for react-native-ble-plx",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",