react-native-ble-nitro 1.0.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/README.md +25 -17
  2. package/ios/BleNitroBleManager.swift +126 -57
  3. package/ios/BlePeripheralDelegate.swift +36 -8
  4. package/lib/commonjs/index.d.ts +29 -20
  5. package/lib/commonjs/index.d.ts.map +1 -1
  6. package/lib/commonjs/index.js +113 -143
  7. package/lib/commonjs/index.js.map +1 -1
  8. package/lib/commonjs/specs/NativeBleNitro.nitro.d.ts +19 -14
  9. package/lib/commonjs/specs/NativeBleNitro.nitro.d.ts.map +1 -1
  10. package/lib/commonjs/specs/NativeBleNitro.nitro.js.map +1 -1
  11. package/lib/index.d.ts +29 -20
  12. package/lib/index.js +112 -142
  13. package/lib/specs/NativeBleNitro.nitro.d.ts +19 -14
  14. package/nitrogen/generated/android/BleNitroOnLoad.cpp +6 -12
  15. package/nitrogen/generated/android/c++/JBLEDevice.hpp +3 -0
  16. package/nitrogen/generated/android/c++/JFunc_void_BLEDevice.hpp +3 -0
  17. package/nitrogen/generated/android/c++/JFunc_void_bool_std__shared_ptr_ArrayBuffer__std__string.hpp +78 -0
  18. package/nitrogen/generated/android/c++/JFunc_void_std__string_std__shared_ptr_ArrayBuffer_.hpp +78 -0
  19. package/nitrogen/generated/android/c++/JHybridNativeBleNitroSpec.cpp +111 -65
  20. package/nitrogen/generated/android/c++/JHybridNativeBleNitroSpec.hpp +13 -13
  21. package/nitrogen/generated/android/c++/JManufacturerData.hpp +3 -0
  22. package/nitrogen/generated/android/c++/JManufacturerDataEntry.hpp +7 -15
  23. package/nitrogen/generated/android/c++/JOperationResult.hpp +58 -0
  24. 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
  25. 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
  26. package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/HybridNativeBleNitroSpec.kt +20 -65
  27. package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/ManufacturerDataEntry.kt +1 -1
  28. package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/OperationResult.kt +32 -0
  29. package/nitrogen/generated/ios/BleNitro-Swift-Cxx-Bridge.cpp +15 -39
  30. package/nitrogen/generated/ios/BleNitro-Swift-Cxx-Bridge.hpp +108 -113
  31. package/nitrogen/generated/ios/BleNitro-Swift-Cxx-Umbrella.hpp +6 -0
  32. package/nitrogen/generated/ios/c++/HybridNativeBleNitroSpecSwift.hpp +57 -28
  33. 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
  34. package/nitrogen/generated/ios/swift/{Func_void_std__string_std__vector_double_.swift → Func_void_std__string_std__shared_ptr_ArrayBuffer_.swift} +11 -11
  35. package/nitrogen/generated/ios/swift/HybridNativeBleNitroSpec.swift +13 -13
  36. package/nitrogen/generated/ios/swift/HybridNativeBleNitroSpec_cxx.swift +84 -136
  37. package/nitrogen/generated/ios/swift/ManufacturerDataEntry.swift +5 -17
  38. package/nitrogen/generated/ios/swift/OperationResult.swift +64 -0
  39. package/nitrogen/generated/shared/c++/HybridNativeBleNitroSpec.cpp +1 -1
  40. package/nitrogen/generated/shared/c++/HybridNativeBleNitroSpec.hpp +20 -14
  41. package/nitrogen/generated/shared/c++/ManufacturerDataEntry.hpp +8 -7
  42. package/nitrogen/generated/shared/c++/OperationResult.hpp +72 -0
  43. package/package.json +1 -1
  44. package/react-native.config.js +10 -2
  45. package/src/__tests__/index.test.ts +19 -22
  46. package/src/index.ts +147 -164
  47. package/src/specs/NativeBleNitro.nitro.ts +22 -14
  48. package/nitrogen/generated/android/c++/JFunc_void_bool.hpp +0 -74
  49. package/nitrogen/generated/android/c++/JFunc_void_bool_std__vector_double__std__string.hpp +0 -86
  50. package/nitrogen/generated/android/c++/JFunc_void_std__string_std__vector_double_.hpp +0 -86
  51. package/nitrogen/generated/android/c++/JFunc_void_std__vector_BLEDevice_.hpp +0 -99
  52. package/nitrogen/generated/android/c++/JFunc_void_std__vector_std__string_.hpp +0 -93
  53. package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/Func_void_bool.kt +0 -81
  54. package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/Func_void_std__vector_BLEDevice_.kt +0 -81
  55. package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/Func_void_std__vector_std__string_.kt +0 -81
  56. package/nitrogen/generated/ios/swift/Func_void_bool.swift +0 -47
  57. package/nitrogen/generated/ios/swift/Func_void_std__vector_BLEDevice_.swift +0 -47
  58. package/nitrogen/generated/ios/swift/Func_void_std__vector_std__string_.swift +0 -47
