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
@@ -14,14 +14,42 @@ namespace margelo::nitro::munimbluetooth { struct AdvertisingDataTypes; }
14
14
  namespace margelo::nitro::munimbluetooth { struct AdvertisingOptions; }
15
15
  // Forward declaration of `BackgroundSessionOptions` to properly resolve imports.
16
16
  namespace margelo::nitro::munimbluetooth { struct BackgroundSessionOptions; }
17
+ // Forward declaration of `BluetoothCapabilities` to properly resolve imports.
18
+ namespace margelo::nitro::munimbluetooth { struct BluetoothCapabilities; }
19
+ // Forward declaration of `BluetoothPhyOption` to properly resolve imports.
20
+ namespace margelo::nitro::munimbluetooth { enum class BluetoothPhyOption; }
21
+ // Forward declaration of `BluetoothPhy` to properly resolve imports.
22
+ namespace margelo::nitro::munimbluetooth { enum class BluetoothPhy; }
23
+ // Forward declaration of `BondState` to properly resolve imports.
24
+ namespace margelo::nitro::munimbluetooth { enum class BondState; }
17
25
  // Forward declaration of `CharacteristicValue` to properly resolve imports.
18
26
  namespace margelo::nitro::munimbluetooth { struct CharacteristicValue; }
27
+ // Forward declaration of `DescriptorValue` to properly resolve imports.
28
+ namespace margelo::nitro::munimbluetooth { struct DescriptorValue; }
29
+ // Forward declaration of `ExtendedAdvertisingOptions` to properly resolve imports.
30
+ namespace margelo::nitro::munimbluetooth { struct ExtendedAdvertisingOptions; }
19
31
  // Forward declaration of `GATTCharacteristic` to properly resolve imports.
20
32
  namespace margelo::nitro::munimbluetooth { struct GATTCharacteristic; }
33
+ // Forward declaration of `GATTDescriptor` to properly resolve imports.
34
+ namespace margelo::nitro::munimbluetooth { struct GATTDescriptor; }
21
35
  // Forward declaration of `GATTService` to properly resolve imports.
22
36
  namespace margelo::nitro::munimbluetooth { struct GATTService; }
23
37
  // Forward declaration of `HybridMunimBluetoothSpec` to properly resolve imports.
24
38
  namespace margelo::nitro::munimbluetooth { class HybridMunimBluetoothSpec; }
39
+ // Forward declaration of `L2CAPChannel` to properly resolve imports.
40
+ namespace margelo::nitro::munimbluetooth { struct L2CAPChannel; }
41
+ // Forward declaration of `MultipeerDiscoveryInfoEntry` to properly resolve imports.
42
+ namespace margelo::nitro::munimbluetooth { struct MultipeerDiscoveryInfoEntry; }
43
+ // Forward declaration of `MultipeerEncryptionPreference` to properly resolve imports.
44
+ namespace margelo::nitro::munimbluetooth { enum class MultipeerEncryptionPreference; }
45
+ // Forward declaration of `MultipeerPeerState` to properly resolve imports.
46
+ namespace margelo::nitro::munimbluetooth { enum class MultipeerPeerState; }
47
+ // Forward declaration of `MultipeerPeer` to properly resolve imports.
48
+ namespace margelo::nitro::munimbluetooth { struct MultipeerPeer; }
49
+ // Forward declaration of `MultipeerSessionOptions` to properly resolve imports.
50
+ namespace margelo::nitro::munimbluetooth { struct MultipeerSessionOptions; }
51
+ // Forward declaration of `PhyStatus` to properly resolve imports.
52
+ namespace margelo::nitro::munimbluetooth { struct PhyStatus; }
25
53
  // Forward declaration of `ScanMode` to properly resolve imports.
26
54
  namespace margelo::nitro::munimbluetooth { enum class ScanMode; }
27
55
  // Forward declaration of `ScanOptions` to properly resolve imports.
@@ -35,10 +63,24 @@ namespace margelo::nitro::munimbluetooth { enum class WriteType; }
35
63
  #include "AdvertisingDataTypes.hpp"
