munim-bluetooth 0.3.27 → 0.4.1

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 (116) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/LICENSE +201 -21
  3. package/README.md +480 -75
  4. package/android/gradle.properties +2 -2
  5. package/android/src/main/AndroidManifest.xml +3 -1
  6. package/android/src/main/cpp/cpp-adapter.cpp +4 -1
  7. package/android/src/main/java/com/munimbluetooth/HybridMunimBluetooth.kt +2006 -209
  8. package/android/src/main/java/com/munimbluetooth/MunimBluetoothBackgroundService.kt +561 -53
  9. package/app.plugin.js +155 -0
  10. package/ios/HybridMunimBluetooth.swift +2123 -298
  11. package/ios/MunimBluetoothEventEmitter.swift +68 -8
  12. package/lib/commonjs/index.js +272 -11
  13. package/lib/commonjs/index.js.map +1 -1
  14. package/lib/module/index.js +243 -11
  15. package/lib/module/index.js.map +1 -1
  16. package/lib/typescript/src/index.d.ts +310 -7
  17. package/lib/typescript/src/index.d.ts.map +1 -1
  18. package/lib/typescript/src/specs/munim-bluetooth.nitro.d.ts +219 -5
  19. package/lib/typescript/src/specs/munim-bluetooth.nitro.d.ts.map +1 -1
  20. package/nitro.json +9 -3
  21. package/nitrogen/generated/android/c++/JAdvertisingDataTypes.hpp +96 -96
  22. package/nitrogen/generated/android/c++/JAdvertisingOptions.hpp +8 -8
  23. package/nitrogen/generated/android/c++/JBackgroundSessionOptions.hpp +8 -8
  24. package/nitrogen/generated/android/c++/JBluetoothCapabilities.hpp +105 -0
  25. package/nitrogen/generated/android/c++/JBluetoothPhy.hpp +61 -0
  26. package/nitrogen/generated/android/c++/JBluetoothPhyOption.hpp +61 -0
  27. package/nitrogen/generated/android/c++/JBondState.hpp +64 -0
  28. package/nitrogen/generated/android/c++/JDescriptorValue.hpp +69 -0
  29. package/nitrogen/generated/android/c++/JExtendedAdvertisingOptions.hpp +131 -0
  30. package/nitrogen/generated/android/c++/JGATTCharacteristic.hpp +35 -11
  31. package/nitrogen/generated/android/c++/JGATTDescriptor.hpp +85 -0
  32. package/nitrogen/generated/android/c++/JGATTService.hpp +33 -9
  33. package/nitrogen/generated/android/c++/JHybridMunimBluetoothSpec.cpp +422 -12
  34. package/nitrogen/generated/android/c++/JHybridMunimBluetoothSpec.hpp +29 -0
  35. package/nitrogen/generated/android/c++/JL2CAPChannel.hpp +66 -0
  36. package/nitrogen/generated/android/c++/JMultipeerDiscoveryInfoEntry.hpp +61 -0
  37. package/nitrogen/generated/android/c++/JMultipeerEncryptionPreference.hpp +61 -0
  38. package/nitrogen/generated/android/c++/JMultipeerPeer.hpp +93 -0
  39. package/nitrogen/generated/android/c++/JMultipeerPeerState.hpp +61 -0
  40. package/nitrogen/generated/android/c++/JMultipeerSessionOptions.hpp +105 -0
  41. package/nitrogen/generated/android/c++/JPhyStatus.hpp +62 -0
  42. package/nitrogen/generated/android/c++/JScanOptions.hpp +8 -8
  43. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/AdvertisingDataTypes.kt +47 -0
  44. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/AdvertisingOptions.kt +19 -0
  45. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/BackgroundSessionOptions.kt +27 -0
  46. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/BluetoothCapabilities.kt +111 -0
  47. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/BluetoothPhy.kt +24 -0
  48. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/BluetoothPhyOption.kt +24 -0
  49. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/BondState.kt +25 -0
  50. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/CharacteristicValue.kt +17 -0
  51. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/DescriptorValue.kt +66 -0
  52. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/ExtendedAdvertisingOptions.kt +111 -0
  53. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/GATTCharacteristic.kt +25 -3
  54. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/GATTDescriptor.kt +61 -0
  55. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/GATTService.kt +23 -3
  56. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/HybridMunimBluetoothSpec.kt +138 -22
  57. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/L2CAPChannel.kt +61 -0
  58. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/MultipeerDiscoveryInfoEntry.kt +56 -0
  59. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/MultipeerEncryptionPreference.kt +24 -0
  60. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/MultipeerPeer.kt +66 -0
  61. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/MultipeerPeerState.kt +24 -0
  62. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/MultipeerSessionOptions.kt +81 -0
  63. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/PhyStatus.kt +56 -0
  64. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/ScanOptions.kt +17 -0
  65. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/ServiceDataEntry.kt +15 -0
  66. package/nitrogen/generated/ios/MunimBluetooth+autolinking.rb +2 -0
  67. package/nitrogen/generated/ios/MunimBluetooth-Swift-Cxx-Bridge.cpp +61 -5
  68. package/nitrogen/generated/ios/MunimBluetooth-Swift-Cxx-Bridge.hpp +494 -49
  69. package/nitrogen/generated/ios/MunimBluetooth-Swift-Cxx-Umbrella.hpp +42 -0
  70. package/nitrogen/generated/ios/c++/HybridMunimBluetoothSpecSwift.hpp +254 -0
  71. package/nitrogen/generated/ios/swift/BluetoothCapabilities.swift +89 -0
  72. package/nitrogen/generated/ios/swift/BluetoothPhy.swift +44 -0
  73. package/nitrogen/generated/ios/swift/BluetoothPhyOption.swift +44 -0
  74. package/nitrogen/generated/ios/swift/BondState.swift +48 -0
  75. package/nitrogen/generated/ios/swift/DescriptorValue.swift +44 -0
  76. package/nitrogen/generated/ios/swift/ExtendedAdvertisingOptions.swift +243 -0
  77. package/nitrogen/generated/ios/swift/Func_void_BluetoothCapabilities.swift +46 -0
  78. package/nitrogen/generated/ios/swift/Func_void_BondState.swift +46 -0
  79. package/nitrogen/generated/ios/swift/Func_void_DescriptorValue.swift +46 -0
  80. package/nitrogen/generated/ios/swift/Func_void_L2CAPChannel.swift +46 -0
  81. package/nitrogen/generated/ios/swift/Func_void_PhyStatus.swift +46 -0
  82. package/nitrogen/generated/ios/swift/Func_void_std__string.swift +46 -0
  83. package/nitrogen/generated/ios/swift/Func_void_std__vector_MultipeerPeer_.swift +46 -0
  84. package/nitrogen/generated/ios/swift/GATTCharacteristic.swift +25 -1
  85. package/nitrogen/generated/ios/swift/GATTDescriptor.swift +71 -0
  86. package/nitrogen/generated/ios/swift/GATTService.swift +25 -1
  87. package/nitrogen/generated/ios/swift/HybridMunimBluetoothSpec.swift +29 -0
  88. package/nitrogen/generated/ios/swift/HybridMunimBluetoothSpec_cxx.swift +556 -23
  89. package/nitrogen/generated/ios/swift/L2CAPChannel.swift +52 -0
  90. package/nitrogen/generated/ios/swift/MultipeerDiscoveryInfoEntry.swift +34 -0
  91. package/nitrogen/generated/ios/swift/MultipeerEncryptionPreference.swift +44 -0
  92. package/nitrogen/generated/ios/swift/MultipeerPeer.swift +63 -0
  93. package/nitrogen/generated/ios/swift/MultipeerPeerState.swift +44 -0
  94. package/nitrogen/generated/ios/swift/MultipeerSessionOptions.swift +136 -0
  95. package/nitrogen/generated/ios/swift/PhyStatus.swift +34 -0
  96. package/nitrogen/generated/shared/c++/BluetoothCapabilities.hpp +131 -0
  97. package/nitrogen/generated/shared/c++/BluetoothPhy.hpp +80 -0
  98. package/nitrogen/generated/shared/c++/BluetoothPhyOption.hpp +80 -0
  99. package/nitrogen/generated/shared/c++/BondState.hpp +84 -0
  100. package/nitrogen/generated/shared/c++/DescriptorValue.hpp +95 -0
  101. package/nitrogen/generated/shared/c++/ExtendedAdvertisingOptions.hpp +138 -0
  102. package/nitrogen/generated/shared/c++/GATTCharacteristic.hpp +9 -3
  103. package/nitrogen/generated/shared/c++/GATTDescriptor.hpp +93 -0
  104. package/nitrogen/generated/shared/c++/GATTService.hpp +7 -2
  105. package/nitrogen/generated/shared/c++/HybridMunimBluetoothSpec.cpp +29 -0
  106. package/nitrogen/generated/shared/c++/HybridMunimBluetoothSpec.hpp +61 -2
  107. package/nitrogen/generated/shared/c++/L2CAPChannel.hpp +92 -0
  108. package/nitrogen/generated/shared/c++/MultipeerDiscoveryInfoEntry.hpp +87 -0
  109. package/nitrogen/generated/shared/c++/MultipeerEncryptionPreference.hpp +80 -0
  110. package/nitrogen/generated/shared/c++/MultipeerPeer.hpp +102 -0
  111. package/nitrogen/generated/shared/c++/MultipeerPeerState.hpp +80 -0
  112. package/nitrogen/generated/shared/c++/MultipeerSessionOptions.hpp +114 -0
  113. package/nitrogen/generated/shared/c++/PhyStatus.hpp +88 -0
  114. package/package.json +23 -12
  115. package/src/index.ts +416 -31
  116. package/src/specs/munim-bluetooth.nitro.ts +298 -14
