react-native-ble-nitro 1.0.0-beta.0 → 1.0.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (290) hide show
  1. package/android/build.gradle +3 -0
  2. package/android/src/main/kotlin/{co → com/margelo/nitro/co}/zyke/ble/BleNitroBleManager.kt +111 -2
  3. package/app.plugin.cjs +1 -0
  4. package/ios/BleNitroBleManager.swift +66 -0
  5. package/ios/BleNitroModule.swift +2 -9
  6. package/lib/BleManagerCompatFactory.d.ts +5 -4
  7. package/lib/BleManagerCompatFactory.js +9 -6
  8. package/lib/BleManagerFactory.d.ts +21 -3
  9. package/lib/BleManagerFactory.js +53 -2
  10. package/lib/commonjs/BleManagerCompatFactory.d.ts +56 -0
  11. package/lib/commonjs/BleManagerCompatFactory.d.ts.map +1 -0
  12. package/lib/commonjs/BleManagerCompatFactory.js +201 -0
  13. package/lib/commonjs/BleManagerCompatFactory.js.map +1 -0
  14. package/lib/commonjs/BleManagerFactory.d.ts +31 -0
  15. package/lib/commonjs/BleManagerFactory.d.ts.map +1 -0
  16. package/lib/commonjs/BleManagerFactory.js +81 -0
  17. package/lib/commonjs/BleManagerFactory.js.map +1 -0
  18. package/lib/commonjs/compatibility/constants.d.ts +50 -0
  19. package/lib/commonjs/compatibility/constants.d.ts.map +1 -0
  20. package/lib/commonjs/compatibility/constants.js +58 -0
  21. package/lib/commonjs/compatibility/constants.js.map +1 -0
  22. package/lib/commonjs/compatibility/deviceWrapper.d.ts +100 -0
  23. package/lib/commonjs/compatibility/deviceWrapper.d.ts.map +1 -0
  24. package/lib/commonjs/compatibility/deviceWrapper.js +268 -0
  25. package/lib/commonjs/compatibility/deviceWrapper.js.map +1 -0
  26. package/lib/commonjs/compatibility/enums.d.ts +39 -0
  27. package/lib/commonjs/compatibility/enums.d.ts.map +1 -0
  28. package/lib/commonjs/compatibility/enums.js +179 -0
  29. package/lib/commonjs/compatibility/enums.js.map +1 -0
  30. package/lib/commonjs/compatibility/index.d.ts +13 -0
  31. package/lib/commonjs/compatibility/index.d.ts.map +1 -0
  32. package/lib/commonjs/compatibility/index.js +41 -0
  33. package/lib/commonjs/compatibility/index.js.map +1 -0
  34. package/lib/commonjs/compatibility/serviceData.d.ts +52 -0
  35. package/lib/commonjs/compatibility/serviceData.d.ts.map +1 -0
  36. package/lib/commonjs/compatibility/serviceData.js +80 -0
  37. package/lib/commonjs/compatibility/serviceData.js.map +1 -0
  38. package/lib/commonjs/errors/BleError.d.ts +60 -0
  39. package/lib/commonjs/errors/BleError.d.ts.map +1 -0
  40. package/lib/commonjs/errors/BleError.js +125 -0
  41. package/lib/commonjs/errors/BleError.js.map +1 -0
  42. package/lib/commonjs/index.d.ts +11 -0
  43. package/lib/commonjs/index.d.ts.map +1 -0
  44. package/lib/commonjs/index.js +42 -0
  45. package/lib/commonjs/index.js.map +1 -0
  46. package/lib/commonjs/specs/BleManager.nitro.d.ts +45 -0
  47. package/lib/commonjs/specs/BleManager.nitro.d.ts.map +1 -0
  48. package/lib/commonjs/specs/BleManager.nitro.js +3 -0
  49. package/lib/commonjs/specs/BleManager.nitro.js.map +1 -0
  50. package/lib/commonjs/specs/Characteristic.nitro.d.ts +27 -0
  51. package/lib/commonjs/specs/Characteristic.nitro.d.ts.map +1 -0
  52. package/lib/commonjs/specs/Characteristic.nitro.js +3 -0
  53. package/lib/commonjs/specs/Characteristic.nitro.js.map +1 -0
  54. package/lib/commonjs/specs/Descriptor.nitro.d.ts +18 -0
  55. package/lib/commonjs/specs/Descriptor.nitro.d.ts.map +1 -0
  56. package/lib/commonjs/specs/Descriptor.nitro.js +3 -0
  57. package/lib/commonjs/specs/Descriptor.nitro.js.map +1 -0
  58. package/lib/commonjs/specs/Device.nitro.d.ts +38 -0
  59. package/lib/commonjs/specs/Device.nitro.d.ts.map +1 -0
  60. package/lib/commonjs/specs/Device.nitro.js +3 -0
  61. package/lib/commonjs/specs/Device.nitro.js.map +1 -0
  62. package/lib/commonjs/specs/Service.nitro.d.ts +20 -0
  63. package/lib/commonjs/specs/Service.nitro.d.ts.map +1 -0
  64. package/lib/commonjs/specs/Service.nitro.js +3 -0
  65. package/lib/commonjs/specs/Service.nitro.js.map +1 -0
  66. package/lib/commonjs/specs/types.d.ts +229 -0
  67. package/lib/commonjs/specs/types.d.ts.map +1 -0
  68. package/lib/commonjs/specs/types.js +150 -0
  69. package/lib/commonjs/specs/types.js.map +1 -0
  70. package/lib/commonjs/utils/base64.d.ts +26 -0
  71. package/lib/commonjs/utils/base64.d.ts.map +1 -0
  72. package/lib/commonjs/utils/base64.js +88 -0
  73. package/lib/commonjs/utils/base64.js.map +1 -0
  74. package/lib/commonjs/utils/index.d.ts +3 -0
  75. package/lib/commonjs/utils/index.d.ts.map +1 -0
  76. package/lib/commonjs/utils/index.js +19 -0
  77. package/lib/commonjs/utils/index.js.map +1 -0
  78. package/lib/commonjs/utils/uuid.d.ts +10 -0
  79. package/lib/commonjs/utils/uuid.d.ts.map +1 -0
  80. package/lib/commonjs/utils/uuid.js +41 -0
  81. package/lib/commonjs/utils/uuid.js.map +1 -0
  82. package/lib/compatibility/constants.d.ts +1 -1
  83. package/lib/compatibility/constants.js +1 -1
  84. package/lib/compatibility/deviceWrapper.d.ts +2 -2
  85. package/lib/compatibility/deviceWrapper.js +2 -2
  86. package/lib/compatibility/enums.d.ts +1 -1
  87. package/lib/compatibility/enums.js +1 -1
  88. package/lib/compatibility/index.d.ts +5 -5
  89. package/lib/compatibility/index.js +4 -4
  90. package/lib/compatibility/serviceData.d.ts +1 -1
  91. package/lib/errors/BleError.d.ts +2 -2
  92. package/lib/errors/BleError.js +1 -1
  93. package/lib/index.d.ts +10 -9
  94. package/lib/index.js +9 -7
  95. package/lib/specs/BleManager.nitro.d.ts +9 -1
  96. package/lib/specs/Characteristic.nitro.d.ts +1 -1
  97. package/lib/specs/Descriptor.nitro.d.ts +1 -1
  98. package/lib/specs/Device.nitro.d.ts +1 -1
  99. package/lib/specs/Service.nitro.d.ts +1 -1
  100. package/nitro.json +6 -1
  101. package/nitrogen/generated/.gitattributes +1 -0
  102. package/nitrogen/generated/android/BleNitro+autolinking.cmake +86 -0
  103. package/nitrogen/generated/android/BleNitro+autolinking.gradle +27 -0
  104. package/nitrogen/generated/android/BleNitroOnLoad.cpp +62 -0
  105. package/nitrogen/generated/android/BleNitroOnLoad.hpp +25 -0
  106. package/nitrogen/generated/android/c++/JBleATTErrorCode.hpp +107 -0
  107. package/nitrogen/generated/android/c++/JBleAndroidErrorCode.hpp +101 -0
  108. package/nitrogen/generated/android/c++/JBleErrorCode.hpp +170 -0
  109. package/nitrogen/generated/android/c++/JBleIOSErrorCode.hpp +92 -0
  110. package/nitrogen/generated/android/c++/JBleManagerNitroOptions.hpp +54 -0
  111. package/nitrogen/generated/android/c++/JBleRestoredState.hpp +76 -0
  112. package/nitrogen/generated/android/c++/JCharacteristicSubscriptionType.hpp +59 -0
  113. package/nitrogen/generated/android/c++/JConnectionOptions.hpp +61 -0
  114. package/nitrogen/generated/android/c++/JConnectionPriority.hpp +62 -0
  115. package/nitrogen/generated/android/c++/JFunc_void.hpp +74 -0
  116. package/nitrogen/generated/android/c++/JFunc_void_State.hpp +76 -0
  117. package/nitrogen/generated/android/c++/JFunc_void_std__optional_NativeBleError__std__optional_NativeCharacteristic_.hpp +88 -0
  118. package/nitrogen/generated/android/c++/JFunc_void_std__optional_NativeBleError__std__optional_NativeDevice_.hpp +91 -0
  119. package/nitrogen/generated/android/c++/JHybridBleManagerSpec.cpp +653 -0
  120. package/nitrogen/generated/android/c++/JHybridBleManagerSpec.hpp +92 -0
  121. package/nitrogen/generated/android/c++/JHybridCharacteristicSpec.cpp +253 -0
  122. package/nitrogen/generated/android/c++/JHybridCharacteristicSpec.hpp +79 -0
  123. package/nitrogen/generated/android/c++/JHybridDescriptorSpec.cpp +115 -0
  124. package/nitrogen/generated/android/c++/JHybridDescriptorSpec.hpp +70 -0
  125. package/nitrogen/generated/android/c++/JHybridDeviceSpec.cpp +476 -0
  126. package/nitrogen/generated/android/c++/JHybridDeviceSpec.hpp +90 -0
  127. package/nitrogen/generated/android/c++/JHybridServiceSpec.cpp +232 -0
  128. package/nitrogen/generated/android/c++/JHybridServiceSpec.hpp +72 -0
  129. package/nitrogen/generated/android/c++/JLogLevel.hpp +71 -0
  130. package/nitrogen/generated/android/c++/JNativeBleError.hpp +98 -0
  131. package/nitrogen/generated/android/c++/JNativeCharacteristic.hpp +98 -0
  132. package/nitrogen/generated/android/c++/JNativeDescriptor.hpp +82 -0
  133. package/nitrogen/generated/android/c++/JNativeDevice.hpp +173 -0
  134. package/nitrogen/generated/android/c++/JNativeService.hpp +65 -0
  135. package/nitrogen/generated/android/c++/JScanCallbackType.hpp +62 -0
  136. package/nitrogen/generated/android/c++/JScanMode.hpp +65 -0
  137. package/nitrogen/generated/android/c++/JScanOptions.hpp +69 -0
  138. package/nitrogen/generated/android/c++/JServiceDataEntry.hpp +57 -0
  139. package/nitrogen/generated/android/c++/JState.hpp +71 -0
  140. package/nitrogen/generated/android/c++/JSubscription.hpp +64 -0
  141. package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/BleATTErrorCode.kt +41 -0
  142. package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/BleAndroidErrorCode.kt +39 -0
  143. package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/BleErrorCode.kt +62 -0
  144. package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/BleIOSErrorCode.kt +36 -0
  145. package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/BleManagerNitroOptions.kt +26 -0
  146. package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/BleNitroOnLoad.kt +35 -0
  147. package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/BleRestoredState.kt +26 -0
  148. package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/CharacteristicSubscriptionType.kt +25 -0
  149. package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/ConnectionOptions.kt +28 -0
  150. package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/ConnectionPriority.kt +26 -0
  151. package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/Func_void.kt +80 -0
  152. package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/Func_void_State.kt +80 -0
  153. package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/Func_void_std__optional_NativeBleError__std__optional_NativeCharacteristic_.kt +80 -0
  154. package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/Func_void_std__optional_NativeBleError__std__optional_NativeDevice_.kt +80 -0
  155. package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/HybridBleManagerSpec.kt +192 -0
  156. package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/HybridCharacteristicSpec.kt +127 -0
  157. package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/HybridDescriptorSpec.kt +86 -0
  158. package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/HybridDeviceSpec.kt +176 -0
  159. package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/HybridServiceSpec.kt +99 -0
  160. package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/LogLevel.kt +29 -0
  161. package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/NativeBleError.kt +35 -0
  162. package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/NativeCharacteristic.kt +37 -0
  163. package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/NativeDescriptor.kt +33 -0
  164. package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/NativeDevice.kt +38 -0
  165. package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/NativeService.kt +29 -0
  166. package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/ScanCallbackType.kt +26 -0
  167. package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/ScanMode.kt +27 -0
  168. package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/ScanOptions.kt +29 -0
  169. package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/ServiceDataEntry.kt +27 -0
  170. package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/State.kt +29 -0
  171. package/nitrogen/generated/android/kotlin/com/margelo/nitro/co/zyke/ble/Subscription.kt +30 -0
  172. package/nitrogen/generated/ios/BleNitro+autolinking.rb +60 -0
  173. package/nitrogen/generated/ios/BleNitro-Swift-Cxx-Bridge.cpp +236 -0
  174. package/nitrogen/generated/ios/BleNitro-Swift-Cxx-Bridge.hpp +1069 -0
  175. package/nitrogen/generated/ios/BleNitro-Swift-Cxx-Umbrella.hpp +131 -0
  176. package/nitrogen/generated/ios/BleNitroAutolinking.mm +33 -0
  177. package/nitrogen/generated/ios/BleNitroAutolinking.swift +25 -0
  178. package/nitrogen/generated/ios/c++/HybridBleManagerSpecSwift.cpp +11 -0
  179. package/nitrogen/generated/ios/c++/HybridBleManagerSpecSwift.hpp +377 -0
  180. package/nitrogen/generated/ios/c++/HybridCharacteristicSpecSwift.cpp +11 -0
  181. package/nitrogen/generated/ios/c++/HybridCharacteristicSpecSwift.hpp +192 -0
  182. package/nitrogen/generated/ios/c++/HybridDescriptorSpecSwift.cpp +11 -0
  183. package/nitrogen/generated/ios/c++/HybridDescriptorSpecSwift.hpp +112 -0
  184. package/nitrogen/generated/ios/c++/HybridDeviceSpecSwift.cpp +11 -0
  185. package/nitrogen/generated/ios/c++/HybridDeviceSpecSwift.hpp +294 -0
  186. package/nitrogen/generated/ios/c++/HybridServiceSpecSwift.cpp +11 -0
  187. package/nitrogen/generated/ios/c++/HybridServiceSpecSwift.hpp +170 -0
  188. package/nitrogen/generated/ios/swift/BleATTErrorCode.swift +104 -0
  189. package/nitrogen/generated/ios/swift/BleAndroidErrorCode.swift +96 -0
  190. package/nitrogen/generated/ios/swift/BleErrorCode.swift +188 -0
  191. package/nitrogen/generated/ios/swift/BleIOSErrorCode.swift +84 -0
  192. package/nitrogen/generated/ios/swift/BleManagerNitroOptions.swift +53 -0
  193. package/nitrogen/generated/ios/swift/BleRestoredState.swift +47 -0
  194. package/nitrogen/generated/ios/swift/CharacteristicSubscriptionType.swift +40 -0
  195. package/nitrogen/generated/ios/swift/ConnectionOptions.swift +57 -0
  196. package/nitrogen/generated/ios/swift/ConnectionPriority.swift +44 -0
  197. package/nitrogen/generated/ios/swift/Func_void.swift +46 -0
  198. package/nitrogen/generated/ios/swift/Func_void_LogLevel.swift +46 -0
  199. package/nitrogen/generated/ios/swift/Func_void_NativeCharacteristic.swift +46 -0
  200. package/nitrogen/generated/ios/swift/Func_void_NativeDescriptor.swift +46 -0
  201. package/nitrogen/generated/ios/swift/Func_void_NativeDevice.swift +46 -0
  202. package/nitrogen/generated/ios/swift/Func_void_State.swift +46 -0
  203. package/nitrogen/generated/ios/swift/Func_void_bool.swift +46 -0
  204. package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
  205. package/nitrogen/generated/ios/swift/Func_void_std__optional_BleRestoredState_.swift +52 -0
  206. package/nitrogen/generated/ios/swift/Func_void_std__optional_NativeBleError__std__optional_NativeCharacteristic_.swift +58 -0
  207. package/nitrogen/generated/ios/swift/Func_void_std__optional_NativeBleError__std__optional_NativeDevice_.swift +58 -0
  208. package/nitrogen/generated/ios/swift/Func_void_std__shared_ptr_margelo__nitro__co__zyke__ble__HybridCharacteristicSpec_.swift +50 -0
  209. package/nitrogen/generated/ios/swift/Func_void_std__shared_ptr_margelo__nitro__co__zyke__ble__HybridDescriptorSpec_.swift +50 -0
  210. package/nitrogen/generated/ios/swift/Func_void_std__vector_NativeCharacteristic_.swift +46 -0
  211. package/nitrogen/generated/ios/swift/Func_void_std__vector_NativeDescriptor_.swift +46 -0
  212. package/nitrogen/generated/ios/swift/Func_void_std__vector_NativeDevice_.swift +46 -0
  213. package/nitrogen/generated/ios/swift/Func_void_std__vector_NativeService_.swift +46 -0
  214. package/nitrogen/generated/ios/swift/HybridBleManagerSpec.swift +78 -0
  215. package/nitrogen/generated/ios/swift/HybridBleManagerSpec_cxx.swift +852 -0
  216. package/nitrogen/generated/ios/swift/HybridCharacteristicSpec.swift +65 -0
  217. package/nitrogen/generated/ios/swift/HybridCharacteristicSpec_cxx.swift +384 -0
  218. package/nitrogen/generated/ios/swift/HybridDescriptorSpec.swift +56 -0
  219. package/nitrogen/generated/ios/swift/HybridDescriptorSpec_cxx.swift +218 -0
  220. package/nitrogen/generated/ios/swift/HybridDeviceSpec.swift +76 -0
  221. package/nitrogen/generated/ios/swift/HybridDeviceSpec_cxx.swift +702 -0
  222. package/nitrogen/generated/ios/swift/HybridServiceSpec.swift +58 -0
  223. package/nitrogen/generated/ios/swift/HybridServiceSpec_cxx.swift +338 -0
  224. package/nitrogen/generated/ios/swift/LogLevel.swift +56 -0
  225. package/nitrogen/generated/ios/swift/NativeBleError.swift +278 -0
  226. package/nitrogen/generated/ios/swift/NativeCharacteristic.swift +174 -0
  227. package/nitrogen/generated/ios/swift/NativeDescriptor.swift +130 -0
  228. package/nitrogen/generated/ios/swift/NativeDevice.swift +377 -0
  229. package/nitrogen/generated/ios/swift/NativeService.swift +68 -0
  230. package/nitrogen/generated/ios/swift/ScanCallbackType.swift +44 -0
  231. package/nitrogen/generated/ios/swift/ScanMode.swift +48 -0
  232. package/nitrogen/generated/ios/swift/ScanOptions.swift +116 -0
  233. package/nitrogen/generated/ios/swift/ServiceDataEntry.swift +46 -0
  234. package/nitrogen/generated/ios/swift/State.swift +56 -0
  235. package/nitrogen/generated/ios/swift/Subscription.swift +46 -0
  236. package/nitrogen/generated/shared/c++/BleATTErrorCode.hpp +80 -0
  237. package/nitrogen/generated/shared/c++/BleAndroidErrorCode.hpp +78 -0
  238. package/nitrogen/generated/shared/c++/BleErrorCode.hpp +101 -0
  239. package/nitrogen/generated/shared/c++/BleIOSErrorCode.hpp +75 -0
  240. package/nitrogen/generated/shared/c++/BleManagerNitroOptions.hpp +70 -0
  241. package/nitrogen/generated/shared/c++/BleRestoredState.hpp +71 -0
  242. package/nitrogen/generated/shared/c++/CharacteristicSubscriptionType.hpp +64 -0
  243. package/nitrogen/generated/shared/c++/ConnectionOptions.hpp +77 -0
  244. package/nitrogen/generated/shared/c++/ConnectionPriority.hpp +65 -0
  245. package/nitrogen/generated/shared/c++/HybridBleManagerSpec.cpp +51 -0
  246. package/nitrogen/generated/shared/c++/HybridBleManagerSpec.hpp +137 -0
  247. package/nitrogen/generated/shared/c++/HybridCharacteristicSpec.cpp +39 -0
  248. package/nitrogen/generated/shared/c++/HybridCharacteristicSpec.hpp +101 -0
  249. package/nitrogen/generated/shared/c++/HybridDescriptorSpec.cpp +30 -0
  250. package/nitrogen/generated/shared/c++/HybridDescriptorSpec.hpp +75 -0
  251. package/nitrogen/generated/shared/c++/HybridDeviceSpec.cpp +50 -0
  252. package/nitrogen/generated/shared/c++/HybridDeviceSpec.hpp +123 -0
  253. package/nitrogen/generated/shared/c++/HybridServiceSpec.cpp +32 -0
  254. package/nitrogen/generated/shared/c++/HybridServiceSpec.hpp +90 -0
  255. package/nitrogen/generated/shared/c++/LogLevel.hpp +68 -0
  256. package/nitrogen/generated/shared/c++/NativeBleError.hpp +117 -0
  257. package/nitrogen/generated/shared/c++/NativeCharacteristic.hpp +114 -0
  258. package/nitrogen/generated/shared/c++/NativeDescriptor.hpp +98 -0
  259. package/nitrogen/generated/shared/c++/NativeDevice.hpp +121 -0
  260. package/nitrogen/generated/shared/c++/NativeService.hpp +81 -0
  261. package/nitrogen/generated/shared/c++/ScanCallbackType.hpp +65 -0
  262. package/nitrogen/generated/shared/c++/ScanMode.hpp +66 -0
  263. package/nitrogen/generated/shared/c++/ScanOptions.hpp +86 -0
  264. package/nitrogen/generated/shared/c++/ServiceDataEntry.hpp +73 -0
  265. package/nitrogen/generated/shared/c++/State.hpp +68 -0
  266. package/nitrogen/generated/shared/c++/Subscription.hpp +69 -0
  267. package/package.json +15 -14
  268. package/plugin/build/index.d.ts +1 -1
  269. package/plugin/build/index.js +42 -4
  270. package/plugin/build/withBleNitro.d.ts +1 -1
  271. package/plugin/build/withBleNitro.js +16 -11
  272. package/react-native.config.js +2 -7
  273. package/src/BleManagerCompatFactory.ts +10 -10
  274. package/src/BleManagerFactory.ts +68 -5
  275. package/src/__tests__/BleManager.test.ts +2 -2
  276. package/src/__tests__/compatibility/enums.test.ts +0 -1
  277. package/src/compatibility/constants.ts +1 -1
  278. package/src/compatibility/deviceWrapper.ts +4 -4
  279. package/src/compatibility/enums.ts +1 -1
  280. package/src/compatibility/index.ts +5 -5
  281. package/src/compatibility/serviceData.ts +1 -1
  282. package/src/errors/BleError.ts +2 -2
  283. package/src/index.ts +12 -9
  284. package/src/specs/BleManager.nitro.ts +17 -4
  285. package/src/specs/Characteristic.nitro.ts +1 -1
  286. package/src/specs/Descriptor.nitro.ts +1 -1
  287. package/src/specs/Device.nitro.ts +1 -1
  288. package/src/specs/Service.nitro.ts +1 -1
  289. package/android/src/main/kotlin/co/zyke/ble/BleNitroPackage.kt +0 -37
  290. package/ios/BleNitro.podspec +0 -37
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-ble-nitro",
3
- "version": "1.0.0-beta.0",
3
+ "version": "1.0.0-beta.10",
4
4
  "description": "High-performance React Native BLE library built on Nitro Modules - drop-in replacement for react-native-ble-plx",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -11,7 +11,7 @@