36
64
  #include "AdvertisingOptions.hpp"
37
65
  #include "BackgroundSessionOptions.hpp"
66
+ #include "BluetoothCapabilities.hpp"
67
+ #include "BluetoothPhy.hpp"
68
+ #include "BluetoothPhyOption.hpp"
69
+ #include "BondState.hpp"
38
70
  #include "CharacteristicValue.hpp"
71
+ #include "DescriptorValue.hpp"
72
+ #include "ExtendedAdvertisingOptions.hpp"
39
73
  #include "GATTCharacteristic.hpp"
74
+ #include "GATTDescriptor.hpp"
40
75
  #include "GATTService.hpp"
41
76
  #include "HybridMunimBluetoothSpec.hpp"
77
+ #include "L2CAPChannel.hpp"
78
+ #include "MultipeerDiscoveryInfoEntry.hpp"
79
+ #include "MultipeerEncryptionPreference.hpp"
80
+ #include "MultipeerPeer.hpp"
81
+ #include "MultipeerPeerState.hpp"
82
+ #include "MultipeerSessionOptions.hpp"
83
+ #include "PhyStatus.hpp"
42
84
  #include "ScanMode.hpp"
43
85
  #include "ScanOptions.hpp"
44
86
  #include "ServiceDataEntry.hpp"
@@ -22,16 +22,44 @@ namespace margelo::nitro::munimbluetooth { struct ServiceDataEntry; }
22
22
  namespace margelo::nitro::munimbluetooth { struct GATTService; }
23
23
  // Forward declaration of `GATTCharacteristic` to properly resolve imports.
24
24
  namespace margelo::nitro::munimbluetooth { struct GATTCharacteristic; }
25
+ // Forward declaration of `GATTDescriptor` to properly resolve imports.
26
+ namespace margelo::nitro::munimbluetooth { struct GATTDescriptor; }
27
+ // Forward declaration of `BluetoothCapabilities` to properly resolve imports.
28
+ namespace margelo::nitro::munimbluetooth { struct BluetoothCapabilities; }
25
29
  // Forward declaration of `ScanOptions` to properly resolve imports.
26
30
  namespace margelo::nitro::munimbluetooth { struct ScanOptions; }
27
31
  // Forward declaration of `ScanMode` to properly resolve imports.
28
32
  namespace margelo::nitro::munimbluetooth { enum class ScanMode; }
29
33
  // Forward declaration of `CharacteristicValue` to properly resolve imports.
30
34
  namespace margelo::nitro::munimbluetooth { struct CharacteristicValue; }
35
+ // Forward declaration of `DescriptorValue` to properly resolve imports.
36
+ namespace margelo::nitro::munimbluetooth { struct DescriptorValue; }
31
37
  // Forward declaration of `WriteType` to properly resolve imports.
32
38
  namespace margelo::nitro::munimbluetooth { enum class WriteType; }
39
+ // Forward declaration of `BluetoothPhy` to properly resolve imports.
40
+ namespace margelo::nitro::munimbluetooth { enum class BluetoothPhy; }
41
+ // Forward declaration of `BluetoothPhyOption` to properly resolve imports.
42
+ namespace margelo::nitro::munimbluetooth { enum class BluetoothPhyOption; }
43
+ // Forward declaration of `PhyStatus` to properly resolve imports.
44
+ namespace margelo::nitro::munimbluetooth { struct PhyStatus; }
45
+ // Forward declaration of `BondState` to properly resolve imports.
46
+ namespace margelo::nitro::munimbluetooth { enum class BondState; }
47
+ // Forward declaration of `ExtendedAdvertisingOptions` to properly resolve imports.
48
+ namespace margelo::nitro::munimbluetooth { struct ExtendedAdvertisingOptions; }
49
+ // Forward declaration of `L2CAPChannel` to properly resolve imports.
50
+ namespace margelo::nitro::munimbluetooth { struct L2CAPChannel; }
33
51
  // Forward declaration of `BackgroundSessionOptions` to properly resolve imports.
34
52
  namespace margelo::nitro::munimbluetooth { struct BackgroundSessionOptions; }
