@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
@@ -8,17 +8,30 @@ var _clockSync = require("../../../types/clock-sync.js");
8
8
  var _hexToByte = require("../../../utils/hex-to-byte.js");
9
9
  var _lepuAdvertisement = require("./lepu.advertisement.js");
10
10
  var _lepuCommands = require("./lepu.commands.js");
11
+ var _lepuConnectRetry = require("./lepu.connect-retry.js");
11
12
  var _lepuDeviceInfo = require("./lepu.device-info.js");
13
+ var _lepuPulseWave = require("./lepu.pulse-wave.js");
12
14
  var _lepuResponseType = require("./lepu.response-type.js");
13
15
  /* eslint-disable max-lines */
14
16
 
15
17
  const COMMAND_INDEX = 1;
16
18
  const VIATOM_OXYGEN_INFO = 0x14;
19
+ const VIATOM_OXYGEN_PARAMETERS = 0x17;
20
+ const PARAMETERS_POLL_INTERVAL_MS = 1_000;
21
+ const REJECTED_POLL_RETRY_MS = 3_000;
22
+
23
+ /** The vendor polls the wave every 500 to 1000 ms; each answer drains what the ring sampled since the last. */
24
+ const PULSE_WAVE_POLL_INTERVAL_MS = 500;
25
+
26
+ /** Longer than a poll's delay and its answer, so a late answer cannot start a second poll chain. */
27
+ const PULSE_WAVE_REPLY_TIMEOUT_MS = 5_000;
17
28
 
18
29
  /** Identifies a device before sending it a model-specific command. */
19
30
  class LepuIdentityGate {
20
31
  isIdentified = false;
21
32
  isRefused = false;
33
+ streamsPulseWave = false;
34
+ connectRetry = new _lepuConnectRetry.LepuConnectRetry();
22
35
  constructor(params) {
23
36
  this.params = params;
24
37
  }
@@ -42,11 +55,47 @@ class LepuIdentityGate {
42
55
  const command = this.params.clockSyncProtocol === "bp3" ? 0xc0 : 0xec;
43
56
  this.pendingClockCommand = command;
44
57
  this.pendingCommand = command;
45
- return [this.commandFor(command, clockPayload(this.params.clockSync, this.params.clockSyncProtocol))];
58
+ return [this.awaitConnect(this.commandFor(command, clockPayload(this.params.clockSync, this.params.clockSyncProtocol)))];
46
59
  }
47
- this.pendingCommand = _lepuCommands.LepuCommand.GET_INFO;
48
- return [this.commandFor(_lepuCommands.LepuCommand.GET_INFO)];
60
+ return [this.askWhatItIs()];
61
+ };
62
+ commandTimeoutMs = () => {
63
+ if (this.awaitsPulseWave()) {
64
+ return PULSE_WAVE_REPLY_TIMEOUT_MS;
65
+ }
66
+ return this.awaitsConnectReply() ? _lepuConnectRetry.LEPU_CONNECT_REPLY_TIMEOUT_MS : undefined;
67
+ };
68
+
69
+ /**
70
+ * A device just woken can drop its first command, so an unanswered connect command is sent
71
+ * once more. An unanswered clock is then skipped; an unanswered identity is left to the
72
+ * stuck watchdog, since a device that never says what it is cannot be addressed.
73
+ */
74
+ onCommandTimeout = () => {
75
+ if (this.awaitsPulseWave()) {
76
+ return {
77
+ commands: this.pollRealtime()
78
+ };
79
+ }
80
+ if (!this.awaitsConnectReply() || !this.connectCommand) {
81
+ return {};
82
+ }
83
+ if (this.connectRetry.mayRetry()) {
84
+ return {
85
+ commands: [this.connectCommand]
86
+ };
87
+ }
88
+ if (this.pendingClockCommand !== undefined) {
89
+ this.pendingClockCommand = undefined;
90
+ return {
91
+ commands: [this.askWhatItIs()]
92
+ };
93
+ }
94
+ return {};
49
95
  };
96
+
97
+ /** Only the awaited connect reply settles its command; other frames leave the timeout running. */
98
+ commandProgress = frame => this.awaitsConnectReply() && (0, _hexToByte.hexToByte)(frame[COMMAND_INDEX] ?? "ff") !== this.pendingCommand ? "ignored" : "complete";
50
99
  nextCommand = frame => {
51
100
  if (this.params.protocol === "viatom-oxygen") {
52
101
  return this.nextViatomOxygenCommand(frame);
@@ -67,9 +116,20 @@ class LepuIdentityGate {
67
116
  return undefined;
68
117
  }
69
118
  this.pendingClockCommand = undefined;
119
+ return [this.askWhatItIs()];
120
+ };
121
+ askWhatItIs = () => {
70
122
  this.pendingCommand = _lepuCommands.LepuCommand.GET_INFO;
71
- return [this.commandFor(_lepuCommands.LepuCommand.GET_INFO)];
123
+ return this.awaitConnect(this.commandFor(_lepuCommands.LepuCommand.GET_INFO));
72
124
  };
125
+ awaitConnect = command => {
126
+ this.connectCommand = command;
127
+ this.connectRetry.started();
128
+ return command;
129
+ };
130
+
131
+ /** The standard family's clock and identity steps; the oxygen and v2 protocols keep their own pacing. */
132
+ awaitsConnectReply = () => this.params.protocol === undefined && !this.isIdentified && !this.isRefused && this.pendingCommand !== undefined;
73
133
 
74
134
  /** Decides on the reply to the generic `GET_INFO` command. */
75
135
  admit = frame => {
@@ -120,8 +180,11 @@ class LepuIdentityGate {
120
180
  }
121
181
  const status = (0, _hexToByte.hexToByte)(frame[1] ?? "ff");
122
182
  if (status !== 0) {
123
- if (this.pendingCommand === 0x17 && this.isIdentified) {
124
- return [this.commandFor(0x17, [], 3_000)];
183
+ if (this.pendingCommand === _lepuPulseWave.PULSE_WAVE_COMMAND) {
184
+ return this.streamsPulseWave ? this.pollPulseWave(REJECTED_POLL_RETRY_MS) : this.pollParameters();
185
+ }
186
+ if (this.pendingCommand === VIATOM_OXYGEN_PARAMETERS && this.isIdentified) {
187
+ return this.pollParameters(REJECTED_POLL_RETRY_MS);
125
188
  }
126
189
  return this.refuse(`the device rejected command 0x${this.pendingCommand.toString(16).padStart(2, "0")} with status 0x${status.toString(16).padStart(2, "0")}`);
127
190
  }
@@ -140,15 +203,36 @@ class LepuIdentityGate {
140
203
  return this.refuse(`the hardware reported model ${info.deviceType}, which this declaration was not written for`);
141
204
  }
142
205
  this.isIdentified = true;
143
- this.pendingCommand = 0x17;
144
- return [this.commandFor(0x17, [], 1_000)];
206
+ return this.params.onPulseWave ? this.pollPulseWave() : this.pollParameters();
145
207
  }
146
- case 0x17:
147
- return [this.commandFor(0x17, [], 1_000)];
208
+ case VIATOM_OXYGEN_PARAMETERS:
209
+ return this.pollParameters();
210
+ case _lepuPulseWave.PULSE_WAVE_COMMAND:
211
+ return this.answerPulseWave(frame);
148
212
  default:
149
213
  return undefined;
150
214
  }
151
215
  };