11
11
  "react-native": "./src/index.ts",
12
12
  "typescript": "./src/index.ts",
13
13
  "import": "./lib/index.js",
14
- "require": "./lib/index.js",
14
+ "require": "./lib/commonjs/index.js",
15
15
  "types": "./lib/index.d.ts",
16
16
  "default": "./src/index.ts"
17
17
  },
@@ -21,15 +21,17 @@
21
21
  "types": "./plugin/build/index.d.ts",
22
22
  "default": "./plugin/build/index.js"
23
23
  },
24
+ "./app.plugin.js": "./app.plugin.cjs",
24
25
  "./package.json": "./package.json"
25
26
  },
26
27
  "scripts": {
27
- "build": "npm run clean && npm run build:plugin && tsc",
28
+ "build": "npm run clean && npm run nitro-codegen && npm run build:plugin && npm run build:esm && npm run build:commonjs",
29
+ "build:esm": "tsc",
30
+ "build:commonjs": "tsc --project tsconfig.commonjs.json",
28
31
  "build:plugin": "tsc --project plugin/tsconfig.json",
29
- "prepare": "npm run build",
30
32
  "prepublishOnly": "npm run build && npm run test",
31
- "nitro-codegen": "nitro-codegen generate",
32
- "clean": "rm -rf lib && rm -rf plugin/build",
33
+ "nitro-codegen": "nitro-codegen src",
34
+ "clean": "rimraf lib && rimraf plugin/build && rimraf nitrogen/generated",
33
35
  "test": "jest",
34
36
  "lint": "eslint src/ --ext .ts,.tsx",
35
37
  "typecheck": "tsc --noEmit",
@@ -65,25 +67,29 @@
65
67
  "react-native-nitro-modules": "*"
66
68
  },