53
+ // Forward declaration of `MultipeerSessionOptions` to properly resolve imports.
54
+ namespace margelo::nitro::munimbluetooth { struct MultipeerSessionOptions; }
55
+ // Forward declaration of `MultipeerDiscoveryInfoEntry` to properly resolve imports.
56
+ namespace margelo::nitro::munimbluetooth { struct MultipeerDiscoveryInfoEntry; }
57
+ // Forward declaration of `MultipeerEncryptionPreference` to properly resolve imports.
58
+ namespace margelo::nitro::munimbluetooth { enum class MultipeerEncryptionPreference; }
59
+ // Forward declaration of `MultipeerPeer` to properly resolve imports.
60
+ namespace margelo::nitro::munimbluetooth { struct MultipeerPeer; }
61
+ // Forward declaration of `MultipeerPeerState` to properly resolve imports.
62
+ namespace margelo::nitro::munimbluetooth { enum class MultipeerPeerState; }
35
63
 
36
64
  #include "AdvertisingOptions.hpp"
37
65
  #include <string>
@@ -42,11 +70,25 @@ namespace margelo::nitro::munimbluetooth { struct BackgroundSessionOptions; }
42
70
  #include <NitroModules/Promise.hpp>
43
71
  #include "GATTService.hpp"
44
72
  #include "GATTCharacteristic.hpp"
73
+ #include "GATTDescriptor.hpp"
74
+ #include "BluetoothCapabilities.hpp"
45
75
  #include "ScanOptions.hpp"
46
76
  #include "ScanMode.hpp"
47
77
  #include "CharacteristicValue.hpp"
78
+ #include "DescriptorValue.hpp"
48
79
  #include "WriteType.hpp"
80
+ #include "BluetoothPhy.hpp"
81
+ #include "BluetoothPhyOption.hpp"
82
+ #include "PhyStatus.hpp"
83
+ #include "BondState.hpp"
84
+ #include "ExtendedAdvertisingOptions.hpp"
85
+ #include "L2CAPChannel.hpp"
49
86
  #include "BackgroundSessionOptions.hpp"
87
+ #include "MultipeerSessionOptions.hpp"
88
+ #include "MultipeerDiscoveryInfoEntry.hpp"
89
+ #include "MultipeerEncryptionPreference.hpp"
90
+ #include "MultipeerPeer.hpp"
91
+ #include "MultipeerPeerState.hpp"
50
92
 
51
93
  #include "MunimBluetooth-Swift-Cxx-Umbrella.hpp"
52
94
 
@@ -130,6 +172,14 @@ namespace margelo::nitro::munimbluetooth {
130
172
  std::rethrow_exception(__result.error());
131
173
  }
132
174
  }