216
+
217
+ /** A ring whose first wave answer carries no wave is polled for its parameters from then on. */
218
+ answerPulseWave = frame => {
219
+ const wave = (0, _lepuPulseWave.readPulseWave)(frame);
220
+ if (wave) {
221
+ this.streamsPulseWave = true;
222
+ this.params.onPulseWave?.(wave);
223
+ }
224
+ return this.pollRealtime();
225
+ };
226
+ pollRealtime = () => this.streamsPulseWave ? this.pollPulseWave() : this.pollParameters();
227
+ pollParameters = (delayMs = PARAMETERS_POLL_INTERVAL_MS) => {
228
+ this.pendingCommand = VIATOM_OXYGEN_PARAMETERS;
229
+ return [this.commandFor(VIATOM_OXYGEN_PARAMETERS, [], delayMs)];
230
+ };
231
+ pollPulseWave = (delayMs = PULSE_WAVE_POLL_INTERVAL_MS) => {
232
+ this.pendingCommand = _lepuPulseWave.PULSE_WAVE_COMMAND;
233
+ return [this.commandFor(_lepuPulseWave.PULSE_WAVE_COMMAND, _lepuPulseWave.PULSE_WAVE_REQUEST, delayMs)];
234
+ };
235
+ awaitsPulseWave = () => this.params.protocol === "viatom-oxygen" && !this.isRefused && this.pendingCommand === _lepuPulseWave.PULSE_WAVE_COMMAND;
152
236
  }
153
237
  exports.LepuIdentityGate = LepuIdentityGate;
