@ovok/native 1.16.1-rc.6 → 1.16.1-rc.7

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 (545) hide show
  1. package/lib/commonjs/modules/bt-management/components/bt-provider-child-wrapper.js +19 -7
  2. package/lib/commonjs/modules/bt-management/components/bt-provider-child-wrapper.js.map +1 -1
  3. package/lib/commonjs/modules/bt-management/hooks/runtime-context.js.map +1 -1
  4. package/lib/commonjs/modules/bt-management/index.js +12 -0
  5. package/lib/commonjs/modules/bt-management/index.js.map +1 -1
  6. package/lib/commonjs/modules/bt-management/services/bt-manager.js +27 -1
  7. package/lib/commonjs/modules/bt-management/services/bt-manager.js.map +1 -1
  8. package/lib/commonjs/modules/bt-management/services/custom/compile-custom-lepu.js +39 -0
  9. package/lib/commonjs/modules/bt-management/services/custom/compile-custom-lepu.js.map +1 -1
  10. package/lib/commonjs/modules/bt-management/services/devices/bp2/bp2.device.js +36 -10
  11. package/lib/commonjs/modules/bt-management/services/devices/bp2/bp2.device.js.map +1 -1
  12. package/lib/commonjs/modules/bt-management/services/devices/bp2/bp2.frame-reader.js +2 -2
  13. package/lib/commonjs/modules/bt-management/services/devices/bp2/bp2.frame-reader.js.map +1 -1
  14. package/lib/commonjs/modules/bt-management/services/devices/bp2/bp2.history-sequencer.js +69 -25
  15. package/lib/commonjs/modules/bt-management/services/devices/bp2/bp2.history-sequencer.js.map +1 -1
  16. package/lib/commonjs/modules/bt-management/services/devices/bt-command-writer.js +30 -2
  17. package/lib/commonjs/modules/bt-management/services/devices/bt-command-writer.js.map +1 -1
  18. package/lib/commonjs/modules/bt-management/services/devices/bt-data-processor.js +1 -1
  19. package/lib/commonjs/modules/bt-management/services/devices/bt-data-processor.js.map +1 -1
  20. package/lib/commonjs/modules/bt-management/services/devices/bt-managed-device.js +48 -3
  21. package/lib/commonjs/modules/bt-management/services/devices/bt-managed-device.js.map +1 -1
  22. package/lib/commonjs/modules/bt-management/services/devices/custom/custom-lepu-sequencer.js +6 -2
  23. package/lib/commonjs/modules/bt-management/services/devices/custom/custom-lepu-sequencer.js.map +1 -1
  24. package/lib/commonjs/modules/bt-management/services/devices/custom/custom.device.js +113 -24
  25. package/lib/commonjs/modules/bt-management/services/devices/custom/custom.device.js.map +1 -1
  26. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.advertisement.js +19 -2
  27. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.advertisement.js.map +1 -1
  28. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.connect-retry.js +32 -0
  29. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.connect-retry.js.map +1 -0
  30. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.delivered-files.js +73 -0
  31. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.delivered-files.js.map +1 -0
  32. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.ecg-transfer.js +130 -30
  33. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.ecg-transfer.js.map +1 -1
  34. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.encryption-handshake.js +103 -0
  35. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.encryption-handshake.js.map +1 -0
  36. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.file-transfer.js +20 -14
  37. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.file-transfer.js.map +1 -1
  38. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.frame-reader.js +4 -2
  39. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.frame-reader.js.map +1 -1
  40. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.identity-gate.js +94 -10
  41. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.identity-gate.js.map +1 -1
  42. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.live-ecg-chunks.js +75 -0
  43. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.live-ecg-chunks.js.map +1 -0
  44. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.pulse-wave-chunks.js +113 -0
  45. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.pulse-wave-chunks.js.map +1 -0
  46. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.pulse-wave.js +67 -0
  47. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.pulse-wave.js.map +1 -0
  48. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.recorder.js +55 -0
  49. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.recorder.js.map +1 -0
  50. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.recording-watch.js +57 -0
  51. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.recording-watch.js.map +1 -0
  52. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.session.js +49 -0
  53. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.session.js.map +1 -0
  54. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.stored-files.js +46 -0
  55. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.stored-files.js.map +1 -0
  56. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.transports.js +10 -4
  57. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.transports.js.map +1 -1
  58. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.waveform.js +27 -0
  59. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.waveform.js.map +1 -0
  60. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.bp-monitors.js +0 -1
  61. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.bp-monitors.js.map +1 -1
  62. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.ecg-files.js +3 -5
  63. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.ecg-files.js.map +1 -1
  64. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.js +17 -8
  65. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.js.map +1 -1
  66. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.ecg-recording-status.js +47 -0
  67. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.ecg-recording-status.js.map +1 -0
  68. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.oximeters.js +58 -32
  69. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.oximeters.js.map +1 -1
  70. package/lib/commonjs/modules/bt-management/services/series-recorder.js +27 -5
  71. package/lib/commonjs/modules/bt-management/services/series-recorder.js.map +1 -1
  72. package/lib/commonjs/modules/bt-management/types/device-waveform.js +6 -0
  73. package/lib/commonjs/modules/bt-management/types/device-waveform.js.map +1 -0
  74. package/lib/commonjs/modules/bt-management/utils/i-16-from-hex.js.map +1 -1
  75. package/lib/commonjs/modules/bt-management/utils/le-32-from-hex.js.map +1 -1
  76. package/lib/commonjs/modules/data-sync/components/apple/apple-health-authorization-provider.js +15 -8
  77. package/lib/commonjs/modules/data-sync/components/apple/apple-health-authorization-provider.js.map +1 -1
  78. package/lib/commonjs/modules/data-sync/components/apple/apple-health-authorization-utils.js +1 -1
  79. package/lib/commonjs/modules/data-sync/components/apple/apple-health-authorization-utils.js.map +1 -1
  80. package/lib/commonjs/modules/data-sync/constants.js +4 -1
  81. package/lib/commonjs/modules/data-sync/constants.js.map +1 -1
  82. package/lib/commonjs/modules/data-sync/hooks/use-listen-changes.js +6 -9
  83. package/lib/commonjs/modules/data-sync/hooks/use-listen-changes.js.map +1 -1
  84. package/lib/commonjs/modules/data-sync/services/managers/data-processor.js +1 -0
  85. package/lib/commonjs/modules/data-sync/services/managers/data-processor.js.map +1 -1
  86. package/lib/commonjs/modules/data-sync/types/health-sync-keys.js +13 -0
  87. package/lib/commonjs/modules/data-sync/types/health-sync-keys.js.map +1 -1
  88. package/lib/commonjs/modules/data-sync/utils/convert-ecg-samples-to-observation.js +47 -0
  89. package/lib/commonjs/modules/data-sync/utils/convert-ecg-samples-to-observation.js.map +1 -0
  90. package/lib/commonjs/modules/data-sync/utils/convert-generic-health-data.js +6 -3
  91. package/lib/commonjs/modules/data-sync/utils/convert-generic-health-data.js.map +1 -1
  92. package/lib/commonjs/modules/data-sync/utils/convert-samples-to-observation.js +7 -15
  93. package/lib/commonjs/modules/data-sync/utils/convert-samples-to-observation.js.map +1 -1
  94. package/lib/commonjs/modules/data-sync/utils/default-health-coding.js +25 -4
  95. package/lib/commonjs/modules/data-sync/utils/default-health-coding.js.map +1 -1
  96. package/lib/commonjs/modules/data-sync/utils/get-records-from-health-connect.js +20 -4
  97. package/lib/commonjs/modules/data-sync/utils/get-records-from-health-connect.js.map +1 -1
  98. package/lib/commonjs/modules/data-sync/utils/get-samples-from-health.js +43 -86
  99. package/lib/commonjs/modules/data-sync/utils/get-samples-from-health.js.map +1 -1
  100. package/lib/commonjs/modules/data-sync/utils/get-total-samples-count.js +6 -5
  101. package/lib/commonjs/modules/data-sync/utils/get-total-samples-count.js.map +1 -1
  102. package/lib/commonjs/modules/data-sync/utils/health-data-catalog.js +15 -15
  103. package/lib/commonjs/modules/data-sync/utils/health-data-catalog.js.map +1 -1
  104. package/lib/commonjs/modules/data-sync/utils/health-units.js +6 -1
  105. package/lib/commonjs/modules/data-sync/utils/health-units.js.map +1 -1
  106. package/lib/commonjs/modules/data-sync/utils/healthkit-daily-statistics.js +64 -0
  107. package/lib/commonjs/modules/data-sync/utils/healthkit-daily-statistics.js.map +1 -0
  108. package/lib/commonjs/modules/data-sync/utils/healthkit-data-types.js.map +1 -1
  109. package/lib/commonjs/modules/data-sync/utils/healthkit-query-options.js +20 -0
  110. package/lib/commonjs/modules/data-sync/utils/healthkit-query-options.js.map +1 -0
  111. package/lib/commonjs/modules/data-sync/utils/healthkit-sample-source.js +21 -0
  112. package/lib/commonjs/modules/data-sync/utils/healthkit-sample-source.js.map +1 -0
  113. package/lib/commonjs/modules/data-sync/utils/healthkit-samples.js +59 -0
  114. package/lib/commonjs/modules/data-sync/utils/healthkit-samples.js.map +1 -0
  115. package/lib/commonjs/modules/data-sync/utils/healthkit-series.js +20 -11
  116. package/lib/commonjs/modules/data-sync/utils/healthkit-series.js.map +1 -1
  117. package/lib/commonjs/modules/next/bluetooth/ble-plx/built-in-devices.js +12 -2
  118. package/lib/commonjs/modules/next/bluetooth/ble-plx/built-in-devices.js.map +1 -1
  119. package/lib/commonjs/modules/next/bluetooth/ble-plx/legacy-driver.js +39 -5
  120. package/lib/commonjs/modules/next/bluetooth/ble-plx/legacy-driver.js.map +1 -1
  121. package/lib/commonjs/modules/next/bluetooth/connections.js +45 -2
  122. package/lib/commonjs/modules/next/bluetooth/connections.js.map +1 -1
  123. package/lib/commonjs/modules/next/bluetooth/driver.js.map +1 -1
  124. package/lib/commonjs/modules/next/bluetooth/errors.js.map +1 -1
  125. package/lib/commonjs/modules/next/bluetooth/index.js.map +1 -1
  126. package/lib/commonjs/modules/next/bluetooth/readings.js +10 -2
  127. package/lib/commonjs/modules/next/bluetooth/readings.js.map +1 -1
  128. package/lib/commonjs/modules/next/bluetooth/runtime.js +37 -1
  129. package/lib/commonjs/modules/next/bluetooth/runtime.js.map +1 -1
  130. package/lib/commonjs/modules/next/bluetooth/web/index.js.map +1 -1
  131. package/lib/module/modules/bt-management/components/bt-provider-child-wrapper.js +19 -7
  132. package/lib/module/modules/bt-management/components/bt-provider-child-wrapper.js.map +1 -1
  133. package/lib/module/modules/bt-management/hooks/runtime-context.js.map +1 -1
  134. package/lib/module/modules/bt-management/index.js +1 -0
  135. package/lib/module/modules/bt-management/index.js.map +1 -1
  136. package/lib/module/modules/bt-management/services/bt-manager.js +27 -1
  137. package/lib/module/modules/bt-management/services/bt-manager.js.map +1 -1
  138. package/lib/module/modules/bt-management/services/custom/compile-custom-lepu.js +39 -0
  139. package/lib/module/modules/bt-management/services/custom/compile-custom-lepu.js.map +1 -1
  140. package/lib/module/modules/bt-management/services/devices/bp2/bp2.device.js +36 -10
  141. package/lib/module/modules/bt-management/services/devices/bp2/bp2.device.js.map +1 -1
  142. package/lib/module/modules/bt-management/services/devices/bp2/bp2.frame-reader.js +2 -3
  143. package/lib/module/modules/bt-management/services/devices/bp2/bp2.frame-reader.js.map +1 -1
  144. package/lib/module/modules/bt-management/services/devices/bp2/bp2.history-sequencer.js +68 -25
  145. package/lib/module/modules/bt-management/services/devices/bp2/bp2.history-sequencer.js.map +1 -1
  146. package/lib/module/modules/bt-management/services/devices/bt-command-writer.js +30 -2
  147. package/lib/module/modules/bt-management/services/devices/bt-command-writer.js.map +1 -1
  148. package/lib/module/modules/bt-management/services/devices/bt-data-processor.js +1 -1
  149. package/lib/module/modules/bt-management/services/devices/bt-data-processor.js.map +1 -1
  150. package/lib/module/modules/bt-management/services/devices/bt-managed-device.js +48 -3
  151. package/lib/module/modules/bt-management/services/devices/bt-managed-device.js.map +1 -1
  152. package/lib/module/modules/bt-management/services/devices/custom/custom-lepu-sequencer.js +6 -2
  153. package/lib/module/modules/bt-management/services/devices/custom/custom-lepu-sequencer.js.map +1 -1
  154. package/lib/module/modules/bt-management/services/devices/custom/custom.device.js +113 -24
  155. package/lib/module/modules/bt-management/services/devices/custom/custom.device.js.map +1 -1
  156. package/lib/module/modules/bt-management/services/devices/lepu/lepu.advertisement.js +17 -1
  157. package/lib/module/modules/bt-management/services/devices/lepu/lepu.advertisement.js.map +1 -1
  158. package/lib/module/modules/bt-management/services/devices/lepu/lepu.connect-retry.js +28 -0
  159. package/lib/module/modules/bt-management/services/devices/lepu/lepu.connect-retry.js.map +1 -0
  160. package/lib/module/modules/bt-management/services/devices/lepu/lepu.delivered-files.js +69 -0
  161. package/lib/module/modules/bt-management/services/devices/lepu/lepu.delivered-files.js.map +1 -0
  162. package/lib/module/modules/bt-management/services/devices/lepu/lepu.ecg-transfer.js +129 -30
  163. package/lib/module/modules/bt-management/services/devices/lepu/lepu.ecg-transfer.js.map +1 -1
  164. package/lib/module/modules/bt-management/services/devices/lepu/lepu.encryption-handshake.js +99 -0
  165. package/lib/module/modules/bt-management/services/devices/lepu/lepu.encryption-handshake.js.map +1 -0
  166. package/lib/module/modules/bt-management/services/devices/lepu/lepu.file-transfer.js +20 -14
  167. package/lib/module/modules/bt-management/services/devices/lepu/lepu.file-transfer.js.map +1 -1
  168. package/lib/module/modules/bt-management/services/devices/lepu/lepu.frame-reader.js +4 -2
  169. package/lib/module/modules/bt-management/services/devices/lepu/lepu.frame-reader.js.map +1 -1
  170. package/lib/module/modules/bt-management/services/devices/lepu/lepu.identity-gate.js +94 -10
  171. package/lib/module/modules/bt-management/services/devices/lepu/lepu.identity-gate.js.map +1 -1
  172. package/lib/module/modules/bt-management/services/devices/lepu/lepu.live-ecg-chunks.js +72 -0
  173. package/lib/module/modules/bt-management/services/devices/lepu/lepu.live-ecg-chunks.js.map +1 -0
  174. package/lib/module/modules/bt-management/services/devices/lepu/lepu.pulse-wave-chunks.js +109 -0
  175. package/lib/module/modules/bt-management/services/devices/lepu/lepu.pulse-wave-chunks.js.map +1 -0
  176. package/lib/module/modules/bt-management/services/devices/lepu/lepu.pulse-wave.js +64 -0
  177. package/lib/module/modules/bt-management/services/devices/lepu/lepu.pulse-wave.js.map +1 -0
  178. package/lib/module/modules/bt-management/services/devices/lepu/lepu.recorder.js +51 -0
  179. package/lib/module/modules/bt-management/services/devices/lepu/lepu.recorder.js.map +1 -0
  180. package/lib/module/modules/bt-management/services/devices/lepu/lepu.recording-watch.js +53 -0
  181. package/lib/module/modules/bt-management/services/devices/lepu/lepu.recording-watch.js.map +1 -0
  182. package/lib/module/modules/bt-management/services/devices/lepu/lepu.session.js +45 -0
  183. package/lib/module/modules/bt-management/services/devices/lepu/lepu.session.js.map +1 -0
  184. package/lib/module/modules/bt-management/services/devices/lepu/lepu.stored-files.js +42 -0
  185. package/lib/module/modules/bt-management/services/devices/lepu/lepu.stored-files.js.map +1 -0
  186. package/lib/module/modules/bt-management/services/devices/lepu/lepu.transports.js +10 -4
  187. package/lib/module/modules/bt-management/services/devices/lepu/lepu.transports.js.map +1 -1
  188. package/lib/module/modules/bt-management/services/devices/lepu/lepu.waveform.js +22 -0
  189. package/lib/module/modules/bt-management/services/devices/lepu/lepu.waveform.js.map +1 -0
  190. package/lib/module/modules/bt-management/services/devices/viatom/viatom.bp-monitors.js +0 -1
  191. package/lib/module/modules/bt-management/services/devices/viatom/viatom.bp-monitors.js.map +1 -1
  192. package/lib/module/modules/bt-management/services/devices/viatom/viatom.ecg-files.js +3 -6
  193. package/lib/module/modules/bt-management/services/devices/viatom/viatom.ecg-files.js.map +1 -1
  194. package/lib/module/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.js +17 -8
  195. package/lib/module/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.js.map +1 -1
  196. package/lib/module/modules/bt-management/services/devices/viatom/viatom.ecg-recording-status.js +44 -0
  197. package/lib/module/modules/bt-management/services/devices/viatom/viatom.ecg-recording-status.js.map +1 -0
  198. package/lib/module/modules/bt-management/services/devices/viatom/viatom.oximeters.js +58 -32
  199. package/lib/module/modules/bt-management/services/devices/viatom/viatom.oximeters.js.map +1 -1
  200. package/lib/module/modules/bt-management/services/series-recorder.js +27 -5
  201. package/lib/module/modules/bt-management/services/series-recorder.js.map +1 -1
  202. package/lib/module/modules/bt-management/types/device-waveform.js +4 -0
  203. package/lib/module/modules/bt-management/types/device-waveform.js.map +1 -0
  204. package/lib/module/modules/bt-management/utils/i-16-from-hex.js.map +1 -1
  205. package/lib/module/modules/bt-management/utils/le-32-from-hex.js.map +1 -1
  206. package/lib/module/modules/data-sync/components/apple/apple-health-authorization-provider.js +16 -9
  207. package/lib/module/modules/data-sync/components/apple/apple-health-authorization-provider.js.map +1 -1
  208. package/lib/module/modules/data-sync/components/apple/apple-health-authorization-utils.js +2 -2
  209. package/lib/module/modules/data-sync/components/apple/apple-health-authorization-utils.js.map +1 -1
  210. package/lib/module/modules/data-sync/constants.js +4 -1
  211. package/lib/module/modules/data-sync/constants.js.map +1 -1
  212. package/lib/module/modules/data-sync/hooks/use-listen-changes.js +7 -10
  213. package/lib/module/modules/data-sync/hooks/use-listen-changes.js.map +1 -1
  214. package/lib/module/modules/data-sync/services/managers/data-processor.js +1 -0
  215. package/lib/module/modules/data-sync/services/managers/data-processor.js.map +1 -1
  216. package/lib/module/modules/data-sync/types/health-sync-keys.js +13 -0
  217. package/lib/module/modules/data-sync/types/health-sync-keys.js.map +1 -1
  218. package/lib/module/modules/data-sync/utils/convert-ecg-samples-to-observation.js +43 -0
  219. package/lib/module/modules/data-sync/utils/convert-ecg-samples-to-observation.js.map +1 -0
  220. package/lib/module/modules/data-sync/utils/convert-generic-health-data.js +6 -3
  221. package/lib/module/modules/data-sync/utils/convert-generic-health-data.js.map +1 -1
  222. package/lib/module/modules/data-sync/utils/convert-samples-to-observation.js +7 -15
  223. package/lib/module/modules/data-sync/utils/convert-samples-to-observation.js.map +1 -1
  224. package/lib/module/modules/data-sync/utils/default-health-coding.js +25 -4
  225. package/lib/module/modules/data-sync/utils/default-health-coding.js.map +1 -1
  226. package/lib/module/modules/data-sync/utils/get-records-from-health-connect.js +20 -4
  227. package/lib/module/modules/data-sync/utils/get-records-from-health-connect.js.map +1 -1
  228. package/lib/module/modules/data-sync/utils/get-samples-from-health.js +44 -87
  229. package/lib/module/modules/data-sync/utils/get-samples-from-health.js.map +1 -1
  230. package/lib/module/modules/data-sync/utils/get-total-samples-count.js +5 -4
  231. package/lib/module/modules/data-sync/utils/get-total-samples-count.js.map +1 -1
  232. package/lib/module/modules/data-sync/utils/health-data-catalog.js +15 -15
  233. package/lib/module/modules/data-sync/utils/health-data-catalog.js.map +1 -1
  234. package/lib/module/modules/data-sync/utils/health-units.js +6 -1
  235. package/lib/module/modules/data-sync/utils/health-units.js.map +1 -1
  236. package/lib/module/modules/data-sync/utils/healthkit-daily-statistics.js +59 -0
  237. package/lib/module/modules/data-sync/utils/healthkit-daily-statistics.js.map +1 -0
  238. package/lib/module/modules/data-sync/utils/healthkit-data-types.js.map +1 -1
  239. package/lib/module/modules/data-sync/utils/healthkit-query-options.js +16 -0
  240. package/lib/module/modules/data-sync/utils/healthkit-query-options.js.map +1 -0
  241. package/lib/module/modules/data-sync/utils/healthkit-sample-source.js +17 -0
  242. package/lib/module/modules/data-sync/utils/healthkit-sample-source.js.map +1 -0
  243. package/lib/module/modules/data-sync/utils/healthkit-samples.js +52 -0
  244. package/lib/module/modules/data-sync/utils/healthkit-samples.js.map +1 -0
  245. package/lib/module/modules/data-sync/utils/healthkit-series.js +19 -10
  246. package/lib/module/modules/data-sync/utils/healthkit-series.js.map +1 -1
  247. package/lib/module/modules/next/bluetooth/ble-plx/built-in-devices.js +12 -2
  248. package/lib/module/modules/next/bluetooth/ble-plx/built-in-devices.js.map +1 -1
  249. package/lib/module/modules/next/bluetooth/ble-plx/legacy-driver.js +39 -5
  250. package/lib/module/modules/next/bluetooth/ble-plx/legacy-driver.js.map +1 -1
  251. package/lib/module/modules/next/bluetooth/connections.js +45 -2
  252. package/lib/module/modules/next/bluetooth/connections.js.map +1 -1
  253. package/lib/module/modules/next/bluetooth/driver.js.map +1 -1
  254. package/lib/module/modules/next/bluetooth/errors.js.map +1 -1
  255. package/lib/module/modules/next/bluetooth/index.js.map +1 -1
  256. package/lib/module/modules/next/bluetooth/readings.js +10 -2
  257. package/lib/module/modules/next/bluetooth/readings.js.map +1 -1
  258. package/lib/module/modules/next/bluetooth/runtime.js +37 -1
  259. package/lib/module/modules/next/bluetooth/runtime.js.map +1 -1
  260. package/lib/module/modules/next/bluetooth/web/index.js.map +1 -1
  261. package/lib/typescript/commonjs/src/modules/bt-management/components/bt-provider-child-wrapper.d.ts.map +1 -1
  262. package/lib/typescript/commonjs/src/modules/bt-management/hooks/runtime-context.d.ts +4 -1
  263. package/lib/typescript/commonjs/src/modules/bt-management/hooks/runtime-context.d.ts.map +1 -1
  264. package/lib/typescript/commonjs/src/modules/bt-management/index.d.ts +1 -0
  265. package/lib/typescript/commonjs/src/modules/bt-management/index.d.ts.map +1 -1
  266. package/lib/typescript/commonjs/src/modules/bt-management/services/bt-manager.d.ts +21 -5
  267. package/lib/typescript/commonjs/src/modules/bt-management/services/bt-manager.d.ts.map +1 -1
  268. package/lib/typescript/commonjs/src/modules/bt-management/services/custom/compile-custom-lepu.d.ts.map +1 -1
  269. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bp2/bp2.device.d.ts +4 -0
  270. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bp2/bp2.device.d.ts.map +1 -1
  271. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bp2/bp2.frame-reader.d.ts +2 -1
  272. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bp2/bp2.frame-reader.d.ts.map +1 -1
  273. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bp2/bp2.history-sequencer.d.ts +24 -4
  274. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bp2/bp2.history-sequencer.d.ts.map +1 -1
  275. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-command-writer.d.ts +6 -1
  276. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-command-writer.d.ts.map +1 -1
  277. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-managed-device.d.ts +23 -3
  278. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-managed-device.d.ts.map +1 -1
  279. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/custom/custom-lepu-sequencer.d.ts +6 -3
  280. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/custom/custom-lepu-sequencer.d.ts.map +1 -1
  281. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/custom/custom.device.d.ts +20 -0
  282. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/custom/custom.device.d.ts.map +1 -1
  283. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.advertisement.d.ts +8 -1
  284. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.advertisement.d.ts.map +1 -1
  285. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.connect-retry.d.ts +12 -0
  286. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.connect-retry.d.ts.map +1 -0
  287. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.delivered-files.d.ts +24 -0
  288. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.delivered-files.d.ts.map +1 -0
  289. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.ecg-transfer.d.ts +40 -5
  290. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.ecg-transfer.d.ts.map +1 -1
  291. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.encryption-handshake.d.ts +20 -0
  292. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.encryption-handshake.d.ts.map +1 -0
  293. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.file-transfer.d.ts +6 -3
  294. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.file-transfer.d.ts.map +1 -1
  295. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.frame-reader.d.ts +3 -1
  296. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.frame-reader.d.ts.map +1 -1
  297. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.identity-gate.d.ts +26 -1
  298. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.identity-gate.d.ts.map +1 -1
  299. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.live-ecg-chunks.d.ts +42 -0
  300. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.live-ecg-chunks.d.ts.map +1 -0
  301. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.pulse-wave-chunks.d.ts +28 -0
  302. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.pulse-wave-chunks.d.ts.map +1 -0
  303. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.pulse-wave.d.ts +16 -0
  304. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.pulse-wave.d.ts.map +1 -0
  305. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.recorder.d.ts +32 -0
  306. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.recorder.d.ts.map +1 -0
  307. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.recording-watch.d.ts +28 -0
  308. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.recording-watch.d.ts.map +1 -0
  309. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.session.d.ts +17 -0
  310. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.session.d.ts.map +1 -0
  311. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.stored-files.d.ts +33 -0
  312. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.stored-files.d.ts.map +1 -0
  313. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.transports.d.ts +4 -0
  314. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.transports.d.ts.map +1 -1
  315. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.waveform.d.ts +9 -0
  316. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.waveform.d.ts.map +1 -0
  317. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.bp-monitors.d.ts.map +1 -1
  318. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.ecg-files.d.ts +1 -1
  319. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.ecg-files.d.ts.map +1 -1
  320. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.d.ts.map +1 -1
  321. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.ecg-recording-status.d.ts +8 -0
  322. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.ecg-recording-status.d.ts.map +1 -0
  323. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.oximeters.d.ts.map +1 -1
  324. package/lib/typescript/commonjs/src/modules/bt-management/services/series-recorder.d.ts +6 -1
  325. package/lib/typescript/commonjs/src/modules/bt-management/services/series-recorder.d.ts.map +1 -1
  326. package/lib/typescript/commonjs/src/modules/bt-management/types/create-device-params.d.ts +7 -1
  327. package/lib/typescript/commonjs/src/modules/bt-management/types/create-device-params.d.ts.map +1 -1
  328. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-lepu-spec.d.ts +42 -1
  329. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-lepu-spec.d.ts.map +1 -1
  330. package/lib/typescript/commonjs/src/modules/bt-management/types/device-connection-event.d.ts +17 -1
  331. package/lib/typescript/commonjs/src/modules/bt-management/types/device-connection-event.d.ts.map +1 -1
  332. package/lib/typescript/commonjs/src/modules/bt-management/types/device-waveform.d.ts +15 -0
  333. package/lib/typescript/commonjs/src/modules/bt-management/types/device-waveform.d.ts.map +1 -0
  334. package/lib/typescript/commonjs/src/modules/bt-management/utils/i-16-from-hex.d.ts +1 -1
  335. package/lib/typescript/commonjs/src/modules/bt-management/utils/i-16-from-hex.d.ts.map +1 -1
  336. package/lib/typescript/commonjs/src/modules/bt-management/utils/le-32-from-hex.d.ts +1 -1
  337. package/lib/typescript/commonjs/src/modules/bt-management/utils/le-32-from-hex.d.ts.map +1 -1
  338. package/lib/typescript/commonjs/src/modules/data-sync/components/apple/apple-health-authorization-provider.d.ts.map +1 -1
  339. package/lib/typescript/commonjs/src/modules/data-sync/components/apple/apple-health-authorization-utils.d.ts +2 -2
  340. package/lib/typescript/commonjs/src/modules/data-sync/components/apple/apple-health-authorization-utils.d.ts.map +1 -1
  341. package/lib/typescript/commonjs/src/modules/data-sync/constants.d.ts +3 -1
  342. package/lib/typescript/commonjs/src/modules/data-sync/constants.d.ts.map +1 -1
  343. package/lib/typescript/commonjs/src/modules/data-sync/hooks/use-listen-changes.d.ts.map +1 -1
  344. package/lib/typescript/commonjs/src/modules/data-sync/services/managers/data-processor.d.ts.map +1 -1
  345. package/lib/typescript/commonjs/src/modules/data-sync/types/apple-health-authorization-provider-props.d.ts +2 -2
  346. package/lib/typescript/commonjs/src/modules/data-sync/types/apple-health-authorization-provider-props.d.ts.map +1 -1
  347. package/lib/typescript/commonjs/src/modules/data-sync/types/apple-health-sync-props.d.ts +4 -7
  348. package/lib/typescript/commonjs/src/modules/data-sync/types/apple-health-sync-props.d.ts.map +1 -1
  349. package/lib/typescript/commonjs/src/modules/data-sync/types/get-data-from-provider-props.d.ts +3 -1
  350. package/lib/typescript/commonjs/src/modules/data-sync/types/get-data-from-provider-props.d.ts.map +1 -1
  351. package/lib/typescript/commonjs/src/modules/data-sync/types/health-authorization-status.d.ts +2 -2
  352. package/lib/typescript/commonjs/src/modules/data-sync/types/health-authorization-status.d.ts.map +1 -1
  353. package/lib/typescript/commonjs/src/modules/data-sync/types/health-sync-keys.d.ts +11 -1
  354. package/lib/typescript/commonjs/src/modules/data-sync/types/health-sync-keys.d.ts.map +1 -1
  355. package/lib/typescript/commonjs/src/modules/data-sync/utils/convert-ecg-samples-to-observation.d.ts +6 -0
  356. package/lib/typescript/commonjs/src/modules/data-sync/utils/convert-ecg-samples-to-observation.d.ts.map +1 -0
  357. package/lib/typescript/commonjs/src/modules/data-sync/utils/convert-generic-health-data.d.ts +1 -1
  358. package/lib/typescript/commonjs/src/modules/data-sync/utils/convert-generic-health-data.d.ts.map +1 -1
  359. package/lib/typescript/commonjs/src/modules/data-sync/utils/convert-samples-to-observation.d.ts.map +1 -1
  360. package/lib/typescript/commonjs/src/modules/data-sync/utils/default-health-coding.d.ts.map +1 -1
  361. package/lib/typescript/commonjs/src/modules/data-sync/utils/get-records-from-health-connect.d.ts +1 -1
  362. package/lib/typescript/commonjs/src/modules/data-sync/utils/get-records-from-health-connect.d.ts.map +1 -1
  363. package/lib/typescript/commonjs/src/modules/data-sync/utils/get-samples-from-health.d.ts +12 -46
  364. package/lib/typescript/commonjs/src/modules/data-sync/utils/get-samples-from-health.d.ts.map +1 -1
  365. package/lib/typescript/commonjs/src/modules/data-sync/utils/get-total-samples-count.d.ts.map +1 -1
  366. package/lib/typescript/commonjs/src/modules/data-sync/utils/health-data-catalog.d.ts.map +1 -1
  367. package/lib/typescript/commonjs/src/modules/data-sync/utils/health-units.d.ts +2 -2
  368. package/lib/typescript/commonjs/src/modules/data-sync/utils/health-units.d.ts.map +1 -1
  369. package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-daily-statistics.d.ts +10 -0
  370. package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-daily-statistics.d.ts.map +1 -0
  371. package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-data-types.d.ts +5 -5
  372. package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-data-types.d.ts.map +1 -1
  373. package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-query-options.d.ts +7 -0
  374. package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-query-options.d.ts.map +1 -0
  375. package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-sample-source.d.ts +8 -0
  376. package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-sample-source.d.ts.map +1 -0
  377. package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-samples.d.ts +30 -0
  378. package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-samples.d.ts.map +1 -0
  379. package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-series.d.ts +2 -2
  380. package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-series.d.ts.map +1 -1
  381. package/lib/typescript/commonjs/src/modules/data-sync/utils/to-core-health-observations.d.ts +1 -0
  382. package/lib/typescript/commonjs/src/modules/data-sync/utils/to-core-health-observations.d.ts.map +1 -1
  383. package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/built-in-devices.d.ts +12 -1
  384. package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/built-in-devices.d.ts.map +1 -1
  385. package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/legacy-driver.d.ts +2 -1
  386. package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/legacy-driver.d.ts.map +1 -1
  387. package/lib/typescript/commonjs/src/modules/next/bluetooth/connections.d.ts +13 -1
  388. package/lib/typescript/commonjs/src/modules/next/bluetooth/connections.d.ts.map +1 -1
  389. package/lib/typescript/commonjs/src/modules/next/bluetooth/driver.d.ts +20 -0
  390. package/lib/typescript/commonjs/src/modules/next/bluetooth/driver.d.ts.map +1 -1
  391. package/lib/typescript/commonjs/src/modules/next/bluetooth/errors.d.ts +1 -1
  392. package/lib/typescript/commonjs/src/modules/next/bluetooth/errors.d.ts.map +1 -1
  393. package/lib/typescript/commonjs/src/modules/next/bluetooth/index.d.ts +2 -1
  394. package/lib/typescript/commonjs/src/modules/next/bluetooth/index.d.ts.map +1 -1
  395. package/lib/typescript/commonjs/src/modules/next/bluetooth/readings.d.ts +3 -2
  396. package/lib/typescript/commonjs/src/modules/next/bluetooth/readings.d.ts.map +1 -1
  397. package/lib/typescript/commonjs/src/modules/next/bluetooth/runtime.d.ts +19 -1
  398. package/lib/typescript/commonjs/src/modules/next/bluetooth/runtime.d.ts.map +1 -1
  399. package/lib/typescript/commonjs/src/modules/next/bluetooth/snapshot.d.ts +33 -1
  400. package/lib/typescript/commonjs/src/modules/next/bluetooth/snapshot.d.ts.map +1 -1
  401. package/lib/typescript/commonjs/src/modules/next/bluetooth/web/index.d.ts +1 -0
  402. package/lib/typescript/commonjs/src/modules/next/bluetooth/web/index.d.ts.map +1 -1
  403. package/lib/typescript/module/src/modules/bt-management/components/bt-provider-child-wrapper.d.ts.map +1 -1
  404. package/lib/typescript/module/src/modules/bt-management/hooks/runtime-context.d.ts +4 -1
  405. package/lib/typescript/module/src/modules/bt-management/hooks/runtime-context.d.ts.map +1 -1
  406. package/lib/typescript/module/src/modules/bt-management/index.d.ts +1 -0
  407. package/lib/typescript/module/src/modules/bt-management/index.d.ts.map +1 -1
  408. package/lib/typescript/module/src/modules/bt-management/services/bt-manager.d.ts +21 -5
  409. package/lib/typescript/module/src/modules/bt-management/services/bt-manager.d.ts.map +1 -1
  410. package/lib/typescript/module/src/modules/bt-management/services/custom/compile-custom-lepu.d.ts.map +1 -1
  411. package/lib/typescript/module/src/modules/bt-management/services/devices/bp2/bp2.device.d.ts +4 -0
  412. package/lib/typescript/module/src/modules/bt-management/services/devices/bp2/bp2.device.d.ts.map +1 -1
  413. package/lib/typescript/module/src/modules/bt-management/services/devices/bp2/bp2.frame-reader.d.ts +2 -1
  414. package/lib/typescript/module/src/modules/bt-management/services/devices/bp2/bp2.frame-reader.d.ts.map +1 -1
  415. package/lib/typescript/module/src/modules/bt-management/services/devices/bp2/bp2.history-sequencer.d.ts +24 -4
  416. package/lib/typescript/module/src/modules/bt-management/services/devices/bp2/bp2.history-sequencer.d.ts.map +1 -1
  417. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-command-writer.d.ts +6 -1
  418. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-command-writer.d.ts.map +1 -1
  419. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-managed-device.d.ts +23 -3
  420. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-managed-device.d.ts.map +1 -1
  421. package/lib/typescript/module/src/modules/bt-management/services/devices/custom/custom-lepu-sequencer.d.ts +6 -3
  422. package/lib/typescript/module/src/modules/bt-management/services/devices/custom/custom-lepu-sequencer.d.ts.map +1 -1
  423. package/lib/typescript/module/src/modules/bt-management/services/devices/custom/custom.device.d.ts +20 -0
  424. package/lib/typescript/module/src/modules/bt-management/services/devices/custom/custom.device.d.ts.map +1 -1
  425. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.advertisement.d.ts +8 -1
  426. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.advertisement.d.ts.map +1 -1
  427. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.connect-retry.d.ts +12 -0
  428. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.connect-retry.d.ts.map +1 -0
  429. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.delivered-files.d.ts +24 -0
  430. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.delivered-files.d.ts.map +1 -0
  431. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.ecg-transfer.d.ts +40 -5
  432. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.ecg-transfer.d.ts.map +1 -1
  433. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.encryption-handshake.d.ts +20 -0
  434. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.encryption-handshake.d.ts.map +1 -0
  435. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.file-transfer.d.ts +6 -3
  436. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.file-transfer.d.ts.map +1 -1
  437. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.frame-reader.d.ts +3 -1
  438. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.frame-reader.d.ts.map +1 -1
  439. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.identity-gate.d.ts +26 -1
  440. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.identity-gate.d.ts.map +1 -1
  441. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.live-ecg-chunks.d.ts +42 -0
  442. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.live-ecg-chunks.d.ts.map +1 -0
  443. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.pulse-wave-chunks.d.ts +28 -0
  444. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.pulse-wave-chunks.d.ts.map +1 -0
  445. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.pulse-wave.d.ts +16 -0
  446. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.pulse-wave.d.ts.map +1 -0
  447. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.recorder.d.ts +32 -0
  448. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.recorder.d.ts.map +1 -0
  449. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.recording-watch.d.ts +28 -0
  450. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.recording-watch.d.ts.map +1 -0
  451. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.session.d.ts +17 -0
  452. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.session.d.ts.map +1 -0
  453. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.stored-files.d.ts +33 -0
  454. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.stored-files.d.ts.map +1 -0
  455. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.transports.d.ts +4 -0
  456. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.transports.d.ts.map +1 -1
  457. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.waveform.d.ts +9 -0
  458. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.waveform.d.ts.map +1 -0
  459. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.bp-monitors.d.ts.map +1 -1
  460. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.ecg-files.d.ts +1 -1
  461. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.ecg-files.d.ts.map +1 -1
  462. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.d.ts.map +1 -1
  463. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.ecg-recording-status.d.ts +8 -0
  464. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.ecg-recording-status.d.ts.map +1 -0
  465. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.oximeters.d.ts.map +1 -1
  466. package/lib/typescript/module/src/modules/bt-management/services/series-recorder.d.ts +6 -1
  467. package/lib/typescript/module/src/modules/bt-management/services/series-recorder.d.ts.map +1 -1
  468. package/lib/typescript/module/src/modules/bt-management/types/create-device-params.d.ts +7 -1
  469. package/lib/typescript/module/src/modules/bt-management/types/create-device-params.d.ts.map +1 -1
  470. package/lib/typescript/module/src/modules/bt-management/types/custom-lepu-spec.d.ts +42 -1
  471. package/lib/typescript/module/src/modules/bt-management/types/custom-lepu-spec.d.ts.map +1 -1
  472. package/lib/typescript/module/src/modules/bt-management/types/device-connection-event.d.ts +17 -1
  473. package/lib/typescript/module/src/modules/bt-management/types/device-connection-event.d.ts.map +1 -1
  474. package/lib/typescript/module/src/modules/bt-management/types/device-waveform.d.ts +15 -0
  475. package/lib/typescript/module/src/modules/bt-management/types/device-waveform.d.ts.map +1 -0
  476. package/lib/typescript/module/src/modules/bt-management/utils/i-16-from-hex.d.ts +1 -1
  477. package/lib/typescript/module/src/modules/bt-management/utils/i-16-from-hex.d.ts.map +1 -1
  478. package/lib/typescript/module/src/modules/bt-management/utils/le-32-from-hex.d.ts +1 -1
  479. package/lib/typescript/module/src/modules/bt-management/utils/le-32-from-hex.d.ts.map +1 -1
  480. package/lib/typescript/module/src/modules/data-sync/components/apple/apple-health-authorization-provider.d.ts.map +1 -1
  481. package/lib/typescript/module/src/modules/data-sync/components/apple/apple-health-authorization-utils.d.ts +2 -2
  482. package/lib/typescript/module/src/modules/data-sync/components/apple/apple-health-authorization-utils.d.ts.map +1 -1
  483. package/lib/typescript/module/src/modules/data-sync/constants.d.ts +3 -1
  484. package/lib/typescript/module/src/modules/data-sync/constants.d.ts.map +1 -1
  485. package/lib/typescript/module/src/modules/data-sync/hooks/use-listen-changes.d.ts.map +1 -1
  486. package/lib/typescript/module/src/modules/data-sync/services/managers/data-processor.d.ts.map +1 -1
  487. package/lib/typescript/module/src/modules/data-sync/types/apple-health-authorization-provider-props.d.ts +2 -2
  488. package/lib/typescript/module/src/modules/data-sync/types/apple-health-authorization-provider-props.d.ts.map +1 -1
  489. package/lib/typescript/module/src/modules/data-sync/types/apple-health-sync-props.d.ts +4 -7
  490. package/lib/typescript/module/src/modules/data-sync/types/apple-health-sync-props.d.ts.map +1 -1
  491. package/lib/typescript/module/src/modules/data-sync/types/get-data-from-provider-props.d.ts +3 -1
  492. package/lib/typescript/module/src/modules/data-sync/types/get-data-from-provider-props.d.ts.map +1 -1
  493. package/lib/typescript/module/src/modules/data-sync/types/health-authorization-status.d.ts +2 -2
  494. package/lib/typescript/module/src/modules/data-sync/types/health-authorization-status.d.ts.map +1 -1
  495. package/lib/typescript/module/src/modules/data-sync/types/health-sync-keys.d.ts +11 -1
  496. package/lib/typescript/module/src/modules/data-sync/types/health-sync-keys.d.ts.map +1 -1
  497. package/lib/typescript/module/src/modules/data-sync/utils/convert-ecg-samples-to-observation.d.ts +6 -0
  498. package/lib/typescript/module/src/modules/data-sync/utils/convert-ecg-samples-to-observation.d.ts.map +1 -0
  499. package/lib/typescript/module/src/modules/data-sync/utils/convert-generic-health-data.d.ts +1 -1
  500. package/lib/typescript/module/src/modules/data-sync/utils/convert-generic-health-data.d.ts.map +1 -1
  501. package/lib/typescript/module/src/modules/data-sync/utils/convert-samples-to-observation.d.ts.map +1 -1
  502. package/lib/typescript/module/src/modules/data-sync/utils/default-health-coding.d.ts.map +1 -1
  503. package/lib/typescript/module/src/modules/data-sync/utils/get-records-from-health-connect.d.ts +1 -1
  504. package/lib/typescript/module/src/modules/data-sync/utils/get-records-from-health-connect.d.ts.map +1 -1
  505. package/lib/typescript/module/src/modules/data-sync/utils/get-samples-from-health.d.ts +12 -46
  506. package/lib/typescript/module/src/modules/data-sync/utils/get-samples-from-health.d.ts.map +1 -1
  507. package/lib/typescript/module/src/modules/data-sync/utils/get-total-samples-count.d.ts.map +1 -1
  508. package/lib/typescript/module/src/modules/data-sync/utils/health-data-catalog.d.ts.map +1 -1
  509. package/lib/typescript/module/src/modules/data-sync/utils/health-units.d.ts +2 -2
  510. package/lib/typescript/module/src/modules/data-sync/utils/health-units.d.ts.map +1 -1
  511. package/lib/typescript/module/src/modules/data-sync/utils/healthkit-daily-statistics.d.ts +10 -0
  512. package/lib/typescript/module/src/modules/data-sync/utils/healthkit-daily-statistics.d.ts.map +1 -0
  513. package/lib/typescript/module/src/modules/data-sync/utils/healthkit-data-types.d.ts +5 -5
  514. package/lib/typescript/module/src/modules/data-sync/utils/healthkit-data-types.d.ts.map +1 -1
  515. package/lib/typescript/module/src/modules/data-sync/utils/healthkit-query-options.d.ts +7 -0
  516. package/lib/typescript/module/src/modules/data-sync/utils/healthkit-query-options.d.ts.map +1 -0
  517. package/lib/typescript/module/src/modules/data-sync/utils/healthkit-sample-source.d.ts +8 -0
  518. package/lib/typescript/module/src/modules/data-sync/utils/healthkit-sample-source.d.ts.map +1 -0
  519. package/lib/typescript/module/src/modules/data-sync/utils/healthkit-samples.d.ts +30 -0
  520. package/lib/typescript/module/src/modules/data-sync/utils/healthkit-samples.d.ts.map +1 -0
  521. package/lib/typescript/module/src/modules/data-sync/utils/healthkit-series.d.ts +2 -2
  522. package/lib/typescript/module/src/modules/data-sync/utils/healthkit-series.d.ts.map +1 -1
  523. package/lib/typescript/module/src/modules/data-sync/utils/to-core-health-observations.d.ts +1 -0
  524. package/lib/typescript/module/src/modules/data-sync/utils/to-core-health-observations.d.ts.map +1 -1
  525. package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/built-in-devices.d.ts +12 -1
  526. package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/built-in-devices.d.ts.map +1 -1
  527. package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/legacy-driver.d.ts +2 -1
  528. package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/legacy-driver.d.ts.map +1 -1
  529. package/lib/typescript/module/src/modules/next/bluetooth/connections.d.ts +13 -1
  530. package/lib/typescript/module/src/modules/next/bluetooth/connections.d.ts.map +1 -1
  531. package/lib/typescript/module/src/modules/next/bluetooth/driver.d.ts +20 -0
  532. package/lib/typescript/module/src/modules/next/bluetooth/driver.d.ts.map +1 -1
  533. package/lib/typescript/module/src/modules/next/bluetooth/errors.d.ts +1 -1
  534. package/lib/typescript/module/src/modules/next/bluetooth/errors.d.ts.map +1 -1
  535. package/lib/typescript/module/src/modules/next/bluetooth/index.d.ts +2 -1
  536. package/lib/typescript/module/src/modules/next/bluetooth/index.d.ts.map +1 -1
  537. package/lib/typescript/module/src/modules/next/bluetooth/readings.d.ts +3 -2
  538. package/lib/typescript/module/src/modules/next/bluetooth/readings.d.ts.map +1 -1
  539. package/lib/typescript/module/src/modules/next/bluetooth/runtime.d.ts +19 -1
  540. package/lib/typescript/module/src/modules/next/bluetooth/runtime.d.ts.map +1 -1
  541. package/lib/typescript/module/src/modules/next/bluetooth/snapshot.d.ts +33 -1
  542. package/lib/typescript/module/src/modules/next/bluetooth/snapshot.d.ts.map +1 -1
  543. package/lib/typescript/module/src/modules/next/bluetooth/web/index.d.ts +1 -0
  544. package/lib/typescript/module/src/modules/next/bluetooth/web/index.d.ts.map +1 -1
  545. package/package.json +8 -3