175
+ inline std::shared_ptr<Promise<void>> updateCharacteristicValue(const std::string& serviceUUID, const std::string& characteristicUUID, const std::string& value, std::optional<bool> notify) override {
176
+ auto __result = _swiftPart.updateCharacteristicValue(serviceUUID, characteristicUUID, value, notify);
177
+ if (__result.hasError()) [[unlikely]] {
178
+ std::rethrow_exception(__result.error());
179
+ }
180
+ auto __value = std::move(__result.value());
181
+ return __value;
182
+ }
133
183
  inline std::shared_ptr<Promise<bool>> isBluetoothEnabled() override {
134
184
  auto __result = _swiftPart.isBluetoothEnabled();
135
185
  if (__result.hasError()) [[unlikely]] {
@@ -146,6 +196,14 @@ namespace margelo::nitro::munimbluetooth {
146
196
  auto __value = std::move(__result.value());
147
197
  return __value;
148
198
  }
199
+ inline std::shared_ptr<Promise<BluetoothCapabilities>> getCapabilities() override {
200
+ auto __result = _swiftPart.getCapabilities();
201
+ if (__result.hasError()) [[unlikely]] {
202
+ std::rethrow_exception(__result.error());
203
+ }
204
+ auto __value = std::move(__result.value());
205
+ return __value;
206
+ }
149
207
  inline void startScan(const std::optional<ScanOptions>& options) override {
150
208
  auto __result = _swiftPart.startScan(options);
151
209
  if (__result.hasError()) [[unlikely]] {
@@ -188,6 +246,14 @@ namespace margelo::nitro::munimbluetooth {
188
246
  auto __value = std::move(__result.value());
189
247
  return __value;
190
248
  }
249
+ inline std::shared_ptr<Promise<DescriptorValue>> readDescriptor(const std::string& deviceId, const std::string& serviceUUID, const std::string& characteristicUUID, const std::string& descriptorUUID) override {
250
+ auto __result = _swiftPart.readDescriptor(deviceId, serviceUUID, characteristicUUID, descriptorUUID);
251
+ if (__result.hasError()) [[unlikely]] {
252
+ std::rethrow_exception(__result.error());
253
+ }
254
+ auto __value = std::move(__result.value());
255
+ return __value;
256
+ }
191
257
  inline std::shared_ptr<Promise<void>> writeCharacteristic(const std::string& deviceId, const std::string& serviceUUID, const std::string& characteristicUUID, const std::string& value, std::optional<WriteType> writeType) override {
192
258
  auto __result = _swiftPart.writeCharacteristic(deviceId, serviceUUID, characteristicUUID, value, writeType);
193
259
  if (__result.hasError()) [[unlikely]] {
@@ -196,6 +262,14 @@ namespace margelo::nitro::munimbluetooth {
196
262
  auto __value = std::move(__result.value());
197
263
  return __value;
198
264
  }
265
+ inline std::shared_ptr<Promise<void>> writeDescriptor(const std::string& deviceId, const std::string& serviceUUID, const std::string& characteristicUUID, const std::string& descriptorUUID, const std::string& value) override {
266
+ auto __result = _swiftPart.writeDescriptor(deviceId, serviceUUID, characteristicUUID, descriptorUUID, value);
267
+ if (__result.hasError()) [[unlikely]] {
268
+ std::rethrow_exception(__result.error());
269
+ }
270
+ auto __value = std::move(__result.value());
271
+ return __value;
272
+ }
199
273
  inline void subscribeToCharacteristic(const std::string& deviceId, const std::string& serviceUUID, const std::string& characteristicUUID) override {
200
274
  auto __result = _swiftPart.subscribeToCharacteristic(deviceId, serviceUUID, characteristicUUID);
201
275
  if (__result.hasError()) [[unlikely]] {
@@ -224,6 +298,152 @@ namespace margelo::nitro::munimbluetooth {
224
298
  auto __value = std::move(__result.value());
225
299
  return __value;
226
300
  }
301
+ inline std::shared_ptr<Promise<double>> requestMTU(const std::string& deviceId, double mtu) override {
302
+ auto __result = _swiftPart.requestMTU(deviceId, std::forward<decltype(mtu)>(mtu));
303
+ if (__result.hasError()) [[unlikely]] {
304
+ std::rethrow_exception(__result.error());
305
+ }
306
+ auto __value = std::move(__result.value());
307
+ return __value;
308
+ }
309
+ inline std::shared_ptr<Promise<void>> setPreferredPhy(const std::string& deviceId, BluetoothPhy txPhy, BluetoothPhy rxPhy, std::optional<BluetoothPhyOption> phyOption) override {
310
+ auto __result = _swiftPart.setPreferredPhy(deviceId, static_cast<int>(txPhy), static_cast<int>(rxPhy), phyOption);
311
+ if (__result.hasError()) [[unlikely]] {
312
+ std::rethrow_exception(__result.error());
313
+ }
314
+ auto __value = std::move(__result.value());
315
+ return __value;
316
+ }
317
+ inline std::shared_ptr<Promise<PhyStatus>> readPhy(const std::string& deviceId) override {
318
+ auto __result = _swiftPart.readPhy(deviceId);
319
+ if (__result.hasError()) [[unlikely]] {
320
+ std::rethrow_exception(__result.error());
321
+ }
322
+ auto __value = std::move(__result.value());
323
+ return __value;
324
+ }
325
+ inline std::shared_ptr<Promise<BondState>> getBondState(const std::string& deviceId) override {
326
+ auto __result = _swiftPart.getBondState(deviceId);
327
+ if (__result.hasError()) [[unlikely]] {
328
+ std::rethrow_exception(__result.error());
329
+ }
330
+ auto __value = std::move(__result.value());
331
+ return __value;
332
+ }
333
+ inline std::shared_ptr<Promise<BondState>> createBond(const std::string& deviceId) override {
334
+ auto __result = _swiftPart.createBond(deviceId);
335
+ if (__result.hasError()) [[unlikely]] {
336
+ std::rethrow_exception(__result.error());
337
+ }
338
+ auto __value = std::move(__result.value());
339
+ return __value;
340
+ }
341
+ inline std::shared_ptr<Promise<BondState>> removeBond(const std::string& deviceId) override {
342
+ auto __result = _swiftPart.removeBond(deviceId);
343
+ if (__result.hasError()) [[unlikely]] {
344
+ std::rethrow_exception(__result.error());
345
+ }
346
+ auto __value = std::move(__result.value());
347
+ return __value;
348
+ }
349
+ inline std::shared_ptr<Promise<std::string>> startExtendedAdvertising(const ExtendedAdvertisingOptions& options) override {
350
+ auto __result = _swiftPart.startExtendedAdvertising(std::forward<decltype(options)>(options));
351
+ if (__result.hasError()) [[unlikely]] {
352
+ std::rethrow_exception(__result.error());
353
+ }
354
+ auto __value = std::move(__result.value());
355
+ return __value;
356
+ }
357
+ inline void stopExtendedAdvertising(const std::string& advertisingId) override {
358
+ auto __result = _swiftPart.stopExtendedAdvertising(advertisingId);
359
+ if (__result.hasError()) [[unlikely]] {
360
+ std::rethrow_exception(__result.error());
361
+ }
362
+ }
363
+ inline std::shared_ptr<Promise<L2CAPChannel>> publishL2CAPChannel(std::optional<bool> encryptionRequired) override {
364
+ auto __result = _swiftPart.publishL2CAPChannel(encryptionRequired);
365
+ if (__result.hasError()) [[unlikely]] {
366
+ std::rethrow_exception(__result.error());
367
+ }
368
+ auto __value = std::move(__result.value());
369
+ return __value;
370
+ }
371
+ inline void unpublishL2CAPChannel(double psm) override {
372
+ auto __result = _swiftPart.unpublishL2CAPChannel(std::forward<decltype(psm)>(psm));
373
+ if (__result.hasError()) [[unlikely]] {
374
+ std::rethrow_exception(__result.error());
375
+ }
376
+ }
377
+ inline std::shared_ptr<Promise<L2CAPChannel>> openL2CAPChannel(const std::string& deviceId, double psm) override {
378
+ auto __result = _swiftPart.openL2CAPChannel(deviceId, std::forward<decltype(psm)>(psm));
379
+ if (__result.hasError()) [[unlikely]] {
380
+ std::rethrow_exception(__result.error());
381
+ }
382
+ auto __value = std::move(__result.value());
383
+ return __value;
384
+ }
385
+ inline void closeL2CAPChannel(const std::string& channelId) override {
386
+ auto __result = _swiftPart.closeL2CAPChannel(channelId);
387
+ if (__result.hasError()) [[unlikely]] {
388
+ std::rethrow_exception(__result.error());
389
+ }
390
+ }
391
+ inline std::shared_ptr<Promise<void>> sendL2CAPData(const std::string& channelId, const std::string& value) override {
392
+ auto __result = _swiftPart.sendL2CAPData(channelId, value);
393
+ if (__result.hasError()) [[unlikely]] {
394
+ std::rethrow_exception(__result.error());
395
+ }
396
+ auto __value = std::move(__result.value());
397
+ return __value;
398
+ }
399
+ inline void startClassicScan() override {
400
+ auto __result = _swiftPart.startClassicScan();
401
+ if (__result.hasError()) [[unlikely]] {
402
+ std::rethrow_exception(__result.error());
403
+ }
404
+ }
405
+ inline void stopClassicScan() override {
406
+ auto __result = _swiftPart.stopClassicScan();
407
+ if (__result.hasError()) [[unlikely]] {
408
+ std::rethrow_exception(__result.error());
409
+ }
410
+ }
411
+ inline std::shared_ptr<Promise<void>> connectClassic(const std::string& deviceId, const std::optional<std::string>& serviceUUID) override {
412
+ auto __result = _swiftPart.connectClassic(deviceId, serviceUUID);
413
+ if (__result.hasError()) [[unlikely]] {
414
+ std::rethrow_exception(__result.error());
415
+ }
416
+ auto __value = std::move(__result.value());
417
+ return __value;
418
+ }
419
+ inline std::shared_ptr<Promise<void>> startClassicServer(const std::optional<std::string>& serviceUUID, const std::optional<std::string>& serviceName) override {
420
+ auto __result = _swiftPart.startClassicServer(serviceUUID, serviceName);
421
+ if (__result.hasError()) [[unlikely]] {
422
+ std::rethrow_exception(__result.error());
423
+ }
424
+ auto __value = std::move(__result.value());
425
+ return __value;
426
+ }
427
+ inline void stopClassicServer(const std::optional<std::string>& serviceUUID) override {
428
+ auto __result = _swiftPart.stopClassicServer(serviceUUID);
429
+ if (__result.hasError()) [[unlikely]] {
430
+ std::rethrow_exception(__result.error());
431
+ }
432
+ }
433
+ inline void disconnectClassic(const std::string& deviceId) override {
434
+ auto __result = _swiftPart.disconnectClassic(deviceId);
435
+ if (__result.hasError()) [[unlikely]] {
436
+ std::rethrow_exception(__result.error());
437
+ }
438
+ }
439
+ inline std::shared_ptr<Promise<void>> writeClassic(const std::string& deviceId, const std::string& value) override {
440
+ auto __result = _swiftPart.writeClassic(deviceId, value);
441
+ if (__result.hasError()) [[unlikely]] {
442
+ std::rethrow_exception(__result.error());
443
+ }
444
+ auto __value = std::move(__result.value());
445
+ return __value;
446
+ }
227
447
  inline void startBackgroundSession(const BackgroundSessionOptions& options) override {
228
448
  auto __result = _swiftPart.startBackgroundSession(std::forward<decltype(options)>(options));
229
449
  if (__result.hasError()) [[unlikely]] {
@@ -236,6 +456,40 @@ namespace margelo::nitro::munimbluetooth {
236
456
  std::rethrow_exception(__result.error());
237
457
  }
238
458
  }
459
+ inline void startMultipeerSession(const MultipeerSessionOptions& options) override {
460
+ auto __result = _swiftPart.startMultipeerSession(std::forward<decltype(options)>(options));
461
+ if (__result.hasError()) [[unlikely]] {
462
+ std::rethrow_exception(__result.error());
463
+ }
464
+ }
465
+ inline void stopMultipeerSession() override {
466
+ auto __result = _swiftPart.stopMultipeerSession();
467
+ if (__result.hasError()) [[unlikely]] {
468
+ std::rethrow_exception(__result.error());
469
+ }
470
+ }
471
+ inline void inviteMultipeerPeer(const std::string& peerId) override {
472
+ auto __result = _swiftPart.inviteMultipeerPeer(peerId);
473
+ if (__result.hasError()) [[unlikely]] {
474
+ std::rethrow_exception(__result.error());
475
+ }
476
+ }
477
+ inline std::shared_ptr<Promise<std::vector<MultipeerPeer>>> getMultipeerPeers() override {
478
+ auto __result = _swiftPart.getMultipeerPeers();
479
+ if (__result.hasError()) [[unlikely]] {
480
+ std::rethrow_exception(__result.error());
481
+ }
482
+ auto __value = std::move(__result.value());
483
+ return __value;
484
+ }
485
+ inline std::shared_ptr<Promise<void>> sendMultipeerMessage(const std::string& value, const std::optional<std::vector<std::string>>& peerIds, std::optional<bool> reliable) override {
486
+ auto __result = _swiftPart.sendMultipeerMessage(value, peerIds, reliable);
487
+ if (__result.hasError()) [[unlikely]] {
488
+ std::rethrow_exception(__result.error());
489
+ }
490
+ auto __value = std::move(__result.value());
491
+ return __value;
492
+ }
239
493
  inline void addListener(const std::string& eventName) override {
240
494
  auto __result = _swiftPart.addListener(eventName);
241
495
  if (__result.hasError()) [[unlikely]] {
@@ -0,0 +1,89 @@
1
+ ///
2
+ /// 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
+ * Represents an instance of `BluetoothCapabilities`, backed by a C++ struct.
12
+ */
13
+ public typealias BluetoothCapabilities = margelo.nitro.munimbluetooth.BluetoothCapabilities
14
+
15
+ public extension BluetoothCapabilities {
16
+ private typealias bridge = margelo.nitro.munimbluetooth.bridge.swift
17
+
18
+ /**
19
+ * Create a new instance of `BluetoothCapabilities`.
20
+ */
21
+ init(platform: String, supportsBleCentral: Bool, supportsBlePeripheral: Bool, supportsDescriptors: Bool, supportsIncludedServices: Bool, supportsMtu: Bool, supportsPhy: Bool, supportsBonding: Bool, supportsExtendedAdvertising: Bool, supportsL2cap: Bool, supportsClassicBluetooth: Bool, supportsBackgroundBle: Bool, supportsMultipeerConnectivity: Bool) {
22
+ self.init(std.string(platform), supportsBleCentral, supportsBlePeripheral, supportsDescriptors, supportsIncludedServices, supportsMtu, supportsPhy, supportsBonding, supportsExtendedAdvertising, supportsL2cap, supportsClassicBluetooth, supportsBackgroundBle, supportsMultipeerConnectivity)
23
+ }
24
+
25
+ @inline(__always)
26
+ var platform: String {
27
+ return String(self.__platform)
28
+ }
29
+
30
+ @inline(__always)
31
+ var supportsBleCentral: Bool {
32
+ return self.__supportsBleCentral
33
+ }
34
+
35
+ @inline(__always)
36
+ var supportsBlePeripheral: Bool {
37
+ return self.__supportsBlePeripheral
38
+ }
39
+
40
+ @inline(__always)
41
+ var supportsDescriptors: Bool {
42
+ return self.__supportsDescriptors
43
+ }
44
+
45
+ @inline(__always)
46
+ var supportsIncludedServices: Bool {
47
+ return self.__supportsIncludedServices
48
+ }
49
+
50
+ @inline(__always)
51
+ var supportsMtu: Bool {
52
+ return self.__supportsMtu
53
+ }
54
+
55
+ @inline(__always)
56
+ var supportsPhy: Bool {
57
+ return self.__supportsPhy
58
+ }
59
+
60
+ @inline(__always)
61
+ var supportsBonding: Bool {
62
+ return self.__supportsBonding
63
+ }
64
+
65
+ @inline(__always)
66
+ var supportsExtendedAdvertising: Bool {
67
+ return self.__supportsExtendedAdvertising
68
+ }
69
+
70
+ @inline(__always)
71
+ var supportsL2cap: Bool {
72
+ return self.__supportsL2cap
73
+ }
74
+
75
+ @inline(__always)
76
+ var supportsClassicBluetooth: Bool {
77
+ return self.__supportsClassicBluetooth
78
+ }
79
+
80
+ @inline(__always)
81
+ var supportsBackgroundBle: Bool {
82
+ return self.__supportsBackgroundBle
83
+ }
84
+
85
+ @inline(__always)
86
+ var supportsMultipeerConnectivity: Bool {
87
+ return self.__supportsMultipeerConnectivity
88
+ }
89
+ }
@@ -0,0 +1,44 @@
1
+ ///
2
+ /// BluetoothPhy.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 `BluetoothPhy`, backed by a C++ enum.
10
+ */
11
+ public typealias BluetoothPhy = margelo.nitro.munimbluetooth.BluetoothPhy
12
+
13
+ public extension BluetoothPhy {
14
+ /**
15
+ * Get a BluetoothPhy 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 "le1m":
21
+ self = .le1m
22
+ case "le2m":
23
+ self = .le2m
24
+ case "leCoded":
25
+ self = .lecoded
26
+ default:
27
+ return nil
28
+ }
29
+ }
30
+
31
+ /**
32
+ * Get the String value this BluetoothPhy represents.
33
+ */
34
+ var stringValue: String {
35
+ switch self {
36
+ case .le1m:
37
+ return "le1m"
38
+ case .le2m:
39
+ return "le2m"
40
+ case .lecoded:
41
+ return "leCoded"
42
+ }
43
+ }
44
+ }
@@ -0,0 +1,44 @@
1
+ ///
2
+ /// BluetoothPhyOption.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 `BluetoothPhyOption`, backed by a C++ enum.
10
+ */
11
+ public typealias BluetoothPhyOption = margelo.nitro.munimbluetooth.BluetoothPhyOption
12
+
13
+ public extension BluetoothPhyOption {
14
+ /**
15
+ * Get a BluetoothPhyOption 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 "none":
21
+ self = .none
22
+ case "s2":
23
+ self = .s2
24
+ case "s8":
25
+ self = .s8
26
+ default:
27
+ return nil
28
+ }
29
+ }
30
+
31
+ /**
32
+ * Get the String value this BluetoothPhyOption represents.
33
+ */
34
+ var stringValue: String {
35
+ switch self {
36
+ case .none:
37
+ return "none"
38
+ case .s2:
39
+ return "s2"
40
+ case .s8:
41
+ return "s8"
42
+ }
43
+ }
44
+ }
@@ -0,0 +1,48 @@
1
+ ///
2
+ /// 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
+ /**
9
+ * Represents the JS union `BondState`, backed by a C++ enum.
10
+ */
11
+ public typealias BondState = margelo.nitro.munimbluetooth.BondState
12
+
13
+ public extension BondState {
14
+ /**
15
+ * Get a BondState 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 "none":
21
+ self = .none
22
+ case "bonding":
23
+ self = .bonding
24
+ case "bonded":
25
+ self = .bonded
26
+ case "unsupported":
27
+ self = .unsupported
28
+ default:
29
+ return nil
30
+ }
31
+ }
32
+
33
+ /**
34
+ * Get the String value this BondState represents.
35
+ */
36
+ var stringValue: String {
37
+ switch self {
38
+ case .none:
39
+ return "none"
40
+ case .bonding:
41
+ return "bonding"
42
+ case .bonded:
43
+ return "bonded"
44
+ case .unsupported:
45
+ return "unsupported"
46
+ }
47
+ }
48
+ }
@@ -0,0 +1,44 @@
1
+ ///
2
+ /// 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
+ * Represents an instance of `DescriptorValue`, backed by a C++ struct.
12
+ */
13
+ public typealias DescriptorValue = margelo.nitro.munimbluetooth.DescriptorValue
14
+
15
+ public extension DescriptorValue {
16
+ private typealias bridge = margelo.nitro.munimbluetooth.bridge.swift
17
+
18
+ /**
19
+ * Create a new instance of `DescriptorValue`.
20
+ */
21
+ init(value: String, serviceUUID: String, characteristicUUID: String, descriptorUUID: String) {
22
+ self.init(std.string(value), std.string(serviceUUID), std.string(characteristicUUID), std.string(descriptorUUID))
23
+ }
24
+
25
+ @inline(__always)
26
+ var value: String {
27
+ return String(self.__value)
28
+ }
29
+
30
+ @inline(__always)
31
+ var serviceUUID: String {
32
+ return String(self.__serviceUUID)
33
+ }
34
+
35
+ @inline(__always)
36
+ var characteristicUUID: String {
37
+ return String(self.__characteristicUUID)
38
+ }
39
+
40
+ @inline(__always)
41
+ var descriptorUUID: String {
42
+ return String(self.__descriptorUUID)
43
+ }
44
+ }