react-native-ble-nitro 1.0.0-beta.6 → 1.0.0-beta.7
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/android/src/main/kotlin/co/zyke/ble/BleNitroBleManager.kt +1 -1
- package/android/src/main/kotlin/co/zyke/ble/BleNitroPackage.kt +4 -4
- package/ios/BleNitro.podspec +1 -1
- package/ios/BleNitroModule.swift +11 -9
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/android/BleNitro+autolinking.cmake +86 -0
- package/nitrogen/generated/android/BleNitro+autolinking.gradle +27 -0
- package/nitrogen/generated/android/BleNitroOnLoad.cpp +52 -0
- package/nitrogen/generated/android/BleNitroOnLoad.hpp +25 -0
- package/nitrogen/generated/android/c++/JBleATTErrorCode.hpp +107 -0
- package/nitrogen/generated/android/c++/JBleAndroidErrorCode.hpp +101 -0
- package/nitrogen/generated/android/c++/JBleErrorCode.hpp +170 -0
- package/nitrogen/generated/android/c++/JBleIOSErrorCode.hpp +92 -0
- package/nitrogen/generated/android/c++/JBleManagerNitroOptions.hpp +54 -0
- package/nitrogen/generated/android/c++/JBleRestoredState.hpp +76 -0
- package/nitrogen/generated/android/c++/JCharacteristicSubscriptionType.hpp +59 -0
- package/nitrogen/generated/android/c++/JConnectionOptions.hpp +61 -0
- package/nitrogen/generated/android/c++/JConnectionPriority.hpp +62 -0
- package/nitrogen/generated/android/c++/JFunc_void.hpp +74 -0
- package/nitrogen/generated/android/c++/JFunc_void_State.hpp +76 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__optional_NativeBleError__std__optional_NativeCharacteristic_.hpp +88 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__optional_NativeBleError__std__optional_NativeDevice_.hpp +91 -0
- package/nitrogen/generated/android/c++/JHybridBleManagerSpec.cpp +653 -0
- package/nitrogen/generated/android/c++/JHybridBleManagerSpec.hpp +92 -0
- package/nitrogen/generated/android/c++/JHybridCharacteristicSpec.cpp +253 -0
- package/nitrogen/generated/android/c++/JHybridCharacteristicSpec.hpp +79 -0
- package/nitrogen/generated/android/c++/JHybridDescriptorSpec.cpp +115 -0
- package/nitrogen/generated/android/c++/JHybridDescriptorSpec.hpp +70 -0
- package/nitrogen/generated/android/c++/JHybridDeviceSpec.cpp +476 -0
- package/nitrogen/generated/android/c++/JHybridDeviceSpec.hpp +90 -0
- package/nitrogen/generated/android/c++/JHybridServiceSpec.cpp +232 -0
- package/nitrogen/generated/android/c++/JHybridServiceSpec.hpp +72 -0
- package/nitrogen/generated/android/c++/JLogLevel.hpp +71 -0
- package/nitrogen/generated/android/c++/JNativeBleError.hpp +98 -0
- package/nitrogen/generated/android/c++/JNativeCharacteristic.hpp +98 -0
- package/nitrogen/generated/android/c++/JNativeDescriptor.hpp +82 -0
- package/nitrogen/generated/android/c++/JNativeDevice.hpp +173 -0
- package/nitrogen/generated/android/c++/JNativeService.hpp +65 -0
- package/nitrogen/generated/android/c++/JScanCallbackType.hpp +62 -0
- package/nitrogen/generated/android/c++/JScanMode.hpp +65 -0
- package/nitrogen/generated/android/c++/JScanOptions.hpp +69 -0
- package/nitrogen/generated/android/c++/JServiceDataEntry.hpp +57 -0
- package/nitrogen/generated/android/c++/JState.hpp +71 -0
- package/nitrogen/generated/android/c++/JSubscription.hpp +64 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/BleATTErrorCode.kt +41 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/BleAndroidErrorCode.kt +39 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/BleErrorCode.kt +62 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/BleIOSErrorCode.kt +36 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/BleManagerNitroOptions.kt +26 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/BleNitroOnLoad.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/BleRestoredState.kt +26 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/CharacteristicSubscriptionType.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/ConnectionOptions.kt +28 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/ConnectionPriority.kt +26 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/Func_void.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/Func_void_State.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/Func_void_std__optional_NativeBleError__std__optional_NativeCharacteristic_.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/Func_void_std__optional_NativeBleError__std__optional_NativeDevice_.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/HybridBleManagerSpec.kt +192 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/HybridCharacteristicSpec.kt +127 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/HybridDescriptorSpec.kt +86 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/HybridDeviceSpec.kt +176 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/HybridServiceSpec.kt +99 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/LogLevel.kt +29 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/NativeBleError.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/NativeCharacteristic.kt +37 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/NativeDescriptor.kt +33 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/NativeDevice.kt +38 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/NativeService.kt +29 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/ScanCallbackType.kt +26 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/ScanMode.kt +27 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/ScanOptions.kt +29 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/ServiceDataEntry.kt +27 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/State.kt +29 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/Subscription.kt +30 -0
- package/nitrogen/generated/ios/BleNitro+autolinking.rb +60 -0
- package/nitrogen/generated/ios/BleNitro-Swift-Cxx-Bridge.cpp +236 -0
- package/nitrogen/generated/ios/BleNitro-Swift-Cxx-Bridge.hpp +1069 -0
- package/nitrogen/generated/ios/BleNitro-Swift-Cxx-Umbrella.hpp +131 -0
- package/nitrogen/generated/ios/c++/HybridBleManagerSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridBleManagerSpecSwift.hpp +377 -0
- package/nitrogen/generated/ios/c++/HybridCharacteristicSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridCharacteristicSpecSwift.hpp +192 -0
- package/nitrogen/generated/ios/c++/HybridDescriptorSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridDescriptorSpecSwift.hpp +112 -0
- package/nitrogen/generated/ios/c++/HybridDeviceSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridDeviceSpecSwift.hpp +294 -0
- package/nitrogen/generated/ios/c++/HybridServiceSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridServiceSpecSwift.hpp +170 -0
- package/nitrogen/generated/ios/swift/BleATTErrorCode.swift +104 -0
- package/nitrogen/generated/ios/swift/BleAndroidErrorCode.swift +96 -0
- package/nitrogen/generated/ios/swift/BleErrorCode.swift +188 -0
- package/nitrogen/generated/ios/swift/BleIOSErrorCode.swift +84 -0
- package/nitrogen/generated/ios/swift/BleManagerNitroOptions.swift +53 -0
- package/nitrogen/generated/ios/swift/BleRestoredState.swift +47 -0
- package/nitrogen/generated/ios/swift/CharacteristicSubscriptionType.swift +40 -0
- package/nitrogen/generated/ios/swift/ConnectionOptions.swift +57 -0
- package/nitrogen/generated/ios/swift/ConnectionPriority.swift +44 -0
- package/nitrogen/generated/ios/swift/Func_void.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_LogLevel.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_NativeCharacteristic.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_NativeDescriptor.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_NativeDevice.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_State.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_bool.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__optional_BleRestoredState_.swift +52 -0
- package/nitrogen/generated/ios/swift/Func_void_std__optional_NativeBleError__std__optional_NativeCharacteristic_.swift +58 -0
- package/nitrogen/generated/ios/swift/Func_void_std__optional_NativeBleError__std__optional_NativeDevice_.swift +58 -0
- package/nitrogen/generated/ios/swift/Func_void_std__shared_ptr_margelo__nitro__co__zyke__ble__HybridCharacteristicSpec_.swift +50 -0
- package/nitrogen/generated/ios/swift/Func_void_std__shared_ptr_margelo__nitro__co__zyke__ble__HybridDescriptorSpec_.swift +50 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_NativeCharacteristic_.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_NativeDescriptor_.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_NativeDevice_.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_NativeService_.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridBleManagerSpec.swift +78 -0
- package/nitrogen/generated/ios/swift/HybridBleManagerSpec_cxx.swift +852 -0
- package/nitrogen/generated/ios/swift/HybridCharacteristicSpec.swift +65 -0
- package/nitrogen/generated/ios/swift/HybridCharacteristicSpec_cxx.swift +384 -0
- package/nitrogen/generated/ios/swift/HybridDescriptorSpec.swift +56 -0
- package/nitrogen/generated/ios/swift/HybridDescriptorSpec_cxx.swift +218 -0
- package/nitrogen/generated/ios/swift/HybridDeviceSpec.swift +76 -0
- package/nitrogen/generated/ios/swift/HybridDeviceSpec_cxx.swift +702 -0
- package/nitrogen/generated/ios/swift/HybridServiceSpec.swift +58 -0
- package/nitrogen/generated/ios/swift/HybridServiceSpec_cxx.swift +338 -0
- package/nitrogen/generated/ios/swift/LogLevel.swift +56 -0
- package/nitrogen/generated/ios/swift/NativeBleError.swift +278 -0
- package/nitrogen/generated/ios/swift/NativeCharacteristic.swift +174 -0
- package/nitrogen/generated/ios/swift/NativeDescriptor.swift +130 -0
- package/nitrogen/generated/ios/swift/NativeDevice.swift +377 -0
- package/nitrogen/generated/ios/swift/NativeService.swift +68 -0
- package/nitrogen/generated/ios/swift/ScanCallbackType.swift +44 -0
- package/nitrogen/generated/ios/swift/ScanMode.swift +48 -0
- package/nitrogen/generated/ios/swift/ScanOptions.swift +116 -0
- package/nitrogen/generated/ios/swift/ServiceDataEntry.swift +46 -0
- package/nitrogen/generated/ios/swift/State.swift +56 -0
- package/nitrogen/generated/ios/swift/Subscription.swift +46 -0
- package/nitrogen/generated/shared/c++/BleATTErrorCode.hpp +80 -0
- package/nitrogen/generated/shared/c++/BleAndroidErrorCode.hpp +78 -0
- package/nitrogen/generated/shared/c++/BleErrorCode.hpp +101 -0
- package/nitrogen/generated/shared/c++/BleIOSErrorCode.hpp +75 -0
- package/nitrogen/generated/shared/c++/BleManagerNitroOptions.hpp +70 -0
- package/nitrogen/generated/shared/c++/BleRestoredState.hpp +71 -0
- package/nitrogen/generated/shared/c++/CharacteristicSubscriptionType.hpp +64 -0
- package/nitrogen/generated/shared/c++/ConnectionOptions.hpp +77 -0
- package/nitrogen/generated/shared/c++/ConnectionPriority.hpp +65 -0
- package/nitrogen/generated/shared/c++/HybridBleManagerSpec.cpp +51 -0
- package/nitrogen/generated/shared/c++/HybridBleManagerSpec.hpp +137 -0
- package/nitrogen/generated/shared/c++/HybridCharacteristicSpec.cpp +39 -0
- package/nitrogen/generated/shared/c++/HybridCharacteristicSpec.hpp +101 -0
- package/nitrogen/generated/shared/c++/HybridDescriptorSpec.cpp +30 -0
- package/nitrogen/generated/shared/c++/HybridDescriptorSpec.hpp +75 -0
- package/nitrogen/generated/shared/c++/HybridDeviceSpec.cpp +50 -0
- package/nitrogen/generated/shared/c++/HybridDeviceSpec.hpp +123 -0
- package/nitrogen/generated/shared/c++/HybridServiceSpec.cpp +32 -0
- package/nitrogen/generated/shared/c++/HybridServiceSpec.hpp +90 -0
- package/nitrogen/generated/shared/c++/LogLevel.hpp +68 -0
- package/nitrogen/generated/shared/c++/NativeBleError.hpp +117 -0
- package/nitrogen/generated/shared/c++/NativeCharacteristic.hpp +114 -0
- package/nitrogen/generated/shared/c++/NativeDescriptor.hpp +98 -0
- package/nitrogen/generated/shared/c++/NativeDevice.hpp +121 -0
- package/nitrogen/generated/shared/c++/NativeService.hpp +81 -0
- package/nitrogen/generated/shared/c++/ScanCallbackType.hpp +65 -0
- package/nitrogen/generated/shared/c++/ScanMode.hpp +66 -0
- package/nitrogen/generated/shared/c++/ScanOptions.hpp +86 -0
- package/nitrogen/generated/shared/c++/ServiceDataEntry.hpp +73 -0
- package/nitrogen/generated/shared/c++/State.hpp +68 -0
- package/nitrogen/generated/shared/c++/Subscription.hpp +69 -0
- package/package.json +6 -5
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JBleIOSErrorCode.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 "BleIOSErrorCode.hpp"
|
|
12
|
+
|
|
13
|
+
namespace margelo::nitro::co::zyke::ble {
|
|
14
|
+
|
|
15
|
+
using namespace facebook;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The C++ JNI bridge between the C++ enum "BleIOSErrorCode" and the the Kotlin enum "BleIOSErrorCode".
|
|
19
|
+
*/
|
|
20
|
+
struct JBleIOSErrorCode final: public jni::JavaClass<JBleIOSErrorCode> {
|
|
21
|
+
public:
|
|
22
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/co/zyke/ble/BleIOSErrorCode;";
|
|
23
|
+
|
|
24
|
+
public:
|
|
25
|
+
/**
|
|
26
|
+
* Convert this Java/Kotlin-based enum to the C++ enum BleIOSErrorCode.
|
|
27
|
+
*/
|
|
28
|
+
[[maybe_unused]]
|
|
29
|
+
[[nodiscard]]
|
|
30
|
+
BleIOSErrorCode toCpp() const {
|
|
31
|
+
static const auto clazz = javaClassStatic();
|
|
32
|
+
static const auto fieldOrdinal = clazz->getField<int>("_ordinal");
|
|
33
|
+
int ordinal = this->getFieldValue(fieldOrdinal);
|
|
34
|
+
return static_cast<BleIOSErrorCode>(ordinal);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public:
|
|
38
|
+
/**
|
|
39
|
+
* Create a Java/Kotlin-based enum with the given C++ enum's value.
|
|
40
|
+
*/
|
|
41
|
+
[[maybe_unused]]
|
|
42
|
+
static jni::alias_ref<JBleIOSErrorCode> fromCpp(BleIOSErrorCode value) {
|
|
43
|
+
static const auto clazz = javaClassStatic();
|
|
44
|
+
static const auto fieldUNKNOWN = clazz->getStaticField<JBleIOSErrorCode>("UNKNOWN");
|
|
45
|
+
static const auto fieldINVALIDPARAMETERS = clazz->getStaticField<JBleIOSErrorCode>("INVALIDPARAMETERS");
|
|
46
|
+
static const auto fieldINVALIDHANDLE = clazz->getStaticField<JBleIOSErrorCode>("INVALIDHANDLE");
|
|
47
|
+
static const auto fieldNOTCONNECTED = clazz->getStaticField<JBleIOSErrorCode>("NOTCONNECTED");
|
|
48
|
+
static const auto fieldOUTOFSPACE = clazz->getStaticField<JBleIOSErrorCode>("OUTOFSPACE");
|
|
49
|
+
static const auto fieldOPERATIONCANCELLED = clazz->getStaticField<JBleIOSErrorCode>("OPERATIONCANCELLED");
|
|
50
|
+
static const auto fieldCONNECTIONTIMEOUT = clazz->getStaticField<JBleIOSErrorCode>("CONNECTIONTIMEOUT");
|
|
51
|
+
static const auto fieldPERIPHERALDISCONNECTED = clazz->getStaticField<JBleIOSErrorCode>("PERIPHERALDISCONNECTED");
|
|
52
|
+
static const auto fieldUUIDNOTALLOWED = clazz->getStaticField<JBleIOSErrorCode>("UUIDNOTALLOWED");
|
|
53
|
+
static const auto fieldALREADYADVERTISING = clazz->getStaticField<JBleIOSErrorCode>("ALREADYADVERTISING");
|
|
54
|
+
static const auto fieldCONNECTIONFAILED = clazz->getStaticField<JBleIOSErrorCode>("CONNECTIONFAILED");
|
|
55
|
+
static const auto fieldCONNECTIONLIMITREACHED = clazz->getStaticField<JBleIOSErrorCode>("CONNECTIONLIMITREACHED");
|
|
56
|
+
static const auto fieldUNKNOWNDEVICE = clazz->getStaticField<JBleIOSErrorCode>("UNKNOWNDEVICE");
|
|
57
|
+
|
|
58
|
+
switch (value) {
|
|
59
|
+
case BleIOSErrorCode::UNKNOWN:
|
|
60
|
+
return clazz->getStaticFieldValue(fieldUNKNOWN);
|
|
61
|
+
case BleIOSErrorCode::INVALIDPARAMETERS:
|
|
62
|
+
return clazz->getStaticFieldValue(fieldINVALIDPARAMETERS);
|
|
63
|
+
case BleIOSErrorCode::INVALIDHANDLE:
|
|
64
|
+
return clazz->getStaticFieldValue(fieldINVALIDHANDLE);
|
|
65
|
+
case BleIOSErrorCode::NOTCONNECTED:
|
|
66
|
+
return clazz->getStaticFieldValue(fieldNOTCONNECTED);
|
|
67
|
+
case BleIOSErrorCode::OUTOFSPACE:
|
|
68
|
+
return clazz->getStaticFieldValue(fieldOUTOFSPACE);
|
|
69
|
+
case BleIOSErrorCode::OPERATIONCANCELLED:
|
|
70
|
+
return clazz->getStaticFieldValue(fieldOPERATIONCANCELLED);
|
|
71
|
+
case BleIOSErrorCode::CONNECTIONTIMEOUT:
|
|
72
|
+
return clazz->getStaticFieldValue(fieldCONNECTIONTIMEOUT);
|
|
73
|
+
case BleIOSErrorCode::PERIPHERALDISCONNECTED:
|
|
74
|
+
return clazz->getStaticFieldValue(fieldPERIPHERALDISCONNECTED);
|
|
75
|
+
case BleIOSErrorCode::UUIDNOTALLOWED:
|
|
76
|
+
return clazz->getStaticFieldValue(fieldUUIDNOTALLOWED);
|
|
77
|
+
case BleIOSErrorCode::ALREADYADVERTISING:
|
|
78
|
+
return clazz->getStaticFieldValue(fieldALREADYADVERTISING);
|
|
79
|
+
case BleIOSErrorCode::CONNECTIONFAILED:
|
|
80
|
+
return clazz->getStaticFieldValue(fieldCONNECTIONFAILED);
|
|
81
|
+
case BleIOSErrorCode::CONNECTIONLIMITREACHED:
|
|
82
|
+
return clazz->getStaticFieldValue(fieldCONNECTIONLIMITREACHED);
|
|
83
|
+
case BleIOSErrorCode::UNKNOWNDEVICE:
|
|
84
|
+
return clazz->getStaticFieldValue(fieldUNKNOWNDEVICE);
|
|
85
|
+
default:
|
|
86
|
+
std::string stringValue = std::to_string(static_cast<int>(value));
|
|
87
|
+
throw std::invalid_argument("Invalid enum value (" + stringValue + "!");
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
} // namespace margelo::nitro::co::zyke::ble
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JBleManagerNitroOptions.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 "BleManagerNitroOptions.hpp"
|
|
12
|
+
|
|
13
|
+
#include <optional>
|
|
14
|
+
#include <string>
|
|
15
|
+
|
|
16
|
+
namespace margelo::nitro::co::zyke::ble {
|
|
17
|
+
|
|
18
|
+
using namespace facebook;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The C++ JNI bridge between the C++ struct "BleManagerNitroOptions" and the the Kotlin data class "BleManagerNitroOptions".
|
|
22
|
+
*/
|
|
23
|
+
struct JBleManagerNitroOptions final: public jni::JavaClass<JBleManagerNitroOptions> {
|
|
24
|
+
public:
|
|
25
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/co/zyke/ble/BleManagerNitroOptions;";
|
|
26
|
+
|
|
27
|
+
public:
|
|
28
|
+
/**
|
|
29
|
+
* Convert this Java/Kotlin-based struct to the C++ struct BleManagerNitroOptions by copying all values to C++.
|
|
30
|
+
*/
|
|
31
|
+
[[maybe_unused]]
|
|
32
|
+
[[nodiscard]]
|
|
33
|
+
BleManagerNitroOptions toCpp() const {
|
|
34
|
+
static const auto clazz = javaClassStatic();
|
|
35
|
+
static const auto fieldRestoreStateIdentifier = clazz->getField<jni::JString>("restoreStateIdentifier");
|
|
36
|
+
jni::local_ref<jni::JString> restoreStateIdentifier = this->getFieldValue(fieldRestoreStateIdentifier);
|
|
37
|
+
return BleManagerNitroOptions(
|
|
38
|
+
restoreStateIdentifier != nullptr ? std::make_optional(restoreStateIdentifier->toStdString()) : std::nullopt
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
public:
|
|
43
|
+
/**
|
|
44
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
45
|
+
*/
|
|
46
|
+
[[maybe_unused]]
|
|
47
|
+
static jni::local_ref<JBleManagerNitroOptions::javaobject> fromCpp(const BleManagerNitroOptions& value) {
|
|
48
|
+
return newInstance(
|
|
49
|
+
value.restoreStateIdentifier.has_value() ? jni::make_jstring(value.restoreStateIdentifier.value()) : nullptr
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
} // namespace margelo::nitro::co::zyke::ble
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JBleRestoredState.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 "BleRestoredState.hpp"
|
|
12
|
+
|
|
13
|
+
#include "JNativeDevice.hpp"
|
|
14
|
+
#include "JServiceDataEntry.hpp"
|
|
15
|
+
#include "NativeDevice.hpp"
|
|
16
|
+
#include "ServiceDataEntry.hpp"
|
|
17
|
+
#include <optional>
|
|
18
|
+
#include <string>
|
|
19
|
+
#include <vector>
|
|
20
|
+
|
|
21
|
+
namespace margelo::nitro::co::zyke::ble {
|
|
22
|
+
|
|
23
|
+
using namespace facebook;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The C++ JNI bridge between the C++ struct "BleRestoredState" and the the Kotlin data class "BleRestoredState".
|
|
27
|
+
*/
|
|
28
|
+
struct JBleRestoredState final: public jni::JavaClass<JBleRestoredState> {
|
|
29
|
+
public:
|
|
30
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/co/zyke/ble/BleRestoredState;";
|
|
31
|
+
|
|
32
|
+
public:
|
|
33
|
+
/**
|
|
34
|
+
* Convert this Java/Kotlin-based struct to the C++ struct BleRestoredState by copying all values to C++.
|
|
35
|
+
*/
|
|
36
|
+
[[maybe_unused]]
|
|
37
|
+
[[nodiscard]]
|
|
38
|
+
BleRestoredState toCpp() const {
|
|
39
|
+
static const auto clazz = javaClassStatic();
|
|
40
|
+
static const auto fieldConnectedPeripherals = clazz->getField<jni::JArrayClass<JNativeDevice>>("connectedPeripherals");
|
|
41
|
+
jni::local_ref<jni::JArrayClass<JNativeDevice>> connectedPeripherals = this->getFieldValue(fieldConnectedPeripherals);
|
|
42
|
+
return BleRestoredState(
|
|
43
|
+
[&]() {
|
|
44
|
+
size_t __size = connectedPeripherals->size();
|
|
45
|
+
std::vector<NativeDevice> __vector;
|
|
46
|
+
__vector.reserve(__size);
|
|
47
|
+
for (size_t __i = 0; __i < __size; __i++) {
|
|
48
|
+
auto __element = connectedPeripherals->getElement(__i);
|
|
49
|
+
__vector.push_back(__element->toCpp());
|
|
50
|
+
}
|
|
51
|
+
return __vector;
|
|
52
|
+
}()
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
public:
|
|
57
|
+
/**
|
|
58
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
59
|
+
*/
|
|
60
|
+
[[maybe_unused]]
|
|
61
|
+
static jni::local_ref<JBleRestoredState::javaobject> fromCpp(const BleRestoredState& value) {
|
|
62
|
+
return newInstance(
|
|
63
|
+
[&]() {
|
|
64
|
+
size_t __size = value.connectedPeripherals.size();
|
|
65
|
+
jni::local_ref<jni::JArrayClass<JNativeDevice>> __array = jni::JArrayClass<JNativeDevice>::newArray(__size);
|
|
66
|
+
for (size_t __i = 0; __i < __size; __i++) {
|
|
67
|
+
const auto& __element = value.connectedPeripherals[__i];
|
|
68
|
+
__array->setElement(__i, *JNativeDevice::fromCpp(__element));
|
|
69
|
+
}
|
|
70
|
+
return __array;
|
|
71
|
+
}()
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
} // namespace margelo::nitro::co::zyke::ble
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JCharacteristicSubscriptionType.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 "CharacteristicSubscriptionType.hpp"
|
|
12
|
+
|
|
13
|
+
namespace margelo::nitro::co::zyke::ble {
|
|
14
|
+
|
|
15
|
+
using namespace facebook;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The C++ JNI bridge between the C++ enum "CharacteristicSubscriptionType" and the the Kotlin enum "CharacteristicSubscriptionType".
|
|
19
|
+
*/
|
|
20
|
+
struct JCharacteristicSubscriptionType final: public jni::JavaClass<JCharacteristicSubscriptionType> {
|
|
21
|
+
public:
|
|
22
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/co/zyke/ble/CharacteristicSubscriptionType;";
|
|
23
|
+
|
|
24
|
+
public:
|
|
25
|
+
/**
|
|
26
|
+
* Convert this Java/Kotlin-based enum to the C++ enum CharacteristicSubscriptionType.
|
|
27
|
+
*/
|
|
28
|
+
[[maybe_unused]]
|
|
29
|
+
[[nodiscard]]
|
|
30
|
+
CharacteristicSubscriptionType toCpp() const {
|
|
31
|
+
static const auto clazz = javaClassStatic();
|
|
32
|
+
static const auto fieldOrdinal = clazz->getField<int>("_ordinal");
|
|
33
|
+
int ordinal = this->getFieldValue(fieldOrdinal);
|
|
34
|
+
return static_cast<CharacteristicSubscriptionType>(ordinal);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public:
|
|
38
|
+
/**
|
|
39
|
+
* Create a Java/Kotlin-based enum with the given C++ enum's value.
|
|
40
|
+
*/
|
|
41
|
+
[[maybe_unused]]
|
|
42
|
+
static jni::alias_ref<JCharacteristicSubscriptionType> fromCpp(CharacteristicSubscriptionType value) {
|
|
43
|
+
static const auto clazz = javaClassStatic();
|
|
44
|
+
static const auto fieldNOTIFICATION = clazz->getStaticField<JCharacteristicSubscriptionType>("NOTIFICATION");
|
|
45
|
+
static const auto fieldINDICATION = clazz->getStaticField<JCharacteristicSubscriptionType>("INDICATION");
|
|
46
|
+
|
|
47
|
+
switch (value) {
|
|
48
|
+
case CharacteristicSubscriptionType::NOTIFICATION:
|
|
49
|
+
return clazz->getStaticFieldValue(fieldNOTIFICATION);
|
|
50
|
+
case CharacteristicSubscriptionType::INDICATION:
|
|
51
|
+
return clazz->getStaticFieldValue(fieldINDICATION);
|
|
52
|
+
default:
|
|
53
|
+
std::string stringValue = std::to_string(static_cast<int>(value));
|
|
54
|
+
throw std::invalid_argument("Invalid enum value (" + stringValue + "!");
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
} // namespace margelo::nitro::co::zyke::ble
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JConnectionOptions.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 "ConnectionOptions.hpp"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
namespace margelo::nitro::co::zyke::ble {
|
|
16
|
+
|
|
17
|
+
using namespace facebook;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The C++ JNI bridge between the C++ struct "ConnectionOptions" and the the Kotlin data class "ConnectionOptions".
|
|
21
|
+
*/
|
|
22
|
+
struct JConnectionOptions final: public jni::JavaClass<JConnectionOptions> {
|
|
23
|
+
public:
|
|
24
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/co/zyke/ble/ConnectionOptions;";
|
|
25
|
+
|
|
26
|
+
public:
|
|
27
|
+
/**
|
|
28
|
+
* Convert this Java/Kotlin-based struct to the C++ struct ConnectionOptions by copying all values to C++.
|
|
29
|
+
*/
|
|
30
|
+
[[maybe_unused]]
|
|
31
|
+
[[nodiscard]]
|
|
32
|
+
ConnectionOptions toCpp() const {
|
|
33
|
+
static const auto clazz = javaClassStatic();
|
|
34
|
+
static const auto fieldAutoConnect = clazz->getField<jboolean>("autoConnect");
|
|
35
|
+
jboolean autoConnect = this->getFieldValue(fieldAutoConnect);
|
|
36
|
+
static const auto fieldRequestMTU = clazz->getField<double>("requestMTU");
|
|
37
|
+
double requestMTU = this->getFieldValue(fieldRequestMTU);
|
|
38
|
+
static const auto fieldTimeout = clazz->getField<double>("timeout");
|
|
39
|
+
double timeout = this->getFieldValue(fieldTimeout);
|
|
40
|
+
return ConnectionOptions(
|
|
41
|
+
static_cast<bool>(autoConnect),
|
|
42
|
+
requestMTU,
|
|
43
|
+
timeout
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public:
|
|
48
|
+
/**
|
|
49
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
50
|
+
*/
|
|
51
|
+
[[maybe_unused]]
|
|
52
|
+
static jni::local_ref<JConnectionOptions::javaobject> fromCpp(const ConnectionOptions& value) {
|
|
53
|
+
return newInstance(
|
|
54
|
+
value.autoConnect,
|
|
55
|
+
value.requestMTU,
|
|
56
|
+
value.timeout
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
} // namespace margelo::nitro::co::zyke::ble
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JConnectionPriority.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 "ConnectionPriority.hpp"
|
|
12
|
+
|
|
13
|
+
namespace margelo::nitro::co::zyke::ble {
|
|
14
|
+
|
|
15
|
+
using namespace facebook;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The C++ JNI bridge between the C++ enum "ConnectionPriority" and the the Kotlin enum "ConnectionPriority".
|
|
19
|
+
*/
|
|
20
|
+
struct JConnectionPriority final: public jni::JavaClass<JConnectionPriority> {
|
|
21
|
+
public:
|
|
22
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/co/zyke/ble/ConnectionPriority;";
|
|
23
|
+
|
|
24
|
+
public:
|
|
25
|
+
/**
|
|
26
|
+
* Convert this Java/Kotlin-based enum to the C++ enum ConnectionPriority.
|
|
27
|
+
*/
|
|
28
|
+
[[maybe_unused]]
|
|
29
|
+
[[nodiscard]]
|
|
30
|
+
ConnectionPriority toCpp() const {
|
|
31
|
+
static const auto clazz = javaClassStatic();
|
|
32
|
+
static const auto fieldOrdinal = clazz->getField<int>("_ordinal");
|
|
33
|
+
int ordinal = this->getFieldValue(fieldOrdinal);
|
|
34
|
+
return static_cast<ConnectionPriority>(ordinal);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public:
|
|
38
|
+
/**
|
|
39
|
+
* Create a Java/Kotlin-based enum with the given C++ enum's value.
|
|
40
|
+
*/
|
|
41
|
+
[[maybe_unused]]
|
|
42
|
+
static jni::alias_ref<JConnectionPriority> fromCpp(ConnectionPriority value) {
|
|
43
|
+
static const auto clazz = javaClassStatic();
|
|
44
|
+
static const auto fieldBALANCED = clazz->getStaticField<JConnectionPriority>("BALANCED");
|
|
45
|
+
static const auto fieldHIGH = clazz->getStaticField<JConnectionPriority>("HIGH");
|
|
46
|
+
static const auto fieldLOWPOWER = clazz->getStaticField<JConnectionPriority>("LOWPOWER");
|
|
47
|
+
|
|
48
|
+
switch (value) {
|
|
49
|
+
case ConnectionPriority::BALANCED:
|
|
50
|
+
return clazz->getStaticFieldValue(fieldBALANCED);
|
|
51
|
+
case ConnectionPriority::HIGH:
|
|
52
|
+
return clazz->getStaticFieldValue(fieldHIGH);
|
|
53
|
+
case ConnectionPriority::LOWPOWER:
|
|
54
|
+
return clazz->getStaticFieldValue(fieldLOWPOWER);
|
|
55
|
+
default:
|
|
56
|
+
std::string stringValue = std::to_string(static_cast<int>(value));
|
|
57
|
+
throw std::invalid_argument("Invalid enum value (" + stringValue + "!");
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
} // namespace margelo::nitro::co::zyke::ble
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JFunc_void.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 <functional>
|
|
14
|
+
|
|
15
|
+
namespace margelo::nitro::co::zyke::ble {
|
|
16
|
+
|
|
17
|
+
using namespace facebook;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Represents the Java/Kotlin callback `() -> Unit`.
|
|
21
|
+
* This can be passed around between C++ and Java/Kotlin.
|
|
22
|
+
*/
|
|
23
|
+
struct JFunc_void: public jni::JavaClass<JFunc_void> {
|
|
24
|
+
public:
|
|
25
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/co/zyke/ble/Func_void;";
|
|
26
|
+
|
|
27
|
+
public:
|
|
28
|
+
/**
|
|
29
|
+
* Invokes the function this `JFunc_void` instance holds through JNI.
|
|
30
|
+
*/
|
|
31
|
+
void invoke() const {
|
|
32
|
+
static const auto method = javaClassStatic()->getMethod<void()>("invoke");
|
|
33
|
+
method(self());
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* An implementation of Func_void that is backed by a C++ implementation (using `std::function<...>`)
|
|
39
|
+
*/
|
|
40
|
+
struct JFunc_void_cxx final: public jni::HybridClass<JFunc_void_cxx, JFunc_void> {
|
|
41
|
+
public:
|
|
42
|
+
static jni::local_ref<JFunc_void::javaobject> fromCpp(const std::function<void()>& func) {
|
|
43
|
+
return JFunc_void_cxx::newObjectCxxArgs(func);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
public:
|
|
47
|
+
/**
|
|
48
|
+
* Invokes the C++ `std::function<...>` this `JFunc_void_cxx` instance holds.
|
|
49
|
+
*/
|
|
50
|
+
void invoke_cxx() {
|
|
51
|
+
_func();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
public:
|
|
55
|
+
[[nodiscard]]
|
|
56
|
+
inline const std::function<void()>& getFunction() const {
|
|
57
|
+
return _func;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
public:
|
|
61
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/co/zyke/ble/Func_void_cxx;";
|
|
62
|
+
static void registerNatives() {
|
|
63
|
+
registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_cxx::invoke_cxx)});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
private:
|
|
67
|
+
explicit JFunc_void_cxx(const std::function<void()>& func): _func(func) { }
|
|
68
|
+
|
|
69
|
+
private:
|
|
70
|
+
friend HybridBase;
|
|
71
|
+
std::function<void()> _func;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
} // namespace margelo::nitro::co::zyke::ble
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JFunc_void_State.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 <functional>
|
|
14
|
+
#include "State.hpp"
|
|
15
|
+
#include "JState.hpp"
|
|
16
|
+
|
|
17
|
+
namespace margelo::nitro::co::zyke::ble {
|
|
18
|
+
|
|
19
|
+
using namespace facebook;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Represents the Java/Kotlin callback `(newState: State) -> Unit`.
|
|
23
|
+
* This can be passed around between C++ and Java/Kotlin.
|
|
24
|
+
*/
|
|
25
|
+
struct JFunc_void_State: public jni::JavaClass<JFunc_void_State> {
|
|
26
|
+
public:
|
|
27
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/co/zyke/ble/Func_void_State;";
|
|
28
|
+
|
|
29
|
+
public:
|
|
30
|
+
/**
|
|
31
|
+
* Invokes the function this `JFunc_void_State` instance holds through JNI.
|
|
32
|
+
*/
|
|
33
|
+
void invoke(State newState) const {
|
|
34
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JState> /* newState */)>("invoke");
|
|
35
|
+
method(self(), JState::fromCpp(newState));
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* An implementation of Func_void_State that is backed by a C++ implementation (using `std::function<...>`)
|
|
41
|
+
*/
|
|
42
|
+
struct JFunc_void_State_cxx final: public jni::HybridClass<JFunc_void_State_cxx, JFunc_void_State> {
|
|
43
|
+
public:
|
|
44
|
+
static jni::local_ref<JFunc_void_State::javaobject> fromCpp(const std::function<void(State /* newState */)>& func) {
|
|
45
|
+
return JFunc_void_State_cxx::newObjectCxxArgs(func);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public:
|
|
49
|
+
/**
|
|
50
|
+
* Invokes the C++ `std::function<...>` this `JFunc_void_State_cxx` instance holds.
|
|
51
|
+
*/
|
|
52
|
+
void invoke_cxx(jni::alias_ref<JState> newState) {
|
|
53
|
+
_func(newState->toCpp());
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
public:
|
|
57
|
+
[[nodiscard]]
|
|
58
|
+
inline const std::function<void(State /* newState */)>& getFunction() const {
|
|
59
|
+
return _func;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
public:
|
|
63
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/co/zyke/ble/Func_void_State_cxx;";
|
|
64
|
+
static void registerNatives() {
|
|
65
|
+
registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_State_cxx::invoke_cxx)});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
private:
|
|
69
|
+
explicit JFunc_void_State_cxx(const std::function<void(State /* newState */)>& func): _func(func) { }
|
|
70
|
+
|
|
71
|
+
private:
|
|
72
|
+
friend HybridBase;
|
|
73
|
+
std::function<void(State /* newState */)> _func;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
} // namespace margelo::nitro::co::zyke::ble
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JFunc_void_std__optional_NativeBleError__std__optional_NativeCharacteristic_.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 <functional>
|
|
14
|
+
#include <optional>
|
|
15
|
+
#include "NativeBleError.hpp"
|
|
16
|
+
#include "NativeCharacteristic.hpp"
|
|
17
|
+
#include "JNativeBleError.hpp"
|
|
18
|
+
#include "BleErrorCode.hpp"
|
|
19
|
+
#include "JBleErrorCode.hpp"
|
|
20
|
+
#include "BleATTErrorCode.hpp"
|
|
21
|
+
#include "JBleATTErrorCode.hpp"
|
|
22
|
+
#include "BleIOSErrorCode.hpp"
|
|
23
|
+
#include "JBleIOSErrorCode.hpp"
|
|
24
|
+
#include "BleAndroidErrorCode.hpp"
|
|
25
|
+
#include "JBleAndroidErrorCode.hpp"
|
|
26
|
+
#include <string>
|
|
27
|
+
#include "JNativeCharacteristic.hpp"
|
|
28
|
+
|
|
29
|
+
namespace margelo::nitro::co::zyke::ble {
|
|
30
|
+
|
|
31
|
+
using namespace facebook;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Represents the Java/Kotlin callback `(error: NativeBleError?, characteristic: NativeCharacteristic?) -> Unit`.
|
|
35
|
+
* This can be passed around between C++ and Java/Kotlin.
|
|
36
|
+
*/
|
|
37
|
+
struct JFunc_void_std__optional_NativeBleError__std__optional_NativeCharacteristic_: public jni::JavaClass<JFunc_void_std__optional_NativeBleError__std__optional_NativeCharacteristic_> {
|
|
38
|
+
public:
|
|
39
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/co/zyke/ble/Func_void_std__optional_NativeBleError__std__optional_NativeCharacteristic_;";
|
|
40
|
+
|
|
41
|
+
public:
|
|
42
|
+
/**
|
|
43
|
+
* Invokes the function this `JFunc_void_std__optional_NativeBleError__std__optional_NativeCharacteristic_` instance holds through JNI.
|
|
44
|
+
*/
|
|
45
|
+
void invoke(const std::optional<NativeBleError>& error, const std::optional<NativeCharacteristic>& characteristic) const {
|
|
46
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JNativeBleError> /* error */, jni::alias_ref<JNativeCharacteristic> /* characteristic */)>("invoke");
|
|
47
|
+
method(self(), error.has_value() ? JNativeBleError::fromCpp(error.value()) : nullptr, characteristic.has_value() ? JNativeCharacteristic::fromCpp(characteristic.value()) : nullptr);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* An implementation of Func_void_std__optional_NativeBleError__std__optional_NativeCharacteristic_ that is backed by a C++ implementation (using `std::function<...>`)
|
|
53
|
+
*/
|
|
54
|
+
struct JFunc_void_std__optional_NativeBleError__std__optional_NativeCharacteristic__cxx final: public jni::HybridClass<JFunc_void_std__optional_NativeBleError__std__optional_NativeCharacteristic__cxx, JFunc_void_std__optional_NativeBleError__std__optional_NativeCharacteristic_> {
|
|
55
|
+
public:
|
|
56
|
+
static jni::local_ref<JFunc_void_std__optional_NativeBleError__std__optional_NativeCharacteristic_::javaobject> fromCpp(const std::function<void(const std::optional<NativeBleError>& /* error */, const std::optional<NativeCharacteristic>& /* characteristic */)>& func) {
|
|
57
|
+
return JFunc_void_std__optional_NativeBleError__std__optional_NativeCharacteristic__cxx::newObjectCxxArgs(func);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
public:
|
|
61
|
+
/**
|
|
62
|
+
* Invokes the C++ `std::function<...>` this `JFunc_void_std__optional_NativeBleError__std__optional_NativeCharacteristic__cxx` instance holds.
|
|
63
|
+
*/
|
|
64
|
+
void invoke_cxx(jni::alias_ref<JNativeBleError> error, jni::alias_ref<JNativeCharacteristic> characteristic) {
|
|
65
|
+
_func(error != nullptr ? std::make_optional(error->toCpp()) : std::nullopt, characteristic != nullptr ? std::make_optional(characteristic->toCpp()) : std::nullopt);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
public:
|
|
69
|
+
[[nodiscard]]
|
|
70
|
+
inline const std::function<void(const std::optional<NativeBleError>& /* error */, const std::optional<NativeCharacteristic>& /* characteristic */)>& getFunction() const {
|
|
71
|
+
return _func;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
public:
|
|
75
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/co/zyke/ble/Func_void_std__optional_NativeBleError__std__optional_NativeCharacteristic__cxx;";
|
|
76
|
+
static void registerNatives() {
|
|
77
|
+
registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_std__optional_NativeBleError__std__optional_NativeCharacteristic__cxx::invoke_cxx)});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
private:
|
|
81
|
+
explicit JFunc_void_std__optional_NativeBleError__std__optional_NativeCharacteristic__cxx(const std::function<void(const std::optional<NativeBleError>& /* error */, const std::optional<NativeCharacteristic>& /* characteristic */)>& func): _func(func) { }
|
|
82
|
+
|
|
83
|
+
private:
|
|
84
|
+
friend HybridBase;
|
|
85
|
+
std::function<void(const std::optional<NativeBleError>& /* error */, const std::optional<NativeCharacteristic>& /* characteristic */)> _func;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
} // namespace margelo::nitro::co::zyke::ble
|