react-native-ble-nitro 1.0.0-beta.8 → 1.0.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/BleNitro.podspec +39 -0
- package/LICENSE +1 -1
- package/README.md +273 -77
- package/ios/BleNitroBleManager.swift +425 -464
- package/ios/BlePeripheralDelegate.swift +174 -0
- package/lib/commonjs/index.d.ts +174 -10
- package/lib/commonjs/index.d.ts.map +1 -1
- package/lib/commonjs/index.js +461 -38
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/specs/NativeBleNitro.d.ts +5 -0
- package/lib/commonjs/specs/NativeBleNitro.d.ts.map +1 -0
- package/lib/commonjs/{utils/index.js → specs/NativeBleNitro.js} +6 -3
- package/lib/commonjs/specs/NativeBleNitro.js.map +1 -0
- package/lib/commonjs/specs/NativeBleNitro.nitro.d.ts +69 -0
- package/lib/commonjs/specs/NativeBleNitro.nitro.d.ts.map +1 -0
- package/lib/commonjs/specs/NativeBleNitro.nitro.js +14 -0
- package/lib/commonjs/specs/NativeBleNitro.nitro.js.map +1 -0
- package/lib/index.d.ts +174 -10
- package/lib/index.js +456 -16
- package/lib/specs/NativeBleNitro.d.ts +4 -0
- package/lib/specs/NativeBleNitro.js +5 -0
- package/lib/specs/NativeBleNitro.nitro.d.ts +68 -0
- package/lib/specs/NativeBleNitro.nitro.js +10 -0
- package/nitro.json +1 -1
- package/nitrogen/generated/android/BleNitro+autolinking.cmake +2 -10
- package/nitrogen/generated/android/BleNitroOnLoad.cpp +25 -22
- package/nitrogen/generated/android/c++/JBLEDevice.hpp +95 -0
- package/nitrogen/generated/android/c++/{JState.hpp → JBLEState.hpp} +22 -22
- package/nitrogen/generated/android/c++/JFunc_void_BLEDevice.hpp +82 -0
- package/nitrogen/generated/android/c++/JFunc_void_BLEState.hpp +76 -0
- package/nitrogen/generated/android/c++/JFunc_void_bool.hpp +74 -0
- package/nitrogen/generated/android/c++/JFunc_void_bool_std__string.hpp +75 -0
- package/nitrogen/generated/android/c++/JFunc_void_bool_std__string_std__string.hpp +75 -0
- package/nitrogen/generated/android/c++/JFunc_void_bool_std__vector_double__std__string.hpp +86 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__string_bool_std__string.hpp +75 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__string_std__vector_double_.hpp +86 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__vector_BLEDevice_.hpp +99 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__vector_std__string_.hpp +93 -0
- package/nitrogen/generated/android/c++/JHybridNativeBleNitroSpec.cpp +171 -0
- package/nitrogen/generated/android/c++/JHybridNativeBleNitroSpec.hpp +83 -0
- package/nitrogen/generated/android/c++/JManufacturerData.hpp +73 -0
- package/nitrogen/generated/android/c++/JManufacturerDataEntry.hpp +68 -0
- package/nitrogen/generated/android/c++/JScanFilter.hpp +79 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/BLEDevice.kt +44 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/{LogLevel.kt → BLEState.kt} +9 -13
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/{Func_void_std__optional_NativeBleError__std__optional_NativeDevice_.kt → Func_void_BLEDevice.kt} +15 -14
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/{Func_void.kt → Func_void_BLEState.kt} +15 -14
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/{Func_void_State.kt → Func_void_bool.kt} +15 -14
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/{Func_void_std__optional_NativeBleError__std__optional_NativeCharacteristic_.kt → Func_void_bool_std__string.kt} +15 -14
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/Func_void_bool_std__string_std__string.kt +81 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/Func_void_bool_std__vector_double__std__string.kt +81 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/Func_void_std__string_bool_std__string.kt +81 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/Func_void_std__string_std__vector_double_.kt +81 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/Func_void_std__vector_BLEDevice_.kt +81 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/Func_void_std__vector_std__string_.kt +81 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/HybridNativeBleNitroSpec.kt +223 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/{ServiceDataEntry.kt → ManufacturerData.kt} +7 -5
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/{ConnectionOptions.kt → ManufacturerDataEntry.kt} +10 -6
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/{NativeService.kt → ScanFilter.kt} +13 -7
- package/nitrogen/generated/ios/BleNitro-Swift-Cxx-Bridge.cpp +67 -175
- package/nitrogen/generated/ios/BleNitro-Swift-Cxx-Bridge.hpp +205 -867
- package/nitrogen/generated/ios/BleNitro-Swift-Cxx-Umbrella.hpp +20 -88
- package/nitrogen/generated/ios/BleNitroAutolinking.mm +3 -3
- package/nitrogen/generated/ios/BleNitroAutolinking.swift +4 -4
- package/nitrogen/generated/ios/c++/{HybridCharacteristicSpecSwift.cpp → HybridNativeBleNitroSpecSwift.cpp} +2 -2
- package/nitrogen/generated/ios/c++/HybridNativeBleNitroSpecSwift.hpp +205 -0
- package/nitrogen/generated/ios/swift/BLEDevice.swift +102 -0
- package/nitrogen/generated/ios/swift/{State.swift → BLEState.swift} +6 -6
- package/nitrogen/generated/ios/swift/Func_void.swift +1 -0
- package/nitrogen/generated/ios/swift/{Func_void_State.swift → Func_void_BLEDevice.swift} +12 -11
- package/nitrogen/generated/ios/swift/{Func_void_LogLevel.swift → Func_void_BLEState.swift} +12 -11
- package/nitrogen/generated/ios/swift/Func_void_bool.swift +6 -5
- package/nitrogen/generated/ios/swift/{Func_void_NativeDescriptor.swift → Func_void_bool_std__string.swift} +12 -11
- package/nitrogen/generated/ios/swift/{Func_void_std__vector_NativeCharacteristic_.swift → Func_void_bool_std__string_std__string.swift} +12 -11
- package/nitrogen/generated/ios/swift/Func_void_bool_std__vector_double__std__string.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +1 -0
- package/nitrogen/generated/ios/swift/{Func_void_NativeDevice.swift → Func_void_std__string_bool_std__string.swift} +12 -11
- package/nitrogen/generated/ios/swift/{Func_void_std__optional_BleRestoredState_.swift → Func_void_std__string_std__vector_double_.swift} +12 -17
- package/nitrogen/generated/ios/swift/{Func_void_NativeCharacteristic.swift → Func_void_std__vector_BLEDevice_.swift} +12 -11
- package/nitrogen/generated/ios/swift/{Func_void_std__vector_NativeDevice_.swift → Func_void_std__vector_std__string_.swift} +12 -11
- package/nitrogen/generated/ios/swift/HybridNativeBleNitroSpec.swift +68 -0
- package/nitrogen/generated/ios/swift/HybridNativeBleNitroSpec_cxx.swift +485 -0
- package/nitrogen/generated/ios/swift/ManufacturerData.swift +47 -0
- package/nitrogen/generated/ios/swift/ManufacturerDataEntry.swift +58 -0
- package/nitrogen/generated/ios/swift/ScanFilter.swift +69 -0
- package/nitrogen/generated/shared/c++/BLEDevice.hpp +90 -0
- package/nitrogen/generated/shared/c++/{State.hpp → BLEState.hpp} +13 -15
- package/nitrogen/generated/shared/c++/HybridNativeBleNitroSpec.cpp +40 -0
- package/nitrogen/generated/shared/c++/HybridNativeBleNitroSpec.hpp +93 -0
- package/nitrogen/generated/shared/c++/ManufacturerData.hpp +69 -0
- package/nitrogen/generated/shared/c++/{ServiceDataEntry.hpp → ManufacturerDataEntry.hpp} +19 -20
- package/nitrogen/generated/shared/c++/ScanFilter.hpp +76 -0
- package/package.json +9 -11
- package/react-native.config.js +2 -7
- package/src/__tests__/index.test.ts +188 -0
- package/src/index.ts +604 -45
- package/src/specs/NativeBleNitro.nitro.ts +84 -0
- package/src/specs/NativeBleNitro.ts +8 -0
- package/android/build.gradle +0 -58
- package/android/src/main/AndroidManifest.xml +0 -23
- package/android/src/main/kotlin/com/margelo/nitro/co/zyke/ble/BleNitroBleManager.kt +0 -760
- package/ios/BleNitro.podspec +0 -44
- package/ios/BleNitroModule.swift +0 -24
- package/lib/BleManagerCompatFactory.d.ts +0 -55
- package/lib/BleManagerCompatFactory.js +0 -194
- package/lib/BleManagerFactory.d.ts +0 -30
- package/lib/BleManagerFactory.js +0 -73
- package/lib/commonjs/BleManagerCompatFactory.d.ts +0 -56
- package/lib/commonjs/BleManagerCompatFactory.d.ts.map +0 -1
- package/lib/commonjs/BleManagerCompatFactory.js +0 -201
- package/lib/commonjs/BleManagerCompatFactory.js.map +0 -1
- package/lib/commonjs/BleManagerFactory.d.ts +0 -31
- package/lib/commonjs/BleManagerFactory.d.ts.map +0 -1
- package/lib/commonjs/BleManagerFactory.js +0 -81
- package/lib/commonjs/BleManagerFactory.js.map +0 -1
- package/lib/commonjs/compatibility/constants.d.ts +0 -50
- package/lib/commonjs/compatibility/constants.d.ts.map +0 -1
- package/lib/commonjs/compatibility/constants.js +0 -58
- package/lib/commonjs/compatibility/constants.js.map +0 -1
- package/lib/commonjs/compatibility/deviceWrapper.d.ts +0 -100
- package/lib/commonjs/compatibility/deviceWrapper.d.ts.map +0 -1
- package/lib/commonjs/compatibility/deviceWrapper.js +0 -268
- package/lib/commonjs/compatibility/deviceWrapper.js.map +0 -1
- package/lib/commonjs/compatibility/enums.d.ts +0 -39
- package/lib/commonjs/compatibility/enums.d.ts.map +0 -1
- package/lib/commonjs/compatibility/enums.js +0 -179
- package/lib/commonjs/compatibility/enums.js.map +0 -1
- package/lib/commonjs/compatibility/index.d.ts +0 -13
- package/lib/commonjs/compatibility/index.d.ts.map +0 -1
- package/lib/commonjs/compatibility/index.js +0 -41
- package/lib/commonjs/compatibility/index.js.map +0 -1
- package/lib/commonjs/compatibility/serviceData.d.ts +0 -52
- package/lib/commonjs/compatibility/serviceData.d.ts.map +0 -1
- package/lib/commonjs/compatibility/serviceData.js +0 -80
- package/lib/commonjs/compatibility/serviceData.js.map +0 -1
- package/lib/commonjs/errors/BleError.d.ts +0 -60
- package/lib/commonjs/errors/BleError.d.ts.map +0 -1
- package/lib/commonjs/errors/BleError.js +0 -125
- package/lib/commonjs/errors/BleError.js.map +0 -1
- package/lib/commonjs/specs/BleManager.nitro.d.ts +0 -45
- package/lib/commonjs/specs/BleManager.nitro.d.ts.map +0 -1
- package/lib/commonjs/specs/BleManager.nitro.js +0 -3
- package/lib/commonjs/specs/BleManager.nitro.js.map +0 -1
- package/lib/commonjs/specs/Characteristic.nitro.d.ts +0 -27
- package/lib/commonjs/specs/Characteristic.nitro.d.ts.map +0 -1
- package/lib/commonjs/specs/Characteristic.nitro.js +0 -3
- package/lib/commonjs/specs/Characteristic.nitro.js.map +0 -1
- package/lib/commonjs/specs/Descriptor.nitro.d.ts +0 -18
- package/lib/commonjs/specs/Descriptor.nitro.d.ts.map +0 -1
- package/lib/commonjs/specs/Descriptor.nitro.js +0 -3
- package/lib/commonjs/specs/Descriptor.nitro.js.map +0 -1
- package/lib/commonjs/specs/Device.nitro.d.ts +0 -38
- package/lib/commonjs/specs/Device.nitro.d.ts.map +0 -1
- package/lib/commonjs/specs/Device.nitro.js +0 -3
- package/lib/commonjs/specs/Device.nitro.js.map +0 -1
- package/lib/commonjs/specs/Service.nitro.d.ts +0 -20
- package/lib/commonjs/specs/Service.nitro.d.ts.map +0 -1
- package/lib/commonjs/specs/Service.nitro.js +0 -3
- package/lib/commonjs/specs/Service.nitro.js.map +0 -1
- package/lib/commonjs/specs/types.d.ts +0 -229
- package/lib/commonjs/specs/types.d.ts.map +0 -1
- package/lib/commonjs/specs/types.js +0 -150
- package/lib/commonjs/specs/types.js.map +0 -1
- package/lib/commonjs/utils/base64.d.ts +0 -26
- package/lib/commonjs/utils/base64.d.ts.map +0 -1
- package/lib/commonjs/utils/base64.js +0 -88
- package/lib/commonjs/utils/base64.js.map +0 -1
- package/lib/commonjs/utils/index.d.ts +0 -3
- package/lib/commonjs/utils/index.d.ts.map +0 -1
- package/lib/commonjs/utils/index.js.map +0 -1
- package/lib/commonjs/utils/uuid.d.ts +0 -10
- package/lib/commonjs/utils/uuid.d.ts.map +0 -1
- package/lib/commonjs/utils/uuid.js +0 -41
- package/lib/commonjs/utils/uuid.js.map +0 -1
- package/lib/compatibility/constants.d.ts +0 -49
- package/lib/compatibility/constants.js +0 -50
- package/lib/compatibility/deviceWrapper.d.ts +0 -99
- package/lib/compatibility/deviceWrapper.js +0 -259
- package/lib/compatibility/enums.d.ts +0 -38
- package/lib/compatibility/enums.js +0 -159
- package/lib/compatibility/index.d.ts +0 -12
- package/lib/compatibility/index.js +0 -12
- package/lib/compatibility/serviceData.d.ts +0 -51
- package/lib/compatibility/serviceData.js +0 -70
- package/lib/errors/BleError.d.ts +0 -59
- package/lib/errors/BleError.js +0 -120
- package/lib/specs/BleManager.nitro.d.ts +0 -44
- package/lib/specs/BleManager.nitro.js +0 -1
- package/lib/specs/Characteristic.nitro.d.ts +0 -26
- package/lib/specs/Characteristic.nitro.js +0 -1
- package/lib/specs/Descriptor.nitro.d.ts +0 -17
- package/lib/specs/Descriptor.nitro.js +0 -1
- package/lib/specs/Device.nitro.d.ts +0 -37
- package/lib/specs/Device.nitro.js +0 -1
- package/lib/specs/Service.nitro.d.ts +0 -19
- package/lib/specs/Service.nitro.js +0 -1
- package/lib/specs/types.d.ts +0 -228
- package/lib/specs/types.js +0 -146
- package/lib/utils/base64.d.ts +0 -25
- package/lib/utils/base64.js +0 -80
- package/lib/utils/index.d.ts +0 -2
- package/lib/utils/index.js +0 -2
- package/lib/utils/uuid.d.ts +0 -9
- package/lib/utils/uuid.js +0 -37
- package/nitrogen/generated/android/c++/JBleATTErrorCode.hpp +0 -107
- package/nitrogen/generated/android/c++/JBleAndroidErrorCode.hpp +0 -101
- package/nitrogen/generated/android/c++/JBleErrorCode.hpp +0 -170
- package/nitrogen/generated/android/c++/JBleIOSErrorCode.hpp +0 -92
- package/nitrogen/generated/android/c++/JBleManagerNitroOptions.hpp +0 -54
- package/nitrogen/generated/android/c++/JBleRestoredState.hpp +0 -76
- package/nitrogen/generated/android/c++/JCharacteristicSubscriptionType.hpp +0 -59
- package/nitrogen/generated/android/c++/JConnectionOptions.hpp +0 -61
- package/nitrogen/generated/android/c++/JConnectionPriority.hpp +0 -62
- package/nitrogen/generated/android/c++/JFunc_void.hpp +0 -74
- package/nitrogen/generated/android/c++/JFunc_void_State.hpp +0 -76
- package/nitrogen/generated/android/c++/JFunc_void_std__optional_NativeBleError__std__optional_NativeCharacteristic_.hpp +0 -88
- package/nitrogen/generated/android/c++/JFunc_void_std__optional_NativeBleError__std__optional_NativeDevice_.hpp +0 -91
- package/nitrogen/generated/android/c++/JHybridBleManagerSpec.cpp +0 -653
- package/nitrogen/generated/android/c++/JHybridBleManagerSpec.hpp +0 -92
- package/nitrogen/generated/android/c++/JHybridCharacteristicSpec.cpp +0 -253
- package/nitrogen/generated/android/c++/JHybridCharacteristicSpec.hpp +0 -79
- package/nitrogen/generated/android/c++/JHybridDescriptorSpec.cpp +0 -115
- package/nitrogen/generated/android/c++/JHybridDescriptorSpec.hpp +0 -70
- package/nitrogen/generated/android/c++/JHybridDeviceSpec.cpp +0 -476
- package/nitrogen/generated/android/c++/JHybridDeviceSpec.hpp +0 -90
- package/nitrogen/generated/android/c++/JHybridServiceSpec.cpp +0 -232
- package/nitrogen/generated/android/c++/JHybridServiceSpec.hpp +0 -72
- package/nitrogen/generated/android/c++/JLogLevel.hpp +0 -71
- package/nitrogen/generated/android/c++/JNativeBleError.hpp +0 -98
- package/nitrogen/generated/android/c++/JNativeCharacteristic.hpp +0 -98
- package/nitrogen/generated/android/c++/JNativeDescriptor.hpp +0 -82
- package/nitrogen/generated/android/c++/JNativeDevice.hpp +0 -173
- package/nitrogen/generated/android/c++/JNativeService.hpp +0 -65
- package/nitrogen/generated/android/c++/JScanCallbackType.hpp +0 -62
- package/nitrogen/generated/android/c++/JScanMode.hpp +0 -65
- package/nitrogen/generated/android/c++/JScanOptions.hpp +0 -69
- package/nitrogen/generated/android/c++/JServiceDataEntry.hpp +0 -57
- package/nitrogen/generated/android/c++/JSubscription.hpp +0 -64
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/BleATTErrorCode.kt +0 -41
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/BleAndroidErrorCode.kt +0 -39
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/BleErrorCode.kt +0 -62
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/BleIOSErrorCode.kt +0 -36
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/BleManagerNitroOptions.kt +0 -26
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/BleRestoredState.kt +0 -26
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/CharacteristicSubscriptionType.kt +0 -25
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/ConnectionPriority.kt +0 -26
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/HybridBleManagerSpec.kt +0 -192
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/HybridCharacteristicSpec.kt +0 -127
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/HybridDescriptorSpec.kt +0 -86
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/HybridDeviceSpec.kt +0 -176
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/HybridServiceSpec.kt +0 -99
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/NativeBleError.kt +0 -35
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/NativeCharacteristic.kt +0 -37
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/NativeDescriptor.kt +0 -33
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/NativeDevice.kt +0 -38
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/ScanCallbackType.kt +0 -26
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/ScanMode.kt +0 -27
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/ScanOptions.kt +0 -29
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/State.kt +0 -29
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/Subscription.kt +0 -30
- package/nitrogen/generated/ios/c++/HybridBleManagerSpecSwift.cpp +0 -11
- package/nitrogen/generated/ios/c++/HybridBleManagerSpecSwift.hpp +0 -377
- package/nitrogen/generated/ios/c++/HybridCharacteristicSpecSwift.hpp +0 -192
- package/nitrogen/generated/ios/c++/HybridDescriptorSpecSwift.cpp +0 -11
- package/nitrogen/generated/ios/c++/HybridDescriptorSpecSwift.hpp +0 -112
- package/nitrogen/generated/ios/c++/HybridDeviceSpecSwift.cpp +0 -11
- package/nitrogen/generated/ios/c++/HybridDeviceSpecSwift.hpp +0 -294
- package/nitrogen/generated/ios/c++/HybridServiceSpecSwift.cpp +0 -11
- package/nitrogen/generated/ios/c++/HybridServiceSpecSwift.hpp +0 -170
- package/nitrogen/generated/ios/swift/BleATTErrorCode.swift +0 -104
- package/nitrogen/generated/ios/swift/BleAndroidErrorCode.swift +0 -96
- package/nitrogen/generated/ios/swift/BleErrorCode.swift +0 -188
- package/nitrogen/generated/ios/swift/BleIOSErrorCode.swift +0 -84
- package/nitrogen/generated/ios/swift/BleManagerNitroOptions.swift +0 -53
- package/nitrogen/generated/ios/swift/BleRestoredState.swift +0 -47
- package/nitrogen/generated/ios/swift/CharacteristicSubscriptionType.swift +0 -40
- package/nitrogen/generated/ios/swift/ConnectionOptions.swift +0 -57
- package/nitrogen/generated/ios/swift/ConnectionPriority.swift +0 -44
- package/nitrogen/generated/ios/swift/Func_void_std__optional_NativeBleError__std__optional_NativeCharacteristic_.swift +0 -58
- package/nitrogen/generated/ios/swift/Func_void_std__optional_NativeBleError__std__optional_NativeDevice_.swift +0 -58
- package/nitrogen/generated/ios/swift/Func_void_std__shared_ptr_margelo__nitro__co__zyke__ble__HybridCharacteristicSpec_.swift +0 -50
- package/nitrogen/generated/ios/swift/Func_void_std__shared_ptr_margelo__nitro__co__zyke__ble__HybridDescriptorSpec_.swift +0 -50
- package/nitrogen/generated/ios/swift/Func_void_std__vector_NativeDescriptor_.swift +0 -46
- package/nitrogen/generated/ios/swift/Func_void_std__vector_NativeService_.swift +0 -46
- package/nitrogen/generated/ios/swift/HybridBleManagerSpec.swift +0 -78
- package/nitrogen/generated/ios/swift/HybridBleManagerSpec_cxx.swift +0 -852
- package/nitrogen/generated/ios/swift/HybridCharacteristicSpec.swift +0 -65
- package/nitrogen/generated/ios/swift/HybridCharacteristicSpec_cxx.swift +0 -384
- package/nitrogen/generated/ios/swift/HybridDescriptorSpec.swift +0 -56
- package/nitrogen/generated/ios/swift/HybridDescriptorSpec_cxx.swift +0 -218
- package/nitrogen/generated/ios/swift/HybridDeviceSpec.swift +0 -76
- package/nitrogen/generated/ios/swift/HybridDeviceSpec_cxx.swift +0 -702
- package/nitrogen/generated/ios/swift/HybridServiceSpec.swift +0 -58
- package/nitrogen/generated/ios/swift/HybridServiceSpec_cxx.swift +0 -338
- package/nitrogen/generated/ios/swift/LogLevel.swift +0 -56
- package/nitrogen/generated/ios/swift/NativeBleError.swift +0 -278
- package/nitrogen/generated/ios/swift/NativeCharacteristic.swift +0 -174
- package/nitrogen/generated/ios/swift/NativeDescriptor.swift +0 -130
- package/nitrogen/generated/ios/swift/NativeDevice.swift +0 -377
- package/nitrogen/generated/ios/swift/NativeService.swift +0 -68
- package/nitrogen/generated/ios/swift/ScanCallbackType.swift +0 -44
- package/nitrogen/generated/ios/swift/ScanMode.swift +0 -48
- package/nitrogen/generated/ios/swift/ScanOptions.swift +0 -116
- package/nitrogen/generated/ios/swift/ServiceDataEntry.swift +0 -46
- package/nitrogen/generated/ios/swift/Subscription.swift +0 -46
- package/nitrogen/generated/shared/c++/BleATTErrorCode.hpp +0 -80
- package/nitrogen/generated/shared/c++/BleAndroidErrorCode.hpp +0 -78
- package/nitrogen/generated/shared/c++/BleErrorCode.hpp +0 -101
- package/nitrogen/generated/shared/c++/BleIOSErrorCode.hpp +0 -75
- package/nitrogen/generated/shared/c++/BleManagerNitroOptions.hpp +0 -70
- package/nitrogen/generated/shared/c++/BleRestoredState.hpp +0 -71
- package/nitrogen/generated/shared/c++/CharacteristicSubscriptionType.hpp +0 -64
- package/nitrogen/generated/shared/c++/ConnectionOptions.hpp +0 -77
- package/nitrogen/generated/shared/c++/ConnectionPriority.hpp +0 -65
- package/nitrogen/generated/shared/c++/HybridBleManagerSpec.cpp +0 -51
- package/nitrogen/generated/shared/c++/HybridBleManagerSpec.hpp +0 -137
- package/nitrogen/generated/shared/c++/HybridCharacteristicSpec.cpp +0 -39
- package/nitrogen/generated/shared/c++/HybridCharacteristicSpec.hpp +0 -101
- package/nitrogen/generated/shared/c++/HybridDescriptorSpec.cpp +0 -30
- package/nitrogen/generated/shared/c++/HybridDescriptorSpec.hpp +0 -75
- package/nitrogen/generated/shared/c++/HybridDeviceSpec.cpp +0 -50
- package/nitrogen/generated/shared/c++/HybridDeviceSpec.hpp +0 -123
- package/nitrogen/generated/shared/c++/HybridServiceSpec.cpp +0 -32
- package/nitrogen/generated/shared/c++/HybridServiceSpec.hpp +0 -90
- package/nitrogen/generated/shared/c++/LogLevel.hpp +0 -68
- package/nitrogen/generated/shared/c++/NativeBleError.hpp +0 -117
- package/nitrogen/generated/shared/c++/NativeCharacteristic.hpp +0 -114
- package/nitrogen/generated/shared/c++/NativeDescriptor.hpp +0 -98
- package/nitrogen/generated/shared/c++/NativeDevice.hpp +0 -121
- package/nitrogen/generated/shared/c++/NativeService.hpp +0 -81
- package/nitrogen/generated/shared/c++/ScanCallbackType.hpp +0 -65
- package/nitrogen/generated/shared/c++/ScanMode.hpp +0 -66
- package/nitrogen/generated/shared/c++/ScanOptions.hpp +0 -86
- package/nitrogen/generated/shared/c++/Subscription.hpp +0 -69
- package/src/BleManagerCompatFactory.ts +0 -371
- package/src/BleManagerFactory.ts +0 -93
- package/src/__tests__/BleManager.test.ts +0 -327
- package/src/__tests__/compatibility/deviceWrapper.test.ts +0 -563
- package/src/__tests__/compatibility/enums.test.ts +0 -264
- package/src/compatibility/constants.ts +0 -71
- package/src/compatibility/deviceWrapper.ts +0 -427
- package/src/compatibility/enums.ts +0 -190
- package/src/compatibility/index.ts +0 -32
- package/src/compatibility/serviceData.ts +0 -85
- package/src/errors/BleError.ts +0 -193
- package/src/specs/BleManager.nitro.ts +0 -165
- package/src/specs/Characteristic.nitro.ts +0 -61
- package/src/specs/Descriptor.nitro.ts +0 -28
- package/src/specs/Device.nitro.ts +0 -104
- package/src/specs/Service.nitro.ts +0 -64
- package/src/specs/types.ts +0 -259
- package/src/utils/base64.ts +0 -80
- package/src/utils/index.ts +0 -2
- package/src/utils/uuid.ts +0 -45
|
@@ -8,86 +8,26 @@
|
|
|
8
8
|
#pragma once
|
|
9
9
|
|
|
10
10
|
// Forward declarations of C++ defined types
|
|
11
|
-
// Forward declaration of `
|
|
12
|
-
namespace margelo::nitro::co::zyke::ble {
|
|
13
|
-
// Forward declaration of `
|
|
14
|
-
namespace margelo::nitro::co::zyke::ble { enum class
|
|
15
|
-
// Forward declaration of `
|
|
16
|
-
namespace margelo::nitro::co::zyke::ble {
|
|
17
|
-
// Forward declaration of `
|
|
18
|
-
namespace margelo::nitro::co::zyke::ble {
|
|
19
|
-
// Forward declaration of `
|
|
20
|
-
namespace margelo::nitro::co::zyke::ble { struct
|
|
21
|
-
// Forward declaration of `
|
|
22
|
-
namespace margelo::nitro::co::zyke::ble { struct
|
|
23
|
-
// Forward declaration of `CharacteristicSubscriptionType` to properly resolve imports.
|
|
24
|
-
namespace margelo::nitro::co::zyke::ble { enum class CharacteristicSubscriptionType; }
|
|
25
|
-
// Forward declaration of `ConnectionOptions` to properly resolve imports.
|
|
26
|
-
namespace margelo::nitro::co::zyke::ble { struct ConnectionOptions; }
|
|
27
|
-
// Forward declaration of `ConnectionPriority` to properly resolve imports.
|
|
28
|
-
namespace margelo::nitro::co::zyke::ble { enum class ConnectionPriority; }
|
|
29
|
-
// Forward declaration of `HybridBleManagerSpec` to properly resolve imports.
|
|
30
|
-
namespace margelo::nitro::co::zyke::ble { class HybridBleManagerSpec; }
|
|
31
|
-
// Forward declaration of `HybridCharacteristicSpec` to properly resolve imports.
|
|
32
|
-
namespace margelo::nitro::co::zyke::ble { class HybridCharacteristicSpec; }
|
|
33
|
-
// Forward declaration of `HybridDescriptorSpec` to properly resolve imports.
|
|
34
|
-
namespace margelo::nitro::co::zyke::ble { class HybridDescriptorSpec; }
|
|
35
|
-
// Forward declaration of `HybridDeviceSpec` to properly resolve imports.
|
|
36
|
-
namespace margelo::nitro::co::zyke::ble { class HybridDeviceSpec; }
|
|
37
|
-
// Forward declaration of `HybridServiceSpec` to properly resolve imports.
|
|
38
|
-
namespace margelo::nitro::co::zyke::ble { class HybridServiceSpec; }
|
|
39
|
-
// Forward declaration of `LogLevel` to properly resolve imports.
|
|
40
|
-
namespace margelo::nitro::co::zyke::ble { enum class LogLevel; }
|
|
41
|
-
// Forward declaration of `NativeBleError` to properly resolve imports.
|
|
42
|
-
namespace margelo::nitro::co::zyke::ble { struct NativeBleError; }
|
|
43
|
-
// Forward declaration of `NativeCharacteristic` to properly resolve imports.
|
|
44
|
-
namespace margelo::nitro::co::zyke::ble { struct NativeCharacteristic; }
|
|
45
|
-
// Forward declaration of `NativeDescriptor` to properly resolve imports.
|
|
46
|
-
namespace margelo::nitro::co::zyke::ble { struct NativeDescriptor; }
|
|
47
|
-
// Forward declaration of `NativeDevice` to properly resolve imports.
|
|
48
|
-
namespace margelo::nitro::co::zyke::ble { struct NativeDevice; }
|
|
49
|
-
// Forward declaration of `NativeService` to properly resolve imports.
|
|
50
|
-
namespace margelo::nitro::co::zyke::ble { struct NativeService; }
|
|
51
|
-
// Forward declaration of `ScanCallbackType` to properly resolve imports.
|
|
52
|
-
namespace margelo::nitro::co::zyke::ble { enum class ScanCallbackType; }
|
|
53
|
-
// Forward declaration of `ScanMode` to properly resolve imports.
|
|
54
|
-
namespace margelo::nitro::co::zyke::ble { enum class ScanMode; }
|
|
55
|
-
// Forward declaration of `ScanOptions` to properly resolve imports.
|
|
56
|
-
namespace margelo::nitro::co::zyke::ble { struct ScanOptions; }
|
|
57
|
-
// Forward declaration of `ServiceDataEntry` to properly resolve imports.
|
|
58
|
-
namespace margelo::nitro::co::zyke::ble { struct ServiceDataEntry; }
|
|
59
|
-
// Forward declaration of `State` to properly resolve imports.
|
|
60
|
-
namespace margelo::nitro::co::zyke::ble { enum class State; }
|
|
61
|
-
// Forward declaration of `Subscription` to properly resolve imports.
|
|
62
|
-
namespace margelo::nitro::co::zyke::ble { struct Subscription; }
|
|
11
|
+
// Forward declaration of `BLEDevice` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::co::zyke::ble { struct BLEDevice; }
|
|
13
|
+
// Forward declaration of `BLEState` to properly resolve imports.
|
|
14
|
+
namespace margelo::nitro::co::zyke::ble { enum class BLEState; }
|
|
15
|
+
// Forward declaration of `HybridNativeBleNitroSpec` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::co::zyke::ble { class HybridNativeBleNitroSpec; }
|
|
17
|
+
// Forward declaration of `ManufacturerDataEntry` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::co::zyke::ble { struct ManufacturerDataEntry; }
|
|
19
|
+
// Forward declaration of `ManufacturerData` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::co::zyke::ble { struct ManufacturerData; }
|
|
21
|
+
// Forward declaration of `ScanFilter` to properly resolve imports.
|
|
22
|
+
namespace margelo::nitro::co::zyke::ble { struct ScanFilter; }
|
|
63
23
|
|
|
64
24
|
// Include C++ defined types
|
|
65
|
-
#include "
|
|
66
|
-
#include "
|
|
67
|
-
#include "
|
|
68
|
-
#include "
|
|
69
|
-
#include "
|
|
70
|
-
#include "
|
|
71
|
-
#include "CharacteristicSubscriptionType.hpp"
|
|
72
|
-
#include "ConnectionOptions.hpp"
|
|
73
|
-
#include "ConnectionPriority.hpp"
|
|
74
|
-
#include "HybridBleManagerSpec.hpp"
|
|
75
|
-
#include "HybridCharacteristicSpec.hpp"
|
|
76
|
-
#include "HybridDescriptorSpec.hpp"
|
|
77
|
-
#include "HybridDeviceSpec.hpp"
|
|
78
|
-
#include "HybridServiceSpec.hpp"
|
|
79
|
-
#include "LogLevel.hpp"
|
|
80
|
-
#include "NativeBleError.hpp"
|
|
81
|
-
#include "NativeCharacteristic.hpp"
|
|
82
|
-
#include "NativeDescriptor.hpp"
|
|
83
|
-
#include "NativeDevice.hpp"
|
|
84
|
-
#include "NativeService.hpp"
|
|
85
|
-
#include "ScanCallbackType.hpp"
|
|
86
|
-
#include "ScanMode.hpp"
|
|
87
|
-
#include "ScanOptions.hpp"
|
|
88
|
-
#include "ServiceDataEntry.hpp"
|
|
89
|
-
#include "State.hpp"
|
|
90
|
-
#include "Subscription.hpp"
|
|
25
|
+
#include "BLEDevice.hpp"
|
|
26
|
+
#include "BLEState.hpp"
|
|
27
|
+
#include "HybridNativeBleNitroSpec.hpp"
|
|
28
|
+
#include "ManufacturerData.hpp"
|
|
29
|
+
#include "ManufacturerDataEntry.hpp"
|
|
30
|
+
#include "ScanFilter.hpp"
|
|
91
31
|
#include <NitroModules/Promise.hpp>
|
|
92
32
|
#include <NitroModules/Result.hpp>
|
|
93
33
|
#include <exception>
|
|
@@ -107,16 +47,8 @@ namespace margelo::nitro::co::zyke::ble { struct Subscription; }
|
|
|
107
47
|
#include <NitroModules/DateToChronoDate.hpp>
|
|
108
48
|
|
|
109
49
|
// Forward declarations of Swift defined types
|
|
110
|
-
// Forward declaration of `
|
|
111
|
-
namespace BleNitro { class
|
|
112
|
-
// Forward declaration of `HybridCharacteristicSpec_cxx` to properly resolve imports.
|
|
113
|
-
namespace BleNitro { class HybridCharacteristicSpec_cxx; }
|
|
114
|
-
// Forward declaration of `HybridDescriptorSpec_cxx` to properly resolve imports.
|
|
115
|
-
namespace BleNitro { class HybridDescriptorSpec_cxx; }
|
|
116
|
-
// Forward declaration of `HybridDeviceSpec_cxx` to properly resolve imports.
|
|
117
|
-
namespace BleNitro { class HybridDeviceSpec_cxx; }
|
|
118
|
-
// Forward declaration of `HybridServiceSpec_cxx` to properly resolve imports.
|
|
119
|
-
namespace BleNitro { class HybridServiceSpec_cxx; }
|
|
50
|
+
// Forward declaration of `HybridNativeBleNitroSpec_cxx` to properly resolve imports.
|
|
51
|
+
namespace BleNitro { class HybridNativeBleNitroSpec_cxx; }
|
|
120
52
|
|
|
121
53
|
// Include Swift defined types
|
|
122
54
|
#if __has_include("BleNitro-Swift.h")
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
#import "BleNitro-Swift-Cxx-Umbrella.hpp"
|
|
11
11
|
#import <type_traits>
|
|
12
12
|
|
|
13
|
-
#include "
|
|
13
|
+
#include "HybridNativeBleNitroSpecSwift.hpp"
|
|
14
14
|
|
|
15
15
|
@interface BleNitroAutolinking : NSObject
|
|
16
16
|
@end
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
using namespace margelo::nitro::co::zyke::ble;
|
|
23
23
|
|
|
24
24
|
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
25
|
-
"
|
|
25
|
+
"NativeBleNitro",
|
|
26
26
|
[]() -> std::shared_ptr<HybridObject> {
|
|
27
|
-
std::shared_ptr<
|
|
27
|
+
std::shared_ptr<HybridNativeBleNitroSpec> hybridObject = BleNitro::BleNitroAutolinking::createNativeBleNitro();
|
|
28
28
|
return hybridObject;
|
|
29
29
|
}
|
|
30
30
|
);
|
|
@@ -9,15 +9,15 @@ public final class BleNitroAutolinking {
|
|
|
9
9
|
public typealias bridge = margelo.nitro.co.zyke.ble.bridge.swift
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* Creates an instance of a Swift class that implements `
|
|
13
|
-
* and wraps it in a Swift class that can directly interop with C++ (`
|
|
12
|
+
* Creates an instance of a Swift class that implements `HybridNativeBleNitroSpec`,
|
|
13
|
+
* and wraps it in a Swift class that can directly interop with C++ (`HybridNativeBleNitroSpec_cxx`)
|
|
14
14
|
*
|
|
15
15
|
* This is generated by Nitrogen and will initialize the class specified
|
|
16
16
|
* in the `"autolinking"` property of `nitro.json` (in this case, `BleNitroBleManager`).
|
|
17
17
|
*/
|
|
18
|
-
public static func
|
|
18
|
+
public static func createNativeBleNitro() -> bridge.std__shared_ptr_HybridNativeBleNitroSpec_ {
|
|
19
19
|
let hybridObject = BleNitroBleManager()
|
|
20
|
-
return { () -> bridge.
|
|
20
|
+
return { () -> bridge.std__shared_ptr_HybridNativeBleNitroSpec_ in
|
|
21
21
|
let __cxxWrapped = hybridObject.getCxxWrapper()
|
|
22
22
|
return __cxxWrapped.getCxxPart()
|
|
23
23
|
}()
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
///
|
|
2
|
-
///
|
|
2
|
+
/// HybridNativeBleNitroSpecSwift.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
5
|
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
|
-
#include "
|
|
8
|
+
#include "HybridNativeBleNitroSpecSwift.hpp"
|
|
9
9
|
|
|
10
10
|
namespace margelo::nitro::co::zyke::ble {
|
|
11
11
|
} // namespace margelo::nitro::co::zyke::ble
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNativeBleNitroSpecSwift.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 "HybridNativeBleNitroSpec.hpp"
|
|
11
|
+
|
|
12
|
+
// Forward declaration of `HybridNativeBleNitroSpec_cxx` to properly resolve imports.
|
|
13
|
+
namespace BleNitro { class HybridNativeBleNitroSpec_cxx; }
|
|
14
|
+
|
|
15
|
+
// Forward declaration of `ScanFilter` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::co::zyke::ble { struct ScanFilter; }
|
|
17
|
+
// Forward declaration of `BLEDevice` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::co::zyke::ble { struct BLEDevice; }
|
|
19
|
+
// Forward declaration of `ManufacturerData` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::co::zyke::ble { struct ManufacturerData; }
|
|
21
|
+
// Forward declaration of `ManufacturerDataEntry` to properly resolve imports.
|
|
22
|
+
namespace margelo::nitro::co::zyke::ble { struct ManufacturerDataEntry; }
|
|
23
|
+
// Forward declaration of `BLEState` to properly resolve imports.
|
|
24
|
+
namespace margelo::nitro::co::zyke::ble { enum class BLEState; }
|
|
25
|
+
|
|
26
|
+
#include "ScanFilter.hpp"
|
|
27
|
+
#include <string>
|
|
28
|
+
#include <vector>
|
|
29
|
+
#include "BLEDevice.hpp"
|
|
30
|
+
#include <functional>
|
|
31
|
+
#include "ManufacturerData.hpp"
|
|
32
|
+
#include "ManufacturerDataEntry.hpp"
|
|
33
|
+
#include <optional>
|
|
34
|
+
#include "BLEState.hpp"
|
|
35
|
+
#include <NitroModules/Promise.hpp>
|
|
36
|
+
|
|
37
|
+
#include "BleNitro-Swift-Cxx-Umbrella.hpp"
|
|
38
|
+
|
|
39
|
+
namespace margelo::nitro::co::zyke::ble {
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* The C++ part of HybridNativeBleNitroSpec_cxx.swift.
|
|
43
|
+
*
|
|
44
|
+
* HybridNativeBleNitroSpecSwift (C++) accesses HybridNativeBleNitroSpec_cxx (Swift), and might
|
|
45
|
+
* contain some additional bridging code for C++ <> Swift interop.
|
|
46
|
+
*
|
|
47
|
+
* Since this obviously introduces an overhead, I hope at some point in
|
|
48
|
+
* the future, HybridNativeBleNitroSpec_cxx can directly inherit from the C++ class HybridNativeBleNitroSpec
|
|
49
|
+
* to simplify the whole structure and memory management.
|
|
50
|
+
*/
|
|
51
|
+
class HybridNativeBleNitroSpecSwift: public virtual HybridNativeBleNitroSpec {
|
|
52
|
+
public:
|
|
53
|
+
// Constructor from a Swift instance
|
|
54
|
+
explicit HybridNativeBleNitroSpecSwift(const BleNitro::HybridNativeBleNitroSpec_cxx& swiftPart):
|
|
55
|
+
HybridObject(HybridNativeBleNitroSpec::TAG),
|
|
56
|
+
_swiftPart(swiftPart) { }
|
|
57
|
+
|
|
58
|
+
public:
|
|
59
|
+
// Get the Swift part
|
|
60
|
+
inline BleNitro::HybridNativeBleNitroSpec_cxx& getSwiftPart() noexcept {
|
|
61
|
+
return _swiftPart;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
public:
|
|
65
|
+
inline size_t getExternalMemorySize() noexcept override {
|
|
66
|
+
return _swiftPart.getMemorySize();
|
|
67
|
+
}
|
|
68
|
+
void dispose() noexcept override {
|
|
69
|
+
_swiftPart.dispose();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
public:
|
|
73
|
+
// Properties
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
public:
|
|
77
|
+
// Methods
|
|
78
|
+
inline void startScan(const ScanFilter& filter, const std::function<void(const BLEDevice& /* device */)>& callback) override {
|
|
79
|
+
auto __result = _swiftPart.startScan(filter, callback);
|
|
80
|
+
if (__result.hasError()) [[unlikely]] {
|
|
81
|
+
std::rethrow_exception(__result.error());
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
inline void stopScan(const std::function<void(bool /* success */, const std::string& /* error */)>& callback) override {
|
|
85
|
+
auto __result = _swiftPart.stopScan(callback);
|
|
86
|
+
if (__result.hasError()) [[unlikely]] {
|
|
87
|
+
std::rethrow_exception(__result.error());
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
inline void isScanning(const std::function<void(bool /* result */)>& callback) override {
|
|
91
|
+
auto __result = _swiftPart.isScanning(callback);
|
|
92
|
+
if (__result.hasError()) [[unlikely]] {
|
|
93
|
+
std::rethrow_exception(__result.error());
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
inline void getConnectedDevices(const std::function<void(const std::vector<BLEDevice>& /* devices */)>& callback) override {
|
|
97
|
+
auto __result = _swiftPart.getConnectedDevices(callback);
|
|
98
|
+
if (__result.hasError()) [[unlikely]] {
|
|
99
|
+
std::rethrow_exception(__result.error());
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
inline void connect(const std::string& deviceId, const std::function<void(bool /* success */, const std::string& /* deviceId */, const std::string& /* error */)>& callback, const std::optional<std::function<void(const std::string& /* deviceId */, bool /* interrupted */, const std::string& /* error */)>>& disconnectCallback) override {
|
|
103
|
+
auto __result = _swiftPart.connect(deviceId, callback, disconnectCallback);
|
|
104
|
+
if (__result.hasError()) [[unlikely]] {
|
|
105
|
+
std::rethrow_exception(__result.error());
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
inline void disconnect(const std::string& deviceId, const std::function<void(bool /* success */, const std::string& /* error */)>& callback) override {
|
|
109
|
+
auto __result = _swiftPart.disconnect(deviceId, callback);
|
|
110
|
+
if (__result.hasError()) [[unlikely]] {
|
|
111
|
+
std::rethrow_exception(__result.error());
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
inline void isConnected(const std::string& deviceId, const std::function<void(bool /* result */)>& callback) override {
|
|
115
|
+
auto __result = _swiftPart.isConnected(deviceId, callback);
|
|
116
|
+
if (__result.hasError()) [[unlikely]] {
|
|
117
|
+
std::rethrow_exception(__result.error());
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
inline void discoverServices(const std::string& deviceId, const std::function<void(bool /* success */, const std::string& /* error */)>& callback) override {
|
|
121
|
+
auto __result = _swiftPart.discoverServices(deviceId, callback);
|
|
122
|
+
if (__result.hasError()) [[unlikely]] {
|
|
123
|
+
std::rethrow_exception(__result.error());
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
inline void getServices(const std::string& deviceId, const std::function<void(const std::vector<std::string>& /* result */)>& callback) override {
|
|
127
|
+
auto __result = _swiftPart.getServices(deviceId, callback);
|
|
128
|
+
if (__result.hasError()) [[unlikely]] {
|
|
129
|
+
std::rethrow_exception(__result.error());
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
inline void getCharacteristics(const std::string& deviceId, const std::string& serviceId, const std::function<void(const std::vector<std::string>& /* result */)>& callback) override {
|
|
133
|
+
auto __result = _swiftPart.getCharacteristics(deviceId, serviceId, callback);
|
|
134
|
+
if (__result.hasError()) [[unlikely]] {
|
|
135
|
+
std::rethrow_exception(__result.error());
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
inline void readCharacteristic(const std::string& deviceId, const std::string& serviceId, const std::string& characteristicId, const std::function<void(bool /* success */, const std::vector<double>& /* data */, const std::string& /* error */)>& callback) override {
|
|
139
|
+
auto __result = _swiftPart.readCharacteristic(deviceId, serviceId, characteristicId, callback);
|
|
140
|
+
if (__result.hasError()) [[unlikely]] {
|
|
141
|
+
std::rethrow_exception(__result.error());
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
inline void writeCharacteristic(const std::string& deviceId, const std::string& serviceId, const std::string& characteristicId, const std::vector<double>& data, bool withResponse, const std::function<void(bool /* success */, const std::string& /* error */)>& callback) override {
|
|
145
|
+
auto __result = _swiftPart.writeCharacteristic(deviceId, serviceId, characteristicId, data, std::forward<decltype(withResponse)>(withResponse), callback);
|
|
146
|
+
if (__result.hasError()) [[unlikely]] {
|
|
147
|
+
std::rethrow_exception(__result.error());
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
inline void subscribeToCharacteristic(const std::string& deviceId, const std::string& serviceId, const std::string& characteristicId, const std::function<void(const std::string& /* characteristicId */, const std::vector<double>& /* data */)>& updateCallback, const std::function<void(bool /* success */, const std::string& /* error */)>& resultCallback) override {
|
|
151
|
+
auto __result = _swiftPart.subscribeToCharacteristic(deviceId, serviceId, characteristicId, updateCallback, resultCallback);
|
|
152
|
+
if (__result.hasError()) [[unlikely]] {
|
|
153
|
+
std::rethrow_exception(__result.error());
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
inline void unsubscribeFromCharacteristic(const std::string& deviceId, const std::string& serviceId, const std::string& characteristicId, const std::function<void(bool /* success */, const std::string& /* error */)>& callback) override {
|
|
157
|
+
auto __result = _swiftPart.unsubscribeFromCharacteristic(deviceId, serviceId, characteristicId, callback);
|
|
158
|
+
if (__result.hasError()) [[unlikely]] {
|
|
159
|
+
std::rethrow_exception(__result.error());
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
inline void isBluetoothEnabled(const std::function<void(bool /* result */)>& callback) override {
|
|
163
|
+
auto __result = _swiftPart.isBluetoothEnabled(callback);
|
|
164
|
+
if (__result.hasError()) [[unlikely]] {
|
|
165
|
+
std::rethrow_exception(__result.error());
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
inline void requestBluetoothEnable(const std::function<void(bool /* success */, const std::string& /* error */)>& callback) override {
|
|
169
|
+
auto __result = _swiftPart.requestBluetoothEnable(callback);
|
|
170
|
+
if (__result.hasError()) [[unlikely]] {
|
|
171
|
+
std::rethrow_exception(__result.error());
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
inline void state(const std::function<void(BLEState /* state */)>& callback) override {
|
|
175
|
+
auto __result = _swiftPart.state(callback);
|
|
176
|
+
if (__result.hasError()) [[unlikely]] {
|
|
177
|
+
std::rethrow_exception(__result.error());
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
inline void subscribeToStateChange(const std::function<void(BLEState /* state */)>& stateCallback, const std::function<void(bool /* success */, const std::string& /* error */)>& resultCallback) override {
|
|
181
|
+
auto __result = _swiftPart.subscribeToStateChange(stateCallback, resultCallback);
|
|
182
|
+
if (__result.hasError()) [[unlikely]] {
|
|
183
|
+
std::rethrow_exception(__result.error());
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
inline void unsubscribeFromStateChange(const std::function<void(bool /* success */, const std::string& /* error */)>& resultCallback) override {
|
|
187
|
+
auto __result = _swiftPart.unsubscribeFromStateChange(resultCallback);
|
|
188
|
+
if (__result.hasError()) [[unlikely]] {
|
|
189
|
+
std::rethrow_exception(__result.error());
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
inline std::shared_ptr<Promise<void>> openSettings() override {
|
|
193
|
+
auto __result = _swiftPart.openSettings();
|
|
194
|
+
if (__result.hasError()) [[unlikely]] {
|
|
195
|
+
std::rethrow_exception(__result.error());
|
|
196
|
+
}
|
|
197
|
+
auto __value = std::move(__result.value());
|
|
198
|
+
return __value;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
private:
|
|
202
|
+
BleNitro::HybridNativeBleNitroSpec_cxx _swiftPart;
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
} // namespace margelo::nitro::co::zyke::ble
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// 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
|
+
* Represents an instance of `BLEDevice`, backed by a C++ struct.
|
|
12
|
+
*/
|
|
13
|
+
public typealias BLEDevice = margelo.nitro.co.zyke.ble.BLEDevice
|
|
14
|
+
|
|
15
|
+
public extension BLEDevice {
|
|
16
|
+
private typealias bridge = margelo.nitro.co.zyke.ble.bridge.swift
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a new instance of `BLEDevice`.
|
|
20
|
+
*/
|
|
21
|
+
init(id: String, name: String, rssi: Double, manufacturerData: ManufacturerData, serviceUUIDs: [String], isConnectable: Bool) {
|
|
22
|
+
self.init(std.string(id), std.string(name), rssi, manufacturerData, { () -> bridge.std__vector_std__string_ in
|
|
23
|
+
var __vector = bridge.create_std__vector_std__string_(serviceUUIDs.count)
|
|
24
|
+
for __item in serviceUUIDs {
|
|
25
|
+
__vector.push_back(std.string(__item))
|
|
26
|
+
}
|
|
27
|
+
return __vector
|
|
28
|
+
}(), isConnectable)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
var id: String {
|
|
32
|
+
@inline(__always)
|
|
33
|
+
get {
|
|
34
|
+
return String(self.__id)
|
|
35
|
+
}
|
|
36
|
+
@inline(__always)
|
|
37
|
+
set {
|
|
38
|
+
self.__id = std.string(newValue)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
var name: String {
|
|
43
|
+
@inline(__always)
|
|
44
|
+
get {
|
|
45
|
+
return String(self.__name)
|
|
46
|
+
}
|
|
47
|
+
@inline(__always)
|
|
48
|
+
set {
|
|
49
|
+
self.__name = std.string(newValue)
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
var rssi: Double {
|
|
54
|
+
@inline(__always)
|
|
55
|
+
get {
|
|
56
|
+
return self.__rssi
|
|
57
|
+
}
|
|
58
|
+
@inline(__always)
|
|
59
|
+
set {
|
|
60
|
+
self.__rssi = newValue
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
var manufacturerData: ManufacturerData {
|
|
65
|
+
@inline(__always)
|
|
66
|
+
get {
|
|
67
|
+
return self.__manufacturerData
|
|
68
|
+
}
|
|
69
|
+
@inline(__always)
|
|
70
|
+
set {
|
|
71
|
+
self.__manufacturerData = newValue
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
var serviceUUIDs: [String] {
|
|
76
|
+
@inline(__always)
|
|
77
|
+
get {
|
|
78
|
+
return self.__serviceUUIDs.map({ __item in String(__item) })
|
|
79
|
+
}
|
|
80
|
+
@inline(__always)
|
|
81
|
+
set {
|
|
82
|
+
self.__serviceUUIDs = { () -> bridge.std__vector_std__string_ in
|
|
83
|
+
var __vector = bridge.create_std__vector_std__string_(newValue.count)
|
|
84
|
+
for __item in newValue {
|
|
85
|
+
__vector.push_back(std.string(__item))
|
|
86
|
+
}
|
|
87
|
+
return __vector
|
|
88
|
+
}()
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
var isConnectable: Bool {
|
|
93
|
+
@inline(__always)
|
|
94
|
+
get {
|
|
95
|
+
return self.__isConnectable
|
|
96
|
+
}
|
|
97
|
+
@inline(__always)
|
|
98
|
+
set {
|
|
99
|
+
self.__isConnectable = newValue
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
///
|
|
2
|
-
///
|
|
2
|
+
/// BLEState.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
5
|
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* Represents the JS enum `
|
|
9
|
+
* Represents the JS enum `BLEState`, backed by a C++ enum.
|
|
10
10
|
*/
|
|
11
|
-
public typealias
|
|
11
|
+
public typealias BLEState = margelo.nitro.co.zyke.ble.BLEState
|
|
12
12
|
|
|
13
|
-
public extension
|
|
13
|
+
public extension BLEState {
|
|
14
14
|
/**
|
|
15
|
-
* Get a
|
|
15
|
+
* Get a BLEState for the given String value, or
|
|
16
16
|
* return `nil` if the given value was invalid/unknown.
|
|
17
17
|
*/
|
|
18
18
|
init?(fromString string: String) {
|
|
@@ -35,7 +35,7 @@ public extension State {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
|
-
* Get the String value this
|
|
38
|
+
* Get the String value this BLEState represents.
|
|
39
39
|
*/
|
|
40
40
|
var stringValue: String {
|
|
41
41
|
switch self {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
///
|
|
2
|
-
///
|
|
2
|
+
/// Func_void_BLEDevice.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
5
|
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
@@ -7,22 +7,23 @@
|
|
|
7
7
|
|
|
8
8
|
import NitroModules
|
|
9
9
|
|
|
10
|
+
|
|
10
11
|
/**
|
|
11
|
-
* Wraps a Swift `(_
|
|
12
|
+
* Wraps a Swift `(_ device: BLEDevice) -> Void` as a class.
|
|
12
13
|
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
14
|
*/
|
|
14
|
-
public final class
|
|
15
|
+
public final class Func_void_BLEDevice {
|
|
15
16
|
public typealias bridge = margelo.nitro.co.zyke.ble.bridge.swift
|
|
16
17
|
|
|
17
|
-
private let closure: (_
|
|
18
|
+
private let closure: (_ device: BLEDevice) -> Void
|
|
18
19
|
|
|
19
|
-
public init(_ closure: @escaping (_
|
|
20
|
+
public init(_ closure: @escaping (_ device: BLEDevice) -> Void) {
|
|
20
21
|
self.closure = closure
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
@inline(__always)
|
|
24
|
-
public func call(
|
|
25
|
-
self.closure(
|
|
25
|
+
public func call(device: BLEDevice) -> Void {
|
|
26
|
+
self.closure(device)
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
/**
|
|
@@ -35,12 +36,12 @@ public final class Func_void_State {
|
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
/**
|
|
38
|
-
* Casts an unsafe pointer to a `
|
|
39
|
-
* The pointer has to be a retained opaque `Unmanaged<
|
|
39
|
+
* Casts an unsafe pointer to a `Func_void_BLEDevice`.
|
|
40
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_BLEDevice>`.
|
|
40
41
|
* This removes one strong reference from the object!
|
|
41
42
|
*/
|
|
42
43
|
@inline(__always)
|
|
43
|
-
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) ->
|
|
44
|
-
return Unmanaged<
|
|
44
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_BLEDevice {
|
|
45
|
+
return Unmanaged<Func_void_BLEDevice>.fromOpaque(pointer).takeRetainedValue()
|
|
45
46
|
}
|
|
46
47
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
///
|
|
2
|
-
///
|
|
2
|
+
/// Func_void_BLEState.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
5
|
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
@@ -7,22 +7,23 @@
|
|
|
7
7
|
|
|
8
8
|
import NitroModules
|
|
9
9
|
|
|
10
|
+
|
|
10
11
|
/**
|
|
11
|
-
* Wraps a Swift `(_
|
|
12
|
+
* Wraps a Swift `(_ state: BLEState) -> Void` as a class.
|
|
12
13
|
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
14
|
*/
|
|
14
|
-
public final class
|
|
15
|
+
public final class Func_void_BLEState {
|
|
15
16
|
public typealias bridge = margelo.nitro.co.zyke.ble.bridge.swift
|
|
16
17
|
|
|
17
|
-
private let closure: (_
|
|
18
|
+
private let closure: (_ state: BLEState) -> Void
|
|
18
19
|
|
|
19
|
-
public init(_ closure: @escaping (_
|
|
20
|
+
public init(_ closure: @escaping (_ state: BLEState) -> Void) {
|
|
20
21
|
self.closure = closure
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
@inline(__always)
|
|
24
|
-
public func call(
|
|
25
|
-
self.closure(margelo.nitro.co.zyke.ble.
|
|
25
|
+
public func call(state: Int32) -> Void {
|
|
26
|
+
self.closure(margelo.nitro.co.zyke.ble.BLEState(rawValue: state)!)
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
/**
|
|
@@ -35,12 +36,12 @@ public final class Func_void_LogLevel {
|
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
/**
|
|
38
|
-
* Casts an unsafe pointer to a `
|
|
39
|
-
* The pointer has to be a retained opaque `Unmanaged<
|
|
39
|
+
* Casts an unsafe pointer to a `Func_void_BLEState`.
|
|
40
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_BLEState>`.
|
|
40
41
|
* This removes one strong reference from the object!
|
|
41
42
|
*/
|
|
42
43
|
@inline(__always)
|
|
43
|
-
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) ->
|
|
44
|
-
return Unmanaged<
|
|
44
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_BLEState {
|
|
45
|
+
return Unmanaged<Func_void_BLEState>.fromOpaque(pointer).takeRetainedValue()
|
|
45
46
|
}
|
|
46
47
|
}
|
|
@@ -7,22 +7,23 @@
|
|
|
7
7
|
|
|
8
8
|
import NitroModules
|
|
9
9
|
|
|
10
|
+
|
|
10
11
|
/**
|
|
11
|
-
* Wraps a Swift `(_
|
|
12
|
+
* Wraps a Swift `(_ result: Bool) -> Void` as a class.
|
|
12
13
|
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
14
|
*/
|
|
14
15
|
public final class Func_void_bool {
|
|
15
16
|
public typealias bridge = margelo.nitro.co.zyke.ble.bridge.swift
|
|
16
17
|
|
|
17
|
-
private let closure: (_
|
|
18
|
+
private let closure: (_ result: Bool) -> Void
|
|
18
19
|
|
|
19
|
-
public init(_ closure: @escaping (_
|
|
20
|
+
public init(_ closure: @escaping (_ result: Bool) -> Void) {
|
|
20
21
|
self.closure = closure
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
@inline(__always)
|
|
24
|
-
public func call(
|
|
25
|
-
self.closure(
|
|
25
|
+
public func call(result: Bool) -> Void {
|
|
26
|
+
self.closure(result)
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
/**
|