67
69
  "devDependencies": {
70
+ "@expo/config-plugins": "^10.1.2",
68
71
  "@types/jest": "^29.5.0",
69
72
  "@types/node": "^20.0.0",
70
73
  "@types/react": "^18.2.0",
71
74
  "@typescript-eslint/eslint-plugin": "^6.21.0",
72
75
  "@typescript-eslint/parser": "^6.21.0",
73
76
  "eslint": "^8.0.0",
74
- "expo": "^52.0.47",
77
+ "expo-module-scripts": "^4.1.9",
75
78
  "jest": "^29.0.0",
76
79
  "nitro-codegen": "^0.26.4",
77
80
  "react-native": "^0.76.0",
81
+ "rimraf": "^6.0.1",
78
82
  "ts-jest": "^29.4.0",
79
- "typescript": "^5.0.0"
83
+ "typescript": "^5.8.3"
80
84
  },
81
85
  "files": [
82
86
  "lib/",
83
87
  "src/",
84
88
  "ios/",
85
89
  "android/",
86
- "plugin/build/",
90
+ "nitrogen/generated/",
91
+ "plugin/build",
92
+ "app.plugin.cjs",
87
93
  "nitro.json",
88
94
  "react-native.config.js",
89
95
  "README.md",
@@ -94,10 +100,5 @@
94
100
  "ios",
95
101
  "android"
96
102
  ]
