munim-bluetooth 0.2.7 → 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 (71) hide show
  1. package/MunimBluetooth.podspec +1 -0
  2. package/lib/typescript/src/specs/munim-bluetooth.nitro.d.ts +24 -25
  3. package/lib/typescript/src/specs/munim-bluetooth.nitro.d.ts.map +1 -1
  4. package/nitrogen/generated/.gitattributes +1 -0
  5. package/nitrogen/generated/android/MunimBluetooth+autolinking.cmake +81 -0
  6. package/nitrogen/generated/android/MunimBluetooth+autolinking.gradle +27 -0
  7. package/nitrogen/generated/android/MunimBluetoothOnLoad.cpp +44 -0
  8. package/nitrogen/generated/android/MunimBluetoothOnLoad.hpp +25 -0
  9. package/nitrogen/generated/android/c++/JAdvertisingDataTypes.hpp +345 -0
  10. package/nitrogen/generated/android/c++/JAdvertisingOptions.hpp +93 -0
  11. package/nitrogen/generated/android/c++/JCharacteristicValue.hpp +65 -0
  12. package/nitrogen/generated/android/c++/JGATTCharacteristic.hpp +85 -0
  13. package/nitrogen/generated/android/c++/JGATTService.hpp +83 -0
  14. package/nitrogen/generated/android/c++/JHybridMunimBluetoothSpec.cpp +307 -0
  15. package/nitrogen/generated/android/c++/JHybridMunimBluetoothSpec.hpp +85 -0
  16. package/nitrogen/generated/android/c++/JScanMode.hpp +61 -0
  17. package/nitrogen/generated/android/c++/JScanOptions.hpp +87 -0
  18. package/nitrogen/generated/android/c++/JServiceDataEntry.hpp +61 -0
  19. package/nitrogen/generated/android/c++/JWriteType.hpp +58 -0
  20. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/AdvertisingDataTypes.kt +89 -0
  21. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/AdvertisingOptions.kt +47 -0
  22. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/CharacteristicValue.kt +44 -0
  23. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/GATTCharacteristic.kt +44 -0
  24. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/GATTService.kt +41 -0
  25. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/HybridMunimBluetoothSpec.kt +134 -0
  26. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/MunimBluetoothOnLoad.kt +35 -0
  27. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/ScanMode.kt +24 -0
  28. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/ScanOptions.kt +44 -0
  29. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/ServiceDataEntry.kt +41 -0
  30. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/WriteType.kt +23 -0
  31. package/nitrogen/generated/ios/MunimBluetooth+autolinking.rb +60 -0
  32. package/nitrogen/generated/ios/MunimBluetooth-Swift-Cxx-Bridge.cpp +97 -0
  33. package/nitrogen/generated/ios/MunimBluetooth-Swift-Cxx-Bridge.hpp +583 -0
  34. package/nitrogen/generated/ios/MunimBluetooth-Swift-Cxx-Umbrella.hpp +74 -0
  35. package/nitrogen/generated/ios/MunimBluetoothAutolinking.mm +33 -0
  36. package/nitrogen/generated/ios/MunimBluetoothAutolinking.swift +44 -0
  37. package/nitrogen/generated/ios/c++/HybridMunimBluetoothSpecSwift.cpp +11 -0
  38. package/nitrogen/generated/ios/c++/HybridMunimBluetoothSpecSwift.hpp +241 -0
  39. package/nitrogen/generated/ios/swift/AdvertisingDataTypes.swift +400 -0
  40. package/nitrogen/generated/ios/swift/AdvertisingOptions.swift +83 -0
  41. package/nitrogen/generated/ios/swift/CharacteristicValue.swift +40 -0
  42. package/nitrogen/generated/ios/swift/Func_void.swift +47 -0
  43. package/nitrogen/generated/ios/swift/Func_void_AdvertisingDataTypes.swift +47 -0
  44. package/nitrogen/generated/ios/swift/Func_void_CharacteristicValue.swift +47 -0
  45. package/nitrogen/generated/ios/swift/Func_void_bool.swift +47 -0
  46. package/nitrogen/generated/ios/swift/Func_void_double.swift +47 -0
  47. package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +47 -0
  48. package/nitrogen/generated/ios/swift/Func_void_std__vector_GATTService_.swift +47 -0
  49. package/nitrogen/generated/ios/swift/Func_void_std__vector_std__string_.swift +47 -0
  50. package/nitrogen/generated/ios/swift/GATTCharacteristic.swift +59 -0
  51. package/nitrogen/generated/ios/swift/GATTService.swift +41 -0
  52. package/nitrogen/generated/ios/swift/HybridMunimBluetoothSpec.swift +75 -0
  53. package/nitrogen/generated/ios/swift/HybridMunimBluetoothSpec_cxx.swift +431 -0
  54. package/nitrogen/generated/ios/swift/ScanMode.swift +44 -0
  55. package/nitrogen/generated/ios/swift/ScanOptions.swift +78 -0
  56. package/nitrogen/generated/ios/swift/ServiceDataEntry.swift +35 -0
  57. package/nitrogen/generated/ios/swift/WriteType.swift +40 -0
  58. package/nitrogen/generated/shared/c++/AdvertisingDataTypes.hpp +155 -0
  59. package/nitrogen/generated/shared/c++/AdvertisingOptions.hpp +99 -0
  60. package/nitrogen/generated/shared/c++/CharacteristicValue.hpp +91 -0
  61. package/nitrogen/generated/shared/c++/GATTCharacteristic.hpp +93 -0
  62. package/nitrogen/generated/shared/c++/GATTService.hpp +90 -0
  63. package/nitrogen/generated/shared/c++/HybridMunimBluetoothSpec.cpp +40 -0
  64. package/nitrogen/generated/shared/c++/HybridMunimBluetoothSpec.hpp +101 -0
  65. package/nitrogen/generated/shared/c++/ScanMode.hpp +80 -0
  66. package/nitrogen/generated/shared/c++/ScanOptions.hpp +95 -0
  67. package/nitrogen/generated/shared/c++/ServiceDataEntry.hpp +87 -0
  68. package/nitrogen/generated/shared/c++/WriteType.hpp +76 -0
  69. package/package.json +9 -9
  70. package/src/specs/munim-bluetooth.nitro.ts +34 -25
  71. package/lib/module/package.json +0 -1
