react-native-ble-nitro 1.6.0 → 1.7.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 +27 -11
- package/android/src/main/java/com/margelo/nitro/co/zyke/ble/BleNitroBleManager.kt +8 -3
- package/android/src/main/java/com/margelo/nitro/co/zyke/ble/BleNitroBleManagerFactory.kt +21 -0
- package/ios/BleNitroBleManager.swift +36 -23
- package/ios/BleNitroBleManagerFactory.swift +19 -0
- package/lib/commonjs/index.d.ts +2 -5
- package/lib/commonjs/index.d.ts.map +1 -1
- package/lib/commonjs/index.js +7 -15
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/manager.d.ts +9 -0
- package/lib/commonjs/manager.d.ts.map +1 -1
- package/lib/commonjs/manager.js +44 -30
- package/lib/commonjs/manager.js.map +1 -1
- package/lib/commonjs/singleton.d.ts +10 -0
- package/lib/commonjs/singleton.d.ts.map +1 -0
- package/lib/commonjs/singleton.js +20 -0
- package/lib/commonjs/singleton.js.map +1 -0
- package/lib/commonjs/specs/NativeBleNitro.d.ts +1 -1
- package/lib/commonjs/specs/NativeBleNitro.d.ts.map +1 -1
- package/lib/commonjs/specs/NativeBleNitro.js +1 -0
- package/lib/commonjs/specs/NativeBleNitro.js.map +1 -1
- package/lib/commonjs/specs/NativeBleNitro.nitro.d.ts +2 -0
- package/lib/commonjs/specs/NativeBleNitro.nitro.d.ts.map +1 -1
- package/lib/commonjs/specs/NativeBleNitro.nitro.js.map +1 -1
- package/lib/commonjs/specs/NativeBleNitroFactory.d.ts +5 -0
- package/lib/commonjs/specs/NativeBleNitroFactory.d.ts.map +1 -0
- package/lib/commonjs/specs/NativeBleNitroFactory.js +23 -0
- package/lib/commonjs/specs/NativeBleNitroFactory.js.map +1 -0
- package/lib/commonjs/specs/NativeBleNitroFactory.nitro.d.ts +9 -0
- package/lib/commonjs/specs/NativeBleNitroFactory.nitro.d.ts.map +1 -0
- package/lib/commonjs/specs/NativeBleNitroFactory.nitro.js +3 -0
- package/lib/commonjs/specs/NativeBleNitroFactory.nitro.js.map +1 -0
- package/lib/index.d.ts +2 -5
- package/lib/index.js +2 -11
- package/lib/manager.d.ts +9 -0
- package/lib/manager.js +38 -25
- package/lib/singleton.d.ts +9 -0
- package/lib/singleton.js +15 -0
- package/lib/specs/NativeBleNitro.d.ts +1 -1
- package/lib/specs/NativeBleNitro.js +1 -0
- package/lib/specs/NativeBleNitro.nitro.d.ts +2 -0
- package/lib/specs/NativeBleNitroFactory.d.ts +4 -0
- package/lib/specs/NativeBleNitroFactory.js +6 -0
- package/lib/specs/NativeBleNitroFactory.nitro.d.ts +8 -0
- package/lib/specs/NativeBleNitroFactory.nitro.js +1 -0
- package/nitro.json +4 -0
- package/nitrogen/generated/android/BleNitro+autolinking.cmake +2 -0
- package/nitrogen/generated/android/BleNitroOnLoad.cpp +11 -0
- package/nitrogen/generated/android/c++/JBLEDevice.hpp +6 -2
- package/nitrogen/generated/android/c++/JFunc_void_std__vector_BLEDevice_.hpp +12 -12
- package/nitrogen/generated/android/c++/JHybridNativeBleNitroFactorySpec.cpp +71 -0
- package/nitrogen/generated/android/c++/JHybridNativeBleNitroFactorySpec.hpp +64 -0
- package/nitrogen/generated/android/c++/JHybridNativeBleNitroSpec.cpp +11 -3
- package/nitrogen/generated/android/c++/JHybridNativeBleNitroSpec.hpp +2 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/BLEDevice.kt +4 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/Func_void_std__vector_BLEDevice_.kt +9 -9
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/HybridNativeBleNitroFactorySpec.kt +57 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/HybridNativeBleNitroSpec.kt +5 -1
- package/nitrogen/generated/ios/BleNitro-Swift-Cxx-Bridge.cpp +17 -0
- package/nitrogen/generated/ios/BleNitro-Swift-Cxx-Bridge.hpp +44 -9
- package/nitrogen/generated/ios/BleNitro-Swift-Cxx-Umbrella.hpp +5 -0
- package/nitrogen/generated/ios/BleNitroAutolinking.mm +8 -0
- package/nitrogen/generated/ios/BleNitroAutolinking.swift +15 -0
- package/nitrogen/generated/ios/c++/HybridNativeBleNitroFactorySpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridNativeBleNitroFactorySpecSwift.hpp +94 -0
- package/nitrogen/generated/ios/c++/HybridNativeBleNitroSpecSwift.hpp +9 -3
- package/nitrogen/generated/ios/swift/BLEDevice.swift +13 -2
- package/nitrogen/generated/ios/swift/Func_void_std__vector_BLEDevice_.swift +5 -5
- package/nitrogen/generated/ios/swift/HybridNativeBleNitroFactorySpec.swift +49 -0
- package/nitrogen/generated/ios/swift/HybridNativeBleNitroFactorySpec_cxx.swift +149 -0
- package/nitrogen/generated/ios/swift/HybridNativeBleNitroSpec.swift +1 -1
- package/nitrogen/generated/ios/swift/HybridNativeBleNitroSpec_cxx.swift +22 -1
- package/nitrogen/generated/shared/c++/BLEDevice.hpp +6 -2
- package/nitrogen/generated/shared/c++/HybridNativeBleNitroFactorySpec.cpp +21 -0
- package/nitrogen/generated/shared/c++/HybridNativeBleNitroFactorySpec.hpp +71 -0
- package/nitrogen/generated/shared/c++/HybridNativeBleNitroSpec.cpp +2 -0
- package/nitrogen/generated/shared/c++/HybridNativeBleNitroSpec.hpp +4 -3
- package/package.json +9 -1
- package/src/__tests__/index.test.ts +36 -26
- package/src/index.ts +2 -13
- package/src/manager.ts +41 -25
- package/src/singleton.ts +17 -0
- package/src/specs/NativeBleNitro.nitro.ts +2 -0
- package/src/specs/NativeBleNitro.ts +2 -1
- package/src/specs/NativeBleNitroFactory.nitro.ts +6 -0
- package/src/specs/NativeBleNitroFactory.ts +9 -0
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
#include "JFunc_void_bool_std__shared_ptr_ArrayBuffer__std__string.hpp"
|
|
26
26
|
#include "JFunc_void_std__string_std__shared_ptr_ArrayBuffer_.hpp"
|
|
27
27
|
#include "JFunc_void_BLEState.hpp"
|
|
28
|
+
#include "JHybridNativeBleNitroFactorySpec.hpp"
|
|
28
29
|
#include <NitroModules/DefaultConstructableObject.hpp>
|
|
29
30
|
|
|
30
31
|
namespace margelo::nitro::co::zyke::ble {
|
|
@@ -46,6 +47,7 @@ int initialize(JavaVM* vm) {
|
|
|
46
47
|
margelo::nitro::co::zyke::ble::JFunc_void_bool_std__shared_ptr_ArrayBuffer__std__string_cxx::registerNatives();
|
|
47
48
|
margelo::nitro::co::zyke::ble::JFunc_void_std__string_std__shared_ptr_ArrayBuffer__cxx::registerNatives();
|
|
48
49
|
margelo::nitro::co::zyke::ble::JFunc_void_BLEState_cxx::registerNatives();
|
|
50
|
+
margelo::nitro::co::zyke::ble::JHybridNativeBleNitroFactorySpec::registerNatives();
|
|
49
51
|
|
|
50
52
|
// Register Nitro Hybrid Objects
|
|
51
53
|
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
@@ -57,6 +59,15 @@ int initialize(JavaVM* vm) {
|
|
|
57
59
|
return globalRef->cthis()->shared();
|
|
58
60
|
}
|
|
59
61
|
);
|
|
62
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
63
|
+
"NativeBleNitroFactory",
|
|
64
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
65
|
+
static DefaultConstructableObject<JHybridNativeBleNitroFactorySpec::javaobject> object("com/margelo/nitro/co/zyke/ble/BleNitroBleManagerFactory");
|
|
66
|
+
auto instance = object.create();
|
|
67
|
+
auto globalRef = jni::make_global(instance);
|
|
68
|
+
return globalRef->cthis()->shared();
|
|
69
|
+
}
|
|
70
|
+
);
|
|
60
71
|
});
|
|
61
72
|
}
|
|
62
73
|
|
|
@@ -51,6 +51,8 @@ namespace margelo::nitro::co::zyke::ble {
|
|
|
51
51
|
jni::local_ref<jni::JArrayClass<jni::JString>> serviceUUIDs = this->getFieldValue(fieldServiceUUIDs);
|
|
52
52
|
static const auto fieldIsConnectable = clazz->getField<jboolean>("isConnectable");
|
|
53
53
|
jboolean isConnectable = this->getFieldValue(fieldIsConnectable);
|
|
54
|
+
static const auto fieldIsConnected = clazz->getField<jboolean>("isConnected");
|
|
55
|
+
jboolean isConnected = this->getFieldValue(fieldIsConnected);
|
|
54
56
|
return BLEDevice(
|
|
55
57
|
id->toStdString(),
|
|
56
58
|
name->toStdString(),
|
|
@@ -66,7 +68,8 @@ namespace margelo::nitro::co::zyke::ble {
|
|
|
66
68
|
}
|
|
67
69
|
return __vector;
|
|
68
70
|
}(),
|
|
69
|
-
static_cast<bool>(isConnectable)
|
|
71
|
+
static_cast<bool>(isConnectable),
|
|
72
|
+
static_cast<bool>(isConnected)
|
|
70
73
|
);
|
|
71
74
|
}
|
|
72
75
|
|
|
@@ -90,7 +93,8 @@ namespace margelo::nitro::co::zyke::ble {
|
|
|
90
93
|
}
|
|
91
94
|
return __array;
|
|
92
95
|
}(),
|
|
93
|
-
value.isConnectable
|
|
96
|
+
value.isConnectable,
|
|
97
|
+
value.isConnected
|
|
94
98
|
);
|
|
95
99
|
}
|
|
96
100
|
};
|
|
@@ -28,7 +28,7 @@ namespace margelo::nitro::co::zyke::ble {
|
|
|
28
28
|
using namespace facebook;
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
|
-
* Represents the Java/Kotlin callback `(
|
|
31
|
+
* Represents the Java/Kotlin callback `(peripherals: Array<BLEDevice>) -> Unit`.
|
|
32
32
|
* This can be passed around between C++ and Java/Kotlin.
|
|
33
33
|
*/
|
|
34
34
|
struct JFunc_void_std__vector_BLEDevice_: public jni::JavaClass<JFunc_void_std__vector_BLEDevice_> {
|
|
@@ -39,13 +39,13 @@ namespace margelo::nitro::co::zyke::ble {
|
|
|
39
39
|
/**
|
|
40
40
|
* Invokes the function this `JFunc_void_std__vector_BLEDevice_` instance holds through JNI.
|
|
41
41
|
*/
|
|
42
|
-
void invoke(const std::vector<BLEDevice>&
|
|
43
|
-
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JArrayClass<JBLEDevice>> /*
|
|
42
|
+
void invoke(const std::vector<BLEDevice>& peripherals) const {
|
|
43
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JArrayClass<JBLEDevice>> /* peripherals */)>("invoke");
|
|
44
44
|
method(self(), [&]() {
|
|
45
|
-
size_t __size =
|
|
45
|
+
size_t __size = peripherals.size();
|
|
46
46
|
jni::local_ref<jni::JArrayClass<JBLEDevice>> __array = jni::JArrayClass<JBLEDevice>::newArray(__size);
|
|
47
47
|
for (size_t __i = 0; __i < __size; __i++) {
|
|
48
|
-
const auto& __element =
|
|
48
|
+
const auto& __element = peripherals[__i];
|
|
49
49
|
__array->setElement(__i, *JBLEDevice::fromCpp(__element));
|
|
50
50
|
}
|
|
51
51
|
return __array;
|
|
@@ -58,7 +58,7 @@ namespace margelo::nitro::co::zyke::ble {
|
|
|
58
58
|
*/
|
|
59
59
|
struct JFunc_void_std__vector_BLEDevice__cxx final: public jni::HybridClass<JFunc_void_std__vector_BLEDevice__cxx, JFunc_void_std__vector_BLEDevice_> {
|
|
60
60
|
public:
|
|
61
|
-
static jni::local_ref<JFunc_void_std__vector_BLEDevice_::javaobject> fromCpp(const std::function<void(const std::vector<BLEDevice>& /*
|
|
61
|
+
static jni::local_ref<JFunc_void_std__vector_BLEDevice_::javaobject> fromCpp(const std::function<void(const std::vector<BLEDevice>& /* peripherals */)>& func) {
|
|
62
62
|
return JFunc_void_std__vector_BLEDevice__cxx::newObjectCxxArgs(func);
|
|
63
63
|
}
|
|
64
64
|
|
|
@@ -66,13 +66,13 @@ namespace margelo::nitro::co::zyke::ble {
|
|
|
66
66
|
/**
|
|
67
67
|
* Invokes the C++ `std::function<...>` this `JFunc_void_std__vector_BLEDevice__cxx` instance holds.
|
|
68
68
|
*/
|
|
69
|
-
void invoke_cxx(jni::alias_ref<jni::JArrayClass<JBLEDevice>>
|
|
69
|
+
void invoke_cxx(jni::alias_ref<jni::JArrayClass<JBLEDevice>> peripherals) {
|
|
70
70
|
_func([&]() {
|
|
71
|
-
size_t __size =
|
|
71
|
+
size_t __size = peripherals->size();
|
|
72
72
|
std::vector<BLEDevice> __vector;
|
|
73
73
|
__vector.reserve(__size);
|
|
74
74
|
for (size_t __i = 0; __i < __size; __i++) {
|
|
75
|
-
auto __element =
|
|
75
|
+
auto __element = peripherals->getElement(__i);
|
|
76
76
|
__vector.push_back(__element->toCpp());
|
|
77
77
|
}
|
|
78
78
|
return __vector;
|
|
@@ -81,7 +81,7 @@ namespace margelo::nitro::co::zyke::ble {
|
|
|
81
81
|
|
|
82
82
|
public:
|
|
83
83
|
[[nodiscard]]
|
|
84
|
-
inline const std::function<void(const std::vector<BLEDevice>& /*
|
|
84
|
+
inline const std::function<void(const std::vector<BLEDevice>& /* peripherals */)>& getFunction() const {
|
|
85
85
|
return _func;
|
|
86
86
|
}
|
|
87
87
|
|
|
@@ -92,11 +92,11 @@ namespace margelo::nitro::co::zyke::ble {
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
private:
|
|
95
|
-
explicit JFunc_void_std__vector_BLEDevice__cxx(const std::function<void(const std::vector<BLEDevice>& /*
|
|
95
|
+
explicit JFunc_void_std__vector_BLEDevice__cxx(const std::function<void(const std::vector<BLEDevice>& /* peripherals */)>& func): _func(func) { }
|
|
96
96
|
|
|
97
97
|
private:
|
|
98
98
|
friend HybridBase;
|
|
99
|
-
std::function<void(const std::vector<BLEDevice>& /*
|
|
99
|
+
std::function<void(const std::vector<BLEDevice>& /* peripherals */)> _func;
|
|
100
100
|
};
|
|
101
101
|
|
|
102
102
|
} // namespace margelo::nitro::co::zyke::ble
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JHybridNativeBleNitroFactorySpec.cpp
|
|
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
|
+
#include "JHybridNativeBleNitroFactorySpec.hpp"
|
|
9
|
+
|
|
10
|
+
// Forward declaration of `HybridNativeBleNitroSpec` to properly resolve imports.
|
|
11
|
+
namespace margelo::nitro::co::zyke::ble { class HybridNativeBleNitroSpec; }
|
|
12
|
+
// Forward declaration of `BLEDevice` to properly resolve imports.
|
|
13
|
+
namespace margelo::nitro::co::zyke::ble { struct BLEDevice; }
|
|
14
|
+
// Forward declaration of `ManufacturerData` to properly resolve imports.
|
|
15
|
+
namespace margelo::nitro::co::zyke::ble { struct ManufacturerData; }
|
|
16
|
+
// Forward declaration of `ManufacturerDataEntry` to properly resolve imports.
|
|
17
|
+
namespace margelo::nitro::co::zyke::ble { struct ManufacturerDataEntry; }
|
|
18
|
+
// Forward declaration of `ArrayBuffer` to properly resolve imports.
|
|
19
|
+
namespace NitroModules { class ArrayBuffer; }
|
|
20
|
+
|
|
21
|
+
#include <memory>
|
|
22
|
+
#include "HybridNativeBleNitroSpec.hpp"
|
|
23
|
+
#include "JHybridNativeBleNitroSpec.hpp"
|
|
24
|
+
#include <string>
|
|
25
|
+
#include <optional>
|
|
26
|
+
#include "BLEDevice.hpp"
|
|
27
|
+
#include <vector>
|
|
28
|
+
#include <functional>
|
|
29
|
+
#include "JFunc_void_std__vector_BLEDevice_.hpp"
|
|
30
|
+
#include "JBLEDevice.hpp"
|
|
31
|
+
#include "ManufacturerData.hpp"
|
|
32
|
+
#include "JManufacturerData.hpp"
|
|
33
|
+
#include "ManufacturerDataEntry.hpp"
|
|
34
|
+
#include "JManufacturerDataEntry.hpp"
|
|
35
|
+
#include <NitroModules/ArrayBuffer.hpp>
|
|
36
|
+
#include <NitroModules/JArrayBuffer.hpp>
|
|
37
|
+
#include <NitroModules/JUnit.hpp>
|
|
38
|
+
|
|
39
|
+
namespace margelo::nitro::co::zyke::ble {
|
|
40
|
+
|
|
41
|
+
jni::local_ref<JHybridNativeBleNitroFactorySpec::jhybriddata> JHybridNativeBleNitroFactorySpec::initHybrid(jni::alias_ref<jhybridobject> jThis) {
|
|
42
|
+
return makeCxxInstance(jThis);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
void JHybridNativeBleNitroFactorySpec::registerNatives() {
|
|
46
|
+
registerHybrid({
|
|
47
|
+
makeNativeMethod("initHybrid", JHybridNativeBleNitroFactorySpec::initHybrid),
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
size_t JHybridNativeBleNitroFactorySpec::getExternalMemorySize() noexcept {
|
|
52
|
+
static const auto method = javaClassStatic()->getMethod<jlong()>("getMemorySize");
|
|
53
|
+
return method(_javaPart);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
void JHybridNativeBleNitroFactorySpec::dispose() noexcept {
|
|
57
|
+
static const auto method = javaClassStatic()->getMethod<void()>("dispose");
|
|
58
|
+
method(_javaPart);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Properties
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
// Methods
|
|
65
|
+
std::shared_ptr<HybridNativeBleNitroSpec> JHybridNativeBleNitroFactorySpec::create(const std::optional<std::string>& nativeRestoreStateIdentifier, const std::optional<std::function<void(const std::vector<BLEDevice>& /* peripherals */)>>& restoreStateCallback) {
|
|
66
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JHybridNativeBleNitroSpec::javaobject>(jni::alias_ref<jni::JString> /* nativeRestoreStateIdentifier */, jni::alias_ref<JFunc_void_std__vector_BLEDevice_::javaobject> /* restoreStateCallback */)>("create_cxx");
|
|
67
|
+
auto __result = method(_javaPart, nativeRestoreStateIdentifier.has_value() ? jni::make_jstring(nativeRestoreStateIdentifier.value()) : nullptr, restoreStateCallback.has_value() ? JFunc_void_std__vector_BLEDevice__cxx::fromCpp(restoreStateCallback.value()) : nullptr);
|
|
68
|
+
return __result->cthis()->shared_cast<JHybridNativeBleNitroSpec>();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
} // namespace margelo::nitro::co::zyke::ble
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNativeBleNitroFactorySpec.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 <NitroModules/JHybridObject.hpp>
|
|
11
|
+
#include <fbjni/fbjni.h>
|
|
12
|
+
#include "HybridNativeBleNitroFactorySpec.hpp"
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
namespace margelo::nitro::co::zyke::ble {
|
|
18
|
+
|
|
19
|
+
using namespace facebook;
|
|
20
|
+
|
|
21
|
+
class JHybridNativeBleNitroFactorySpec: public jni::HybridClass<JHybridNativeBleNitroFactorySpec, JHybridObject>,
|
|
22
|
+
public virtual HybridNativeBleNitroFactorySpec {
|
|
23
|
+
public:
|
|
24
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/co/zyke/ble/HybridNativeBleNitroFactorySpec;";
|
|
25
|
+
static jni::local_ref<jhybriddata> initHybrid(jni::alias_ref<jhybridobject> jThis);
|
|
26
|
+
static void registerNatives();
|
|
27
|
+
|
|
28
|
+
protected:
|
|
29
|
+
// C++ constructor (called from Java via `initHybrid()`)
|
|
30
|
+
explicit JHybridNativeBleNitroFactorySpec(jni::alias_ref<jhybridobject> jThis) :
|
|
31
|
+
HybridObject(HybridNativeBleNitroFactorySpec::TAG),
|
|
32
|
+
HybridBase(jThis),
|
|
33
|
+
_javaPart(jni::make_global(jThis)) {}
|
|
34
|
+
|
|
35
|
+
public:
|
|
36
|
+
~JHybridNativeBleNitroFactorySpec() override {
|
|
37
|
+
// Hermes GC can destroy JS objects on a non-JNI Thread.
|
|
38
|
+
jni::ThreadScope::WithClassLoader([&] { _javaPart.reset(); });
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
public:
|
|
42
|
+
size_t getExternalMemorySize() noexcept override;
|
|
43
|
+
void dispose() noexcept override;
|
|
44
|
+
|
|
45
|
+
public:
|
|
46
|
+
inline const jni::global_ref<JHybridNativeBleNitroFactorySpec::javaobject>& getJavaPart() const noexcept {
|
|
47
|
+
return _javaPart;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public:
|
|
51
|
+
// Properties
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
public:
|
|
55
|
+
// Methods
|
|
56
|
+
std::shared_ptr<HybridNativeBleNitroSpec> create(const std::optional<std::string>& nativeRestoreStateIdentifier, const std::optional<std::function<void(const std::vector<BLEDevice>& /* peripherals */)>>& restoreStateCallback) override;
|
|
57
|
+
|
|
58
|
+
private:
|
|
59
|
+
friend HybridBase;
|
|
60
|
+
using HybridBase::HybridBase;
|
|
61
|
+
jni::global_ref<JHybridNativeBleNitroFactorySpec::javaobject> _javaPart;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
} // namespace margelo::nitro::co::zyke::ble
|
|
@@ -24,10 +24,11 @@ namespace margelo::nitro::co::zyke::ble { struct ScanFilter; }
|
|
|
24
24
|
// Forward declaration of `AndroidScanMode` to properly resolve imports.
|
|
25
25
|
namespace margelo::nitro::co::zyke::ble { enum class AndroidScanMode; }
|
|
26
26
|
|
|
27
|
+
#include <string>
|
|
28
|
+
#include <optional>
|
|
27
29
|
#include "BLEDevice.hpp"
|
|
28
30
|
#include <vector>
|
|
29
31
|
#include "JBLEDevice.hpp"
|
|
30
|
-
#include <string>
|
|
31
32
|
#include "ManufacturerData.hpp"
|
|
32
33
|
#include "JManufacturerData.hpp"
|
|
33
34
|
#include "ManufacturerDataEntry.hpp"
|
|
@@ -39,7 +40,6 @@ namespace margelo::nitro::co::zyke::ble { enum class AndroidScanMode; }
|
|
|
39
40
|
#include "JBLEState.hpp"
|
|
40
41
|
#include "OperationResult.hpp"
|
|
41
42
|
#include "JOperationResult.hpp"
|
|
42
|
-
#include <optional>
|
|
43
43
|
#include <NitroModules/Promise.hpp>
|
|
44
44
|
#include <NitroModules/JPromise.hpp>
|
|
45
45
|
#include <functional>
|
|
@@ -80,7 +80,15 @@ namespace margelo::nitro::co::zyke::ble {
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
// Properties
|
|
83
|
-
|
|
83
|
+
std::optional<std::string> JHybridNativeBleNitroSpec::getRestoreStateIdentifier() {
|
|
84
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getRestoreStateIdentifier");
|
|
85
|
+
auto __result = method(_javaPart);
|
|
86
|
+
return __result != nullptr ? std::make_optional(__result->toStdString()) : std::nullopt;
|
|
87
|
+
}
|
|
88
|
+
void JHybridNativeBleNitroSpec::setRestoreStateIdentifier(const std::optional<std::string>& restoreStateIdentifier) {
|
|
89
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* restoreStateIdentifier */)>("setRestoreStateIdentifier");
|
|
90
|
+
method(_javaPart, restoreStateIdentifier.has_value() ? jni::make_jstring(restoreStateIdentifier.value()) : nullptr);
|
|
91
|
+
}
|
|
84
92
|
|
|
85
93
|
// Methods
|
|
86
94
|
void JHybridNativeBleNitroSpec::setRestoreStateCallback(const std::function<void(const std::vector<BLEDevice>& /* restoredPeripherals */)>& callback) {
|
|
@@ -49,7 +49,8 @@ namespace margelo::nitro::co::zyke::ble {
|
|
|
49
49
|
|
|
50
50
|
public:
|
|
51
51
|
// Properties
|
|
52
|
-
|
|
52
|
+
std::optional<std::string> getRestoreStateIdentifier() override;
|
|
53
|
+
void setRestoreStateIdentifier(const std::optional<std::string>& restoreStateIdentifier) override;
|
|
53
54
|
|
|
54
55
|
public:
|
|
55
56
|
// Methods
|
|
@@ -15,7 +15,7 @@ import dalvik.annotation.optimization.FastNative
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* Represents the JavaScript callback `(
|
|
18
|
+
* Represents the JavaScript callback `(peripherals: array) => 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
|
*/
|
|
@@ -29,11 +29,11 @@ fun interface Func_void_std__vector_BLEDevice_: (Array<BLEDevice>) -> Unit {
|
|
|
29
29
|
*/
|
|
30
30
|
@DoNotStrip
|
|
31
31
|
@Keep
|
|
32
|
-
override fun invoke(
|
|
32
|
+
override fun invoke(peripherals: Array<BLEDevice>): Unit
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
|
-
* Represents the JavaScript callback `(
|
|
36
|
+
* Represents the JavaScript callback `(peripherals: array) => void`.
|
|
37
37
|
* This is implemented in C++, via a `std::function<...>`.
|
|
38
38
|
* The callback might be coming from JS.
|
|
39
39
|
*/
|
|
@@ -57,15 +57,15 @@ class Func_void_std__vector_BLEDevice__cxx: Func_void_std__vector_BLEDevice_ {
|
|
|
57
57
|
|
|
58
58
|
@DoNotStrip
|
|
59
59
|
@Keep
|
|
60
|
-
override fun invoke(
|
|
61
|
-
= invoke_cxx(
|
|
60
|
+
override fun invoke(peripherals: Array<BLEDevice>): Unit
|
|
61
|
+
= invoke_cxx(peripherals)
|
|
62
62
|
|
|
63
63
|
@FastNative
|
|
64
|
-
private external fun invoke_cxx(
|
|
64
|
+
private external fun invoke_cxx(peripherals: Array<BLEDevice>): Unit
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
|
-
* Represents the JavaScript callback `(
|
|
68
|
+
* Represents the JavaScript callback `(peripherals: array) => void`.
|
|
69
69
|
* This is implemented in Java/Kotlin, via a `(Array<BLEDevice>) -> Unit`.
|
|
70
70
|
* The callback is always coming from native.
|
|
71
71
|
*/
|
|
@@ -75,7 +75,7 @@ class Func_void_std__vector_BLEDevice__cxx: Func_void_std__vector_BLEDevice_ {
|
|
|
75
75
|
class Func_void_std__vector_BLEDevice__java(private val function: (Array<BLEDevice>) -> Unit): Func_void_std__vector_BLEDevice_ {
|
|
76
76
|
@DoNotStrip
|
|
77
77
|
@Keep
|
|
78
|
-
override fun invoke(
|
|
79
|
-
return this.function(
|
|
78
|
+
override fun invoke(peripherals: Array<BLEDevice>): Unit {
|
|
79
|
+
return this.function(peripherals)
|
|
80
80
|
}
|
|
81
81
|
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNativeBleNitroFactorySpec.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.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
import com.margelo.nitro.core.*
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* A Kotlin class representing the NativeBleNitroFactory HybridObject.
|
|
17
|
+
* Implement this abstract class to create Kotlin-based instances of NativeBleNitroFactory.
|
|
18
|
+
*/
|
|
19
|
+
@DoNotStrip
|
|
20
|
+
@Keep
|
|
21
|
+
@Suppress(
|
|
22
|
+
"KotlinJniMissingFunction", "unused",
|
|
23
|
+
"RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
|
|
24
|
+
"LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
|
|
25
|
+
)
|
|
26
|
+
abstract class HybridNativeBleNitroFactorySpec: HybridObject() {
|
|
27
|
+
@DoNotStrip
|
|
28
|
+
private var mHybridData: HybridData = initHybrid()
|
|
29
|
+
|
|
30
|
+
init {
|
|
31
|
+
super.updateNative(mHybridData)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
override fun updateNative(hybridData: HybridData) {
|
|
35
|
+
mHybridData = hybridData
|
|
36
|
+
super.updateNative(hybridData)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Properties
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
// Methods
|
|
43
|
+
abstract fun create(nativeRestoreStateIdentifier: String?, restoreStateCallback: ((peripherals: Array<BLEDevice>) -> Unit)?): HybridNativeBleNitroSpec
|
|
44
|
+
|
|
45
|
+
@DoNotStrip
|
|
46
|
+
@Keep
|
|
47
|
+
private fun create_cxx(nativeRestoreStateIdentifier: String?, restoreStateCallback: Func_void_std__vector_BLEDevice_?): HybridNativeBleNitroSpec {
|
|
48
|
+
val __result = create(nativeRestoreStateIdentifier, restoreStateCallback?.let { it })
|
|
49
|
+
return __result
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
private external fun initHybrid(): HybridData
|
|
53
|
+
|
|
54
|
+
companion object {
|
|
55
|
+
private const val TAG = "HybridNativeBleNitroFactorySpec"
|
|
56
|
+
}
|
|
57
|
+
}
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/HybridNativeBleNitroSpec.kt
CHANGED
|
@@ -37,7 +37,11 @@ abstract class HybridNativeBleNitroSpec: HybridObject() {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
// Properties
|
|
40
|
-
|
|
40
|
+
@get:DoNotStrip
|
|
41
|
+
@get:Keep
|
|
42
|
+
@set:DoNotStrip
|
|
43
|
+
@set:Keep
|
|
44
|
+
abstract var restoreStateIdentifier: String?
|
|
41
45
|
|
|
42
46
|
// Methods
|
|
43
47
|
abstract fun setRestoreStateCallback(callback: (restoredPeripherals: Array<BLEDevice>) -> Unit): Unit
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
// Include C++ implementation defined types
|
|
11
11
|
#include "BleNitro-Swift-Cxx-Umbrella.hpp"
|
|
12
|
+
#include "HybridNativeBleNitroFactorySpecSwift.hpp"
|
|
12
13
|
#include "HybridNativeBleNitroSpecSwift.hpp"
|
|
13
14
|
|
|
14
15
|
namespace margelo::nitro::co::zyke::ble::bridge::swift {
|
|
@@ -116,5 +117,21 @@ namespace margelo::nitro::co::zyke::ble::bridge::swift {
|
|
|
116
117
|
BleNitro::HybridNativeBleNitroSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
|
|
117
118
|
return swiftPart.toUnsafe();
|
|
118
119
|
}
|
|
120
|
+
|
|
121
|
+
// pragma MARK: std::shared_ptr<HybridNativeBleNitroFactorySpec>
|
|
122
|
+
std::shared_ptr<HybridNativeBleNitroFactorySpec> create_std__shared_ptr_HybridNativeBleNitroFactorySpec_(void* _Nonnull swiftUnsafePointer) {
|
|
123
|
+
BleNitro::HybridNativeBleNitroFactorySpec_cxx swiftPart = BleNitro::HybridNativeBleNitroFactorySpec_cxx::fromUnsafe(swiftUnsafePointer);
|
|
124
|
+
return std::make_shared<margelo::nitro::co::zyke::ble::HybridNativeBleNitroFactorySpecSwift>(swiftPart);
|
|
125
|
+
}
|
|
126
|
+
void* _Nonnull get_std__shared_ptr_HybridNativeBleNitroFactorySpec_(std__shared_ptr_HybridNativeBleNitroFactorySpec_ cppType) {
|
|
127
|
+
std::shared_ptr<margelo::nitro::co::zyke::ble::HybridNativeBleNitroFactorySpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::co::zyke::ble::HybridNativeBleNitroFactorySpecSwift>(cppType);
|
|
128
|
+
#ifdef NITRO_DEBUG
|
|
129
|
+
if (swiftWrapper == nullptr) [[unlikely]] {
|
|
130
|
+
throw std::runtime_error("Class \"HybridNativeBleNitroFactorySpec\" is not implemented in Swift!");
|
|
131
|
+
}
|
|
132
|
+
#endif
|
|
133
|
+
BleNitro::HybridNativeBleNitroFactorySpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
|
|
134
|
+
return swiftPart.toUnsafe();
|
|
135
|
+
}
|
|
119
136
|
|
|
120
137
|
} // namespace margelo::nitro::co::zyke::ble::bridge::swift
|
|
@@ -16,6 +16,8 @@ namespace NitroModules { class ArrayBuffer; }
|
|
|
16
16
|
namespace margelo::nitro::co::zyke::ble { struct BLEDevice; }
|
|
17
17
|
// Forward declaration of `BLEState` to properly resolve imports.
|
|
18
18
|
namespace margelo::nitro::co::zyke::ble { enum class BLEState; }
|
|
19
|
+
// Forward declaration of `HybridNativeBleNitroFactorySpec` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::co::zyke::ble { class HybridNativeBleNitroFactorySpec; }
|
|
19
21
|
// Forward declaration of `HybridNativeBleNitroSpec` to properly resolve imports.
|
|
20
22
|
namespace margelo::nitro::co::zyke::ble { class HybridNativeBleNitroSpec; }
|
|
21
23
|
// Forward declaration of `ManufacturerDataEntry` to properly resolve imports.
|
|
@@ -26,12 +28,15 @@ namespace margelo::nitro::co::zyke::ble { struct ManufacturerData; }
|
|
|
26
28
|
namespace margelo::nitro::co::zyke::ble { struct OperationResult; }
|
|
27
29
|
|
|
28
30
|
// Forward declarations of Swift defined types
|
|
31
|
+
// Forward declaration of `HybridNativeBleNitroFactorySpec_cxx` to properly resolve imports.
|
|
32
|
+
namespace BleNitro { class HybridNativeBleNitroFactorySpec_cxx; }
|
|
29
33
|
// Forward declaration of `HybridNativeBleNitroSpec_cxx` to properly resolve imports.
|
|
30
34
|
namespace BleNitro { class HybridNativeBleNitroSpec_cxx; }
|
|
31
35
|
|
|
32
36
|
// Include C++ defined types
|
|
33
37
|
#include "BLEDevice.hpp"
|
|
34
38
|
#include "BLEState.hpp"
|
|
39
|
+
#include "HybridNativeBleNitroFactorySpec.hpp"
|
|
35
40
|
#include "HybridNativeBleNitroSpec.hpp"
|
|
36
41
|
#include "ManufacturerData.hpp"
|
|
37
42
|
#include "ManufacturerDataEntry.hpp"
|
|
@@ -54,6 +59,15 @@ namespace BleNitro { class HybridNativeBleNitroSpec_cxx; }
|
|
|
54
59
|
*/
|
|
55
60
|
namespace margelo::nitro::co::zyke::ble::bridge::swift {
|
|
56
61
|
|
|
62
|
+
// pragma MARK: std::optional<std::string>
|
|
63
|
+
/**
|
|
64
|
+
* Specialized version of `std::optional<std::string>`.
|
|
65
|
+
*/
|
|
66
|
+
using std__optional_std__string_ = std::optional<std::string>;
|
|
67
|
+
inline std::optional<std::string> create_std__optional_std__string_(const std::string& value) {
|
|
68
|
+
return std::optional<std::string>(value);
|
|
69
|
+
}
|
|
70
|
+
|
|
57
71
|
// pragma MARK: std::vector<ManufacturerDataEntry>
|
|
58
72
|
/**
|
|
59
73
|
* Specialized version of `std::vector<ManufacturerDataEntry>`.
|
|
@@ -118,15 +132,6 @@ namespace margelo::nitro::co::zyke::ble::bridge::swift {
|
|
|
118
132
|
return std::optional<BLEDevice>(value);
|
|
119
133
|
}
|
|
120
134
|
|
|
121
|
-
// pragma MARK: std::optional<std::string>
|
|
122
|
-
/**
|
|
123
|
-
* Specialized version of `std::optional<std::string>`.
|
|
124
|
-
*/
|
|
125
|
-
using std__optional_std__string_ = std::optional<std::string>;
|
|
126
|
-
inline std::optional<std::string> create_std__optional_std__string_(const std::string& value) {
|
|
127
|
-
return std::optional<std::string>(value);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
135
|
// pragma MARK: std::function<void(const std::optional<BLEDevice>& /* device */, const std::optional<std::string>& /* error */)>
|
|
131
136
|
/**
|
|
132
137
|
* Specialized version of `std::function<void(const std::optional<BLEDevice>&, const std::optional<std::string>&)>`.
|
|
@@ -460,5 +465,35 @@ namespace margelo::nitro::co::zyke::ble::bridge::swift {
|
|
|
460
465
|
inline Result_std__shared_ptr_Promise_void___ create_Result_std__shared_ptr_Promise_void___(const std::exception_ptr& error) {
|
|
461
466
|
return Result<std::shared_ptr<Promise<void>>>::withError(error);
|
|
462
467
|
}
|
|
468
|
+
|
|
469
|
+
// pragma MARK: std::optional<std::function<void(const std::vector<BLEDevice>& /* peripherals */)>>
|
|
470
|
+
/**
|
|
471
|
+
* Specialized version of `std::optional<std::function<void(const std::vector<BLEDevice>& / * peripherals * /)>>`.
|
|
472
|
+
*/
|
|
473
|
+
using std__optional_std__function_void_const_std__vector_BLEDevice______peripherals______ = std::optional<std::function<void(const std::vector<BLEDevice>& /* peripherals */)>>;
|
|
474
|
+
inline std::optional<std::function<void(const std::vector<BLEDevice>& /* peripherals */)>> create_std__optional_std__function_void_const_std__vector_BLEDevice______peripherals______(const std::function<void(const std::vector<BLEDevice>& /* peripherals */)>& value) {
|
|
475
|
+
return std::optional<std::function<void(const std::vector<BLEDevice>& /* peripherals */)>>(value);
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
// pragma MARK: std::shared_ptr<HybridNativeBleNitroFactorySpec>
|
|
479
|
+
/**
|
|
480
|
+
* Specialized version of `std::shared_ptr<HybridNativeBleNitroFactorySpec>`.
|
|
481
|
+
*/
|
|
482
|
+
using std__shared_ptr_HybridNativeBleNitroFactorySpec_ = std::shared_ptr<HybridNativeBleNitroFactorySpec>;
|
|
483
|
+
std::shared_ptr<HybridNativeBleNitroFactorySpec> create_std__shared_ptr_HybridNativeBleNitroFactorySpec_(void* _Nonnull swiftUnsafePointer);
|
|
484
|
+
void* _Nonnull get_std__shared_ptr_HybridNativeBleNitroFactorySpec_(std__shared_ptr_HybridNativeBleNitroFactorySpec_ cppType);
|
|
485
|
+
|
|
486
|
+
// pragma MARK: std::weak_ptr<HybridNativeBleNitroFactorySpec>
|
|
487
|
+
using std__weak_ptr_HybridNativeBleNitroFactorySpec_ = std::weak_ptr<HybridNativeBleNitroFactorySpec>;
|
|
488
|
+
inline std__weak_ptr_HybridNativeBleNitroFactorySpec_ weakify_std__shared_ptr_HybridNativeBleNitroFactorySpec_(const std::shared_ptr<HybridNativeBleNitroFactorySpec>& strong) { return strong; }
|
|
489
|
+
|
|
490
|
+
// pragma MARK: Result<std::shared_ptr<HybridNativeBleNitroSpec>>
|
|
491
|
+
using Result_std__shared_ptr_HybridNativeBleNitroSpec__ = Result<std::shared_ptr<HybridNativeBleNitroSpec>>;
|
|
492
|
+
inline Result_std__shared_ptr_HybridNativeBleNitroSpec__ create_Result_std__shared_ptr_HybridNativeBleNitroSpec__(const std::shared_ptr<HybridNativeBleNitroSpec>& value) {
|
|
493
|
+
return Result<std::shared_ptr<HybridNativeBleNitroSpec>>::withValue(value);
|
|
494
|
+
}
|
|
495
|
+
inline Result_std__shared_ptr_HybridNativeBleNitroSpec__ create_Result_std__shared_ptr_HybridNativeBleNitroSpec__(const std::exception_ptr& error) {
|
|
496
|
+
return Result<std::shared_ptr<HybridNativeBleNitroSpec>>::withError(error);
|
|
497
|
+
}
|
|
463
498
|
|
|
464
499
|
} // namespace margelo::nitro::co::zyke::ble::bridge::swift
|
|
@@ -16,6 +16,8 @@ namespace NitroModules { class ArrayBuffer; }
|
|
|
16
16
|
namespace margelo::nitro::co::zyke::ble { struct BLEDevice; }
|
|
17
17
|
// Forward declaration of `BLEState` to properly resolve imports.
|
|
18
18
|
namespace margelo::nitro::co::zyke::ble { enum class BLEState; }
|
|
19
|
+
// Forward declaration of `HybridNativeBleNitroFactorySpec` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::co::zyke::ble { class HybridNativeBleNitroFactorySpec; }
|
|
19
21
|
// Forward declaration of `HybridNativeBleNitroSpec` to properly resolve imports.
|
|
20
22
|
namespace margelo::nitro::co::zyke::ble { class HybridNativeBleNitroSpec; }
|
|
21
23
|
// Forward declaration of `ManufacturerDataEntry` to properly resolve imports.
|
|
@@ -31,6 +33,7 @@ namespace margelo::nitro::co::zyke::ble { struct ScanFilter; }
|
|
|
31
33
|
#include "AndroidScanMode.hpp"
|
|
32
34
|
#include "BLEDevice.hpp"
|
|
33
35
|
#include "BLEState.hpp"
|
|
36
|
+
#include "HybridNativeBleNitroFactorySpec.hpp"
|
|
34
37
|
#include "HybridNativeBleNitroSpec.hpp"
|
|
35
38
|
#include "ManufacturerData.hpp"
|
|
36
39
|
#include "ManufacturerDataEntry.hpp"
|
|
@@ -56,6 +59,8 @@ namespace margelo::nitro::co::zyke::ble { struct ScanFilter; }
|
|
|
56
59
|
#include <NitroModules/DateToChronoDate.hpp>
|
|
57
60
|
|
|
58
61
|
// Forward declarations of Swift defined types
|
|
62
|
+
// Forward declaration of `HybridNativeBleNitroFactorySpec_cxx` to properly resolve imports.
|
|
63
|
+
namespace BleNitro { class HybridNativeBleNitroFactorySpec_cxx; }
|
|
59
64
|
// Forward declaration of `HybridNativeBleNitroSpec_cxx` to properly resolve imports.
|
|
60
65
|
namespace BleNitro { class HybridNativeBleNitroSpec_cxx; }
|
|
61
66
|
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
#import <type_traits>
|
|
12
12
|
|
|
13
13
|
#include "HybridNativeBleNitroSpecSwift.hpp"
|
|
14
|
+
#include "HybridNativeBleNitroFactorySpecSwift.hpp"
|
|
14
15
|
|
|
15
16
|
@interface BleNitroAutolinking : NSObject
|
|
16
17
|
@end
|
|
@@ -28,6 +29,13 @@
|
|
|
28
29
|
return hybridObject;
|
|
29
30
|
}
|
|
30
31
|
);
|
|
32
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
33
|
+
"NativeBleNitroFactory",
|
|
34
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
35
|
+
std::shared_ptr<HybridNativeBleNitroFactorySpec> hybridObject = BleNitro::BleNitroAutolinking::createNativeBleNitroFactory();
|
|
36
|
+
return hybridObject;
|
|
37
|
+
}
|
|
38
|
+
);
|
|
31
39
|
}
|
|
32
40
|
|
|
33
41
|
@end
|
|
@@ -22,4 +22,19 @@ public final class BleNitroAutolinking {
|
|
|
22
22
|
return __cxxWrapped.getCxxPart()
|
|
23
23
|
}()
|
|
24
24
|
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Creates an instance of a Swift class that implements `HybridNativeBleNitroFactorySpec`,
|
|
28
|
+
* and wraps it in a Swift class that can directly interop with C++ (`HybridNativeBleNitroFactorySpec_cxx`)
|
|
29
|
+
*
|
|
30
|
+
* This is generated by Nitrogen and will initialize the class specified
|
|
31
|
+
* in the `"autolinking"` property of `nitro.json` (in this case, `BleNitroBleManagerFactory`).
|
|
32
|
+
*/
|
|
33
|
+
public static func createNativeBleNitroFactory() -> bridge.std__shared_ptr_HybridNativeBleNitroFactorySpec_ {
|
|
34
|
+
let hybridObject = BleNitroBleManagerFactory()
|
|
35
|
+
return { () -> bridge.std__shared_ptr_HybridNativeBleNitroFactorySpec_ in
|
|
36
|
+
let __cxxWrapped = hybridObject.getCxxWrapper()
|
|
37
|
+
return __cxxWrapped.getCxxPart()
|
|
38
|
+
}()
|
|
39
|
+
}
|
|
25
40
|
}
|