react-native-ble-nitro 1.9.2 → 1.9.4
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 +2 -2
- package/ios/BleNitroBleManager.swift +2 -2
- package/lib/commonjs/manager.d.ts +1 -0
- package/lib/commonjs/manager.d.ts.map +1 -1
- package/lib/commonjs/manager.js +2 -0
- package/lib/commonjs/manager.js.map +1 -1
- package/lib/manager.d.ts +1 -0
- package/lib/manager.js +1 -0
- package/nitrogen/generated/android/BleNitro+autolinking.cmake +3 -1
- package/nitrogen/generated/android/BleNitro+autolinking.gradle +1 -1
- package/nitrogen/generated/android/BleNitroOnLoad.cpp +3 -3
- package/nitrogen/generated/android/BleNitroOnLoad.hpp +1 -1
- package/nitrogen/generated/android/c++/JAndroidScanMode.hpp +5 -6
- package/nitrogen/generated/android/c++/JBLEDevice.hpp +8 -4
- package/nitrogen/generated/android/c++/JBLEState.hpp +7 -8
- package/nitrogen/generated/android/c++/JFunc_void_BLEState.hpp +3 -2
- package/nitrogen/generated/android/c++/JFunc_void_bool_double_std__string.hpp +3 -2
- package/nitrogen/generated/android/c++/JFunc_void_bool_std__shared_ptr_ArrayBuffer__std__string.hpp +3 -3
- package/nitrogen/generated/android/c++/JFunc_void_bool_std__string.hpp +3 -2
- package/nitrogen/generated/android/c++/JFunc_void_bool_std__string_std__string.hpp +3 -2
- package/nitrogen/generated/android/c++/JFunc_void_std__optional_std__variant_nitro__NullType__BLEDevice___std__optional_std__variant_nitro__NullType__std__string__.hpp +91 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__string_bool_std__string.hpp +3 -2
- package/nitrogen/generated/android/c++/JFunc_void_std__string_std__shared_ptr_ArrayBuffer_.hpp +3 -3
- package/nitrogen/generated/android/c++/JFunc_void_std__vector_BLEDevice_.hpp +5 -4
- package/nitrogen/generated/android/c++/JHybridNativeBleNitroFactorySpec.cpp +15 -4
- package/nitrogen/generated/android/c++/JHybridNativeBleNitroFactorySpec.hpp +3 -1
- package/nitrogen/generated/android/c++/JHybridNativeBleNitroSpec.cpp +27 -9
- package/nitrogen/generated/android/c++/JHybridNativeBleNitroSpec.hpp +4 -2
- package/nitrogen/generated/android/c++/JManufacturerData.hpp +8 -4
- package/nitrogen/generated/android/c++/JManufacturerDataEntry.hpp +6 -3
- package/nitrogen/generated/android/c++/JOperationResult.hpp +6 -2
- package/nitrogen/generated/android/c++/JScanFilter.hpp +8 -3
- package/nitrogen/generated/android/c++/JVariant_NullType_BLEDevice.cpp +26 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_BLEDevice.hpp +79 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_String.cpp +26 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_String.hpp +70 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/AndroidScanMode.kt +3 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/BLEDevice.kt +34 -25
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/BLEState.kt +3 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/BleNitroOnLoad.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/Func_void_BLEState.kt +1 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/Func_void_bool_double_std__string.kt +1 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/Func_void_bool_std__shared_ptr_ArrayBuffer__std__string.kt +2 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/Func_void_bool_std__string.kt +1 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/Func_void_bool_std__string_std__string.kt +1 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/{Func_void_std__optional_BLEDevice__std__optional_std__string_.kt → Func_void_std__optional_std__variant_nitro__NullType__BLEDevice___std__optional_std__variant_nitro__NullType__std__string__.kt} +11 -12
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/Func_void_std__string_bool_std__string.kt +1 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/Func_void_std__string_std__shared_ptr_ArrayBuffer_.kt +2 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/Func_void_std__vector_BLEDevice_.kt +1 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/HybridNativeBleNitroFactorySpec.kt +8 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/HybridNativeBleNitroSpec.kt +13 -5
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/ManufacturerData.kt +16 -7
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/ManufacturerDataEntry.kt +20 -11
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/OperationResult.kt +19 -10
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/ScanFilter.kt +25 -16
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/Variant_NullType_BLEDevice.kt +59 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/Variant_NullType_String.kt +59 -0
- package/nitrogen/generated/ios/BleNitro+autolinking.rb +2 -2
- package/nitrogen/generated/ios/BleNitro-Swift-Cxx-Bridge.cpp +6 -5
- package/nitrogen/generated/ios/BleNitro-Swift-Cxx-Bridge.hpp +99 -27
- package/nitrogen/generated/ios/BleNitro-Swift-Cxx-Umbrella.hpp +3 -3
- package/nitrogen/generated/ios/BleNitroAutolinking.mm +1 -1
- package/nitrogen/generated/ios/BleNitroAutolinking.swift +13 -15
- package/nitrogen/generated/ios/c++/HybridNativeBleNitroFactorySpecSwift.cpp +1 -1
- package/nitrogen/generated/ios/c++/HybridNativeBleNitroFactorySpecSwift.hpp +10 -3
- package/nitrogen/generated/ios/c++/HybridNativeBleNitroSpecSwift.cpp +1 -1
- package/nitrogen/generated/ios/c++/HybridNativeBleNitroSpecSwift.hpp +13 -4
- package/nitrogen/generated/ios/swift/AndroidScanMode.swift +1 -1
- package/nitrogen/generated/ios/swift/BLEDevice.swift +15 -63
- package/nitrogen/generated/ios/swift/BLEState.swift +1 -1
- package/nitrogen/generated/ios/swift/Func_void.swift +1 -2
- package/nitrogen/generated/ios/swift/Func_void_BLEState.swift +1 -2
- package/nitrogen/generated/ios/swift/Func_void_bool_double_std__string.swift +1 -2
- package/nitrogen/generated/ios/swift/Func_void_bool_std__shared_ptr_ArrayBuffer__std__string.swift +1 -2
- package/nitrogen/generated/ios/swift/Func_void_bool_std__string.swift +1 -2
- package/nitrogen/generated/ios/swift/Func_void_bool_std__string_std__string.swift +1 -2
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +1 -2
- package/nitrogen/generated/ios/swift/Func_void_std__optional_std__variant_nitro__NullType__BLEDevice___std__optional_std__variant_nitro__NullType__std__string__.swift +84 -0
- package/nitrogen/generated/ios/swift/Func_void_std__string_bool_std__string.swift +1 -2
- package/nitrogen/generated/ios/swift/Func_void_std__string_std__shared_ptr_ArrayBuffer_.swift +1 -2
- package/nitrogen/generated/ios/swift/Func_void_std__vector_BLEDevice_.swift +1 -2
- package/nitrogen/generated/ios/swift/HybridNativeBleNitroFactorySpec.swift +10 -4
- package/nitrogen/generated/ios/swift/HybridNativeBleNitroFactorySpec_cxx.swift +18 -3
- package/nitrogen/generated/ios/swift/HybridNativeBleNitroSpec.swift +11 -5
- package/nitrogen/generated/ios/swift/HybridNativeBleNitroSpec_cxx.swift +48 -12
- package/nitrogen/generated/ios/swift/ManufacturerData.swift +3 -15
- package/nitrogen/generated/ios/swift/ManufacturerDataEntry.swift +5 -17
- package/nitrogen/generated/ios/swift/OperationResult.swift +12 -30
- package/nitrogen/generated/ios/swift/ScanFilter.swift +9 -39
- package/nitrogen/generated/ios/swift/Variant_NullType_BLEDevice.swift +18 -0
- package/nitrogen/generated/ios/swift/Variant_NullType_String.swift +18 -0
- package/nitrogen/generated/shared/c++/AndroidScanMode.hpp +1 -1
- package/nitrogen/generated/shared/c++/BLEDevice.hpp +31 -23
- package/nitrogen/generated/shared/c++/BLEState.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridNativeBleNitroFactorySpec.cpp +1 -1
- package/nitrogen/generated/shared/c++/HybridNativeBleNitroFactorySpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridNativeBleNitroSpec.cpp +1 -1
- package/nitrogen/generated/shared/c++/HybridNativeBleNitroSpec.hpp +4 -4
- package/nitrogen/generated/shared/c++/ManufacturerData.hpp +13 -5
- package/nitrogen/generated/shared/c++/ManufacturerDataEntry.hpp +17 -10
- package/nitrogen/generated/shared/c++/OperationResult.hpp +16 -8
- package/nitrogen/generated/shared/c++/ScanFilter.hpp +22 -14
- package/package.json +10 -10
- package/src/manager.ts +2 -1
- package/nitrogen/generated/android/c++/JFunc_void_std__optional_BLEDevice__std__optional_std__string_.hpp +0 -86
- package/nitrogen/generated/ios/swift/Func_void_std__optional_BLEDevice__std__optional_std__string_.swift +0 -54
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// ManufacturerDataEntry.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
import NitroModules
|
|
@@ -22,25 +22,13 @@ public extension ManufacturerDataEntry {
|
|
|
22
22
|
self.init(std.string(id), data.getArrayBuffer())
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
@inline(__always)
|
|
25
26
|
var id: String {
|
|
26
|
-
|
|
27
|
-
get {
|
|
28
|
-
return String(self.__id)
|
|
29
|
-
}
|
|
30
|
-
@inline(__always)
|
|
31
|
-
set {
|
|
32
|
-
self.__id = std.string(newValue)
|
|
33
|
-
}
|
|
27
|
+
return String(self.__id)
|
|
34
28
|
}
|
|
35
29
|
|
|
30
|
+
@inline(__always)
|
|
36
31
|
var data: ArrayBuffer {
|
|
37
|
-
|
|
38
|
-
get {
|
|
39
|
-
return ArrayBuffer(self.__data)
|
|
40
|
-
}
|
|
41
|
-
@inline(__always)
|
|
42
|
-
set {
|
|
43
|
-
self.__data = newValue.getArrayBuffer()
|
|
44
|
-
}
|
|
32
|
+
return ArrayBuffer(self.__data)
|
|
45
33
|
}
|
|
46
34
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// OperationResult.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
import NitroModules
|
|
@@ -28,38 +28,20 @@ public extension OperationResult {
|
|
|
28
28
|
}())
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
@inline(__always)
|
|
31
32
|
var success: Bool {
|
|
32
|
-
|
|
33
|
-
get {
|
|
34
|
-
return self.__success
|
|
35
|
-
}
|
|
36
|
-
@inline(__always)
|
|
37
|
-
set {
|
|
38
|
-
self.__success = newValue
|
|
39
|
-
}
|
|
33
|
+
return self.__success
|
|
40
34
|
}
|
|
41
35
|
|
|
36
|
+
@inline(__always)
|
|
42
37
|
var error: String? {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
}()
|
|
53
|
-
}
|
|
54
|
-
@inline(__always)
|
|
55
|
-
set {
|
|
56
|
-
self.__error = { () -> bridge.std__optional_std__string_ in
|
|
57
|
-
if let __unwrappedValue = newValue {
|
|
58
|
-
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
59
|
-
} else {
|
|
60
|
-
return .init()
|
|
61
|
-
}
|
|
62
|
-
}()
|
|
63
|
-
}
|
|
38
|
+
return { () -> String? in
|
|
39
|
+
if bridge.has_value_std__optional_std__string_(self.__error) {
|
|
40
|
+
let __unwrapped = bridge.get_std__optional_std__string_(self.__error)
|
|
41
|
+
return String(__unwrapped)
|
|
42
|
+
} else {
|
|
43
|
+
return nil
|
|
44
|
+
}
|
|
45
|
+
}()
|
|
64
46
|
}
|
|
65
47
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// ScanFilter.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
import NitroModules
|
|
@@ -28,53 +28,23 @@ public extension ScanFilter {
|
|
|
28
28
|
}(), rssiThreshold, allowDuplicates, androidScanMode)
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
@inline(__always)
|
|
31
32
|
var serviceUUIDs: [String] {
|
|
32
|
-
|
|
33
|
-
get {
|
|
34
|
-
return self.__serviceUUIDs.map({ __item in String(__item) })
|
|
35
|
-
}
|
|
36
|
-
@inline(__always)
|
|
37
|
-
set {
|
|
38
|
-
self.__serviceUUIDs = { () -> bridge.std__vector_std__string_ in
|
|
39
|
-
var __vector = bridge.create_std__vector_std__string_(newValue.count)
|
|
40
|
-
for __item in newValue {
|
|
41
|
-
__vector.push_back(std.string(__item))
|
|
42
|
-
}
|
|
43
|
-
return __vector
|
|
44
|
-
}()
|
|
45
|
-
}
|
|
33
|
+
return self.__serviceUUIDs.map({ __item in String(__item) })
|
|
46
34
|
}
|
|
47
35
|
|
|
36
|
+
@inline(__always)
|
|
48
37
|
var rssiThreshold: Double {
|
|
49
|
-
|
|
50
|
-
get {
|
|
51
|
-
return self.__rssiThreshold
|
|
52
|
-
}
|
|
53
|
-
@inline(__always)
|
|
54
|
-
set {
|
|
55
|
-
self.__rssiThreshold = newValue
|
|
56
|
-
}
|
|
38
|
+
return self.__rssiThreshold
|
|
57
39
|
}
|
|
58
40
|
|
|
41
|
+
@inline(__always)
|
|
59
42
|
var allowDuplicates: Bool {
|
|
60
|
-
|
|
61
|
-
get {
|
|
62
|
-
return self.__allowDuplicates
|
|
63
|
-
}
|
|
64
|
-
@inline(__always)
|
|
65
|
-
set {
|
|
66
|
-
self.__allowDuplicates = newValue
|
|
67
|
-
}
|
|
43
|
+
return self.__allowDuplicates
|
|
68
44
|
}
|
|
69
45
|
|
|
46
|
+
@inline(__always)
|
|
70
47
|
var androidScanMode: AndroidScanMode {
|
|
71
|
-
|
|
72
|
-
get {
|
|
73
|
-
return self.__androidScanMode
|
|
74
|
-
}
|
|
75
|
-
@inline(__always)
|
|
76
|
-
set {
|
|
77
|
-
self.__androidScanMode = newValue
|
|
78
|
-
}
|
|
48
|
+
return self.__androidScanMode
|
|
79
49
|
}
|
|
80
50
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Variant_NullType_BLEDevice.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* An Swift enum with associated values representing a Variant/Union type.
|
|
12
|
+
* JS type: `null | struct`
|
|
13
|
+
*/
|
|
14
|
+
@frozen
|
|
15
|
+
public indirect enum Variant_NullType_BLEDevice {
|
|
16
|
+
case first(NullType)
|
|
17
|
+
case second(BLEDevice)
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Variant_NullType_String.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* An Swift enum with associated values representing a Variant/Union type.
|
|
12
|
+
* JS type: `null | string`
|
|
13
|
+
*/
|
|
14
|
+
@frozen
|
|
15
|
+
public enum Variant_NullType_String {
|
|
16
|
+
case first(NullType)
|
|
17
|
+
case second(String)
|
|
18
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// BLEDevice.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
@@ -22,6 +22,11 @@
|
|
|
22
22
|
#else
|
|
23
23
|
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
24
|
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
25
30
|
|
|
26
31
|
// Forward declaration of `ManufacturerData` to properly resolve imports.
|
|
27
32
|
namespace margelo::nitro::co::zyke::ble { struct ManufacturerData; }
|
|
@@ -35,7 +40,7 @@ namespace margelo::nitro::co::zyke::ble {
|
|
|
35
40
|
/**
|
|
36
41
|
* A struct which can be represented as a JavaScript object (BLEDevice).
|
|
37
42
|
*/
|
|
38
|
-
struct BLEDevice {
|
|
43
|
+
struct BLEDevice final {
|
|
39
44
|
public:
|
|
40
45
|
std::string id SWIFT_PRIVATE;
|
|
41
46
|
std::string name SWIFT_PRIVATE;
|
|
@@ -48,6 +53,9 @@ namespace margelo::nitro::co::zyke::ble {
|
|
|
48
53
|
public:
|
|
49
54
|
BLEDevice() = default;
|
|
50
55
|
explicit BLEDevice(std::string id, std::string name, double rssi, ManufacturerData manufacturerData, std::vector<std::string> serviceUUIDs, bool isConnectable, bool isConnected): id(id), name(name), rssi(rssi), manufacturerData(manufacturerData), serviceUUIDs(serviceUUIDs), isConnectable(isConnectable), isConnected(isConnected) {}
|
|
56
|
+
|
|
57
|
+
public:
|
|
58
|
+
friend bool operator==(const BLEDevice& lhs, const BLEDevice& rhs) = default;
|
|
51
59
|
};
|
|
52
60
|
|
|
53
61
|
} // namespace margelo::nitro::co::zyke::ble
|
|
@@ -60,24 +68,24 @@ namespace margelo::nitro {
|
|
|
60
68
|
static inline margelo::nitro::co::zyke::ble::BLEDevice fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
61
69
|
jsi::Object obj = arg.asObject(runtime);
|
|
62
70
|
return margelo::nitro::co::zyke::ble::BLEDevice(
|
|
63
|
-
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "id")),
|
|
64
|
-
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "name")),
|
|
65
|
-
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "rssi")),
|
|
66
|
-
JSIConverter<margelo::nitro::co::zyke::ble::ManufacturerData>::fromJSI(runtime, obj.getProperty(runtime, "manufacturerData")),
|
|
67
|
-
JSIConverter<std::vector<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "serviceUUIDs")),
|
|
68
|
-
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, "isConnectable")),
|
|
69
|
-
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, "isConnected"))
|
|
71
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "id"))),
|
|
72
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "name"))),
|
|
73
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rssi"))),
|
|
74
|
+
JSIConverter<margelo::nitro::co::zyke::ble::ManufacturerData>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "manufacturerData"))),
|
|
75
|
+
JSIConverter<std::vector<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "serviceUUIDs"))),
|
|
76
|
+
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isConnectable"))),
|
|
77
|
+
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isConnected")))
|
|
70
78
|
);
|
|
71
79
|
}
|
|
72
80
|
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::co::zyke::ble::BLEDevice& arg) {
|
|
73
81
|
jsi::Object obj(runtime);
|
|
74
|
-
obj.setProperty(runtime, "id", JSIConverter<std::string>::toJSI(runtime, arg.id));
|
|
75
|
-
obj.setProperty(runtime, "name", JSIConverter<std::string>::toJSI(runtime, arg.name));
|
|
76
|
-
obj.setProperty(runtime, "rssi", JSIConverter<double>::toJSI(runtime, arg.rssi));
|
|
77
|
-
obj.setProperty(runtime, "manufacturerData", JSIConverter<margelo::nitro::co::zyke::ble::ManufacturerData>::toJSI(runtime, arg.manufacturerData));
|
|
78
|
-
obj.setProperty(runtime, "serviceUUIDs", JSIConverter<std::vector<std::string>>::toJSI(runtime, arg.serviceUUIDs));
|
|
79
|
-
obj.setProperty(runtime, "isConnectable", JSIConverter<bool>::toJSI(runtime, arg.isConnectable));
|
|
80
|
-
obj.setProperty(runtime, "isConnected", JSIConverter<bool>::toJSI(runtime, arg.isConnected));
|
|
82
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "id"), JSIConverter<std::string>::toJSI(runtime, arg.id));
|
|
83
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "name"), JSIConverter<std::string>::toJSI(runtime, arg.name));
|
|
84
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "rssi"), JSIConverter<double>::toJSI(runtime, arg.rssi));
|
|
85
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "manufacturerData"), JSIConverter<margelo::nitro::co::zyke::ble::ManufacturerData>::toJSI(runtime, arg.manufacturerData));
|
|
86
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "serviceUUIDs"), JSIConverter<std::vector<std::string>>::toJSI(runtime, arg.serviceUUIDs));
|
|
87
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "isConnectable"), JSIConverter<bool>::toJSI(runtime, arg.isConnectable));
|
|
88
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "isConnected"), JSIConverter<bool>::toJSI(runtime, arg.isConnected));
|
|
81
89
|
return obj;
|
|
82
90
|
}
|
|
83
91
|
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
@@ -88,13 +96,13 @@ namespace margelo::nitro {
|
|
|
88
96
|
if (!nitro::isPlainObject(runtime, obj)) {
|
|
89
97
|
return false;
|
|
90
98
|
}
|
|
91
|
-
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "id"))) return false;
|
|
92
|
-
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "name"))) return false;
|
|
93
|
-
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "rssi"))) return false;
|
|
94
|
-
if (!JSIConverter<margelo::nitro::co::zyke::ble::ManufacturerData>::canConvert(runtime, obj.getProperty(runtime, "manufacturerData"))) return false;
|
|
95
|
-
if (!JSIConverter<std::vector<std::string>>::canConvert(runtime, obj.getProperty(runtime, "serviceUUIDs"))) return false;
|
|
96
|
-
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, "isConnectable"))) return false;
|
|
97
|
-
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, "isConnected"))) return false;
|
|
99
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "id")))) return false;
|
|
100
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "name")))) return false;
|
|
101
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rssi")))) return false;
|
|
102
|
+
if (!JSIConverter<margelo::nitro::co::zyke::ble::ManufacturerData>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "manufacturerData")))) return false;
|
|
103
|
+
if (!JSIConverter<std::vector<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "serviceUUIDs")))) return false;
|
|
104
|
+
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isConnectable")))) return false;
|
|
105
|
+
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isConnected")))) return false;
|
|
98
106
|
return true;
|
|
99
107
|
}
|
|
100
108
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridNativeBleNitroFactorySpec.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#include "HybridNativeBleNitroFactorySpec.hpp"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridNativeBleNitroSpec.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#include "HybridNativeBleNitroSpec.hpp"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridNativeBleNitroSpec.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
@@ -17,8 +17,6 @@
|
|
|
17
17
|
namespace margelo::nitro::co::zyke::ble { struct BLEDevice; }
|
|
18
18
|
// Forward declaration of `ScanFilter` to properly resolve imports.
|
|
19
19
|
namespace margelo::nitro::co::zyke::ble { struct ScanFilter; }
|
|
20
|
-
// Forward declaration of `ArrayBuffer` to properly resolve imports.
|
|
21
|
-
namespace NitroModules { class ArrayBuffer; }
|
|
22
20
|
// Forward declaration of `BLEState` to properly resolve imports.
|
|
23
21
|
namespace margelo::nitro::co::zyke::ble { enum class BLEState; }
|
|
24
22
|
// Forward declaration of `OperationResult` to properly resolve imports.
|
|
@@ -30,6 +28,8 @@ namespace margelo::nitro::co::zyke::ble { struct OperationResult; }
|
|
|
30
28
|
#include <vector>
|
|
31
29
|
#include <functional>
|
|
32
30
|
#include "ScanFilter.hpp"
|
|
31
|
+
#include <NitroModules/Null.hpp>
|
|
32
|
+
#include <variant>
|
|
33
33
|
#include <NitroModules/ArrayBuffer.hpp>
|
|
34
34
|
#include "BLEState.hpp"
|
|
35
35
|
#include "OperationResult.hpp"
|
|
@@ -68,7 +68,7 @@ namespace margelo::nitro::co::zyke::ble {
|
|
|
68
68
|
public:
|
|
69
69
|
// Methods
|
|
70
70
|
virtual void setRestoreStateCallback(const std::function<void(const std::vector<BLEDevice>& /* restoredPeripherals */)>& callback) = 0;
|
|
71
|
-
virtual void startScan(const ScanFilter& filter, const std::function<void(const std::optional<BLEDevice
|
|
71
|
+
virtual void startScan(const ScanFilter& filter, const std::function<void(const std::optional<std::variant<nitro::NullType, BLEDevice>>& /* device */, const std::optional<std::variant<nitro::NullType, std::string>>& /* error */)>& callback) = 0;
|
|
72
72
|
virtual bool stopScan() = 0;
|
|
73
73
|
virtual bool isScanning() = 0;
|
|
74
74
|
virtual std::vector<BLEDevice> getConnectedDevices(const std::vector<std::string>& services) = 0;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// ManufacturerData.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
@@ -22,6 +22,11 @@
|
|
|
22
22
|
#else
|
|
23
23
|
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
24
|
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
25
30
|
|
|
26
31
|
// Forward declaration of `ManufacturerDataEntry` to properly resolve imports.
|
|
27
32
|
namespace margelo::nitro::co::zyke::ble { struct ManufacturerDataEntry; }
|
|
@@ -34,13 +39,16 @@ namespace margelo::nitro::co::zyke::ble {
|
|
|
34
39
|
/**
|
|
35
40
|
* A struct which can be represented as a JavaScript object (ManufacturerData).
|
|
36
41
|
*/
|
|
37
|
-
struct ManufacturerData {
|
|
42
|
+
struct ManufacturerData final {
|
|
38
43
|
public:
|
|
39
44
|
std::vector<ManufacturerDataEntry> companyIdentifiers SWIFT_PRIVATE;
|
|
40
45
|
|
|
41
46
|
public:
|
|
42
47
|
ManufacturerData() = default;
|
|
43
48
|
explicit ManufacturerData(std::vector<ManufacturerDataEntry> companyIdentifiers): companyIdentifiers(companyIdentifiers) {}
|
|
49
|
+
|
|
50
|
+
public:
|
|
51
|
+
friend bool operator==(const ManufacturerData& lhs, const ManufacturerData& rhs) = default;
|
|
44
52
|
};
|
|
45
53
|
|
|
46
54
|
} // namespace margelo::nitro::co::zyke::ble
|
|
@@ -53,12 +61,12 @@ namespace margelo::nitro {
|
|
|
53
61
|
static inline margelo::nitro::co::zyke::ble::ManufacturerData fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
54
62
|
jsi::Object obj = arg.asObject(runtime);
|
|
55
63
|
return margelo::nitro::co::zyke::ble::ManufacturerData(
|
|
56
|
-
JSIConverter<std::vector<margelo::nitro::co::zyke::ble::ManufacturerDataEntry>>::fromJSI(runtime, obj.getProperty(runtime, "companyIdentifiers"))
|
|
64
|
+
JSIConverter<std::vector<margelo::nitro::co::zyke::ble::ManufacturerDataEntry>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "companyIdentifiers")))
|
|
57
65
|
);
|
|
58
66
|
}
|
|
59
67
|
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::co::zyke::ble::ManufacturerData& arg) {
|
|
60
68
|
jsi::Object obj(runtime);
|
|
61
|
-
obj.setProperty(runtime, "companyIdentifiers", JSIConverter<std::vector<margelo::nitro::co::zyke::ble::ManufacturerDataEntry>>::toJSI(runtime, arg.companyIdentifiers));
|
|
69
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "companyIdentifiers"), JSIConverter<std::vector<margelo::nitro::co::zyke::ble::ManufacturerDataEntry>>::toJSI(runtime, arg.companyIdentifiers));
|
|
62
70
|
return obj;
|
|
63
71
|
}
|
|
64
72
|
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
@@ -69,7 +77,7 @@ namespace margelo::nitro {
|
|
|
69
77
|
if (!nitro::isPlainObject(runtime, obj)) {
|
|
70
78
|
return false;
|
|
71
79
|
}
|
|
72
|
-
if (!JSIConverter<std::vector<margelo::nitro::co::zyke::ble::ManufacturerDataEntry>>::canConvert(runtime, obj.getProperty(runtime, "companyIdentifiers"))) return false;
|
|
80
|
+
if (!JSIConverter<std::vector<margelo::nitro::co::zyke::ble::ManufacturerDataEntry>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "companyIdentifiers")))) return false;
|
|
73
81
|
return true;
|
|
74
82
|
}
|
|
75
83
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// ManufacturerDataEntry.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
@@ -22,9 +22,13 @@
|
|
|
22
22
|
#else
|
|
23
23
|
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
24
|
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
25
31
|
|
|
26
|
-
// Forward declaration of `ArrayBuffer` to properly resolve imports.
|
|
27
|
-
namespace NitroModules { class ArrayBuffer; }
|
|
28
32
|
|
|
29
33
|
#include <string>
|
|
30
34
|
#include <NitroModules/ArrayBuffer.hpp>
|
|
@@ -34,7 +38,7 @@ namespace margelo::nitro::co::zyke::ble {
|
|
|
34
38
|
/**
|
|
35
39
|
* A struct which can be represented as a JavaScript object (ManufacturerDataEntry).
|
|
36
40
|
*/
|
|
37
|
-
struct ManufacturerDataEntry {
|
|
41
|
+
struct ManufacturerDataEntry final {
|
|
38
42
|
public:
|
|
39
43
|
std::string id SWIFT_PRIVATE;
|
|
40
44
|
std::shared_ptr<ArrayBuffer> data SWIFT_PRIVATE;
|
|
@@ -42,6 +46,9 @@ namespace margelo::nitro::co::zyke::ble {
|
|
|
42
46
|
public:
|
|
43
47
|
ManufacturerDataEntry() = default;
|
|
44
48
|
explicit ManufacturerDataEntry(std::string id, std::shared_ptr<ArrayBuffer> data): id(id), data(data) {}
|
|
49
|
+
|
|
50
|
+
public:
|
|
51
|
+
friend bool operator==(const ManufacturerDataEntry& lhs, const ManufacturerDataEntry& rhs) = default;
|
|
45
52
|
};
|
|
46
53
|
|
|
47
54
|
} // namespace margelo::nitro::co::zyke::ble
|
|
@@ -54,14 +61,14 @@ namespace margelo::nitro {
|
|
|
54
61
|
static inline margelo::nitro::co::zyke::ble::ManufacturerDataEntry fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
55
62
|
jsi::Object obj = arg.asObject(runtime);
|
|
56
63
|
return margelo::nitro::co::zyke::ble::ManufacturerDataEntry(
|
|
57
|
-
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "id")),
|
|
58
|
-
JSIConverter<std::shared_ptr<ArrayBuffer>>::fromJSI(runtime, obj.getProperty(runtime, "data"))
|
|
64
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "id"))),
|
|
65
|
+
JSIConverter<std::shared_ptr<ArrayBuffer>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "data")))
|
|
59
66
|
);
|
|
60
67
|
}
|
|
61
68
|
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::co::zyke::ble::ManufacturerDataEntry& arg) {
|
|
62
69
|
jsi::Object obj(runtime);
|
|
63
|
-
obj.setProperty(runtime, "id", JSIConverter<std::string>::toJSI(runtime, arg.id));
|
|
64
|
-
obj.setProperty(runtime, "data", JSIConverter<std::shared_ptr<ArrayBuffer>>::toJSI(runtime, arg.data));
|
|
70
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "id"), JSIConverter<std::string>::toJSI(runtime, arg.id));
|
|
71
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "data"), JSIConverter<std::shared_ptr<ArrayBuffer>>::toJSI(runtime, arg.data));
|
|
65
72
|
return obj;
|
|
66
73
|
}
|
|
67
74
|
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
@@ -72,8 +79,8 @@ namespace margelo::nitro {
|
|
|
72
79
|
if (!nitro::isPlainObject(runtime, obj)) {
|
|
73
80
|
return false;
|
|
74
81
|
}
|
|
75
|
-
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "id"))) return false;
|
|
76
|
-
if (!JSIConverter<std::shared_ptr<ArrayBuffer>>::canConvert(runtime, obj.getProperty(runtime, "data"))) return false;
|
|
82
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "id")))) return false;
|
|
83
|
+
if (!JSIConverter<std::shared_ptr<ArrayBuffer>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "data")))) return false;
|
|
77
84
|
return true;
|
|
78
85
|
}
|
|
79
86
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// OperationResult.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
@@ -22,6 +22,11 @@
|
|
|
22
22
|
#else
|
|
23
23
|
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
24
|
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
25
30
|
|
|
26
31
|
|
|
27
32
|
|
|
@@ -33,7 +38,7 @@ namespace margelo::nitro::co::zyke::ble {
|
|
|
33
38
|
/**
|
|
34
39
|
* A struct which can be represented as a JavaScript object (OperationResult).
|
|
35
40
|
*/
|
|
36
|
-
struct OperationResult {
|
|
41
|
+
struct OperationResult final {
|
|
37
42
|
public:
|
|
38
43
|
bool success SWIFT_PRIVATE;
|
|
39
44
|
std::optional<std::string> error SWIFT_PRIVATE;
|
|
@@ -41,6 +46,9 @@ namespace margelo::nitro::co::zyke::ble {
|
|
|
41
46
|
public:
|
|
42
47
|
OperationResult() = default;
|
|
43
48
|
explicit OperationResult(bool success, std::optional<std::string> error): success(success), error(error) {}
|
|
49
|
+
|
|
50
|
+
public:
|
|
51
|
+
friend bool operator==(const OperationResult& lhs, const OperationResult& rhs) = default;
|
|
44
52
|
};
|
|
45
53
|
|
|
46
54
|
} // namespace margelo::nitro::co::zyke::ble
|
|
@@ -53,14 +61,14 @@ namespace margelo::nitro {
|
|
|
53
61
|
static inline margelo::nitro::co::zyke::ble::OperationResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
54
62
|
jsi::Object obj = arg.asObject(runtime);
|
|
55
63
|
return margelo::nitro::co::zyke::ble::OperationResult(
|
|
56
|
-
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, "success")),
|
|
57
|
-
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "error"))
|
|
64
|
+
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "success"))),
|
|
65
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "error")))
|
|
58
66
|
);
|
|
59
67
|
}
|
|
60
68
|
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::co::zyke::ble::OperationResult& arg) {
|
|
61
69
|
jsi::Object obj(runtime);
|
|
62
|
-
obj.setProperty(runtime, "success", JSIConverter<bool>::toJSI(runtime, arg.success));
|
|
63
|
-
obj.setProperty(runtime, "error", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.error));
|
|
70
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "success"), JSIConverter<bool>::toJSI(runtime, arg.success));
|
|
71
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "error"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.error));
|
|
64
72
|
return obj;
|
|
65
73
|
}
|
|
66
74
|
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
@@ -71,8 +79,8 @@ namespace margelo::nitro {
|
|
|
71
79
|
if (!nitro::isPlainObject(runtime, obj)) {
|
|
72
80
|
return false;
|
|
73
81
|
}
|
|
74
|
-
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, "success"))) return false;
|
|
75
|
-
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "error"))) return false;
|
|
82
|
+
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "success")))) return false;
|
|
83
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "error")))) return false;
|
|
76
84
|
return true;
|
|
77
85
|
}
|
|
78
86
|
};
|