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
package/lib/index.js
CHANGED
|
@@ -20,6 +20,12 @@ function mapNativeBLEStateToBLEState(nativeState) {
|
|
|
20
20
|
};
|
|
21
21
|
return map[nativeState];
|
|
22
22
|
}
|
|
23
|
+
function arrayBufferToByteArray(buffer) {
|
|
24
|
+
return Array.from(new Uint8Array(buffer));
|
|
25
|
+
}
|
|
26
|
+
function byteArrayToArrayBuffer(data) {
|
|
27
|
+
return new Uint8Array(data).buffer;
|
|
28
|
+
}
|
|
23
29
|
let _instance;
|
|
24
30
|
export class BleNitro {
|
|
25
31
|
constructor() {
|
|
@@ -70,8 +76,18 @@ export class BleNitro {
|
|
|
70
76
|
};
|
|
71
77
|
// Create callback wrapper
|
|
72
78
|
const scanCallback = (device) => {
|
|
73
|
-
|
|
74
|
-
|
|
79
|
+
// Convert manufacturer data to Uint8Arrays
|
|
80
|
+
const convertedDevice = {
|
|
81
|
+
...device,
|
|
82
|
+
serviceUUIDs: BleNitro.normalizeGattUUIDs(device.serviceUUIDs),
|
|
83
|
+
manufacturerData: {
|
|
84
|
+
companyIdentifiers: device.manufacturerData.companyIdentifiers.map(entry => ({
|
|
85
|
+
id: entry.id,
|
|
86
|
+
data: arrayBufferToByteArray(entry.data)
|
|
87
|
+
}))
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
callback(convertedDevice);
|
|
75
91
|
};
|
|
76
92
|
// Start scan
|
|
77
93
|
BleNitroNative.startScan(nativeFilter, scanCallback);
|
|
@@ -102,10 +118,16 @@ export class BleNitro {
|
|
|
102
118
|
*/
|
|
103
119
|
getConnectedDevices(services) {
|
|
104
120
|
const devices = BleNitroNative.getConnectedDevices(services || []);
|
|
105
|
-
// Normalize service UUIDs
|
|
121
|
+
// Normalize service UUIDs - manufacturer data already comes as ArrayBuffers
|
|
106
122
|
return devices.map(device => ({
|
|
107
123
|
...device,
|
|
108
|
-
serviceUUIDs: BleNitro.normalizeGattUUIDs(device.serviceUUIDs)
|
|
124
|
+
serviceUUIDs: BleNitro.normalizeGattUUIDs(device.serviceUUIDs),
|
|
125
|
+
manufacturerData: {
|
|
126
|
+
companyIdentifiers: device.manufacturerData.companyIdentifiers.map(entry => ({
|
|
127
|
+
id: entry.id,
|
|
128
|
+
data: arrayBufferToByteArray(entry.data)
|
|
129
|
+
}))
|
|
130
|
+
}
|
|
109
131
|
}));
|
|
110
132
|
}
|
|
111
133
|
/**
|
|
@@ -167,6 +189,17 @@ export class BleNitro {
|
|
|
167
189
|
isConnected(deviceId) {
|
|
168
190
|
return BleNitroNative.isConnected(deviceId);
|
|
169
191
|
}
|
|
192
|
+
/**
|
|
193
|
+
* Request a new MTU size
|
|
194
|
+
* @param deviceId ID of the device
|
|
195
|
+
* @param mtu New MTU size, min is 23, max is 517
|
|
196
|
+
* @returns On Android: new MTU size; on iOS: current MTU size as it is handled by iOS itself; on error: -1
|
|
197
|
+
*/
|
|
198
|
+
requestMTU(deviceId, mtu) {
|
|
199
|
+
mtu = parseInt(mtu.toString(), 10);
|
|
200
|
+
const deviceMtu = BleNitroNative.requestMTU(deviceId, mtu);
|
|
201
|
+
return deviceMtu;
|
|
202
|
+
}
|
|
170
203
|
/**
|
|
171
204
|
* Discover services for a connected device
|
|
172
205
|
* @param deviceId ID of the device
|
|
@@ -228,7 +261,7 @@ export class BleNitro {
|
|
|
228
261
|
* @param deviceId ID of the device
|
|
229
262
|
* @param serviceId ID of the service
|
|
230
263
|
* @param characteristicId ID of the characteristic
|
|
231
|
-
* @returns Promise resolving to the characteristic data as
|
|
264
|
+
* @returns Promise resolving to the characteristic data as ByteArray
|
|
232
265
|
*/
|
|
233
266
|
readCharacteristic(deviceId, serviceId, characteristicId) {
|
|
234
267
|
return new Promise((resolve, reject) => {
|
|
@@ -239,7 +272,7 @@ export class BleNitro {
|
|
|
239
272
|
}
|
|
240
273
|
BleNitroNative.readCharacteristic(deviceId, BleNitro.normalizeGattUUID(serviceId), BleNitro.normalizeGattUUID(characteristicId), (success, data, error) => {
|
|
241
274
|
if (success) {
|
|
242
|
-
resolve(data);
|
|
275
|
+
resolve(arrayBufferToByteArray(data));
|
|
243
276
|
}
|
|
244
277
|
else {
|
|
245
278
|
reject(new Error(error));
|
|
@@ -252,7 +285,7 @@ export class BleNitro {
|
|
|
252
285
|
* @param deviceId ID of the device
|
|
253
286
|
* @param serviceId ID of the service
|
|
254
287
|
* @param characteristicId ID of the characteristic
|
|
255
|
-
* @param data Data to write as
|
|
288
|
+
* @param data Data to write as ByteArray(number[])
|
|
256
289
|
* @param withResponse Whether to wait for response
|
|
257
290
|
* @returns Promise resolving when write is complete
|
|
258
291
|
*/
|
|
@@ -263,7 +296,8 @@ export class BleNitro {
|
|
|
263
296
|
reject(new Error('Device not connected'));
|
|
264
297
|
return;
|
|
265
298
|
}
|
|
266
|
-
|
|
299
|
+
const dataAsArrayBuffer = byteArrayToArrayBuffer(data);
|
|
300
|
+
BleNitroNative.writeCharacteristic(deviceId, BleNitro.normalizeGattUUID(serviceId), BleNitro.normalizeGattUUID(characteristicId), dataAsArrayBuffer, withResponse, (success, error) => {
|
|
267
301
|
if (success) {
|
|
268
302
|
resolve(true);
|
|
269
303
|
}
|
|
@@ -288,7 +322,7 @@ export class BleNitro {
|
|
|
288
322
|
}
|
|
289
323
|
let _success = false;
|
|
290
324
|
BleNitroNative.subscribeToCharacteristic(deviceId, BleNitro.normalizeGattUUID(serviceId), BleNitro.normalizeGattUUID(characteristicId), (charId, data) => {
|
|
291
|
-
callback(charId, data);
|
|
325
|
+
callback(charId, arrayBufferToByteArray(data));
|
|
292
326
|
}, (success, error) => {
|
|
293
327
|
_success = success;
|
|
294
328
|
if (!success) {
|
|
@@ -336,8 +370,7 @@ export class BleNitro {
|
|
|
336
370
|
return this.state() === BLEState.PoweredOn;
|
|
337
371
|
}
|
|
338
372
|
/**
|
|
339
|
-
* Request to enable Bluetooth
|
|
340
|
-
* Only works on Android
|
|
373
|
+
* Request to enable Bluetooth (Android only)
|
|
341
374
|
* @returns Promise resolving when Bluetooth is enabled
|
|
342
375
|
*/
|
|
343
376
|
requestBluetoothEnable() {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { HybridObject } from 'react-native-nitro-modules';
|
|
2
|
+
export type BLEValue = ArrayBuffer;
|
|
2
3
|
export declare enum BLEState {
|
|
3
4
|
Unknown = 0,
|
|
4
5
|
Resetting = 1,
|
|
@@ -9,7 +10,7 @@ export declare enum BLEState {
|
|
|
9
10
|
}
|
|
10
11
|
export interface ManufacturerDataEntry {
|
|
11
12
|
id: string;
|
|
12
|
-
data:
|
|
13
|
+
data: BLEValue;
|
|
13
14
|
}
|
|
14
15
|
export interface ManufacturerData {
|
|
15
16
|
companyIdentifiers: ManufacturerDataEntry[];
|
|
@@ -32,11 +33,11 @@ export type DevicesCallback = (devices: BLEDevice[]) => void;
|
|
|
32
33
|
export type ConnectionCallback = (success: boolean, deviceId: string, error: string) => void;
|
|
33
34
|
export type DisconnectionEventCallback = (deviceId: string, interrupted: boolean, error: string) => void;
|
|
34
35
|
export type OperationCallback = (success: boolean, error: string) => void;
|
|
35
|
-
export type CharacteristicCallback = (characteristicId: string, data:
|
|
36
|
+
export type CharacteristicCallback = (characteristicId: string, data: BLEValue) => void;
|
|
36
37
|
export type StateCallback = (state: BLEState) => void;
|
|
37
38
|
export type BooleanCallback = (result: boolean) => void;
|
|
38
39
|
export type StringArrayCallback = (result: string[]) => void;
|
|
39
|
-
export type ReadCharacteristicCallback = (success: boolean, data:
|
|
40
|
+
export type ReadCharacteristicCallback = (success: boolean, data: BLEValue, error: string) => void;
|
|
40
41
|
export type OperationResult = {
|
|
41
42
|
success: boolean;
|
|
42
43
|
error?: string;
|
|
@@ -56,11 +57,12 @@ export interface NativeBleNitro extends HybridObject<{
|
|
|
56
57
|
connect(deviceId: string, callback: ConnectionCallback, disconnectCallback?: DisconnectionEventCallback): void;
|
|
57
58
|
disconnect(deviceId: string, callback: OperationCallback): void;
|
|
58
59
|
isConnected(deviceId: string): boolean;
|
|
60
|
+
requestMTU(deviceId: string, mtu: number): number;
|
|
59
61
|
discoverServices(deviceId: string, callback: OperationCallback): void;
|
|
60
62
|
getServices(deviceId: string): string[];
|
|
61
63
|
getCharacteristics(deviceId: string, serviceId: string): string[];
|
|
62
64
|
readCharacteristic(deviceId: string, serviceId: string, characteristicId: string, callback: ReadCharacteristicCallback): void;
|
|
63
|
-
writeCharacteristic(deviceId: string, serviceId: string, characteristicId: string, data:
|
|
65
|
+
writeCharacteristic(deviceId: string, serviceId: string, characteristicId: string, data: BLEValue, withResponse: boolean, callback: OperationCallback): void;
|
|
64
66
|
subscribeToCharacteristic(deviceId: string, serviceId: string, characteristicId: string, updateCallback: CharacteristicCallback, resultCallback: OperationCallback): void;
|
|
65
67
|
unsubscribeFromCharacteristic(deviceId: string, serviceId: string, characteristicId: string, callback: OperationCallback): void;
|
|
66
68
|
requestBluetoothEnable(callback: OperationCallback): void;
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
#include "JFunc_void_bool_std__string_std__string.hpp"
|
|
21
21
|
#include "JFunc_void_std__string_bool_std__string.hpp"
|
|
22
22
|
#include "JFunc_void_bool_std__string.hpp"
|
|
23
|
-
#include "
|
|
24
|
-
#include "
|
|
23
|
+
#include "JFunc_void_bool_std__shared_ptr_ArrayBuffer__std__string.hpp"
|
|
24
|
+
#include "JFunc_void_std__string_std__shared_ptr_ArrayBuffer_.hpp"
|
|
25
25
|
#include "JFunc_void_BLEState.hpp"
|
|
26
26
|
#include <NitroModules/DefaultConstructableObject.hpp>
|
|
27
27
|
|
|
@@ -39,8 +39,8 @@ int initialize(JavaVM* vm) {
|
|
|
39
39
|
margelo::nitro::co::zyke::ble::JFunc_void_bool_std__string_std__string_cxx::registerNatives();
|
|
40
40
|
margelo::nitro::co::zyke::ble::JFunc_void_std__string_bool_std__string_cxx::registerNatives();
|
|
41
41
|
margelo::nitro::co::zyke::ble::JFunc_void_bool_std__string_cxx::registerNatives();
|
|
42
|
-
margelo::nitro::co::zyke::ble::
|
|
43
|
-
margelo::nitro::co::zyke::ble::
|
|
42
|
+
margelo::nitro::co::zyke::ble::JFunc_void_bool_std__shared_ptr_ArrayBuffer__std__string_cxx::registerNatives();
|
|
43
|
+
margelo::nitro::co::zyke::ble::JFunc_void_std__string_std__shared_ptr_ArrayBuffer__cxx::registerNatives();
|
|
44
44
|
margelo::nitro::co::zyke::ble::JFunc_void_BLEState_cxx::registerNatives();
|
|
45
45
|
|
|
46
46
|
// Register Nitro Hybrid Objects
|
|
@@ -14,6 +14,9 @@
|
|
|
14
14
|
#include "JManufacturerDataEntry.hpp"
|
|
15
15
|
#include "ManufacturerData.hpp"
|
|
16
16
|
#include "ManufacturerDataEntry.hpp"
|
|
17
|
+
#include <NitroModules/ArrayBuffer.hpp>
|
|
18
|
+
#include <NitroModules/JArrayBuffer.hpp>
|
|
19
|
+
#include <NitroModules/JUnit.hpp>
|
|
17
20
|
#include <string>
|
|
18
21
|
#include <vector>
|
|
19
22
|
|
|
@@ -19,6 +19,9 @@
|
|
|
19
19
|
#include "ManufacturerDataEntry.hpp"
|
|
20
20
|
#include <vector>
|
|
21
21
|
#include "JManufacturerDataEntry.hpp"
|
|
22
|
+
#include <NitroModules/ArrayBuffer.hpp>
|
|
23
|
+
#include <NitroModules/JArrayBuffer.hpp>
|
|
24
|
+
#include <NitroModules/JUnit.hpp>
|
|
22
25
|
|
|
23
26
|
namespace margelo::nitro::co::zyke::ble {
|
|
24
27
|
|
package/nitrogen/generated/android/c++/JFunc_void_bool_std__shared_ptr_ArrayBuffer__std__string.hpp
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JFunc_void_bool_std__shared_ptr_ArrayBuffer__std__string.hpp
|
|
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
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include <functional>
|
|
12
|
+
|
|
13
|
+
#include <NitroModules/ArrayBuffer.hpp>
|
|
14
|
+
#include <string>
|
|
15
|
+
#include <functional>
|
|
16
|
+
#include <NitroModules/JArrayBuffer.hpp>
|
|
17
|
+
#include <NitroModules/JUnit.hpp>
|
|
18
|
+
|
|
19
|
+
namespace margelo::nitro::co::zyke::ble {
|
|
20
|
+
|
|
21
|
+
using namespace facebook;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Represents the Java/Kotlin callback `(success: Boolean, data: ArrayBuffer, error: String) -> Unit`.
|
|
25
|
+
* This can be passed around between C++ and Java/Kotlin.
|
|
26
|
+
*/
|
|
27
|
+
struct JFunc_void_bool_std__shared_ptr_ArrayBuffer__std__string: public jni::JavaClass<JFunc_void_bool_std__shared_ptr_ArrayBuffer__std__string> {
|
|
28
|
+
public:
|
|
29
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/co/zyke/ble/Func_void_bool_std__shared_ptr_ArrayBuffer__std__string;";
|
|
30
|
+
|
|
31
|
+
public:
|
|
32
|
+
/**
|
|
33
|
+
* Invokes the function this `JFunc_void_bool_std__shared_ptr_ArrayBuffer__std__string` instance holds through JNI.
|
|
34
|
+
*/
|
|
35
|
+
void invoke(bool success, const std::shared_ptr<ArrayBuffer>& data, const std::string& error) const {
|
|
36
|
+
static const auto method = javaClassStatic()->getMethod<void(jboolean /* success */, jni::alias_ref<JArrayBuffer::javaobject> /* data */, jni::alias_ref<jni::JString> /* error */)>("invoke");
|
|
37
|
+
method(self(), success, JArrayBuffer::wrap(data), jni::make_jstring(error));
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* An implementation of Func_void_bool_std__shared_ptr_ArrayBuffer__std__string that is backed by a C++ implementation (using `std::function<...>`)
|
|
43
|
+
*/
|
|
44
|
+
struct JFunc_void_bool_std__shared_ptr_ArrayBuffer__std__string_cxx final: public jni::HybridClass<JFunc_void_bool_std__shared_ptr_ArrayBuffer__std__string_cxx, JFunc_void_bool_std__shared_ptr_ArrayBuffer__std__string> {
|
|
45
|
+
public:
|
|
46
|
+
static jni::local_ref<JFunc_void_bool_std__shared_ptr_ArrayBuffer__std__string::javaobject> fromCpp(const std::function<void(bool /* success */, const std::shared_ptr<ArrayBuffer>& /* data */, const std::string& /* error */)>& func) {
|
|
47
|
+
return JFunc_void_bool_std__shared_ptr_ArrayBuffer__std__string_cxx::newObjectCxxArgs(func);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public:
|
|
51
|
+
/**
|
|
52
|
+
* Invokes the C++ `std::function<...>` this `JFunc_void_bool_std__shared_ptr_ArrayBuffer__std__string_cxx` instance holds.
|
|
53
|
+
*/
|
|
54
|
+
void invoke_cxx(jboolean success, jni::alias_ref<JArrayBuffer::javaobject> data, jni::alias_ref<jni::JString> error) {
|
|
55
|
+
_func(static_cast<bool>(success), data->cthis()->getArrayBuffer(), error->toStdString());
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
public:
|
|
59
|
+
[[nodiscard]]
|
|
60
|
+
inline const std::function<void(bool /* success */, const std::shared_ptr<ArrayBuffer>& /* data */, const std::string& /* error */)>& getFunction() const {
|
|
61
|
+
return _func;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
public:
|
|
65
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/co/zyke/ble/Func_void_bool_std__shared_ptr_ArrayBuffer__std__string_cxx;";
|
|
66
|
+
static void registerNatives() {
|
|
67
|
+
registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_bool_std__shared_ptr_ArrayBuffer__std__string_cxx::invoke_cxx)});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
private:
|
|
71
|
+
explicit JFunc_void_bool_std__shared_ptr_ArrayBuffer__std__string_cxx(const std::function<void(bool /* success */, const std::shared_ptr<ArrayBuffer>& /* data */, const std::string& /* error */)>& func): _func(func) { }
|
|
72
|
+
|
|
73
|
+
private:
|
|
74
|
+
friend HybridBase;
|
|
75
|
+
std::function<void(bool /* success */, const std::shared_ptr<ArrayBuffer>& /* data */, const std::string& /* error */)> _func;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
} // namespace margelo::nitro::co::zyke::ble
|
package/nitrogen/generated/android/c++/JFunc_void_std__string_std__shared_ptr_ArrayBuffer_.hpp
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JFunc_void_std__string_std__shared_ptr_ArrayBuffer_.hpp
|
|
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
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include <functional>
|
|
12
|
+
|
|
13
|
+
#include <string>
|
|
14
|
+
#include <NitroModules/ArrayBuffer.hpp>
|
|
15
|
+
#include <functional>
|
|
16
|
+
#include <NitroModules/JArrayBuffer.hpp>
|
|
17
|
+
#include <NitroModules/JUnit.hpp>
|
|
18
|
+
|
|
19
|
+
namespace margelo::nitro::co::zyke::ble {
|
|
20
|
+
|
|
21
|
+
using namespace facebook;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Represents the Java/Kotlin callback `(characteristicId: String, data: ArrayBuffer) -> Unit`.
|
|
25
|
+
* This can be passed around between C++ and Java/Kotlin.
|
|
26
|
+
*/
|
|
27
|
+
struct JFunc_void_std__string_std__shared_ptr_ArrayBuffer_: public jni::JavaClass<JFunc_void_std__string_std__shared_ptr_ArrayBuffer_> {
|
|
28
|
+
public:
|
|
29
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/co/zyke/ble/Func_void_std__string_std__shared_ptr_ArrayBuffer_;";
|
|
30
|
+
|
|
31
|
+
public:
|
|
32
|
+
/**
|
|
33
|
+
* Invokes the function this `JFunc_void_std__string_std__shared_ptr_ArrayBuffer_` instance holds through JNI.
|
|
34
|
+
*/
|
|
35
|
+
void invoke(const std::string& characteristicId, const std::shared_ptr<ArrayBuffer>& data) const {
|
|
36
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* characteristicId */, jni::alias_ref<JArrayBuffer::javaobject> /* data */)>("invoke");
|
|
37
|
+
method(self(), jni::make_jstring(characteristicId), JArrayBuffer::wrap(data));
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* An implementation of Func_void_std__string_std__shared_ptr_ArrayBuffer_ that is backed by a C++ implementation (using `std::function<...>`)
|
|
43
|
+
*/
|
|
44
|
+
struct JFunc_void_std__string_std__shared_ptr_ArrayBuffer__cxx final: public jni::HybridClass<JFunc_void_std__string_std__shared_ptr_ArrayBuffer__cxx, JFunc_void_std__string_std__shared_ptr_ArrayBuffer_> {
|
|
45
|
+
public:
|
|
46
|
+
static jni::local_ref<JFunc_void_std__string_std__shared_ptr_ArrayBuffer_::javaobject> fromCpp(const std::function<void(const std::string& /* characteristicId */, const std::shared_ptr<ArrayBuffer>& /* data */)>& func) {
|
|
47
|
+
return JFunc_void_std__string_std__shared_ptr_ArrayBuffer__cxx::newObjectCxxArgs(func);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public:
|
|
51
|
+
/**
|
|
52
|
+
* Invokes the C++ `std::function<...>` this `JFunc_void_std__string_std__shared_ptr_ArrayBuffer__cxx` instance holds.
|
|
53
|
+
*/
|
|
54
|
+
void invoke_cxx(jni::alias_ref<jni::JString> characteristicId, jni::alias_ref<JArrayBuffer::javaobject> data) {
|
|
55
|
+
_func(characteristicId->toStdString(), data->cthis()->getArrayBuffer());
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
public:
|
|
59
|
+
[[nodiscard]]
|
|
60
|
+
inline const std::function<void(const std::string& /* characteristicId */, const std::shared_ptr<ArrayBuffer>& /* data */)>& getFunction() const {
|
|
61
|
+
return _func;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
public:
|
|
65
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/co/zyke/ble/Func_void_std__string_std__shared_ptr_ArrayBuffer__cxx;";
|
|
66
|
+
static void registerNatives() {
|
|
67
|
+
registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_std__string_std__shared_ptr_ArrayBuffer__cxx::invoke_cxx)});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
private:
|
|
71
|
+
explicit JFunc_void_std__string_std__shared_ptr_ArrayBuffer__cxx(const std::function<void(const std::string& /* characteristicId */, const std::shared_ptr<ArrayBuffer>& /* data */)>& func): _func(func) { }
|
|
72
|
+
|
|
73
|
+
private:
|
|
74
|
+
friend HybridBase;
|
|
75
|
+
std::function<void(const std::string& /* characteristicId */, const std::shared_ptr<ArrayBuffer>& /* data */)> _func;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
} // namespace margelo::nitro::co::zyke::ble
|
|
@@ -13,6 +13,8 @@ namespace margelo::nitro::co::zyke::ble { struct BLEDevice; }
|
|
|
13
13
|
namespace margelo::nitro::co::zyke::ble { struct ManufacturerData; }
|
|
14
14
|
// Forward declaration of `ManufacturerDataEntry` to properly resolve imports.
|
|
15
15
|
namespace margelo::nitro::co::zyke::ble { struct ManufacturerDataEntry; }
|
|
16
|
+
// Forward declaration of `ArrayBuffer` to properly resolve imports.
|
|
17
|
+
namespace NitroModules { class ArrayBuffer; }
|
|
16
18
|
// Forward declaration of `BLEState` to properly resolve imports.
|
|
17
19
|
namespace margelo::nitro::co::zyke::ble { enum class BLEState; }
|
|
18
20
|
// Forward declaration of `OperationResult` to properly resolve imports.
|
|
@@ -28,6 +30,9 @@ namespace margelo::nitro::co::zyke::ble { struct ScanFilter; }
|
|
|
28
30
|
#include "JManufacturerData.hpp"
|
|
29
31
|
#include "ManufacturerDataEntry.hpp"
|
|
30
32
|
#include "JManufacturerDataEntry.hpp"
|
|
33
|
+
#include <NitroModules/ArrayBuffer.hpp>
|
|
34
|
+
#include <NitroModules/JArrayBuffer.hpp>
|
|
35
|
+
#include <NitroModules/JUnit.hpp>
|
|
31
36
|
#include "BLEState.hpp"
|
|
32
37
|
#include "JBLEState.hpp"
|
|
33
38
|
#include "OperationResult.hpp"
|
|
@@ -42,8 +47,8 @@ namespace margelo::nitro::co::zyke::ble { struct ScanFilter; }
|
|
|
42
47
|
#include "JFunc_void_bool_std__string_std__string.hpp"
|
|
43
48
|
#include "JFunc_void_std__string_bool_std__string.hpp"
|
|
44
49
|
#include "JFunc_void_bool_std__string.hpp"
|
|
45
|
-
#include "
|
|
46
|
-
#include "
|
|
50
|
+
#include "JFunc_void_bool_std__shared_ptr_ArrayBuffer__std__string.hpp"
|
|
51
|
+
#include "JFunc_void_std__string_std__shared_ptr_ArrayBuffer_.hpp"
|
|
47
52
|
#include "JFunc_void_BLEState.hpp"
|
|
48
53
|
|
|
49
54
|
namespace margelo::nitro::co::zyke::ble {
|
|
@@ -121,6 +126,11 @@ namespace margelo::nitro::co::zyke::ble {
|
|
|
121
126
|
auto __result = method(_javaPart, jni::make_jstring(deviceId));
|
|
122
127
|
return static_cast<bool>(__result);
|
|
123
128
|
}
|
|
129
|
+
double JHybridNativeBleNitroSpec::requestMTU(const std::string& deviceId, double mtu) {
|
|
130
|
+
static const auto method = javaClassStatic()->getMethod<double(jni::alias_ref<jni::JString> /* deviceId */, double /* mtu */)>("requestMTU");
|
|
131
|
+
auto __result = method(_javaPart, jni::make_jstring(deviceId), mtu);
|
|
132
|
+
return __result;
|
|
133
|
+
}
|
|
124
134
|
void JHybridNativeBleNitroSpec::discoverServices(const std::string& deviceId, const std::function<void(bool /* success */, const std::string& /* error */)>& callback) {
|
|
125
135
|
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* deviceId */, jni::alias_ref<JFunc_void_bool_std__string::javaobject> /* callback */)>("discoverServices_cxx");
|
|
126
136
|
method(_javaPart, jni::make_jstring(deviceId), JFunc_void_bool_std__string_cxx::fromCpp(callback));
|
|
@@ -153,22 +163,17 @@ namespace margelo::nitro::co::zyke::ble {
|
|
|
153
163
|
return __vector;
|
|
154
164
|
}();
|
|
155
165
|
}
|
|
156
|
-
void JHybridNativeBleNitroSpec::readCharacteristic(const std::string& deviceId, const std::string& serviceId, const std::string& characteristicId, const std::function<void(bool /* success */, const std::
|
|
157
|
-
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* deviceId */, jni::alias_ref<jni::JString> /* serviceId */, jni::alias_ref<jni::JString> /* characteristicId */, jni::alias_ref<
|
|
158
|
-
method(_javaPart, jni::make_jstring(deviceId), jni::make_jstring(serviceId), jni::make_jstring(characteristicId),
|
|
166
|
+
void JHybridNativeBleNitroSpec::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) {
|
|
167
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* deviceId */, jni::alias_ref<jni::JString> /* serviceId */, jni::alias_ref<jni::JString> /* characteristicId */, jni::alias_ref<JFunc_void_bool_std__shared_ptr_ArrayBuffer__std__string::javaobject> /* callback */)>("readCharacteristic_cxx");
|
|
168
|
+
method(_javaPart, jni::make_jstring(deviceId), jni::make_jstring(serviceId), jni::make_jstring(characteristicId), JFunc_void_bool_std__shared_ptr_ArrayBuffer__std__string_cxx::fromCpp(callback));
|
|
159
169
|
}
|
|
160
|
-
void JHybridNativeBleNitroSpec::writeCharacteristic(const std::string& deviceId, const std::string& serviceId, const std::string& characteristicId, const std::
|
|
161
|
-
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* deviceId */, jni::alias_ref<jni::JString> /* serviceId */, jni::alias_ref<jni::JString> /* characteristicId */, jni::alias_ref<
|
|
162
|
-
method(_javaPart, jni::make_jstring(deviceId), jni::make_jstring(serviceId), jni::make_jstring(characteristicId),
|
|
163
|
-
size_t __size = data.size();
|
|
164
|
-
jni::local_ref<jni::JArrayDouble> __array = jni::JArrayDouble::newArray(__size);
|
|
165
|
-
__array->setRegion(0, __size, data.data());
|
|
166
|
-
return __array;
|
|
167
|
-
}(), withResponse, JFunc_void_bool_std__string_cxx::fromCpp(callback));
|
|
170
|
+
void JHybridNativeBleNitroSpec::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) {
|
|
171
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* deviceId */, jni::alias_ref<jni::JString> /* serviceId */, jni::alias_ref<jni::JString> /* characteristicId */, jni::alias_ref<JArrayBuffer::javaobject> /* data */, jboolean /* withResponse */, jni::alias_ref<JFunc_void_bool_std__string::javaobject> /* callback */)>("writeCharacteristic_cxx");
|
|
172
|
+
method(_javaPart, jni::make_jstring(deviceId), jni::make_jstring(serviceId), jni::make_jstring(characteristicId), JArrayBuffer::wrap(data), withResponse, JFunc_void_bool_std__string_cxx::fromCpp(callback));
|
|
168
173
|
}
|
|
169
|
-
void JHybridNativeBleNitroSpec::subscribeToCharacteristic(const std::string& deviceId, const std::string& serviceId, const std::string& characteristicId, const std::function<void(const std::string& /* characteristicId */, const std::
|
|
170
|
-
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* deviceId */, jni::alias_ref<jni::JString> /* serviceId */, jni::alias_ref<jni::JString> /* characteristicId */, jni::alias_ref<
|
|
171
|
-
method(_javaPart, jni::make_jstring(deviceId), jni::make_jstring(serviceId), jni::make_jstring(characteristicId),
|
|
174
|
+
void JHybridNativeBleNitroSpec::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) {
|
|
175
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* deviceId */, jni::alias_ref<jni::JString> /* serviceId */, jni::alias_ref<jni::JString> /* characteristicId */, jni::alias_ref<JFunc_void_std__string_std__shared_ptr_ArrayBuffer_::javaobject> /* updateCallback */, jni::alias_ref<JFunc_void_bool_std__string::javaobject> /* resultCallback */)>("subscribeToCharacteristic_cxx");
|
|
176
|
+
method(_javaPart, jni::make_jstring(deviceId), jni::make_jstring(serviceId), jni::make_jstring(characteristicId), JFunc_void_std__string_std__shared_ptr_ArrayBuffer__cxx::fromCpp(updateCallback), JFunc_void_bool_std__string_cxx::fromCpp(resultCallback));
|
|
172
177
|
}
|
|
173
178
|
void JHybridNativeBleNitroSpec::unsubscribeFromCharacteristic(const std::string& deviceId, const std::string& serviceId, const std::string& characteristicId, const std::function<void(bool /* success */, const std::string& /* error */)>& callback) {
|
|
174
179
|
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* deviceId */, jni::alias_ref<jni::JString> /* serviceId */, jni::alias_ref<jni::JString> /* characteristicId */, jni::alias_ref<JFunc_void_bool_std__string::javaobject> /* callback */)>("unsubscribeFromCharacteristic_cxx");
|
|
@@ -60,12 +60,13 @@ namespace margelo::nitro::co::zyke::ble {
|
|
|
60
60
|
void connect(const std::string& deviceId, const std::function<void(bool /* success */, const std::string& /* deviceId */, const std::string& /* error */)>& callback, const std::optional<std::function<void(const std::string& /* deviceId */, bool /* interrupted */, const std::string& /* error */)>>& disconnectCallback) override;
|
|
61
61
|
void disconnect(const std::string& deviceId, const std::function<void(bool /* success */, const std::string& /* error */)>& callback) override;
|
|
62
62
|
bool isConnected(const std::string& deviceId) override;
|
|
63
|
+
double requestMTU(const std::string& deviceId, double mtu) override;
|
|
63
64
|
void discoverServices(const std::string& deviceId, const std::function<void(bool /* success */, const std::string& /* error */)>& callback) override;
|
|
64
65
|
std::vector<std::string> getServices(const std::string& deviceId) override;
|
|
65
66
|
std::vector<std::string> getCharacteristics(const std::string& deviceId, const std::string& serviceId) override;
|
|
66
|
-
void readCharacteristic(const std::string& deviceId, const std::string& serviceId, const std::string& characteristicId, const std::function<void(bool /* success */, const std::
|
|
67
|
-
void writeCharacteristic(const std::string& deviceId, const std::string& serviceId, const std::string& characteristicId, const std::
|
|
68
|
-
void subscribeToCharacteristic(const std::string& deviceId, const std::string& serviceId, const std::string& characteristicId, const std::function<void(const std::string& /* characteristicId */, const std::
|
|
67
|
+
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;
|
|
68
|
+
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;
|
|
69
|
+
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;
|
|
69
70
|
void unsubscribeFromCharacteristic(const std::string& deviceId, const std::string& serviceId, const std::string& characteristicId, const std::function<void(bool /* success */, const std::string& /* error */)>& callback) override;
|
|
70
71
|
void requestBluetoothEnable(const std::function<void(bool /* success */, const std::string& /* error */)>& callback) override;
|
|
71
72
|
BLEState state() override;
|
|
@@ -10,8 +10,10 @@
|
|
|
10
10
|
#include <fbjni/fbjni.h>
|
|
11
11
|
#include "ManufacturerDataEntry.hpp"
|
|
12
12
|
|
|
13
|
+
#include <NitroModules/ArrayBuffer.hpp>
|
|
14
|
+
#include <NitroModules/JArrayBuffer.hpp>
|
|
15
|
+
#include <NitroModules/JUnit.hpp>
|
|
13
16
|
#include <string>
|
|
14
|
-
#include <vector>
|
|
15
17
|
|
|
16
18
|
namespace margelo::nitro::co::zyke::ble {
|
|
17
19
|
|
|
@@ -34,16 +36,11 @@ namespace margelo::nitro::co::zyke::ble {
|
|
|
34
36
|
static const auto clazz = javaClassStatic();
|
|
35
37
|
static const auto fieldId = clazz->getField<jni::JString>("id");
|
|
36
38
|
jni::local_ref<jni::JString> id = this->getFieldValue(fieldId);
|
|
37
|
-
static const auto fieldData = clazz->getField<
|
|
38
|
-
jni::local_ref<
|
|
39
|
+
static const auto fieldData = clazz->getField<JArrayBuffer::javaobject>("data");
|
|
40
|
+
jni::local_ref<JArrayBuffer::javaobject> data = this->getFieldValue(fieldData);
|
|
39
41
|
return ManufacturerDataEntry(
|
|
40
42
|
id->toStdString(),
|
|
41
|
-
|
|
42
|
-
size_t __size = data->size();
|
|
43
|
-
std::vector<double> __vector(__size);
|
|
44
|
-
data->getRegion(0, __size, __vector.data());
|
|
45
|
-
return __vector;
|
|
46
|
-
}()
|
|
43
|
+
data->cthis()->getArrayBuffer()
|
|
47
44
|
);
|
|
48
45
|
}
|
|
49
46
|
|
|
@@ -55,12 +52,7 @@ namespace margelo::nitro::co::zyke::ble {
|
|
|
55
52
|
static jni::local_ref<JManufacturerDataEntry::javaobject> fromCpp(const ManufacturerDataEntry& value) {
|
|
56
53
|
return newInstance(
|
|
57
54
|
jni::make_jstring(value.id),
|
|
58
|
-
|
|
59
|
-
size_t __size = value.data.size();
|
|
60
|
-
jni::local_ref<jni::JArrayDouble> __array = jni::JArrayDouble::newArray(__size);
|
|
61
|
-
__array->setRegion(0, __size, value.data.data());
|
|
62
|
-
return __array;
|
|
63
|
-
}()
|
|
55
|
+
JArrayBuffer::wrap(value.data)
|
|
64
56
|
);
|
|
65
57
|
}
|
|
66
58
|
};
|
|
@@ -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
|
}
|