munim-bluetooth 0.2.8 → 0.3.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.
Files changed (70) hide show
  1. package/lib/typescript/src/specs/munim-bluetooth.nitro.d.ts +24 -25
  2. package/lib/typescript/src/specs/munim-bluetooth.nitro.d.ts.map +1 -1
  3. package/nitrogen/generated/.gitattributes +1 -0
  4. package/nitrogen/generated/android/MunimBluetooth+autolinking.cmake +81 -0
  5. package/nitrogen/generated/android/MunimBluetooth+autolinking.gradle +27 -0
  6. package/nitrogen/generated/android/MunimBluetoothOnLoad.cpp +44 -0
  7. package/nitrogen/generated/android/MunimBluetoothOnLoad.hpp +25 -0
  8. package/nitrogen/generated/android/c++/JAdvertisingDataTypes.hpp +345 -0
  9. package/nitrogen/generated/android/c++/JAdvertisingOptions.hpp +93 -0
  10. package/nitrogen/generated/android/c++/JCharacteristicValue.hpp +65 -0
  11. package/nitrogen/generated/android/c++/JGATTCharacteristic.hpp +85 -0
  12. package/nitrogen/generated/android/c++/JGATTService.hpp +83 -0
  13. package/nitrogen/generated/android/c++/JHybridMunimBluetoothSpec.cpp +307 -0
  14. package/nitrogen/generated/android/c++/JHybridMunimBluetoothSpec.hpp +85 -0
  15. package/nitrogen/generated/android/c++/JScanMode.hpp +61 -0
  16. package/nitrogen/generated/android/c++/JScanOptions.hpp +87 -0
  17. package/nitrogen/generated/android/c++/JServiceDataEntry.hpp +61 -0
  18. package/nitrogen/generated/android/c++/JWriteType.hpp +58 -0
  19. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/AdvertisingDataTypes.kt +89 -0
  20. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/AdvertisingOptions.kt +47 -0
  21. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/CharacteristicValue.kt +44 -0
  22. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/GATTCharacteristic.kt +44 -0
  23. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/GATTService.kt +41 -0
  24. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/HybridMunimBluetoothSpec.kt +134 -0
  25. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/MunimBluetoothOnLoad.kt +35 -0
  26. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/ScanMode.kt +24 -0
  27. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/ScanOptions.kt +44 -0
  28. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/ServiceDataEntry.kt +41 -0
  29. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/WriteType.kt +23 -0
  30. package/nitrogen/generated/ios/MunimBluetooth+autolinking.rb +60 -0
  31. package/nitrogen/generated/ios/MunimBluetooth-Swift-Cxx-Bridge.cpp +97 -0
  32. package/nitrogen/generated/ios/MunimBluetooth-Swift-Cxx-Bridge.hpp +583 -0
  33. package/nitrogen/generated/ios/MunimBluetooth-Swift-Cxx-Umbrella.hpp +74 -0
  34. package/nitrogen/generated/ios/MunimBluetoothAutolinking.mm +33 -0
  35. package/nitrogen/generated/ios/MunimBluetoothAutolinking.swift +44 -0
  36. package/nitrogen/generated/ios/c++/HybridMunimBluetoothSpecSwift.cpp +11 -0
  37. package/nitrogen/generated/ios/c++/HybridMunimBluetoothSpecSwift.hpp +241 -0
  38. package/nitrogen/generated/ios/swift/AdvertisingDataTypes.swift +400 -0
  39. package/nitrogen/generated/ios/swift/AdvertisingOptions.swift +83 -0
  40. package/nitrogen/generated/ios/swift/CharacteristicValue.swift +40 -0
  41. package/nitrogen/generated/ios/swift/Func_void.swift +47 -0
  42. package/nitrogen/generated/ios/swift/Func_void_AdvertisingDataTypes.swift +47 -0
  43. package/nitrogen/generated/ios/swift/Func_void_CharacteristicValue.swift +47 -0
  44. package/nitrogen/generated/ios/swift/Func_void_bool.swift +47 -0
  45. package/nitrogen/generated/ios/swift/Func_void_double.swift +47 -0
  46. package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +47 -0
  47. package/nitrogen/generated/ios/swift/Func_void_std__vector_GATTService_.swift +47 -0
  48. package/nitrogen/generated/ios/swift/Func_void_std__vector_std__string_.swift +47 -0
  49. package/nitrogen/generated/ios/swift/GATTCharacteristic.swift +59 -0
  50. package/nitrogen/generated/ios/swift/GATTService.swift +41 -0
  51. package/nitrogen/generated/ios/swift/HybridMunimBluetoothSpec.swift +75 -0
  52. package/nitrogen/generated/ios/swift/HybridMunimBluetoothSpec_cxx.swift +431 -0
  53. package/nitrogen/generated/ios/swift/ScanMode.swift +44 -0
  54. package/nitrogen/generated/ios/swift/ScanOptions.swift +78 -0
  55. package/nitrogen/generated/ios/swift/ServiceDataEntry.swift +35 -0
  56. package/nitrogen/generated/ios/swift/WriteType.swift +40 -0
  57. package/nitrogen/generated/shared/c++/AdvertisingDataTypes.hpp +155 -0
  58. package/nitrogen/generated/shared/c++/AdvertisingOptions.hpp +99 -0
  59. package/nitrogen/generated/shared/c++/CharacteristicValue.hpp +91 -0
  60. package/nitrogen/generated/shared/c++/GATTCharacteristic.hpp +93 -0
  61. package/nitrogen/generated/shared/c++/GATTService.hpp +90 -0
  62. package/nitrogen/generated/shared/c++/HybridMunimBluetoothSpec.cpp +40 -0
  63. package/nitrogen/generated/shared/c++/HybridMunimBluetoothSpec.hpp +101 -0
  64. package/nitrogen/generated/shared/c++/ScanMode.hpp +80 -0
  65. package/nitrogen/generated/shared/c++/ScanOptions.hpp +95 -0
  66. package/nitrogen/generated/shared/c++/ServiceDataEntry.hpp +87 -0
  67. package/nitrogen/generated/shared/c++/WriteType.hpp +76 -0
  68. package/package.json +9 -9
  69. package/src/specs/munim-bluetooth.nitro.ts +34 -25
  70. package/lib/module/package.json +0 -1
