react-native-ble-nitro 1.0.0 → 1.1.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 (40) hide show
  1. package/README.md +19 -15
  2. package/ios/BleNitroBleManager.swift +77 -43
  3. package/lib/commonjs/index.d.ts +15 -13
  4. package/lib/commonjs/index.d.ts.map +1 -1
  5. package/lib/commonjs/index.js +76 -139
  6. package/lib/commonjs/index.js.map +1 -1
  7. package/lib/commonjs/specs/NativeBleNitro.nitro.d.ts +13 -10
  8. package/lib/commonjs/specs/NativeBleNitro.nitro.d.ts.map +1 -1
  9. package/lib/index.d.ts +15 -13
  10. package/lib/index.js +75 -138
  11. package/lib/specs/NativeBleNitro.nitro.d.ts +13 -10
  12. package/nitrogen/generated/android/BleNitroOnLoad.cpp +2 -8
  13. package/nitrogen/generated/android/c++/JHybridNativeBleNitroSpec.cpp +90 -49
  14. package/nitrogen/generated/android/c++/JHybridNativeBleNitroSpec.hpp +9 -10
  15. package/nitrogen/generated/android/c++/JOperationResult.hpp +58 -0
  16. package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/HybridNativeBleNitroSpec.kt +11 -60
  17. package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/OperationResult.kt +32 -0
  18. package/nitrogen/generated/ios/BleNitro-Swift-Cxx-Bridge.cpp +5 -29
  19. package/nitrogen/generated/ios/BleNitro-Swift-Cxx-Bridge.hpp +69 -78
  20. package/nitrogen/generated/ios/BleNitro-Swift-Cxx-Umbrella.hpp +3 -0
  21. package/nitrogen/generated/ios/c++/HybridNativeBleNitroSpecSwift.hpp +39 -24
  22. package/nitrogen/generated/ios/swift/HybridNativeBleNitroSpec.swift +9 -10
  23. package/nitrogen/generated/ios/swift/HybridNativeBleNitroSpec_cxx.swift +60 -112
  24. package/nitrogen/generated/ios/swift/OperationResult.swift +64 -0
  25. package/nitrogen/generated/shared/c++/HybridNativeBleNitroSpec.cpp +0 -1
  26. package/nitrogen/generated/shared/c++/HybridNativeBleNitroSpec.hpp +13 -11
  27. package/nitrogen/generated/shared/c++/OperationResult.hpp +72 -0
  28. package/package.json +1 -1
  29. package/src/__tests__/index.test.ts +19 -22
  30. package/src/index.ts +100 -156
  31. package/src/specs/NativeBleNitro.nitro.ts +14 -10
  32. package/nitrogen/generated/android/c++/JFunc_void_bool.hpp +0 -74
  33. package/nitrogen/generated/android/c++/JFunc_void_std__vector_BLEDevice_.hpp +0 -99
  34. package/nitrogen/generated/android/c++/JFunc_void_std__vector_std__string_.hpp +0 -93
  35. package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/Func_void_bool.kt +0 -81
  36. package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/Func_void_std__vector_BLEDevice_.kt +0 -81
  37. package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/Func_void_std__vector_std__string_.kt +0 -81
  38. package/nitrogen/generated/ios/swift/Func_void_bool.swift +0 -47
  39. package/nitrogen/generated/ios/swift/Func_void_std__vector_BLEDevice_.swift +0 -47
  40. package/nitrogen/generated/ios/swift/Func_void_std__vector_std__string_.swift +0 -47
@@ -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
- }
@@ -1,47 +0,0 @@
1
- ///
2
- /// Func_void_std__vector_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 `(_ devices: [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_std__vector_BLEDevice_ {
16
- public typealias bridge = margelo.nitro.co.zyke.ble.bridge.swift
17
-
18
- private let closure: (_ devices: [BLEDevice]) -> Void
19
-
20
- public init(_ closure: @escaping (_ devices: [BLEDevice]) -> Void) {
21
- self.closure = closure
22
- }
23
-
24
- @inline(__always)
25
- public func call(devices: bridge.std__vector_BLEDevice_) -> Void {
26
- self.closure(devices.map({ __item in __item }))
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_std__vector_BLEDevice_`.
40
- * The pointer has to be a retained opaque `Unmanaged<Func_void_std__vector_BLEDevice_>`.
41
- * This removes one strong reference from the object!
42
- */
43
- @inline(__always)
44
- public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__vector_BLEDevice_ {
45
- return Unmanaged<Func_void_std__vector_BLEDevice_>.fromOpaque(pointer).takeRetainedValue()
46
- }
47
- }
@@ -1,47 +0,0 @@
1
- ///
2
- /// Func_void_std__vector_std__string_.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: [String]) -> 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_std__vector_std__string_ {
16
- public typealias bridge = margelo.nitro.co.zyke.ble.bridge.swift
17
-
18
- private let closure: (_ result: [String]) -> Void
19
-
20
- public init(_ closure: @escaping (_ result: [String]) -> Void) {
21
- self.closure = closure
22
- }
23
-
24
- @inline(__always)
25
- public func call(result: bridge.std__vector_std__string_) -> Void {
26
- self.closure(result.map({ __item in String(__item) }))
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_std__vector_std__string_`.
40
- * The pointer has to be a retained opaque `Unmanaged<Func_void_std__vector_std__string_>`.
41
- * This removes one strong reference from the object!
42
- */
43
- @inline(__always)
44
- public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__vector_std__string_ {
45
- return Unmanaged<Func_void_std__vector_std__string_>.fromOpaque(pointer).takeRetainedValue()
46
- }
47
- }