@@ -1,86 +0,0 @@
1
- ///
2
- /// JFunc_void_bool_std__vector_double__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 <vector>
14
- #include <string>
15
- #include <functional>
16
-
17
- namespace margelo::nitro::co::zyke::ble {
18
-
19
- using namespace facebook;
20
-
21
- /**
22
- * Represents the Java/Kotlin callback `(success: Boolean, data: DoubleArray, error: String) -> Unit`.
23
- * This can be passed around between C++ and Java/Kotlin.
24
- */
25
- struct JFunc_void_bool_std__vector_double__std__string: public jni::JavaClass<JFunc_void_bool_std__vector_double__std__string> {
26
- public:
27
- static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/co/zyke/ble/Func_void_bool_std__vector_double__std__string;";
28
-
29
- public:
30
- /**
31
- * Invokes the function this `JFunc_void_bool_std__vector_double__std__string` instance holds through JNI.
32
- */
33
- void invoke(bool success, const std::vector<double>& data, const std::string& error) const {
34
- static const auto method = javaClassStatic()->getMethod<void(jboolean /* success */, jni::alias_ref<jni::JArrayDouble> /* data */, jni::alias_ref<jni::JString> /* error */)>("invoke");
35
- method(self(), success, [&]() {
36
- size_t __size = data.size();
37
- jni::local_ref<jni::JArrayDouble> __array = jni::JArrayDouble::newArray(__size);
38
- __array->setRegion(0, __size, data.data());
39
- return __array;
40
- }(), jni::make_jstring(error));
41
- }
42
- };
43
-
44
- /**
45
- * An implementation of Func_void_bool_std__vector_double__std__string that is backed by a C++ implementation (using `std::function<...>`)
46
- */
47
- struct JFunc_void_bool_std__vector_double__std__string_cxx final: public jni::HybridClass<JFunc_void_bool_std__vector_double__std__string_cxx, JFunc_void_bool_std__vector_double__std__string> {
48
- public:
49
- static jni::local_ref<JFunc_void_bool_std__vector_double__std__string::javaobject> fromCpp(const std::function<void(bool /* success */, const std::vector<double>& /* data */, const std::string& /* error */)>& func) {
50
- return JFunc_void_bool_std__vector_double__std__string_cxx::newObjectCxxArgs(func);
51
- }
52
-
53
- public:
54
- /**
55
- * Invokes the C++ `std::function<...>` this `JFunc_void_bool_std__vector_double__std__string_cxx` instance holds.
56
- */
57
- void invoke_cxx(jboolean success, jni::alias_ref<jni::JArrayDouble> data, jni::alias_ref<jni::JString> error) {
58
- _func(static_cast<bool>(success), [&]() {
59
- size_t __size = data->size();
60
- std::vector<double> __vector(__size);
61
- data->getRegion(0, __size, __vector.data());
62
- return __vector;
63
- }(), error->toStdString());
64
- }
65
-
66
- public:
67
- [[nodiscard]]
68
- inline const std::function<void(bool /* success */, const std::vector<double>& /* data */, const std::string& /* error */)>& getFunction() const {
69
- return _func;
70
- }
71
-
72
- public:
73
- static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/co/zyke/ble/Func_void_bool_std__vector_double__std__string_cxx;";
74
- static void registerNatives() {
75
- registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_bool_std__vector_double__std__string_cxx::invoke_cxx)});
76
- }
77
-
78
- private:
79
- explicit JFunc_void_bool_std__vector_double__std__string_cxx(const std::function<void(bool /* success */, const std::vector<double>& /* data */, const std::string& /* error */)>& func): _func(func) { }
80
-
81
- private:
82
- friend HybridBase;
83
- std::function<void(bool /* success */, const std::vector<double>& /* data */, const std::string& /* error */)> _func;
84
- };
85
-
86
- } // namespace margelo::nitro::co::zyke::ble
@@ -1,86 +0,0 @@
1
- ///
2
- /// JFunc_void_std__string_std__vector_double_.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 <vector>
15
- #include <functional>
16
-
17
- namespace margelo::nitro::co::zyke::ble {
18
-
19
- using namespace facebook;
20
-
21
- /**
22
- * Represents the Java/Kotlin callback `(characteristicId: String, data: DoubleArray) -> Unit`.
23
- * This can be passed around between C++ and Java/Kotlin.
24
- */
25
- struct JFunc_void_std__string_std__vector_double_: public jni::JavaClass<JFunc_void_std__string_std__vector_double_> {
26
- public:
27
- static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/co/zyke/ble/Func_void_std__string_std__vector_double_;";
28
-
29
- public:
30
- /**
31
- * Invokes the function this `JFunc_void_std__string_std__vector_double_` instance holds through JNI.
32
- */
33
- void invoke(const std::string& characteristicId, const std::vector<double>& data) const {
34
- static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* characteristicId */, jni::alias_ref<jni::JArrayDouble> /* data */)>("invoke");
35
- method(self(), jni::make_jstring(characteristicId), [&]() {
36
- size_t __size = data.size();
37
- jni::local_ref<jni::JArrayDouble> __array = jni::JArrayDouble::newArray(__size);
38
- __array->setRegion(0, __size, data.data());
39
- return __array;
40
- }());
41
- }
42
- };
43
-
44
- /**
45
- * An implementation of Func_void_std__string_std__vector_double_ that is backed by a C++ implementation (using `std::function<...>`)
46
- */
47
- struct JFunc_void_std__string_std__vector_double__cxx final: public jni::HybridClass<JFunc_void_std__string_std__vector_double__cxx, JFunc_void_std__string_std__vector_double_> {
48
- public:
49
- static jni::local_ref<JFunc_void_std__string_std__vector_double_::javaobject> fromCpp(const std::function<void(const std::string& /* characteristicId */, const std::vector<double>& /* data */)>& func) {
50
- return JFunc_void_std__string_std__vector_double__cxx::newObjectCxxArgs(func);
51
- }
52
-
53
- public:
54
- /**
55
- * Invokes the C++ `std::function<...>` this `JFunc_void_std__string_std__vector_double__cxx` instance holds.
56
- */
57
- void invoke_cxx(jni::alias_ref<jni::JString> characteristicId, jni::alias_ref<jni::JArrayDouble> data) {
58
- _func(characteristicId->toStdString(), [&]() {
59
- size_t __size = data->size();
60
- std::vector<double> __vector(__size);
61
- data->getRegion(0, __size, __vector.data());
62
- return __vector;
63
- }());
64
- }
65
-
66
- public:
67
- [[nodiscard]]
68
- inline const std::function<void(const std::string& /* characteristicId */, const std::vector<double>& /* data */)>& getFunction() const {
69
- return _func;
70
- }
71
-
72
- public:
73
- static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/co/zyke/ble/Func_void_std__string_std__vector_double__cxx;";
74
- static void registerNatives() {
75
- registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_std__string_std__vector_double__cxx::invoke_cxx)});
76
- }
77
-
78
- private:
79
- explicit JFunc_void_std__string_std__vector_double__cxx(const std::function<void(const std::string& /* characteristicId */, const std::vector<double>& /* data */)>& func): _func(func) { }
80
-
81
- private:
82
- friend HybridBase;
83
- std::function<void(const std::string& /* characteristicId */, const std::vector<double>& /* data */)> _func;
84
- };
85
-
86
- } // namespace margelo::nitro::co::zyke::ble
@@ -1,99 +0,0 @@
1
- ///
2
- /// JFunc_void_std__vector_BLEDevice_.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 "BLEDevice.hpp"
14
- #include <vector>
15
- #include <functional>
16
- #include "JBLEDevice.hpp"
17
- #include <string>
18
- #include "ManufacturerData.hpp"
19
- #include "JManufacturerData.hpp"
20
- #include "ManufacturerDataEntry.hpp"
21
- #include "JManufacturerDataEntry.hpp"
22
-
23
- namespace margelo::nitro::co::zyke::ble {
24
-
25
- using namespace facebook;
26
-
27
- /**
28
- * Represents the Java/Kotlin callback `(devices: Array<BLEDevice>) -> Unit`.
29
- * This can be passed around between C++ and Java/Kotlin.
30
- */
31
- struct JFunc_void_std__vector_BLEDevice_: public jni::JavaClass<JFunc_void_std__vector_BLEDevice_> {
32
- public:
33
- static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/co/zyke/ble/Func_void_std__vector_BLEDevice_;";
34
-
35
- public:
36
- /**
37
- * Invokes the function this `JFunc_void_std__vector_BLEDevice_` instance holds through JNI.
38
- */
39
- void invoke(const std::vector<BLEDevice>& devices) const {
40
- static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JArrayClass<JBLEDevice>> /* devices */)>("invoke");
41
- method(self(), [&]() {
42
- size_t __size = devices.size();
43
- jni::local_ref<jni::JArrayClass<JBLEDevice>> __array = jni::JArrayClass<JBLEDevice>::newArray(__size);
44
- for (size_t __i = 0; __i < __size; __i++) {
45
- const auto& __element = devices[__i];
46
- __array->setElement(__i, *JBLEDevice::fromCpp(__element));
47
- }
48
- return __array;
49
- }());
50
- }
51
- };
52
-
53
- /**
54
- * An implementation of Func_void_std__vector_BLEDevice_ that is backed by a C++ implementation (using `std::function<...>`)
55
- */
56
- struct JFunc_void_std__vector_BLEDevice__cxx final: public jni::HybridClass<JFunc_void_std__vector_BLEDevice__cxx, JFunc_void_std__vector_BLEDevice_> {
57
- public:
58
- static jni::local_ref<JFunc_void_std__vector_BLEDevice_::javaobject> fromCpp(const std::function<void(const std::vector<BLEDevice>& /* devices */)>& func) {
59
- return JFunc_void_std__vector_BLEDevice__cxx::newObjectCxxArgs(func);
60
- }
61
-
62
- public:
63
- /**
64
- * Invokes the C++ `std::function<...>` this `JFunc_void_std__vector_BLEDevice__cxx` instance holds.
65
- */
66
- void invoke_cxx(jni::alias_ref<jni::JArrayClass<JBLEDevice>> devices) {
67
- _func([&]() {
68
- size_t __size = devices->size();
69
- std::vector<BLEDevice> __vector;
70
- __vector.reserve(__size);
71
- for (size_t __i = 0; __i < __size; __i++) {
72
- auto __element = devices->getElement(__i);
73
- __vector.push_back(__element->toCpp());
74
- }
75
- return __vector;
76
- }());
77
- }
78
-
79
- public:
80
- [[nodiscard]]
81
- inline const std::function<void(const std::vector<BLEDevice>& /* devices */)>& getFunction() const {
82
- return _func;
83
- }
84
-
85
- public:
86
- static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/co/zyke/ble/Func_void_std__vector_BLEDevice__cxx;";
87
- static void registerNatives() {
88
- registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_std__vector_BLEDevice__cxx::invoke_cxx)});
89
- }
90
-
91
- private:
92
- explicit JFunc_void_std__vector_BLEDevice__cxx(const std::function<void(const std::vector<BLEDevice>& /* devices */)>& func): _func(func) { }
93
-
94
- private:
95
- friend HybridBase;
96
- std::function<void(const std::vector<BLEDevice>& /* devices */)> _func;
97
- };
98
-
99
- } // namespace margelo::nitro::co::zyke::ble
@@ -1,93 +0,0 @@
1
- ///
2
- /// JFunc_void_std__vector_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 <string>
14
- #include <vector>
15
- #include <functional>
16
-
17
- namespace margelo::nitro::co::zyke::ble {
18
-
19
- using namespace facebook;
20
-
21
- /**
22
- * Represents the Java/Kotlin callback `(result: Array<String>) -> Unit`.
23
- * This can be passed around between C++ and Java/Kotlin.
24
- */
25
- struct JFunc_void_std__vector_std__string_: public jni::JavaClass<JFunc_void_std__vector_std__string_> {
26
- public:
27
- static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/co/zyke/ble/Func_void_std__vector_std__string_;";
28
-
29
- public:
30
- /**
31
- * Invokes the function this `JFunc_void_std__vector_std__string_` instance holds through JNI.
32
- */
33
- void invoke(const std::vector<std::string>& result) const {
34
- static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JArrayClass<jni::JString>> /* result */)>("invoke");
35
- method(self(), [&]() {
36
- size_t __size = result.size();
37
- jni::local_ref<jni::JArrayClass<jni::JString>> __array = jni::JArrayClass<jni::JString>::newArray(__size);
38
- for (size_t __i = 0; __i < __size; __i++) {
39
- const auto& __element = result[__i];
40
- __array->setElement(__i, *jni::make_jstring(__element));
41
- }
42
- return __array;
43
- }());
44
- }
45
- };
46
-
47
- /**
48
- * An implementation of Func_void_std__vector_std__string_ that is backed by a C++ implementation (using `std::function<...>`)
49
- */
50
- struct JFunc_void_std__vector_std__string__cxx final: public jni::HybridClass<JFunc_void_std__vector_std__string__cxx, JFunc_void_std__vector_std__string_> {
51
- public:
52
- static jni::local_ref<JFunc_void_std__vector_std__string_::javaobject> fromCpp(const std::function<void(const std::vector<std::string>& /* result */)>& func) {
53
- return JFunc_void_std__vector_std__string__cxx::newObjectCxxArgs(func);
54
- }
55
-
56
- public:
57
- /**
58
- * Invokes the C++ `std::function<...>` this `JFunc_void_std__vector_std__string__cxx` instance holds.
59
- */
60
- void invoke_cxx(jni::alias_ref<jni::JArrayClass<jni::JString>> result) {
61
- _func([&]() {
62
- size_t __size = result->size();
63
- std::vector<std::string> __vector;
64
- __vector.reserve(__size);
65
- for (size_t __i = 0; __i < __size; __i++) {
66
- auto __element = result->getElement(__i);
67
- __vector.push_back(__element->toStdString());
68
- }
69
- return __vector;
70
- }());
71
- }
72
-
73
- public:
74
- [[nodiscard]]
75
- inline const std::function<void(const std::vector<std::string>& /* result */)>& getFunction() const {
76
- return _func;
77
- }
78
-
79
- public:
80
- static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/co/zyke/ble/Func_void_std__vector_std__string__cxx;";
81
- static void registerNatives() {
82
- registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_std__vector_std__string__cxx::invoke_cxx)});
83
- }
84
-
85
- private:
86
- explicit JFunc_void_std__vector_std__string__cxx(const std::function<void(const std::vector<std::string>& /* result */)>& func): _func(func) { }
87
-
88
- private:
89
- friend HybridBase;
90
- std::function<void(const std::vector<std::string>& /* result */)> _func;
91
- };
92
-
93
- } // namespace margelo::nitro::co::zyke::ble
@@ -1,81 +0,0 @@
1
- ///
2
- /// Func_void_bool.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
- import dalvik.annotation.optimization.FastNative
15
-
16
-
17
- /**
18
- * Represents the JavaScript callback `(result: boolean) => void`.
19
- * This can be either implemented in C++ (in which case it might be a callback coming from JS),
20
- * or in Kotlin/Java (in which case it is a native callback).
21
- */
22
- @DoNotStrip
23
- @Keep
24
- @Suppress("ClassName", "RedundantUnitReturnType")
25
- fun interface Func_void_bool: (Boolean) -> Unit {
26
- /**
27
- * Call the given JS callback.
28
- * @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
29
- */
30
- @DoNotStrip
31
- @Keep
32
- override fun invoke(result: Boolean): Unit
33
- }
34
-
35
- /**
36
- * Represents the JavaScript callback `(result: boolean) => void`.
37
- * This is implemented in C++, via a `std::function<...>`.
38
- * The callback might be coming from JS.
39
- */
40
- @DoNotStrip
41
- @Keep
42
- @Suppress(
43
- "KotlinJniMissingFunction", "unused",
44
- "RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
45
- "ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
46
- )
47
- class Func_void_bool_cxx: Func_void_bool {
48
- @DoNotStrip
49
- @Keep
50
- private val mHybridData: HybridData
51
-
52
- @DoNotStrip
53
- @Keep
54
- private constructor(hybridData: HybridData) {
55
- mHybridData = hybridData
56
- }
57
-
58
- @DoNotStrip
59
- @Keep
60
- override fun invoke(result: Boolean): Unit
61
- = invoke_cxx(result)
62
-
63
- @FastNative
64
- private external fun invoke_cxx(result: Boolean): Unit
65
- }
66
-
67
- /**
68
- * Represents the JavaScript callback `(result: boolean) => void`.
69
- * This is implemented in Java/Kotlin, via a `(Boolean) -> Unit`.
70
- * The callback is always coming from native.
71
- */
72
- @DoNotStrip
73
- @Keep
74
- @Suppress("ClassName", "RedundantUnitReturnType", "unused")
75
- class Func_void_bool_java(private val function: (Boolean) -> Unit): Func_void_bool {
76
- @DoNotStrip
77
- @Keep
78
- override fun invoke(result: Boolean): Unit {
79
- return this.function(result)
80
- }
81
- }
@@ -1,81 +0,0 @@
1
- ///
2
- /// Func_void_std__vector_BLEDevice_.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
- import dalvik.annotation.optimization.FastNative
15
-
16
-
17
- /**
18
- * Represents the JavaScript callback `(devices: array) => void`.
19
- * This can be either implemented in C++ (in which case it might be a callback coming from JS),
20
- * or in Kotlin/Java (in which case it is a native callback).
21
- */
22
- @DoNotStrip
23
- @Keep
24
- @Suppress("ClassName", "RedundantUnitReturnType")
25
- fun interface Func_void_std__vector_BLEDevice_: (Array<BLEDevice>) -> Unit {
26
- /**
27
- * Call the given JS callback.
28
- * @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
29
- */
30
- @DoNotStrip
31
- @Keep
32
- override fun invoke(devices: Array<BLEDevice>): Unit
33
- }
34
-
35
- /**
36
- * Represents the JavaScript callback `(devices: array) => void`.
37
- * This is implemented in C++, via a `std::function<...>`.
38
- * The callback might be coming from JS.
39
- */
40
- @DoNotStrip
41
- @Keep
42
- @Suppress(
43
- "KotlinJniMissingFunction", "unused",
44
- "RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
45
- "ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
46
- )
47
- class Func_void_std__vector_BLEDevice__cxx: Func_void_std__vector_BLEDevice_ {
48
- @DoNotStrip
49
- @Keep
50
- private val mHybridData: HybridData
51
-
52
- @DoNotStrip
53
- @Keep
54
- private constructor(hybridData: HybridData) {
55
- mHybridData = hybridData
56
- }
57
-
58
- @DoNotStrip
59
- @Keep
60
- override fun invoke(devices: Array<BLEDevice>): Unit
61
- = invoke_cxx(devices)
62
-
63
- @FastNative
64
- private external fun invoke_cxx(devices: Array<BLEDevice>): Unit
65
- }
66
-
67
- /**
68
- * Represents the JavaScript callback `(devices: array) => void`.
69
- * This is implemented in Java/Kotlin, via a `(Array<BLEDevice>) -> Unit`.
70
- * The callback is always coming from native.
71
- */
72
- @DoNotStrip
73
- @Keep
74
- @Suppress("ClassName", "RedundantUnitReturnType", "unused")
75
- class Func_void_std__vector_BLEDevice__java(private val function: (Array<BLEDevice>) -> Unit): Func_void_std__vector_BLEDevice_ {
76
- @DoNotStrip
77
- @Keep
78
- override fun invoke(devices: Array<BLEDevice>): Unit {
79
- return this.function(devices)
80
- }
81
- }
@@ -1,81 +0,0 @@
1
- ///
2
- /// Func_void_std__vector_std__string_.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
- import dalvik.annotation.optimization.FastNative
15
-
16
-
17
- /**
18
- * Represents the JavaScript callback `(result: array) => void`.
19
- * This can be either implemented in C++ (in which case it might be a callback coming from JS),
20
- * or in Kotlin/Java (in which case it is a native callback).
21
- */
22
- @DoNotStrip
23
- @Keep
24
- @Suppress("ClassName", "RedundantUnitReturnType")
25
- fun interface Func_void_std__vector_std__string_: (Array<String>) -> Unit {
26
- /**
27
- * Call the given JS callback.
28
- * @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
29
- */
30
- @DoNotStrip
31
- @Keep
32
- override fun invoke(result: Array<String>): Unit
33
- }
34
-
35
- /**
36
- * Represents the JavaScript callback `(result: array) => void`.
37
- * This is implemented in C++, via a `std::function<...>`.
38
- * The callback might be coming from JS.
39
- */
40
- @DoNotStrip
41
- @Keep
42
- @Suppress(
43
- "KotlinJniMissingFunction", "unused",
44
- "RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
45
- "ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
46
- )
47
- class Func_void_std__vector_std__string__cxx: Func_void_std__vector_std__string_ {
48
- @DoNotStrip
49
- @Keep
50
- private val mHybridData: HybridData
51
-
52
- @DoNotStrip
53
- @Keep
54
- private constructor(hybridData: HybridData) {
55
- mHybridData = hybridData
56
- }
57
-
58
- @DoNotStrip
59
- @Keep
60
- override fun invoke(result: Array<String>): Unit
61
- = invoke_cxx(result)
62
-
63
- @FastNative
64
- private external fun invoke_cxx(result: Array<String>): Unit
65
- }
66
-
67
- /**
68
- * Represents the JavaScript callback `(result: array) => void`.
69
- * This is implemented in Java/Kotlin, via a `(Array<String>) -> Unit`.
70
- * The callback is always coming from native.
71
- */
72
- @DoNotStrip
73
- @Keep
74
- @Suppress("ClassName", "RedundantUnitReturnType", "unused")
75
- class Func_void_std__vector_std__string__java(private val function: (Array<String>) -> Unit): Func_void_std__vector_std__string_ {
76
- @DoNotStrip
77
- @Keep
78
- override fun invoke(result: Array<String>): Unit {
79
- return this.function(result)
80
- }
81
- }
@@ -1,47 +0,0 @@
1
- ///
2
- /// Func_void_bool.swift
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
- import NitroModules
9
-
10
-
11
- /**
12
- * Wraps a Swift `(_ result: Bool) -> Void` as a class.
13
- * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
14
- */
15
- public final class Func_void_bool {
16
- public typealias bridge = margelo.nitro.co.zyke.ble.bridge.swift
17
-
18
- private let closure: (_ result: Bool) -> Void
19
-
20
- public init(_ closure: @escaping (_ result: Bool) -> Void) {
21
- self.closure = closure
22
- }
23
-
24
- @inline(__always)
25
- public func call(result: Bool) -> Void {
26
- self.closure(result)
27
- }
28
-
29
- /**
30
- * Casts this instance to a retained unsafe raw pointer.
31
- * This acquires one additional strong reference on the object!
32
- */
33
- @inline(__always)
34
- public func toUnsafe() -> UnsafeMutableRawPointer {
35
- return Unmanaged.passRetained(self).toOpaque()
36
- }
37
-
38
- /**
39
- * Casts an unsafe pointer to a `Func_void_bool`.
40
- * The pointer has to be a retained opaque `Unmanaged<Func_void_bool>`.
41
- * This removes one strong reference from the object!
42
- */
43
- @inline(__always)
44
- public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_bool {
45
- return Unmanaged<Func_void_bool>.fromOpaque(pointer).takeRetainedValue()
46
- }
47
- }