@@ -1,16 +1,41 @@
1
1
  "use strict";
2
2
 
3
+ /* eslint-disable max-lines */
3
4
  import { getClockParts, isClockSyncEnabled } from "../../../types/clock-sync.js";
4
5
  import { LepuCommand } from "./lepu.commands.js";
5
- import { LepuFileTransfer } from "./lepu.file-transfer.js";
6
+ import { LEPU_CONNECT_REPLY_TIMEOUT_MS, LepuConnectRetry } from "./lepu.connect-retry.js";
6
7
  import { lepuCommandOf } from "./lepu.frame.js";
7
8
  import { LepuIdentityGate } from "./lepu.identity-gate.js";
8
9
  import { describeLepuResponseType, isLepuSuccess } from "./lepu.response-type.js";
9
- /** Identifies a recorder, sets its local clock, then downloads its stored files. */
10
+ import { LepuStoredFiles } from "./lepu.stored-files.js";
11
+ /** How long past its delay a poll may go unanswered before it is sent again. */
12
+ const POLL_ANSWER_GRACE_MS = 1_000;
13
+
14
+ /** Lets a device finish writing a record before its file list is read. */
15
+ const FILE_LIST_DELAY_MS = 3_000;
16
+ const hexOf = opcode => `0x${(opcode ?? 0).toString(16).padStart(2, "0")}`;
17
+
18
+ /**
19
+ * Identifies a recorder, sets its local clock, then polls it live. Its stored files are only
20
+ * listed on connect: they are read when the app asks (`takeHistorySync`), and a record the
21
+ * device stores while connected is read as it is saved. A device that does not poll reads its
22
+ * files on connect, as nothing else would ever ask for them.
23
+ */
10
24
  class LepuEcgTransferSequencer {
11
25
  phase = "identity";
26
+ clockRetry = new LepuConnectRetry();
12
27
  constructor(params) {
13
28
  this.params = params;
29
+ this.storedFiles = new LepuStoredFiles({
30
+ write: params.write,
31
+ builder: params.builder,
32
+ onFile: params.onFile,
33
+ onError: params.onError,
34
+ skipFiles: params.skipFiles,
35
+ deliveredFiles: params.deliveredFiles,
36
+ acceptFile: params.acceptFile,
37
+ onProgress: params.onProgress
38
+ });
14
39
  this.identity = new LepuIdentityGate({
15
40
  write: params.write,
16
41
  builder: params.builder,
@@ -19,11 +44,51 @@ class LepuEcgTransferSequencer {
19
44
  rejectEncryptionAtBytes: params.rejectEncryptionAtBytes,
20
45
  onIdentified: params.onIdentified,
21
46
  onRefused: params.onRefused,
22
- onAdmitted: this.startClockOrTransfer
47
+ onAdmitted: this.startClockOrFiles
23
48
  });
24
49
  }
25
50
  initialCommands = () => this.identity.initialCommands();
26
51
  isHistoryTransfer = () => true;
52
+ commandTimeoutMs = () => {
53
+ if (this.phase === "identity") {
54
+ return this.identity.commandTimeoutMs();
55
+ }
56
+ if (this.phase === "polling" && this.params.pollIntervalMs !== undefined) {
57
+ return this.params.pollIntervalMs + POLL_ANSWER_GRACE_MS;
58
+ }
59
+ if (this.phase === "requested") {
60
+ return LEPU_CONNECT_REPLY_TIMEOUT_MS;
61
+ }
62
+ return this.phase === "clock" ? LEPU_CONNECT_REPLY_TIMEOUT_MS : undefined;
63
+ };
64
+
65
+ /** An unanswered clock is sent once more, then skipped; nothing after it needs it. */
66
+ onCommandTimeout = () => {
67
+ if (this.phase === "identity") {
68
+ return this.identity.onCommandTimeout();
69
+ }
70
+ if (this.phase === "requested") {
71
+ this.params.onError(`the device did not answer command ${hexOf(this.requestedCommand)}`);
72
+ }
73
+ if (this.phase === "polling" || this.phase === "requested") {
74
+ return {
75
+ commands: this.resumePolling()
76
+ };
77
+ }
78
+ if (this.phase !== "clock") {
79
+ return {};
80
+ }
81
+ return {
82
+ commands: this.clockRetry.mayRetry() ? [this.setTimeCommand()] : this.startFiles()
83
+ };
84
+ };
85
+ commandProgress = frame => {
86
+ if (this.phase === "identity") {
87
+ return this.identity.commandProgress(frame);
88
+ }
89
+ const awaited = this.phase === "clock" ? LepuCommand.SET_TIME : this.phase === "polling" ? this.params.pollCommand : this.phase === "requested" ? this.requestedCommand : undefined;
90
+ return awaited !== undefined && lepuCommandOf(frame) !== awaited ? "ignored" : "complete";
91
+ };
27
92
  nextCommand = frame => {
28
93
  if (this.phase === "identity") {
29
94
  return this.identity.nextCommand(frame);
@@ -35,20 +100,60 @@ class LepuEcgTransferSequencer {
35
100
  if (this.params.pollCommand === undefined || lepuCommandOf(frame) !== this.params.pollCommand) {
36
101
  return undefined;
37
102
  }
38
- return this.startTransfer(3_000);
103
+ return this.afterPollAnswer(frame);
104
+ }
105
+ if (this.phase === "requested") {
106
+ return this.finishRequested(frame);
39
107
  }
40
108
  return this.transfer?.nextCommand(frame);
41
109
  };
42
- startClockOrTransfer = () => {
110
+ afterPollAnswer = frame => {
111
+ const stored = this.params.shouldStartTransfer?.(frame) ?? true;
112
+ const delayBeforeWriteMs = stored ? FILE_LIST_DELAY_MS : undefined;
113
+ if (this.params.takeHistorySync?.()) {
114
+ return this.startTransfer(this.storedFiles.readAll, delayBeforeWriteMs);
115
+ }
116
+ return stored ? this.startTransfer(this.storedFiles.readNew, delayBeforeWriteMs) : this.requestedOrPoll();
117
+ };
118
+ requestedOrPoll = () => {
119
+ const requested = this.params.takeRequestedCommand?.();
120
+ if (requested === undefined) {
121
+ return [this.pollCommand()];
122
+ }
123
+ this.phase = "requested";
124
+ this.requestedCommand = requested;
125
+ return [{
126
+ ...this.params.write,
127
+ frame: this.params.builder.build(requested)
128
+ }];
129
+ };
130
+ finishRequested = frame => {
131
+ if (lepuCommandOf(frame) !== this.requestedCommand) {
132
+ return undefined;
133
+ }
134
+ if (!isLepuSuccess(frame)) {
135
+ this.params.onError(`the device refused command ${hexOf(this.requestedCommand)}: ${describeLepuResponseType(frame)}`);
136
+ }
137
+ return this.resumePolling();
138
+ };
139
+ resumePolling = () => {
140
+ this.phase = "polling";
141
+ this.requestedCommand = undefined;
142
+ return [this.pollCommand()];
143
+ };
144
+ startClockOrFiles = () => {
43
145
  if (isClockSyncEnabled(this.params.clockSync)) {
44
146
  this.phase = "clock";
45
- return [{
46
- ...this.params.write,
47
- frame: this.params.builder.build(LepuCommand.SET_TIME, clockPayload(this.params.clockSync))
48
- }];
147
+ this.clockRetry.started();
148
+ return [this.setTimeCommand()];
49
149
  }
50
- return this.startTransfer();
150
+ return this.startFiles();
51
151
  };
152
+ startFiles = () => this.params.pollCommand === undefined || this.params.takeHistorySync?.() ? this.startTransfer(this.storedFiles.readAll) : this.startTransfer(this.storedFiles.listExisting);
153
+ setTimeCommand = () => ({
154
+ ...this.params.write,
155
+ frame: this.params.builder.build(LepuCommand.SET_TIME, clockPayload(this.params.clockSync))
156
+ });
52
157
  finishClock = frame => {
53
158
  if (lepuCommandOf(frame) !== LepuCommand.SET_TIME) {
54
159
  return undefined;
@@ -56,20 +161,11 @@ class LepuEcgTransferSequencer {
56
161
  if (!isLepuSuccess(frame)) {
57
162
  this.params.onError(`the device refused SET_TIME: ${describeLepuResponseType(frame)}`);
58
163
  }
59
- return this.startTransfer();
164
+ return this.startFiles();
60
165
  };
61
- startTransfer = delayBeforeWriteMs => {
166
+ startTransfer = (files, delayBeforeWriteMs) => {
62
167
  this.phase = "files";
63
- this.transfer = new LepuFileTransfer({
64
- write: this.params.write,
65
- builder: this.params.builder,
66
- onFile: this.params.onFile,
67
- onError: this.params.onError,
68
- skipFiles: this.params.skipFiles,
69
- acceptFile: this.params.acceptFile,
70
- afterTransfer: this.finishTransfer,
71
- onProgress: this.params.onProgress
72
- });
168
+ this.transfer = files(this.finishTransfer);
73
169
  return this.transfer.initialCommands(delayBeforeWriteMs);
74
170
  };
75
171
  finishTransfer = () => {
@@ -78,15 +174,18 @@ class LepuEcgTransferSequencer {
78
174
  this.phase = "polling";
79
175
  return [this.pollCommand()];
80
176
  }
81
- return this.params.afterTransfer?.() ?? [];
177
+ return [];
178
+ };
179
+ pollCommand = () => {
180
+ const delayBeforeWriteMs = this.params.pollsOnAnswer?.() ? undefined : this.params.pollIntervalMs;
181
+ return {
182
+ ...this.params.write,
183
+ frame: this.params.builder.build(this.params.pollCommand),
184
+ ...(delayBeforeWriteMs === undefined ? {} : {
185
+ delayBeforeWriteMs
186
+ })
187
+ };
82
188
  };
83
- pollCommand = () => ({
84
- ...this.params.write,
85
- frame: this.params.builder.build(this.params.pollCommand),
86
- ...(this.params.pollIntervalMs === undefined ? {} : {
87
- delayBeforeWriteMs: this.params.pollIntervalMs
88
- })
89
- });
90
189
  }
91
190
  const clockPayload = clockSync => {
92
191
  const parts = getClockParts(clockSync?.now?.() ?? new Date(), clockSync?.timezone);
@@ -1 +1 @@
1
- {"version":3,"names":["getClockParts","isClockSyncEnabled","LepuCommand","LepuFileTransfer","lepuCommandOf","LepuIdentityGate","describeLepuResponseType","isLepuSuccess","LepuEcgTransferSequencer","phase","constructor","params","identity","write","builder","expectedDeviceTypes","manufacturerData","rejectEncryptionAtBytes","onIdentified","onRefused","onAdmitted","startClockOrTransfer","initialCommands","isHistoryTransfer","nextCommand","frame","finishClock","pollCommand","undefined","startTransfer","transfer","clockSync","build","SET_TIME","clockPayload","onError","delayBeforeWriteMs","onFile","skipFiles","acceptFile","afterTransfer","finishTransfer","onProgress","pollIntervalMs","parts","now","Date","timezone","year","month","day","hours","minutes","seconds"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/lepu/lepu.ecg-transfer.ts"],"mappings":";;AAAA,SAEEA,aAAa,EACbC,kBAAkB,QACb,8BAA2B;AAKlC,SAASC,WAAW,QAAQ,oBAAiB;AAE7C,SAAmBC,gBAAgB,QAAQ,yBAAsB;AACjE,SAASC,aAAa,QAAQ,iBAAc;AAC5C,SAASC,gBAAgB,QAAQ,yBAAsB;AACvD,SAASC,wBAAwB,EAAEC,aAAa,QAAQ,yBAAsB;AA2B9E;AACA,MAAMC,wBAAwB,CAA6B;EACjDC,KAAK,GAAyB,UAAU;EAIzCC,WAAWA,CAAkBC,MAA6B,EAAE;IAAA,KAA/BA,MAA6B,GAA7BA,MAA6B;IAC/D,IAAI,CAACC,QAAQ,GAAG,IAAIP,gBAAgB,CAAC;MACnCQ,KAAK,EAAEF,MAAM,CAACE,KAAK;MACnBC,OAAO,EAAEH,MAAM,CAACG,OAAO;MACvBC,mBAAmB,EAAEJ,MAAM,CAACI,mBAAmB;MAC/CC,gBAAgB,EAAEL,MAAM,CAACK,gBAAgB;MACzCC,uBAAuB,EAAEN,MAAM,CAACM,uBAAuB;MACvDC,YAAY,EAAEP,MAAM,CAACO,YAAY;MACjCC,SAAS,EAAER,MAAM,CAACQ,SAAS;MAC3BC,UAAU,EAAE,IAAI,CAACC;IACnB,CAAC,CAAC;EACJ;EAEOC,eAAe,GAAGA,CAAA,KACvB,IAAI,CAACV,QAAQ,CAACU,eAAe,CAAC,CAAC;EAE1BC,iBAAiB,GAAGA,CAAA,KAAe,IAAI;EAEvCC,WAAW,GAChBC,KAAwB,IACiB;IACzC,IAAI,IAAI,CAAChB,KAAK,KAAK,UAAU,EAAE;MAC7B,OAAO,IAAI,CAACG,QAAQ,CAACY,WAAW,CA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,kBAAkB,EAAE,IAAI,CAACzB,MAAM,CAACgC;IAAe,CAAC;EACxD,CAAC,CAAC;AACJ;AAEA,MAAMT,YAAY,GAAIH,SAA4B,IAAe;EAC/D,MAAMa,KAAK,GAAG5C,aAAa,CACzB+B,SAAS,EAAEc,GAAG,GAAG,CAAC,IAAI,IAAIC,IAAI,CAAC,CAAC,EAChCf,SAAS,EAAEgB,QACb,CAAC;EAED,OAAO,CACLH,KAAK,CAACI,IAAI,GAAG,IAAI,EAChBJ,KAAK,CAACI,IAAI,IAAI,CAAC,GAAI,IAAI,EACxBJ,KAAK,CAACK,KAAK,EACXL,KAAK,CAACM,GAAG,EACTN,KAAK,CAACO,KAAK,EACXP,KAAK,CAACQ,OAAO,EACbR,KAAK,CAACS,OAAO,CACd;AACH,CAAC;AAED,SAAS7C,wBAAwB,EAAE0B,YAAY","ignoreList":[]}
1
+ {"version":3,"names":["getClockParts","isClockSyncEnabled","LepuCommand","LEPU_CONNECT_REPLY_TIMEOUT_MS","LepuConnectRetry","lepuCommandOf","LepuIdentityGate","describeLepuResponseType","isLepuSuccess","LepuStoredFiles","POLL_ANSWER_GRACE_MS","FILE_LIST_DELAY_MS","hexOf","opcode","toString","padStart","LepuEcgTransferSequencer","phase","clockRetry","constructor","params","storedFiles","write","builder","onFile","onError","skipFiles","deliveredFiles","acceptFile","onProgress","identity","expectedDeviceTypes","manufacturerData","rejectEncryptionAtBytes","onIdentified","onRefused","onAdmitted","startClockOrFiles","initialCommands","isHistoryTransfer","commandTimeoutMs","pollIntervalMs","undefined","onCommandTimeout","requestedCommand","commands","resumePolling","mayRetry","setTimeCommand","startFiles","commandProgress","frame","awaited","SET_TIME","pollCommand","nextCommand","finishClock","afterPollAnswer","finishRequested","transfer","stored","shouldStartTransfer","delayBeforeWriteMs","takeHistorySync","startTransfer","readAll","readNew","requestedOrPoll","requested","takeRequestedCommand","build","clockSync","started","listExisting","clockPayload","files","finishTransfer","pollsOnAnswer","parts","now","Date","timezone","year","month","day","hours","minutes","seconds"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/lepu/lepu.ecg-transfer.ts"],"mappings":";;AAAA;AACA,SAEEA,aAAa,EACbC,kBAAkB,QACb,8BAA2B;AAQlC,SAASC,WAAW,QAAQ,oBAAiB;AAC7C,SAASC,6BAA6B,EAAEC,gBAAgB,QAAQ,yBAAsB;AAItF,SAASC,aAAa,QAAQ,iBAAc;AAC5C,SAASC,gBAAgB,QAAQ,yBAAsB;AACvD,SAASC,wBAAwB,EAAEC,aAAa,QAAQ,yBAAsB;AAC9E,SAASC,eAAe,QAAQ,wBAAqB;AAgDrD;AACA,MAAMC,oBAAoB,GAAG,KAAK;;AAElC;AACA,MAAMC,kBAAkB,GAAG,KAAK;AAEhC,MAAMC,KAAK,GAAIC,MAA0B,IACvC,KAAK,CAACA,MAAM,IAAI,CAAC,EAAEC,QAAQ,CAAC,EAAE,CAAC,CAACC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE;;AAEpD;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,wBAAwB,CAA6B;EACjDC,KAAK,GAAyB,UAAU;EAC/BC,UAAU,GAAG,IAAId,gBAAgB,CAAC,CAAC;EAM7Ce,WAAWA,CAAkBC,MAA6B,EAAE;IAAA,KAA/BA,MAA6B,GAA7BA,MAA6B;IAC/D,IAAI,CAACC,WAAW,GAAG,IAAIZ,eAAe,CAAC;MACrCa,KAAK,EAAEF,MAAM,CAACE,KAAK;MACnBC,OAAO,EAAEH,MAAM,CAACG,OAAO;MACvBC,MAAM,EAAEJ,MAAM,CAACI,MAAM;MACrBC,OAAO,EAAEL,MAAM,CAACK,OAAO;MACvBC,SAAS,EAAEN,MAAM,CAACM,SAAS;MAC3BC,cAAc,EAAEP,MAAM,CAACO,cAAc;MACrCC,UAAU,EAAER,MAAM,CAACQ,UAAU;MAC7BC,UAAU,EAAET,MAAM,CAACS;IACrB,CAAC,CAAC;IACF,IAAI,CAACC,QAAQ,GAAG,IAAI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;IAEA,OAAO,EAAE;EACX,CAAC;EAEOA,WAAW,GAAGA,CAAA,KAAqB;IACzC,MAAMQ,kBAAkB,GAAG,IAAI,CAAC1C,MAAM,CAACyD,aAAa,GAAG,CAAC,GAAGnC,SAAS,GAAG,IAAI,CAACtB,MAAM,CAACqB,cAAc;IAEjG,OAAO;MACL,GAAG,IAAI,CAACrB,MAAM,CAACE,KAAK;MACpB6B,KAAK,EAAE,IAAI,CAAC/B,MAAM,CAACG,OAAO,CAAC+C,KAAK,CAAC,IAAI,CAAClD,MAAM,CAACkC,WAAY,CAAC;MAC1D,IAAIQ,kBAAkB,KAAKpB,SAAS,GAAG,CAAC,CAAC,GAAG;QAAEoB;MAAmB,CAAC;IACpE,CAAC;EACH,CAAC;AACH;AAEA,MAAMY,YAAY,GAAIH,SAA4B,IAAe;EAC/D,MAAMO,KAAK,GAAG9E,aAAa,CACzBuE,SAAS,EAAEQ,GAAG,GAAG,CAAC,IAAI,IAAIC,IAAI,CAAC,CAAC,EAChCT,SAAS,EAAEU,QACb,CAAC;EAED,OAAO,CACLH,KAAK,CAACI,IAAI,GAAG,IAAI,EAChBJ,KAAK,CAACI,IAAI,IAAI,CAAC,GAAI,IAAI,EACxBJ,KAAK,CAACK,KAAK,EACXL,KAAK,CAACM,GAAG,EACTN,KAAK,CAACO,KAAK,EACXP,KAAK,CAACQ,OAAO,EACbR,KAAK,CAACS,OAAO,CACd;AACH,CAAC;AAED,SAASvE,wBAAwB,EAAE0D,YAAY","ignoreList":[]}
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+
3
+ import { hexToByte } from "../../../utils/hex-to-byte.js";
4
+ import { createLepuAccessToken, decryptLepuHandshake, parseLepuSessionKey } from "../viatom/viatom-lepu-crypto.js";
5
+ import { advertisesLepuEncryption } from "./lepu.advertisement.js";
6
+ import { LepuCommandBuilder } from "./lepu.command-builder.js";
7
+ import { LEPU_CONNECT_REPLY_TIMEOUT_MS, LepuConnectRetry } from "./lepu.connect-retry.js";
8
+ import { lepuCommandOf, lepuPayloadOf } from "./lepu.frame.js";
9
+ import { isLepuSuccess } from "./lepu.response-type.js";
10
+ const LEPU_ENCRYPT_COMMAND = 0xff;
11
+ /**
12
+ * Runs the vendor's encryption handshake before a standard Lepu exchange, when the
13
+ * advertisement asks for one.
14
+ *
15
+ * The access token goes out in plain text; the reply carries the session key, and from then
16
+ * on every request is encrypted here and every reply is decrypted by the frame reader that
17
+ * shares the session. Without the flag the exchange runs exactly as it did before.
18
+ */
19
+ class LepuEncryptionHandshake {
20
+ state = "awaiting-key";
21
+ retry = new LepuConnectRetry();
22
+ constructor(inner, params) {
23
+ this.inner = inner;
24
+ this.params = params;
25
+ }
26
+ initialCommands = () => {
27
+ this.retry.started();
28
+ return [this.tokenCommand()];
29
+ };
30
+ nextCommand = (frame, characteristicUuid) => {
31
+ if (this.state === "done") {
32
+ return this.encrypted(this.inner.nextCommand(frame, characteristicUuid));
33
+ }
34
+ if (this.state === "refused" || lepuCommandOf(frame) !== LEPU_ENCRYPT_COMMAND) {
35
+ return undefined;
36
+ }
37
+ return this.acceptKey(frame);
38
+ };
39
+ commandTimeoutMs = () => this.state === "awaiting-key" ? LEPU_CONNECT_REPLY_TIMEOUT_MS : this.state === "done" ? this.inner.commandTimeoutMs?.() : undefined;
40
+
41
+ /** A device just woken can drop the token, so it is sent once more before giving up. */
42
+ onCommandTimeout = () => {
43
+ if (this.state === "done") {
44
+ const result = this.inner.onCommandTimeout?.() ?? {};
45
+ return {
46
+ ...result,
47
+ commands: this.encrypted(result.commands)
48
+ };
49
+ }
50
+ if (this.state === "refused") {
51
+ return {};
52
+ }
53
+ return this.retry.mayRetry() ? {
54
+ commands: [this.tokenCommand()]
55
+ } : {
56
+ terminal: true
57
+ };
58
+ };
59
+ commandProgress = frame => {
60
+ if (this.state === "done") {
61
+ return this.inner.commandProgress?.(frame) ?? "complete";
62
+ }
63
+ return lepuCommandOf(frame) === LEPU_ENCRYPT_COMMAND ? "complete" : "ignored";
64
+ };
65
+ onServicesDiscovered = serviceUuids => this.inner.onServicesDiscovered?.(serviceUuids);
66
+ isNormalDisconnect = () => this.inner.isNormalDisconnect?.() ?? false;
67
+ isHistoryTransfer = () => this.inner.isHistoryTransfer?.() ?? false;
68
+ acceptKey = frame => {
69
+ const reply = lepuPayloadOf(frame).map(hexToByte);
70
+ const key = isLepuSuccess(frame) ? parseLepuSessionKey(decryptLepuHandshake(reply)) : undefined;
71
+ if (!key) {
72
+ this.state = "refused";
73
+ this.params.onRefused("the device refused the encryption handshake");
74
+ return undefined;
75
+ }
76
+ this.params.session.begin(key);
77
+ this.state = "done";
78
+ return this.encrypted(this.inner.initialCommands());
79
+ };
80
+ tokenCommand = () => ({
81
+ ...this.params.write,
82
+ frame: new LepuCommandBuilder(this.params.startByte).build(LEPU_ENCRYPT_COMMAND, createLepuAccessToken())
83
+ });
84
+ encrypted = commands => commands?.map(command => ({
85
+ ...command,
86
+ frame: this.params.session.encryptFrame(command.frame)
87
+ }));
88
+ }
89
+
90
+ /**
91
+ * The sequencer for one connection: wrapped in the handshake when the advertisement asks
92
+ * for encryption, unchanged otherwise. Either way the session starts without a key.
93
+ */
94
+ const withLepuEncryption = (inner, params) => {
95
+ params.session.end();
96
+ return advertisesLepuEncryption(params.manufacturerData) ? new LepuEncryptionHandshake(inner, params) : inner;
97
+ };
98
+ export { withLepuEncryption };
99
+ //# sourceMappingURL=lepu.encryption-handshake.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["hexToByte","createLepuAccessToken","decryptLepuHandshake","parseLepuSessionKey","advertisesLepuEncryption","LepuCommandBuilder","LEPU_CONNECT_REPLY_TIMEOUT_MS","LepuConnectRetry","lepuCommandOf","lepuPayloadOf","isLepuSuccess","LEPU_ENCRYPT_COMMAND","LepuEncryptionHandshake","state","retry","constructor","inner","params","initialCommands","started","tokenCommand","nextCommand","frame","characteristicUuid","encrypted","undefined","acceptKey","commandTimeoutMs","onCommandTimeout","result","commands","mayRetry","terminal","commandProgress","onServicesDiscovered","serviceUuids","isNormalDisconnect","isHistoryTransfer","reply","map","key","onRefused","session","begin","write","startByte","build","command","encryptFrame","withLepuEncryption","end","manufacturerData"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/lepu/lepu.encryption-handshake.ts"],"mappings":";;AAKA,SAASA,SAAS,QAAQ,+BAA4B;AACtD,SACEC,qBAAqB,EACrBC,oBAAoB,EACpBC,mBAAmB,QACd,iCAA8B;AAErC,SAASC,wBAAwB,QAAQ,yBAAsB;AAC/D,SAASC,kBAAkB,QAAQ,2BAAwB;AAC3D,SAASC,6BAA6B,EAAEC,gBAAgB,QAAQ,yBAAsB;AACtF,SAASC,aAAa,EAAEC,aAAa,QAAQ,iBAAc;AAC3D,SAASC,aAAa,QAAQ,yBAAsB;AAGpD,MAAMC,oBAAoB,GAAG,IAAI;AAgBjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,uBAAuB,CAA6B;EAChDC,KAAK,GAAmB,cAAc;EAC7BC,KAAK,GAAG,IAAIP,gBAAgB,CAAC,CAAC;EAExCQ,WAAWA,CACCC,KAA2B,EAC3BC,MAA4B,EAC7C;IAAA,KAFiBD,KAA2B,GAA3BA,KAA2B;IAAA,KAC3BC,MAA4B,GAA5BA,MAA4B;EAC5C;EAEIC,eAAe,GAAGA,CAAA,KAAgC;IACvD,IAAI,CAACJ,KAAK,CAACK,OAAO,CAAC,CAAC;IAEpB,OAAO,CAAC,IAAI,CAACC,YAAY,CAAC,CAAC,CAAC;EAC9B,CAAC;EAEMC,WAAW,GAAGA,CACnBC,KAAwB,EACxBC,kBAA2B,KACc;IACzC,IAAI,IAAI,CAACV,KAAK,KAAK,MAAM,EAAE;MACzB,OAAO,IAAI,CAACW,SAAS,CAAC,IAAI,CAACR,KAAK,CAACK,WAAW,CAACC,KAAK,EAAEC,kBAAkB,CAAC,CAAC;IAC1E;IAEA,IAAI,IAAI,CAACV,KAAK,KAAK,SAAS,IAAIL,aAAa,CAACc,KAAK,CAAC,K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2B,kBAAkB,GAAGA,CACzBjC,KAA2B,EAC3BC,MAA4B,KACP;EACrBA,MAAM,CAACyB,OAAO,CAACQ,GAAG,CAAC,CAAC;EAEpB,OAAO9C,wBAAwB,CAACa,MAAM,CAACkC,gBAAgB,CAAC,GACpD,IAAIvC,uBAAuB,CAACI,KAAK,EAAEC,MAAM,CAAC,GAC1CD,KAAK;AACX,CAAC;AAED,SAASiC,kBAAkB","ignoreList":[]}
@@ -2,6 +2,7 @@
2
2
 
3
3
  /* eslint-disable max-lines */
4
4
 
5
+ import { hexToByte } from "../../../utils/hex-to-byte.js";
5
6
  import { le32FromHex } from "../../../utils/le-32-from-hex.js";
6
7
  import { le32ToBytes } from "../../../utils/le-32-to-bytes.js";
7
8
  import { LepuCommand } from "./lepu.commands.js";
@@ -11,11 +12,10 @@ import { describeLepuResponseType, isLepuSuccess } from "./lepu.response-type.js
11
12
  const FILE_SIZE_OFFSET = 0;
12
13
 
13
14
  /**
14
- * A hex-byte array costs far more memory than the file it describes, so the cap sits well
15
- * below what a device could offer. A stored ECG is tens of kilobytes; a length near this one
16
- * is a length to refuse rather than try to hold on a low-memory tablet.
15
+ * A size beyond this is a corrupt length field rather than a recording. A holter ECG takes about
16
+ * a byte per sample at 125 Hz, so this holds about 140 hours.
17
17
  */
18
- const MAX_FILE_BYTES = 262_144;
18
+ const MAX_FILE_BYTES = 64 * 1_024 * 1_024;
19
19
  const TRANSFER_COMMANDS = [LepuCommand.GET_FILE_LIST, LepuCommand.READ_FILE_START, LepuCommand.READ_FILE_DATA, LepuCommand.READ_FILE_END];
20
20
 
21
21
  /** A file read from a Lepu device. */
@@ -44,7 +44,8 @@ class LepuFileTransfer {
44
44
  fileIndex = 0;
45
45
  name = "";
46
46
  totalBytes = 0;
47
- content = [];
47
+ bytes = new Uint8Array(0);
48
+ received = 0;
48
49
  isSessionOpen = false;
49
50
  isDone = false;
50
51
  constructor(params) {
@@ -66,6 +67,7 @@ class LepuFileTransfer {
66
67
  if (command === LepuCommand.GET_FILE_LIST) {
67
68
  this.files = lepuNamesFrom(lepuPayloadOf(frame));
68
69
  this.fileIndex = 0;
70
+ this.params.onFileList?.(this.files);
69
71
  return this.openNextFile();
70
72
  }
71
73
  if (command === LepuCommand.READ_FILE_START) {
@@ -88,7 +90,8 @@ class LepuFileTransfer {
88
90
  }
89
91
  this.name = name;
90
92
  this.totalBytes = 0;
91
- this.content = [];
93
+ this.bytes = new Uint8Array(0);
94
+ this.received = 0;
92
95
  return [this.commandFor(LepuCommand.READ_FILE_START, [...lepuNameBytes(name), ...le32ToBytes(0)])];
93
96
  };
94
97
 
@@ -103,6 +106,7 @@ class LepuFileTransfer {
103
106
  if (this.totalBytes === 0) {
104
107
  return this.closeFile();
105
108
  }
109
+ this.bytes = new Uint8Array(this.totalBytes);
106
110
  return [this.commandFor(LepuCommand.READ_FILE_DATA, le32ToBytes(0))];
107
111
  };
108
112
 
@@ -113,28 +117,30 @@ class LepuFileTransfer {
113
117
  */
114
118
  appendChunk = payload => {
115
119
  if (payload.length === 0) {
116
- return this.fail(`"${this.name}" stopped sending at ${this.content.length} of ${this.totalBytes} bytes`);
120
+ return this.fail(`"${this.name}" stopped sending at ${this.received} of ${this.totalBytes} bytes`);
117
121
  }
118
- this.content.push(...payload);
122
+ const fits = payload.slice(0, this.totalBytes - this.received);
123
+ this.bytes.set(fits.map(hexToByte), this.received);
124
+ this.received += fits.length;
119
125
  this.params.onProgress?.({
120
126
  name: this.name,
121
- receivedBytes: this.content.length,
127
+ receivedBytes: this.received,
122
128
  totalBytes: this.totalBytes
123
129
  });
124
- if (this.content.length >= this.totalBytes) {
130
+ if (this.received >= this.totalBytes) {
125
131
  return this.closeFile();
126
132
  }
127
- return [this.commandFor(LepuCommand.READ_FILE_DATA, le32ToBytes(this.content.length))];
133
+ return [this.commandFor(LepuCommand.READ_FILE_DATA, le32ToBytes(this.received))];
128
134
  };
129
135
  closedFile = () => {
130
136
  this.isSessionOpen = false;
131
- if (this.totalBytes > 0 && this.content.length !== this.totalBytes) {
132
- return this.fail(`"${this.name}" ended at ${this.content.length} of ${this.totalBytes} bytes`);
137
+ if (this.totalBytes > 0 && this.received !== this.totalBytes) {
138
+ return this.fail(`"${this.name}" ended at ${this.received} of ${this.totalBytes} bytes`);
133
139
  }
134
140
  if (this.totalBytes > 0) {
135
141
  this.params.onFile({
136
142
  name: this.name,
137
- content: this.content
143
+ bytes: this.bytes
138
144
  });
139
145
  }
140
146
  this.fileIndex++;
@@ -1 +1 @@
1
- {"version":3,"names":["le32FromHex","le32ToBytes","LepuCommand","lepuNameBytes","lepuNamesFrom","lepuCommandOf","lepuPayloadOf","describeLepuResponseType","isLepuSuccess","FILE_SIZE_OFFSET","MAX_FILE_BYTES","TRANSFER_COMMANDS","GET_FILE_LIST","READ_FILE_START","READ_FILE_DATA","READ_FILE_END","LepuFileTransfer","files","fileIndex","name","totalBytes","content","isSessionOpen","isDone","constructor","params","isHistoryTransfer","initialCommands","delayBeforeWriteMs","commandFor","nextCommand","frame","command","afterTransfer","includes","undefined","fail","openNextFile","openedFile","appendChunk","closedFile","skipFiles","has","acceptFile","payload","limit","maxFileBytes","closeFile","length","push","onProgress","receivedBytes","onFile","reason","onError","write","builder","build"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/lepu/lepu.file-transfer.ts"],"mappings":";;AAAA;;AAIA,SAASA,WAAW,QAAQ,kCAA+B;AAC3D,SAASC,WAAW,QAAQ,kCAA+B;AAG3D,SAASC,WAAW,QAAQ,oBAAiB;AAC7C,SAASC,aAAa,EAAEC,aAAa,QAAQ,sBAAmB;AAChE,SAASC,aAAa,EAAEC,aAAa,QAAQ,iBAAc;AAC3D,SAASC,wBAAwB,EAAEC,aAAa,QAAQ,yBAAsB;AAE9E,MAAMC,gBAAgB,GAAG,CAAC;;AAE1B;AACA;AACA;AACA;AACA;AACA,MAAMC,cAAc,GAAG,OAAO;AAE9B,MAAMC,iBAAoC,GAAG,CAC3CT,WAAW,CAACU,aAAa,EACzBV,WA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E,EAC/BhB,kBAA2B,MACR;IACnB,GAAG,IAAI,CAACH,MAAM,CAAC8B,KAAK;IACpBxB,KAAK,EAAE,IAAI,CAACN,MAAM,CAAC+B,OAAO,CAACC,KAAK,CAACzB,OAAO,EAAEY,OAAO,CAAC;IAClD,IAAIhB,kBAAkB,KAAKO,SAAS,GAAG,CAAC,CAAC,GAAG;MAAEP;IAAmB,CAAC;EACpE,CAAC,CAAC;AACJ;AAEA,SAASZ,gBAAgB","ignoreList":[]}
1
+ {"version":3,"names":["hexToByte","le32FromHex","le32ToBytes","LepuCommand","lepuNameBytes","lepuNamesFrom","lepuCommandOf","lepuPayloadOf","describeLepuResponseType","isLepuSuccess","FILE_SIZE_OFFSET","MAX_FILE_BYTES","TRANSFER_COMMANDS","GET_FILE_LIST","READ_FILE_START","READ_FILE_DATA","READ_FILE_END","LepuFileTransfer","files","fileIndex","name","totalBytes","bytes","Uint8Array","received","isSessionOpen","isDone","constructor","params","isHistoryTransfer","initialCommands","delayBeforeWriteMs","commandFor","nextCommand","frame","command","afterTransfer","includes","undefined","fail","onFileList","openNextFile","openedFile","appendChunk","closedFile","skipFiles","has","acceptFile","payload","limit","maxFileBytes","closeFile","length","fits","slice","set","map","onProgress","receivedBytes","onFile","reason","onError","write","builder","build"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/lepu/lepu.file-transfer.ts"],"mappings":";;AAAA;;AAIA,SAASA,SAAS,QAAQ,+BAA4B;AACtD,SAASC,WAAW,QAAQ,kCAA+B;AAC3D,SAASC,WAAW,QAAQ,kCAA+B;AAG3D,SAASC,WAAW,QAAQ,oBAAiB;AAC7C,SAASC,aAAa,EAAEC,aAAa,QAAQ,sBAAmB;AAChE,SAASC,aAAa,EAAEC,aAAa,QAAQ,iBAAc;AAC3D,SAASC,wBAAwB,EAAEC,aAAa,QAAQ,yBAAsB;AAE9E,MAAMC,gBAAgB,GAAG,CAAC;;AAE1B;AACA;AACA;AACA;AACA,MAAMC,cAAc,GAAG,E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,CAAA,KAAgC,CAClD,IAAI,CAACnB,UAAU,CAAC7B,WAAW,CAACa,aAAa,CAAC,CAC3C;;EAED;AACF;AACA;AACA;AACA;AACA;EACUuB,IAAI,GAAIqB,MAAc,IAA2C;IACvE,IAAI,CAAChC,MAAM,CAACiC,OAAO,CAACD,MAAM,CAAC;IAC3B,IAAI,CAAClC,MAAM,GAAG,IAAI;IAElB,IAAI,CAAC,IAAI,CAACD,aAAa,EAAE;MACvB,OAAO,IAAI,CAACG,MAAM,CAACQ,aAAa,GAAG,CAAC;IACtC;IAEA,IAAI,CAACX,aAAa,GAAG,KAAK;IAE1B,OAAO,IAAI,CAAC0B,SAAS,CAAC,CAAC;EACzB,CAAC;EAEOnB,UAAU,GAAGA,CACnBG,OAAe,EACfa,OAA0B,GAAG,EAAE,EAC/BjB,kBAA2B,MACR;IACnB,GAAG,IAAI,CAACH,MAAM,CAACkC,KAAK;IACpB5B,KAAK,EAAE,IAAI,CAACN,MAAM,CAACmC,OAAO,CAACC,KAAK,CAAC7B,OAAO,EAAEa,OAAO,CAAC;IAClD,IAAIjB,kBAAkB,KAAKO,SAAS,GAAG,CAAC,CAAC,GAAG;MAAEP;IAAmB,CAAC;EACpE,CAAC,CAAC;AACJ;AAEA,SAASd,gBAAgB","ignoreList":[]}
@@ -27,8 +27,9 @@ const START_PATTERN_BYTES = 3;
27
27
  * protocol, which is why it is worth having once rather than once per device.
28
28
  */
29
29
  export class LepuFrameReader {
30
- constructor(startBytes) {
30
+ constructor(startBytes, session) {
31
31
  this.startBytes = startBytes;
32
+ this.session = session;
32
33
  }
33
34
  readFrame(buffer) {
34
35
  const start = this.findFrameStart(buffer);
@@ -44,7 +45,8 @@ export class LepuFrameReader {
44
45
  if (!this.hasValidChecksum(frame)) {
45
46
  return corrupt(start + START_PATTERN_BYTES);
46
47
  }
47
- return complete(frame, start + frameLength);
48
+ const plainFrame = this.session ? this.session.decryptFrame(frame) : frame;
49
+ return plainFrame ? complete(plainFrame, start + frameLength) : corrupt(start + frameLength);
48
50
  }
49
51
  isFrameStart(buffer, index) {
50
52
  if (!this.startBytes.includes((buffer[index] || "").toLowerCase())) {
@@ -1 +1 @@
1
- {"version":3,"names":["calculateCrc8","complete","corrupt","incomplete","hexToByte","le16FromHex","COMMAND_INDEX","COMMAND_COMPLEMENT_INDEX","PAYLOAD_LENGTH_INDEX","HEADER_BYTES","CHECKSUM_BYTES","BYTE_MASK","START_PATTERN_BYTES","LepuFrameReader","constructor","startBytes","readFrame","buffer","start","findFrameStart","droppableLeadingBytes","payloadLength","frameLength","length","frame","slice","hasValidChecksum","isFrameStart","index","includes","toLowerCase","command","complement","lastCandidate","Math","max","checksummedBytes","declared"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/lepu/lepu.frame-reader.ts"],"mappings":";;AAEA,SAASA,aAAa,QAAQ,mCAAgC;AAC9D,SAASC,QAAQ,EAAEC,OAAO,EAAEC,UAAU,QAAQ,sCAAmC;AACjF,SAASC,SAAS,QAAQ,+BAA4B;AACtD,SAASC,WAAW,QAAQ,kCAA+B;AAE3D,MAAMC,aAAa,GAAG,CAAC;AACvB,MAAMC,wBAAwB,GAAG,CAAC;AAClC,MAAMC,oBAAoB,GAAG,CAAC;AAC9B,MAAMC,YAAY,GAAG,CAAC;AACtB,MAAMC,cAAc,GAAG,CAAC;AACxB,MAAMC,SAAS,GAAG,IAAI;;AAEtB;AACA,MAAMC,mBAAmB,GAAG,CAAC;;AAE7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,eAAe,CAAwB;EAC3CC,WAAWA,CAAkBC,UAA6B,EAAE;IAAA,KAA/BA,UAA6B,GAA7BA,UAA6B;EAAG;EAE7DC,SAASA,CAACC,MAAyB,EAAmB;IAC3D,MAAMC,KAAK,GAAG,IAAI,CAACC,cAAc,CAACF,MAAM,CAAC;IAEzC,IAAIC,KAAK,KAAK,CAAC,CAAC,EAAE;MAChB,OAAOf,UAAU,CA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,EAAEL,KAAK,EAAE,EAAE;MACnD,IAAI,IAAI,CAACD,YAAY,CAACV,MAAM,EAAEW,KAAK,CAAC,EAAE;QACpC,OAAOA,KAAK;MACd;IACF;IAEA,OAAO,CAAC,CAAC;EACX;;EAEA;AACF;AACA;AACA;EACUR,qBAAqBA,CAACH,MAAyB,EAAU;IAC/D,OAAOiB,IAAI,CAACC,GAAG,CAAC,CAAC,EAAElB,MAAM,CAACM,MAAM,IAAIX,mBAAmB,GAAG,CAAC,CAAC,CAAC;EAC/D;EAEQc,gBAAgBA,CAACF,KAAe,EAAW;IACjD,MAAMY,gBAAgB,GAAGZ,KAAK,CAACD,MAAM,GAAGb,cAAc;IACtD,MAAM2B,QAAQ,GAAGjC,SAAS,CAACoB,KAAK,CAACY,gBAAgB,CAAC,IAAI,GAAG,CAAC;IAE1D,OAAOC,QAAQ,KAAKrC,aAAa,CAACwB,KAAK,EAAEY,gBAAgB,CAAC;EAC5D;AACF","ignoreList":[]}
1
+ {"version":3,"names":["calculateCrc8","complete","corrupt","incomplete","hexToByte","le16FromHex","COMMAND_INDEX","COMMAND_COMPLEMENT_INDEX","PAYLOAD_LENGTH_INDEX","HEADER_BYTES","CHECKSUM_BYTES","BYTE_MASK","START_PATTERN_BYTES","LepuFrameReader","constructor","startBytes","session","readFrame","buffer","start","findFrameStart","droppableLeadingBytes","payloadLength","frameLength","length","frame","slice","hasValidChecksum","plainFrame","decryptFrame","isFrameStart","index","includes","toLowerCase","command","complement","lastCandidate","Math","max","checksummedBytes","declared"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/lepu/lepu.frame-reader.ts"],"mappings":";;AAEA,SAASA,aAAa,QAAQ,mCAAgC;AAC9D,SAASC,QAAQ,EAAEC,OAAO,EAAEC,UAAU,QAAQ,sCAAmC;AACjF,SAASC,SAAS,QAAQ,+BAA4B;AACtD,SAASC,WAAW,QAAQ,kCAA+B;AAI3D,MAAMC,aAAa,GAAG,CAAC;AACvB,MAAMC,wBAAwB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