react-native-ble-nitro 1.0.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 +25 -17
- package/ios/BleNitroBleManager.swift +126 -57
- package/ios/BlePeripheralDelegate.swift +36 -8
- package/lib/commonjs/index.d.ts +29 -20
- package/lib/commonjs/index.d.ts.map +1 -1
- package/lib/commonjs/index.js +113 -143
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/specs/NativeBleNitro.nitro.d.ts +19 -14
- 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 +29 -20
- package/lib/index.js +112 -142
- package/lib/specs/NativeBleNitro.nitro.d.ts +19 -14
- package/nitrogen/generated/android/BleNitroOnLoad.cpp +6 -12
- 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 +111 -65
- package/nitrogen/generated/android/c++/JHybridNativeBleNitroSpec.hpp +13 -13
- package/nitrogen/generated/android/c++/JManufacturerData.hpp +3 -0
- package/nitrogen/generated/android/c++/JManufacturerDataEntry.hpp +7 -15
- package/nitrogen/generated/android/c++/JOperationResult.hpp +58 -0
- 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 +20 -65
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/ManufacturerDataEntry.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/OperationResult.kt +32 -0
- package/nitrogen/generated/ios/BleNitro-Swift-Cxx-Bridge.cpp +15 -39
- package/nitrogen/generated/ios/BleNitro-Swift-Cxx-Bridge.hpp +108 -113
- package/nitrogen/generated/ios/BleNitro-Swift-Cxx-Umbrella.hpp +6 -0
- package/nitrogen/generated/ios/c++/HybridNativeBleNitroSpecSwift.hpp +57 -28
- 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 +13 -13
- package/nitrogen/generated/ios/swift/HybridNativeBleNitroSpec_cxx.swift +84 -136
- package/nitrogen/generated/ios/swift/ManufacturerDataEntry.swift +5 -17
- package/nitrogen/generated/ios/swift/OperationResult.swift +64 -0
- package/nitrogen/generated/shared/c++/HybridNativeBleNitroSpec.cpp +1 -1
- package/nitrogen/generated/shared/c++/HybridNativeBleNitroSpec.hpp +20 -14
- package/nitrogen/generated/shared/c++/ManufacturerDataEntry.hpp +8 -7
- package/nitrogen/generated/shared/c++/OperationResult.hpp +72 -0
- package/package.json +1 -1
- package/react-native.config.js +10 -2
- package/src/__tests__/index.test.ts +19 -22
- package/src/index.ts +147 -164
- package/src/specs/NativeBleNitro.nitro.ts +22 -14
- package/nitrogen/generated/android/c++/JFunc_void_bool.hpp +0 -74
- 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
- package/nitrogen/generated/android/c++/JFunc_void_std__vector_BLEDevice_.hpp +0 -99
- package/nitrogen/generated/android/c++/JFunc_void_std__vector_std__string_.hpp +0 -93
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/Func_void_bool.kt +0 -81
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/Func_void_std__vector_BLEDevice_.kt +0 -81
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/Func_void_std__vector_std__string_.kt +0 -81
- package/nitrogen/generated/ios/swift/Func_void_bool.swift +0 -47
- package/nitrogen/generated/ios/swift/Func_void_std__vector_BLEDevice_.swift +0 -47
- package/nitrogen/generated/ios/swift/Func_void_std__vector_std__string_.swift +0 -47
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
///
|
|
2
|
-
///
|
|
2
|
+
/// Func_void_bool_std__shared_ptr_ArrayBuffer__std__string.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 `(success: boolean, data: array, error: string) => void`.
|
|
18
|
+
* Represents the JavaScript callback `(success: boolean, data: array-buffer, error: string) => 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_bool_std__shared_ptr_ArrayBuffer__std__string: (Boolean, ArrayBuffer, String) -> 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(success: Boolean, data:
|
|
32
|
+
override fun invoke(success: Boolean, data: ArrayBuffer, error: String): Unit
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
|
-
* Represents the JavaScript callback `(success: boolean, data: array, error: string) => void`.
|
|
36
|
+
* Represents the JavaScript callback `(success: boolean, data: array-buffer, error: string) => 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_bool_std__vector_double__std__string: (Boolean, DoubleAr
|
|
|
44
44
|
"RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
|
|
45
45
|
"ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
|
|
46
46
|
)
|
|
47
|
-
class
|
|
47
|
+
class Func_void_bool_std__shared_ptr_ArrayBuffer__std__string_cxx: Func_void_bool_std__shared_ptr_ArrayBuffer__std__string {
|
|
48
48
|
@DoNotStrip
|
|
49
49
|
@Keep
|
|
50
50
|
private val mHybridData: HybridData
|
|
@@ -57,25 +57,25 @@ class Func_void_bool_std__vector_double__std__string_cxx: Func_void_bool_std__ve
|
|
|
57
57
|
|
|
58
58
|
@DoNotStrip
|
|
59
59
|
@Keep
|
|
60
|
-
override fun invoke(success: Boolean, data:
|
|
60
|
+
override fun invoke(success: Boolean, data: ArrayBuffer, error: String): Unit
|
|
61
61
|
= invoke_cxx(success,data,error)
|
|
62
62
|
|
|
63
63
|
@FastNative
|
|
64
|
-
private external fun invoke_cxx(success: Boolean, data:
|
|
64
|
+
private external fun invoke_cxx(success: Boolean, data: ArrayBuffer, error: String): Unit
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
|
-
* Represents the JavaScript callback `(success: boolean, data: array, error: string) => void`.
|
|
69
|
-
* This is implemented in Java/Kotlin, via a `(Boolean,
|
|
68
|
+
* Represents the JavaScript callback `(success: boolean, data: array-buffer, error: string) => void`.
|
|
69
|
+
* This is implemented in Java/Kotlin, via a `(Boolean, ArrayBuffer, String) -> 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_bool_std__shared_ptr_ArrayBuffer__std__string_java(private val function: (Boolean, ArrayBuffer, String) -> Unit): Func_void_bool_std__shared_ptr_ArrayBuffer__std__string {
|
|
76
76
|
@DoNotStrip
|
|
77
77
|
@Keep
|
|
78
|
-
override fun invoke(success: Boolean, data:
|
|
78
|
+
override fun invoke(success: Boolean, data: ArrayBuffer, error: String): Unit {
|
|
79
79
|
return this.function(success, data, error)
|
|
80
80
|
}
|
|
81
81
|
}
|
|
@@ -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
|
@@ -49,32 +49,17 @@ abstract class HybridNativeBleNitroSpec: HybridObject() {
|
|
|
49
49
|
return __result
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
abstract fun stopScan(callback: (success: Boolean, error: String) -> Unit): Unit
|
|
53
|
-
|
|
54
52
|
@DoNotStrip
|
|
55
53
|
@Keep
|
|
56
|
-
|
|
57
|
-
val __result = stopScan(callback)
|
|
58
|
-
return __result
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
abstract fun isScanning(callback: (result: Boolean) -> Unit): Unit
|
|
54
|
+
abstract fun stopScan(): Boolean
|
|
62
55
|
|
|
63
56
|
@DoNotStrip
|
|
64
57
|
@Keep
|
|
65
|
-
|
|
66
|
-
val __result = isScanning(callback)
|
|
67
|
-
return __result
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
abstract fun getConnectedDevices(callback: (devices: Array<BLEDevice>) -> Unit): Unit
|
|
58
|
+
abstract fun isScanning(): Boolean
|
|
71
59
|
|
|
72
60
|
@DoNotStrip
|
|
73
61
|
@Keep
|
|
74
|
-
|
|
75
|
-
val __result = getConnectedDevices(callback)
|
|
76
|
-
return __result
|
|
77
|
-
}
|
|
62
|
+
abstract fun getConnectedDevices(services: Array<String>): Array<BLEDevice>
|
|
78
63
|
|
|
79
64
|
abstract fun connect(deviceId: String, callback: (success: Boolean, deviceId: String, error: String) -> Unit, disconnectCallback: ((deviceId: String, interrupted: Boolean, error: String) -> Unit)?): Unit
|
|
80
65
|
|
|
@@ -94,14 +79,13 @@ abstract class HybridNativeBleNitroSpec: HybridObject() {
|
|
|
94
79
|
return __result
|
|
95
80
|
}
|
|
96
81
|
|
|
97
|
-
|
|
82
|
+
@DoNotStrip
|
|
83
|
+
@Keep
|
|
84
|
+
abstract fun isConnected(deviceId: String): Boolean
|
|
98
85
|
|
|
99
86
|
@DoNotStrip
|
|
100
87
|
@Keep
|
|
101
|
-
|
|
102
|
-
val __result = isConnected(deviceId, callback)
|
|
103
|
-
return __result
|
|
104
|
-
}
|
|
88
|
+
abstract fun requestMTU(deviceId: String, mtu: Double): Double
|
|
105
89
|
|
|
106
90
|
abstract fun discoverServices(deviceId: String, callback: (success: Boolean, error: String) -> Unit): Unit
|
|
107
91
|
|
|
@@ -112,47 +96,37 @@ abstract class HybridNativeBleNitroSpec: HybridObject() {
|
|
|
112
96
|
return __result
|
|
113
97
|
}
|
|
114
98
|
|
|
115
|
-
abstract fun getServices(deviceId: String, callback: (result: Array<String>) -> Unit): Unit
|
|
116
|
-
|
|
117
99
|
@DoNotStrip
|
|
118
100
|
@Keep
|
|
119
|
-
|
|
120
|
-
val __result = getServices(deviceId, callback)
|
|
121
|
-
return __result
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
abstract fun getCharacteristics(deviceId: String, serviceId: String, callback: (result: Array<String>) -> Unit): Unit
|
|
101
|
+
abstract fun getServices(deviceId: String): Array<String>
|
|
125
102
|
|
|
126
103
|
@DoNotStrip
|
|
127
104
|
@Keep
|
|
128
|
-
|
|
129
|
-
val __result = getCharacteristics(deviceId, serviceId, callback)
|
|
130
|
-
return __result
|
|
131
|
-
}
|
|
105
|
+
abstract fun getCharacteristics(deviceId: String, serviceId: String): Array<String>
|
|
132
106
|
|
|
133
|
-
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
|
|
134
108
|
|
|
135
109
|
@DoNotStrip
|
|
136
110
|
@Keep
|
|
137
|
-
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 {
|
|
138
112
|
val __result = readCharacteristic(deviceId, serviceId, characteristicId, callback)
|
|
139
113
|
return __result
|
|
140
114
|
}
|
|
141
115
|
|
|
142
|
-
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
|
|
143
117
|
|
|
144
118
|
@DoNotStrip
|
|
145
119
|
@Keep
|
|
146
|
-
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 {
|
|
147
121
|
val __result = writeCharacteristic(deviceId, serviceId, characteristicId, data, withResponse, callback)
|
|
148
122
|
return __result
|
|
149
123
|
}
|
|
150
124
|
|
|
151
|
-
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
|
|
152
126
|
|
|
153
127
|
@DoNotStrip
|
|
154
128
|
@Keep
|
|
155
|
-
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 {
|
|
156
130
|
val __result = subscribeToCharacteristic(deviceId, serviceId, characteristicId, updateCallback, resultCallback)
|
|
157
131
|
return __result
|
|
158
132
|
}
|
|
@@ -166,15 +140,6 @@ abstract class HybridNativeBleNitroSpec: HybridObject() {
|
|
|
166
140
|
return __result
|
|
167
141
|
}
|
|
168
142
|
|
|
169
|
-
abstract fun isBluetoothEnabled(callback: (result: Boolean) -> Unit): Unit
|
|
170
|
-
|
|
171
|
-
@DoNotStrip
|
|
172
|
-
@Keep
|
|
173
|
-
private fun isBluetoothEnabled_cxx(callback: Func_void_bool): Unit {
|
|
174
|
-
val __result = isBluetoothEnabled(callback)
|
|
175
|
-
return __result
|
|
176
|
-
}
|
|
177
|
-
|
|
178
143
|
abstract fun requestBluetoothEnable(callback: (success: Boolean, error: String) -> Unit): Unit
|
|
179
144
|
|
|
180
145
|
@DoNotStrip
|
|
@@ -184,32 +149,22 @@ abstract class HybridNativeBleNitroSpec: HybridObject() {
|
|
|
184
149
|
return __result
|
|
185
150
|
}
|
|
186
151
|
|
|
187
|
-
abstract fun state(callback: (state: BLEState) -> Unit): Unit
|
|
188
|
-
|
|
189
152
|
@DoNotStrip
|
|
190
153
|
@Keep
|
|
191
|
-
|
|
192
|
-
val __result = state(callback)
|
|
193
|
-
return __result
|
|
194
|
-
}
|
|
154
|
+
abstract fun state(): BLEState
|
|
195
155
|
|
|
196
|
-
abstract fun subscribeToStateChange(stateCallback: (state: BLEState) -> Unit
|
|
156
|
+
abstract fun subscribeToStateChange(stateCallback: (state: BLEState) -> Unit): OperationResult
|
|
197
157
|
|
|
198
158
|
@DoNotStrip
|
|
199
159
|
@Keep
|
|
200
|
-
private fun subscribeToStateChange_cxx(stateCallback: Func_void_BLEState
|
|
201
|
-
val __result = subscribeToStateChange(stateCallback
|
|
160
|
+
private fun subscribeToStateChange_cxx(stateCallback: Func_void_BLEState): OperationResult {
|
|
161
|
+
val __result = subscribeToStateChange(stateCallback)
|
|
202
162
|
return __result
|
|
203
163
|
}
|
|
204
164
|
|
|
205
|
-
abstract fun unsubscribeFromStateChange(resultCallback: (success: Boolean, error: String) -> Unit): Unit
|
|
206
|
-
|
|
207
165
|
@DoNotStrip
|
|
208
166
|
@Keep
|
|
209
|
-
|
|
210
|
-
val __result = unsubscribeFromStateChange(resultCallback)
|
|
211
|
-
return __result
|
|
212
|
-
}
|
|
167
|
+
abstract fun unsubscribeFromStateChange(): OperationResult
|
|
213
168
|
|
|
214
169
|
@DoNotStrip
|
|
215
170
|
@Keep
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// OperationResult.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.co.zyke.ble
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
import com.margelo.nitro.core.*
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Represents the JavaScript object/struct "OperationResult".
|
|
17
|
+
*/
|
|
18
|
+
@DoNotStrip
|
|
19
|
+
@Keep
|
|
20
|
+
data class OperationResult
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
@Keep
|
|
23
|
+
constructor(
|
|
24
|
+
@DoNotStrip
|
|
25
|
+
@Keep
|
|
26
|
+
val success: Boolean,
|
|
27
|
+
@DoNotStrip
|
|
28
|
+
@Keep
|
|
29
|
+
val error: String?
|
|
30
|
+
) {
|
|
31
|
+
/* main constructor */
|
|
32
|
+
}
|
|
@@ -21,30 +21,6 @@ namespace margelo::nitro::co::zyke::ble::bridge::swift {
|
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
// pragma MARK: std::function<void(bool /* success */, const std::string& /* error */)>
|
|
25
|
-
Func_void_bool_std__string create_Func_void_bool_std__string(void* _Nonnull swiftClosureWrapper) {
|
|
26
|
-
auto swiftClosure = BleNitro::Func_void_bool_std__string::fromUnsafe(swiftClosureWrapper);
|
|
27
|
-
return [swiftClosure = std::move(swiftClosure)](bool success, const std::string& error) mutable -> void {
|
|
28
|
-
swiftClosure.call(success, error);
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// pragma MARK: std::function<void(bool /* result */)>
|
|
33
|
-
Func_void_bool create_Func_void_bool(void* _Nonnull swiftClosureWrapper) {
|
|
34
|
-
auto swiftClosure = BleNitro::Func_void_bool::fromUnsafe(swiftClosureWrapper);
|
|
35
|
-
return [swiftClosure = std::move(swiftClosure)](bool result) mutable -> void {
|
|
36
|
-
swiftClosure.call(result);
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// pragma MARK: std::function<void(const std::vector<BLEDevice>& /* devices */)>
|
|
41
|
-
Func_void_std__vector_BLEDevice_ create_Func_void_std__vector_BLEDevice_(void* _Nonnull swiftClosureWrapper) {
|
|
42
|
-
auto swiftClosure = BleNitro::Func_void_std__vector_BLEDevice_::fromUnsafe(swiftClosureWrapper);
|
|
43
|
-
return [swiftClosure = std::move(swiftClosure)](const std::vector<BLEDevice>& devices) mutable -> void {
|
|
44
|
-
swiftClosure.call(devices);
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
|
|
48
24
|
// pragma MARK: std::function<void(bool /* success */, const std::string& /* deviceId */, const std::string& /* error */)>
|
|
49
25
|
Func_void_bool_std__string_std__string create_Func_void_bool_std__string_std__string(void* _Nonnull swiftClosureWrapper) {
|
|
50
26
|
auto swiftClosure = BleNitro::Func_void_bool_std__string_std__string::fromUnsafe(swiftClosureWrapper);
|
|
@@ -61,27 +37,27 @@ namespace margelo::nitro::co::zyke::ble::bridge::swift {
|
|
|
61
37
|
};
|
|
62
38
|
}
|
|
63
39
|
|
|
64
|
-
// pragma MARK: std::function<void(const std::
|
|
65
|
-
|
|
66
|
-
auto swiftClosure = BleNitro::
|
|
67
|
-
return [swiftClosure = std::move(swiftClosure)](const std::
|
|
68
|
-
swiftClosure.call(
|
|
40
|
+
// pragma MARK: std::function<void(bool /* success */, const std::string& /* error */)>
|
|
41
|
+
Func_void_bool_std__string create_Func_void_bool_std__string(void* _Nonnull swiftClosureWrapper) {
|
|
42
|
+
auto swiftClosure = BleNitro::Func_void_bool_std__string::fromUnsafe(swiftClosureWrapper);
|
|
43
|
+
return [swiftClosure = std::move(swiftClosure)](bool success, const std::string& error) mutable -> void {
|
|
44
|
+
swiftClosure.call(success, error);
|
|
69
45
|
};
|
|
70
46
|
}
|
|
71
47
|
|
|
72
|
-
// pragma MARK: std::function<void(bool /* success */, const std::
|
|
73
|
-
|
|
74
|
-
auto swiftClosure = BleNitro::
|
|
75
|
-
return [swiftClosure = std::move(swiftClosure)](bool success, const std::
|
|
76
|
-
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);
|
|
77
53
|
};
|
|
78
54
|
}
|
|
79
55
|
|
|
80
|
-
// pragma MARK: std::function<void(const std::string& /* characteristicId */, const std::
|
|
81
|
-
|
|
82
|
-
auto swiftClosure = BleNitro::
|
|
83
|
-
return [swiftClosure = std::move(swiftClosure)](const std::string& characteristicId, const std::
|
|
84
|
-
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));
|
|
85
61
|
};
|
|
86
62
|
}
|
|
87
63
|
|