@@ -0,0 +1,431 @@
1
+ ///
2
+ /// HybridMunimBluetoothSpec_cxx.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ import Foundation
9
+ import NitroModules
10
+
11
+ /**
12
+ * A class implementation that bridges HybridMunimBluetoothSpec over to C++.
13
+ * In C++, we cannot use Swift protocols - so we need to wrap it in a class to make it strongly defined.
14
+ *
15
+ * Also, some Swift types need to be bridged with special handling:
16
+ * - Enums need to be wrapped in Structs, otherwise they cannot be accessed bi-directionally (Swift bug: https://github.com/swiftlang/swift/issues/75330)
17
+ * - Other HybridObjects need to be wrapped/unwrapped from the Swift TCxx wrapper
18
+ * - Throwing methods need to be wrapped with a Result<T, Error> type, as exceptions cannot be propagated to C++
19
+ */
20
+ open class HybridMunimBluetoothSpec_cxx {
21
+ /**
22
+ * The Swift <> C++ bridge's namespace (`margelo::nitro::munimbluetooth::bridge::swift`)
23
+ * from `MunimBluetooth-Swift-Cxx-Bridge.hpp`.
24
+ * This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift.
25
+ */
26
+ public typealias bridge = margelo.nitro.munimbluetooth.bridge.swift
27
+
28
+ /**
29
+ * Holds an instance of the `HybridMunimBluetoothSpec` Swift protocol.
30
+ */
31
+ private var __implementation: any HybridMunimBluetoothSpec
32
+
33
+ /**
34
+ * Holds a weak pointer to the C++ class that wraps the Swift class.
35
+ */
36
+ private var __cxxPart: bridge.std__weak_ptr_HybridMunimBluetoothSpec_
37
+
38
+ /**
39
+ * Create a new `HybridMunimBluetoothSpec_cxx` that wraps the given `HybridMunimBluetoothSpec`.
40
+ * All properties and methods bridge to C++ types.
41
+ */
42
+ public init(_ implementation: any HybridMunimBluetoothSpec) {
43
+ self.__implementation = implementation
44
+ self.__cxxPart = .init()
45
+ /* no base class */
46
+ }
47
+
48
+ /**
49
+ * Get the actual `HybridMunimBluetoothSpec` instance this class wraps.
50
+ */
51
+ @inline(__always)
52
+ public func getHybridMunimBluetoothSpec() -> any HybridMunimBluetoothSpec {
53
+ return __implementation
54
+ }
55
+
56
+ /**
57
+ * Casts this instance to a retained unsafe raw pointer.
58
+ * This acquires one additional strong reference on the object!
59
+ */
60
+ public func toUnsafe() -> UnsafeMutableRawPointer {
61
+ return Unmanaged.passRetained(self).toOpaque()
62
+ }
63
+
64
+ /**
65
+ * Casts an unsafe pointer to a `HybridMunimBluetoothSpec_cxx`.
66
+ * The pointer has to be a retained opaque `Unmanaged<HybridMunimBluetoothSpec_cxx>`.
67
+ * This removes one strong reference from the object!
68
+ */
69
+ public class func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridMunimBluetoothSpec_cxx {
70
+ return Unmanaged<HybridMunimBluetoothSpec_cxx>.fromOpaque(pointer).takeRetainedValue()
71
+ }
72
+
73
+ /**
74
+ * Gets (or creates) the C++ part of this Hybrid Object.
75
+ * The C++ part is a `std::shared_ptr<HybridMunimBluetoothSpec>`.
76
+ */
77
+ public func getCxxPart() -> bridge.std__shared_ptr_HybridMunimBluetoothSpec_ {
78
+ let cachedCxxPart = self.__cxxPart.lock()
79
+ if Bool(fromCxx: cachedCxxPart) {
80
+ return cachedCxxPart
81
+ } else {
82
+ let newCxxPart = bridge.create_std__shared_ptr_HybridMunimBluetoothSpec_(self.toUnsafe())
83
+ __cxxPart = bridge.weakify_std__shared_ptr_HybridMunimBluetoothSpec_(newCxxPart)
84
+ return newCxxPart
85
+ }
86
+ }
87
+
88
+
89
+
90
+ /**
91
+ * Get the memory size of the Swift class (plus size of any other allocations)
92
+ * so the JS VM can properly track it and garbage-collect the JS object if needed.
93
+ */
94
+ @inline(__always)
95
+ public var memorySize: Int {
96
+ return MemoryHelper.getSizeOf(self.__implementation) + self.__implementation.memorySize
97
+ }
98
+
99
+ /**
100
+ * Compares this object with the given [other] object for reference equality.
101
+ */
102
+ @inline(__always)
103
+ public func equals(other: HybridMunimBluetoothSpec_cxx) -> Bool {
104
+ return self.__implementation === other.__implementation
105
+ }
106
+
107
+ /**
108
+ * Call dispose() on the Swift class.
109
+ * This _may_ be called manually from JS.
110
+ */
111
+ @inline(__always)
112
+ public func dispose() {
113
+ self.__implementation.dispose()
114
+ }
115
+
116
+ /**
117
+ * Call toString() on the Swift class.
118
+ */
119
+ @inline(__always)
120
+ public func toString() -> String {
121
+ return self.__implementation.toString()
122
+ }
123
+
124
+ // Properties
125
+
126
+
127
+ // Methods
128
+ @inline(__always)
129
+ public final func startAdvertising(options: AdvertisingOptions) -> bridge.Result_void_ {
130
+ do {
131
+ try self.__implementation.startAdvertising(options: options)
132
+ return bridge.create_Result_void_()
133
+ } catch (let __error) {
134
+ let __exceptionPtr = __error.toCpp()
135
+ return bridge.create_Result_void_(__exceptionPtr)
136
+ }
137
+ }
138
+
139
+ @inline(__always)
140
+ public final func updateAdvertisingData(advertisingData: AdvertisingDataTypes) -> bridge.Result_void_ {
141
+ do {
142
+ try self.__implementation.updateAdvertisingData(advertisingData: advertisingData)
143
+ return bridge.create_Result_void_()
144
+ } catch (let __error) {
145
+ let __exceptionPtr = __error.toCpp()
146
+ return bridge.create_Result_void_(__exceptionPtr)
147
+ }
148
+ }
149
+
150
+ @inline(__always)
151
+ public final func getAdvertisingData() -> bridge.Result_std__shared_ptr_Promise_AdvertisingDataTypes___ {
152
+ do {
153
+ let __result = try self.__implementation.getAdvertisingData()
154
+ let __resultCpp = { () -> bridge.std__shared_ptr_Promise_AdvertisingDataTypes__ in
155
+ let __promise = bridge.create_std__shared_ptr_Promise_AdvertisingDataTypes__()
156
+ let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_AdvertisingDataTypes__(__promise)
157
+ __result
158
+ .then({ __result in __promiseHolder.resolve(__result) })
159
+ .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
160
+ return __promise
161
+ }()
162
+ return bridge.create_Result_std__shared_ptr_Promise_AdvertisingDataTypes___(__resultCpp)
163
+ } catch (let __error) {
164
+ let __exceptionPtr = __error.toCpp()
165
+ return bridge.create_Result_std__shared_ptr_Promise_AdvertisingDataTypes___(__exceptionPtr)
166
+ }
167
+ }
168
+
169
+ @inline(__always)
170
+ public final func stopAdvertising() -> bridge.Result_void_ {
171
+ do {
172
+ try self.__implementation.stopAdvertising()
173
+ return bridge.create_Result_void_()
174
+ } catch (let __error) {
175
+ let __exceptionPtr = __error.toCpp()
176
+ return bridge.create_Result_void_(__exceptionPtr)
177
+ }
178
+ }
179
+
180
+ @inline(__always)
181
+ public final func setServices(services: bridge.std__vector_GATTService_) -> bridge.Result_void_ {
182
+ do {
183
+ try self.__implementation.setServices(services: services.map({ __item in __item }))
184
+ return bridge.create_Result_void_()
185
+ } catch (let __error) {
186
+ let __exceptionPtr = __error.toCpp()
187
+ return bridge.create_Result_void_(__exceptionPtr)
188
+ }
189
+ }
190
+
191
+ @inline(__always)
192
+ public final func isBluetoothEnabled() -> bridge.Result_std__shared_ptr_Promise_bool___ {
193
+ do {
194
+ let __result = try self.__implementation.isBluetoothEnabled()
195
+ let __resultCpp = { () -> bridge.std__shared_ptr_Promise_bool__ in
196
+ let __promise = bridge.create_std__shared_ptr_Promise_bool__()
197
+ let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_bool__(__promise)
198
+ __result
199
+ .then({ __result in __promiseHolder.resolve(__result) })
200
+ .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
201
+ return __promise
202
+ }()
203
+ return bridge.create_Result_std__shared_ptr_Promise_bool___(__resultCpp)
204
+ } catch (let __error) {
205
+ let __exceptionPtr = __error.toCpp()
206
+ return bridge.create_Result_std__shared_ptr_Promise_bool___(__exceptionPtr)
207
+ }
208
+ }
209
+
210
+ @inline(__always)
211
+ public final func requestBluetoothPermission() -> bridge.Result_std__shared_ptr_Promise_bool___ {
212
+ do {
213
+ let __result = try self.__implementation.requestBluetoothPermission()
214
+ let __resultCpp = { () -> bridge.std__shared_ptr_Promise_bool__ in
215
+ let __promise = bridge.create_std__shared_ptr_Promise_bool__()
216
+ let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_bool__(__promise)
217
+ __result
218
+ .then({ __result in __promiseHolder.resolve(__result) })
219
+ .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
220
+ return __promise
221
+ }()
222
+ return bridge.create_Result_std__shared_ptr_Promise_bool___(__resultCpp)
223
+ } catch (let __error) {
224
+ let __exceptionPtr = __error.toCpp()
225
+ return bridge.create_Result_std__shared_ptr_Promise_bool___(__exceptionPtr)
226
+ }
227
+ }
228
+
229
+ @inline(__always)
230
+ public final func startScan(options: bridge.std__optional_ScanOptions_) -> bridge.Result_void_ {
231
+ do {
232
+ try self.__implementation.startScan(options: options.value)
233
+ return bridge.create_Result_void_()
234
+ } catch (let __error) {
235
+ let __exceptionPtr = __error.toCpp()
236
+ return bridge.create_Result_void_(__exceptionPtr)
237
+ }
238
+ }
239
+
240
+ @inline(__always)
241
+ public final func stopScan() -> bridge.Result_void_ {
242
+ do {
243
+ try self.__implementation.stopScan()
244
+ return bridge.create_Result_void_()
245
+ } catch (let __error) {
246
+ let __exceptionPtr = __error.toCpp()
247
+ return bridge.create_Result_void_(__exceptionPtr)
248
+ }
249
+ }
250
+
251
+ @inline(__always)
252
+ public final func connect(deviceId: std.string) -> bridge.Result_std__shared_ptr_Promise_void___ {
253
+ do {
254
+ let __result = try self.__implementation.connect(deviceId: String(deviceId))
255
+ let __resultCpp = { () -> bridge.std__shared_ptr_Promise_void__ in
256
+ let __promise = bridge.create_std__shared_ptr_Promise_void__()
257
+ let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_void__(__promise)
258
+ __result
259
+ .then({ __result in __promiseHolder.resolve() })
260
+ .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
261
+ return __promise
262
+ }()
263
+ return bridge.create_Result_std__shared_ptr_Promise_void___(__resultCpp)
264
+ } catch (let __error) {
265
+ let __exceptionPtr = __error.toCpp()
266
+ return bridge.create_Result_std__shared_ptr_Promise_void___(__exceptionPtr)
267
+ }
268
+ }
269
+
270
+ @inline(__always)
271
+ public final func disconnect(deviceId: std.string) -> bridge.Result_void_ {
272
+ do {
273
+ try self.__implementation.disconnect(deviceId: String(deviceId))
274
+ return bridge.create_Result_void_()
275
+ } catch (let __error) {
276
+ let __exceptionPtr = __error.toCpp()
277
+ return bridge.create_Result_void_(__exceptionPtr)
278
+ }
279
+ }
280
+
281
+ @inline(__always)
282
+ public final func discoverServices(deviceId: std.string) -> bridge.Result_std__shared_ptr_Promise_std__vector_GATTService____ {
283
+ do {
284
+ let __result = try self.__implementation.discoverServices(deviceId: String(deviceId))
285
+ let __resultCpp = { () -> bridge.std__shared_ptr_Promise_std__vector_GATTService___ in
286
+ let __promise = bridge.create_std__shared_ptr_Promise_std__vector_GATTService___()
287
+ let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_std__vector_GATTService___(__promise)
288
+ __result
289
+ .then({ __result in __promiseHolder.resolve({ () -> bridge.std__vector_GATTService_ in
290
+ var __vector = bridge.create_std__vector_GATTService_(__result.count)
291
+ for __item in __result {
292
+ __vector.push_back(__item)
293
+ }
294
+ return __vector
295
+ }()) })
296
+ .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
297
+ return __promise
298
+ }()
299
+ return bridge.create_Result_std__shared_ptr_Promise_std__vector_GATTService____(__resultCpp)
300
+ } catch (let __error) {
301
+ let __exceptionPtr = __error.toCpp()
302
+ return bridge.create_Result_std__shared_ptr_Promise_std__vector_GATTService____(__exceptionPtr)
303
+ }
304
+ }
305
+
306
+ @inline(__always)
307
+ public final func readCharacteristic(deviceId: std.string, serviceUUID: std.string, characteristicUUID: std.string) -> bridge.Result_std__shared_ptr_Promise_CharacteristicValue___ {
308
+ do {
309
+ let __result = try self.__implementation.readCharacteristic(deviceId: String(deviceId), serviceUUID: String(serviceUUID), characteristicUUID: String(characteristicUUID))
310
+ let __resultCpp = { () -> bridge.std__shared_ptr_Promise_CharacteristicValue__ in
311
+ let __promise = bridge.create_std__shared_ptr_Promise_CharacteristicValue__()
312
+ let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_CharacteristicValue__(__promise)
313
+ __result
314
+ .then({ __result in __promiseHolder.resolve(__result) })
315
+ .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
316
+ return __promise
317
+ }()
318
+ return bridge.create_Result_std__shared_ptr_Promise_CharacteristicValue___(__resultCpp)
319
+ } catch (let __error) {
320
+ let __exceptionPtr = __error.toCpp()
321
+ return bridge.create_Result_std__shared_ptr_Promise_CharacteristicValue___(__exceptionPtr)
322
+ }
323
+ }
324
+
325
+ @inline(__always)
326
+ public final func writeCharacteristic(deviceId: std.string, serviceUUID: std.string, characteristicUUID: std.string, value: std.string, writeType: bridge.std__optional_WriteType_) -> bridge.Result_std__shared_ptr_Promise_void___ {
327
+ do {
328
+ let __result = try self.__implementation.writeCharacteristic(deviceId: String(deviceId), serviceUUID: String(serviceUUID), characteristicUUID: String(characteristicUUID), value: String(value), writeType: writeType.value)
329
+ let __resultCpp = { () -> bridge.std__shared_ptr_Promise_void__ in
330
+ let __promise = bridge.create_std__shared_ptr_Promise_void__()
331
+ let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_void__(__promise)
332
+ __result
333
+ .then({ __result in __promiseHolder.resolve() })
334
+ .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
335
+ return __promise
336
+ }()
337
+ return bridge.create_Result_std__shared_ptr_Promise_void___(__resultCpp)
338
+ } catch (let __error) {
339
+ let __exceptionPtr = __error.toCpp()
340
+ return bridge.create_Result_std__shared_ptr_Promise_void___(__exceptionPtr)
341
+ }
342
+ }
343
+
344
+ @inline(__always)
345
+ public final func subscribeToCharacteristic(deviceId: std.string, serviceUUID: std.string, characteristicUUID: std.string) -> bridge.Result_void_ {
346
+ do {
347
+ try self.__implementation.subscribeToCharacteristic(deviceId: String(deviceId), serviceUUID: String(serviceUUID), characteristicUUID: String(characteristicUUID))
348
+ return bridge.create_Result_void_()
349
+ } catch (let __error) {
350
+ let __exceptionPtr = __error.toCpp()
351
+ return bridge.create_Result_void_(__exceptionPtr)
352
+ }
353
+ }
354
+
355
+ @inline(__always)
356
+ public final func unsubscribeFromCharacteristic(deviceId: std.string, serviceUUID: std.string, characteristicUUID: std.string) -> bridge.Result_void_ {
357
+ do {
358
+ try self.__implementation.unsubscribeFromCharacteristic(deviceId: String(deviceId), serviceUUID: String(serviceUUID), characteristicUUID: String(characteristicUUID))
359
+ return bridge.create_Result_void_()
360
+ } catch (let __error) {
361
+ let __exceptionPtr = __error.toCpp()
362
+ return bridge.create_Result_void_(__exceptionPtr)
363
+ }
364
+ }
365
+
366
+ @inline(__always)
367
+ public final func getConnectedDevices() -> bridge.Result_std__shared_ptr_Promise_std__vector_std__string____ {
368
+ do {
369
+ let __result = try self.__implementation.getConnectedDevices()
370
+ let __resultCpp = { () -> bridge.std__shared_ptr_Promise_std__vector_std__string___ in
371
+ let __promise = bridge.create_std__shared_ptr_Promise_std__vector_std__string___()
372
+ let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_std__vector_std__string___(__promise)
373
+ __result
374
+ .then({ __result in __promiseHolder.resolve({ () -> bridge.std__vector_std__string_ in
375
+ var __vector = bridge.create_std__vector_std__string_(__result.count)
376
+ for __item in __result {
377
+ __vector.push_back(std.string(__item))
378
+ }
379
+ return __vector
380
+ }()) })
381
+ .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
382
+ return __promise
383
+ }()
384
+ return bridge.create_Result_std__shared_ptr_Promise_std__vector_std__string____(__resultCpp)
385
+ } catch (let __error) {
386
+ let __exceptionPtr = __error.toCpp()
387
+ return bridge.create_Result_std__shared_ptr_Promise_std__vector_std__string____(__exceptionPtr)
388
+ }
389
+ }
390
+
391
+ @inline(__always)
392
+ public final func readRSSI(deviceId: std.string) -> bridge.Result_std__shared_ptr_Promise_double___ {
393
+ do {
394
+ let __result = try self.__implementation.readRSSI(deviceId: String(deviceId))
395
+ let __resultCpp = { () -> bridge.std__shared_ptr_Promise_double__ in
396
+ let __promise = bridge.create_std__shared_ptr_Promise_double__()
397
+ let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_double__(__promise)
398
+ __result
399
+ .then({ __result in __promiseHolder.resolve(__result) })
400
+ .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
401
+ return __promise
402
+ }()
403
+ return bridge.create_Result_std__shared_ptr_Promise_double___(__resultCpp)
404
+ } catch (let __error) {
405
+ let __exceptionPtr = __error.toCpp()
406
+ return bridge.create_Result_std__shared_ptr_Promise_double___(__exceptionPtr)
407
+ }
408
+ }
409
+
410
+ @inline(__always)
411
+ public final func addListener(eventName: std.string) -> bridge.Result_void_ {
412
+ do {
413
+ try self.__implementation.addListener(eventName: String(eventName))
414
+ return bridge.create_Result_void_()
415
+ } catch (let __error) {
416
+ let __exceptionPtr = __error.toCpp()
417
+ return bridge.create_Result_void_(__exceptionPtr)
418
+ }
419
+ }
420
+
421
+ @inline(__always)
422
+ public final func removeListeners(count: Double) -> bridge.Result_void_ {
423
+ do {
424
+ try self.__implementation.removeListeners(count: count)
425
+ return bridge.create_Result_void_()
426
+ } catch (let __error) {
427
+ let __exceptionPtr = __error.toCpp()
428
+ return bridge.create_Result_void_(__exceptionPtr)
429
+ }
430
+ }
431
+ }
@@ -0,0 +1,44 @@
1
+ ///
2
+ /// ScanMode.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ /**
9
+ * Represents the JS union `ScanMode`, backed by a C++ enum.
10
+ */
11
+ public typealias ScanMode = margelo.nitro.munimbluetooth.ScanMode
12
+
13
+ public extension ScanMode {
14
+ /**
15
+ * Get a ScanMode for the given String value, or
16
+ * return `nil` if the given value was invalid/unknown.
17
+ */
18
+ init?(fromString string: String) {
19
+ switch string {
20
+ case "lowPower":
21
+ self = .lowpower
22
+ case "balanced":
23
+ self = .balanced
24
+ case "lowLatency":
25
+ self = .lowlatency
26
+ default:
27
+ return nil
28
+ }
29
+ }
30
+
31
+ /**
32
+ * Get the String value this ScanMode represents.
33
+ */
34
+ var stringValue: String {
35
+ switch self {
36
+ case .lowpower:
37
+ return "lowPower"
38
+ case .balanced:
39
+ return "balanced"
40
+ case .lowlatency:
41
+ return "lowLatency"
42
+ }
43
+ }
44
+ }
@@ -0,0 +1,78 @@
1
+ ///
2
+ /// ScanOptions.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ import Foundation
9
+ import NitroModules
10
+
11
+ /**
12
+ * Represents an instance of `ScanOptions`, backed by a C++ struct.
13
+ */
14
+ public typealias ScanOptions = margelo.nitro.munimbluetooth.ScanOptions
15
+
16
+ public extension ScanOptions {
17
+ private typealias bridge = margelo.nitro.munimbluetooth.bridge.swift
18
+
19
+ /**
20
+ * Create a new instance of `ScanOptions`.
21
+ */
22
+ init(serviceUUIDs: [String]?, allowDuplicates: Bool?, scanMode: ScanMode?) {
23
+ self.init({ () -> bridge.std__optional_std__vector_std__string__ in
24
+ if let __unwrappedValue = serviceUUIDs {
25
+ return bridge.create_std__optional_std__vector_std__string__({ () -> bridge.std__vector_std__string_ in
26
+ var __vector = bridge.create_std__vector_std__string_(__unwrappedValue.count)
27
+ for __item in __unwrappedValue {
28
+ __vector.push_back(std.string(__item))
29
+ }
30
+ return __vector
31
+ }())
32
+ } else {
33
+ return .init()
34
+ }
35
+ }(), { () -> bridge.std__optional_bool_ in
36
+ if let __unwrappedValue = allowDuplicates {
37
+ return bridge.create_std__optional_bool_(__unwrappedValue)
38
+ } else {
39
+ return .init()
40
+ }
41
+ }(), { () -> bridge.std__optional_ScanMode_ in
42
+ if let __unwrappedValue = scanMode {
43
+ return bridge.create_std__optional_ScanMode_(__unwrappedValue)
44
+ } else {
45
+ return .init()
46
+ }
47
+ }())
48
+ }
49
+
50
+ @inline(__always)
51
+ var serviceUUIDs: [String]? {
52
+ return { () -> [String]? in
53
+ if bridge.has_value_std__optional_std__vector_std__string__(self.__serviceUUIDs) {
54
+ let __unwrapped = bridge.get_std__optional_std__vector_std__string__(self.__serviceUUIDs)
55
+ return __unwrapped.map({ __item in String(__item) })
56
+ } else {
57
+ return nil
58
+ }
59
+ }()
60
+ }
61
+
62
+ @inline(__always)
63
+ var allowDuplicates: Bool? {
64
+ return { () -> Bool? in
65
+ if bridge.has_value_std__optional_bool_(self.__allowDuplicates) {
66
+ let __unwrapped = bridge.get_std__optional_bool_(self.__allowDuplicates)
67
+ return __unwrapped
68
+ } else {
69
+ return nil
70
+ }
71
+ }()
72
+ }
73
+
74
+ @inline(__always)
75
+ var scanMode: ScanMode? {
76
+ return self.__scanMode.value
77
+ }
78
+ }
@@ -0,0 +1,35 @@
1
+ ///
2
+ /// ServiceDataEntry.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ import Foundation
9
+ import NitroModules
10
+
11
+ /**
12
+ * Represents an instance of `ServiceDataEntry`, backed by a C++ struct.
13
+ */
14
+ public typealias ServiceDataEntry = margelo.nitro.munimbluetooth.ServiceDataEntry
15
+
16
+ public extension ServiceDataEntry {
17
+ private typealias bridge = margelo.nitro.munimbluetooth.bridge.swift
18
+
19
+ /**
20
+ * Create a new instance of `ServiceDataEntry`.
21
+ */
22
+ init(uuid: String, data: String) {
23
+ self.init(std.string(uuid), std.string(data))
24
+ }
25
+
26
+ @inline(__always)
27
+ var uuid: String {
28
+ return String(self.__uuid)
29
+ }
30
+
31
+ @inline(__always)
32
+ var data: String {
33
+ return String(self.__data)
34
+ }
35
+ }
@@ -0,0 +1,40 @@
1
+ ///
2
+ /// WriteType.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ /**
9
+ * Represents the JS union `WriteType`, backed by a C++ enum.
10
+ */
11
+ public typealias WriteType = margelo.nitro.munimbluetooth.WriteType
12
+
13
+ public extension WriteType {
14
+ /**
15
+ * Get a WriteType for the given String value, or
16
+ * return `nil` if the given value was invalid/unknown.
17
+ */
18
+ init?(fromString string: String) {
19
+ switch string {
20
+ case "write":
21
+ self = .write
22
+ case "writeWithoutResponse":
23
+ self = .writewithoutresponse
24
+ default:
25
+ return nil
26
+ }
27
+ }
28
+
29
+ /**
30
+ * Get the String value this WriteType represents.
31
+ */
32
+ var stringValue: String {
33
+ switch self {
34
+ case .write:
35
+ return "write"
36
+ case .writewithoutresponse:
37
+ return "writeWithoutResponse"
38
+ }
39
+ }
40
+ }