@@ -0,0 +1,243 @@
1
+ ///
2
+ /// ExtendedAdvertisingOptions.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 NitroModules
9
+
10
+ /**
11
+ * Represents an instance of `ExtendedAdvertisingOptions`, backed by a C++ struct.
12
+ */
13
+ public typealias ExtendedAdvertisingOptions = margelo.nitro.munimbluetooth.ExtendedAdvertisingOptions
14
+
15
+ public extension ExtendedAdvertisingOptions {
16
+ private typealias bridge = margelo.nitro.munimbluetooth.bridge.swift
17
+
18
+ /**
19
+ * Create a new instance of `ExtendedAdvertisingOptions`.
20
+ */
21
+ init(serviceUUIDs: [String]?, localName: String?, manufacturerData: String?, advertisingData: AdvertisingDataTypes?, connectable: Bool?, scannable: Bool?, legacyMode: Bool?, anonymous: Bool?, includeTxPower: Bool?, interval: Double?, txPowerLevel: Double?, primaryPhy: BluetoothPhy?, secondaryPhy: BluetoothPhy?) {
22
+ self.init({ () -> bridge.std__optional_std__vector_std__string__ in
23
+ if let __unwrappedValue = serviceUUIDs {
24
+ return bridge.create_std__optional_std__vector_std__string__({ () -> bridge.std__vector_std__string_ in
25
+ var __vector = bridge.create_std__vector_std__string_(__unwrappedValue.count)
26
+ for __item in __unwrappedValue {
27
+ __vector.push_back(std.string(__item))
28
+ }
29
+ return __vector
30
+ }())
31
+ } else {
32
+ return .init()
33
+ }
34
+ }(), { () -> bridge.std__optional_std__string_ in
35
+ if let __unwrappedValue = localName {
36
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
37
+ } else {
38
+ return .init()
39
+ }
40
+ }(), { () -> bridge.std__optional_std__string_ in
41
+ if let __unwrappedValue = manufacturerData {
42
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
43
+ } else {
44
+ return .init()
45
+ }
46
+ }(), { () -> bridge.std__optional_AdvertisingDataTypes_ in
47
+ if let __unwrappedValue = advertisingData {
48
+ return bridge.create_std__optional_AdvertisingDataTypes_(__unwrappedValue)
49
+ } else {
50
+ return .init()
51
+ }
52
+ }(), { () -> bridge.std__optional_bool_ in
53
+ if let __unwrappedValue = connectable {
54
+ return bridge.create_std__optional_bool_(__unwrappedValue)
55
+ } else {
56
+ return .init()
57
+ }
58
+ }(), { () -> bridge.std__optional_bool_ in
59
+ if let __unwrappedValue = scannable {
60
+ return bridge.create_std__optional_bool_(__unwrappedValue)
61
+ } else {
62
+ return .init()
63
+ }
64
+ }(), { () -> bridge.std__optional_bool_ in
65
+ if let __unwrappedValue = legacyMode {
66
+ return bridge.create_std__optional_bool_(__unwrappedValue)
67
+ } else {
68
+ return .init()
69
+ }
70
+ }(), { () -> bridge.std__optional_bool_ in
71
+ if let __unwrappedValue = anonymous {
72
+ return bridge.create_std__optional_bool_(__unwrappedValue)
73
+ } else {
74
+ return .init()
75
+ }
76
+ }(), { () -> bridge.std__optional_bool_ in
77
+ if let __unwrappedValue = includeTxPower {
78
+ return bridge.create_std__optional_bool_(__unwrappedValue)
79
+ } else {
80
+ return .init()
81
+ }
82
+ }(), { () -> bridge.std__optional_double_ in
83
+ if let __unwrappedValue = interval {
84
+ return bridge.create_std__optional_double_(__unwrappedValue)
85
+ } else {
86
+ return .init()
87
+ }
88
+ }(), { () -> bridge.std__optional_double_ in
89
+ if let __unwrappedValue = txPowerLevel {
90
+ return bridge.create_std__optional_double_(__unwrappedValue)
91
+ } else {
92
+ return .init()
93
+ }
94
+ }(), { () -> bridge.std__optional_BluetoothPhy_ in
95
+ if let __unwrappedValue = primaryPhy {
96
+ return bridge.create_std__optional_BluetoothPhy_(__unwrappedValue)
97
+ } else {
98
+ return .init()
99
+ }
100
+ }(), { () -> bridge.std__optional_BluetoothPhy_ in
101
+ if let __unwrappedValue = secondaryPhy {
102
+ return bridge.create_std__optional_BluetoothPhy_(__unwrappedValue)
103
+ } else {
104
+ return .init()
105
+ }
106
+ }())
107
+ }
108
+
109
+ @inline(__always)
110
+ var serviceUUIDs: [String]? {
111
+ return { () -> [String]? in
112
+ if bridge.has_value_std__optional_std__vector_std__string__(self.__serviceUUIDs) {
113
+ let __unwrapped = bridge.get_std__optional_std__vector_std__string__(self.__serviceUUIDs)
114
+ return __unwrapped.map({ __item in String(__item) })
115
+ } else {
116
+ return nil
117
+ }
118
+ }()
119
+ }
120
+
121
+ @inline(__always)
122
+ var localName: String? {
123
+ return { () -> String? in
124
+ if bridge.has_value_std__optional_std__string_(self.__localName) {
125
+ let __unwrapped = bridge.get_std__optional_std__string_(self.__localName)
126
+ return String(__unwrapped)
127
+ } else {
128
+ return nil
129
+ }
130
+ }()
131
+ }
132
+
133
+ @inline(__always)
134
+ var manufacturerData: String? {
135
+ return { () -> String? in
136
+ if bridge.has_value_std__optional_std__string_(self.__manufacturerData) {
137
+ let __unwrapped = bridge.get_std__optional_std__string_(self.__manufacturerData)
138
+ return String(__unwrapped)
139
+ } else {
140
+ return nil
141
+ }
142
+ }()
143
+ }
144
+
145
+ @inline(__always)
146
+ var advertisingData: AdvertisingDataTypes? {
147
+ return self.__advertisingData.value
148
+ }
149
+
150
+ @inline(__always)
151
+ var connectable: Bool? {
152
+ return { () -> Bool? in
153
+ if bridge.has_value_std__optional_bool_(self.__connectable) {
154
+ let __unwrapped = bridge.get_std__optional_bool_(self.__connectable)
155
+ return __unwrapped
156
+ } else {
157
+ return nil
158
+ }
159
+ }()
160
+ }
161
+
162
+ @inline(__always)
163
+ var scannable: Bool? {
164
+ return { () -> Bool? in
165
+ if bridge.has_value_std__optional_bool_(self.__scannable) {
166
+ let __unwrapped = bridge.get_std__optional_bool_(self.__scannable)
167
+ return __unwrapped
168
+ } else {
169
+ return nil
170
+ }
171
+ }()
172
+ }
173
+
174
+ @inline(__always)
175
+ var legacyMode: Bool? {
176
+ return { () -> Bool? in
177
+ if bridge.has_value_std__optional_bool_(self.__legacyMode) {
178
+ let __unwrapped = bridge.get_std__optional_bool_(self.__legacyMode)
179
+ return __unwrapped
180
+ } else {
181
+ return nil
182
+ }
183
+ }()
184
+ }
185
+
186
+ @inline(__always)
187
+ var anonymous: Bool? {
188
+ return { () -> Bool? in
189
+ if bridge.has_value_std__optional_bool_(self.__anonymous) {
190
+ let __unwrapped = bridge.get_std__optional_bool_(self.__anonymous)
191
+ return __unwrapped
192
+ } else {
193
+ return nil
194
+ }
195
+ }()
196
+ }
197
+
198
+ @inline(__always)
199
+ var includeTxPower: Bool? {
200
+ return { () -> Bool? in
201
+ if bridge.has_value_std__optional_bool_(self.__includeTxPower) {
202
+ let __unwrapped = bridge.get_std__optional_bool_(self.__includeTxPower)
203
+ return __unwrapped
204
+ } else {
205
+ return nil
206
+ }
207
+ }()
208
+ }
209
+
210
+ @inline(__always)
211
+ var interval: Double? {
212
+ return { () -> Double? in
213
+ if bridge.has_value_std__optional_double_(self.__interval) {
214
+ let __unwrapped = bridge.get_std__optional_double_(self.__interval)
215
+ return __unwrapped
216
+ } else {
217
+ return nil
218
+ }
219
+ }()
220
+ }
221
+
222
+ @inline(__always)
223
+ var txPowerLevel: Double? {
224
+ return { () -> Double? in
225
+ if bridge.has_value_std__optional_double_(self.__txPowerLevel) {
226
+ let __unwrapped = bridge.get_std__optional_double_(self.__txPowerLevel)
227
+ return __unwrapped
228
+ } else {
229
+ return nil
230
+ }
231
+ }()
232
+ }
233
+
234
+ @inline(__always)
235
+ var primaryPhy: BluetoothPhy? {
236
+ return self.__primaryPhy.value
237
+ }
238
+
239
+ @inline(__always)
240
+ var secondaryPhy: BluetoothPhy? {
241
+ return self.__secondaryPhy.value
242
+ }
243
+ }
@@ -0,0 +1,46 @@
1
+ ///
2
+ /// Func_void_BluetoothCapabilities.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 NitroModules
9
+
10
+ /**
11
+ * Wraps a Swift `(_ value: BluetoothCapabilities) -> Void` as a class.
12
+ * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
13
+ */
14
+ public final class Func_void_BluetoothCapabilities {
15
+ public typealias bridge = margelo.nitro.munimbluetooth.bridge.swift
16
+
17
+ private let closure: (_ value: BluetoothCapabilities) -> Void
18
+
19
+ public init(_ closure: @escaping (_ value: BluetoothCapabilities) -> Void) {
20
+ self.closure = closure
21
+ }
22
+
23
+ @inline(__always)
24
+ public func call(value: BluetoothCapabilities) -> Void {
25
+ self.closure(value)
26
+ }
27
+
28
+ /**
29
+ * Casts this instance to a retained unsafe raw pointer.
30
+ * This acquires one additional strong reference on the object!
31
+ */
32
+ @inline(__always)
33
+ public func toUnsafe() -> UnsafeMutableRawPointer {
34
+ return Unmanaged.passRetained(self).toOpaque()
35
+ }
36
+
37
+ /**
38
+ * Casts an unsafe pointer to a `Func_void_BluetoothCapabilities`.
39
+ * The pointer has to be a retained opaque `Unmanaged<Func_void_BluetoothCapabilities>`.
40
+ * This removes one strong reference from the object!
41
+ */
42
+ @inline(__always)
43
+ public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_BluetoothCapabilities {
44
+ return Unmanaged<Func_void_BluetoothCapabilities>.fromOpaque(pointer).takeRetainedValue()
45
+ }
46
+ }
@@ -0,0 +1,46 @@
1
+ ///
2
+ /// Func_void_BondState.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 NitroModules
9
+
10
+ /**
11
+ * Wraps a Swift `(_ value: BondState) -> Void` as a class.
12
+ * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
13
+ */
14
+ public final class Func_void_BondState {
15
+ public typealias bridge = margelo.nitro.munimbluetooth.bridge.swift
16
+
17
+ private let closure: (_ value: BondState) -> Void
18
+
19
+ public init(_ closure: @escaping (_ value: BondState) -> Void) {
20
+ self.closure = closure
21
+ }
22
+
23
+ @inline(__always)
24
+ public func call(value: Int32) -> Void {
25
+ self.closure(margelo.nitro.munimbluetooth.BondState(rawValue: value)!)
26
+ }
27
+
28
+ /**
29
+ * Casts this instance to a retained unsafe raw pointer.
30
+ * This acquires one additional strong reference on the object!
31
+ */
32
+ @inline(__always)
33
+ public func toUnsafe() -> UnsafeMutableRawPointer {
34
+ return Unmanaged.passRetained(self).toOpaque()
35
+ }
36
+
37
+ /**
38
+ * Casts an unsafe pointer to a `Func_void_BondState`.
39
+ * The pointer has to be a retained opaque `Unmanaged<Func_void_BondState>`.
40
+ * This removes one strong reference from the object!
41
+ */
42
+ @inline(__always)
43
+ public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_BondState {
44
+ return Unmanaged<Func_void_BondState>.fromOpaque(pointer).takeRetainedValue()
45
+ }
46
+ }
@@ -0,0 +1,46 @@
1
+ ///
2
+ /// Func_void_DescriptorValue.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 NitroModules
9
+
10
+ /**
11
+ * Wraps a Swift `(_ value: DescriptorValue) -> Void` as a class.
12
+ * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
13
+ */
14
+ public final class Func_void_DescriptorValue {
15
+ public typealias bridge = margelo.nitro.munimbluetooth.bridge.swift
16
+
17
+ private let closure: (_ value: DescriptorValue) -> Void
18
+
19
+ public init(_ closure: @escaping (_ value: DescriptorValue) -> Void) {
20
+ self.closure = closure
21
+ }
22
+
23
+ @inline(__always)
24
+ public func call(value: DescriptorValue) -> Void {
25
+ self.closure(value)
26
+ }
27
+
28
+ /**
29
+ * Casts this instance to a retained unsafe raw pointer.
30
+ * This acquires one additional strong reference on the object!
31
+ */
32
+ @inline(__always)
33
+ public func toUnsafe() -> UnsafeMutableRawPointer {
34
+ return Unmanaged.passRetained(self).toOpaque()
35
+ }
36
+
37
+ /**
38
+ * Casts an unsafe pointer to a `Func_void_DescriptorValue`.
39
+ * The pointer has to be a retained opaque `Unmanaged<Func_void_DescriptorValue>`.
40
+ * This removes one strong reference from the object!
41
+ */
42
+ @inline(__always)
43
+ public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_DescriptorValue {
44
+ return Unmanaged<Func_void_DescriptorValue>.fromOpaque(pointer).takeRetainedValue()
45
+ }
46
+ }
@@ -0,0 +1,46 @@
1
+ ///
2
+ /// Func_void_L2CAPChannel.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 NitroModules
9
+
10
+ /**
11
+ * Wraps a Swift `(_ value: L2CAPChannel) -> Void` as a class.
12
+ * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
13
+ */
14
+ public final class Func_void_L2CAPChannel {
15
+ public typealias bridge = margelo.nitro.munimbluetooth.bridge.swift
16
+
17
+ private let closure: (_ value: L2CAPChannel) -> Void
18
+
19
+ public init(_ closure: @escaping (_ value: L2CAPChannel) -> Void) {
20
+ self.closure = closure
21
+ }
22
+
23
+ @inline(__always)
24
+ public func call(value: L2CAPChannel) -> Void {
25
+ self.closure(value)
26
+ }
27
+
28
+ /**
29
+ * Casts this instance to a retained unsafe raw pointer.
30
+ * This acquires one additional strong reference on the object!
31
+ */
32
+ @inline(__always)
33
+ public func toUnsafe() -> UnsafeMutableRawPointer {
34
+ return Unmanaged.passRetained(self).toOpaque()
35
+ }
36
+
37
+ /**
38
+ * Casts an unsafe pointer to a `Func_void_L2CAPChannel`.
39
+ * The pointer has to be a retained opaque `Unmanaged<Func_void_L2CAPChannel>`.
40
+ * This removes one strong reference from the object!
41
+ */
42
+ @inline(__always)
43
+ public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_L2CAPChannel {
44
+ return Unmanaged<Func_void_L2CAPChannel>.fromOpaque(pointer).takeRetainedValue()
45
+ }
46
+ }
@@ -0,0 +1,46 @@
1
+ ///
2
+ /// Func_void_PhyStatus.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 NitroModules
9
+
10
+ /**
11
+ * Wraps a Swift `(_ value: PhyStatus) -> Void` as a class.
12
+ * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
13
+ */
14
+ public final class Func_void_PhyStatus {
15
+ public typealias bridge = margelo.nitro.munimbluetooth.bridge.swift
16
+
17
+ private let closure: (_ value: PhyStatus) -> Void
18
+
19
+ public init(_ closure: @escaping (_ value: PhyStatus) -> Void) {
20
+ self.closure = closure
21
+ }
22
+
23
+ @inline(__always)
24
+ public func call(value: PhyStatus) -> Void {
25
+ self.closure(value)
26
+ }
27
+
28
+ /**
29
+ * Casts this instance to a retained unsafe raw pointer.
30
+ * This acquires one additional strong reference on the object!
31
+ */
32
+ @inline(__always)
33
+ public func toUnsafe() -> UnsafeMutableRawPointer {
34
+ return Unmanaged.passRetained(self).toOpaque()
35
+ }
36
+
37
+ /**
38
+ * Casts an unsafe pointer to a `Func_void_PhyStatus`.
39
+ * The pointer has to be a retained opaque `Unmanaged<Func_void_PhyStatus>`.
40
+ * This removes one strong reference from the object!
41
+ */
42
+ @inline(__always)
43
+ public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_PhyStatus {
44
+ return Unmanaged<Func_void_PhyStatus>.fromOpaque(pointer).takeRetainedValue()
45
+ }
46
+ }
@@ -0,0 +1,46 @@
1
+ ///
2
+ /// Func_void_std__string.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 NitroModules
9
+
10
+ /**
11
+ * Wraps a Swift `(_ value: String) -> Void` as a class.
12
+ * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
13
+ */
14
+ public final class Func_void_std__string {
15
+ public typealias bridge = margelo.nitro.munimbluetooth.bridge.swift
16
+
17
+ private let closure: (_ value: String) -> Void
18
+
19
+ public init(_ closure: @escaping (_ value: String) -> Void) {
20
+ self.closure = closure
21
+ }
22
+
23
+ @inline(__always)
24
+ public func call(value: std.string) -> Void {
25
+ self.closure(String(value))
26
+ }
27
+
28
+ /**
29
+ * Casts this instance to a retained unsafe raw pointer.
30
+ * This acquires one additional strong reference on the object!
31
+ */
32
+ @inline(__always)
33
+ public func toUnsafe() -> UnsafeMutableRawPointer {
34
+ return Unmanaged.passRetained(self).toOpaque()
35
+ }
36
+
37
+ /**
38
+ * Casts an unsafe pointer to a `Func_void_std__string`.
39
+ * The pointer has to be a retained opaque `Unmanaged<Func_void_std__string>`.
40
+ * This removes one strong reference from the object!
41
+ */
42
+ @inline(__always)
43
+ public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__string {
44
+ return Unmanaged<Func_void_std__string>.fromOpaque(pointer).takeRetainedValue()
45
+ }
46
+ }
@@ -0,0 +1,46 @@
1
+ ///
2
+ /// Func_void_std__vector_MultipeerPeer_.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 NitroModules
9
+
10
+ /**
11
+ * Wraps a Swift `(_ value: [MultipeerPeer]) -> Void` as a class.
12
+ * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
13
+ */
14
+ public final class Func_void_std__vector_MultipeerPeer_ {
15
+ public typealias bridge = margelo.nitro.munimbluetooth.bridge.swift
16
+
17
+ private let closure: (_ value: [MultipeerPeer]) -> Void
18
+
19
+ public init(_ closure: @escaping (_ value: [MultipeerPeer]) -> Void) {
20
+ self.closure = closure
21
+ }
22
+
23
+ @inline(__always)
24
+ public func call(value: bridge.std__vector_MultipeerPeer_) -> Void {
25
+ self.closure(value.map({ __item in __item }))
26
+ }
27
+
28
+ /**
29
+ * Casts this instance to a retained unsafe raw pointer.
30
+ * This acquires one additional strong reference on the object!
31
+ */
32
+ @inline(__always)
33
+ public func toUnsafe() -> UnsafeMutableRawPointer {
34
+ return Unmanaged.passRetained(self).toOpaque()
35
+ }
36
+
37
+ /**
38
+ * Casts an unsafe pointer to a `Func_void_std__vector_MultipeerPeer_`.
39
+ * The pointer has to be a retained opaque `Unmanaged<Func_void_std__vector_MultipeerPeer_>`.
40
+ * This removes one strong reference from the object!
41
+ */
42
+ @inline(__always)
43
+ public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__vector_MultipeerPeer_ {
44
+ return Unmanaged<Func_void_std__vector_MultipeerPeer_>.fromOpaque(pointer).takeRetainedValue()
45
+ }
46
+ }
@@ -18,7 +18,7 @@ public extension GATTCharacteristic {
18
18
  /**
19
19
  * Create a new instance of `GATTCharacteristic`.
20
20
  */
21
- init(uuid: String, properties: [String], value: String?) {
21
+ init(uuid: String, properties: [String], value: String?, descriptors: [GATTDescriptor]?) {
22
22
  self.init(std.string(uuid), { () -> bridge.std__vector_std__string_ in
23
23
  var __vector = bridge.create_std__vector_std__string_(properties.count)
24
24
  for __item in properties {
@@ -31,6 +31,18 @@ public extension GATTCharacteristic {
31
31
  } else {
32
32
  return .init()
33
33
  }
34
+ }(), { () -> bridge.std__optional_std__vector_GATTDescriptor__ in
35
+ if let __unwrappedValue = descriptors {
36
+ return bridge.create_std__optional_std__vector_GATTDescriptor__({ () -> bridge.std__vector_GATTDescriptor_ in
37
+ var __vector = bridge.create_std__vector_GATTDescriptor_(__unwrappedValue.count)
38
+ for __item in __unwrappedValue {
39
+ __vector.push_back(__item)
40
+ }
41
+ return __vector
42
+ }())
43
+ } else {
44
+ return .init()
45
+ }
34
46
  }())
35
47
  }
36
48
 
@@ -55,4 +67,16 @@ public extension GATTCharacteristic {
55
67
  }
56
68
  }()
57
69
  }
70
+
71
+ @inline(__always)
72
+ var descriptors: [GATTDescriptor]? {
73
+ return { () -> [GATTDescriptor]? in
74
+ if bridge.has_value_std__optional_std__vector_GATTDescriptor__(self.__descriptors) {
75
+ let __unwrapped = bridge.get_std__optional_std__vector_GATTDescriptor__(self.__descriptors)
76
+ return __unwrapped.map({ __item in __item })
77
+ } else {
78
+ return nil
79
+ }
80
+ }()
81
+ }
58
82
  }