154
238
  const oxyClockPayload = clockSync => {
@@ -1 +1 @@
1
- {"version":3,"names":["_clockSync","require","_hexToByte","_lepuAdvertisement","_lepuCommands","_lepuDeviceInfo","_lepuResponseType","COMMAND_INDEX","VIATOM_OXYGEN_INFO","LepuIdentityGate","isIdentified","isRefused","constructor","params","initialCommands","advertisementRequiresEncryption","manufacturerData","rejectEncryptionAtBytes","refuse","protocol","command","pollCommand","pendingCommand","commandFor","setClock","setClockBeforeInfo","isClockSyncEnabled","clockSync","oxyClockPayload","clockSyncProtocol","pendingClockCommand","clockPayload","LepuCommand","GET_INFO","nextCommand","frame","nextViatomOxygenCommand","undefined","nextClockCommand","poll","admit","hexToByte","isLepuSuccess","describeLepuResponseType","info","parseLepuDeviceInfo","onIdentified","onAdmitted","isNarrowed","expectedDeviceTypes","length","includes","deviceType","branchCode","reason","onRefused","pollIntervalMs","payload","delayBeforeWriteMs","write","builder","build","writeWithoutResponse","withoutResponse","status","toString","padStart","parseViatomOxygenDeviceInfo","exports","parts","getClockParts","now","Date","timezone","pad","value","String","JSON","stringify","SetTIME","year","month","day","hours","minutes","seconds","Array","from","TextEncoder","encode","date","tenthsOfHour","getTimezoneOffset","push","text","slice","map","byte","fromCharCode","join","replace","parse","Number","Model","isInteger","protocolMaxLength","Branch","serialNumber","SN","SerialNumber"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/lepu/lepu.identity-gate.ts"],"mappings":";;;;;;AAEA,IAAAA,UAAA,GAAAC,OAAA;AAOA,IAAAC,UAAA,GAAAD,OAAA;AAEA,IAAAE,kBAAA,GAAAF,OAAA;AAEA,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;IACN,OAAOxE,SAAS;EAClB;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_clockSync","require","_hexToByte","_lepuAdvertisement","_lepuCommands","_lepuConnectRetry","_lepuDeviceInfo","_lepuPulseWave","_lepuResponseType","COMMAND_INDEX","VIATOM_OXYGEN_INFO","VIATOM_OXYGEN_PARAMETERS","PARAMETERS_POLL_INTERVAL_MS","REJECTED_POLL_RETRY_MS","PULSE_WAVE_POLL_INTERVAL_MS","PULSE_WAVE_REPLY_TIMEOUT_MS","LepuIdentityGate","isIdentified","isRefused","streamsPulseWave","connectRetry","LepuConnectRetry","constructor","params","initialCommands","advertisementRequiresEncryption","manufacturerData","rejectEncryptionAtBytes","refuse","protocol","command","pollCommand","pendingCommand","commandFor","setClock","setClockBeforeInfo","isClockSyncEnabled","clockSync","oxyClockPayload","clockSyncProtocol","pendingClockCommand","awaitConnect","clockPayload","askWhatItIs","commandTimeoutMs","awaitsPulseWave","awaitsConnectReply","LEPU_CONNECT_REPLY_TIMEOUT_MS","undefined","onCommandTimeout","commands","pollRealtime","connectCommand","mayRetry","commandProgress","frame","hexToByte","nextCommand","nextViatomOxygenCommand","nextClockCommand","poll","admit","LepuCommand","GET_INFO","started","isLepuSuccess","describeLepuResponseType","info","parseLepuDeviceInfo","onIdentified","onAdmitted","isNarrowed","expectedDeviceTypes","length","includes","deviceType","branchCode","reason","onRefused","pollIntervalMs","payload","delayBeforeWriteMs","write","builder","build","writeWithoutResponse","withoutResponse","status","PULSE_WAVE_COMMAND","pollPulseWave","pollParameters","toString","padStart","parseViatomOxygenDeviceInfo","onPulseWave","answerPulseWave","wave","readPulseWave","delayMs","PULSE_WAVE_REQUEST","exports","parts","getClockParts","now","Date","timezone","pad","value","String","JSON","stringify","SetTIME","year","month","day","hours","minutes","seconds","Array","from","TextEncoder","encode","date","tenthsOfHour","getTimezoneOffset","push","text","slice","map","byte","fromCharCode","join","replace","parse","Number","Model","isInteger","protocolMaxLength","Branch","serialNumber","SN","SerialNumber"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/lepu/lepu.identity-gate.ts"],"mappings":";;;;;;AAEA,IAAAA,UAAA,GAAAC,OAAA;AAUA,IAAAC,UAAA,GAAAD,OAAA;AAEA,IAAAE,kBAAA,GAAAF,OAAA;AAEA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAJ,OAAA;AACA,IAAAK,eAAA,GAAAL,OAAA;AACA,IAAAM,cAAA,GAAAN,OAAA;AAMA,IAAAO,iBAAA,GAAAP,OAAA;AAzBA;;AAsEA,MAAMQ,aAAa,GAAG,CAAC;AACvB,MAAMC,kBAAkB,GAAG,IAAI;AAC/B,MAAMC,wBAAwB,GAAG,IAAI;AACrC,MAAMC,2BAA2B,GAAG,KAAK;AACzC,MAAMC,sBAAsB,GAAG,KAAK;;AAEpC;AACA,MAAMC,2BAA2B,GAAG,GAAG;;AAEvC;AACA,MAAMC,2BAA2B,GAAG,KAAK;;AAEzC;AACO,MAAMC,gBAAgB,CAA6B;EAChDC,YAAY,GAAG,KAAK;EACpBC,SAAS,GAAG,KAAK;EACjBC,gBAAgB,GAAG,KAAK;EAIfC,YAAY,GAAG,IAAIC,kCAAgB,CAAC,CAAC;EAE/CC,WAAWA,CAAkBC,MAA8B,EAAE;IAAA,KAAhCA,MAA8B,GAA9BA,MAA8B;EAAG;EAE9DC,eAAe,GAAGA,CAAA,KAAgC;IACvD,IACE,IAAAC,kDAA+B,EAC7B,IAAI,CAACF,MAAM,CAACG,gBAAgB,EAC5B,IAAI,CAACH,MAAM,CAACI,uBACd,CAAC,EACD;MACA,OACE,IAAI,CAACC,MAAM,CACT,qFACF,CAAC,IAAI,EAAE;IAEX;IAEA,IAAI,IAAI,CAACL,MAAM,CAACM,QAAQ,KAAK,IAAI,EAAE;MACjC,MAAMC,OAAO,GAAG,IAAI,CAACP,MAAM,CAACQ,WAAW,IAAI,IAAI;MAE/C,IAAI,CAACC,cAAc,GAAGF,OAAO;MAC7B,I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MuE,IAAI,GAAGvE,KAAK,CACfwE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CACZC,GAAG,CAAEC,IAAI,IAAKrB,MAAM,CAACsB,YAAY,CAAC,IAAA1E,oBAAS,EAACyE,IAAI,CAAC,CAAC,CAAC,CACnDE,IAAI,CAAC,EAAE,CAAC,CACRC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;IAEtB,MAAMjE,IAAI,GAAG0C,IAAI,CAACwB,KAAK,CAACP,IAAI,CAA4B;IACxD,MAAMnD,UAAU,GAAG2D,MAAM,CAACnE,IAAI,CAACoE,KAAK,CAAC;IAErC,IAAI,CAACD,MAAM,CAACE,SAAS,CAAC7D,UAAU,CAAC,EAAE;MACjC,OAAO3B,SAAS;IAClB;IAEA,OAAO;MACL2B,UAAU;MACV8D,iBAAiB,EAAE,CAAC;MACpB7D,UAAU,EAAEgC,MAAM,CAACzC,IAAI,CAACuE,MAAM,IAAI,EAAE,CAAC;MACrCC,YAAY,EAAE/B,MAAM,CAACzC,IAAI,CAACyE,EAAE,IAAIzE,IAAI,CAAC0E,YAAY,IAAI,EAAE;IACzD,CAAC;EACH,CAAC,CAAC,MAAM;IACN,OAAO7F,SAAS;EAClB;AACF,CAAC","ignoreList":[]}
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.LiveEcgChunks = void 0;
7
+ var _next = require("@ovok/core/next");
8
+ var _caseType = require("../../../types/case-type.js");
9
+ var _lepuWaveform = require("./lepu.waveform.js");
10
+ /** How long a live chunk grows before it is handed over. */
11
+ const CHUNK_SECONDS = 300;
12
+ const MS_PER_SECOND = 1_000;
13
+ const COVERAGE_DECIMALS = 2;
14
+
15
+ /** A stretch of a recording sent live, before the device's own file supersedes it. */
16
+
17
+ /** Collects one recording's live samples and hands them over in chunks of five minutes or less. */
18
+ class LiveEcgChunks {
19
+ counts = [];
20
+ index = 0;
21
+ constructor(waveform, onChunk) {
22
+ this.waveform = waveform;
23
+ this.onChunk = onChunk;
24
+ }
25
+
26
+ /** Adds the samples an answer at `at` carried, `recordedSeconds` into the recording. */
27
+ append = (samples, at, recordedSeconds) => {
28
+ this.recordingKey ??= recordingKeyOf(new Date(at.getTime() - recordedSeconds * MS_PER_SECOND));
29
+ this.startedAt ??= new Date(at.getTime() - this.secondsOf(samples.length) * MS_PER_SECOND);
30
+ this.counts.push(...samples);
31
+ this.lastAt = at;
32
+ if (this.secondsOf(this.counts.length) >= CHUNK_SECONDS) {
33
+ this.flush();
34
+ }
35
+ };
36
+
37
+ /** Hands over what has been collected; the recording may continue into a further chunk. */
38
+ flush = () => {
39
+ if (this.counts.length === 0 || !this.startedAt || !this.lastAt || !this.recordingKey) {
40
+ return;
41
+ }
42
+ this.onChunk({
43
+ measurementTypeKey: _next.MeasurementTypeKey.ecg,
44
+ caseType: _caseType.CaseType.RESULT,
45
+ diagramPoints: this.counts.map(count => (0, _lepuWaveform.millivoltsOf)(count, this.waveform)),
46
+ duration: this.secondsOf(this.counts.length),
47
+ recordedAt: this.startedAt,
48
+ recordingId: `${this.recordingKey}-live-${this.index}`,
49
+ live: true,
50
+ coverage: this.coverage()
51
+ });
52
+ this.index += 1;
53
+ this.counts = [];
54
+ this.startedAt = undefined;
55
+ };
56
+
57
+ /** Hands over the rest and forgets the recording, so the next one starts its own chunks. */
58
+ endRecording = () => {
59
+ this.flush();
60
+ this.recordingKey = undefined;
61
+ this.index = 0;
62
+ };
63
+ secondsOf = samples => samples / this.waveform.sampleRateHz;
64
+ coverage = () => {
65
+ const spanSeconds = ((this.lastAt?.getTime() ?? 0) - (this.startedAt?.getTime() ?? 0)) / MS_PER_SECOND;
66
+ const expected = Math.max(this.counts.length, spanSeconds * this.waveform.sampleRateHz);
67
+ return Number((this.counts.length / expected).toFixed(COVERAGE_DECIMALS));
68
+ };
69
+ }
70
+ exports.LiveEcgChunks = LiveEcgChunks;
71
+ const pad = value => String(value).padStart(2, "0");
72
+
73
+ /** The name the device gives the recording's file: `R` and its local start, to the second. */
74
+ const recordingKeyOf = start => `R${start.getFullYear()}${pad(start.getMonth() + 1)}${pad(start.getDate())}` + `${pad(start.getHours())}${pad(start.getMinutes())}${pad(start.getSeconds())}`;
75
+ //# sourceMappingURL=lepu.live-ecg-chunks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_next","require","_caseType","_lepuWaveform","CHUNK_SECONDS","MS_PER_SECOND","COVERAGE_DECIMALS","LiveEcgChunks","counts","index","constructor","waveform","onChunk","append","samples","at","recordedSeconds","recordingKey","recordingKeyOf","Date","getTime","startedAt","secondsOf","length","push","lastAt","flush","measurementTypeKey","MeasurementTypeKey","ecg","caseType","CaseType","RESULT","diagramPoints","map","count","millivoltsOf","duration","recordedAt","recordingId","live","coverage","undefined","endRecording","sampleRateHz","spanSeconds","expected","Math","max","Number","toFixed","exports","pad","value","String","padStart","start","getFullYear","getMonth","getDate","getHours","getMinutes","getSeconds"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/lepu/lepu.live-ecg-chunks.ts"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AAEA,IAAAE,aAAA,GAAAF,OAAA;AAEA;AACA,MAAMG,aAAa,GAAG,GAAG;AAEzB,MAAMC,aAAa,GAAG,KAAK;AAC3B,MAAMC,iBAAiB,GAAG,CAAC;;AAE3B;;AAwBA;AACA,MAAMC,aAAa,CAAC;EACVC,MAAM,GAAa,EAAE;EAIrBC,KAAK,GAAG,CAAC;EAEVC,WAAWA,CACCC,QAAkB,EAClBC,OAAsC,EACvD;IAAA,KAFiBD,QAAkB,GAAlBA,QAAkB;IAAA,KAClBC,OAAsC,GAAtCA,OAAsC;EACtD;;EAEH;EACOC,MAAM,GAAGA,CAACC,OAA0B,EAAEC,EAAQ,EAAEC,eAAuB,KAAW;IACvF,IAAI,CAACC,YAAY,KAAKC,cAAc,CAAC,IAAIC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AAGP,GAAG,CAACI,KAAK,CAACI,QAAQ,CAAC,CAAC,CAAC,GAAGR,GAAG,CAACI,KAAK,CAACK,UAAU,CAAC,CAAC,CAAC,GAAGT,GAAG,CAACI,KAAK,CAACM,UAAU,CAAC,CAAC,CAAC,EAAE","ignoreList":[]}
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.pulseWaveResult = exports.PulseWaveChunks = void 0;
7
+ var _next = require("@ovok/core/next");
8
+ var _lepuPulseWave = require("./lepu.pulse-wave.js");
9
+ /** How long a chunk grows before it is handed over. */
10
+ const CHUNK_MS = 300_000;
11
+ const SAMPLES_PER_CHUNK = CHUNK_MS / _lepuPulseWave.PULSE_WAVE_PERIOD_MS;
12
+
13
+ /** How far the samples may fall behind the clock before the shortfall is recorded as a gap. */
14
+ const MAX_SHORTFALL_MS = 250;
15
+ const isRecorded = sample => sample !== null;
16
+ const endOf = chunk => chunk.start + chunk.samples.length * _lepuPulseWave.PULSE_WAVE_PERIOD_MS;
17
+
18
+ /**
19
+ * Collects a pulse wave into series of five minutes or less. Each answer's samples are timed back from its
20
+ * arrival, and `null` marks a gap: no sensor contact, or samples that never arrived.
21
+ */
22
+ class PulseWaveChunks {
23
+ constructor(onChunk) {
24
+ this.onChunk = onChunk;
25
+ }
26
+
27
+ /** Adds one answer's samples, the last of them taken at `at`. */
28
+ append = (wave, at) => {
29
+ if (wave.samples.length === 0) {
30
+ return;
31
+ }
32
+ const firstAt = at.getTime() - wave.samples.length * _lepuPulseWave.PULSE_WAVE_PERIOD_MS;
33
+ this.recordGapBefore(firstAt);
34
+ this.chunk ??= {
35
+ start: firstAt,
36
+ samples: []
37
+ };
38
+ this.push(wave.leadOn ? wave.samples : wave.samples.map(() => null));
39
+ };
40
+
41
+ /** Hands over what has been collected; the next answer starts a new chunk. */
42
+ flush = () => {
43
+ if (this.chunk) {
44
+ this.handOver(this.chunk);
45
+ }
46
+ this.chunk = undefined;
47
+ };
48
+
49
+ /** Keeps later samples on time; a gap longer than the chunk has room for ends the chunk instead. */
50
+ recordGapBefore = firstAt => {
51
+ const chunk = this.chunk;
52
+ const shortfallMs = chunk ? firstAt - endOf(chunk) : 0;
53
+ if (!chunk || shortfallMs <= MAX_SHORTFALL_MS) {
54
+ return;
55
+ }
56
+ const missing = Math.round(shortfallMs / _lepuPulseWave.PULSE_WAVE_PERIOD_MS);
57
+ if (chunk.samples.length + missing < SAMPLES_PER_CHUNK) {
58
+ this.push(Array(missing).fill(null));
59
+ } else {
60
+ this.flush();
61
+ }
62
+ };
63
+
64
+ /** Appends to the open chunk, handing it over when full and carrying the rest into the next. */
65
+ push = samples => {
66
+ const chunk = this.chunk;
67
+ if (!chunk || samples.length === 0) {
68
+ return;
69
+ }
70
+ const room = SAMPLES_PER_CHUNK - chunk.samples.length;
71
+ chunk.samples = chunk.samples.concat(samples.slice(0, room));
72
+ if (chunk.samples.length < SAMPLES_PER_CHUNK) {
73
+ return;
74
+ }
75
+ this.handOver(chunk);
76
+ this.chunk = {
77
+ start: chunk.start + CHUNK_MS,
78
+ samples: []
79
+ };
80
+ this.push(samples.slice(room));
81
+ };
82
+
83
+ /** Reports the chunk from its first recorded sample to its last; one with none is dropped. */
84
+ handOver = chunk => {
85
+ const first = chunk.samples.findIndex(isRecorded);
86
+ const last = chunk.samples.findLastIndex(isRecorded);
87
+ if (first === -1) {
88
+ return;
89
+ }
90
+ this.onChunk({
91
+ measurementTypeKey: _next.MeasurementTypeKey.bloodOxygenPulseRate,
92
+ start: new Date(chunk.start + first * _lepuPulseWave.PULSE_WAVE_PERIOD_MS),
93
+ periodMs: _lepuPulseWave.PULSE_WAVE_PERIOD_MS,
94
+ values: {
95
+ pulseWave: chunk.samples.slice(first, last + 1)
96
+ }
97
+ });
98
+ };
99
+ }
100
+
101
+ /** A chunk as a result, with an id the one-second series of the same device cannot share. */
102
+ exports.PulseWaveChunks = PulseWaveChunks;
103
+ const pulseWaveResult = (deviceData, series) => ({
104
+ id: `wave:${deviceData.sn || deviceData.id}:pulse-wave:${series.start.toISOString()}`,
105
+ deviceData,
106
+ data: {
107
+ measurementTypeKey: series.measurementTypeKey,
108
+ recordedAt: series.start
109
+ },
110
+ series
111
+ });
112
+ exports.pulseWaveResult = pulseWaveResult;
113
+ //# sourceMappingURL=lepu.pulse-wave-chunks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_next","require","_lepuPulseWave","CHUNK_MS","SAMPLES_PER_CHUNK","PULSE_WAVE_PERIOD_MS","MAX_SHORTFALL_MS","isRecorded","sample","endOf","chunk","start","samples","length","PulseWaveChunks","constructor","onChunk","append","wave","at","firstAt","getTime","recordGapBefore","push","leadOn","map","flush","handOver","undefined","shortfallMs","missing","Math","round","Array","fill","room","concat","slice","first","findIndex","last","findLastIndex","measurementTypeKey","MeasurementTypeKey","bloodOxygenPulseRate","Date","periodMs","values","pulseWave","exports","pulseWaveResult","deviceData","series","id","sn","toISOString","data","recordedAt"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/lepu/lepu.pulse-wave-chunks.ts"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAOA,IAAAC,cAAA,GAAAD,OAAA;AAEA;AACA,MAAME,QAAQ,GAAG,OAAO;AACxB,MAAMC,iBAAiB,GAAGD,QAAQ,GAAGE,mCAAoB;;AAEzD;AACA,MAAMC,gBAAgB,GAAG,GAAG;AAS5B,MAAMC,UAAU,GAAIC,MAAc,IAAcA,MAAM,KAAK,IAAI;AAE/D,MAAMC,KAAK,GAAIC,KAAgB,IAAaA,KAAK,CAACC,KAAK,GAAGD,KAAK,CAACE,OAAO,CAACC,MAAM,GAAGR,mCAAoB;;AAErG;AACA;AACA;AACA;AACA,MAAMS,eAAe,CAAC;EAGbC,WAAWA,CAAkBC,OAA4C,EAAE;IAAA,KAA9CA,OAA4C,GAA5CA,OAA4C;EAAG;;EAEnF;EACOC,MAAM,GAAGA,CAACC,IAA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CAACyB,KAAK,CAACC,KAAK,EAAEE,IAAI,GAAG,CAAC;MAAE;IAC5D,CAAC,CAAC;EACJ,CAAC;AACH;;AAEA;AAAAS,OAAA,CAAAnC,eAAA,GAAAA,eAAA;AACA,MAAMoC,eAAe,GAAGA,CAACC,UAAsB,EAAEC,MAAyB,MAAiC;EACzGC,EAAE,EAAE,QAAQF,UAAU,CAACG,EAAE,IAAIH,UAAU,CAACE,EAAE,eAAeD,MAAM,CAACzC,KAAK,CAAC4C,WAAW,CAAC,CAAC,EAAE;EACrFJ,UAAU;EACVK,IAAI,EAAE;IACJd,kBAAkB,EAAEU,MAAM,CAACV,kBAAkB;IAC7Ce,UAAU,EAAEL,MAAM,CAACzC;EACrB,CAA6C;EAC7CyC;AACF,CAAC,CAAC;AAACH,OAAA,CAAAC,eAAA,GAAAA,eAAA","ignoreList":[]}
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.readPulseWave = exports.PULSE_WAVE_REQUEST = exports.PULSE_WAVE_PERIOD_MS = exports.PULSE_WAVE_COMMAND = void 0;
7
+ var _hexToByte = require("../../../utils/hex-to-byte.js");
8
+ var _le16FromHex = require("../../../utils/le-16-from-hex.js");
9
+ /** The legacy oxygen protocol's realtime request answered with the pulse wave as well as the parameters. */
10
+ const PULSE_WAVE_COMMAND = exports.PULSE_WAVE_COMMAND = 0x1b;
11
+
12
+ /** Its one payload byte picks the sample rate; 0 is 125 Hz. */
13
+ const RATE_125_HZ = 0x00;
14
+ const PULSE_WAVE_REQUEST = exports.PULSE_WAVE_REQUEST = [RATE_125_HZ];
15
+ const PULSE_WAVE_PERIOD_MS = exports.PULSE_WAVE_PERIOD_MS = 8;
16
+ const PAYLOAD_START = 7;
17
+ const CHECKSUM_BYTES = 1;
18
+
19
+ /** Offsets in the answer's payload. */
20
+ const LEAD_STATE = 6;
21
+ const SAMPLE_COUNT = 10;
22
+ const SAMPLES_START = 12;
23
+ const LEAD_ON = 1;
24
+
25
+ /** One sample would make the answer as long as a realtime parameters answer, so it could be one. */
26
+ const MIN_SAMPLES = 2;
27
+
28
+ /** Sample values the ring sends as markers rather than as the wave. */
29
+ const MARKERS = new Set([156, 246]);
30
+
31
+ /** The pulse wave one answer carries: raw, unitless and inverted, so systolic peaks are minima. */
32
+
33
+ const isSample = value => value !== undefined;
34
+
35
+ /** The whole mean of the samples either side, or the one neighbour at an edge, as the vendor's SDKs do. */
36
+ const neighbourMean = (raw, index) => {
37
+ const neighbours = [raw[index - 1], raw[index + 1]].filter(isSample);
38
+ const total = neighbours.reduce((sum, value) => sum + value, 0);
39
+ return Math.floor(total / neighbours.length);
40
+ };
41
+ const withoutMarkers = raw => raw.map((value, index) => MARKERS.has(value) ? neighbourMean(raw, index) : value);
42
+
43
+ /** An answer that ends right after a zero count streams the wave but had nothing new, as while the sensor acquires. */
44
+ const isEmptyWave = (payload, count) => count === 0 && payload.length === SAMPLES_START;
45
+
46
+ /** The pulse wave in a realtime wave answer; `undefined` for one sample, or fewer than it counts. */
47
+ const readPulseWave = frame => {
48
+ const payload = frame.slice(PAYLOAD_START, -CHECKSUM_BYTES);
49
+ const count = (0, _le16FromHex.le16FromHex)(payload, SAMPLE_COUNT);
50
+ const samples = payload.slice(SAMPLES_START, SAMPLES_START + count).map(_hexToByte.hexToByte);
51
+ const leadOn = (0, _hexToByte.hexToByte)(payload[LEAD_STATE] ?? "00") === LEAD_ON;
52
+ if (isEmptyWave(payload, count)) {
53
+ return {
54
+ leadOn,
55
+ samples: []
56
+ };
57
+ }
58
+ if (count < MIN_SAMPLES || samples.length < count) {
59
+ return undefined;
60
+ }
61
+ return {
62
+ leadOn,
63
+ samples: withoutMarkers(samples)
64
+ };
65
+ };
66
+ exports.readPulseWave = readPulseWave;
67
+ //# sourceMappingURL=lepu.pulse-wave.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_hexToByte","require","_le16FromHex","PULSE_WAVE_COMMAND","exports","RATE_125_HZ","PULSE_WAVE_REQUEST","PULSE_WAVE_PERIOD_MS","PAYLOAD_START","CHECKSUM_BYTES","LEAD_STATE","SAMPLE_COUNT","SAMPLES_START","LEAD_ON","MIN_SAMPLES","MARKERS","Set","isSample","value","undefined","neighbourMean","raw","index","neighbours","filter","total","reduce","sum","Math","floor","length","withoutMarkers","map","has","isEmptyWave","payload","count","readPulseWave","frame","slice","le16FromHex","samples","hexToByte","leadOn"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/lepu/lepu.pulse-wave.ts"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA;AACA,MAAME,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAG,IAAI;;AAE/B;AACA,MAAME,WAAW,GAAG,IAAI;AACxB,MAAMC,kBAAqC,GAAAF,OAAA,CAAAE,kBAAA,GAAG,CAACD,WAAW,CAAC;AAC3D,MAAME,oBAAoB,GAAAH,OAAA,CAAAG,oBAAA,GAAG,CAAC;AAE9B,MAAMC,aAAa,GAAG,CAAC;AACvB,MAAMC,cAAc,GAAG,CAAC;;AAExB;AACA,MAAMC,UAAU,GAAG,CAAC;AACpB,MAAMC,YAAY,GAAG,EAAE;AACvB,MAAMC,aAAa,GAAG,EAAE;AAExB,MAAMC,OAAO,GAAG,CAAC;;AAEjB;AACA,MAAMC,WAAW,GAAG,CAAC;;AAErB;AACA,MAAMC,OAA4B,GAAG,IAAIC,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;;AAExD;;AAUA,MAAMC,QAAQ,GAAIC,KAAyB,IAAsBA,KAAK,KAAKC,SAAS;;AAEpF;AACA,MAAMC,aAAa,GAAGA,CAACC,GAAsB,EAAEC,KAAa,KAAa;EACvE,MAAMC,UAAU,GAAG,CAACF,GAAG,CAACC,KAAK,GAAG,CAAC,CAAC,EAAED,GAAG,CAACC,KAAK,GAAG,CAAC,CAAC,CAAC,CA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,OAAO;IAAEwB,MAAM;IAAEF,OAAO,EAAEV,cAAc,CAACU,OAAO;EAAE,CAAC;AACrD,CAAC;AAACrC,OAAA,CAAAiC,aAAA,GAAAA,aAAA","ignoreList":[]}
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.LepuRecorder = void 0;
7
+ var _lepuLiveEcgChunks = require("./lepu.live-ecg-chunks.js");
8
+ var _lepuRecordingWatch = require("./lepu.recording-watch.js");
9
+ var _lepuWaveform = require("./lepu.waveform.js");
10
+ /**
11
+ * Follows a recorder's open recording through its poll answers: reports its state, feeds the live
12
+ * trace while it records, and hands its samples over in chunks.
13
+ */
14
+ class LepuRecorder {
15
+ constructor(status, callbacks) {
16
+ this.status = status;
17
+ this.callbacks = callbacks;
18
+ this.watch = new _lepuRecordingWatch.LepuRecordingWatch(status, callbacks.onRecordingChanged);
19
+ this.chunks = status.waveform ? new _lepuLiveEcgChunks.LiveEcgChunks(status.waveform, callbacks.onChunk) : undefined;
20
+ }
21
+
22
+ /** Reads one poll answer; true when it is the first in the saved state, so the files are read. */
23
+ observe = pollAnswer => {
24
+ const saved = this.watch.observe(pollAnswer);
25
+ if (this.watch.isRecording()) {
26
+ this.record(pollAnswer);
27
+ } else if (this.watch.isOpen()) {
28
+ this.chunks?.flush();
29
+ } else {
30
+ this.chunks?.endRecording();
31
+ }
32
+ return saved;
33
+ };
34
+ isOpen = () => this.watch.isOpen();
35
+
36
+ /** Whether samples are being recorded, so every answer's samples count. */
37
+ isRecording = () => this.watch.isRecording();
38
+
39
+ /** Hands over what is collected, for a connection that is ending. */
40
+ flush = () => this.chunks?.flush();
41
+ record = pollAnswer => {
42
+ if (!this.status.waveform) {
43
+ return;
44
+ }
45
+ const samples = (0, _lepuWaveform.waveformSamples)(pollAnswer, this.status.waveform);
46
+ const at = new Date();
47
+ if (samples.length === 0) {
48
+ return;
49
+ }
50
+ this.callbacks.onSamples(samples, at);
51
+ this.chunks?.append(samples, at, this.watch.recordedSeconds());
52
+ };
53
+ }
54
+ exports.LepuRecorder = LepuRecorder;
55
+ //# sourceMappingURL=lepu.recorder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_lepuLiveEcgChunks","require","_lepuRecordingWatch","_lepuWaveform","LepuRecorder","constructor","status","callbacks","watch","LepuRecordingWatch","onRecordingChanged","chunks","waveform","LiveEcgChunks","onChunk","undefined","observe","pollAnswer","saved","isRecording","record","isOpen","flush","endRecording","samples","waveformSamples","at","Date","length","onSamples","append","recordedSeconds","exports"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/lepu/lepu.recorder.ts"],"mappings":";;;;;;AAGA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AAcA;AACA;AACA;AACA;AACA,MAAMG,YAAY,CAAC;EAIVC,WAAWA,CACCC,MAAuB,EACvBC,SAAgC,EACjD;IAAA,KAFiBD,MAAuB,GAAvBA,MAAuB;IAAA,KACvBC,SAAgC,GAAhCA,SAAgC;IAEjD,IAAI,CAACC,KAAK,GAAG,IAAIC,sCAAkB,CAACH,MAAM,EAAEC,SAAS,CAACG,kBAAkB,CAAC;IACzE,IAAI,CAACC,MAAM,GAAGL,MAAM,CAACM,QAAQ,GAAG,IAAIC,gCAAa,CAACP,MAAM,CAACM,QAAQ,EAAEL,SAAS,CAACO,OAAO,CAAC,GAAGC,SAAS;EACnG;;EAEA;EACOC,OAAO,GAAIC,UAA6B,IAAc;IAC3D,MAAMC,KAAK,GAAG,IAAI,CAACV,KAAK,CAACQ,OAAO,CAACC,UAAU,CAAC;IAE5C,IAAI,IAAI,CAACT,KAAK,CAACW,WAAW,CAAC,CAAC,EAAE;MAC5B,IAAI,CAACC,MAAM,CAACH,UAAU,CAAC;IACzB,CAAC,MAAM,IAAI,IAAI,CAACT,KAAK,CAACa,MAAM,CAAC,CAAC,EAAE;MAC9B,IAAI,CAACV,MAAM,EAAEW,KAAK,CAAC,CAAC;IACtB,CAAC,MAAM;MACL,IAAI,CAACX,MAAM,EAAEY,YAAY,CAAC,CAAC;IAC7B;IAEA,OAAOL,KAAK;EACd,CAAC;EAEMG,MAAM,GAAGA,CAAA,KAAe,IAAI,CAACb,KAAK,CAACa,MAAM,CAAC,CAAC;;EAElD;EACOF,WAAW,GAAGA,CAAA,KAAe,IAAI,CAACX,KAAK,CAACW,WAAW,CAAC,CAAC;;EAE5D;EACOG,KAAK,GAAGA,CAAA,KAAY,IAAI,CAACX,MAAM,EAAEW,KAAK,CAAC,CAAC;EAEvCF,MAAM,GAAIH,UAA6B,IAAW;IACxD,IAAI,CAAC,IAAI,CAACX,MAAM,CAACM,QAAQ,EAAE;MACzB;IACF;IAEA,MAAMY,OAAO,GAAG,IAAAC,6BAAe,EAACR,UAAU,EAAE,IAAI,CAACX,MAAM,CAACM,QAAQ,CAAC;IACjE,MAAMc,EAAE,GAAG,IAAIC,IAAI,CAAC,CAAC;IAErB,IAAIH,OAAO,CAACI,MAAM,KAAK,CAAC,EAAE;MACxB;IACF;IAEA,IAAI,CAACrB,SAAS,CAACsB,SAAS,CAACL,OAAO,EAAEE,EAAE,CAAC;IACrC,IAAI,CAACf,MAAM,EAAEmB,MAAM,CAACN,OAAO,EAAEE,EAAE,EAAE,IAAI,CAAClB,KAAK,CAACuB,eAAe,CAAC,CAAC,CAAC;EAChE,CAAC;AACH;AAACC,OAAA,CAAA5B,YAAA,GAAAA,YAAA","ignoreList":[]}
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.LepuRecordingWatch = void 0;
7
+ var _hexToByte = require("../../../utils/hex-to-byte.js");
8
+ var _le32FromHex = require("../../../utils/le-32-from-hex.js");
9
+ const LOW_NIBBLE = 0x0f;
10
+ const CLOSED = "closed";
11
+ /** Follows a recorder's open recording through its poll answers. */
12
+ class LepuRecordingWatch {
13
+ seconds = 0;
14
+ constructor(status, onRecordingChanged) {
15
+ this.status = status;
16
+ this.onRecordingChanged = onRecordingChanged;
17
+ }
18
+
19
+ /** Reads one poll answer; true when it is the first in the saved state, so the files are read. */
20
+ observe = pollAnswer => {
21
+ const previous = this.state;
22
+ this.state = (0, _hexToByte.hexToByte)(pollAnswer[this.status.byteIndex] ?? "00") & LOW_NIBBLE;
23
+ this.seconds = (0, _le32FromHex.le32FromHex)(pollAnswer, this.status.secondsByteIndex);
24
+ this.leadOffSince = this.isLeadOff() ? this.leadOffSince ?? new Date() : undefined;
25
+ this.report(this.recordingIn());
26
+ return this.state === this.status.savedState && previous !== this.status.savedState;
27
+ };
28
+
29
+ /** Whether a recording is open, so that stopping it means something. */
30
+ isOpen = () => this.isRecording() || this.isLeadOff();
31
+
32
+ /** Whether the electrodes have contact and samples are being recorded. */
33
+ isRecording = () => this.state === this.status.recordingState;
34
+
35
+ /** Seconds recorded, as of the last answer. */
36
+ recordedSeconds = () => this.seconds;
37
+ recordingIn = () => this.isOpen() ? {
38
+ seconds: this.seconds,
39
+ ...(this.leadOffSince ? {
40
+ leadOffSince: this.leadOffSince
41
+ } : {}),
42
+ storesOnStop: this.seconds >= this.status.minimumStoredSeconds
43
+ } : undefined;
44
+ isLeadOff = () => this.state === this.status.leadOffState;
45
+
46
+ /** Reports a change in what the app would act on, not every tick of the seconds. */
47
+ report = recording => {
48
+ const key = recording ? `${recording.leadOffSince !== undefined}:${recording.storesOnStop}` : CLOSED;
49
+ const changed = key !== (this.reported ?? CLOSED);
50
+ this.reported = key;
51
+ if (changed) {
52
+ this.onRecordingChanged(recording);
53
+ }
54
+ };
55
+ }
56
+ exports.LepuRecordingWatch = LepuRecordingWatch;
57
+ //# sourceMappingURL=lepu.recording-watch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_hexToByte","require","_le32FromHex","LOW_NIBBLE","CLOSED","LepuRecordingWatch","seconds","constructor","status","onRecordingChanged","observe","pollAnswer","previous","state","hexToByte","byteIndex","le32FromHex","secondsByteIndex","leadOffSince","isLeadOff","Date","undefined","report","recordingIn","savedState","isOpen","isRecording","recordingState","recordedSeconds","storesOnStop","minimumStoredSeconds","leadOffState","recording","key","changed","reported","exports"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/lepu/lepu.recording-watch.ts"],"mappings":";;;;;;AAEA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,MAAME,UAAU,GAAG,IAAI;AACvB,MAAMC,MAAM,GAAG,QAAQ;AAMvB;AACA,MAAMC,kBAAkB,CAAC;EAEfC,OAAO,GAAG,CAAC;EAIZC,WAAWA,CACCC,MAAuB,EACvBC,kBAA8D,EAC/E;IAAA,KAFiBD,MAAuB,GAAvBA,MAAuB;IAAA,KACvBC,kBAA8D,GAA9DA,kBAA8D;EAC9E;;EAEH;EACOC,OAAO,GAAIC,UAA6B,IAAc;IAC3D,MAAMC,QAAQ,GAAG,IAAI,CAACC,KAAK;IAE3B,IAAI,CAACA,KAAK,GAAG,IAAAC,oBAAS,EAACH,UAAU,CAAC,IAAI,CAACH,MAAM,CAACO,SAAS,CAAC,IAAI,IAAI,CAAC,GAAGZ,UAAU;IAC9E,IAAI,CAACG,OAAO,GAAG,IAAAU,wBAAW,EAACL,UAAU,EAAE,IAAI,CAACH,MAAM,CAACS,gBAAgB,CAAC;IACpE,IAAI,CAACC,YAAY,GAAG,IAAI,CAACC,SAAS,CAAC,CAAC,GAAI,IAAI,CAACD,YAAY,IAAI,IAAIE,IAAI,CAAC,CAAC,GAAIC,SAAS;IACpF,IAAI,CAACC,MAAM,CAAC,IAAI,CAACC,WAAW,CAAC,CAAC,CAAC;IAE/B,OAAO,IAAI,CAACV,KAAK,KAAK,IAAI,CAACL,MAAM,CAACgB,UAAU,IAAIZ,QAAQ,KAAK,IAAI,CAACJ,MAAM,CAACgB,UAAU;EACrF,CAAC;;EAED;EACOC,MAAM,GAAGA,CAAA,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