react-native-ble-nitro 1.1.0 → 1.2.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.
- package/README.md +6 -2
- package/ios/BleNitroBleManager.swift +49 -14
- package/ios/BlePeripheralDelegate.swift +36 -8
- package/lib/commonjs/index.d.ts +15 -8
- package/lib/commonjs/index.d.ts.map +1 -1
- package/lib/commonjs/index.js +44 -11
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/specs/NativeBleNitro.nitro.d.ts +6 -4
- package/lib/commonjs/specs/NativeBleNitro.nitro.d.ts.map +1 -1
- package/lib/commonjs/specs/NativeBleNitro.nitro.js.map +1 -1
- package/lib/index.d.ts +15 -8
- package/lib/index.js +44 -11
- package/lib/specs/NativeBleNitro.nitro.d.ts +6 -4
- package/nitrogen/generated/android/BleNitroOnLoad.cpp +4 -4
- package/nitrogen/generated/android/c++/JBLEDevice.hpp +3 -0
- package/nitrogen/generated/android/c++/JFunc_void_BLEDevice.hpp +3 -0
- package/nitrogen/generated/android/c++/JFunc_void_bool_std__shared_ptr_ArrayBuffer__std__string.hpp +78 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__string_std__shared_ptr_ArrayBuffer_.hpp +78 -0
- package/nitrogen/generated/android/c++/JHybridNativeBleNitroSpec.cpp +21 -16
- package/nitrogen/generated/android/c++/JHybridNativeBleNitroSpec.hpp +4 -3
- package/nitrogen/generated/android/c++/JManufacturerData.hpp +3 -0
- package/nitrogen/generated/android/c++/JManufacturerDataEntry.hpp +7 -15
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/{Func_void_bool_std__vector_double__std__string.kt → Func_void_bool_std__shared_ptr_ArrayBuffer__std__string.kt} +12 -12
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/{Func_void_std__string_std__vector_double_.kt → Func_void_std__string_std__shared_ptr_ArrayBuffer_.kt} +12 -12
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/HybridNativeBleNitroSpec.kt +10 -6
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/ManufacturerDataEntry.kt +1 -1
- package/nitrogen/generated/ios/BleNitro-Swift-Cxx-Bridge.cpp +10 -10
- package/nitrogen/generated/ios/BleNitro-Swift-Cxx-Bridge.hpp +39 -35
- package/nitrogen/generated/ios/BleNitro-Swift-Cxx-Umbrella.hpp +3 -0
- package/nitrogen/generated/ios/c++/HybridNativeBleNitroSpecSwift.hpp +18 -4
- package/nitrogen/generated/ios/swift/{Func_void_bool_std__vector_double__std__string.swift → Func_void_bool_std__shared_ptr_ArrayBuffer__std__string.swift} +11 -11
- package/nitrogen/generated/ios/swift/{Func_void_std__string_std__vector_double_.swift → Func_void_std__string_std__shared_ptr_ArrayBuffer_.swift} +11 -11
- package/nitrogen/generated/ios/swift/HybridNativeBleNitroSpec.swift +4 -3
- package/nitrogen/generated/ios/swift/HybridNativeBleNitroSpec_cxx.swift +24 -24
- package/nitrogen/generated/ios/swift/ManufacturerDataEntry.swift +5 -17
- package/nitrogen/generated/shared/c++/HybridNativeBleNitroSpec.cpp +1 -0
- package/nitrogen/generated/shared/c++/HybridNativeBleNitroSpec.hpp +7 -3
- package/nitrogen/generated/shared/c++/ManufacturerDataEntry.hpp +8 -7
- package/package.json +1 -1
- package/react-native.config.js +10 -2
- package/src/index.ts +56 -17
- package/src/specs/NativeBleNitro.nitro.ts +8 -4
- package/nitrogen/generated/android/c++/JFunc_void_bool_std__vector_double__std__string.hpp +0 -86
- package/nitrogen/generated/android/c++/JFunc_void_std__string_std__vector_double_.hpp +0 -86
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
///
|
|
2
|
-
///
|
|
2
|
+
/// Func_void_std__string_std__shared_ptr_ArrayBuffer_.kt
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
5
|
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
@@ -15,25 +15,25 @@ import dalvik.annotation.optimization.FastNative
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* Represents the JavaScript callback `(characteristicId: string, data: array) => void`.
|
|
18
|
+
* Represents the JavaScript callback `(characteristicId: string, data: array-buffer) => void`.
|
|
19
19
|
* This can be either implemented in C++ (in which case it might be a callback coming from JS),
|
|
20
20
|
* or in Kotlin/Java (in which case it is a native callback).
|
|
21
21
|
*/
|
|
22
22
|
@DoNotStrip
|
|
23
23
|
@Keep
|
|
24
24
|
@Suppress("ClassName", "RedundantUnitReturnType")
|
|
25
|
-
fun interface
|
|
25
|
+
fun interface Func_void_std__string_std__shared_ptr_ArrayBuffer_: (String, ArrayBuffer) -> Unit {
|
|
26
26
|
/**
|
|
27
27
|
* Call the given JS callback.
|
|
28
28
|
* @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
|
|
29
29
|
*/
|
|
30
30
|
@DoNotStrip
|
|
31
31
|
@Keep
|
|
32
|
-
override fun invoke(characteristicId: String, data:
|
|
32
|
+
override fun invoke(characteristicId: String, data: ArrayBuffer): Unit
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
|
-
* Represents the JavaScript callback `(characteristicId: string, data: array) => void`.
|
|
36
|
+
* Represents the JavaScript callback `(characteristicId: string, data: array-buffer) => void`.
|
|
37
37
|
* This is implemented in C++, via a `std::function<...>`.
|
|
38
38
|
* The callback might be coming from JS.
|
|
39
39
|
*/
|
|
@@ -44,7 +44,7 @@ fun interface Func_void_std__string_std__vector_double_: (String, DoubleArray) -
|
|
|
44
44
|
"RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
|
|
45
45
|
"ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
|
|
46
46
|
)
|
|
47
|
-
class
|
|
47
|
+
class Func_void_std__string_std__shared_ptr_ArrayBuffer__cxx: Func_void_std__string_std__shared_ptr_ArrayBuffer_ {
|
|
48
48
|
@DoNotStrip
|
|
49
49
|
@Keep
|
|
50
50
|
private val mHybridData: HybridData
|
|
@@ -57,25 +57,25 @@ class Func_void_std__string_std__vector_double__cxx: Func_void_std__string_std__
|
|
|
57
57
|
|
|
58
58
|
@DoNotStrip
|
|
59
59
|
@Keep
|
|
60
|
-
override fun invoke(characteristicId: String, data:
|
|
60
|
+
override fun invoke(characteristicId: String, data: ArrayBuffer): Unit
|
|
61
61
|
= invoke_cxx(characteristicId,data)
|
|
62
62
|
|
|
63
63
|
@FastNative
|
|
64
|
-
private external fun invoke_cxx(characteristicId: String, data:
|
|
64
|
+
private external fun invoke_cxx(characteristicId: String, data: ArrayBuffer): Unit
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
|
-
* Represents the JavaScript callback `(characteristicId: string, data: array) => void`.
|
|
69
|
-
* This is implemented in Java/Kotlin, via a `(String,
|
|
68
|
+
* Represents the JavaScript callback `(characteristicId: string, data: array-buffer) => void`.
|
|
69
|
+
* This is implemented in Java/Kotlin, via a `(String, ArrayBuffer) -> Unit`.
|
|
70
70
|
* The callback is always coming from native.
|
|
71
71
|
*/
|
|
72
72
|
@DoNotStrip
|
|
73
73
|
@Keep
|
|
74
74
|
@Suppress("ClassName", "RedundantUnitReturnType", "unused")
|
|
75
|
-
class
|
|
75
|
+
class Func_void_std__string_std__shared_ptr_ArrayBuffer__java(private val function: (String, ArrayBuffer) -> Unit): Func_void_std__string_std__shared_ptr_ArrayBuffer_ {
|
|
76
76
|
@DoNotStrip
|
|
77
77
|
@Keep
|
|
78
|
-
override fun invoke(characteristicId: String, data:
|
|
78
|
+
override fun invoke(characteristicId: String, data: ArrayBuffer): Unit {
|
|
79
79
|
return this.function(characteristicId, data)
|
|
80
80
|
}
|
|
81
81
|
}
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/HybridNativeBleNitroSpec.kt
CHANGED
|
@@ -83,6 +83,10 @@ abstract class HybridNativeBleNitroSpec: HybridObject() {
|
|
|
83
83
|
@Keep
|
|
84
84
|
abstract fun isConnected(deviceId: String): Boolean
|
|
85
85
|
|
|
86
|
+
@DoNotStrip
|
|
87
|
+
@Keep
|
|
88
|
+
abstract fun requestMTU(deviceId: String, mtu: Double): Double
|
|
89
|
+
|
|
86
90
|
abstract fun discoverServices(deviceId: String, callback: (success: Boolean, error: String) -> Unit): Unit
|
|
87
91
|
|
|
88
92
|
@DoNotStrip
|
|
@@ -100,29 +104,29 @@ abstract class HybridNativeBleNitroSpec: HybridObject() {
|
|
|
100
104
|
@Keep
|
|
101
105
|
abstract fun getCharacteristics(deviceId: String, serviceId: String): Array<String>
|
|
102
106
|
|
|
103
|
-
abstract fun readCharacteristic(deviceId: String, serviceId: String, characteristicId: String, callback: (success: Boolean, data:
|
|
107
|
+
abstract fun readCharacteristic(deviceId: String, serviceId: String, characteristicId: String, callback: (success: Boolean, data: ArrayBuffer, error: String) -> Unit): Unit
|
|
104
108
|
|
|
105
109
|
@DoNotStrip
|
|
106
110
|
@Keep
|
|
107
|
-
private fun readCharacteristic_cxx(deviceId: String, serviceId: String, characteristicId: String, callback:
|
|
111
|
+
private fun readCharacteristic_cxx(deviceId: String, serviceId: String, characteristicId: String, callback: Func_void_bool_std__shared_ptr_ArrayBuffer__std__string): Unit {
|
|
108
112
|
val __result = readCharacteristic(deviceId, serviceId, characteristicId, callback)
|
|
109
113
|
return __result
|
|
110
114
|
}
|
|
111
115
|
|
|
112
|
-
abstract fun writeCharacteristic(deviceId: String, serviceId: String, characteristicId: String, data:
|
|
116
|
+
abstract fun writeCharacteristic(deviceId: String, serviceId: String, characteristicId: String, data: ArrayBuffer, withResponse: Boolean, callback: (success: Boolean, error: String) -> Unit): Unit
|
|
113
117
|
|
|
114
118
|
@DoNotStrip
|
|
115
119
|
@Keep
|
|
116
|
-
private fun writeCharacteristic_cxx(deviceId: String, serviceId: String, characteristicId: String, data:
|
|
120
|
+
private fun writeCharacteristic_cxx(deviceId: String, serviceId: String, characteristicId: String, data: ArrayBuffer, withResponse: Boolean, callback: Func_void_bool_std__string): Unit {
|
|
117
121
|
val __result = writeCharacteristic(deviceId, serviceId, characteristicId, data, withResponse, callback)
|
|
118
122
|
return __result
|
|
119
123
|
}
|
|
120
124
|
|
|
121
|
-
abstract fun subscribeToCharacteristic(deviceId: String, serviceId: String, characteristicId: String, updateCallback: (characteristicId: String, data:
|
|
125
|
+
abstract fun subscribeToCharacteristic(deviceId: String, serviceId: String, characteristicId: String, updateCallback: (characteristicId: String, data: ArrayBuffer) -> Unit, resultCallback: (success: Boolean, error: String) -> Unit): Unit
|
|
122
126
|
|
|
123
127
|
@DoNotStrip
|
|
124
128
|
@Keep
|
|
125
|
-
private fun subscribeToCharacteristic_cxx(deviceId: String, serviceId: String, characteristicId: String, updateCallback:
|
|
129
|
+
private fun subscribeToCharacteristic_cxx(deviceId: String, serviceId: String, characteristicId: String, updateCallback: Func_void_std__string_std__shared_ptr_ArrayBuffer_, resultCallback: Func_void_bool_std__string): Unit {
|
|
126
130
|
val __result = subscribeToCharacteristic(deviceId, serviceId, characteristicId, updateCallback, resultCallback)
|
|
127
131
|
return __result
|
|
128
132
|
}
|
|
@@ -45,19 +45,19 @@ namespace margelo::nitro::co::zyke::ble::bridge::swift {
|
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
// pragma MARK: std::function<void(bool /* success */, const std::
|
|
49
|
-
|
|
50
|
-
auto swiftClosure = BleNitro::
|
|
51
|
-
return [swiftClosure = std::move(swiftClosure)](bool success, const std::
|
|
52
|
-
swiftClosure.call(success, data, error);
|
|
48
|
+
// pragma MARK: std::function<void(bool /* success */, const std::shared_ptr<ArrayBuffer>& /* data */, const std::string& /* error */)>
|
|
49
|
+
Func_void_bool_std__shared_ptr_ArrayBuffer__std__string create_Func_void_bool_std__shared_ptr_ArrayBuffer__std__string(void* _Nonnull swiftClosureWrapper) {
|
|
50
|
+
auto swiftClosure = BleNitro::Func_void_bool_std__shared_ptr_ArrayBuffer__std__string::fromUnsafe(swiftClosureWrapper);
|
|
51
|
+
return [swiftClosure = std::move(swiftClosure)](bool success, const std::shared_ptr<ArrayBuffer>& data, const std::string& error) mutable -> void {
|
|
52
|
+
swiftClosure.call(success, ArrayBufferHolder(data), error);
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
// pragma MARK: std::function<void(const std::string& /* characteristicId */, const std::
|
|
57
|
-
|
|
58
|
-
auto swiftClosure = BleNitro::
|
|
59
|
-
return [swiftClosure = std::move(swiftClosure)](const std::string& characteristicId, const std::
|
|
60
|
-
swiftClosure.call(characteristicId, data);
|
|
56
|
+
// pragma MARK: std::function<void(const std::string& /* characteristicId */, const std::shared_ptr<ArrayBuffer>& /* data */)>
|
|
57
|
+
Func_void_std__string_std__shared_ptr_ArrayBuffer_ create_Func_void_std__string_std__shared_ptr_ArrayBuffer_(void* _Nonnull swiftClosureWrapper) {
|
|
58
|
+
auto swiftClosure = BleNitro::Func_void_std__string_std__shared_ptr_ArrayBuffer_::fromUnsafe(swiftClosureWrapper);
|
|
59
|
+
return [swiftClosure = std::move(swiftClosure)](const std::string& characteristicId, const std::shared_ptr<ArrayBuffer>& data) mutable -> void {
|
|
60
|
+
swiftClosure.call(characteristicId, ArrayBufferHolder(data));
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
63
|
|
|
@@ -8,6 +8,10 @@
|
|
|
8
8
|
#pragma once
|
|
9
9
|
|
|
10
10
|
// Forward declarations of C++ defined types
|
|
11
|
+
// Forward declaration of `ArrayBufferHolder` to properly resolve imports.
|
|
12
|
+
namespace NitroModules { class ArrayBufferHolder; }
|
|
13
|
+
// Forward declaration of `ArrayBuffer` to properly resolve imports.
|
|
14
|
+
namespace NitroModules { class ArrayBuffer; }
|
|
11
15
|
// Forward declaration of `BLEDevice` to properly resolve imports.
|
|
12
16
|
namespace margelo::nitro::co::zyke::ble { struct BLEDevice; }
|
|
13
17
|
// Forward declaration of `BLEState` to properly resolve imports.
|
|
@@ -32,6 +36,8 @@ namespace BleNitro { class HybridNativeBleNitroSpec_cxx; }
|
|
|
32
36
|
#include "ManufacturerData.hpp"
|
|
33
37
|
#include "ManufacturerDataEntry.hpp"
|
|
34
38
|
#include "OperationResult.hpp"
|
|
39
|
+
#include <NitroModules/ArrayBuffer.hpp>
|
|
40
|
+
#include <NitroModules/ArrayBufferHolder.hpp>
|
|
35
41
|
#include <NitroModules/Promise.hpp>
|
|
36
42
|
#include <NitroModules/PromiseHolder.hpp>
|
|
37
43
|
#include <NitroModules/Result.hpp>
|
|
@@ -59,17 +65,6 @@ namespace margelo::nitro::co::zyke::ble::bridge::swift {
|
|
|
59
65
|
return vector;
|
|
60
66
|
}
|
|
61
67
|
|
|
62
|
-
// pragma MARK: std::vector<double>
|
|
63
|
-
/**
|
|
64
|
-
* Specialized version of `std::vector<double>`.
|
|
65
|
-
*/
|
|
66
|
-
using std__vector_double_ = std::vector<double>;
|
|
67
|
-
inline std::vector<double> create_std__vector_double_(size_t size) {
|
|
68
|
-
std::vector<double> vector;
|
|
69
|
-
vector.reserve(size);
|
|
70
|
-
return vector;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
68
|
// pragma MARK: std::vector<ManufacturerDataEntry>
|
|
74
69
|
/**
|
|
75
70
|
* Specialized version of `std::vector<ManufacturerDataEntry>`.
|
|
@@ -189,48 +184,48 @@ namespace margelo::nitro::co::zyke::ble::bridge::swift {
|
|
|
189
184
|
return Func_void_bool_std__string_Wrapper(std::move(value));
|
|
190
185
|
}
|
|
191
186
|
|
|
192
|
-
// pragma MARK: std::function<void(bool /* success */, const std::
|
|
187
|
+
// pragma MARK: std::function<void(bool /* success */, const std::shared_ptr<ArrayBuffer>& /* data */, const std::string& /* error */)>
|
|
193
188
|
/**
|
|
194
|
-
* Specialized version of `std::function<void(bool, const std::
|
|
189
|
+
* Specialized version of `std::function<void(bool, const std::shared_ptr<ArrayBuffer>&, const std::string&)>`.
|
|
195
190
|
*/
|
|
196
|
-
using
|
|
191
|
+
using Func_void_bool_std__shared_ptr_ArrayBuffer__std__string = std::function<void(bool /* success */, const std::shared_ptr<ArrayBuffer>& /* data */, const std::string& /* error */)>;
|
|
197
192
|
/**
|
|
198
|
-
* Wrapper class for a `std::function<void(bool / * success * /, const std::
|
|
193
|
+
* Wrapper class for a `std::function<void(bool / * success * /, const std::shared_ptr<ArrayBuffer>& / * data * /, const std::string& / * error * /)>`, this can be used from Swift.
|
|
199
194
|
*/
|
|
200
|
-
class
|
|
195
|
+
class Func_void_bool_std__shared_ptr_ArrayBuffer__std__string_Wrapper final {
|
|
201
196
|
public:
|
|
202
|
-
explicit
|
|
203
|
-
inline void call(bool success,
|
|
204
|
-
_function->operator()(success, data, error);
|
|
197
|
+
explicit Func_void_bool_std__shared_ptr_ArrayBuffer__std__string_Wrapper(std::function<void(bool /* success */, const std::shared_ptr<ArrayBuffer>& /* data */, const std::string& /* error */)>&& func): _function(std::make_unique<std::function<void(bool /* success */, const std::shared_ptr<ArrayBuffer>& /* data */, const std::string& /* error */)>>(std::move(func))) {}
|
|
198
|
+
inline void call(bool success, ArrayBufferHolder data, std::string error) const {
|
|
199
|
+
_function->operator()(success, data.getArrayBuffer(), error);
|
|
205
200
|
}
|
|
206
201
|
private:
|
|
207
|
-
std::unique_ptr<std::function<void(bool /* success */, const std::
|
|
202
|
+
std::unique_ptr<std::function<void(bool /* success */, const std::shared_ptr<ArrayBuffer>& /* data */, const std::string& /* error */)>> _function;
|
|
208
203
|
} SWIFT_NONCOPYABLE;
|
|
209
|
-
|
|
210
|
-
inline
|
|
211
|
-
return
|
|
204
|
+
Func_void_bool_std__shared_ptr_ArrayBuffer__std__string create_Func_void_bool_std__shared_ptr_ArrayBuffer__std__string(void* _Nonnull swiftClosureWrapper);
|
|
205
|
+
inline Func_void_bool_std__shared_ptr_ArrayBuffer__std__string_Wrapper wrap_Func_void_bool_std__shared_ptr_ArrayBuffer__std__string(Func_void_bool_std__shared_ptr_ArrayBuffer__std__string value) {
|
|
206
|
+
return Func_void_bool_std__shared_ptr_ArrayBuffer__std__string_Wrapper(std::move(value));
|
|
212
207
|
}
|
|
213
208
|
|
|
214
|
-
// pragma MARK: std::function<void(const std::string& /* characteristicId */, const std::
|
|
209
|
+
// pragma MARK: std::function<void(const std::string& /* characteristicId */, const std::shared_ptr<ArrayBuffer>& /* data */)>
|
|
215
210
|
/**
|
|
216
|
-
* Specialized version of `std::function<void(const std::string&, const std::
|
|
211
|
+
* Specialized version of `std::function<void(const std::string&, const std::shared_ptr<ArrayBuffer>&)>`.
|
|
217
212
|
*/
|
|
218
|
-
using
|
|
213
|
+
using Func_void_std__string_std__shared_ptr_ArrayBuffer_ = std::function<void(const std::string& /* characteristicId */, const std::shared_ptr<ArrayBuffer>& /* data */)>;
|
|
219
214
|
/**
|
|
220
|
-
* Wrapper class for a `std::function<void(const std::string& / * characteristicId * /, const std::
|
|
215
|
+
* Wrapper class for a `std::function<void(const std::string& / * characteristicId * /, const std::shared_ptr<ArrayBuffer>& / * data * /)>`, this can be used from Swift.
|
|
221
216
|
*/
|
|
222
|
-
class
|
|
217
|
+
class Func_void_std__string_std__shared_ptr_ArrayBuffer__Wrapper final {
|
|
223
218
|
public:
|
|
224
|
-
explicit
|
|
225
|
-
inline void call(std::string characteristicId,
|
|
226
|
-
_function->operator()(characteristicId, data);
|
|
219
|
+
explicit Func_void_std__string_std__shared_ptr_ArrayBuffer__Wrapper(std::function<void(const std::string& /* characteristicId */, const std::shared_ptr<ArrayBuffer>& /* data */)>&& func): _function(std::make_unique<std::function<void(const std::string& /* characteristicId */, const std::shared_ptr<ArrayBuffer>& /* data */)>>(std::move(func))) {}
|
|
220
|
+
inline void call(std::string characteristicId, ArrayBufferHolder data) const {
|
|
221
|
+
_function->operator()(characteristicId, data.getArrayBuffer());
|
|
227
222
|
}
|
|
228
223
|
private:
|
|
229
|
-
std::unique_ptr<std::function<void(const std::string& /* characteristicId */, const std::
|
|
224
|
+
std::unique_ptr<std::function<void(const std::string& /* characteristicId */, const std::shared_ptr<ArrayBuffer>& /* data */)>> _function;
|
|
230
225
|
} SWIFT_NONCOPYABLE;
|
|
231
|
-
|
|
232
|
-
inline
|
|
233
|
-
return
|
|
226
|
+
Func_void_std__string_std__shared_ptr_ArrayBuffer_ create_Func_void_std__string_std__shared_ptr_ArrayBuffer_(void* _Nonnull swiftClosureWrapper);
|
|
227
|
+
inline Func_void_std__string_std__shared_ptr_ArrayBuffer__Wrapper wrap_Func_void_std__string_std__shared_ptr_ArrayBuffer_(Func_void_std__string_std__shared_ptr_ArrayBuffer_ value) {
|
|
228
|
+
return Func_void_std__string_std__shared_ptr_ArrayBuffer__Wrapper(std::move(value));
|
|
234
229
|
}
|
|
235
230
|
|
|
236
231
|
// pragma MARK: std::optional<std::string>
|
|
@@ -359,6 +354,15 @@ namespace margelo::nitro::co::zyke::ble::bridge::swift {
|
|
|
359
354
|
return Result<std::vector<BLEDevice>>::withError(error);
|
|
360
355
|
}
|
|
361
356
|
|
|
357
|
+
// pragma MARK: Result<double>
|
|
358
|
+
using Result_double_ = Result<double>;
|
|
359
|
+
inline Result_double_ create_Result_double_(double value) {
|
|
360
|
+
return Result<double>::withValue(std::move(value));
|
|
361
|
+
}
|
|
362
|
+
inline Result_double_ create_Result_double_(const std::exception_ptr& error) {
|
|
363
|
+
return Result<double>::withError(error);
|
|
364
|
+
}
|
|
365
|
+
|
|
362
366
|
// pragma MARK: Result<std::vector<std::string>>
|
|
363
367
|
using Result_std__vector_std__string__ = Result<std::vector<std::string>>;
|
|
364
368
|
inline Result_std__vector_std__string__ create_Result_std__vector_std__string__(const std::vector<std::string>& value) {
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
#pragma once
|
|
9
9
|
|
|
10
10
|
// Forward declarations of C++ defined types
|
|
11
|
+
// Forward declaration of `ArrayBuffer` to properly resolve imports.
|
|
12
|
+
namespace NitroModules { class ArrayBuffer; }
|
|
11
13
|
// Forward declaration of `BLEDevice` to properly resolve imports.
|
|
12
14
|
namespace margelo::nitro::co::zyke::ble { struct BLEDevice; }
|
|
13
15
|
// Forward declaration of `BLEState` to properly resolve imports.
|
|
@@ -31,6 +33,7 @@ namespace margelo::nitro::co::zyke::ble { struct ScanFilter; }
|
|
|
31
33
|
#include "ManufacturerDataEntry.hpp"
|
|
32
34
|
#include "OperationResult.hpp"
|
|
33
35
|
#include "ScanFilter.hpp"
|
|
36
|
+
#include <NitroModules/ArrayBuffer.hpp>
|
|
34
37
|
#include <NitroModules/Promise.hpp>
|
|
35
38
|
#include <NitroModules/Result.hpp>
|
|
36
39
|
#include <exception>
|
|
@@ -20,6 +20,10 @@ namespace margelo::nitro::co::zyke::ble { struct BLEDevice; }
|
|
|
20
20
|
namespace margelo::nitro::co::zyke::ble { struct ManufacturerData; }
|
|
21
21
|
// Forward declaration of `ManufacturerDataEntry` to properly resolve imports.
|
|
22
22
|
namespace margelo::nitro::co::zyke::ble { struct ManufacturerDataEntry; }
|
|
23
|
+
// Forward declaration of `ArrayBuffer` to properly resolve imports.
|
|
24
|
+
namespace NitroModules { class ArrayBuffer; }
|
|
25
|
+
// Forward declaration of `ArrayBufferHolder` to properly resolve imports.
|
|
26
|
+
namespace NitroModules { class ArrayBufferHolder; }
|
|
23
27
|
// Forward declaration of `BLEState` to properly resolve imports.
|
|
24
28
|
namespace margelo::nitro::co::zyke::ble { enum class BLEState; }
|
|
25
29
|
// Forward declaration of `OperationResult` to properly resolve imports.
|
|
@@ -32,6 +36,8 @@ namespace margelo::nitro::co::zyke::ble { struct OperationResult; }
|
|
|
32
36
|
#include <functional>
|
|
33
37
|
#include "ManufacturerData.hpp"
|
|
34
38
|
#include "ManufacturerDataEntry.hpp"
|
|
39
|
+
#include <NitroModules/ArrayBuffer.hpp>
|
|
40
|
+
#include <NitroModules/ArrayBufferHolder.hpp>
|
|
35
41
|
#include <optional>
|
|
36
42
|
#include "BLEState.hpp"
|
|
37
43
|
#include "OperationResult.hpp"
|
|
@@ -128,6 +134,14 @@ namespace margelo::nitro::co::zyke::ble {
|
|
|
128
134
|
auto __value = std::move(__result.value());
|
|
129
135
|
return __value;
|
|
130
136
|
}
|
|
137
|
+
inline double requestMTU(const std::string& deviceId, double mtu) override {
|
|
138
|
+
auto __result = _swiftPart.requestMTU(deviceId, std::forward<decltype(mtu)>(mtu));
|
|
139
|
+
if (__result.hasError()) [[unlikely]] {
|
|
140
|
+
std::rethrow_exception(__result.error());
|
|
141
|
+
}
|
|
142
|
+
auto __value = std::move(__result.value());
|
|
143
|
+
return __value;
|
|
144
|
+
}
|
|
131
145
|
inline void discoverServices(const std::string& deviceId, const std::function<void(bool /* success */, const std::string& /* error */)>& callback) override {
|
|
132
146
|
auto __result = _swiftPart.discoverServices(deviceId, callback);
|
|
133
147
|
if (__result.hasError()) [[unlikely]] {
|
|
@@ -150,19 +164,19 @@ namespace margelo::nitro::co::zyke::ble {
|
|
|
150
164
|
auto __value = std::move(__result.value());
|
|
151
165
|
return __value;
|
|
152
166
|
}
|
|
153
|
-
inline void readCharacteristic(const std::string& deviceId, const std::string& serviceId, const std::string& characteristicId, const std::function<void(bool /* success */, const std::
|
|
167
|
+
inline void readCharacteristic(const std::string& deviceId, const std::string& serviceId, const std::string& characteristicId, const std::function<void(bool /* success */, const std::shared_ptr<ArrayBuffer>& /* data */, const std::string& /* error */)>& callback) override {
|
|
154
168
|
auto __result = _swiftPart.readCharacteristic(deviceId, serviceId, characteristicId, callback);
|
|
155
169
|
if (__result.hasError()) [[unlikely]] {
|
|
156
170
|
std::rethrow_exception(__result.error());
|
|
157
171
|
}
|
|
158
172
|
}
|
|
159
|
-
inline void writeCharacteristic(const std::string& deviceId, const std::string& serviceId, const std::string& characteristicId, const std::
|
|
160
|
-
auto __result = _swiftPart.writeCharacteristic(deviceId, serviceId, characteristicId, data, std::forward<decltype(withResponse)>(withResponse), callback);
|
|
173
|
+
inline void writeCharacteristic(const std::string& deviceId, const std::string& serviceId, const std::string& characteristicId, const std::shared_ptr<ArrayBuffer>& data, bool withResponse, const std::function<void(bool /* success */, const std::string& /* error */)>& callback) override {
|
|
174
|
+
auto __result = _swiftPart.writeCharacteristic(deviceId, serviceId, characteristicId, ArrayBufferHolder(data), std::forward<decltype(withResponse)>(withResponse), callback);
|
|
161
175
|
if (__result.hasError()) [[unlikely]] {
|
|
162
176
|
std::rethrow_exception(__result.error());
|
|
163
177
|
}
|
|
164
178
|
}
|
|
165
|
-
inline void subscribeToCharacteristic(const std::string& deviceId, const std::string& serviceId, const std::string& characteristicId, const std::function<void(const std::string& /* characteristicId */, const std::
|
|
179
|
+
inline void subscribeToCharacteristic(const std::string& deviceId, const std::string& serviceId, const std::string& characteristicId, const std::function<void(const std::string& /* characteristicId */, const std::shared_ptr<ArrayBuffer>& /* data */)>& updateCallback, const std::function<void(bool /* success */, const std::string& /* error */)>& resultCallback) override {
|
|
166
180
|
auto __result = _swiftPart.subscribeToCharacteristic(deviceId, serviceId, characteristicId, updateCallback, resultCallback);
|
|
167
181
|
if (__result.hasError()) [[unlikely]] {
|
|
168
182
|
std::rethrow_exception(__result.error());
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
///
|
|
2
|
-
///
|
|
2
|
+
/// Func_void_bool_std__shared_ptr_ArrayBuffer__std__string.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
5
|
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
@@ -9,21 +9,21 @@ import NitroModules
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* Wraps a Swift `(_ success: Bool, _ data:
|
|
12
|
+
* Wraps a Swift `(_ success: Bool, _ data: ArrayBuffer, _ error: String) -> Void` as a class.
|
|
13
13
|
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
14
14
|
*/
|
|
15
|
-
public final class
|
|
15
|
+
public final class Func_void_bool_std__shared_ptr_ArrayBuffer__std__string {
|
|
16
16
|
public typealias bridge = margelo.nitro.co.zyke.ble.bridge.swift
|
|
17
17
|
|
|
18
|
-
private let closure: (_ success: Bool, _ data:
|
|
18
|
+
private let closure: (_ success: Bool, _ data: ArrayBuffer, _ error: String) -> Void
|
|
19
19
|
|
|
20
|
-
public init(_ closure: @escaping (_ success: Bool, _ data:
|
|
20
|
+
public init(_ closure: @escaping (_ success: Bool, _ data: ArrayBuffer, _ error: String) -> Void) {
|
|
21
21
|
self.closure = closure
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
@inline(__always)
|
|
25
|
-
public func call(success: Bool, data:
|
|
26
|
-
self.closure(success, data
|
|
25
|
+
public func call(success: Bool, data: ArrayBuffer, error: std.string) -> Void {
|
|
26
|
+
self.closure(success, data, String(error))
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
/**
|
|
@@ -36,12 +36,12 @@ public final class Func_void_bool_std__vector_double__std__string {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
|
-
* Casts an unsafe pointer to a `
|
|
40
|
-
* The pointer has to be a retained opaque `Unmanaged<
|
|
39
|
+
* Casts an unsafe pointer to a `Func_void_bool_std__shared_ptr_ArrayBuffer__std__string`.
|
|
40
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_bool_std__shared_ptr_ArrayBuffer__std__string>`.
|
|
41
41
|
* This removes one strong reference from the object!
|
|
42
42
|
*/
|
|
43
43
|
@inline(__always)
|
|
44
|
-
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) ->
|
|
45
|
-
return Unmanaged<
|
|
44
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_bool_std__shared_ptr_ArrayBuffer__std__string {
|
|
45
|
+
return Unmanaged<Func_void_bool_std__shared_ptr_ArrayBuffer__std__string>.fromOpaque(pointer).takeRetainedValue()
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
///
|
|
2
|
-
///
|
|
2
|
+
/// Func_void_std__string_std__shared_ptr_ArrayBuffer_.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
5
|
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
@@ -9,21 +9,21 @@ import NitroModules
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* Wraps a Swift `(_ characteristicId: String, _ data:
|
|
12
|
+
* Wraps a Swift `(_ characteristicId: String, _ data: ArrayBuffer) -> Void` as a class.
|
|
13
13
|
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
14
14
|
*/
|
|
15
|
-
public final class
|
|
15
|
+
public final class Func_void_std__string_std__shared_ptr_ArrayBuffer_ {
|
|
16
16
|
public typealias bridge = margelo.nitro.co.zyke.ble.bridge.swift
|
|
17
17
|
|
|
18
|
-
private let closure: (_ characteristicId: String, _ data:
|
|
18
|
+
private let closure: (_ characteristicId: String, _ data: ArrayBuffer) -> Void
|
|
19
19
|
|
|
20
|
-
public init(_ closure: @escaping (_ characteristicId: String, _ data:
|
|
20
|
+
public init(_ closure: @escaping (_ characteristicId: String, _ data: ArrayBuffer) -> Void) {
|
|
21
21
|
self.closure = closure
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
@inline(__always)
|
|
25
|
-
public func call(characteristicId: std.string, data:
|
|
26
|
-
self.closure(String(characteristicId), data
|
|
25
|
+
public func call(characteristicId: std.string, data: ArrayBuffer) -> Void {
|
|
26
|
+
self.closure(String(characteristicId), data)
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
/**
|
|
@@ -36,12 +36,12 @@ public final class Func_void_std__string_std__vector_double_ {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
|
-
* Casts an unsafe pointer to a `
|
|
40
|
-
* The pointer has to be a retained opaque `Unmanaged<
|
|
39
|
+
* Casts an unsafe pointer to a `Func_void_std__string_std__shared_ptr_ArrayBuffer_`.
|
|
40
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_std__string_std__shared_ptr_ArrayBuffer_>`.
|
|
41
41
|
* This removes one strong reference from the object!
|
|
42
42
|
*/
|
|
43
43
|
@inline(__always)
|
|
44
|
-
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) ->
|
|
45
|
-
return Unmanaged<
|
|
44
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__string_std__shared_ptr_ArrayBuffer_ {
|
|
45
|
+
return Unmanaged<Func_void_std__string_std__shared_ptr_ArrayBuffer_>.fromOpaque(pointer).takeRetainedValue()
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -21,12 +21,13 @@ public protocol HybridNativeBleNitroSpec_protocol: HybridObject {
|
|
|
21
21
|
func connect(deviceId: String, callback: @escaping (_ success: Bool, _ deviceId: String, _ error: String) -> Void, disconnectCallback: ((_ deviceId: String, _ interrupted: Bool, _ error: String) -> Void)?) throws -> Void
|
|
22
22
|
func disconnect(deviceId: String, callback: @escaping (_ success: Bool, _ error: String) -> Void) throws -> Void
|
|
23
23
|
func isConnected(deviceId: String) throws -> Bool
|
|
24
|
+
func requestMTU(deviceId: String, mtu: Double) throws -> Double
|
|
24
25
|
func discoverServices(deviceId: String, callback: @escaping (_ success: Bool, _ error: String) -> Void) throws -> Void
|
|
25
26
|
func getServices(deviceId: String) throws -> [String]
|
|
26
27
|
func getCharacteristics(deviceId: String, serviceId: String) throws -> [String]
|
|
27
|
-
func readCharacteristic(deviceId: String, serviceId: String, characteristicId: String, callback: @escaping (_ success: Bool, _ data:
|
|
28
|
-
func writeCharacteristic(deviceId: String, serviceId: String, characteristicId: String, data:
|
|
29
|
-
func subscribeToCharacteristic(deviceId: String, serviceId: String, characteristicId: String, updateCallback: @escaping (_ characteristicId: String, _ data:
|
|
28
|
+
func readCharacteristic(deviceId: String, serviceId: String, characteristicId: String, callback: @escaping (_ success: Bool, _ data: ArrayBuffer, _ error: String) -> Void) throws -> Void
|
|
29
|
+
func writeCharacteristic(deviceId: String, serviceId: String, characteristicId: String, data: ArrayBuffer, withResponse: Bool, callback: @escaping (_ success: Bool, _ error: String) -> Void) throws -> Void
|
|
30
|
+
func subscribeToCharacteristic(deviceId: String, serviceId: String, characteristicId: String, updateCallback: @escaping (_ characteristicId: String, _ data: ArrayBuffer) -> Void, resultCallback: @escaping (_ success: Bool, _ error: String) -> Void) throws -> Void
|
|
30
31
|
func unsubscribeFromCharacteristic(deviceId: String, serviceId: String, characteristicId: String, callback: @escaping (_ success: Bool, _ error: String) -> Void) throws -> Void
|
|
31
32
|
func requestBluetoothEnable(callback: @escaping (_ success: Bool, _ error: String) -> Void) throws -> Void
|
|
32
33
|
func state() throws -> BLEState
|
|
@@ -222,6 +222,18 @@ open class HybridNativeBleNitroSpec_cxx {
|
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
+
@inline(__always)
|
|
226
|
+
public final func requestMTU(deviceId: std.string, mtu: Double) -> bridge.Result_double_ {
|
|
227
|
+
do {
|
|
228
|
+
let __result = try self.__implementation.requestMTU(deviceId: String(deviceId), mtu: mtu)
|
|
229
|
+
let __resultCpp = __result
|
|
230
|
+
return bridge.create_Result_double_(__resultCpp)
|
|
231
|
+
} catch (let __error) {
|
|
232
|
+
let __exceptionPtr = __error.toCpp()
|
|
233
|
+
return bridge.create_Result_double_(__exceptionPtr)
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
225
237
|
@inline(__always)
|
|
226
238
|
public final func discoverServices(deviceId: std.string, callback: bridge.Func_void_bool_std__string) -> bridge.Result_void_ {
|
|
227
239
|
do {
|
|
@@ -275,18 +287,12 @@ open class HybridNativeBleNitroSpec_cxx {
|
|
|
275
287
|
}
|
|
276
288
|
|
|
277
289
|
@inline(__always)
|
|
278
|
-
public final func readCharacteristic(deviceId: std.string, serviceId: std.string, characteristicId: std.string, callback: bridge.
|
|
290
|
+
public final func readCharacteristic(deviceId: std.string, serviceId: std.string, characteristicId: std.string, callback: bridge.Func_void_bool_std__shared_ptr_ArrayBuffer__std__string) -> bridge.Result_void_ {
|
|
279
291
|
do {
|
|
280
|
-
try self.__implementation.readCharacteristic(deviceId: String(deviceId), serviceId: String(serviceId), characteristicId: String(characteristicId), callback: { () -> (Bool,
|
|
281
|
-
let __wrappedFunction = bridge.
|
|
282
|
-
return { (__success: Bool, __data:
|
|
283
|
-
__wrappedFunction.call(__success,
|
|
284
|
-
var __vector = bridge.create_std__vector_double_(__data.count)
|
|
285
|
-
for __item in __data {
|
|
286
|
-
__vector.push_back(__item)
|
|
287
|
-
}
|
|
288
|
-
return __vector
|
|
289
|
-
}(), std.string(__error))
|
|
292
|
+
try self.__implementation.readCharacteristic(deviceId: String(deviceId), serviceId: String(serviceId), characteristicId: String(characteristicId), callback: { () -> (Bool, ArrayBuffer, String) -> Void in
|
|
293
|
+
let __wrappedFunction = bridge.wrap_Func_void_bool_std__shared_ptr_ArrayBuffer__std__string(callback)
|
|
294
|
+
return { (__success: Bool, __data: ArrayBuffer, __error: String) -> Void in
|
|
295
|
+
__wrappedFunction.call(__success, __data, std.string(__error))
|
|
290
296
|
}
|
|
291
297
|
}())
|
|
292
298
|
return bridge.create_Result_void_()
|
|
@@ -297,9 +303,9 @@ open class HybridNativeBleNitroSpec_cxx {
|
|
|
297
303
|
}
|
|
298
304
|
|
|
299
305
|
@inline(__always)
|
|
300
|
-
public final func writeCharacteristic(deviceId: std.string, serviceId: std.string, characteristicId: std.string, data:
|
|
306
|
+
public final func writeCharacteristic(deviceId: std.string, serviceId: std.string, characteristicId: std.string, data: ArrayBuffer, withResponse: Bool, callback: bridge.Func_void_bool_std__string) -> bridge.Result_void_ {
|
|
301
307
|
do {
|
|
302
|
-
try self.__implementation.writeCharacteristic(deviceId: String(deviceId), serviceId: String(serviceId), characteristicId: String(characteristicId), data: data
|
|
308
|
+
try self.__implementation.writeCharacteristic(deviceId: String(deviceId), serviceId: String(serviceId), characteristicId: String(characteristicId), data: data, withResponse: withResponse, callback: { () -> (Bool, String) -> Void in
|
|
303
309
|
let __wrappedFunction = bridge.wrap_Func_void_bool_std__string(callback)
|
|
304
310
|
return { (__success: Bool, __error: String) -> Void in
|
|
305
311
|
__wrappedFunction.call(__success, std.string(__error))
|
|
@@ -313,18 +319,12 @@ open class HybridNativeBleNitroSpec_cxx {
|
|
|
313
319
|
}
|
|
314
320
|
|
|
315
321
|
@inline(__always)
|
|
316
|
-
public final func subscribeToCharacteristic(deviceId: std.string, serviceId: std.string, characteristicId: std.string, updateCallback: bridge.
|
|
322
|
+
public final func subscribeToCharacteristic(deviceId: std.string, serviceId: std.string, characteristicId: std.string, updateCallback: bridge.Func_void_std__string_std__shared_ptr_ArrayBuffer_, resultCallback: bridge.Func_void_bool_std__string) -> bridge.Result_void_ {
|
|
317
323
|
do {
|
|
318
|
-
try self.__implementation.subscribeToCharacteristic(deviceId: String(deviceId), serviceId: String(serviceId), characteristicId: String(characteristicId), updateCallback: { () -> (String,
|
|
319
|
-
let __wrappedFunction = bridge.
|
|
320
|
-
return { (__characteristicId: String, __data:
|
|
321
|
-
__wrappedFunction.call(std.string(__characteristicId),
|
|
322
|
-
var __vector = bridge.create_std__vector_double_(__data.count)
|
|
323
|
-
for __item in __data {
|
|
324
|
-
__vector.push_back(__item)
|
|
325
|
-
}
|
|
326
|
-
return __vector
|
|
327
|
-
}())
|
|
324
|
+
try self.__implementation.subscribeToCharacteristic(deviceId: String(deviceId), serviceId: String(serviceId), characteristicId: String(characteristicId), updateCallback: { () -> (String, ArrayBuffer) -> Void in
|
|
325
|
+
let __wrappedFunction = bridge.wrap_Func_void_std__string_std__shared_ptr_ArrayBuffer_(updateCallback)
|
|
326
|
+
return { (__characteristicId: String, __data: ArrayBuffer) -> Void in
|
|
327
|
+
__wrappedFunction.call(std.string(__characteristicId), __data)
|
|
328
328
|
}
|
|
329
329
|
}(), resultCallback: { () -> (Bool, String) -> Void in
|
|
330
330
|
let __wrappedFunction = bridge.wrap_Func_void_bool_std__string(resultCallback)
|
|
@@ -18,14 +18,8 @@ public extension ManufacturerDataEntry {
|
|
|
18
18
|
/**
|
|
19
19
|
* Create a new instance of `ManufacturerDataEntry`.
|
|
20
20
|
*/
|
|
21
|
-
init(id: String, data:
|
|
22
|
-
self.init(std.string(id),
|
|
23
|
-
var __vector = bridge.create_std__vector_double_(data.count)
|
|
24
|
-
for __item in data {
|
|
25
|
-
__vector.push_back(__item)
|
|
26
|
-
}
|
|
27
|
-
return __vector
|
|
28
|
-
}())
|
|
21
|
+
init(id: String, data: ArrayBuffer) {
|
|
22
|
+
self.init(std.string(id), data.getArrayBuffer())
|
|
29
23
|
}
|
|
30
24
|
|
|
31
25
|
var id: String {
|
|
@@ -39,20 +33,14 @@ public extension ManufacturerDataEntry {
|
|
|
39
33
|
}
|
|
40
34
|
}
|
|
41
35
|
|
|
42
|
-
var data:
|
|
36
|
+
var data: ArrayBuffer {
|
|
43
37
|
@inline(__always)
|
|
44
38
|
get {
|
|
45
|
-
return self.__data
|
|
39
|
+
return ArrayBuffer(self.__data)
|
|
46
40
|
}
|
|
47
41
|
@inline(__always)
|
|
48
42
|
set {
|
|
49
|
-
self.__data =
|
|
50
|
-
var __vector = bridge.create_std__vector_double_(newValue.count)
|
|
51
|
-
for __item in newValue {
|
|
52
|
-
__vector.push_back(__item)
|
|
53
|
-
}
|
|
54
|
-
return __vector
|
|
55
|
-
}()
|
|
43
|
+
self.__data = newValue.getArrayBuffer()
|
|
56
44
|
}
|
|
57
45
|
}
|
|
58
46
|
}
|