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