@ovok/native 1.16.1-rc.3 → 1.16.1-rc.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (597) hide show
  1. package/lib/commonjs/modules/bt-management/components/android-bluetooth-foreground-service.js +3 -1
  2. package/lib/commonjs/modules/bt-management/components/android-bluetooth-foreground-service.js.map +1 -1
  3. package/lib/commonjs/modules/bt-management/components/bluetooth-device-picker.js +9 -141
  4. package/lib/commonjs/modules/bt-management/components/bluetooth-device-picker.js.map +1 -1
  5. package/lib/commonjs/modules/bt-management/components/bt-provider-child-wrapper.js +1 -0
  6. package/lib/commonjs/modules/bt-management/components/bt-provider-child-wrapper.js.map +1 -1
  7. package/lib/commonjs/modules/bt-management/components/device-picker-sheet.js +160 -0
  8. package/lib/commonjs/modules/bt-management/components/device-picker-sheet.js.map +1 -0
  9. package/lib/commonjs/modules/bt-management/hooks/runtime-context.js.map +1 -1
  10. package/lib/commonjs/modules/bt-management/hooks/use-bluetooth-permission.js +2 -1
  11. package/lib/commonjs/modules/bt-management/hooks/use-bluetooth-permission.js.map +1 -1
  12. package/lib/commonjs/modules/bt-management/hooks/use-measurements.js +1 -1
  13. package/lib/commonjs/modules/bt-management/hooks/use-measurements.js.map +1 -1
  14. package/lib/commonjs/modules/bt-management/index.js +12 -0
  15. package/lib/commonjs/modules/bt-management/index.js.map +1 -1
  16. package/lib/commonjs/modules/bt-management/services/bt-manager.js +50 -0
  17. package/lib/commonjs/modules/bt-management/services/bt-manager.js.map +1 -1
  18. package/lib/commonjs/modules/bt-management/services/custom/define-custom-device.js +3 -0
  19. package/lib/commonjs/modules/bt-management/services/custom/define-custom-device.js.map +1 -1
  20. package/lib/commonjs/modules/bt-management/services/devices/bt-command-writer.js +4 -2
  21. package/lib/commonjs/modules/bt-management/services/devices/bt-command-writer.js.map +1 -1
  22. package/lib/commonjs/modules/bt-management/services/devices/bt-connection-handler.js +97 -28
  23. package/lib/commonjs/modules/bt-management/services/devices/bt-connection-handler.js.map +1 -1
  24. package/lib/commonjs/modules/bt-management/services/devices/bt-current-time.js +59 -0
  25. package/lib/commonjs/modules/bt-management/services/devices/bt-current-time.js.map +1 -0
  26. package/lib/commonjs/modules/bt-management/services/devices/bt-device-information.js +18 -37
  27. package/lib/commonjs/modules/bt-management/services/devices/bt-device-information.js.map +1 -1
  28. package/lib/commonjs/modules/bt-management/services/devices/bt-managed-device.js +31 -3
  29. package/lib/commonjs/modules/bt-management/services/devices/bt-managed-device.js.map +1 -1
  30. package/lib/commonjs/modules/bt-management/services/devices/bt-notification-readiness.js +68 -0
  31. package/lib/commonjs/modules/bt-management/services/devices/bt-notification-readiness.js.map +1 -0
  32. package/lib/commonjs/modules/bt-management/services/devices/bt-pairing-retry.js +70 -0
  33. package/lib/commonjs/modules/bt-management/services/devices/bt-pairing-retry.js.map +1 -0
  34. package/lib/commonjs/modules/bt-management/services/devices/custom/custom.device.js +14 -0
  35. package/lib/commonjs/modules/bt-management/services/devices/custom/custom.device.js.map +1 -1
  36. package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.blood-pressure-status.js +4 -7
  37. package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.blood-pressure-status.js.map +1 -1
  38. package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.decorators.js +106 -0
  39. package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.decorators.js.map +1 -0
  40. package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.js +38 -31
  41. package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.js.map +1 -1
  42. package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.frame.js +41 -0
  43. package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.frame.js.map +1 -0
  44. package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose-details.js +77 -0
  45. package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose-details.js.map +1 -0
  46. package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose-frame.js +49 -0
  47. package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose-frame.js.map +1 -0
  48. package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose-racp.js +89 -0
  49. package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose-racp.js.map +1 -0
  50. package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose.js +35 -42
  51. package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose.js.map +1 -1
  52. package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.js +22 -24
  53. package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.js.map +1 -1
  54. package/lib/commonjs/modules/bt-management/services/record-cursor.js +70 -0
  55. package/lib/commonjs/modules/bt-management/services/record-cursor.js.map +1 -0
  56. package/lib/commonjs/modules/bt-management/testing/fake-ble-manager.js +8 -0
  57. package/lib/commonjs/modules/bt-management/testing/fake-ble-manager.js.map +1 -1
  58. package/lib/commonjs/modules/bt-management/types/glucose-record-details.js +2 -0
  59. package/lib/commonjs/modules/bt-management/types/glucose-record-details.js.map +1 -0
  60. package/lib/commonjs/modules/bt-management/utils/bluetooth-permission-list.js +19 -0
  61. package/lib/commonjs/modules/bt-management/utils/bluetooth-permission-list.js.map +1 -0
  62. package/lib/commonjs/modules/bt-management/utils/device-user.js +22 -0
  63. package/lib/commonjs/modules/bt-management/utils/device-user.js.map +1 -0
  64. package/lib/commonjs/modules/bt-management/utils/kpa-to-mmhg.js +9 -0
  65. package/lib/commonjs/modules/bt-management/utils/kpa-to-mmhg.js.map +1 -0
  66. package/lib/commonjs/modules/bt-management/utils/result-identity.js +26 -35
  67. package/lib/commonjs/modules/bt-management/utils/result-identity.js.map +1 -1
  68. package/lib/commonjs/modules/bt-management/utils/rr-interval.js +16 -0
  69. package/lib/commonjs/modules/bt-management/utils/rr-interval.js.map +1 -0
  70. package/lib/commonjs/modules/bt-management/utils/temperature-type.js +15 -0
  71. package/lib/commonjs/modules/bt-management/utils/temperature-type.js.map +1 -0
  72. package/lib/commonjs/modules/bt-management/utils/wait.js +10 -0
  73. package/lib/commonjs/modules/bt-management/utils/wait.js.map +1 -0
  74. package/lib/commonjs/modules/next/background-sync/index.js +28 -0
  75. package/lib/commonjs/modules/next/background-sync/index.js.map +1 -0
  76. package/lib/commonjs/modules/next/background-sync/offline-measurement-background-sync.js +63 -0
  77. package/lib/commonjs/modules/next/background-sync/offline-measurement-background-sync.js.map +1 -0
  78. package/lib/commonjs/modules/next/bluetooth/auto-connect.js +32 -0
  79. package/lib/commonjs/modules/next/bluetooth/auto-connect.js.map +1 -0
  80. package/lib/commonjs/modules/next/bluetooth/ble-plx/ble-errors.js +33 -0
  81. package/lib/commonjs/modules/next/bluetooth/ble-plx/ble-errors.js.map +1 -0
  82. package/lib/commonjs/modules/next/bluetooth/ble-plx/ble-link.js +162 -0
  83. package/lib/commonjs/modules/next/bluetooth/ble-plx/ble-link.js.map +1 -0
  84. package/lib/commonjs/modules/next/bluetooth/ble-plx/ble-scanner.js +75 -0
  85. package/lib/commonjs/modules/next/bluetooth/ble-plx/ble-scanner.js.map +1 -0
  86. package/lib/commonjs/modules/next/bluetooth/ble-plx/built-in-devices.js +34 -0
  87. package/lib/commonjs/modules/next/bluetooth/ble-plx/built-in-devices.js.map +1 -0
  88. package/lib/commonjs/modules/next/bluetooth/ble-plx/legacy-driver.js +67 -0
  89. package/lib/commonjs/modules/next/bluetooth/ble-plx/legacy-driver.js.map +1 -0
  90. package/lib/commonjs/modules/next/bluetooth/connections.js +114 -0
  91. package/lib/commonjs/modules/next/bluetooth/connections.js.map +1 -0
  92. package/lib/commonjs/modules/next/bluetooth/daily-total-day.js.map +1 -0
  93. package/lib/commonjs/modules/next/bluetooth/devices.js +41 -0
  94. package/lib/commonjs/modules/next/bluetooth/devices.js.map +1 -0
  95. package/lib/commonjs/modules/next/bluetooth/driver.js +30 -20
  96. package/lib/commonjs/modules/next/bluetooth/driver.js.map +1 -1
  97. package/lib/commonjs/modules/next/bluetooth/errors.js +26 -0
  98. package/lib/commonjs/modules/next/bluetooth/errors.js.map +1 -0
  99. package/lib/commonjs/modules/next/bluetooth/index.js +122 -11
  100. package/lib/commonjs/modules/next/bluetooth/index.js.map +1 -1
  101. package/lib/commonjs/modules/next/bluetooth/link.js +0 -103
  102. package/lib/commonjs/modules/next/bluetooth/link.js.map +1 -1
  103. package/lib/commonjs/modules/next/bluetooth/paired.js +50 -0
  104. package/lib/commonjs/modules/next/bluetooth/paired.js.map +1 -0
  105. package/lib/commonjs/modules/next/bluetooth/permissions.js +2 -0
  106. package/lib/commonjs/modules/next/bluetooth/permissions.js.map +1 -0
  107. package/lib/commonjs/modules/next/bluetooth/react/bluetooth-device-picker.js +44 -0
  108. package/lib/commonjs/modules/next/bluetooth/react/bluetooth-device-picker.js.map +1 -0
  109. package/lib/commonjs/modules/next/bluetooth/react/context.js +54 -0
  110. package/lib/commonjs/modules/next/bluetooth/react/context.js.map +1 -0
  111. package/lib/commonjs/modules/next/bluetooth/react/hooks.js +86 -0
  112. package/lib/commonjs/modules/next/bluetooth/react/hooks.js.map +1 -0
  113. package/lib/commonjs/modules/next/bluetooth/react-native/create-bluetooth-runtime.js +28 -0
  114. package/lib/commonjs/modules/next/bluetooth/react-native/create-bluetooth-runtime.js.map +1 -0
  115. package/lib/commonjs/modules/next/bluetooth/react-native/os-permissions.js +32 -0
  116. package/lib/commonjs/modules/next/bluetooth/react-native/os-permissions.js.map +1 -0
  117. package/lib/commonjs/modules/next/bluetooth/react-native/ovok-sink.js +43 -0
  118. package/lib/commonjs/modules/next/bluetooth/react-native/ovok-sink.js.map +1 -0
  119. package/lib/commonjs/modules/next/bluetooth/readings.js +93 -0
  120. package/lib/commonjs/modules/next/bluetooth/readings.js.map +1 -0
  121. package/lib/commonjs/modules/next/bluetooth/result-policy.js +15 -2
  122. package/lib/commonjs/modules/next/bluetooth/result-policy.js.map +1 -1
  123. package/lib/commonjs/modules/next/bluetooth/runtime.js +223 -0
  124. package/lib/commonjs/modules/next/bluetooth/runtime.js.map +1 -0
  125. package/lib/commonjs/modules/next/bluetooth/scan-loop.js +82 -0
  126. package/lib/commonjs/modules/next/bluetooth/scan-loop.js.map +1 -0
  127. package/lib/commonjs/modules/next/bluetooth/sig-profiles.js +46 -13
  128. package/lib/commonjs/modules/next/bluetooth/sig-profiles.js.map +1 -1
  129. package/lib/commonjs/modules/next/bluetooth/sink.js +6 -0
  130. package/lib/commonjs/modules/next/bluetooth/sink.js.map +1 -0
  131. package/lib/commonjs/modules/next/bluetooth/snapshot.js +6 -0
  132. package/lib/commonjs/modules/next/bluetooth/snapshot.js.map +1 -0
  133. package/lib/commonjs/modules/next/bluetooth/stable-hash.js +42 -0
  134. package/lib/commonjs/modules/next/bluetooth/stable-hash.js.map +1 -0
  135. package/lib/commonjs/modules/next/bluetooth/store.js +61 -0
  136. package/lib/commonjs/modules/next/bluetooth/store.js.map +1 -0
  137. package/lib/commonjs/modules/next/bluetooth/transport.js +6 -0
  138. package/lib/commonjs/modules/next/bluetooth/transport.js.map +1 -0
  139. package/lib/commonjs/modules/next/data-sync/index.js +17 -0
  140. package/lib/commonjs/modules/next/data-sync/index.js.map +1 -0
  141. package/lib/module/modules/bt-management/components/android-bluetooth-foreground-service.js +3 -1
  142. package/lib/module/modules/bt-management/components/android-bluetooth-foreground-service.js.map +1 -1
  143. package/lib/module/modules/bt-management/components/bluetooth-device-picker.js +9 -141
  144. package/lib/module/modules/bt-management/components/bluetooth-device-picker.js.map +1 -1
  145. package/lib/module/modules/bt-management/components/bt-provider-child-wrapper.js +1 -0
  146. package/lib/module/modules/bt-management/components/bt-provider-child-wrapper.js.map +1 -1
  147. package/lib/module/modules/bt-management/components/device-picker-sheet.js +154 -0
  148. package/lib/module/modules/bt-management/components/device-picker-sheet.js.map +1 -0
  149. package/lib/module/modules/bt-management/hooks/runtime-context.js.map +1 -1
  150. package/lib/module/modules/bt-management/hooks/use-bluetooth-permission.js +4 -3
  151. package/lib/module/modules/bt-management/hooks/use-bluetooth-permission.js.map +1 -1
  152. package/lib/module/modules/bt-management/hooks/use-measurements.js +1 -1
  153. package/lib/module/modules/bt-management/hooks/use-measurements.js.map +1 -1
  154. package/lib/module/modules/bt-management/index.js +1 -0
  155. package/lib/module/modules/bt-management/index.js.map +1 -1
  156. package/lib/module/modules/bt-management/services/bt-manager.js +50 -0
  157. package/lib/module/modules/bt-management/services/bt-manager.js.map +1 -1
  158. package/lib/module/modules/bt-management/services/custom/define-custom-device.js +3 -0
  159. package/lib/module/modules/bt-management/services/custom/define-custom-device.js.map +1 -1
  160. package/lib/module/modules/bt-management/services/devices/bt-command-writer.js +4 -2
  161. package/lib/module/modules/bt-management/services/devices/bt-command-writer.js.map +1 -1
  162. package/lib/module/modules/bt-management/services/devices/bt-connection-handler.js +97 -28
  163. package/lib/module/modules/bt-management/services/devices/bt-connection-handler.js.map +1 -1
  164. package/lib/module/modules/bt-management/services/devices/bt-current-time.js +55 -0
  165. package/lib/module/modules/bt-management/services/devices/bt-current-time.js.map +1 -0
  166. package/lib/module/modules/bt-management/services/devices/bt-device-information.js +18 -37
  167. package/lib/module/modules/bt-management/services/devices/bt-device-information.js.map +1 -1
  168. package/lib/module/modules/bt-management/services/devices/bt-managed-device.js +33 -5
  169. package/lib/module/modules/bt-management/services/devices/bt-managed-device.js.map +1 -1
  170. package/lib/module/modules/bt-management/services/devices/bt-notification-readiness.js +65 -0
  171. package/lib/module/modules/bt-management/services/devices/bt-notification-readiness.js.map +1 -0
  172. package/lib/module/modules/bt-management/services/devices/bt-pairing-retry.js +65 -0
  173. package/lib/module/modules/bt-management/services/devices/bt-pairing-retry.js.map +1 -0
  174. package/lib/module/modules/bt-management/services/devices/custom/custom.device.js +14 -0
  175. package/lib/module/modules/bt-management/services/devices/custom/custom.device.js.map +1 -1
  176. package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.blood-pressure-status.js +1 -4
  177. package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.blood-pressure-status.js.map +1 -1
  178. package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.decorators.js +99 -0
  179. package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.decorators.js.map +1 -0
  180. package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.js +38 -31
  181. package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.js.map +1 -1
  182. package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.frame.js +35 -0
  183. package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.frame.js.map +1 -0
  184. package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose-details.js +72 -0
  185. package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose-details.js.map +1 -0
  186. package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose-frame.js +40 -0
  187. package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose-frame.js.map +1 -0
  188. package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose-racp.js +85 -0
  189. package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose-racp.js.map +1 -0
  190. package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose.js +25 -32
  191. package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose.js.map +1 -1
  192. package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.js +18 -20
  193. package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.js.map +1 -1
  194. package/lib/module/modules/bt-management/services/record-cursor.js +66 -0
  195. package/lib/module/modules/bt-management/services/record-cursor.js.map +1 -0
  196. package/lib/module/modules/bt-management/testing/fake-ble-manager.js +8 -0
  197. package/lib/module/modules/bt-management/testing/fake-ble-manager.js.map +1 -1
  198. package/lib/module/modules/bt-management/types/custom-device-definition.js +4 -0
  199. package/lib/module/modules/bt-management/types/custom-device-definition.js.map +1 -1
  200. package/lib/module/modules/bt-management/types/glucose-record-details.js +2 -0
  201. package/lib/module/modules/bt-management/types/glucose-record-details.js.map +1 -0
  202. package/lib/module/modules/bt-management/utils/bluetooth-permission-list.js +14 -0
  203. package/lib/module/modules/bt-management/utils/bluetooth-permission-list.js.map +1 -0
  204. package/lib/module/modules/bt-management/utils/device-user.js +17 -0
  205. package/lib/module/modules/bt-management/utils/device-user.js.map +1 -0
  206. package/lib/module/modules/bt-management/utils/kpa-to-mmhg.js +6 -0
  207. package/lib/module/modules/bt-management/utils/kpa-to-mmhg.js.map +1 -0
  208. package/lib/module/modules/bt-management/utils/result-identity.js +23 -33
  209. package/lib/module/modules/bt-management/utils/result-identity.js.map +1 -1
  210. package/lib/module/modules/bt-management/utils/rr-interval.js +12 -0
  211. package/lib/module/modules/bt-management/utils/rr-interval.js.map +1 -0
  212. package/lib/module/modules/bt-management/utils/temperature-type.js +11 -0
  213. package/lib/module/modules/bt-management/utils/temperature-type.js.map +1 -0
  214. package/lib/module/modules/bt-management/utils/wait.js +5 -0
  215. package/lib/module/modules/bt-management/utils/wait.js.map +1 -0
  216. package/lib/module/modules/next/background-sync/index.js +12 -0
  217. package/lib/module/modules/next/background-sync/index.js.map +1 -0
  218. package/lib/module/modules/next/background-sync/offline-measurement-background-sync.js +55 -0
  219. package/lib/module/modules/next/background-sync/offline-measurement-background-sync.js.map +1 -0
  220. package/lib/module/modules/next/bluetooth/auto-connect.js +28 -0
  221. package/lib/module/modules/next/bluetooth/auto-connect.js.map +1 -0
  222. package/lib/module/modules/next/bluetooth/ble-plx/ble-errors.js +28 -0
  223. package/lib/module/modules/next/bluetooth/ble-plx/ble-errors.js.map +1 -0
  224. package/lib/module/modules/next/bluetooth/ble-plx/ble-link.js +159 -0
  225. package/lib/module/modules/next/bluetooth/ble-plx/ble-link.js.map +1 -0
  226. package/lib/module/modules/next/bluetooth/ble-plx/ble-scanner.js +69 -0
  227. package/lib/module/modules/next/bluetooth/ble-plx/ble-scanner.js.map +1 -0
  228. package/lib/module/modules/next/bluetooth/ble-plx/built-in-devices.js +31 -0
  229. package/lib/module/modules/next/bluetooth/ble-plx/built-in-devices.js.map +1 -0
  230. package/lib/module/modules/next/bluetooth/ble-plx/legacy-driver.js +63 -0
  231. package/lib/module/modules/next/bluetooth/ble-plx/legacy-driver.js.map +1 -0
  232. package/lib/module/modules/next/bluetooth/connections.js +110 -0
  233. package/lib/module/modules/next/bluetooth/connections.js.map +1 -0
  234. package/lib/module/modules/next/bluetooth/daily-total-day.js.map +1 -0
  235. package/lib/module/modules/next/bluetooth/devices.js +37 -0
  236. package/lib/module/modules/next/bluetooth/devices.js.map +1 -0
  237. package/lib/module/modules/next/bluetooth/driver.js +29 -20
  238. package/lib/module/modules/next/bluetooth/driver.js.map +1 -1
  239. package/lib/module/modules/next/bluetooth/errors.js +21 -0
  240. package/lib/module/modules/next/bluetooth/errors.js.map +1 -0
  241. package/lib/module/modules/next/bluetooth/index.js +22 -4
  242. package/lib/module/modules/next/bluetooth/index.js.map +1 -1
  243. package/lib/module/modules/next/bluetooth/link.js +0 -101
  244. package/lib/module/modules/next/bluetooth/link.js.map +1 -1
  245. package/lib/module/modules/next/bluetooth/paired.js +46 -0
  246. package/lib/module/modules/next/bluetooth/paired.js.map +1 -0
  247. package/lib/module/modules/next/bluetooth/permissions.js +2 -0
  248. package/lib/module/modules/next/bluetooth/permissions.js.map +1 -0
  249. package/lib/module/modules/next/bluetooth/react/bluetooth-device-picker.js +39 -0
  250. package/lib/module/modules/next/bluetooth/react/bluetooth-device-picker.js.map +1 -0
  251. package/lib/module/modules/next/bluetooth/react/context.js +48 -0
  252. package/lib/module/modules/next/bluetooth/react/context.js.map +1 -0
  253. package/lib/module/modules/next/bluetooth/react/hooks.js +76 -0
  254. package/lib/module/modules/next/bluetooth/react/hooks.js.map +1 -0
  255. package/lib/module/modules/next/bluetooth/react-native/create-bluetooth-runtime.js +25 -0
  256. package/lib/module/modules/next/bluetooth/react-native/create-bluetooth-runtime.js.map +1 -0
  257. package/lib/module/modules/next/bluetooth/react-native/os-permissions.js +28 -0
  258. package/lib/module/modules/next/bluetooth/react-native/os-permissions.js.map +1 -0
  259. package/lib/module/modules/next/bluetooth/react-native/ovok-sink.js +39 -0
  260. package/lib/module/modules/next/bluetooth/react-native/ovok-sink.js.map +1 -0
  261. package/lib/module/modules/next/bluetooth/readings.js +89 -0
  262. package/lib/module/modules/next/bluetooth/readings.js.map +1 -0
  263. package/lib/module/modules/next/bluetooth/result-policy.js +14 -2
  264. package/lib/module/modules/next/bluetooth/result-policy.js.map +1 -1
  265. package/lib/module/modules/next/bluetooth/runtime.js +220 -0
  266. package/lib/module/modules/next/bluetooth/runtime.js.map +1 -0
  267. package/lib/module/modules/next/bluetooth/scan-loop.js +78 -0
  268. package/lib/module/modules/next/bluetooth/scan-loop.js.map +1 -0
  269. package/lib/module/modules/next/bluetooth/sig-profiles.js +44 -11
  270. package/lib/module/modules/next/bluetooth/sig-profiles.js.map +1 -1
  271. package/lib/module/modules/next/bluetooth/sink.js +4 -0
  272. package/lib/module/modules/next/bluetooth/sink.js.map +1 -0
  273. package/lib/module/modules/next/bluetooth/snapshot.js +4 -0
  274. package/lib/module/modules/next/bluetooth/snapshot.js.map +1 -0
  275. package/lib/module/modules/next/bluetooth/stable-hash.js +37 -0
  276. package/lib/module/modules/next/bluetooth/stable-hash.js.map +1 -0
  277. package/lib/module/modules/next/bluetooth/store.js +57 -0
  278. package/lib/module/modules/next/bluetooth/store.js.map +1 -0
  279. package/lib/module/modules/next/bluetooth/transport.js +4 -0
  280. package/lib/module/modules/next/bluetooth/transport.js.map +1 -0
  281. package/lib/module/modules/next/data-sync/index.js +11 -0
  282. package/lib/module/modules/next/data-sync/index.js.map +1 -0
  283. package/lib/typescript/commonjs/src/modules/auth/hooks/use-sign-in.d.ts +1 -1
  284. package/lib/typescript/commonjs/src/modules/bt-management/components/android-bluetooth-foreground-service.d.ts.map +1 -1
  285. package/lib/typescript/commonjs/src/modules/bt-management/components/bluetooth-device-picker.d.ts +1 -1
  286. package/lib/typescript/commonjs/src/modules/bt-management/components/bluetooth-device-picker.d.ts.map +1 -1
  287. package/lib/typescript/commonjs/src/modules/bt-management/components/bt-provider-child-wrapper.d.ts.map +1 -1
  288. package/lib/typescript/commonjs/src/modules/bt-management/components/device-picker-sheet.d.ts +25 -0
  289. package/lib/typescript/commonjs/src/modules/bt-management/components/device-picker-sheet.d.ts.map +1 -0
  290. package/lib/typescript/commonjs/src/modules/bt-management/hooks/runtime-context.d.ts +1 -1
  291. package/lib/typescript/commonjs/src/modules/bt-management/hooks/runtime-context.d.ts.map +1 -1
  292. package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-bluetooth-permission.d.ts.map +1 -1
  293. package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-measurements.d.ts.map +1 -1
  294. package/lib/typescript/commonjs/src/modules/bt-management/index.d.ts +1 -0
  295. package/lib/typescript/commonjs/src/modules/bt-management/index.d.ts.map +1 -1
  296. package/lib/typescript/commonjs/src/modules/bt-management/services/bt-manager.d.ts +20 -0
  297. package/lib/typescript/commonjs/src/modules/bt-management/services/bt-manager.d.ts.map +1 -1
  298. package/lib/typescript/commonjs/src/modules/bt-management/services/custom/define-custom-device.d.ts +2 -1
  299. package/lib/typescript/commonjs/src/modules/bt-management/services/custom/define-custom-device.d.ts.map +1 -1
  300. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-command-writer.d.ts +3 -1
  301. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-command-writer.d.ts.map +1 -1
  302. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-connection-handler.d.ts +14 -1
  303. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-connection-handler.d.ts.map +1 -1
  304. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-current-time.d.ts +11 -0
  305. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-current-time.d.ts.map +1 -0
  306. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-device-information.d.ts +2 -1
  307. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-device-information.d.ts.map +1 -1
  308. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-managed-device.d.ts +11 -1
  309. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-managed-device.d.ts.map +1 -1
  310. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-notification-readiness.d.ts +15 -0
  311. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-notification-readiness.d.ts.map +1 -0
  312. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-pairing-retry.d.ts +21 -0
  313. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-pairing-retry.d.ts.map +1 -0
  314. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/custom/custom.device.d.ts +2 -0
  315. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/custom/custom.device.d.ts.map +1 -1
  316. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.blood-pressure-status.d.ts.map +1 -1
  317. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.decorators.d.ts +11 -0
  318. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.decorators.d.ts.map +1 -0
  319. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.d.ts +5 -2
  320. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.d.ts.map +1 -1
  321. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.frame.d.ts +10 -0
  322. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.frame.d.ts.map +1 -0
  323. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose-details.d.ts +7 -0
  324. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose-details.d.ts.map +1 -0
  325. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose-frame.d.ts +16 -0
  326. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose-frame.d.ts.map +1 -0
  327. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose-racp.d.ts +8 -0
  328. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose-racp.d.ts.map +1 -0
  329. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose.d.ts.map +1 -1
  330. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.d.ts +2 -0
  331. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.d.ts.map +1 -1
  332. package/lib/typescript/commonjs/src/modules/bt-management/services/record-cursor.d.ts +21 -0
  333. package/lib/typescript/commonjs/src/modules/bt-management/services/record-cursor.d.ts.map +1 -0
  334. package/lib/typescript/commonjs/src/modules/bt-management/testing/fake-ble-manager.d.ts.map +1 -1
  335. package/lib/typescript/commonjs/src/modules/bt-management/types/command-sequencer.d.ts +6 -2
  336. package/lib/typescript/commonjs/src/modules/bt-management/types/command-sequencer.d.ts.map +1 -1
  337. package/lib/typescript/commonjs/src/modules/bt-management/types/create-device-params.d.ts +3 -0
  338. package/lib/typescript/commonjs/src/modules/bt-management/types/create-device-params.d.ts.map +1 -1
  339. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-device-definition.d.ts +14 -1
  340. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-device-definition.d.ts.map +1 -1
  341. package/lib/typescript/commonjs/src/modules/bt-management/types/glucose-record-details.d.ts +33 -0
  342. package/lib/typescript/commonjs/src/modules/bt-management/types/glucose-record-details.d.ts.map +1 -0
  343. package/lib/typescript/commonjs/src/modules/bt-management/types/result-callback.d.ts +2 -0
  344. package/lib/typescript/commonjs/src/modules/bt-management/types/result-callback.d.ts.map +1 -1
  345. package/lib/typescript/commonjs/src/modules/bt-management/types/result-policy.d.ts +6 -0
  346. package/lib/typescript/commonjs/src/modules/bt-management/types/result-policy.d.ts.map +1 -1
  347. package/lib/typescript/commonjs/src/modules/bt-management/utils/bluetooth-permission-list.d.ts +4 -0
  348. package/lib/typescript/commonjs/src/modules/bt-management/utils/bluetooth-permission-list.d.ts.map +1 -0
  349. package/lib/typescript/commonjs/src/modules/bt-management/utils/device-user.d.ts +6 -0
  350. package/lib/typescript/commonjs/src/modules/bt-management/utils/device-user.d.ts.map +1 -0
  351. package/lib/typescript/commonjs/src/modules/bt-management/utils/kpa-to-mmhg.d.ts +4 -0
  352. package/lib/typescript/commonjs/src/modules/bt-management/utils/kpa-to-mmhg.d.ts.map +1 -0
  353. package/lib/typescript/commonjs/src/modules/bt-management/utils/result-identity.d.ts +5 -4
  354. package/lib/typescript/commonjs/src/modules/bt-management/utils/result-identity.d.ts.map +1 -1
  355. package/lib/typescript/commonjs/src/modules/bt-management/utils/rr-interval.d.ts +4 -0
  356. package/lib/typescript/commonjs/src/modules/bt-management/utils/rr-interval.d.ts.map +1 -0
  357. package/lib/typescript/commonjs/src/modules/bt-management/utils/temperature-type.d.ts +7 -0
  358. package/lib/typescript/commonjs/src/modules/bt-management/utils/temperature-type.d.ts.map +1 -0
  359. package/lib/typescript/commonjs/src/modules/bt-management/utils/wait.d.ts +3 -0
  360. package/lib/typescript/commonjs/src/modules/bt-management/utils/wait.d.ts.map +1 -0
  361. package/lib/typescript/commonjs/src/modules/data-sync/services/managers/sync-progress-manager.d.ts +1 -1
  362. package/lib/typescript/commonjs/src/modules/next/background-sync/index.d.ts +10 -0
  363. package/lib/typescript/commonjs/src/modules/next/background-sync/index.d.ts.map +1 -0
  364. package/lib/typescript/commonjs/src/modules/next/background-sync/offline-measurement-background-sync.d.ts +22 -0
  365. package/lib/typescript/commonjs/src/modules/next/background-sync/offline-measurement-background-sync.d.ts.map +1 -0
  366. package/lib/typescript/commonjs/src/modules/next/bluetooth/auto-connect.d.ts +10 -0
  367. package/lib/typescript/commonjs/src/modules/next/bluetooth/auto-connect.d.ts.map +1 -0
  368. package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/ble-errors.d.ts +4 -0
  369. package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/ble-errors.d.ts.map +1 -0
  370. package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/ble-link.d.ts +6 -0
  371. package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/ble-link.d.ts.map +1 -0
  372. package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/ble-scanner.d.ts +10 -0
  373. package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/ble-scanner.d.ts.map +1 -0
  374. package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/built-in-devices.d.ts +6 -0
  375. package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/built-in-devices.d.ts.map +1 -0
  376. package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/legacy-driver.d.ts +8 -0
  377. package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/legacy-driver.d.ts.map +1 -0
  378. package/lib/typescript/commonjs/src/modules/next/bluetooth/connections.d.ts +25 -0
  379. package/lib/typescript/commonjs/src/modules/next/bluetooth/connections.d.ts.map +1 -0
  380. package/lib/typescript/commonjs/src/modules/next/bluetooth/daily-total-day.d.ts.map +1 -0
  381. package/lib/typescript/commonjs/src/modules/next/bluetooth/devices.d.ts +30 -0
  382. package/lib/typescript/commonjs/src/modules/next/bluetooth/devices.d.ts.map +1 -0
  383. package/lib/typescript/commonjs/src/modules/next/bluetooth/driver.d.ts +27 -20
  384. package/lib/typescript/commonjs/src/modules/next/bluetooth/driver.d.ts.map +1 -1
  385. package/lib/typescript/commonjs/src/modules/next/bluetooth/errors.d.ts +17 -0
  386. package/lib/typescript/commonjs/src/modules/next/bluetooth/errors.d.ts.map +1 -0
  387. package/lib/typescript/commonjs/src/modules/next/bluetooth/index.d.ts +34 -5
  388. package/lib/typescript/commonjs/src/modules/next/bluetooth/index.d.ts.map +1 -1
  389. package/lib/typescript/commonjs/src/modules/next/bluetooth/link.d.ts +14 -5
  390. package/lib/typescript/commonjs/src/modules/next/bluetooth/link.d.ts.map +1 -1
  391. package/lib/typescript/commonjs/src/modules/next/bluetooth/paired.d.ts +18 -0
  392. package/lib/typescript/commonjs/src/modules/next/bluetooth/paired.d.ts.map +1 -0
  393. package/lib/typescript/commonjs/src/modules/next/bluetooth/permissions.d.ts +13 -0
  394. package/lib/typescript/commonjs/src/modules/next/bluetooth/permissions.d.ts.map +1 -0
  395. package/lib/typescript/commonjs/src/modules/next/bluetooth/react/bluetooth-device-picker.d.ts +35 -0
  396. package/lib/typescript/commonjs/src/modules/next/bluetooth/react/bluetooth-device-picker.d.ts.map +1 -0
  397. package/lib/typescript/commonjs/src/modules/next/bluetooth/react/context.d.ts +30 -0
  398. package/lib/typescript/commonjs/src/modules/next/bluetooth/react/context.d.ts.map +1 -0
  399. package/lib/typescript/commonjs/src/modules/next/bluetooth/react/hooks.d.ts +47 -0
  400. package/lib/typescript/commonjs/src/modules/next/bluetooth/react/hooks.d.ts.map +1 -0
  401. package/lib/typescript/commonjs/src/modules/next/bluetooth/react-native/create-bluetooth-runtime.d.ts +21 -0
  402. package/lib/typescript/commonjs/src/modules/next/bluetooth/react-native/create-bluetooth-runtime.d.ts.map +1 -0
  403. package/lib/typescript/commonjs/src/modules/next/bluetooth/react-native/os-permissions.d.ts +5 -0
  404. package/lib/typescript/commonjs/src/modules/next/bluetooth/react-native/os-permissions.d.ts.map +1 -0
  405. package/lib/typescript/commonjs/src/modules/next/bluetooth/react-native/ovok-sink.d.ts +6 -0
  406. package/lib/typescript/commonjs/src/modules/next/bluetooth/react-native/ovok-sink.d.ts.map +1 -0
  407. package/lib/typescript/commonjs/src/modules/next/bluetooth/readings.d.ts +21 -0
  408. package/lib/typescript/commonjs/src/modules/next/bluetooth/readings.d.ts.map +1 -0
  409. package/lib/typescript/commonjs/src/modules/next/bluetooth/result-policy.d.ts +9 -1
  410. package/lib/typescript/commonjs/src/modules/next/bluetooth/result-policy.d.ts.map +1 -1
  411. package/lib/typescript/commonjs/src/modules/next/bluetooth/runtime.d.ts +87 -0
  412. package/lib/typescript/commonjs/src/modules/next/bluetooth/runtime.d.ts.map +1 -0
  413. package/lib/typescript/commonjs/src/modules/next/bluetooth/scan-loop.d.ts +23 -0
  414. package/lib/typescript/commonjs/src/modules/next/bluetooth/scan-loop.d.ts.map +1 -0
  415. package/lib/typescript/commonjs/src/modules/next/bluetooth/sig-profiles.d.ts.map +1 -1
  416. package/lib/typescript/commonjs/src/modules/next/bluetooth/sink.d.ts +20 -0
  417. package/lib/typescript/commonjs/src/modules/next/bluetooth/sink.d.ts.map +1 -0
  418. package/lib/typescript/commonjs/src/modules/next/bluetooth/snapshot.d.ts +72 -0
  419. package/lib/typescript/commonjs/src/modules/next/bluetooth/snapshot.d.ts.map +1 -0
  420. package/lib/typescript/commonjs/src/modules/next/bluetooth/stable-hash.d.ts +6 -0
  421. package/lib/typescript/commonjs/src/modules/next/bluetooth/stable-hash.d.ts.map +1 -0
  422. package/lib/typescript/commonjs/src/modules/next/bluetooth/store.d.ts +16 -0
  423. package/lib/typescript/commonjs/src/modules/next/bluetooth/store.d.ts.map +1 -0
  424. package/lib/typescript/commonjs/src/modules/next/bluetooth/transport.d.ts +31 -0
  425. package/lib/typescript/commonjs/src/modules/next/bluetooth/transport.d.ts.map +1 -0
  426. package/lib/typescript/commonjs/src/modules/next/data-sync/index.d.ts +9 -0
  427. package/lib/typescript/commonjs/src/modules/next/data-sync/index.d.ts.map +1 -0
  428. package/lib/typescript/module/src/modules/auth/hooks/use-sign-in.d.ts +1 -1
  429. package/lib/typescript/module/src/modules/bt-management/components/android-bluetooth-foreground-service.d.ts.map +1 -1
  430. package/lib/typescript/module/src/modules/bt-management/components/bluetooth-device-picker.d.ts +1 -1
  431. package/lib/typescript/module/src/modules/bt-management/components/bluetooth-device-picker.d.ts.map +1 -1
  432. package/lib/typescript/module/src/modules/bt-management/components/bt-provider-child-wrapper.d.ts.map +1 -1
  433. package/lib/typescript/module/src/modules/bt-management/components/device-picker-sheet.d.ts +25 -0
  434. package/lib/typescript/module/src/modules/bt-management/components/device-picker-sheet.d.ts.map +1 -0
  435. package/lib/typescript/module/src/modules/bt-management/hooks/runtime-context.d.ts +1 -1
  436. package/lib/typescript/module/src/modules/bt-management/hooks/runtime-context.d.ts.map +1 -1
  437. package/lib/typescript/module/src/modules/bt-management/hooks/use-bluetooth-permission.d.ts.map +1 -1
  438. package/lib/typescript/module/src/modules/bt-management/hooks/use-measurements.d.ts.map +1 -1
  439. package/lib/typescript/module/src/modules/bt-management/index.d.ts +1 -0
  440. package/lib/typescript/module/src/modules/bt-management/index.d.ts.map +1 -1
  441. package/lib/typescript/module/src/modules/bt-management/services/bt-manager.d.ts +20 -0
  442. package/lib/typescript/module/src/modules/bt-management/services/bt-manager.d.ts.map +1 -1
  443. package/lib/typescript/module/src/modules/bt-management/services/custom/define-custom-device.d.ts +2 -1
  444. package/lib/typescript/module/src/modules/bt-management/services/custom/define-custom-device.d.ts.map +1 -1
  445. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-command-writer.d.ts +3 -1
  446. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-command-writer.d.ts.map +1 -1
  447. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-connection-handler.d.ts +14 -1
  448. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-connection-handler.d.ts.map +1 -1
  449. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-current-time.d.ts +11 -0
  450. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-current-time.d.ts.map +1 -0
  451. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-device-information.d.ts +2 -1
  452. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-device-information.d.ts.map +1 -1
  453. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-managed-device.d.ts +11 -1
  454. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-managed-device.d.ts.map +1 -1
  455. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-notification-readiness.d.ts +15 -0
  456. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-notification-readiness.d.ts.map +1 -0
  457. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-pairing-retry.d.ts +21 -0
  458. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-pairing-retry.d.ts.map +1 -0
  459. package/lib/typescript/module/src/modules/bt-management/services/devices/custom/custom.device.d.ts +2 -0
  460. package/lib/typescript/module/src/modules/bt-management/services/devices/custom/custom.device.d.ts.map +1 -1
  461. package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.blood-pressure-status.d.ts.map +1 -1
  462. package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.decorators.d.ts +11 -0
  463. package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.decorators.d.ts.map +1 -0
  464. package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.d.ts +5 -2
  465. package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.d.ts.map +1 -1
  466. package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.frame.d.ts +10 -0
  467. package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.frame.d.ts.map +1 -0
  468. package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose-details.d.ts +7 -0
  469. package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose-details.d.ts.map +1 -0
  470. package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose-frame.d.ts +16 -0
  471. package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose-frame.d.ts.map +1 -0
  472. package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose-racp.d.ts +8 -0
  473. package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose-racp.d.ts.map +1 -0
  474. package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose.d.ts.map +1 -1
  475. package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.d.ts +2 -0
  476. package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.d.ts.map +1 -1
  477. package/lib/typescript/module/src/modules/bt-management/services/record-cursor.d.ts +21 -0
  478. package/lib/typescript/module/src/modules/bt-management/services/record-cursor.d.ts.map +1 -0
  479. package/lib/typescript/module/src/modules/bt-management/testing/fake-ble-manager.d.ts.map +1 -1
  480. package/lib/typescript/module/src/modules/bt-management/types/command-sequencer.d.ts +6 -2
  481. package/lib/typescript/module/src/modules/bt-management/types/command-sequencer.d.ts.map +1 -1
  482. package/lib/typescript/module/src/modules/bt-management/types/create-device-params.d.ts +3 -0
  483. package/lib/typescript/module/src/modules/bt-management/types/create-device-params.d.ts.map +1 -1
  484. package/lib/typescript/module/src/modules/bt-management/types/custom-device-definition.d.ts +14 -1
  485. package/lib/typescript/module/src/modules/bt-management/types/custom-device-definition.d.ts.map +1 -1
  486. package/lib/typescript/module/src/modules/bt-management/types/glucose-record-details.d.ts +33 -0
  487. package/lib/typescript/module/src/modules/bt-management/types/glucose-record-details.d.ts.map +1 -0
  488. package/lib/typescript/module/src/modules/bt-management/types/result-callback.d.ts +2 -0
  489. package/lib/typescript/module/src/modules/bt-management/types/result-callback.d.ts.map +1 -1
  490. package/lib/typescript/module/src/modules/bt-management/types/result-policy.d.ts +6 -0
  491. package/lib/typescript/module/src/modules/bt-management/types/result-policy.d.ts.map +1 -1
  492. package/lib/typescript/module/src/modules/bt-management/utils/bluetooth-permission-list.d.ts +4 -0
  493. package/lib/typescript/module/src/modules/bt-management/utils/bluetooth-permission-list.d.ts.map +1 -0
  494. package/lib/typescript/module/src/modules/bt-management/utils/device-user.d.ts +6 -0
  495. package/lib/typescript/module/src/modules/bt-management/utils/device-user.d.ts.map +1 -0
  496. package/lib/typescript/module/src/modules/bt-management/utils/kpa-to-mmhg.d.ts +4 -0
  497. package/lib/typescript/module/src/modules/bt-management/utils/kpa-to-mmhg.d.ts.map +1 -0
  498. package/lib/typescript/module/src/modules/bt-management/utils/result-identity.d.ts +5 -4
  499. package/lib/typescript/module/src/modules/bt-management/utils/result-identity.d.ts.map +1 -1
  500. package/lib/typescript/module/src/modules/bt-management/utils/rr-interval.d.ts +4 -0
  501. package/lib/typescript/module/src/modules/bt-management/utils/rr-interval.d.ts.map +1 -0
  502. package/lib/typescript/module/src/modules/bt-management/utils/temperature-type.d.ts +7 -0
  503. package/lib/typescript/module/src/modules/bt-management/utils/temperature-type.d.ts.map +1 -0
  504. package/lib/typescript/module/src/modules/bt-management/utils/wait.d.ts +3 -0
  505. package/lib/typescript/module/src/modules/bt-management/utils/wait.d.ts.map +1 -0
  506. package/lib/typescript/module/src/modules/data-sync/services/managers/sync-progress-manager.d.ts +1 -1
  507. package/lib/typescript/module/src/modules/next/background-sync/index.d.ts +10 -0
  508. package/lib/typescript/module/src/modules/next/background-sync/index.d.ts.map +1 -0
  509. package/lib/typescript/module/src/modules/next/background-sync/offline-measurement-background-sync.d.ts +22 -0
  510. package/lib/typescript/module/src/modules/next/background-sync/offline-measurement-background-sync.d.ts.map +1 -0
  511. package/lib/typescript/module/src/modules/next/bluetooth/auto-connect.d.ts +10 -0
  512. package/lib/typescript/module/src/modules/next/bluetooth/auto-connect.d.ts.map +1 -0
  513. package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/ble-errors.d.ts +4 -0
  514. package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/ble-errors.d.ts.map +1 -0
  515. package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/ble-link.d.ts +6 -0
  516. package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/ble-link.d.ts.map +1 -0
  517. package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/ble-scanner.d.ts +10 -0
  518. package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/ble-scanner.d.ts.map +1 -0
  519. package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/built-in-devices.d.ts +6 -0
  520. package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/built-in-devices.d.ts.map +1 -0
  521. package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/legacy-driver.d.ts +8 -0
  522. package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/legacy-driver.d.ts.map +1 -0
  523. package/lib/typescript/module/src/modules/next/bluetooth/connections.d.ts +25 -0
  524. package/lib/typescript/module/src/modules/next/bluetooth/connections.d.ts.map +1 -0
  525. package/lib/typescript/module/src/modules/next/bluetooth/daily-total-day.d.ts.map +1 -0
  526. package/lib/typescript/module/src/modules/next/bluetooth/devices.d.ts +30 -0
  527. package/lib/typescript/module/src/modules/next/bluetooth/devices.d.ts.map +1 -0
  528. package/lib/typescript/module/src/modules/next/bluetooth/driver.d.ts +27 -20
  529. package/lib/typescript/module/src/modules/next/bluetooth/driver.d.ts.map +1 -1
  530. package/lib/typescript/module/src/modules/next/bluetooth/errors.d.ts +17 -0
  531. package/lib/typescript/module/src/modules/next/bluetooth/errors.d.ts.map +1 -0
  532. package/lib/typescript/module/src/modules/next/bluetooth/index.d.ts +34 -5
  533. package/lib/typescript/module/src/modules/next/bluetooth/index.d.ts.map +1 -1
  534. package/lib/typescript/module/src/modules/next/bluetooth/link.d.ts +14 -5
  535. package/lib/typescript/module/src/modules/next/bluetooth/link.d.ts.map +1 -1
  536. package/lib/typescript/module/src/modules/next/bluetooth/paired.d.ts +18 -0
  537. package/lib/typescript/module/src/modules/next/bluetooth/paired.d.ts.map +1 -0
  538. package/lib/typescript/module/src/modules/next/bluetooth/permissions.d.ts +13 -0
  539. package/lib/typescript/module/src/modules/next/bluetooth/permissions.d.ts.map +1 -0
  540. package/lib/typescript/module/src/modules/next/bluetooth/react/bluetooth-device-picker.d.ts +35 -0
  541. package/lib/typescript/module/src/modules/next/bluetooth/react/bluetooth-device-picker.d.ts.map +1 -0
  542. package/lib/typescript/module/src/modules/next/bluetooth/react/context.d.ts +30 -0
  543. package/lib/typescript/module/src/modules/next/bluetooth/react/context.d.ts.map +1 -0
  544. package/lib/typescript/module/src/modules/next/bluetooth/react/hooks.d.ts +47 -0
  545. package/lib/typescript/module/src/modules/next/bluetooth/react/hooks.d.ts.map +1 -0
  546. package/lib/typescript/module/src/modules/next/bluetooth/react-native/create-bluetooth-runtime.d.ts +21 -0
  547. package/lib/typescript/module/src/modules/next/bluetooth/react-native/create-bluetooth-runtime.d.ts.map +1 -0
  548. package/lib/typescript/module/src/modules/next/bluetooth/react-native/os-permissions.d.ts +5 -0
  549. package/lib/typescript/module/src/modules/next/bluetooth/react-native/os-permissions.d.ts.map +1 -0
  550. package/lib/typescript/module/src/modules/next/bluetooth/react-native/ovok-sink.d.ts +6 -0
  551. package/lib/typescript/module/src/modules/next/bluetooth/react-native/ovok-sink.d.ts.map +1 -0
  552. package/lib/typescript/module/src/modules/next/bluetooth/readings.d.ts +21 -0
  553. package/lib/typescript/module/src/modules/next/bluetooth/readings.d.ts.map +1 -0
  554. package/lib/typescript/module/src/modules/next/bluetooth/result-policy.d.ts +9 -1
  555. package/lib/typescript/module/src/modules/next/bluetooth/result-policy.d.ts.map +1 -1
  556. package/lib/typescript/module/src/modules/next/bluetooth/runtime.d.ts +87 -0
  557. package/lib/typescript/module/src/modules/next/bluetooth/runtime.d.ts.map +1 -0
  558. package/lib/typescript/module/src/modules/next/bluetooth/scan-loop.d.ts +23 -0
  559. package/lib/typescript/module/src/modules/next/bluetooth/scan-loop.d.ts.map +1 -0
  560. package/lib/typescript/module/src/modules/next/bluetooth/sig-profiles.d.ts.map +1 -1
  561. package/lib/typescript/module/src/modules/next/bluetooth/sink.d.ts +20 -0
  562. package/lib/typescript/module/src/modules/next/bluetooth/sink.d.ts.map +1 -0
  563. package/lib/typescript/module/src/modules/next/bluetooth/snapshot.d.ts +72 -0
  564. package/lib/typescript/module/src/modules/next/bluetooth/snapshot.d.ts.map +1 -0
  565. package/lib/typescript/module/src/modules/next/bluetooth/stable-hash.d.ts +6 -0
  566. package/lib/typescript/module/src/modules/next/bluetooth/stable-hash.d.ts.map +1 -0
  567. package/lib/typescript/module/src/modules/next/bluetooth/store.d.ts +16 -0
  568. package/lib/typescript/module/src/modules/next/bluetooth/store.d.ts.map +1 -0
  569. package/lib/typescript/module/src/modules/next/bluetooth/transport.d.ts +31 -0
  570. package/lib/typescript/module/src/modules/next/bluetooth/transport.d.ts.map +1 -0
  571. package/lib/typescript/module/src/modules/next/data-sync/index.d.ts +9 -0
  572. package/lib/typescript/module/src/modules/next/data-sync/index.d.ts.map +1 -0
  573. package/package.json +12 -2
  574. package/lib/commonjs/modules/bt-management/utils/daily-total-day.js.map +0 -1
  575. package/lib/commonjs/modules/next/bluetooth/drivers.js +0 -20
  576. package/lib/commonjs/modules/next/bluetooth/drivers.js.map +0 -1
  577. package/lib/commonjs/modules/next/bluetooth/legacy-driver.js +0 -55
  578. package/lib/commonjs/modules/next/bluetooth/legacy-driver.js.map +0 -1
  579. package/lib/module/modules/bt-management/utils/daily-total-day.js.map +0 -1
  580. package/lib/module/modules/next/bluetooth/drivers.js +0 -17
  581. package/lib/module/modules/next/bluetooth/drivers.js.map +0 -1
  582. package/lib/module/modules/next/bluetooth/legacy-driver.js +0 -51
  583. package/lib/module/modules/next/bluetooth/legacy-driver.js.map +0 -1
  584. package/lib/typescript/commonjs/src/modules/bt-management/utils/daily-total-day.d.ts.map +0 -1
  585. package/lib/typescript/commonjs/src/modules/next/bluetooth/drivers.d.ts +0 -7
  586. package/lib/typescript/commonjs/src/modules/next/bluetooth/drivers.d.ts.map +0 -1
  587. package/lib/typescript/commonjs/src/modules/next/bluetooth/legacy-driver.d.ts +0 -8
  588. package/lib/typescript/commonjs/src/modules/next/bluetooth/legacy-driver.d.ts.map +0 -1
  589. package/lib/typescript/module/src/modules/bt-management/utils/daily-total-day.d.ts.map +0 -1
  590. package/lib/typescript/module/src/modules/next/bluetooth/drivers.d.ts +0 -7
  591. package/lib/typescript/module/src/modules/next/bluetooth/drivers.d.ts.map +0 -1
  592. package/lib/typescript/module/src/modules/next/bluetooth/legacy-driver.d.ts +0 -8
  593. package/lib/typescript/module/src/modules/next/bluetooth/legacy-driver.d.ts.map +0 -1
  594. /package/lib/commonjs/modules/{bt-management/utils → next/bluetooth}/daily-total-day.js +0 -0
  595. /package/lib/module/modules/{bt-management/utils → next/bluetooth}/daily-total-day.js +0 -0
  596. /package/lib/typescript/commonjs/src/modules/{bt-management/utils → next/bluetooth}/daily-total-day.d.ts +0 -0
  597. /package/lib/typescript/module/src/modules/{bt-management/utils → next/bluetooth}/daily-total-day.d.ts +0 -0
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ const FIRST_RETRY_DELAY_MS = 2_000;
4
+ const MAX_RETRY_DELAY_MS = 60_000;
5
+
6
+ /** When a paired device that keeps failing may be connected automatically again. */
7
+ class AutoConnectBackoff {
8
+ failures = new Map();
9
+ allows(id, now = Date.now()) {
10
+ return (this.failures.get(id)?.notBefore ?? 0) <= now;
11
+ }
12
+
13
+ /** Records a failure; returns how long until the next automatic attempt. */
14
+ failed(id, now = Date.now()) {
15
+ const count = (this.failures.get(id)?.count ?? 0) + 1;
16
+ const delay = Math.min(FIRST_RETRY_DELAY_MS * 2 ** (count - 1), MAX_RETRY_DELAY_MS);
17
+ this.failures.set(id, {
18
+ count,
19
+ notBefore: now + delay
20
+ });
21
+ return delay;
22
+ }
23
+ succeeded(id) {
24
+ this.failures.delete(id);
25
+ }
26
+ }
27
+ export { AutoConnectBackoff };
28
+ //# sourceMappingURL=auto-connect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["FIRST_RETRY_DELAY_MS","MAX_RETRY_DELAY_MS","AutoConnectBackoff","failures","Map","allows","id","now","Date","get","notBefore","failed","count","delay","Math","min","set","succeeded","delete"],"sourceRoot":"../../../../../src","sources":["modules/next/bluetooth/auto-connect.ts"],"mappings":";;AAAA,MAAMA,oBAAoB,GAAG,KAAK;AAClC,MAAMC,kBAAkB,GAAG,MAAM;;AAEjC;AACA,MAAMC,kBAAkB,CAAC;EACNC,QAAQ,GAAG,IAAIC,GAAG,CAA+C,CAAC;EAE5EC,MAAMA,CAACC,EAAU,EAAEC,GAAG,GAAGC,IAAI,CAACD,GAAG,CAAC,CAAC,EAAW;IACnD,OAAO,CAAC,IAAI,CAACJ,QAAQ,CAACM,GAAG,CAACH,EAAE,CAAC,EAAEI,SAAS,IAAI,CAAC,KAAKH,GAAG;EACvD;;EAEA;EACOI,MAAMA,CAACL,EAAU,EAAEC,GAAG,GAAGC,IAAI,CAACD,GAAG,CAAC,CAAC,EAAU;IAClD,MAAMK,KAAK,GAAG,CAAC,IAAI,CAACT,QAAQ,CAACM,GAAG,CAACH,EAAE,CAAC,EAAEM,KAAK,IAAI,CAAC,IAAI,CAAC;IACrD,MAAMC,KAAK,GAAGC,IAAI,CAACC,GAAG,CAACf,oBAAoB,GAAG,CAAC,KAAKY,KAAK,GAAG,CAAC,CAAC,EAAEX,kBAAkB,CAAC;IAEnF,IAAI,CAACE,QAAQ,CAACa,GAAG,CAACV,EAAE,EAAE;MAAEM,KAAK;MAAEF,SAAS,EAAEH,GAAG,GAAGM;IAAM,CAAC,CAAC;IAExD,OAAOA,KAAK;EACd;EAEOI,SAASA,CAACX,EAAU,EAAQ;IACjC,IAAI,CAACH,QAAQ,CAACe,MAAM,CAACZ,EAAE,CAAC;EAC1B;AACF;AAEA,SAASJ,kBAAkB","ignoreList":[]}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ import { BluetoothErrorCode as LegacyCode, toBluetoothError } from "../../../bt-management/types/bluetooth-error.js";
4
+ import { BluetoothError } from "../errors.js";
5
+ const CODES = {
6
+ [LegacyCode.UNKNOWN]: "unknown",
7
+ [LegacyCode.PERMISSION_DENIED]: "permission-denied",
8
+ [LegacyCode.UNSUPPORTED]: "unsupported",
9
+ [LegacyCode.POWERED_OFF]: "powered-off",
10
+ [LegacyCode.SCAN_FAILED]: "scan-failed",
11
+ [LegacyCode.CONNECTION_FAILED]: "connection-failed",
12
+ [LegacyCode.PAIRING_REQUIRED]: "pairing-required",
13
+ [LegacyCode.DISCOVERY_FAILED]: "discovery-failed",
14
+ [LegacyCode.DEVICE_ERROR]: "device-error",
15
+ [LegacyCode.FRAME_INVALID]: "frame-invalid",
16
+ [LegacyCode.MEASUREMENT_FAILED]: "measurement-failed",
17
+ [LegacyCode.BACKGROUND_SYNC]: "unknown"
18
+ };
19
+
20
+ /** Classifies a `react-native-ble-plx` or legacy device error as a `BluetoothError`. */
21
+ export const fromBleError = error => {
22
+ if (error instanceof BluetoothError) {
23
+ return error;
24
+ }
25
+ const legacy = toBluetoothError(error);
26
+ return new BluetoothError(CODES[legacy.code], legacy.message, error);
27
+ };
28
+ //# sourceMappingURL=ble-errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["BluetoothErrorCode","LegacyCode","toBluetoothError","BluetoothError","CODES","UNKNOWN","PERMISSION_DENIED","UNSUPPORTED","POWERED_OFF","SCAN_FAILED","CONNECTION_FAILED","PAIRING_REQUIRED","DISCOVERY_FAILED","DEVICE_ERROR","FRAME_INVALID","MEASUREMENT_FAILED","BACKGROUND_SYNC","fromBleError","error","legacy","code","message"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/ble-plx/ble-errors.ts"],"mappings":";;AAAA,SAASA,kBAAkB,IAAIC,UAAU,EAAEC,gBAAgB,QAAQ,iDAA8C;AACjH,SAASC,cAAc,QAA4B,cAAW;AAE9D,MAAMC,KAA6C,GAAG;EACpD,CAACH,UAAU,CAACI,OAAO,GAAG,SAAS;EAC/B,CAACJ,UAAU,CAACK,iBAAiB,GAAG,mBAAmB;EACnD,CAACL,UAAU,CAACM,WAAW,GAAG,aAAa;EACvC,CAACN,UAAU,CAACO,WAAW,GAAG,aAAa;EACvC,CAACP,UAAU,CAACQ,WAAW,GAAG,aAAa;EACvC,CAACR,UAAU,CAACS,iBAAiB,GAAG,mBAAmB;EACnD,CAACT,UAAU,CAACU,gBAAgB,GAAG,kBAAkB;EACjD,CAACV,UAAU,CAACW,gBAAgB,GAAG,kBAAkB;EACjD,CAACX,UAAU,CAACY,YAAY,GAAG,cAAc;EACzC,CAACZ,UAAU,CAACa,aAAa,GAAG,eAAe;EAC3C,CAACb,UAAU,CAACc,kBAAkB,GAAG,oBAAoB;EACrD,CAACd,UAAU,CAACe,eAAe,GAAG;AAChC,CAAC;;AAED;AACA,OAAO,MAAMC,YAAY,GAAIC,KAAc,IAAqB;EAC9D,IAAIA,KAAK,YAAYf,cAAc,EAAE;IACnC,OAAOe,KAAK;EACd;EAEA,MAAMC,MAAM,GAAGjB,gBAAgB,CAACgB,KAAK,CAAC;EAEtC,OAAO,IAAIf,cAAc,CAACC,KAAK,CAACe,MAAM,CAACC,IAAI,CAAC,EAAED,MAAM,CAACE,OAAO,EAAEH,KAAK,CAAC;AACtE,CAAC","ignoreList":[]}
@@ -0,0 +1,159 @@
1
+ "use strict";
2
+
3
+ import { readDeviceInformation } from "../../../bt-management/services/devices/bt-device-information.js";
4
+ import { awaitNotificationsEnabled } from "../../../bt-management/services/devices/bt-notification-readiness.js";
5
+ import { BTPairingRetry } from "../../../bt-management/services/devices/bt-pairing-retry.js";
6
+ import { sentryLogger } from "../../../helpers/utils/sentry-logger.js";
7
+ import { Channel } from "../channel.js";
8
+ import { fromBleError } from "./ble-errors.js";
9
+ const CONNECT_ATTEMPTS = 5;
10
+ const FIRST_RETRY_DELAY_MS = 1000;
11
+ const MAX_RETRY_DELAY_MS = 5000;
12
+
13
+ /** BleErrorCode.OperationCancelled and DeviceDisconnected; the enum is not available at runtime. */
14
+ const ENDS_THE_LINK = new Set([2, 201]);
15
+ const toBytes = base64 => Uint8Array.from(atob(base64), char => char.charCodeAt(0));
16
+ const toBase64 = bytes => btoa(String.fromCharCode(...bytes));
17
+ const retryDelay = attempt => Math.min(FIRST_RETRY_DELAY_MS * 2 ** (attempt - 1), MAX_RETRY_DELAY_MS);
18
+ const abortReason = signal => signal.reason ?? new Error("The Bluetooth connection was cancelled");
19
+
20
+ /** Waits `ms`, or rejects as soon as `signal` aborts so a cancelled retry does not linger. */
21
+ const wait = (ms, signal) => new Promise((resolve, reject) => {
22
+ const aborted = () => {
23
+ clearTimeout(timer);
24
+ reject(abortReason(signal));
25
+ };
26
+ const timer = setTimeout(() => {
27
+ signal.removeEventListener("abort", aborted);
28
+ resolve();
29
+ }, ms);
30
+ signal.addEventListener("abort", aborted, {
31
+ once: true
32
+ });
33
+ });
34
+ async function connectWithRetries(device, signal) {
35
+ for (let attempt = 1;; attempt += 1) {
36
+ if (signal.aborted) {
37
+ throw abortReason(signal);
38
+ }
39
+ try {
40
+ if (!(await device.isConnected())) {
41
+ await device.connect();
42
+ }
43
+ return;
44
+ } catch (error) {
45
+ if (attempt >= CONNECT_ATTEMPTS) {
46
+ sentryLogger("error", "BLUETOOTH: Connection failed", {
47
+ errorCode: fromBleError(error).code,
48
+ attempts: attempt
49
+ });
50
+ throw error;
51
+ }
52
+ await wait(retryDelay(attempt), signal);
53
+ }
54
+ }
55
+ }
56
+
57
+ /** Reads the standard Device Information strings; `undefined` when the device has none. */
58
+ async function readInformation(device, pairing) {
59
+ let information;
60
+ await readDeviceInformation(device, ({
61
+ manufacturerName,
62
+ model,
63
+ serialNumber
64
+ }) => {
65
+ information = {
66
+ manufacturerName,
67
+ model,
68
+ serialNumber
69
+ };
70
+ }, pairing.run);
71
+ return information;
72
+ }
73
+ class BleLink {
74
+ channels = new Set();
75
+ notificationsPending = new Set();
76
+ ended = false;
77
+ closeOnAbort = () => void this.close();
78
+ constructor(device, signal, pairing, deviceInformation) {
79
+ this.device = device;
80
+ this.signal = signal;
81
+ this.pairing = pairing;
82
+ this.deviceInformation = deviceInformation;
83
+ this.disconnected = device.onDisconnected(() => this.endAll());
84
+ signal.addEventListener("abort", this.closeOnAbort, {
85
+ once: true
86
+ });
87
+ }
88
+ subscribe(service, characteristic) {
89
+ const channel = new Channel(() => {
90
+ subscription.remove();
91
+ this.channels.delete(channel);
92
+ });
93
+ const subscription = this.device.monitorCharacteristicForService(service, characteristic, (error, value) => {
94
+ if (error) {
95
+ this.endOrFail(channel, error);
96
+ } else if (value?.value) {
97
+ channel.push(toBytes(value.value));
98
+ }
99
+ });
100
+ this.channels.add(channel);
101
+ this.awaitNotifications(service, characteristic);
102
+ if (this.ended) {
103
+ channel.end();
104
+ }
105
+ return channel;
106
+ }
107
+ async write(service, characteristic, bytes) {
108
+ await Promise.all(this.notificationsPending);
109
+ await this.pairing.run(() => this.device.writeCharacteristicWithResponseForService(service, characteristic, toBase64(bytes)));
110
+ }
111
+ async close() {
112
+ this.signal.removeEventListener("abort", this.closeOnAbort);
113
+ this.endAll();
114
+ this.disconnected.remove();
115
+ await this.device.cancelConnection().catch(() => undefined);
116
+ }
117
+
118
+ /** A write waits for these, because a device may refuse a command until its notifications are on. */
119
+ awaitNotifications(serviceUuid, characteristicUuid) {
120
+ const enabled = awaitNotificationsEnabled(this.device, [{
121
+ serviceUuid,
122
+ characteristicUuid
123
+ }]).finally(() => this.notificationsPending.delete(enabled));
124
+ this.notificationsPending.add(enabled);
125
+ }
126
+ endOrFail(channel, error) {
127
+ if (ENDS_THE_LINK.has(error.errorCode)) {
128
+ channel.end();
129
+ } else {
130
+ channel.fail(fromBleError(error));
131
+ }
132
+ }
133
+ endAll() {
134
+ this.ended = true;
135
+ [...this.channels].forEach(channel => channel.end());
136
+ }
137
+ }
138
+
139
+ /** Connects (retrying with backoff), discovers services and reads Device Information; aborting `signal` closes the link. */
140
+ async function openBleLink(device, signal) {
141
+ await connectWithRetries(device, signal).catch(error => {
142
+ throw fromBleError(error);
143
+ });
144
+ const pairing = new BTPairingRetry(device, () => sentryLogger("info", "BLUETOOTH: Waiting for the user to pair the device"));
145
+ let information;
146
+ try {
147
+ await device.discoverAllServicesAndCharacteristics();
148
+ information = await readInformation(device, pairing);
149
+ if (signal.aborted) {
150
+ throw abortReason(signal);
151
+ }
152
+ } catch (error) {
153
+ await device.cancelConnection().catch(() => undefined);
154
+ throw fromBleError(error);
155
+ }
156
+ return new BleLink(device, signal, pairing, information);
157
+ }
158
+ export { openBleLink };
159
+ //# sourceMappingURL=ble-link.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["readDeviceInformation","awaitNotificationsEnabled","BTPairingRetry","sentryLogger","Channel","fromBleError","CONNECT_ATTEMPTS","FIRST_RETRY_DELAY_MS","MAX_RETRY_DELAY_MS","ENDS_THE_LINK","Set","toBytes","base64","Uint8Array","from","atob","char","charCodeAt","toBase64","bytes","btoa","String","fromCharCode","retryDelay","attempt","Math","min","abortReason","signal","reason","Error","wait","ms","Promise","resolve","reject","aborted","clearTimeout","timer","setTimeout","removeEventListener","addEventListener","once","connectWithRetries","device","isConnected","connect","error","errorCode","code","attempts","readInformation","pairing","information","manufacturerName","model","serialNumber","run","BleLink","channels","notificationsPending","ended","closeOnAbort","close","constructor","deviceInformation","disconnected","onDisconnected","endAll","subscribe","service","characteristic","channel","subscription","remove","delete","monitorCharacteristicForService","value","endOrFail","push","add","awaitNotifications","end","write","all","writeCharacteristicWithResponseForService","cancelConnection","catch","undefined","serviceUuid","characteristicUuid","enabled","finally","has","fail","forEach","openBleLink","discoverAllServicesAndCharacteristics"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/ble-plx/ble-link.ts"],"mappings":";;AAEA,SAASA,qBAAqB,QAAQ,kEAA+D;AACrG,SAASC,y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from "./ble-errors.js";
5
+ import { openBleLink } from "./ble-link.js";
6
+ const ADAPTER_STATES = {
7
+ [State.PoweredOn]: "on",
8
+ [State.PoweredOff]: "off",
9
+ [State.Unauthorized]: "unauthorized",
10
+ [State.Unsupported]: "unsupported"
11
+ };
12
+ const bleDevices = new WeakMap();
13
+
14
+ /** The `react-native-ble-plx` device behind a peripheral this adapter reported. */
15
+ const bleDeviceOf = peripheral => {
16
+ const device = bleDevices.get(peripheral);
17
+ if (!device) {
18
+ throw new Error("The peripheral was not found by bleManagerScanner");
19
+ }
20
+ return device;
21
+ };
22
+
23
+ /** A `react-native-ble-plx` device as a peripheral. */
24
+ const blePeripheral = device => {
25
+ const peripheral = {
26
+ id: device.id,
27
+ advertisement: {
28
+ name: device.name?.trim() || device.localName?.trim() || "",
29
+ serviceUUIDs: device.serviceUUIDs ?? [],
30
+ manufacturerData: device.manufacturerData ?? null
31
+ },
32
+ openLink: signal => openBleLink(device, signal)
33
+ };
34
+ bleDevices.set(peripheral, device);
35
+ return peripheral;
36
+ };
37
+
38
+ /** A scanner over a `react-native-ble-plx` `BleManager`. */
39
+ const bleManagerScanner = bleManager => ({
40
+ watchState: listener => {
41
+ const subscription = bleManager.onStateChange(state => listener(ADAPTER_STATES[state] ?? "unknown"), true);
42
+ return () => subscription.remove();
43
+ },
44
+ scan: (onFound, onError) => {
45
+ let active = true;
46
+ try {
47
+ bleManager.startDeviceScan(null, {
48
+ scanMode: ScanMode.Balanced
49
+ }, (error, device) => {
50
+ if (!active) {
51
+ return;
52
+ }
53
+ if (error) {
54
+ onError(fromBleError(error));
55
+ } else if (device) {
56
+ onFound(blePeripheral(device));
57
+ }
58
+ });
59
+ } catch (error) {
60
+ onError(fromBleError(error));
61
+ }
62
+ return () => {
63
+ active = false;
64
+ bleManager.stopDeviceScan();
65
+ };
66
+ }
67
+ });
68
+ export { bleDeviceOf, bleManagerScanner, blePeripheral };
69
+ //# sourceMappingURL=ble-scanner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ScanMode","State","fromBleError","openBleLink","ADAPTER_STATES","PoweredOn","PoweredOff","Unauthorized","Unsupported","bleDevices","WeakMap","bleDeviceOf","peripheral","device","get","Error","blePeripheral","id","advertisement","name","trim","localName","serviceUUIDs","manufacturerData","openLink","signal","set","bleManagerScanner","bleManager","watchState","listener","subscription","onStateChange","state","remove","scan","onFound","onError","active","startDeviceScan","scanMode","Balanced","error","stopDeviceScan"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/ble-plx/ble-scanner.ts"],"mappings":";;AAAA,SAA6BA,QAAQ,EAAEC,KAAK,QAAQ,sBAAsB;AAI1E,SAASC,YAAY,QAAQ,iBAAc;AAC3C,SAASC,WAAW,QAAQ,eAAY;AAExC,MAAMC,cAAoD,GAAG;EAC3D,CAACH,KAAK,CAACI,SAAS,GAAG,IAAI;EACvB,CAACJ,KAAK,CAACK,UAAU,GAAG,KAAK;EACzB,CAACL,KAAK,CAACM,YAAY,GAAG,cAAc;EACpC,CAACN,KAAK,CAACO,WAAW,GAAG;AACvB,CAAC;AAED,MAAMC,UAAU,GAAG,IAAIC,OAAO,CAAqB,CAAC;;AAEpD;AACA,MAAMC,WAAW,GAAIC,UAAsB,IAAa;EACtD,MAAMC,MAAM,GAAGJ,UAAU,CAACK,GAAG,CAACF,UAAU,CAAC;EAEzC,IAAI,CAACC,MAAM,EAAE;IACX,MAAM,IAAIE,KAAK,CAAC,mDAAmD,CAAC;EACtE;EAEA,OAAOF,MAAM;AACf,CAAC;;AAED;AACA,MAAMG,aAAa,GAAIH,MAAc,IAAiB;EACpD,MAAMD,UAAsB,GAAG;IAC7BK,EAAE,EAAEJ,MAAM,CAACI,EAAE;IACbC,aAAa,EAAE;MACbC,IAAI,EAAEN,MAAM,CAACM,IAAI,EAAEC,IAAI,CAAC,CAAC,IAAIP,MAAM,CAACQ,SAAS,EAAED,IAAI,CAAC,CAAC,IAAI,EAAE;MAC3DE,YAAY,EAAET,MAAM,CAACS,YAAY,IAAI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,aAAa","ignoreList":[]}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ import { resolveDeviceKey } from "../../../bt-management/core/resolve-device-key.js";
4
+ import { DeviceCreator } from "../../../bt-management/services/device-creator.js";
5
+ import { gattDriver } from "../driver.js";
6
+ import { SIG_PROTOCOLS } from "../sig-profiles.js";
7
+ import { legacyDriver } from "./legacy-driver.js";
8
+
9
+ /** Support for the SDK's integrated devices and `defineCustomDevice` declarations, over `react-native-ble-plx`. */
10
+ const builtInDevices = accepted => {
11
+ const creator = new DeviceCreator(accepted);
12
+ return {
13
+ match: ({
14
+ name,
15
+ serviceUUIDs,
16
+ manufacturerData
17
+ }) => {
18
+ const key = resolveDeviceKey(accepted, name, serviceUUIDs, manufacturerData ?? undefined);
19
+ if (key === undefined) {
20
+ return undefined;
21
+ }
22
+ const protocol = SIG_PROTOCOLS.get(key);
23
+ return {
24
+ key,
25
+ driver: protocol ? gattDriver(key, protocol) : legacyDriver(creator, key)
26
+ };
27
+ }
28
+ };
29
+ };
30
+ export { builtInDevices };
31
+ //# sourceMappingURL=built-in-devices.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["resolveDeviceKey","DeviceCreator","gattDriver","SIG_PROTOCOLS","legacyDriver","builtInDevices","accepted","creator","match","name","serviceUUIDs","manufacturerData","key","undefined","protocol","get","driver"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/ble-plx/built-in-devices.ts"],"mappings":";;AAAA,SAASA,gBAAgB,QAAQ,mDAAgD;AACjF,SAASC,aAAa,QAAQ,mDAAgD;AAG9E,SAASC,UAAU,QAAQ,cAAW;AACtC,SAASC,aAAa,QAAQ,oBAAiB;AAE/C,SAASC,YAAY,QAAQ,oBAAiB;;AAE9C;AACA,MAAMC,cAAc,GAAIC,QAAmC,IAAoB;EAC7E,MAAMC,OAAO,GAAG,IAAIN,aAAa,CAACK,QAAQ,CAAC;EAE3C,OAAO;IACLE,KAAK,EAAEA,CAAC;MAAEC,IAAI;MAAEC,YAAY;MAAEC;IAAiB,CAAC,KAAK;MACnD,MAAMC,GAAG,GAAGZ,gBAAgB,CAACM,QAAQ,EAAEG,IAAI,EAAEC,YAAY,EAAEC,gBAAgB,IAAIE,SAAS,CAAC;MAEzF,IAAID,GAAG,KAAKC,SAAS,EAAE;QACrB,OAAOA,SAAS;MAClB;MAEA,MAAMC,QAAQ,GAAGX,aAAa,CAACY,GAAG,CAACH,GAAG,CAAC;MAEvC,OAAO;QAAEA,GAAG;QAAEI,MAAM,EAAEF,QAAQ,GAAGZ,UAAU,CAACU,GAAG,EAAEE,QAAQ,CAAC,GAAGV,YAAY,CAACG,OAAO,EAAEK,GAAG;MAAE,CAAC;IAC3F;EACF,CAAC;AACH,CAAC;AAED,SAASP,cAAc","ignoreList":[]}
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+
3
+ import { DeviceStatus } from "../../../bt-management/types/device-status.js";
4
+ import { Channel } from "../channel.js";
5
+ import { isTimestamped } from "../driver.js";
6
+ import { fromBleError } from "./ble-errors.js";
7
+ import { bleDeviceOf } from "./ble-scanner.js";
8
+ const STATUSES = {
9
+ [DeviceStatus.CONNECTED]: "connected",
10
+ [DeviceStatus.MEASURING]: "measuring",
11
+ [DeviceStatus.DISCONNECTED]: "disconnected"
12
+ };
13
+
14
+ /** Runs a device class from `@ovok/native/bt-management` until its protocol moves to a `DeviceProtocol`. */
15
+ const legacyDriver = (creator, deviceName) => (peripheral, signal) => {
16
+ const stop = () => events.end();
17
+ const events = new Channel(() => {
18
+ signal.removeEventListener("abort", stop);
19
+ void managed.disconnect();
20
+ });
21
+ const managed = creator.createDevice({
22
+ device: bleDeviceOf(peripheral),
23
+ deviceName,
24
+ onResult: ({
25
+ id,
26
+ data
27
+ }) => {
28
+ const reading = data;
29
+ events.push({
30
+ kind: "reading",
31
+ id: isTimestamped(reading) ? id : null,
32
+ reading
33
+ });
34
+ },
35
+ onDeviceStatusChanged: ({
36
+ status
37
+ }) => {
38
+ const mapped = STATUSES[status];
39
+ if (mapped) {
40
+ events.push({
41
+ kind: "status",
42
+ status: mapped
43
+ });
44
+ }
45
+ if (status === DeviceStatus.DISCONNECTED) {
46
+ events.end();
47
+ }
48
+ },
49
+ onError: ({
50
+ error
51
+ }) => events.push({
52
+ kind: "error",
53
+ error: fromBleError(error)
54
+ })
55
+ });
56
+ signal.addEventListener("abort", stop, {
57
+ once: true
58
+ });
59
+ managed.connect().catch(error => events.fail(fromBleError(error)));
60
+ return events;
61
+ };
62
+ export { legacyDriver };
63
+ //# sourceMappingURL=legacy-driver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["DeviceStatus","Channel","isTimestamped","fromBleError","bleDeviceOf","STATUSES","CONNECTED","MEASURING","DISCONNECTED","legacyDriver","creator","deviceName","peripheral","signal","stop","events","end","removeEventListener","managed","disconnect","createDevice","device","onResult","id","data","reading","push","kind","onDeviceStatusChanged","status","mapped","onError","error","addEventListener","once","connect","catch","fail"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/ble-plx/legacy-driver.ts"],"mappings":";;AAKA,SAASA,YAAY,QAAQ,+CAA4C;AACzE,SAASC,OAAO,QAAQ,eAAY;AACpC,SAA8BC,aAAa,QAAQ,cAAW;AAE9D,SAASC,YAAY,QAAQ,iBAAc;AAC3C,SAASC,WAAW,QAAQ,kBAAe;AAE3C,MAAMC,QAAmF,GAAG;EAC1F,CAACL,YAAY,CAACM,SAAS,GAAG,WAAW;EACrC,CAACN,YAAY,CAACO,SAAS,GAAG,WAAW;EACrC,CAACP,YAAY,CAACQ,YAAY,GAAG;AAC/B,CAAC;;AAED;AACA,MAAMC,YAAY,GAAGA,CAACC,OAAiD,EAAEC,UAAqB,KAC5F,CAACC,UAAU,EAAEC,MAAM,KAAK;EACtB,MAAMC,IAAI,GAAGA,CAAA,KAAMC,MAAM,CAACC,GAAG,CAAC,CAAC;EAE/B,MAAMD,MAAM,GAAG,IAAId,OAAO,CAAc,MAAM;IAC5CY,MAAM,CAACI,mBAAmB,CAAC,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OjB,MAAM;AACf,CAAC;AAEH,SAASN,YAAY","ignoreList":[]}
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+
3
+ import { asBluetoothError, BluetoothError } from "./errors.js";
4
+ import { keepReadings } from "./result-policy.js";
5
+ const endedBeforeConnecting = () => new BluetoothError("connection-failed", "The device disconnected before it connected");
6
+
7
+ /** One driver run per connected device, its events folded into the snapshot. */
8
+ class Connections {
9
+ sessions = new Map();
10
+ constructor(store, readings, policy, onEnded) {
11
+ this.store = store;
12
+ this.readings = readings;
13
+ this.policy = policy;
14
+ this.onEnded = onEnded;
15
+ }
16
+ isActive(id) {
17
+ return this.sessions.has(id);
18
+ }
19
+
20
+ /** Resolves once connected; joins a connection still opening or open, and waits out one being closed. */
21
+ async connect(peripheral, driver) {
22
+ const current = this.sessions.get(peripheral.id);
23
+ if (current?.controller.signal.aborted) {
24
+ await current.ended;
25
+ return this.connect(peripheral, driver);
26
+ }
27
+ return (current ?? this.start(peripheral, driver)).connected;
28
+ }
29
+ async disconnect(id) {
30
+ const session = this.sessions.get(id);
31
+ session?.controller.abort();
32
+ await session?.ended;
33
+ }
34
+
35
+ /** Disconnects every device; resolves once every connection has ended. */
36
+ async disconnectAll() {
37
+ await Promise.all([...this.sessions.keys()].map(id => this.disconnect(id)));
38
+ }
39
+ start(peripheral, driver) {
40
+ const {
41
+ id
42
+ } = peripheral;
43
+ const controller = new AbortController();
44
+ let markConnected = () => undefined;
45
+ let failConnecting = () => undefined;
46
+ const connected = new Promise((resolve, reject) => {
47
+ markConnected = resolve;
48
+ failConnecting = reject;
49
+ });
50
+ this.store.updateDevice(id, {
51
+ connection: "connecting",
52
+ error: null
53
+ });
54
+ const ended = this.run(peripheral, driver, controller.signal, () => markConnected()).then(() => {
55
+ this.store.updateDevice(id, {
56
+ connection: "disconnected"
57
+ });
58
+ failConnecting(endedBeforeConnecting());
59
+ }).catch(error => {
60
+ const failure = asBluetoothError(error, "connection-failed");
61
+ this.store.updateDevice(id, controller.signal.aborted ? {
62
+ connection: "disconnected"
63
+ } : {
64
+ connection: "failed",
65
+ error: failure
66
+ });
67
+ failConnecting(failure);
68
+ }).finally(() => {
69
+ this.sessions.delete(id);
70
+ this.onEnded(id);
71
+ });
72
+ const session = {
73
+ controller,
74
+ connected,
75
+ ended
76
+ };
77
+ this.sessions.set(id, session);
78
+ return session;
79
+ }
80
+ async run(peripheral, driver, signal, connected) {
81
+ for await (const event of keepReadings(driver(peripheral, signal), this.policy)) {
82
+ this.apply(peripheral.id, event, connected);
83
+ }
84
+ }
85
+ apply(id, event, connected) {
86
+ if (event.kind === "status") {
87
+ if (event.status !== "disconnected") {
88
+ connected();
89
+ }
90
+ this.store.updateDevice(id, {
91
+ connection: event.status
92
+ });
93
+ } else if (event.kind === "information") {
94
+ this.store.updateDevice(id, {
95
+ information: event.information
96
+ });
97
+ } else if (event.kind === "reading") {
98
+ const device = this.store.device(id);
99
+ if (device) {
100
+ this.readings.receive(device, event.id, event.reading);
101
+ }
102
+ } else {
103
+ this.store.updateDevice(id, {
104
+ error: event.error
105
+ });
106
+ }
107
+ }
108
+ }
109
+ export { Connections };
110
+ //# sourceMappingURL=connections.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["asBluetoothError","BluetoothError","keepReadings","endedBeforeConnecting","Connections","sessions","Map","constructor","store","readings","policy","onEnded","isActive","id","has","connect","peripheral","driver","current","get","controller","signal","aborted","ended","start","connected","disconnect","session","abort","disconnectAll","Promise","all","keys","map","AbortController","markConnected","undefined","failConnecting","resolve","reject","updateDevice","connection","error","run","then","catch","failure","finally","delete","set","event","apply","kind","status","information","device","receive","reading"],"sourceRoot":"../../../../../src","sources":["modules/next/bluetooth/connections.ts"],"mappings":";;AACA,SAASA,gBAAgB,EAAEC,cAAc,QAAQ,aAAU;AAE3D,SAASC,YAAY,QAAsB,oBAAiB;AAM5D,MAAMC,qBAAqB,GAAGA,CAAA,KAC5B,IAAIF,cAAc,CAAC,mBAAmB,EAAE,6CAA6C,CAAC;;AAExF;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CAAC;MAEpC,IAAI0C,MAAM,EAAE;QACV,IAAI,CAAC9C,QAAQ,CAAC+C,OAAO,CAACD,MAAM,EAAEL,KAAK,CAACrC,EAAE,EAAEqC,KAAK,CAACO,OAAO,CAAC;MACxD;IACF,CAAC,MAAM;MACL,IAAI,CAACjD,KAAK,CAACgC,YAAY,CAAC3B,EAAE,EAAE;QAAE6B,KAAK,EAAEQ,KAAK,CAACR;MAAM,CAAC,CAAC;IACrD;EACF;AACF;AAEA,SAAStC,WAAW","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"version":3,"names":["dailyTotalDay","data","now","temporal","end","Date","getTime","day","start","recordedAt","toISOString","slice","undefined"],"sourceRoot":"../../../../../src","sources":["modules/next/bluetooth/daily-total-day.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,aAAa,GAAGA,CAC3BC,IAAY,EACZC,GAAW,KACY;EACvB,MAAMC,QAAQ,GAAGF,IAAuD;EAExE,IAAIE,QAAQ,CAACC,GAAG,YAAYC,IAAI,IAAIF,QAAQ,CAACC,GAAG,CAACE,OAAO,CAAC,CAAC,GAAGJ,GAAG,EAAE;IAChE,OAAO,QAAQ;EACjB;EAEA,MAAMK,GAAG,GAAGJ,QAAQ,CAACC,GAAG,IAAID,QAAQ,CAACK,KAAK,IAAIL,QAAQ,CAACM,UAAU;EAEjE,OAAOF,GAAG,YAAYF,IAAI,GAAGE,GAAG,CAACG,WAAW,CAAC,CAAC,CAACC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,GAAGC,SAAS;AACzE,CAAC","ignoreList":[]}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ import { gattDriver } from "./driver.js";
4
+
5
+ /** A peripheral a support recognised: the device key its readings carry and the driver that runs it. */
6
+
7
+ /** Recognises peripherals by their advertisement. */
8
+
9
+ /** A device a third party adds: how to recognise it and the protocol that reads it. */
10
+
11
+ /** Support for one device a third party defines with its own protocol. */
12
+ const defineDevice = ({
13
+ key,
14
+ matches,
15
+ protocol
16
+ }) => {
17
+ const driver = gattDriver(key, protocol);
18
+ return {
19
+ match: advertisement => matches(advertisement) ? {
20
+ key,
21
+ driver
22
+ } : undefined
23
+ };
24
+ };
25
+
26
+ /** The first support's match for an advertisement. */
27
+ const matchDevice = (devices, advertisement) => {
28
+ for (const support of devices) {
29
+ const match = support.match(advertisement);
30
+ if (match) {
31
+ return match;
32
+ }
33
+ }
34
+ return undefined;
35
+ };
36
+ export { defineDevice, matchDevice };
37
+ //# sourceMappingURL=devices.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["gattDriver","defineDevice","key","matches","protocol","driver","match","advertisement","undefined","matchDevice","devices","support"],"sourceRoot":"../../../../../src","sources":["modules/next/bluetooth/devices.ts"],"mappings":";;AAAA,SAAiCA,UAAU,QAAQ,aAAU;;AAG7D;;AAUA;;AAOA;;AAaA;AACA,MAAMC,YAAY,GAAGA,CAAC;EAAEC,GAAG;EAAEC,OAAO;EAAEC;AAA2B,CAAC,KAAoB;EACpF,MAAMC,MAAM,GAAGL,UAAU,CAACE,GAAG,EAAEE,QAAQ,CAAC;EAExC,OAAO;IAAEE,KAAK,EAAGC,aAAa,IAAMJ,OAAO,CAACI,aAAa,CAAC,GAAG;MAAEL,GAAG;MAAEG;IAAO,CAAC,GAAGG;EAAW,CAAC;AAC7F,CAAC;;AAED;AACA,MAAMC,WAAW,GAAGA,CAACC,OAAiC,EAAEH,aAA4B,KAA8B;EAChH,KAAK,MAAMI,OAAO,IAAID,OAAO,EAAE;IAC7B,MAAMJ,KAAK,GAAGK,OAAO,CAACL,KAAK,CAACC,aAAa,CAAC;IAE1C,IAAID,KAAK,EAAE;MACT,OAAOA,KAAK;IACd;EACF;EAEA,OAAOE,SAAS;AAClB,CAAC;AAED,SAASP,YAAY,EAAEQ,WAAW","ignoreList":[]}