97
- },
98
- "codegenConfig": {
99
- "name": "BleNitroSpec",
100
- "type": "modules",
101
- "jsSrcsDir": "src"
102
103
  }
103
104
  }
@@ -1,4 +1,4 @@
1
- import { ConfigPlugin } from 'expo/config-plugins';
1
+ import { ConfigPlugin } from '@expo/config-plugins';
2
2
  import withBleNitro, { withBleNitroAndroid, withBleNitroIOS, type BleNitroPluginProps } from './withBleNitro';
3
3
  /**
4
4
  * Expo Config Plugin for react-native-ble-nitro
@@ -1,4 +1,43 @@
1
- import withBleNitro, { withBleNitroAndroid, withBleNitroIOS } from './withBleNitro';
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.withBleNitroIOS = exports.withBleNitroAndroid = exports.withBleNitro = void 0;
37
+ const withBleNitro_1 = __importStar(require("./withBleNitro"));
38
+ exports.withBleNitro = withBleNitro_1.default;
39
+ Object.defineProperty(exports, "withBleNitroAndroid", { enumerable: true, get: function () { return withBleNitro_1.withBleNitroAndroid; } });
40
+ Object.defineProperty(exports, "withBleNitroIOS", { enumerable: true, get: function () { return withBleNitro_1.withBleNitroIOS; } });
2
41
  /**
3
42
  * Expo Config Plugin for react-native-ble-nitro
4
43
  *
@@ -23,7 +62,6 @@ import withBleNitro, { withBleNitroAndroid, withBleNitroIOS } from './withBleNit
23
62
  * ```
24
63
  */