@@ -0,0 +1,33 @@
1
+ ///
2
+ /// MunimBluetoothAutolinking.mm
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/Foundation.h>
9
+ #import <NitroModules/HybridObjectRegistry.hpp>
10
+ #import "MunimBluetooth-Swift-Cxx-Umbrella.hpp"
11
+ #import <type_traits>
12
+
13
+ #include "HybridMunimBluetoothSpecSwift.hpp"
14
+
15
+ @interface MunimBluetoothAutolinking : NSObject
16
+ @end
17
+
18
+ @implementation MunimBluetoothAutolinking
19
+
20
+ + (void) load {
21
+ using namespace margelo::nitro;
22
+ using namespace margelo::nitro::munimbluetooth;
23
+
24
+ HybridObjectRegistry::registerHybridObjectConstructor(
25
+ "MunimBluetooth",
26
+ []() -> std::shared_ptr<HybridObject> {
27
+ std::shared_ptr<HybridMunimBluetoothSpec> hybridObject = MunimBluetooth::MunimBluetoothAutolinking::AutolinkedMunimBluetooth::create();
28
+ return hybridObject;
29
+ }
30
+ );
31
+ }
32
+
33
+ @end
@@ -0,0 +1,44 @@
1
+ ///
2
+ /// MunimBluetoothAutolinking.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
+ // TODO: Use empty enums once Swift supports exporting them as namespaces
11
+ // See: https://github.com/swiftlang/swift/pull/83616
12
+ public final class MunimBluetoothAutolinking {
13
+ public typealias bridge = margelo.nitro.munimbluetooth.bridge.swift
14
+
15
+ private protocol AutolinkedClass {
16
+ associatedtype T
17
+ /**
18
+ * Creates an instance of the Swift class that implements the HybridObject's spec,
19
+ * and wraps it in a Swift class that can directly interop with C++.
20
+ *
21
+ * This is generated by Nitrogen and will initialize the class specified
22
+ * in the `"autolinking"` property of `nitro.json`.
23
+ */
24
+ static func create() -> T
25
+ /**
26
+ * Returns whether this concrete implementation is also
27
+ * conforming to the `RecyclableView` protocol, or not.
28
+ */
29
+ static var isRecyclableHybridView: Bool { get }
30
+ }
31
+
32
+ public final class AutolinkedMunimBluetooth: AutolinkedClass {
33
+ public static func create() -> bridge.std__shared_ptr_HybridMunimBluetoothSpec_ {
34
+ let hybridObject = HybridMunimBluetooth()
35
+ return { () -> bridge.std__shared_ptr_HybridMunimBluetoothSpec_ in
36
+ let __cxxWrapped = hybridObject.getCxxWrapper()
37
+ return __cxxWrapped.getCxxPart()
38
+ }()
39
+ }
40
+ public static var isRecyclableHybridView: Bool {
41
+ return HybridMunimBluetooth.self is any RecyclableView.Type
42
+ }
43
+ }
44
+ }
@@ -0,0 +1,11 @@
1
+ ///
2
+ /// HybridMunimBluetoothSpecSwift.cpp
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
+ #include "HybridMunimBluetoothSpecSwift.hpp"
9
+
10
+ namespace margelo::nitro::munimbluetooth {
11
+ } // namespace margelo::nitro::munimbluetooth
@@ -0,0 +1,241 @@
1
+ ///
2
+ /// HybridMunimBluetoothSpecSwift.hpp
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
+ #pragma once
9
+
10
+ #include "HybridMunimBluetoothSpec.hpp"
11
+
12
+ // Forward declaration of `HybridMunimBluetoothSpec_cxx` to properly resolve imports.
13
+ namespace MunimBluetooth { class HybridMunimBluetoothSpec_cxx; }
14
+
15
+ // Forward declaration of `AdvertisingOptions` to properly resolve imports.
16
+ namespace margelo::nitro::munimbluetooth { struct AdvertisingOptions; }
17
+ // Forward declaration of `AdvertisingDataTypes` to properly resolve imports.
18
+ namespace margelo::nitro::munimbluetooth { struct AdvertisingDataTypes; }
19
+ // Forward declaration of `ServiceDataEntry` to properly resolve imports.
20
+ namespace margelo::nitro::munimbluetooth { struct ServiceDataEntry; }
21
+ // Forward declaration of `GATTService` to properly resolve imports.
22
+ namespace margelo::nitro::munimbluetooth { struct GATTService; }
23
+ // Forward declaration of `GATTCharacteristic` to properly resolve imports.
24
+ namespace margelo::nitro::munimbluetooth { struct GATTCharacteristic; }
25
+ // Forward declaration of `ScanOptions` to properly resolve imports.
26
+ namespace margelo::nitro::munimbluetooth { struct ScanOptions; }
27
+ // Forward declaration of `ScanMode` to properly resolve imports.
28
+ namespace margelo::nitro::munimbluetooth { enum class ScanMode; }
29
+ // Forward declaration of `CharacteristicValue` to properly resolve imports.
30
+ namespace margelo::nitro::munimbluetooth { struct CharacteristicValue; }
31
+ // Forward declaration of `WriteType` to properly resolve imports.
32
+ namespace margelo::nitro::munimbluetooth { enum class WriteType; }
33
+
34
+ #include "AdvertisingOptions.hpp"
35
+ #include <string>
36
+ #include <vector>
37
+ #include <optional>
38
+ #include "AdvertisingDataTypes.hpp"
39
+ #include "ServiceDataEntry.hpp"
40
+ #include <NitroModules/Promise.hpp>
41
+ #include "GATTService.hpp"
42
+ #include "GATTCharacteristic.hpp"
43
+ #include "ScanOptions.hpp"
44
+ #include "ScanMode.hpp"
45
+ #include "CharacteristicValue.hpp"
46
+ #include "WriteType.hpp"
47
+
48
+ #include "MunimBluetooth-Swift-Cxx-Umbrella.hpp"
49
+
50
+ namespace margelo::nitro::munimbluetooth {
51
+
52
+ /**
53
+ * The C++ part of HybridMunimBluetoothSpec_cxx.swift.
54
+ *
55
+ * HybridMunimBluetoothSpecSwift (C++) accesses HybridMunimBluetoothSpec_cxx (Swift), and might
56
+ * contain some additional bridging code for C++ <> Swift interop.
57
+ *
58
+ * Since this obviously introduces an overhead, I hope at some point in
59
+ * the future, HybridMunimBluetoothSpec_cxx can directly inherit from the C++ class HybridMunimBluetoothSpec
60
+ * to simplify the whole structure and memory management.
61
+ */
62
+ class HybridMunimBluetoothSpecSwift: public virtual HybridMunimBluetoothSpec {
63
+ public:
64
+ // Constructor from a Swift instance
65
+ explicit HybridMunimBluetoothSpecSwift(const MunimBluetooth::HybridMunimBluetoothSpec_cxx& swiftPart):
66
+ HybridObject(HybridMunimBluetoothSpec::TAG),
67
+ _swiftPart(swiftPart) { }
68
+
69
+ public:
70
+ // Get the Swift part
71
+ inline MunimBluetooth::HybridMunimBluetoothSpec_cxx& getSwiftPart() noexcept {
72
+ return _swiftPart;
73
+ }
74
+
75
+ public:
76
+ inline size_t getExternalMemorySize() noexcept override {
77
+ return _swiftPart.getMemorySize();
78
+ }
79
+ bool equals(const std::shared_ptr<HybridObject>& other) override {
80
+ if (auto otherCast = std::dynamic_pointer_cast<HybridMunimBluetoothSpecSwift>(other)) {
81
+ return _swiftPart.equals(otherCast->_swiftPart);
82
+ }
83
+ return false;
84
+ }
85
+ void dispose() noexcept override {
86
+ _swiftPart.dispose();
87
+ }
88
+ std::string toString() override {
89
+ return _swiftPart.toString();
90
+ }
91
+
92
+ public:
93
+ // Properties
94
+
95
+
96
+ public:
97
+ // Methods
98
+ inline void startAdvertising(const AdvertisingOptions& options) override {
99
+ auto __result = _swiftPart.startAdvertising(std::forward<decltype(options)>(options));
100
+ if (__result.hasError()) [[unlikely]] {
101
+ std::rethrow_exception(__result.error());
102
+ }
103
+ }
104
+ inline void updateAdvertisingData(const AdvertisingDataTypes& advertisingData) override {
105
+ auto __result = _swiftPart.updateAdvertisingData(std::forward<decltype(advertisingData)>(advertisingData));
106
+ if (__result.hasError()) [[unlikely]] {
107
+ std::rethrow_exception(__result.error());
108
+ }
109
+ }
110
+ inline std::shared_ptr<Promise<AdvertisingDataTypes>> getAdvertisingData() override {
111
+ auto __result = _swiftPart.getAdvertisingData();
112
+ if (__result.hasError()) [[unlikely]] {
113
+ std::rethrow_exception(__result.error());
114
+ }
115
+ auto __value = std::move(__result.value());
116
+ return __value;
117
+ }
118
+ inline void stopAdvertising() override {
119
+ auto __result = _swiftPart.stopAdvertising();
120
+ if (__result.hasError()) [[unlikely]] {
121
+ std::rethrow_exception(__result.error());
122
+ }
123
+ }
124
+ inline void setServices(const std::vector<GATTService>& services) override {
125
+ auto __result = _swiftPart.setServices(services);
126
+ if (__result.hasError()) [[unlikely]] {
127
+ std::rethrow_exception(__result.error());
128
+ }
129
+ }
130
+ inline std::shared_ptr<Promise<bool>> isBluetoothEnabled() override {
131
+ auto __result = _swiftPart.isBluetoothEnabled();
132
+ if (__result.hasError()) [[unlikely]] {
133
+ std::rethrow_exception(__result.error());
134
+ }
135
+ auto __value = std::move(__result.value());
136
+ return __value;
137
+ }
138
+ inline std::shared_ptr<Promise<bool>> requestBluetoothPermission() override {
139
+ auto __result = _swiftPart.requestBluetoothPermission();
140
+ if (__result.hasError()) [[unlikely]] {
141
+ std::rethrow_exception(__result.error());
142
+ }
143
+ auto __value = std::move(__result.value());
144
+ return __value;
145
+ }
146
+ inline void startScan(const std::optional<ScanOptions>& options) override {
147
+ auto __result = _swiftPart.startScan(options);
148
+ if (__result.hasError()) [[unlikely]] {
149
+ std::rethrow_exception(__result.error());
150
+ }
151
+ }
152
+ inline void stopScan() override {
153
+ auto __result = _swiftPart.stopScan();
154
+ if (__result.hasError()) [[unlikely]] {
155
+ std::rethrow_exception(__result.error());
156
+ }
157
+ }
158
+ inline std::shared_ptr<Promise<void>> connect(const std::string& deviceId) override {
159
+ auto __result = _swiftPart.connect(deviceId);
160
+ if (__result.hasError()) [[unlikely]] {
161
+ std::rethrow_exception(__result.error());
162
+ }
163
+ auto __value = std::move(__result.value());
164
+ return __value;
165
+ }
166
+ inline void disconnect(const std::string& deviceId) override {
167
+ auto __result = _swiftPart.disconnect(deviceId);
168
+ if (__result.hasError()) [[unlikely]] {
169
+ std::rethrow_exception(__result.error());
170
+ }
171
+ }
172
+ inline std::shared_ptr<Promise<std::vector<GATTService>>> discoverServices(const std::string& deviceId) override {
173
+ auto __result = _swiftPart.discoverServices(deviceId);
174
+ if (__result.hasError()) [[unlikely]] {
175
+ std::rethrow_exception(__result.error());
176
+ }
177
+ auto __value = std::move(__result.value());
178
+ return __value;
179
+ }
180
+ inline std::shared_ptr<Promise<CharacteristicValue>> readCharacteristic(const std::string& deviceId, const std::string& serviceUUID, const std::string& characteristicUUID) override {
181
+ auto __result = _swiftPart.readCharacteristic(deviceId, serviceUUID, characteristicUUID);
182
+ if (__result.hasError()) [[unlikely]] {
183
+ std::rethrow_exception(__result.error());
184
+ }
185
+ auto __value = std::move(__result.value());
186
+ return __value;
187
+ }
188
+ 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 {
189
+ auto __result = _swiftPart.writeCharacteristic(deviceId, serviceUUID, characteristicUUID, value, writeType);
190
+ if (__result.hasError()) [[unlikely]] {
191
+ std::rethrow_exception(__result.error());
192
+ }
193
+ auto __value = std::move(__result.value());
194
+ return __value;
195
+ }
196
+ inline void subscribeToCharacteristic(const std::string& deviceId, const std::string& serviceUUID, const std::string& characteristicUUID) override {
197
+ auto __result = _swiftPart.subscribeToCharacteristic(deviceId, serviceUUID, characteristicUUID);
198
+ if (__result.hasError()) [[unlikely]] {
199
+ std::rethrow_exception(__result.error());
200
+ }
201
+ }
202
+ inline void unsubscribeFromCharacteristic(const std::string& deviceId, const std::string& serviceUUID, const std::string& characteristicUUID) override {
203
+ auto __result = _swiftPart.unsubscribeFromCharacteristic(deviceId, serviceUUID, characteristicUUID);
204
+ if (__result.hasError()) [[unlikely]] {
205
+ std::rethrow_exception(__result.error());
206
+ }
207
+ }
208
+ inline std::shared_ptr<Promise<std::vector<std::string>>> getConnectedDevices() override {
209
+ auto __result = _swiftPart.getConnectedDevices();
210
+ if (__result.hasError()) [[unlikely]] {
211
+ std::rethrow_exception(__result.error());
212
+ }
213
+ auto __value = std::move(__result.value());
214
+ return __value;
215
+ }
216
+ inline std::shared_ptr<Promise<double>> readRSSI(const std::string& deviceId) override {
217
+ auto __result = _swiftPart.readRSSI(deviceId);
218
+ if (__result.hasError()) [[unlikely]] {
219
+ std::rethrow_exception(__result.error());
220
+ }
221
+ auto __value = std::move(__result.value());
222
+ return __value;
223
+ }
224
+ inline void addListener(const std::string& eventName) override {
225
+ auto __result = _swiftPart.addListener(eventName);
226
+ if (__result.hasError()) [[unlikely]] {
227
+ std::rethrow_exception(__result.error());
228
+ }
229
+ }
230
+ inline void removeListeners(double count) override {
231
+ auto __result = _swiftPart.removeListeners(std::forward<decltype(count)>(count));
232
+ if (__result.hasError()) [[unlikely]] {
233
+ std::rethrow_exception(__result.error());
234
+ }
235
+ }
236
+
237
+ private:
238
+ MunimBluetooth::HybridMunimBluetoothSpec_cxx _swiftPart;
239
+ };
240
+
241
+ } // namespace margelo::nitro::munimbluetooth