react-native-ble-nitro 1.2.0 → 1.3.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 +81 -18
- package/android/CMakeLists.txt +32 -0
- package/android/build.gradle +140 -0
- package/android/fix-prefab.gradle +51 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/cpp/cpp-adapter.cpp +6 -0
- package/android/src/main/java/com/margelo/nitro/co/zyke/ble/BleNitroBleManager.kt +899 -0
- package/android/src/main/java/com/margelo/nitro/co/zyke/ble/BleNitroPackage.kt +38 -0
- package/ios/BleNitroBleManager.swift +7 -3
- package/lib/commonjs/index.d.ts +14 -8
- package/lib/commonjs/index.d.ts.map +1 -1
- package/lib/commonjs/index.js +35 -17
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/specs/NativeBleNitro.nitro.d.ts +8 -1
- package/lib/commonjs/specs/NativeBleNitro.nitro.d.ts.map +1 -1
- package/lib/commonjs/specs/NativeBleNitro.nitro.js +8 -1
- package/lib/commonjs/specs/NativeBleNitro.nitro.js.map +1 -1
- package/lib/index.d.ts +14 -8
- package/lib/index.js +33 -15
- package/lib/specs/NativeBleNitro.nitro.d.ts +8 -1
- package/lib/specs/NativeBleNitro.nitro.js +7 -0
- package/nitrogen/generated/android/BleNitroOnLoad.cpp +2 -2
- package/nitrogen/generated/android/c++/JAndroidScanMode.hpp +65 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__optional_BLEDevice__std__optional_std__string_.hpp +86 -0
- package/nitrogen/generated/android/c++/JHybridNativeBleNitroSpec.cpp +8 -4
- package/nitrogen/generated/android/c++/JHybridNativeBleNitroSpec.hpp +1 -1
- package/nitrogen/generated/android/c++/JScanFilter.hpp +8 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/AndroidScanMode.kt +23 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/{Func_void_BLEDevice.kt → Func_void_std__optional_BLEDevice__std__optional_std__string_.kt} +14 -14
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/HybridNativeBleNitroSpec.kt +2 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/ScanFilter.kt +4 -1
- package/nitrogen/generated/ios/BleNitro-Swift-Cxx-Bridge.cpp +5 -5
- package/nitrogen/generated/ios/BleNitro-Swift-Cxx-Bridge.hpp +30 -21
- package/nitrogen/generated/ios/BleNitro-Swift-Cxx-Umbrella.hpp +3 -0
- package/nitrogen/generated/ios/c++/HybridNativeBleNitroSpecSwift.hpp +5 -2
- package/nitrogen/generated/ios/swift/AndroidScanMode.swift +48 -0
- package/nitrogen/generated/ios/swift/Func_void_std__optional_BLEDevice__std__optional_std__string_.swift +59 -0
- package/nitrogen/generated/ios/swift/HybridNativeBleNitroSpec.swift +1 -1
- package/nitrogen/generated/ios/swift/HybridNativeBleNitroSpec_cxx.swift +17 -5
- package/nitrogen/generated/ios/swift/ScanFilter.swift +13 -2
- package/nitrogen/generated/shared/c++/AndroidScanMode.hpp +64 -0
- package/nitrogen/generated/shared/c++/HybridNativeBleNitroSpec.hpp +3 -3
- package/nitrogen/generated/shared/c++/ScanFilter.hpp +9 -3
- package/package.json +1 -1
- package/plugin/build/index.d.ts +2 -0
- package/plugin/build/index.js +2 -0
- package/plugin/build/withBleNitro.d.ts +5 -1
- package/plugin/build/withBleNitro.js +18 -7
- package/src/__tests__/index.test.ts +48 -13
- package/src/index.ts +40 -21
- package/src/specs/NativeBleNitro.nitro.ts +9 -1
- package/nitrogen/generated/android/c++/JFunc_void_BLEDevice.hpp +0 -85
- package/nitrogen/generated/ios/swift/Func_void_BLEDevice.swift +0 -47
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// JFunc_void_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 <functional>
|
|
15
|
-
#include "JBLEDevice.hpp"
|
|
16
|
-
#include <string>
|
|
17
|
-
#include "ManufacturerData.hpp"
|
|
18
|
-
#include "JManufacturerData.hpp"
|
|
19
|
-
#include "ManufacturerDataEntry.hpp"
|
|
20
|
-
#include <vector>
|
|
21
|
-
#include "JManufacturerDataEntry.hpp"
|
|
22
|
-
#include <NitroModules/ArrayBuffer.hpp>
|
|
23
|
-
#include <NitroModules/JArrayBuffer.hpp>
|
|
24
|
-
#include <NitroModules/JUnit.hpp>
|
|
25
|
-
|
|
26
|
-
namespace margelo::nitro::co::zyke::ble {
|
|
27
|
-
|
|
28
|
-
using namespace facebook;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Represents the Java/Kotlin callback `(device: BLEDevice) -> Unit`.
|
|
32
|
-
* This can be passed around between C++ and Java/Kotlin.
|
|
33
|
-
*/
|
|
34
|
-
struct JFunc_void_BLEDevice: public jni::JavaClass<JFunc_void_BLEDevice> {
|
|
35
|
-
public:
|
|
36
|
-
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/co/zyke/ble/Func_void_BLEDevice;";
|
|
37
|
-
|
|
38
|
-
public:
|
|
39
|
-
/**
|
|
40
|
-
* Invokes the function this `JFunc_void_BLEDevice` instance holds through JNI.
|
|
41
|
-
*/
|
|
42
|
-
void invoke(const BLEDevice& device) const {
|
|
43
|
-
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JBLEDevice> /* device */)>("invoke");
|
|
44
|
-
method(self(), JBLEDevice::fromCpp(device));
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* An implementation of Func_void_BLEDevice that is backed by a C++ implementation (using `std::function<...>`)
|
|
50
|
-
*/
|
|
51
|
-
struct JFunc_void_BLEDevice_cxx final: public jni::HybridClass<JFunc_void_BLEDevice_cxx, JFunc_void_BLEDevice> {
|
|
52
|
-
public:
|
|
53
|
-
static jni::local_ref<JFunc_void_BLEDevice::javaobject> fromCpp(const std::function<void(const BLEDevice& /* device */)>& func) {
|
|
54
|
-
return JFunc_void_BLEDevice_cxx::newObjectCxxArgs(func);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
public:
|
|
58
|
-
/**
|
|
59
|
-
* Invokes the C++ `std::function<...>` this `JFunc_void_BLEDevice_cxx` instance holds.
|
|
60
|
-
*/
|
|
61
|
-
void invoke_cxx(jni::alias_ref<JBLEDevice> device) {
|
|
62
|
-
_func(device->toCpp());
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
public:
|
|
66
|
-
[[nodiscard]]
|
|
67
|
-
inline const std::function<void(const BLEDevice& /* device */)>& getFunction() const {
|
|
68
|
-
return _func;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
public:
|
|
72
|
-
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/co/zyke/ble/Func_void_BLEDevice_cxx;";
|
|
73
|
-
static void registerNatives() {
|
|
74
|
-
registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_BLEDevice_cxx::invoke_cxx)});
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
private:
|
|
78
|
-
explicit JFunc_void_BLEDevice_cxx(const std::function<void(const BLEDevice& /* device */)>& func): _func(func) { }
|
|
79
|
-
|
|
80
|
-
private:
|
|
81
|
-
friend HybridBase;
|
|
82
|
-
std::function<void(const BLEDevice& /* device */)> _func;
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
} // namespace margelo::nitro::co::zyke::ble
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// Func_void_BLEDevice.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 `(_ device: BLEDevice) -> 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_BLEDevice {
|
|
16
|
-
public typealias bridge = margelo.nitro.co.zyke.ble.bridge.swift
|
|
17
|
-
|
|
18
|
-
private let closure: (_ device: BLEDevice) -> Void
|
|
19
|
-
|
|
20
|
-
public init(_ closure: @escaping (_ device: BLEDevice) -> Void) {
|
|
21
|
-
self.closure = closure
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
@inline(__always)
|
|
25
|
-
public func call(device: BLEDevice) -> Void {
|
|
26
|
-
self.closure(device)
|
|
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_BLEDevice`.
|
|
40
|
-
* The pointer has to be a retained opaque `Unmanaged<Func_void_BLEDevice>`.
|
|
41
|
-
* This removes one strong reference from the object!
|
|
42
|
-
*/
|
|
43
|
-
@inline(__always)
|
|
44
|
-
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_BLEDevice {
|
|
45
|
-
return Unmanaged<Func_void_BLEDevice>.fromOpaque(pointer).takeRetainedValue()
|
|
46
|
-
}
|
|
47
|
-
}
|