25
64
  const plugin = (config, props) => {
26
- return withBleNitro(config, props || {});
65
+ return (0, withBleNitro_1.default)(config, props || {});
27
66
  };
28
- export default plugin;
29
- export { withBleNitro, withBleNitroAndroid, withBleNitroIOS };
67
+ exports.default = plugin;
@@ -1,4 +1,4 @@
1
- import { ConfigPlugin } from 'expo/config-plugins';
1
+ import { ConfigPlugin } from '@expo/config-plugins';
2
2
  export interface BleNitroPluginProps {
3
3
  /**
4
4
  * Enable background BLE support on Android.
@@ -1,4 +1,7 @@
1
- import { AndroidConfig, WarningAggregator, withAndroidManifest, withInfoPlist, } from 'expo/config-plugins';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.withBleNitroIOS = exports.withBleNitroAndroid = void 0;
4
+ const config_plugins_1 = require("@expo/config-plugins");
2
5
  const BLUETOOTH_PERMISSIONS = [
3
6
  'android.permission.BLUETOOTH',
4
7
  'android.permission.BLUETOOTH_ADMIN',
@@ -10,12 +13,12 @@ const BLUETOOTH_PERMISSIONS_API_31 = [
10
13
  'android.permission.BLUETOOTH_ADVERTISE',
11
14
  'android.permission.BLUETOOTH_CONNECT',
12
15
  ];
13
- export const withBleNitroAndroid = (config, props = {}) => {
16
+ const withBleNitroAndroid = (config, props = {}) => {
14
17
  const { isBackgroundEnabled = false, neverForLocation = false } = props;
15
- return withAndroidManifest(config, (config) => {
18
+ return (0, config_plugins_1.withAndroidManifest)(config, (config) => {
16
19
  const androidManifest = config.modResults;
17
20
  // Add required permissions
18
- AndroidConfig.Permissions.ensurePermissions(config.modResults, [
21
+ config_plugins_1.AndroidConfig.Permissions.ensurePermissions(config.modResults, [
19
22
  ...BLUETOOTH_PERMISSIONS,
20
23
  ...BLUETOOTH_PERMISSIONS_API_31,
21
24
  ]);
@@ -48,9 +51,10 @@ export const withBleNitroAndroid = (config, props = {}) => {
48
51
  return config;
49
52
  });
50
53
  };
51
- export const withBleNitroIOS = (config, props = {}) => {
54
+ exports.withBleNitroAndroid = withBleNitroAndroid;
55
+ const withBleNitroIOS = (config, props = {}) => {
52
56
  const { modes, bluetoothAlwaysPermission = 'Allow $(PRODUCT_NAME) to connect to bluetooth devices' } = props;
53
- return withInfoPlist(config, (config) => {
57
+ return (0, config_plugins_1.withInfoPlist)(config, (config) => {
54
58
  // Add NSBluetoothAlwaysUsageDescription
55
59
  if (bluetoothAlwaysPermission !== false) {
56
60
  config.modResults.NSBluetoothAlwaysUsageDescription = bluetoothAlwaysPermission;
@@ -70,18 +74,19 @@ export const withBleNitroIOS = (config, props = {}) => {
70
74
  return config;
71
75
  });
72
76
  };
77
+ exports.withBleNitroIOS = withBleNitroIOS;
73
78
  const withBleNitro = (config, props = {}) => {
74
79
  // Validate props
75
80
  if (props.neverForLocation && !props.isBackgroundEnabled) {
76
- WarningAggregator.addWarningForPlatform('android', 'react-native-ble-nitro', 'neverForLocation is set to true but isBackgroundEnabled is false. ' +
81
+ config_plugins_1.WarningAggregator.addWarningForPlatform('android', 'react-native-ble-nitro', 'neverForLocation is set to true but isBackgroundEnabled is false. ' +
77
82
  'This might cause issues with BLE scanning on some Android devices.');
78
83
  }
79
84
  if (props.modes && props.modes.some(mode => !['peripheral', 'central'].includes(mode))) {
80
- WarningAggregator.addWarningForPlatform('ios', 'react-native-ble-nitro', 'Invalid background mode specified. Only "peripheral" and "central" are supported.');
85
+ config_plugins_1.WarningAggregator.addWarningForPlatform('ios', 'react-native-ble-nitro', 'Invalid background mode specified. Only "peripheral" and "central" are supported.');
81
86
  }
82
87
  // Apply platform-specific configurations
83
- config = withBleNitroAndroid(config, props);
84
- config = withBleNitroIOS(config, props);
88
+ config = (0, exports.withBleNitroAndroid)(config, props);
89
+ config = (0, exports.withBleNitroIOS)(config, props);
85
90
  return config;
86
91
  };
87
- export default withBleNitro;
92
+ exports.default = withBleNitro;
@@ -1,13 +1,8 @@
1
1
  module.exports = {
2
2
  dependency: {
3
3
  platforms: {
4
- android: {
5
- sourceDir: './android',
6
- packageImportPath: 'import co.zyke.ble.BleNitroPackage;',
7
- },
8
- ios: {
9
- project: './ios/BleNitro.xcodeproj',
10
- },
4
+ android: {},
5
+ ios: {},
11
6
  },
12
7
  },
13
8
  };
@@ -5,8 +5,8 @@
5
5
  * by wrapping the Nitro implementation with compatibility shims
6
6
  */
7
7
 
8
- import { createBleManager } from './BleManagerFactory.js';
9
- import type { BleManager as BleManagerInterface } from './specs/BleManager.nitro.js';
8
+ import { createBleManager } from './BleManagerFactory';
9
+ import type { BleManager as BleManagerInterface } from './specs/BleManager.nitro';
10
10
  import type {
11
11
  BleManagerOptions,
12
12
  UUID,
@@ -21,16 +21,16 @@ import type {
21
21
  NativeDescriptor,
22
22
  LogLevel,
23
23
  Subscription
24
- } from './specs/types.js';
25
- import { DeviceWrapper } from './compatibility/deviceWrapper.js';
24
+ } from './specs/types';
25
+ import { DeviceWrapper } from './compatibility/deviceWrapper';
26
26
  import {
27
- stateToString,
27
+ stateToString,
28
28
  logLevelToString,
29
29
  normalizeLogLevel,
30
30
  normalizeCharacteristicSubscriptionType,
31
31
  State as PlxState,
32
32
  LogLevel as PlxLogLevel
33
- } from './compatibility/enums.js';
33
+ } from './compatibility/enums';
34
34
 
