@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
@@ -6,15 +6,41 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.clockPayload = exports.LepuEcgTransferSequencer = void 0;
7
7
  var _clockSync = require("../../../types/clock-sync.js");
8
8
  var _lepuCommands = require("./lepu.commands.js");
9
- var _lepuFileTransfer = require("./lepu.file-transfer.js");
9
+ var _lepuConnectRetry = require("./lepu.connect-retry.js");
10
10
  var _lepuFrame = require("./lepu.frame.js");
11
11
  var _lepuIdentityGate = require("./lepu.identity-gate.js");
12
12
  var _lepuResponseType = require("./lepu.response-type.js");
13
- /** Identifies a recorder, sets its local clock, then downloads its stored files. */
13
+ var _lepuStoredFiles = require("./lepu.stored-files.js");
14
+ /* eslint-disable max-lines */
15
+
16
+ /** How long past its delay a poll may go unanswered before it is sent again. */
17
+ const POLL_ANSWER_GRACE_MS = 1_000;
18
+
19
+ /** Lets a device finish writing a record before its file list is read. */
20
+ const FILE_LIST_DELAY_MS = 3_000;
21
+ const hexOf = opcode => `0x${(opcode ?? 0).toString(16).padStart(2, "0")}`;
22
+
23
+ /**
24
+ * Identifies a recorder, sets its local clock, then polls it live. Its stored files are only
25
+ * listed on connect: they are read when the app asks (`takeHistorySync`), and a record the
26
+ * device stores while connected is read as it is saved. A device that does not poll reads its
27
+ * files on connect, as nothing else would ever ask for them.
28
+ */
14
29
  class LepuEcgTransferSequencer {
15
30
  phase = "identity";
31
+ clockRetry = new _lepuConnectRetry.LepuConnectRetry();
16
32
  constructor(params) {
17
33
  this.params = params;
34
+ this.storedFiles = new _lepuStoredFiles.LepuStoredFiles({
35
+ write: params.write,
36
+ builder: params.builder,
37
+ onFile: params.onFile,
38
+ onError: params.onError,
39
+ skipFiles: params.skipFiles,
40
+ deliveredFiles: params.deliveredFiles,
41
+ acceptFile: params.acceptFile,
42
+ onProgress: params.onProgress
43
+ });
18
44
  this.identity = new _lepuIdentityGate.LepuIdentityGate({
19
45
  write: params.write,
20
46
  builder: params.builder,
@@ -23,11 +49,51 @@ class LepuEcgTransferSequencer {
23
49
  rejectEncryptionAtBytes: params.rejectEncryptionAtBytes,
24
50
  onIdentified: params.onIdentified,
25
51
  onRefused: params.onRefused,
26
- onAdmitted: this.startClockOrTransfer
52
+ onAdmitted: this.startClockOrFiles
27
53
  });
28
54
  }
29
55
  initialCommands = () => this.identity.initialCommands();
30
56
  isHistoryTransfer = () => true;
57
+ commandTimeoutMs = () => {
58
+ if (this.phase === "identity") {
59
+ return this.identity.commandTimeoutMs();
60
+ }
61
+ if (this.phase === "polling" && this.params.pollIntervalMs !== undefined) {
62
+ return this.params.pollIntervalMs + POLL_ANSWER_GRACE_MS;
63
+ }
64
+ if (this.phase === "requested") {
65
+ return _lepuConnectRetry.LEPU_CONNECT_REPLY_TIMEOUT_MS;
66
+ }
67
+ return this.phase === "clock" ? _lepuConnectRetry.LEPU_CONNECT_REPLY_TIMEOUT_MS : undefined;
68
+ };
69
+
70
+ /** An unanswered clock is sent once more, then skipped; nothing after it needs it. */
71
+ onCommandTimeout = () => {
72
+ if (this.phase === "identity") {
73
+ return this.identity.onCommandTimeout();
74
+ }
75
+ if (this.phase === "requested") {
76
+ this.params.onError(`the device did not answer command ${hexOf(this.requestedCommand)}`);
77
+ }
78
+ if (this.phase === "polling" || this.phase === "requested") {
79
+ return {
80
+ commands: this.resumePolling()
81
+ };
82
+ }
83
+ if (this.phase !== "clock") {
84
+ return {};
85
+ }
86
+ return {
87
+ commands: this.clockRetry.mayRetry() ? [this.setTimeCommand()] : this.startFiles()
88
+ };
89
+ };
90
+ commandProgress = frame => {
91
+ if (this.phase === "identity") {
92
+ return this.identity.commandProgress(frame);
93
+ }
94
+ const awaited = this.phase === "clock" ? _lepuCommands.LepuCommand.SET_TIME : this.phase === "polling" ? this.params.pollCommand : this.phase === "requested" ? this.requestedCommand : undefined;
95
+ return awaited !== undefined && (0, _lepuFrame.lepuCommandOf)(frame) !== awaited ? "ignored" : "complete";
96
+ };
31
97
  nextCommand = frame => {
32
98
  if (this.phase === "identity") {
33
99
  return this.identity.nextCommand(frame);
@@ -39,20 +105,60 @@ class LepuEcgTransferSequencer {
39
105
  if (this.params.pollCommand === undefined || (0, _lepuFrame.lepuCommandOf)(frame) !== this.params.pollCommand) {
40
106
  return undefined;
41
107
  }
42
- return this.startTransfer(3_000);
108
+ return this.afterPollAnswer(frame);
109
+ }
110
+ if (this.phase === "requested") {
111
+ return this.finishRequested(frame);
43
112
  }
44
113
  return this.transfer?.nextCommand(frame);
45
114
  };
46
- startClockOrTransfer = () => {
115
+ afterPollAnswer = frame => {
116
+ const stored = this.params.shouldStartTransfer?.(frame) ?? true;
117
+ const delayBeforeWriteMs = stored ? FILE_LIST_DELAY_MS : undefined;
118
+ if (this.params.takeHistorySync?.()) {
119
+ return this.startTransfer(this.storedFiles.readAll, delayBeforeWriteMs);
120
+ }
121
+ return stored ? this.startTransfer(this.storedFiles.readNew, delayBeforeWriteMs) : this.requestedOrPoll();
122
+ };
123
+ requestedOrPoll = () => {
124
+ const requested = this.params.takeRequestedCommand?.();
125
+ if (requested === undefined) {
126
+ return [this.pollCommand()];
127
+ }
128
+ this.phase = "requested";
129
+ this.requestedCommand = requested;
130
+ return [{
131
+ ...this.params.write,
132
+ frame: this.params.builder.build(requested)
133
+ }];
134
+ };
135
+ finishRequested = frame => {
136
+ if ((0, _lepuFrame.lepuCommandOf)(frame) !== this.requestedCommand) {
137
+ return undefined;
138
+ }
139
+ if (!(0, _lepuResponseType.isLepuSuccess)(frame)) {
140
+ this.params.onError(`the device refused command ${hexOf(this.requestedCommand)}: ${(0, _lepuResponseType.describeLepuResponseType)(frame)}`);
141
+ }
142
+ return this.resumePolling();
143
+ };
144
+ resumePolling = () => {
145
+ this.phase = "polling";
146
+ this.requestedCommand = undefined;
147
+ return [this.pollCommand()];
148
+ };
149
+ startClockOrFiles = () => {
47
150
  if ((0, _clockSync.isClockSyncEnabled)(this.params.clockSync)) {
48
151
  this.phase = "clock";
49
- return [{
50
- ...this.params.write,
51
- frame: this.params.builder.build(_lepuCommands.LepuCommand.SET_TIME, clockPayload(this.params.clockSync))
52
- }];
152
+ this.clockRetry.started();
153
+ return [this.setTimeCommand()];
53
154
  }
54
- return this.startTransfer();
155
+ return this.startFiles();
55
156
  };
157
+ startFiles = () => this.params.pollCommand === undefined || this.params.takeHistorySync?.() ? this.startTransfer(this.storedFiles.readAll) : this.startTransfer(this.storedFiles.listExisting);
158
+ setTimeCommand = () => ({
159
+ ...this.params.write,
160
+ frame: this.params.builder.build(_lepuCommands.LepuCommand.SET_TIME, clockPayload(this.params.clockSync))
161
+ });
56
162
  finishClock = frame => {
57
163
  if ((0, _lepuFrame.lepuCommandOf)(frame) !== _lepuCommands.LepuCommand.SET_TIME) {
58
164
  return undefined;
@@ -60,20 +166,11 @@ class LepuEcgTransferSequencer {
60
166
  if (!(0, _lepuResponseType.isLepuSuccess)(frame)) {
61
167
  this.params.onError(`the device refused SET_TIME: ${(0, _lepuResponseType.describeLepuResponseType)(frame)}`);
62
168
  }
63
- return this.startTransfer();
169
+ return this.startFiles();
64
170
  };
65
- startTransfer = delayBeforeWriteMs => {
171
+ startTransfer = (files, delayBeforeWriteMs) => {
66
172
  this.phase = "files";
67
- this.transfer = new _lepuFileTransfer.LepuFileTransfer({
68
- write: this.params.write,
69
- builder: this.params.builder,
70
- onFile: this.params.onFile,
71
- onError: this.params.onError,
72
- skipFiles: this.params.skipFiles,
73
- acceptFile: this.params.acceptFile,
74
- afterTransfer: this.finishTransfer,
75
- onProgress: this.params.onProgress
76
- });
173
+ this.transfer = files(this.finishTransfer);
77
174
  return this.transfer.initialCommands(delayBeforeWriteMs);
78
175
  };
79
176
  finishTransfer = () => {
@@ -82,15 +179,18 @@ class LepuEcgTransferSequencer {
82
179
  this.phase = "polling";
83
180
  return [this.pollCommand()];
84
181
  }
85
- return this.params.afterTransfer?.() ?? [];
182
+ return [];
183
+ };
184
+ pollCommand = () => {
185
+ const delayBeforeWriteMs = this.params.pollsOnAnswer?.() ? undefined : this.params.pollIntervalMs;
186
+ return {
187
+ ...this.params.write,
188
+ frame: this.params.builder.build(this.params.pollCommand),
189
+ ...(delayBeforeWriteMs === undefined ? {} : {
190
+ delayBeforeWriteMs
191
+ })
192
+ };
86
193
  };
87
- pollCommand = () => ({
88
- ...this.params.write,
89
- frame: this.params.builder.build(this.params.pollCommand),
90
- ...(this.params.pollIntervalMs === undefined ? {} : {
91
- delayBeforeWriteMs: this.params.pollIntervalMs
92
- })
93
- });
94
194
  }
95
195
  exports.LepuEcgTransferSequencer = LepuEcgTransferSequencer;
96
196
  const clockPayload = clockSync => {
@@ -1 +1 @@
1
- {"version":3,"names":["_clockSync","require","_lepuCommands","_lepuFileTransfer","_lepuFrame","_lepuIdentityGate","_lepuResponseType","LepuEcgTransferSequencer","phase","constructor","params","identity","LepuIdentityGate","write","builder","expectedDeviceTypes","manufacturerData","rejectEncryptionAtBytes","onIdentified","onRefused","onAdmitted","startClockOrTransfer","initialCommands","isHistoryTransfer","nextCommand","frame","finishClock","pollCommand","undefined","lepuCommandOf","startTransfer","transfer","isClockSyncEnabled","clockSync","build","LepuCommand","SET_TIME","clockPayload","isLepuSuccess","onError","describeLepuResponseType","delayBeforeWriteMs","LepuFileTransfer","onFile","skipFiles","acceptFile","afterTransfer","finishTransfer","onProgress","pollIntervalMs","exports","parts","getClockParts","now","Date","timezone","year","month","day","hours","minutes","seconds"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/lepu/lepu.ecg-transfer.ts"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AASA,IAAAC,aAAA,GAAAD,OAAA;AAEA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAJ,OAAA;AACA,IAAAK,iBAAA,GAAAL,OAAA;AA2BA;AACA,MAAMM,wBAAwB,CAA6B;EACjDC,KAAK,GAAyB,UAAU;EAIzCC,WAAWA,CAAkBC,MAA6B,EAAE;IAAA,KAA/BA,MAA6B,GAA7BA,MAA6B;IAC/D,IAAI,CAACC,QAAQ,GAAG,IAAIC,kCAAgB,CAAC;MACnCC,KAAK,EAAEH,MAAM,CAACG,KAAK;MACnBC,OAAO,EAAEJ,MAAM,CAACI,OAAO;MACvBC,mBAAmB,EAAEL,MAAM,CAACK,mBAAmB;MAC/CC,gBAAgB,EAAEN,MAAM,CAACM,gBAAgB;MACzCC,uBAAuB,EAAEP,MAAM,CAACO,uBAAuB;MACvDC,YAAY,EAAER,MAAM,CAACQ,YAAY;MACjCC,SAAS,EAAET,MAAM,CAACS,SAAS;MAC3BC,UAAU,EAAE,IAAI,CAACC;IACnB,CAAC,CAAC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AC;EAEOnB,WAAW,GAAGA,CAAA,MAAsB;IAC1C,GAAG,IAAI,CAACjB,MAAM,CAACG,KAAK;IACpBY,KAAK,EAAE,IAAI,CAACf,MAAM,CAACI,OAAO,CAACoB,KAAK,CAAC,IAAI,CAACxB,MAAM,CAACiB,WAAY,CAAC;IAC1D,IAAI,IAAI,CAACjB,MAAM,CAACuC,cAAc,KAAKrB,SAAS,GACxC,CAAC,CAAC,GACF;MAAEa,kBAAkB,EAAE,IAAI,CAAC/B,MAAM,CAACuC;IAAe,CAAC;EACxD,CAAC,CAAC;AACJ;AAACC,OAAA,CAAA3C,wBAAA,GAAAA,wBAAA;AAED,MAAM8B,YAAY,GAAIJ,SAA4B,IAAe;EAC/D,MAAMkB,KAAK,GAAG,IAAAC,wBAAa,EACzBnB,SAAS,EAAEoB,GAAG,GAAG,CAAC,IAAI,IAAIC,IAAI,CAAC,CAAC,EAChCrB,SAAS,EAAEsB,QACb,CAAC;EAED,OAAO,CACLJ,KAAK,CAACK,IAAI,GAAG,IAAI,EAChBL,KAAK,CAACK,IAAI,IAAI,CAAC,GAAI,IAAI,EACxBL,KAAK,CAACM,KAAK,EACXN,KAAK,CAACO,GAAG,EACTP,KAAK,CAACQ,KAAK,EACXR,KAAK,CAACS,OAAO,EACbT,KAAK,CAACU,OAAO,CACd;AACH,CAAC;AAACX,OAAA,CAAAb,YAAA,GAAAA,YAAA","ignoreList":[]}
1
+ {"version":3,"names":["_clockSync","require","_lepuCommands","_lepuConnectRetry","_lepuFrame","_lepuIdentityGate","_lepuResponseType","_lepuStoredFiles","POLL_ANSWER_GRACE_MS","FILE_LIST_DELAY_MS","hexOf","opcode","toString","padStart","LepuEcgTransferSequencer","phase","clockRetry","LepuConnectRetry","constructor","params","storedFiles","LepuStoredFiles","write","builder","onFile","onError","skipFiles","deliveredFiles","acceptFile","onProgress","identity","LepuIdentityGate","expectedDeviceTypes","manufacturerData","rejectEncryptionAtBytes","onIdentified","onRefused","onAdmitted","startClockOrFiles","initialCommands","isHistoryTransfer","commandTimeoutMs","pollIntervalMs","undefined","LEPU_CONNECT_REPLY_TIMEOUT_MS","onCommandTimeout","requestedCommand","commands","resumePolling","mayRetry","setTimeCommand","startFiles","commandProgress","frame","awaited","LepuCommand","SET_TIME","pollCommand","lepuCommandOf","nextCommand","finishClock","afterPollAnswer","finishRequested","transfer","stored","shouldStartTransfer","delayBeforeWriteMs","takeHistorySync","startTransfer","readAll","readNew","requestedOrPoll","requested","takeRequestedCommand","build","isLepuSuccess","describeLepuResponseType","isClockSyncEnabled","clockSync","started","listExisting","clockPayload","files","finishTransfer","pollsOnAnswer","exports","parts","getClockParts","now","Date","timezone","year","month","day","hours","minutes","seconds"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/lepu/lepu.ecg-transfer.ts"],"mappings":";;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AAYA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AAIA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAJ,OAAA;AACA,IAAAK,iBAAA,GAAAL,OAAA;AACA,IAAAM,gBAAA,GAAAN,OAAA;AArBA;;AAqEA;AACA,MAAMO,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,IAAIC,kCAAgB,CAAC,CAAC;EAM7CC,WAAWA,CAAkBC,MAA6B,EAAE;IAAA,KAA/BA,MAA6B,GAA7BA,MAA6B;IAC/D,IAAI,CAACC,WAAW,GAAG,IAAIC,gCAAe,C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CAACO,GAAG,EACTP,KAAK,CAACQ,KAAK,EACXR,KAAK,CAACS,OAAO,EACbT,KAAK,CAACU,OAAO,CACd;AACH,CAAC;AAACX,OAAA,CAAAJ,YAAA,GAAAA,YAAA","ignoreList":[]}
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.withLepuEncryption = void 0;
7
+ var _hexToByte = require("../../../utils/hex-to-byte.js");
8
+ var _viatomLepuCrypto = require("../viatom/viatom-lepu-crypto.js");
9
+ var _lepuAdvertisement = require("./lepu.advertisement.js");
10
+ var _lepuCommandBuilder = require("./lepu.command-builder.js");
11
+ var _lepuConnectRetry = require("./lepu.connect-retry.js");
12
+ var _lepuFrame = require("./lepu.frame.js");
13
+ var _lepuResponseType = require("./lepu.response-type.js");
14
+ const LEPU_ENCRYPT_COMMAND = 0xff;
15
+ /**
16
+ * Runs the vendor's encryption handshake before a standard Lepu exchange, when the
17
+ * advertisement asks for one.
18
+ *
19
+ * The access token goes out in plain text; the reply carries the session key, and from then
20
+ * on every request is encrypted here and every reply is decrypted by the frame reader that
21
+ * shares the session. Without the flag the exchange runs exactly as it did before.
22
+ */
23
+ class LepuEncryptionHandshake {
24
+ state = "awaiting-key";
25
+ retry = new _lepuConnectRetry.LepuConnectRetry();
26
+ constructor(inner, params) {
27
+ this.inner = inner;
28
+ this.params = params;
29
+ }
30
+ initialCommands = () => {
31
+ this.retry.started();
32
+ return [this.tokenCommand()];
33
+ };
34
+ nextCommand = (frame, characteristicUuid) => {
35
+ if (this.state === "done") {
36
+ return this.encrypted(this.inner.nextCommand(frame, characteristicUuid));
37
+ }
38
+ if (this.state === "refused" || (0, _lepuFrame.lepuCommandOf)(frame) !== LEPU_ENCRYPT_COMMAND) {
39
+ return undefined;
40
+ }
41
+ return this.acceptKey(frame);
42
+ };
43
+ commandTimeoutMs = () => this.state === "awaiting-key" ? _lepuConnectRetry.LEPU_CONNECT_REPLY_TIMEOUT_MS : this.state === "done" ? this.inner.commandTimeoutMs?.() : undefined;
44
+
45
+ /** A device just woken can drop the token, so it is sent once more before giving up. */
46
+ onCommandTimeout = () => {
47
+ if (this.state === "done") {
48
+ const result = this.inner.onCommandTimeout?.() ?? {};
49
+ return {
50
+ ...result,
51
+ commands: this.encrypted(result.commands)
52
+ };
53
+ }
54
+ if (this.state === "refused") {
55
+ return {};
56
+ }
57
+ return this.retry.mayRetry() ? {
58
+ commands: [this.tokenCommand()]
59
+ } : {
60
+ terminal: true
61
+ };
62
+ };
63
+ commandProgress = frame => {
64
+ if (this.state === "done") {
65
+ return this.inner.commandProgress?.(frame) ?? "complete";
66
+ }
67
+ return (0, _lepuFrame.lepuCommandOf)(frame) === LEPU_ENCRYPT_COMMAND ? "complete" : "ignored";
68
+ };
69
+ onServicesDiscovered = serviceUuids => this.inner.onServicesDiscovered?.(serviceUuids);
70
+ isNormalDisconnect = () => this.inner.isNormalDisconnect?.() ?? false;
71
+ isHistoryTransfer = () => this.inner.isHistoryTransfer?.() ?? false;
72
+ acceptKey = frame => {
73
+ const reply = (0, _lepuFrame.lepuPayloadOf)(frame).map(_hexToByte.hexToByte);
74
+ const key = (0, _lepuResponseType.isLepuSuccess)(frame) ? (0, _viatomLepuCrypto.parseLepuSessionKey)((0, _viatomLepuCrypto.decryptLepuHandshake)(reply)) : undefined;
75
+ if (!key) {
76
+ this.state = "refused";
77
+ this.params.onRefused("the device refused the encryption handshake");
78
+ return undefined;
79
+ }
80
+ this.params.session.begin(key);
81
+ this.state = "done";
82
+ return this.encrypted(this.inner.initialCommands());
83
+ };
84
+ tokenCommand = () => ({
85
+ ...this.params.write,
86
+ frame: new _lepuCommandBuilder.LepuCommandBuilder(this.params.startByte).build(LEPU_ENCRYPT_COMMAND, (0, _viatomLepuCrypto.createLepuAccessToken)())
87
+ });
88
+ encrypted = commands => commands?.map(command => ({
89
+ ...command,
90
+ frame: this.params.session.encryptFrame(command.frame)
91
+ }));
92
+ }
93
+
94
+ /**
95
+ * The sequencer for one connection: wrapped in the handshake when the advertisement asks
96
+ * for encryption, unchanged otherwise. Either way the session starts without a key.
97
+ */
98
+ const withLepuEncryption = (inner, params) => {
99
+ params.session.end();
100
+ return (0, _lepuAdvertisement.advertisesLepuEncryption)(params.manufacturerData) ? new LepuEncryptionHandshake(inner, params) : inner;
101
+ };
102
+ exports.withLepuEncryption = withLepuEncryption;
103
+ //# sourceMappingURL=lepu.encryption-handshake.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_hexToByte","require","_viatomLepuCrypto","_lepuAdvertisement","_lepuCommandBuilder","_lepuConnectRetry","_lepuFrame","_lepuResponseType","LEPU_ENCRYPT_COMMAND","LepuEncryptionHandshake","state","retry","LepuConnectRetry","constructor","inner","params","initialCommands","started","tokenCommand","nextCommand","frame","characteristicUuid","encrypted","lepuCommandOf","undefined","acceptKey","commandTimeoutMs","LEPU_CONNECT_REPLY_TIMEOUT_MS","onCommandTimeout","result","commands","mayRetry","terminal","commandProgress","onServicesDiscovered","serviceUuids","isNormalDisconnect","isHistoryTransfer","reply","lepuPayloadOf","map","hexToByte","key","isLepuSuccess","parseLepuSessionKey","decryptLepuHandshake","onRefused","session","begin","write","LepuCommandBuilder","startByte","build","createLepuAccessToken","command","encryptFrame","withLepuEncryption","end","advertisesLepuEncryption","manufacturerData","exports"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/lepu/lepu.encryption-handshake.ts"],"mappings":";;;;;;AAKA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AAMA,IAAAE,kBAAA,GAAAF,OAAA;AACA,IAAAG,mBAAA,GAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,iBAAA,GAAAN,OAAA;AAGA,MAAMO,oBAAoB,GAAG,IAAI;AAgBjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,uBAAuB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E,OAAOtB,SAAS;IAClB;IAEA,IAAI,CAACT,MAAM,CAACgC,OAAO,CAACC,KAAK,CAACN,GAAG,CAAC;IAC9B,IAAI,CAAChC,KAAK,GAAG,MAAM;IAEnB,OAAO,IAAI,CAACY,SAAS,CAAC,IAAI,CAACR,KAAK,CAACE,eAAe,CAAC,CAAC,CAAC;EACrD,CAAC;EAEOE,YAAY,GAAGA,CAAA,MAAsB;IAC3C,GAAG,IAAI,CAACH,MAAM,CAACkC,KAAK;IACpB7B,KAAK,EAAE,IAAI8B,sCAAkB,CAAC,IAAI,CAACnC,MAAM,CAACoC,SAAS,CAAC,CAACC,KAAK,CACxD5C,oBAAoB,EACpB,IAAA6C,uCAAqB,EAAC,CACxB;EACF,CAAC,CAAC;EAEM/B,SAAS,GACfQ,QAA8C,IAE9CA,QAAQ,EAAEU,GAAG,CAAEc,OAAO,KAAM;IAC1B,GAAGA,OAAO;IACVlC,KAAK,EAAE,IAAI,CAACL,MAAM,CAACgC,OAAO,CAACQ,YAAY,CAACD,OAAO,CAAClC,KAAK;EACvD,CAAC,CAAC,CAAC;AACP;;AAEA;AACA;AACA;AACA;AACA,MAAMoC,kBAAkB,GAAGA,CACzB1C,KAA2B,EAC3BC,MAA4B,KACP;EACrBA,MAAM,CAACgC,OAAO,CAACU,GAAG,CAAC,CAAC;EAEpB,OAAO,IAAAC,2CAAwB,EAAC3C,MAAM,CAAC4C,gBAAgB,CAAC,GACpD,IAAIlD,uBAAuB,CAACK,KAAK,EAAEC,MAAM,CAAC,GAC1CD,KAAK;AACX,CAAC;AAAC8C,OAAA,CAAAJ,kBAAA,GAAAA,kBAAA","ignoreList":[]}
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.LepuFileTransfer = void 0;
7
+ var _hexToByte = require("../../../utils/hex-to-byte.js");
7
8
  var _le32FromHex = require("../../../utils/le-32-from-hex.js");
8
9
  var _le32ToBytes = require("../../../utils/le-32-to-bytes.js");
9
10
  var _lepuCommands = require("./lepu.commands.js");
@@ -15,11 +16,10 @@ var _lepuResponseType = require("./lepu.response-type.js");
15
16
  const FILE_SIZE_OFFSET = 0;
16
17
 
17
18
  /**
18
- * A hex-byte array costs far more memory than the file it describes, so the cap sits well
19
- * below what a device could offer. A stored ECG is tens of kilobytes; a length near this one
20
- * is a length to refuse rather than try to hold on a low-memory tablet.
19
+ * A size beyond this is a corrupt length field rather than a recording. A holter ECG takes about
20
+ * a byte per sample at 125 Hz, so this holds about 140 hours.
21
21
  */
22
- const MAX_FILE_BYTES = 262_144;
22
+ const MAX_FILE_BYTES = 64 * 1_024 * 1_024;
23
23
  const TRANSFER_COMMANDS = [_lepuCommands.LepuCommand.GET_FILE_LIST, _lepuCommands.LepuCommand.READ_FILE_START, _lepuCommands.LepuCommand.READ_FILE_DATA, _lepuCommands.LepuCommand.READ_FILE_END];
24
24
 
25
25
  /** A file read from a Lepu device. */
@@ -48,7 +48,8 @@ class LepuFileTransfer {
48
48
  fileIndex = 0;
49
49
  name = "";
50
50
  totalBytes = 0;
51
- content = [];
51
+ bytes = new Uint8Array(0);
52
+ received = 0;
52
53
  isSessionOpen = false;
53
54
  isDone = false;
54
55
  constructor(params) {
@@ -70,6 +71,7 @@ class LepuFileTransfer {
70
71
  if (command === _lepuCommands.LepuCommand.GET_FILE_LIST) {
71
72
  this.files = (0, _lepuFileNames.lepuNamesFrom)((0, _lepuFrame.lepuPayloadOf)(frame));
72
73
  this.fileIndex = 0;
74
+ this.params.onFileList?.(this.files);
73
75
  return this.openNextFile();
74
76
  }
75
77
  if (command === _lepuCommands.LepuCommand.READ_FILE_START) {
@@ -92,7 +94,8 @@ class LepuFileTransfer {
92
94
  }
93
95
  this.name = name;
94
96
  this.totalBytes = 0;
95
- this.content = [];
97
+ this.bytes = new Uint8Array(0);
98
+ this.received = 0;
96
99
  return [this.commandFor(_lepuCommands.LepuCommand.READ_FILE_START, [...(0, _lepuFileNames.lepuNameBytes)(name), ...(0, _le32ToBytes.le32ToBytes)(0)])];
97
100
  };
98
101
 
@@ -107,6 +110,7 @@ class LepuFileTransfer {
107
110
  if (this.totalBytes === 0) {
108
111
  return this.closeFile();
109
112
  }
113
+ this.bytes = new Uint8Array(this.totalBytes);
110
114
  return [this.commandFor(_lepuCommands.LepuCommand.READ_FILE_DATA, (0, _le32ToBytes.le32ToBytes)(0))];
111
115
  };
112
116
 
@@ -117,28 +121,30 @@ class LepuFileTransfer {
117
121
  */
118
122
  appendChunk = payload => {
119
123
  if (payload.length === 0) {
120
- return this.fail(`"${this.name}" stopped sending at ${this.content.length} of ${this.totalBytes} bytes`);
124
+ return this.fail(`"${this.name}" stopped sending at ${this.received} of ${this.totalBytes} bytes`);
121
125
  }
122
- this.content.push(...payload);
126
+ const fits = payload.slice(0, this.totalBytes - this.received);
127
+ this.bytes.set(fits.map(_hexToByte.hexToByte), this.received);
128
+ this.received += fits.length;
123
129
  this.params.onProgress?.({
124
130
  name: this.name,
125
- receivedBytes: this.content.length,
131
+ receivedBytes: this.received,
126
132
  totalBytes: this.totalBytes
127
133
  });
128
- if (this.content.length >= this.totalBytes) {
134
+ if (this.received >= this.totalBytes) {
129
135
  return this.closeFile();
130
136
  }
131
- return [this.commandFor(_lepuCommands.LepuCommand.READ_FILE_DATA, (0, _le32ToBytes.le32ToBytes)(this.content.length))];
137
+ return [this.commandFor(_lepuCommands.LepuCommand.READ_FILE_DATA, (0, _le32ToBytes.le32ToBytes)(this.received))];
132
138
  };
133
139
  closedFile = () => {
134
140
  this.isSessionOpen = false;
135
- if (this.totalBytes > 0 && this.content.length !== this.totalBytes) {
136
- return this.fail(`"${this.name}" ended at ${this.content.length} of ${this.totalBytes} bytes`);
141
+ if (this.totalBytes > 0 && this.received !== this.totalBytes) {
142
+ return this.fail(`"${this.name}" ended at ${this.received} of ${this.totalBytes} bytes`);
137
143
  }
138
144
  if (this.totalBytes > 0) {
139
145
  this.params.onFile({
140
146
  name: this.name,
141
- content: this.content
147
+ bytes: this.bytes
142
148
  });
143
149
  }
144
150
  this.fileIndex++;
@@ -1 +1 @@
1
- {"version":3,"names":["_le32FromHex","require","_le32ToBytes","_lepuCommands","_lepuFileNames","_lepuFrame","_lepuResponseType","FILE_SIZE_OFFSET","MAX_FILE_BYTES","TRANSFER_COMMANDS","LepuCommand","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","lepuCommandOf","afterTransfer","includes","undefined","isLepuSuccess","fail","describeLepuResponseType","lepuNamesFrom","lepuPayloadOf","openNextFile","openedFile","appendChunk","closedFile","skipFiles","has","acceptFile","lepuNameBytes","le32ToBytes","payload","le32FromHex","limit","maxFileBytes","closeFile","length","push","onProgress","receivedBytes","onFile","reason","onError","write","builder","build","exports"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/lepu/lepu.file-transfer.ts"],"mappings":";;;;;;AAIA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAGA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,iBAAA,GAAAL,OAAA;AAXA;;AAaA,MAAMM,gBAAgB,GAAG,CAAC;;AAE1B;AACA;AACA;AACA;AACA;AACA,MAAMC,cAAc,GAAG,OAAO;AAE9B,MAAMC,iBAAoC,GAAG,CAC3CC,yBAAW,CAACC,aAAa,EACzBD,yBAAW,CAACE,eAAe,EAC3BF,yBAAW,CAACG,cAAc,EAC1BH,yBAAW,CAACI,aAAa,CAC1B;;AAED;;AAUA;;AAmCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,gBAAgB,CAA6B;EACzCC,KAAK,GAAa,EAAE;EACpBC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C;IAClD,IAAIvB,kBAAkB,KAAKQ,SAAS,GAAG,CAAC,CAAC,GAAG;MAAER;IAAmB,CAAC;EACpE,CAAC,CAAC;AACJ;AAACsC,OAAA,CAAAlD,gBAAA,GAAAA,gBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_hexToByte","require","_le32FromHex","_le32ToBytes","_lepuCommands","_lepuFileNames","_lepuFrame","_lepuResponseType","FILE_SIZE_OFFSET","MAX_FILE_BYTES","TRANSFER_COMMANDS","LepuCommand","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","lepuCommandOf","afterTransfer","includes","undefined","isLepuSuccess","fail","describeLepuResponseType","lepuNamesFrom","lepuPayloadOf","onFileList","openNextFile","openedFile","appendChunk","closedFile","skipFiles","has","acceptFile","lepuNameBytes","le32ToBytes","payload","le32FromHex","limit","maxFileBytes","closeFile","length","fits","slice","set","map","hexToByte","onProgress","receivedBytes","onFile","reason","onError","write","builder","build","exports"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/lepu/lepu.file-transfer.ts"],"mappings":";;;;;;AAIA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAGA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,iBAAA,GAAAN,OAAA;AAZA;;AAcA,MAAMO,gBAAgB,GAAG,CAAC;;AAE1B;AACA;AACA;AACA;AACA,MAAMC,cAAc,GAAG,EAAE,GAAG,KAAK,GAAG,KAAK;AAEzC,MAAMC,iBAAoC,GAAG,CAC3CC,yBAAW,CAACC,aAAa,EACzBD,yBAAW,CAACE,eAAe,EAC3BF,y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AU,CAACpB,yBAAW,CAACI,aAAa,CAAC,CAC3C;;EAED;AACF;AACA;AACA;AACA;AACA;EACUyB,IAAI,GAAI4B,MAAc,IAA2C;IACvE,IAAI,CAACzC,MAAM,CAAC0C,OAAO,CAACD,MAAM,CAAC;IAC3B,IAAI,CAAC3C,MAAM,GAAG,IAAI;IAElB,IAAI,CAAC,IAAI,CAACD,aAAa,EAAE;MACvB,OAAO,IAAI,CAACG,MAAM,CAACS,aAAa,GAAG,CAAC;IACtC;IAEA,IAAI,CAACZ,aAAa,GAAG,KAAK;IAE1B,OAAO,IAAI,CAACkC,SAAS,CAAC,CAAC;EACzB,CAAC;EAEO3B,UAAU,GAAGA,CACnBG,OAAe,EACfoB,OAA0B,GAAG,EAAE,EAC/BxB,kBAA2B,MACR;IACnB,GAAG,IAAI,CAACH,MAAM,CAAC2C,KAAK;IACpBrC,KAAK,EAAE,IAAI,CAACN,MAAM,CAAC4C,OAAO,CAACC,KAAK,CAACtC,OAAO,EAAEoB,OAAO,CAAC;IAClD,IAAIxB,kBAAkB,KAAKQ,SAAS,GAAG,CAAC,CAAC,GAAG;MAAER;IAAmB,CAAC;EACpE,CAAC,CAAC;AACJ;AAAC2C,OAAA,CAAAzD,gBAAA,GAAAA,gBAAA","ignoreList":[]}
@@ -31,8 +31,9 @@ const START_PATTERN_BYTES = 3;
31
31
  * protocol, which is why it is worth having once rather than once per device.
32
32
  */
33
33
  class LepuFrameReader {
34
- constructor(startBytes) {
34
+ constructor(startBytes, session) {
35
35
  this.startBytes = startBytes;
36
+ this.session = session;
36
37
  }
37
38
  readFrame(buffer) {
38
39
  const start = this.findFrameStart(buffer);
@@ -48,7 +49,8 @@ class LepuFrameReader {
48
49
  if (!this.hasValidChecksum(frame)) {
49
50
  return (0, _frameReadResults.corrupt)(start + START_PATTERN_BYTES);
50
51
  }
51
- return (0, _frameReadResults.complete)(frame, start + frameLength);
52
+ const plainFrame = this.session ? this.session.decryptFrame(frame) : frame;
53
+ return plainFrame ? (0, _frameReadResults.complete)(plainFrame, start + frameLength) : (0, _frameReadResults.corrupt)(start + frameLength);
52
54
  }
53
55
  isFrameStart(buffer, index) {
54
56
  if (!this.startBytes.includes((buffer[index] || "").toLowerCase())) {
@@ -1 +1 @@
1
- {"version":3,"names":["_calculateCrc","require","_frameReadResults","_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","incomplete","droppableLeadingBytes","payloadLength","le16FromHex","frameLength","length","frame","slice","hasValidChecksum","corrupt","complete","isFrameStart","index","includes","toLowerCase","command","hexToByte","complement","lastCandidate","Math","max","checksummedBytes","declared","calculateCrc8","exports"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/lepu/lepu.frame-reader.ts"],"mappings":";;;;;;AAEA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAEA,MAAMI,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;AACO,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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GrB,MAAM,CAACQ,MAAM,GAAGb,mBAAmB;IAEzD,KAAK,IAAIoB,KAAK,GAAG,CAAC,EAAEA,KAAK,IAAIM,aAAa,EAAEN,KAAK,EAAE,EAAE;MACnD,IAAI,IAAI,CAACD,YAAY,CAACd,MAAM,EAAEe,KAAK,CAAC,EAAE;QACpC,OAAOA,KAAK;MACd;IACF;IAEA,OAAO,CAAC,CAAC;EACX;;EAEA;AACF;AACA;AACA;EACUX,qBAAqBA,CAACJ,MAAyB,EAAU;IAC/D,OAAOsB,IAAI,CAACC,GAAG,CAAC,CAAC,EAAEvB,MAAM,CAACQ,MAAM,IAAIb,mBAAmB,GAAG,CAAC,CAAC,CAAC;EAC/D;EAEQgB,gBAAgBA,CAACF,KAAe,EAAW;IACjD,MAAMe,gBAAgB,GAAGf,KAAK,CAACD,MAAM,GAAGf,cAAc;IACtD,MAAMgC,QAAQ,GAAG,IAAAN,oBAAS,EAACV,KAAK,CAACe,gBAAgB,CAAC,IAAI,GAAG,CAAC;IAE1D,OAAOC,QAAQ,KAAK,IAAAC,2BAAa,EAACjB,KAAK,EAAEe,gBAAgB,CAAC;EAC5D;AACF;AAACG,OAAA,CAAA/B,eAAA,GAAAA,eAAA","ignoreList":[]}
1
+ {"version":3,"names":["_calculateCrc","require","_frameReadResults","_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","incomplete","droppableLeadingBytes","payloadLength","le16FromHex","frameLength","length","frame","slice","hasValidChecksum","corrupt","plainFrame","decryptFrame","complete","isFrameStart","index","includes","toLowerCase","command","hexToByte","complement","lastCandidate","Math","max","checksummedBytes","declared","calculateCrc8","exports"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/lepu/lepu.frame-reader.ts"],"mappings":";;;;;;AAEA,IAA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