react-native-ble-nitro 1.0.0-beta.18 → 1.0.0-beta.19
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/ios/BleNitroBleManager.swift +29 -85
- package/package.json +1 -1
|
@@ -21,58 +21,40 @@ public class BleNitroBleManager: HybridBleManagerSpec {
|
|
|
21
21
|
// MARK: - HybridBleManagerSpec Implementation (Stubs)
|
|
22
22
|
|
|
23
23
|
public func destroy() throws -> Promise<Void> {
|
|
24
|
-
return Promise
|
|
25
|
-
resolve(())
|
|
26
|
-
}
|
|
24
|
+
return Promise.resolved(withResult: ())
|
|
27
25
|
}
|
|
28
26
|
|
|
29
27
|
public func initialize(options: BleManagerNitroOptions) throws -> Promise<Void> {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
resolve(())
|
|
33
|
-
}
|
|
28
|
+
print("BleNitro: iOS implementation not yet complete")
|
|
29
|
+
return Promise.resolved(withResult: ())
|
|
34
30
|
}
|
|
35
31
|
|
|
36
32
|
public func getRestoredState() throws -> Promise<BleRestoredState?> {
|
|
37
|
-
return Promise
|
|
38
|
-
resolve(nil)
|
|
39
|
-
}
|
|
33
|
+
return Promise.resolved(withResult: nil as BleRestoredState?)
|
|
40
34
|
}
|
|
41
35
|
|
|
42
36
|
public func setLogLevel(logLevel: BleLogLevel) throws -> Promise<BleLogLevel> {
|
|
43
|
-
return Promise
|
|
44
|
-
resolve(logLevel)
|
|
45
|
-
}
|
|
37
|
+
return Promise.resolved(withResult: logLevel)
|
|
46
38
|
}
|
|
47
39
|
|
|
48
40
|
public func logLevel() throws -> Promise<BleLogLevel> {
|
|
49
|
-
return Promise
|
|
50
|
-
resolve(.none)
|
|
51
|
-
}
|
|
41
|
+
return Promise.resolved(withResult: BleLogLevel.none)
|
|
52
42
|
}
|
|
53
43
|
|
|
54
44
|
public func cancelTransaction(transactionId: String) throws -> Promise<Void> {
|
|
55
|
-
return Promise
|
|
56
|
-
resolve(())
|
|
57
|
-
}
|
|
45
|
+
return Promise.resolved(withResult: ())
|
|
58
46
|
}
|
|
59
47
|
|
|
60
48
|
public func enable(transactionId: String?) throws -> Promise<Void> {
|
|
61
|
-
return Promise
|
|
62
|
-
reject(BleError.notImplemented("enable not implemented on iOS yet"))
|
|
63
|
-
}
|
|
49
|
+
return Promise.rejected(withError: BleError.notImplemented("enable not implemented on iOS yet"))
|
|
64
50
|
}
|
|
65
51
|
|
|
66
52
|
public func disable(transactionId: String?) throws -> Promise<Void> {
|
|
67
|
-
return Promise
|
|
68
|
-
reject(BleError.notImplemented("disable not implemented on iOS yet"))
|
|
69
|
-
}
|
|
53
|
+
return Promise.rejected(withError: BleError.notImplemented("disable not implemented on iOS yet"))
|
|
70
54
|
}
|
|
71
55
|
|
|
72
56
|
public func state() throws -> Promise<State> {
|
|
73
|
-
return Promise
|
|
74
|
-
resolve(.unknown)
|
|
75
|
-
}
|
|
57
|
+
return Promise.resolved(withResult: State.unknown)
|
|
76
58
|
}
|
|
77
59
|
|
|
78
60
|
public func onStateChange(listener: @escaping (State) -> Void, emitCurrentState: Bool?) throws -> Subscription {
|
|
@@ -80,57 +62,39 @@ public class BleNitroBleManager: HybridBleManagerSpec {
|
|
|
80
62
|
}
|
|
81
63
|
|
|
82
64
|
public func startDeviceScan(uuids: [String]?, options: ScanOptions?, listener: @escaping (NativeBleError?, NativeDevice?) -> Void) throws -> Promise<Void> {
|
|
83
|
-
return Promise
|
|
84
|
-
reject(BleError.notImplemented("startDeviceScan not implemented on iOS yet"))
|
|
85
|
-
}
|
|
65
|
+
return Promise.rejected(withError: BleError.notImplemented("startDeviceScan not implemented on iOS yet"))
|
|
86
66
|
}
|
|
87
67
|
|
|
88
68
|
public func stopDeviceScan() throws -> Promise<Void> {
|
|
89
|
-
return Promise
|
|
90
|
-
resolve(())
|
|
91
|
-
}
|
|
69
|
+
return Promise.resolved(withResult: ())
|
|
92
70
|
}
|
|
93
71
|
|
|
94
72
|
public func requestConnectionPriorityForDevice(deviceIdentifier: String, connectionPriority: ConnectionPriority, transactionId: String?) throws -> Promise<NativeDevice> {
|
|
95
|
-
return Promise
|
|
96
|
-
reject(BleError.notImplemented("requestConnectionPriorityForDevice not implemented on iOS yet"))
|
|
97
|
-
}
|
|
73
|
+
return Promise.rejected(withError: BleError.notImplemented("requestConnectionPriorityForDevice not implemented on iOS yet"))
|
|
98
74
|
}
|
|
99
75
|
|
|
100
76
|
public func readRSSIForDevice(deviceIdentifier: String, transactionId: String?) throws -> Promise<NativeDevice> {
|
|
101
|
-
return Promise
|
|
102
|
-
reject(BleError.notImplemented("readRSSIForDevice not implemented on iOS yet"))
|
|
103
|
-
}
|
|
77
|
+
return Promise.rejected(withError: BleError.notImplemented("readRSSIForDevice not implemented on iOS yet"))
|
|
104
78
|
}
|
|
105
79
|
|
|
106
80
|
public func requestMTUForDevice(deviceIdentifier: String, mtu: Double, transactionId: String?) throws -> Promise<NativeDevice> {
|
|
107
|
-
return Promise
|
|
108
|
-
reject(BleError.notImplemented("requestMTUForDevice not implemented on iOS yet"))
|
|
109
|
-
}
|
|
81
|
+
return Promise.rejected(withError: BleError.notImplemented("requestMTUForDevice not implemented on iOS yet"))
|
|
110
82
|
}
|
|
111
83
|
|
|
112
84
|
public func devices(deviceIdentifiers: [String]) throws -> Promise<[NativeDevice]> {
|
|
113
|
-
return Promise
|
|
114
|
-
resolve([])
|
|
115
|
-
}
|
|
85
|
+
return Promise.resolved(withResult: [])
|
|
116
86
|
}
|
|
117
87
|
|
|
118
88
|
public func connectedDevices(serviceUUIDs: [String]) throws -> Promise<[NativeDevice]> {
|
|
119
|
-
return Promise
|
|
120
|
-
resolve([])
|
|
121
|
-
}
|
|
89
|
+
return Promise.resolved(withResult: [])
|
|
122
90
|
}
|
|
123
91
|
|
|
124
92
|
public func connectToDevice(deviceIdentifier: String, options: ConnectionOptions?) throws -> Promise<NativeDevice> {
|
|
125
|
-
return Promise
|
|
126
|
-
reject(BleError.notImplemented("connectToDevice not implemented on iOS yet"))
|
|
127
|
-
}
|
|
93
|
+
return Promise.rejected(withError: BleError.notImplemented("connectToDevice not implemented on iOS yet"))
|
|
128
94
|
}
|
|
129
95
|
|
|
130
96
|
public func cancelDeviceConnection(deviceIdentifier: String) throws -> Promise<NativeDevice> {
|
|
131
|
-
return Promise
|
|
132
|
-
reject(BleError.notImplemented("cancelDeviceConnection not implemented on iOS yet"))
|
|
133
|
-
}
|
|
97
|
+
return Promise.rejected(withError: BleError.notImplemented("cancelDeviceConnection not implemented on iOS yet"))
|
|
134
98
|
}
|
|
135
99
|
|
|
136
100
|
public func onDeviceDisconnected(deviceIdentifier: String, listener: @escaping (NativeBleError?, NativeDevice?) -> Void) throws -> Subscription {
|
|
@@ -138,45 +102,31 @@ public class BleNitroBleManager: HybridBleManagerSpec {
|
|
|
138
102
|
}
|
|
139
103
|
|
|
140
104
|
public func isDeviceConnected(deviceIdentifier: String) throws -> Promise<Bool> {
|
|
141
|
-
return Promise
|
|
142
|
-
resolve(false)
|
|
143
|
-
}
|
|
105
|
+
return Promise.resolved(withResult: false)
|
|
144
106
|
}
|
|
145
107
|
|
|
146
108
|
public func discoverAllServicesAndCharacteristicsForDevice(deviceIdentifier: String, transactionId: String?) throws -> Promise<NativeDevice> {
|
|
147
|
-
return Promise
|
|
148
|
-
reject(BleError.notImplemented("discoverAllServicesAndCharacteristicsForDevice not implemented on iOS yet"))
|
|
149
|
-
}
|
|
109
|
+
return Promise.rejected(withError: BleError.notImplemented("discoverAllServicesAndCharacteristicsForDevice not implemented on iOS yet"))
|
|
150
110
|
}
|
|
151
111
|
|
|
152
112
|
public func servicesForDevice(deviceIdentifier: String) throws -> Promise<[NativeService]> {
|
|
153
|
-
return Promise
|
|
154
|
-
resolve([])
|
|
155
|
-
}
|
|
113
|
+
return Promise.resolved(withResult: [])
|
|
156
114
|
}
|
|
157
115
|
|
|
158
116
|
public func characteristicsForDevice(deviceIdentifier: String, serviceUUID: String) throws -> Promise<[NativeCharacteristic]> {
|
|
159
|
-
return Promise
|
|
160
|
-
resolve([])
|
|
161
|
-
}
|
|
117
|
+
return Promise.resolved(withResult: [])
|
|
162
118
|
}
|
|
163
119
|
|
|
164
120
|
public func readCharacteristicForDevice(deviceIdentifier: String, serviceUUID: String, characteristicUUID: String, transactionId: String?) throws -> Promise<NativeCharacteristic> {
|
|
165
|
-
return Promise
|
|
166
|
-
reject(BleError.notImplemented("readCharacteristicForDevice not implemented on iOS yet"))
|
|
167
|
-
}
|
|
121
|
+
return Promise.rejected(withError: BleError.notImplemented("readCharacteristicForDevice not implemented on iOS yet"))
|
|
168
122
|
}
|
|
169
123
|
|
|
170
124
|
public func writeCharacteristicWithResponseForDevice(deviceIdentifier: String, serviceUUID: String, characteristicUUID: String, base64Value: String, transactionId: String?) throws -> Promise<NativeCharacteristic> {
|
|
171
|
-
return Promise
|
|
172
|
-
reject(BleError.notImplemented("writeCharacteristicWithResponseForDevice not implemented on iOS yet"))
|
|
173
|
-
}
|
|
125
|
+
return Promise.rejected(withError: BleError.notImplemented("writeCharacteristicWithResponseForDevice not implemented on iOS yet"))
|
|
174
126
|
}
|
|
175
127
|
|
|
176
128
|
public func writeCharacteristicWithoutResponseForDevice(deviceIdentifier: String, serviceUUID: String, characteristicUUID: String, base64Value: String, transactionId: String?) throws -> Promise<NativeCharacteristic> {
|
|
177
|
-
return Promise
|
|
178
|
-
reject(BleError.notImplemented("writeCharacteristicWithoutResponseForDevice not implemented on iOS yet"))
|
|
179
|
-
}
|
|
129
|
+
return Promise.rejected(withError: BleError.notImplemented("writeCharacteristicWithoutResponseForDevice not implemented on iOS yet"))
|
|
180
130
|
}
|
|
181
131
|
|
|
182
132
|
public func monitorCharacteristicForDevice(deviceIdentifier: String, serviceUUID: String, characteristicUUID: String, listener: @escaping (NativeBleError?, NativeCharacteristic?) -> Void, transactionId: String?, subscriptionType: CharacteristicSubscriptionType?) throws -> Subscription {
|
|
@@ -184,21 +134,15 @@ public class BleNitroBleManager: HybridBleManagerSpec {
|
|
|
184
134
|
}
|
|
185
135
|
|
|
186
136
|
public func descriptorsForDevice(deviceIdentifier: String, serviceUUID: String, characteristicUUID: String) throws -> Promise<[NativeDescriptor]> {
|
|
187
|
-
return Promise
|
|
188
|
-
resolve([])
|
|
189
|
-
}
|
|
137
|
+
return Promise.resolved(withResult: [])
|
|
190
138
|
}
|
|
191
139
|
|
|
192
140
|
public func readDescriptorForDevice(deviceIdentifier: String, serviceUUID: String, characteristicUUID: String, descriptorUUID: String, transactionId: String?) throws -> Promise<NativeDescriptor> {
|
|
193
|
-
return Promise
|
|
194
|
-
reject(BleError.notImplemented("readDescriptorForDevice not implemented on iOS yet"))
|
|
195
|
-
}
|
|
141
|
+
return Promise.rejected(withError: BleError.notImplemented("readDescriptorForDevice not implemented on iOS yet"))
|
|
196
142
|
}
|
|
197
143
|
|
|
198
144
|
public func writeDescriptorForDevice(deviceIdentifier: String, serviceUUID: String, characteristicUUID: String, descriptorUUID: String, valueBase64: String, transactionId: String?) throws -> Promise<NativeDescriptor> {
|
|
199
|
-
return Promise
|
|
200
|
-
reject(BleError.notImplemented("writeDescriptorForDevice not implemented on iOS yet"))
|
|
201
|
-
}
|
|
145
|
+
return Promise.rejected(withError: BleError.notImplemented("writeDescriptorForDevice not implemented on iOS yet"))
|
|
202
146
|
}
|
|
203
147
|
}
|
|
204
148
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-ble-nitro",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.19",
|
|
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",
|