35
35
 
36
36
  /**
@@ -93,7 +93,7 @@ export class BleManagerCompat {
93
93
  async startDeviceScan(
94
94
  uuids: UUID[] | null,
95
95
  options: ScanOptions | null,
96
- listener: (error: any | null, scannedDevice: DeviceWrapper | null) => void
96
+ listener: (error: any | null, scannedDevice: DeviceWrapper | null) => void // TODO: COMPAT! remove any and move to BleError as react-native-ble-plx uses this type as well!
97
97
  ): Promise<void> {
98
98
  return await this.bleManager.startDeviceScan(uuids, options, (error, device) => {
99
99
  listener(error, device ? new DeviceWrapper(this.createDeviceFromNative(device)) : null);
@@ -131,7 +131,7 @@ export class BleManagerCompat {
131
131
 
132
132
  onDeviceDisconnected(
133
133
  deviceIdentifier: DeviceId,
134
- listener: (error: any | null, device: DeviceWrapper | null) => void
134
+ listener: (error: any | null, device: DeviceWrapper | null) => void // TODO: COMPAT! use propper error type like in react-native-ble-plx!!!
135
135
  ): Subscription {
136
136
  return this.bleManager.onDeviceDisconnected(deviceIdentifier, (error, device) => {
137
137
  listener(error, device ? new DeviceWrapper(this.createDeviceFromNative(device)) : null);
@@ -255,7 +255,7 @@ export class BleManagerCompat {
255
255
  deviceIdentifier: DeviceId,
256
256
  serviceUUID: UUID,
257
257
  characteristicUUID: UUID,
258
- listener: (error: any | null, characteristic: NativeCharacteristic | null) => void,
258
+ listener: (error: any | null, characteristic: NativeCharacteristic | null) => void, // TODO: COMPAT! use proper error type like in react-native-ble-plx
259
259
  transactionId?: TransactionId,
260
260
  subscriptionType?: 'notification' | 'indication'
261
261
  ): Subscription {
@@ -324,7 +324,7 @@ export class BleManagerCompat {
324
324
  * Helper method to create a Device wrapper from NativeDevice data
325
325
  * This is a temporary method until we have proper Device Nitro objects
326
326
  */
