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
|
@@ -1,427 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Device wrapper for compatibility
|
|
3
|
-
*
|
|
4
|
-
* Wraps Nitro Device objects to provide the original react-native-ble-plx API
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import type { Device as NitroDevice } from '../specs/Device.nitro';
|
|
8
|
-
import type {
|
|
9
|
-
NativeDevice,
|
|
10
|
-
UUID,
|
|
11
|
-
Base64,
|
|
12
|
-
DeviceId,
|
|
13
|
-
TransactionId,
|
|
14
|
-
ConnectionPriority,
|
|
15
|
-
ConnectionOptions,
|
|
16
|
-
ServiceDataEntry,
|
|
17
|
-
NativeService,
|
|
18
|
-
NativeCharacteristic,
|
|
19
|
-
NativeDescriptor,
|
|
20
|
-
CharacteristicSubscriptionType,
|
|
21
|
-
Subscription
|
|
22
|
-
} from '../specs/types';
|
|
23
|
-
import { serviceDataArrayToMap } from './serviceData';
|
|
24
|
-
import {
|
|
25
|
-
normalizeCharacteristicSubscriptionType,
|
|
26
|
-
stateToString,
|
|
27
|
-
characteristicSubscriptionTypeToString
|
|
28
|
-
} from './enums';
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Device wrapper that provides react-native-ble-plx compatibility
|
|
32
|
-
* Maps Nitro device properties to the expected API surface
|
|
33
|
-
*/
|
|
34
|
-
export class DeviceWrapper {
|
|
35
|
-
constructor(private nitroDevice: NitroDevice | any) {}
|
|
36
|
-
|
|
37
|
-
// Device identification
|
|
38
|
-
get id(): DeviceId {
|
|
39
|
-
return this.nitroDevice.id;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// Map deviceName back to name for compatibility
|
|
43
|
-
get name(): string | null {
|
|
44
|
-
return this.nitroDevice.deviceName || null;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
get rssi(): number | null {
|
|
48
|
-
return this.nitroDevice.rssi || null;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
get mtu(): number {
|
|
52
|
-
return this.nitroDevice.mtu;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// Advertisement data
|
|
56
|
-
get manufacturerData(): Base64 | null {
|
|
57
|
-
return this.nitroDevice.manufacturerData || null;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
get rawScanRecord(): Base64 {
|
|
61
|
-
return this.nitroDevice.rawScanRecord;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// Convert ServiceDataEntry[] back to { [uuid: string]: Base64 }
|
|
65
|
-
get serviceData(): { [uuid: string]: Base64 } | null {
|
|
66
|
-
return serviceDataArrayToMap(this.nitroDevice.serviceData || null);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
get serviceUUIDs(): UUID[] | null {
|
|
70
|
-
return this.nitroDevice.serviceUUIDs || null;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
get localName(): string | null {
|
|
74
|
-
return this.nitroDevice.localName || null;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
get txPowerLevel(): number | null {
|
|
78
|
-
return this.nitroDevice.txPowerLevel || null;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
get solicitedServiceUUIDs(): UUID[] | null {
|
|
82
|
-
return this.nitroDevice.solicitedServiceUUIDs || null;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
get isConnectable(): boolean | null {
|
|
86
|
-
return this.nitroDevice.isConnectable || null;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
get overflowServiceUUIDs(): UUID[] | null {
|
|
90
|
-
return this.nitroDevice.overflowServiceUUIDs || null;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// Connection management methods
|
|
94
|
-
async requestConnectionPriority(
|
|
95
|
-
connectionPriority: ConnectionPriority,
|
|
96
|
-
transactionId?: TransactionId
|
|
97
|
-
): Promise<DeviceWrapper> {
|
|
98
|
-
const result = await this.nitroDevice.requestConnectionPriority(connectionPriority, transactionId);
|
|
99
|
-
return new DeviceWrapper(result);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
async readRSSI(transactionId?: TransactionId): Promise<DeviceWrapper> {
|
|
103
|
-
const result = await this.nitroDevice.readRSSI(transactionId);
|
|
104
|
-
return new DeviceWrapper(result);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
async requestMTU(mtu: number, transactionId?: TransactionId): Promise<DeviceWrapper> {
|
|
108
|
-
const result = await this.nitroDevice.requestMTU(mtu, transactionId);
|
|
109
|
-
return new DeviceWrapper(result);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
async connect(options?: Partial<ConnectionOptions>): Promise<DeviceWrapper> {
|
|
113
|
-
// Provide defaults for required fields in Nitro interface
|
|
114
|
-
const connectionOptions: ConnectionOptions = {
|
|
115
|
-
autoConnect: options?.autoConnect ?? false,
|
|
116
|
-
requestMTU: options?.requestMTU ?? 23,
|
|
117
|
-
timeout: options?.timeout ?? 0,
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
const result = await this.nitroDevice.connect(connectionOptions);
|
|
121
|
-
return new DeviceWrapper(result);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
async cancelConnection(): Promise<DeviceWrapper> {
|
|
125
|
-
const result = await this.nitroDevice.cancelConnection();
|
|
126
|
-
return new DeviceWrapper(result);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
async isConnected(): Promise<boolean> {
|
|
130
|
-
return await this.nitroDevice.isConnected();
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
onDisconnected(listener: (error: any | null, device: DeviceWrapper) => void): Subscription {
|
|
134
|
-
return this.nitroDevice.onDisconnected((error: any, device: any) => {
|
|
135
|
-
listener(error, new DeviceWrapper(device));
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
// Service discovery
|
|
140
|
-
async discoverAllServicesAndCharacteristics(transactionId?: TransactionId): Promise<DeviceWrapper> {
|
|
141
|
-
const result = await this.nitroDevice.discoverAllServicesAndCharacteristics(transactionId);
|
|
142
|
-
return new DeviceWrapper(result);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
async services(): Promise<ServiceWrapper[]> {
|
|
146
|
-
const services = await this.nitroDevice.services();
|
|
147
|
-
return services.map((service: any) => new ServiceWrapper(service, this.nitroDevice));
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
// Characteristic operations
|
|
151
|
-
async characteristicsForService(serviceUUID: UUID): Promise<CharacteristicWrapper[]> {
|
|
152
|
-
const characteristics = await this.nitroDevice.characteristicsForService(serviceUUID);
|
|
153
|
-
return characteristics.map((char: any) => new CharacteristicWrapper(char, this.nitroDevice));
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
async readCharacteristicForService(
|
|
157
|
-
serviceUUID: UUID,
|
|
158
|
-
characteristicUUID: UUID,
|
|
159
|
-
transactionId?: TransactionId
|
|
160
|
-
): Promise<CharacteristicWrapper> {
|
|
161
|
-
const result = await this.nitroDevice.readCharacteristicForService(
|
|
162
|
-
serviceUUID,
|
|
163
|
-
characteristicUUID,
|
|
164
|
-
transactionId
|
|
165
|
-
);
|
|
166
|
-
return new CharacteristicWrapper(result, this.nitroDevice);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
async writeCharacteristicWithResponseForService(
|
|
170
|
-
serviceUUID: UUID,
|
|
171
|
-
characteristicUUID: UUID,
|
|
172
|
-
valueBase64: Base64,
|
|
173
|
-
transactionId?: TransactionId
|
|
174
|
-
): Promise<CharacteristicWrapper> {
|
|
175
|
-
const result = await this.nitroDevice.writeCharacteristicWithResponseForService(
|
|
176
|
-
serviceUUID,
|
|
177
|
-
characteristicUUID,
|
|
178
|
-
valueBase64,
|
|
179
|
-
transactionId
|
|
180
|
-
);
|
|
181
|
-
return new CharacteristicWrapper(result, this.nitroDevice);
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
async writeCharacteristicWithoutResponseForService(
|
|
185
|
-
serviceUUID: UUID,
|
|
186
|
-
characteristicUUID: UUID,
|
|
187
|
-
valueBase64: Base64,
|
|
188
|
-
transactionId?: TransactionId
|
|
189
|
-
): Promise<CharacteristicWrapper> {
|
|
190
|
-
const result = await this.nitroDevice.writeCharacteristicWithoutResponseForService(
|
|
191
|
-
serviceUUID,
|
|
192
|
-
characteristicUUID,
|
|
193
|
-
valueBase64,
|
|
194
|
-
transactionId
|
|
195
|
-
);
|
|
196
|
-
return new CharacteristicWrapper(result, this.nitroDevice);
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
monitorCharacteristicForService(
|
|
200
|
-
serviceUUID: UUID,
|
|
201
|
-
characteristicUUID: UUID,
|
|
202
|
-
listener: (error: any | null, characteristic: CharacteristicWrapper | null) => void,
|
|
203
|
-
transactionId?: TransactionId,
|
|
204
|
-
subscriptionType?: 'notification' | 'indication'
|
|
205
|
-
): Subscription {
|
|
206
|
-
const nitroSubscriptionType = subscriptionType
|
|
207
|
-
? normalizeCharacteristicSubscriptionType(subscriptionType)
|
|
208
|
-
: undefined;
|
|
209
|
-
|
|
210
|
-
return this.nitroDevice.monitorCharacteristicForService(
|
|
211
|
-
serviceUUID,
|
|
212
|
-
characteristicUUID,
|
|
213
|
-
(error: any, characteristic: any) => {
|
|
214
|
-
listener(
|
|
215
|
-
error,
|
|
216
|
-
characteristic ? new CharacteristicWrapper(characteristic, this.nitroDevice) : null
|
|
217
|
-
);
|
|
218
|
-
},
|
|
219
|
-
transactionId,
|
|
220
|
-
nitroSubscriptionType
|
|
221
|
-
);
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
// Descriptor operations
|
|
225
|
-
async descriptorsForService(
|
|
226
|
-
serviceUUID: UUID,
|
|
227
|
-
characteristicUUID: UUID
|
|
228
|
-
): Promise<DescriptorWrapper[]> {
|
|
229
|
-
const descriptors = await this.nitroDevice.descriptorsForService(serviceUUID, characteristicUUID);
|
|
230
|
-
return descriptors.map((desc: any) => new DescriptorWrapper(desc, this.nitroDevice));
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
async readDescriptorForService(
|
|
234
|
-
serviceUUID: UUID,
|
|
235
|
-
characteristicUUID: UUID,
|
|
236
|
-
descriptorUUID: UUID,
|
|
237
|
-
transactionId?: TransactionId
|
|
238
|
-
): Promise<DescriptorWrapper> {
|
|
239
|
-
const result = await this.nitroDevice.readDescriptorForService(
|
|
240
|
-
serviceUUID,
|
|
241
|
-
characteristicUUID,
|
|
242
|
-
descriptorUUID,
|
|
243
|
-
transactionId
|
|
244
|
-
);
|
|
245
|
-
return new DescriptorWrapper(result, this.nitroDevice);
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
async writeDescriptorForService(
|
|
249
|
-
serviceUUID: UUID,
|
|
250
|
-
characteristicUUID: UUID,
|
|
251
|
-
descriptorUUID: UUID,
|
|
252
|
-
valueBase64: Base64,
|
|
253
|
-
transactionId?: TransactionId
|
|
254
|
-
): Promise<DescriptorWrapper> {
|
|
255
|
-
const result = await this.nitroDevice.writeDescriptorForService(
|
|
256
|
-
serviceUUID,
|
|
257
|
-
characteristicUUID,
|
|
258
|
-
descriptorUUID,
|
|
259
|
-
valueBase64,
|
|
260
|
-
transactionId
|
|
261
|
-
);
|
|
262
|
-
return new DescriptorWrapper(result, this.nitroDevice);
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
/**
|
|
267
|
-
* Service wrapper for compatibility
|
|
268
|
-
*/
|
|
269
|
-
export class ServiceWrapper {
|
|
270
|
-
constructor(
|
|
271
|
-
private nativeService: NativeService,
|
|
272
|
-
private nitroDevice: NitroDevice
|
|
273
|
-
) {}
|
|
274
|
-
|
|
275
|
-
get id(): number {
|
|
276
|
-
return this.nativeService.id;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
get uuid(): UUID {
|
|
280
|
-
return this.nativeService.uuid;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
get deviceID(): DeviceId {
|
|
284
|
-
return this.nativeService.deviceID;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
get isPrimary(): boolean {
|
|
288
|
-
return this.nativeService.isPrimary;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
// Delegate to device methods
|
|
292
|
-
async characteristics(): Promise<CharacteristicWrapper[]> {
|
|
293
|
-
const device = new DeviceWrapper(this.nitroDevice);
|
|
294
|
-
return await device.characteristicsForService(this.uuid);
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
async readCharacteristic(
|
|
298
|
-
characteristicUUID: UUID,
|
|
299
|
-
transactionId?: TransactionId
|
|
300
|
-
): Promise<CharacteristicWrapper> {
|
|
301
|
-
const device = new DeviceWrapper(this.nitroDevice);
|
|
302
|
-
return await device.readCharacteristicForService(this.uuid, characteristicUUID, transactionId);
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
// ... other service methods would delegate similarly
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
/**
|
|
309
|
-
* Characteristic wrapper for compatibility
|
|
310
|
-
*/
|
|
311
|
-
export class CharacteristicWrapper {
|
|
312
|
-
constructor(
|
|
313
|
-
private nativeCharacteristic: NativeCharacteristic,
|
|
314
|
-
private nitroDevice: NitroDevice
|
|
315
|
-
) {}
|
|
316
|
-
|
|
317
|
-
get id(): number {
|
|
318
|
-
return this.nativeCharacteristic.id;
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
get uuid(): UUID {
|
|
322
|
-
return this.nativeCharacteristic.uuid;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
get serviceID(): number {
|
|
326
|
-
return this.nativeCharacteristic.serviceID;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
get serviceUUID(): UUID {
|
|
330
|
-
return this.nativeCharacteristic.serviceUUID;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
get deviceID(): DeviceId {
|
|
334
|
-
return this.nativeCharacteristic.deviceID;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
get isReadable(): boolean {
|
|
338
|
-
return this.nativeCharacteristic.isReadable;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
get isWritableWithResponse(): boolean {
|
|
342
|
-
return this.nativeCharacteristic.isWritableWithResponse;
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
get isWritableWithoutResponse(): boolean {
|
|
346
|
-
return this.nativeCharacteristic.isWritableWithoutResponse;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
get isNotifiable(): boolean {
|
|
350
|
-
return this.nativeCharacteristic.isNotifiable;
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
get isNotifying(): boolean {
|
|
354
|
-
return this.nativeCharacteristic.isNotifying;
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
get isIndicatable(): boolean {
|
|
358
|
-
return this.nativeCharacteristic.isIndicatable;
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
get value(): Base64 | null {
|
|
362
|
-
return this.nativeCharacteristic.value;
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
// Delegate to device methods
|
|
366
|
-
async read(transactionId?: TransactionId): Promise<CharacteristicWrapper> {
|
|
367
|
-
const device = new DeviceWrapper(this.nitroDevice);
|
|
368
|
-
return await device.readCharacteristicForService(this.serviceUUID, this.uuid, transactionId);
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
// ... other characteristic methods would delegate similarly
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
/**
|
|
375
|
-
* Descriptor wrapper for compatibility
|
|
376
|
-
*/
|
|
377
|
-
export class DescriptorWrapper {
|
|
378
|
-
constructor(
|
|
379
|
-
private nativeDescriptor: NativeDescriptor,
|
|
380
|
-
private nitroDevice: NitroDevice
|
|
381
|
-
) {}
|
|
382
|
-
|
|
383
|
-
get id(): number {
|
|
384
|
-
return this.nativeDescriptor.id;
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
get uuid(): UUID {
|
|
388
|
-
return this.nativeDescriptor.uuid;
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
get characteristicID(): number {
|
|
392
|
-
return this.nativeDescriptor.characteristicID;
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
get characteristicUUID(): UUID {
|
|
396
|
-
return this.nativeDescriptor.characteristicUUID;
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
get serviceID(): number {
|
|
400
|
-
return this.nativeDescriptor.serviceID;
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
get serviceUUID(): UUID {
|
|
404
|
-
return this.nativeDescriptor.serviceUUID;
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
get deviceID(): DeviceId {
|
|
408
|
-
return this.nativeDescriptor.deviceID;
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
get value(): Base64 | null {
|
|
412
|
-
return this.nativeDescriptor.value;
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
// Delegate to device methods
|
|
416
|
-
async read(transactionId?: TransactionId): Promise<DescriptorWrapper> {
|
|
417
|
-
const device = new DeviceWrapper(this.nitroDevice);
|
|
418
|
-
return await device.readDescriptorForService(
|
|
419
|
-
this.serviceUUID,
|
|
420
|
-
this.characteristicUUID,
|
|
421
|
-
this.uuid,
|
|
422
|
-
transactionId
|
|
423
|
-
);
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
// ... other descriptor methods would delegate similarly
|
|
427
|
-
}
|
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* React Native BLE Plx Compatible Enums and Types
|
|
3
|
-
*
|
|
4
|
-
* These match the exact types from react-native-ble-plx for drop-in compatibility.
|
|
5
|
-
* This module provides conversion between Nitro's numeric enums and react-native-ble-plx types.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
// Import Nitro's numeric enums with aliases to avoid naming conflicts
|
|
9
|
-
import {
|
|
10
|
-
State as NitroState,
|
|
11
|
-
LogLevel as NitroLogLevel,
|
|
12
|
-
CharacteristicSubscriptionType as NitroCharacteristicSubscriptionType,
|
|
13
|
-
RefreshGattMoment as NitroRefreshGattMoment,
|
|
14
|
-
} from '../specs/types';
|
|
15
|
-
|
|
16
|
-
// Define exact string enums and types matching react-native-ble-plx
|
|
17
|
-
export enum State {
|
|
18
|
-
Unknown = 'Unknown',
|
|
19
|
-
Resetting = 'Resetting',
|
|
20
|
-
Unsupported = 'Unsupported',
|
|
21
|
-
Unauthorized = 'Unauthorized',
|
|
22
|
-
PoweredOff = 'PoweredOff',
|
|
23
|
-
PoweredOn = 'PoweredOn'
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export enum LogLevel {
|
|
27
|
-
None = 'None',
|
|
28
|
-
Verbose = 'Verbose',
|
|
29
|
-
Debug = 'Debug',
|
|
30
|
-
Info = 'Info',
|
|
31
|
-
Warning = 'Warning',
|
|
32
|
-
Error = 'Error'
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// These are type literals in react-native-ble-plx, not enums
|
|
36
|
-
export type CharacteristicSubscriptionType = 'notification' | 'indication';
|
|
37
|
-
export type RefreshGattMoment = 'OnConnected';
|
|
38
|
-
|
|
39
|
-
// Conversion functions from Nitro numeric enums to react-native-ble-plx string enums/types
|
|
40
|
-
export function stateToString(state: NitroState): State {
|
|
41
|
-
const mapping = {
|
|
42
|
-
[NitroState.Unknown]: State.Unknown,
|
|
43
|
-
[NitroState.Resetting]: State.Resetting,
|
|
44
|
-
[NitroState.Unsupported]: State.Unsupported,
|
|
45
|
-
[NitroState.Unauthorized]: State.Unauthorized,
|
|
46
|
-
[NitroState.PoweredOff]: State.PoweredOff,
|
|
47
|
-
[NitroState.PoweredOn]: State.PoweredOn,
|
|
48
|
-
};
|
|
49
|
-
return mapping[state] ?? State.Unknown;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export function logLevelToString(logLevel: NitroLogLevel): LogLevel {
|
|
53
|
-
const mapping = {
|
|
54
|
-
[NitroLogLevel.None]: LogLevel.None,
|
|
55
|
-
[NitroLogLevel.Verbose]: LogLevel.Verbose,
|
|
56
|
-
[NitroLogLevel.Debug]: LogLevel.Debug,
|
|
57
|
-
[NitroLogLevel.Info]: LogLevel.Info,
|
|
58
|
-
[NitroLogLevel.Warning]: LogLevel.Warning,
|
|
59
|
-
[NitroLogLevel.Error]: LogLevel.Error,
|
|
60
|
-
};
|
|
61
|
-
return mapping[logLevel] ?? LogLevel.None;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export function characteristicSubscriptionTypeToString(
|
|
65
|
-
type: NitroCharacteristicSubscriptionType
|
|
66
|
-
): CharacteristicSubscriptionType {
|
|
67
|
-
const mapping = {
|
|
68
|
-
[NitroCharacteristicSubscriptionType.Notification]: 'notification' as const,
|
|
69
|
-
[NitroCharacteristicSubscriptionType.Indication]: 'indication' as const,
|
|
70
|
-
};
|
|
71
|
-
return mapping[type] ?? 'notification';
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export function refreshGattMomentToString(_moment: NitroRefreshGattMoment): RefreshGattMoment {
|
|
75
|
-
return 'OnConnected'; // Only one value exists
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// Conversion functions from react-native-ble-plx string enums/types to Nitro numeric enums
|
|
79
|
-
export function stringToState(stateString: State | string): NitroState {
|
|
80
|
-
switch (stateString) {
|
|
81
|
-
case State.Unknown:
|
|
82
|
-
case 'Unknown':
|
|
83
|
-
return NitroState.Unknown;
|
|
84
|
-
case State.Resetting:
|
|
85
|
-
case 'Resetting':
|
|
86
|
-
return NitroState.Resetting;
|
|
87
|
-
case State.Unsupported:
|
|
88
|
-
case 'Unsupported':
|
|
89
|
-
return NitroState.Unsupported;
|
|
90
|
-
case State.Unauthorized:
|
|
91
|
-
case 'Unauthorized':
|
|
92
|
-
return NitroState.Unauthorized;
|
|
93
|
-
case State.PoweredOff:
|
|
94
|
-
case 'PoweredOff':
|
|
95
|
-
return NitroState.PoweredOff;
|
|
96
|
-
case State.PoweredOn:
|
|
97
|
-
case 'PoweredOn':
|
|
98
|
-
return NitroState.PoweredOn;
|
|
99
|
-
default:
|
|
100
|
-
return NitroState.Unknown;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export function stringToLogLevel(logLevelString: LogLevel | string): NitroLogLevel {
|
|
105
|
-
switch (logLevelString) {
|
|
106
|
-
case LogLevel.None:
|
|
107
|
-
case 'None':
|
|
108
|
-
return NitroLogLevel.None;
|
|
109
|
-
case LogLevel.Verbose:
|
|
110
|
-
case 'Verbose':
|
|
111
|
-
return NitroLogLevel.Verbose;
|
|
112
|
-
case LogLevel.Debug:
|
|
113
|
-
case 'Debug':
|
|
114
|
-
return NitroLogLevel.Debug;
|
|
115
|
-
case LogLevel.Info:
|
|
116
|
-
case 'Info':
|
|
117
|
-
return NitroLogLevel.Info;
|
|
118
|
-
case LogLevel.Warning:
|
|
119
|
-
case 'Warning':
|
|
120
|
-
return NitroLogLevel.Warning;
|
|
121
|
-
case LogLevel.Error:
|
|
122
|
-
case 'Error':
|
|
123
|
-
return NitroLogLevel.Error;
|
|
124
|
-
default:
|
|
125
|
-
return NitroLogLevel.None;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
export function stringToCharacteristicSubscriptionType(
|
|
130
|
-
typeString: CharacteristicSubscriptionType | string
|
|
131
|
-
): NitroCharacteristicSubscriptionType {
|
|
132
|
-
switch (typeString) {
|
|
133
|
-
case 'notification':
|
|
134
|
-
return NitroCharacteristicSubscriptionType.Notification;
|
|
135
|
-
case 'indication':
|
|
136
|
-
return NitroCharacteristicSubscriptionType.Indication;
|
|
137
|
-
default:
|
|
138
|
-
return NitroCharacteristicSubscriptionType.Notification;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
export function stringToRefreshGattMoment(_momentString: RefreshGattMoment): NitroRefreshGattMoment {
|
|
143
|
-
return NitroRefreshGattMoment.OnConnected;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
// Generic converter that handles both string and numeric enum values
|
|
147
|
-
export function normalizeState(state: NitroState | State | string): NitroState {
|
|
148
|
-
if (typeof state === 'string') {
|
|
149
|
-
return stringToState(state);
|
|
150
|
-
}
|
|
151
|
-
// If it's already a NitroState (numeric), return as-is
|
|
152
|
-
if (typeof state === 'number') {
|
|
153
|
-
return state as NitroState;
|
|
154
|
-
}
|
|
155
|
-
// If it's a string State enum value, convert it
|
|
156
|
-
return stringToState(state as string);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
export function normalizeLogLevel(logLevel: NitroLogLevel | LogLevel | string): NitroLogLevel {
|
|
160
|
-
if (typeof logLevel === 'string') {
|
|
161
|
-
return stringToLogLevel(logLevel);
|
|
162
|
-
}
|
|
163
|
-
// If it's already a NitroLogLevel (numeric), return as-is
|
|
164
|
-
if (typeof logLevel === 'number') {
|
|
165
|
-
return logLevel as NitroLogLevel;
|
|
166
|
-
}
|
|
167
|
-
// If it's a string LogLevel enum value, convert it
|
|
168
|
-
return stringToLogLevel(logLevel as string);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
export function normalizeCharacteristicSubscriptionType(
|
|
172
|
-
type: NitroCharacteristicSubscriptionType | CharacteristicSubscriptionType | string
|
|
173
|
-
): NitroCharacteristicSubscriptionType {
|
|
174
|
-
if (typeof type === 'string') {
|
|
175
|
-
return stringToCharacteristicSubscriptionType(type);
|
|
176
|
-
}
|
|
177
|
-
// If it's already a NitroCharacteristicSubscriptionType (numeric), return as-is
|
|
178
|
-
return type as NitroCharacteristicSubscriptionType;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
export function normalizeRefreshGattMoment(
|
|
182
|
-
_moment: NitroRefreshGattMoment | RefreshGattMoment | string
|
|
183
|
-
): NitroRefreshGattMoment {
|
|
184
|
-
return NitroRefreshGattMoment.OnConnected; // Only one value exists
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
// Helper function to detect if a value is a string enum vs numeric enum
|
|
188
|
-
export function isStringEnumValue(value: any): boolean {
|
|
189
|
-
return typeof value === 'string';
|
|
190
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Compatibility layer for react-native-ble-nitro
|
|
3
|
-
*
|
|
4
|
-
* This module provides compatibility shims and converters to maintain
|
|
5
|
-
* 100% API compatibility with react-native-ble-plx while working with
|
|
6
|
-
* Nitro's type system constraints.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
export * from './serviceData';
|
|
10
|
-
export * from './deviceWrapper';
|
|
11
|
-
export * from './constants';
|
|
12
|
-
|
|
13
|
-
// Explicitly export enum utilities and enums to avoid conflicts
|
|
14
|
-
export {
|
|
15
|
-
stateToString,
|
|
16
|
-
stringToState,
|
|
17
|
-
logLevelToString,
|
|
18
|
-
stringToLogLevel,
|
|
19
|
-
characteristicSubscriptionTypeToString,
|
|
20
|
-
stringToCharacteristicSubscriptionType,
|
|
21
|
-
normalizeState,
|
|
22
|
-
normalizeLogLevel,
|
|
23
|
-
normalizeCharacteristicSubscriptionType,
|
|
24
|
-
State,
|
|
25
|
-
LogLevel
|
|
26
|
-
} from './enums';
|
|
27
|
-
|
|
28
|
-
// Export type literals (not enums) for exact react-native-ble-plx compatibility
|
|
29
|
-
export type {
|
|
30
|
-
CharacteristicSubscriptionType,
|
|
31
|
-
RefreshGattMoment
|
|
32
|
-
} from './enums';
|