@@ -0,0 +1,71 @@
1
+ ///
2
+ /// GATTDescriptor.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 NitroModules
9
+
10
+ /**
11
+ * Represents an instance of `GATTDescriptor`, backed by a C++ struct.
12
+ */
13
+ public typealias GATTDescriptor = margelo.nitro.munimbluetooth.GATTDescriptor
14
+
15
+ public extension GATTDescriptor {
16
+ private typealias bridge = margelo.nitro.munimbluetooth.bridge.swift
17
+
18
+ /**
19
+ * Create a new instance of `GATTDescriptor`.
20
+ */
21
+ init(uuid: String, value: String?, permissions: [String]?) {
22
+ self.init(std.string(uuid), { () -> bridge.std__optional_std__string_ in
23
+ if let __unwrappedValue = value {
24
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
25
+ } else {
26
+ return .init()
27
+ }
28
+ }(), { () -> bridge.std__optional_std__vector_std__string__ in
29
+ if let __unwrappedValue = permissions {
30
+ return bridge.create_std__optional_std__vector_std__string__({ () -> bridge.std__vector_std__string_ in
31
+ var __vector = bridge.create_std__vector_std__string_(__unwrappedValue.count)
32
+ for __item in __unwrappedValue {
33
+ __vector.push_back(std.string(__item))
34
+ }
35
+ return __vector
36
+ }())
37
+ } else {
38
+ return .init()
39
+ }
40
+ }())
41
+ }
42
+
43
+ @inline(__always)
44
+ var uuid: String {
45
+ return String(self.__uuid)
46
+ }
47
+
48
+ @inline(__always)
49
+ var value: String? {
50
+ return { () -> String? in
51
+ if bridge.has_value_std__optional_std__string_(self.__value) {
52
+ let __unwrapped = bridge.get_std__optional_std__string_(self.__value)
53
+ return String(__unwrapped)
54
+ } else {
55
+ return nil
56
+ }
57
+ }()
58
+ }
59
+
60
+ @inline(__always)
61
+ var permissions: [String]? {
62
+ return { () -> [String]? in
63
+ if bridge.has_value_std__optional_std__vector_std__string__(self.__permissions) {
64
+ let __unwrapped = bridge.get_std__optional_std__vector_std__string__(self.__permissions)
65
+ return __unwrapped.map({ __item in String(__item) })
66
+ } else {
67
+ return nil
68
+ }
69
+ }()
70
+ }
71
+ }