327
- private createDeviceFromNative(nativeDevice: NativeDevice): any {
327
+ private createDeviceFromNative(nativeDevice: NativeDevice) {
328
328
  // This is a placeholder - in the actual implementation, we'd need to create
329
329
  // proper Nitro Device objects, but for now we'll work with the native data
330
330
  return {
@@ -1,6 +1,12 @@
1
1
  import { NitroModules } from 'react-native-nitro-modules';
2
- import type { BleManager as BleManagerInterface } from './specs/BleManager.nitro.js';
3
- import type { BleManagerOptions } from './specs/types.js';
2
+ import type { BleManager as BleManagerInterface, BleManagerNitroOptions } from './specs/BleManager.nitro';
3
+ import type { BleManagerOptions } from './specs/types';
4
+
5
+ // Store callbacks that can't be passed to Nitro
6
+ const storedCallbacks = new WeakMap<BleManagerInterface, {
7
+ restoreStateFunction?: (restoredState: any) => void;
8
+ errorCodesToMessagesMapping?: { [key: number]: string };
9
+ }>();
4
10
 
5
11
  /**
6
12
  * Creates a BleManager instance using Nitro Modules
@@ -16,15 +22,72 @@ export function createBleManager(options?: BleManagerOptions): BleManagerInterfa
16
22
  );
17
23
  }
18
24
 
19
- // If options are provided, we could initialize with them
20
- // For now, we return the module directly as Nitro handles the native initialization
25
+ // Initialize with options if provided
26
+ if (options) {
27
+ // Extract Nitro-compatible options
28
+ const nitroOptions: BleManagerNitroOptions = {
29
+ restoreStateIdentifier: options.restoreStateIdentifier,
30
+ };
31
+
32
+ // Store callbacks and mappings that can't be passed to Nitro
33
+ if (options.restoreStateFunction || options.errorCodesToMessagesMapping) {
34
+ storedCallbacks.set(BleManagerModule, {
35
+ restoreStateFunction: options.restoreStateFunction,
36
+ errorCodesToMessagesMapping: options.errorCodesToMessagesMapping,
37
+ });
38
+ }
39
+
40
+ // Note: initialize() is async but we need to maintain sync compatibility with react-native-ble-plx
41
+ // The initialization will happen asynchronously in the background
42
+ BleManagerModule.initialize(nitroOptions).then(async () => {
43
+ // Check for restored state and call the callback if available
44
+ if (options.restoreStateFunction) {
45
+ try {
46
+ const restoredState = await BleManagerModule.getRestoredState();
47
+ if (restoredState) {
48
+ options.restoreStateFunction(restoredState);
49
+ }
50
+ } catch (error) {
51
+ console.warn('BleManager restore state callback failed:', error);
52
+ }
53
+ }
54
+ }).catch(error => {
55
+ console.warn('BleManager initialization failed:', error);
56
+ });
57
+ }
58
+
21
59
  return BleManagerModule;
22
60
  }
23
61
 
62
+ /**
63
+ * Helper function to retrieve stored callbacks for a BleManager instance
64
+ * This is used internally when callbacks need to be invoked
65
+ */
66
+ export function getStoredCallbacks(manager: BleManagerInterface) {
67
+ return storedCallbacks.get(manager);
68
+ }
69
+
70
+ /**
71
+ * Helper function to get custom error message if available
72
+ * @param manager The BleManager instance
73
+ * @param errorCode The BLE error code
74
+ * @param defaultMessage Default error message
75
+ * @returns Custom message if available, otherwise default message
76
+ */
77
+ export function getCustomErrorMessage(
78
+ manager: BleManagerInterface,
79
+ errorCode: number,
80
+ defaultMessage: string
81
+ ): string {
82
+ const callbacks = storedCallbacks.get(manager);
83
+ const customMessage = callbacks?.errorCodesToMessagesMapping?.[errorCode];
84
+ return customMessage || defaultMessage;
85
+ }
86
+
24
87
  /**
25
88
  * Legacy compatibility: Export a BleManager constructor function
26
89
  * This maintains compatibility with code that imports { BleManager } from 'react-native-ble-plx'
27
90
  */
28
91
  export const BleManager = function(options?: BleManagerOptions): BleManagerInterface {
29
92
  return createBleManager(options);
30
- } as any;
93
+ } as (options?: BleManagerOptions) => BleManagerInterface;
@@ -4,8 +4,8 @@
4
4
  * Copyright © 2025 Zyke (https://zyke.co)
5
5
  */
6
6
 
7
- import { BleManager } from '../index.js';
8
- import { State, LogLevel } from '../specs/types.js';
7
+ import { BleManager } from '../index';
8
+ import { State, LogLevel } from '../specs/types';
9
9
 
10
10
  // Create a mock Nitro manager
11
11
  const mockNitroManager = {
@@ -16,7 +16,6 @@ import {
16
16
  normalizeCharacteristicSubscriptionType,
17
17
  State,
18
18
  LogLevel,
19
- type CharacteristicSubscriptionType
20
19
  } from '../../compatibility/enums';
21
20
  import {
22
21
  State as NitroState,
@@ -68,4 +68,4 @@ export {
68
68
  BleATTErrorCode,
69
69
  BleIOSErrorCode,
70
70
  BleAndroidErrorCode
71
- } from '../specs/types.js';
71
+ } from '../specs/types';
@@ -4,7 +4,7 @@
4
4
  * Wraps Nitro Device objects to provide the original react-native-ble-plx API
5
5
  */
6
6
 
7
- import type { Device as NitroDevice } from '../specs/Device.nitro.js';
7
+ import type { Device as NitroDevice } from '../specs/Device.nitro';
8
8
  import type {
9
9
  NativeDevice,
10
10
  UUID,
@@ -19,13 +19,13 @@ import type {
19
19
  NativeDescriptor,
20
20
  CharacteristicSubscriptionType,
21
21
  Subscription
22
- } from '../specs/types.js';
23
- import { serviceDataArrayToMap } from './serviceData.js';
22
+ } from '../specs/types';
23
+ import { serviceDataArrayToMap } from './serviceData';
24
24
  import {
25
25
  normalizeCharacteristicSubscriptionType,
26
26
  stateToString,
27
27
  characteristicSubscriptionTypeToString
28
- } from './enums.js';
28
+ } from './enums';
29
29
 
30
30
  /**
31
31
  * Device wrapper that provides react-native-ble-plx compatibility
@@ -11,7 +11,7 @@ import {
11
11
  LogLevel as NitroLogLevel,
12
12
  CharacteristicSubscriptionType as NitroCharacteristicSubscriptionType,
13
13
  RefreshGattMoment as NitroRefreshGattMoment,
14
- } from '../specs/types.js';
14
+ } from '../specs/types';
15
15
 
16
16
  // Define exact string enums and types matching react-native-ble-plx
17
17
  export enum State {
@@ -6,9 +6,9 @@
6
6
  * Nitro's type system constraints.
7
7
  */
8
8
 
9
- export * from './serviceData.js';
10
- export * from './deviceWrapper.js';
11
- export * from './constants.js';
9
+ export * from './serviceData';
10
+ export * from './deviceWrapper';
11
+ export * from './constants';
12
12
 
13
13
  // Explicitly export enum utilities and enums to avoid conflicts
14
14
  export {
@@ -23,10 +23,10 @@ export {
23
23
  normalizeCharacteristicSubscriptionType,
24
24
  State,
25
25
  LogLevel
26
- } from './enums.js';
26
+ } from './enums';
27
27
 
28
28
  // Export type literals (not enums) for exact react-native-ble-plx compatibility
29
29
  export type {
30
30
  CharacteristicSubscriptionType,
31
31
  RefreshGattMoment
32
- } from './enums.js';
32
+ } from './enums';
@@ -5,7 +5,7 @@
5
5
  * and the original { [uuid: string]: Base64 } format from react-native-ble-plx
6
6
  */
7
7
 
8
- import type { ServiceDataEntry, UUID, Base64 } from '../specs/types.js';
8
+ import type { ServiceDataEntry, UUID, Base64 } from '../specs/types';
9
9
 
10
10
  /**
11
11
  * Convert ServiceDataEntry array to the original index signature format
@@ -3,11 +3,11 @@ import {
3
3
  BleATTErrorCode,
4
4
  BleIOSErrorCode,
5
5
  BleAndroidErrorCode
6
- } from '../specs/types.js';
6
+ } from '../specs/types';
7
7
  import type {
8
8
  NativeBleError,
9
9
  BleErrorCodeMessageMapping
10
- } from '../specs/types.js';
10
+ } from '../specs/types';
11
11
 
12
12
  /**
13
13
  * Default error messages for BLE error codes
package/src/index.ts CHANGED
@@ -1,17 +1,20 @@
1
1
  // Export compatibility layer types and constants
2
- export * from './compatibility/constants.js';
2
+ export * from './compatibility/constants';
3
3
 
4
4
  // Export utility functions
5
- export * from './utils/index.js';
5
+ export * from './utils/index';
6
6
 
7
7
  // Export the main BleManager instance with compatibility wrapper
8
- export { BleManagerCompat as BleManager, createBleManagerCompat as createBleManager } from './BleManagerCompatFactory.js';
8
+ export { BleManagerCompat as BleManager, createBleManagerCompat as createBleManager } from './BleManagerCompatFactory';
9
+
10
+ // Export BleManager factory utilities (for internal use by error handling)
11
+ export { getCustomErrorMessage, getStoredCallbacks } from './BleManagerFactory';
9
12
 
10
13
  // Export error handling utilities
11
- export * from './errors/BleError.js';
14
+ export * from './errors/BleError';
12
15
 
13
16
  // Export device wrapper for compatibility
14
- export { DeviceWrapper as Device } from './compatibility/deviceWrapper.js';
17
+ export { DeviceWrapper as Device } from './compatibility/deviceWrapper';
15
18
 
16
19
  // Export interfaces for TypeScript (but not runtime values)
17
20
  export type {
@@ -24,19 +27,19 @@ export type {
24
27
  NativeCharacteristic,
25
28
  NativeDescriptor,
26
29
  Subscription
27
- } from './specs/types.js';
30
+ } from './specs/types';
28
31
 
29
32
  // Export react-native-ble-plx compatible enum types (drop-in replacement)
30
33
  export {
31
34
  State,
32
35
  LogLevel
33
- } from './compatibility/enums.js';
36
+ } from './compatibility/enums';
34
37
 
35
38
  // Export react-native-ble-plx compatible type literals (drop-in replacement)
36
39
  export type {
37
40
  CharacteristicSubscriptionType,
38
41
  RefreshGattMoment
39
- } from './compatibility/enums.js';
42
+ } from './compatibility/enums';
40
43
 
41
44
  // Re-export react-native-ble-plx compatible API
42
- export { fullUUID } from './utils/uuid.js';
45
+ export { fullUUID } from './utils/uuid';
@@ -8,7 +8,6 @@ import type {
8
8
  ConnectionPriority,
9
9
  ScanOptions,
10
10
  ConnectionOptions,
11
- BleManagerOptions,
12
11
  StateListener,
13
12
  DeviceScanListener,
14
13
  DeviceDisconnectedListener,
@@ -18,16 +17,30 @@ import type {
18
17
  NativeService,
19
18
  NativeCharacteristic,
20
19
  NativeDescriptor,
21
- NativeBleError,
22
- BleRestoredState,
23
20
  Base64,
24
21
  Subscription
25
- } from './types.js';
22
+ } from './types';
23
+
24
+ // Nitro-compatible options interface (simplified without functions)
25
+ export interface BleManagerNitroOptions {
26
+ restoreStateIdentifier?: string;
27
+ }
28
+
29
+ // Interface for restored state data
30
+ export interface BleRestoredState {
31
+ connectedPeripherals: NativeDevice[];
32
+ }
26
33
 
27
34
  export interface BleManager extends HybridObject<{ ios: 'swift'; android: 'kotlin' }> {
28
35
  // Lifecycle
29
36
  destroy(): Promise<void>;
30
37
 
38
+ // Initialization - Configure the BLE manager with options
39
+ initialize(options: BleManagerNitroOptions): Promise<void>;
40
+
41
+ // Get restored state if available (called after initialization)
42
+ getRestoredState(): Promise<BleRestoredState | null>;
43
+
31
44
  // Common operations
32
45
  setLogLevel(logLevel: LogLevel): Promise<LogLevel>;
33
46
  logLevel(): Promise<LogLevel>;
@@ -9,7 +9,7 @@ import type {
9
9
  NativeDescriptor,
10
10
  CharacteristicMonitorListener,
11
11
  Subscription
12
- } from './types.js';
12
+ } from './types';
13
13
 
14
14
  export interface Characteristic extends HybridObject<{ ios: 'swift'; android: 'kotlin' }> {
15
15
  // Characteristic properties
@@ -5,7 +5,7 @@ import type {
5
5
  DeviceId,
6
6
  Base64,
7
7
  TransactionId
8
- } from './types.js';
8
+ } from './types';
9
9
 
10
10
  export interface Descriptor extends HybridObject<{ ios: 'swift'; android: 'kotlin' }> {
11
11
  // Descriptor properties
@@ -15,7 +15,7 @@ import type {
15
15
  DeviceDisconnectedListener,
16
16
  CharacteristicMonitorListener,
17
17
  Subscription
18
- } from './types.js';
18
+ } from './types';
19
19
 
20
20
  export interface Device extends HybridObject<{ ios: 'swift'; android: 'kotlin' }> {
21
21
  // Device properties
@@ -10,7 +10,7 @@ import type {
10
10
  NativeDescriptor,
11
11
  CharacteristicMonitorListener,
12
12
  Subscription
13
- } from './types.js';
13
+ } from './types';
14
14
 
15
15
  export interface Service extends HybridObject<{ ios: 'swift'; android: 'kotlin' }> {
16
16
  // Service properties