@ovok/native 1.16.1-rc.5 → 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 (712) hide show
  1. package/lib/commonjs/modules/auth/google-return-page/index.js +24 -0
  2. package/lib/commonjs/modules/auth/google-return-page/index.js.map +1 -0
  3. package/lib/commonjs/modules/auth/hooks/use-social-sign-in.web.js +15 -0
  4. package/lib/commonjs/modules/auth/hooks/use-social-sign-in.web.js.map +1 -0
  5. package/lib/commonjs/modules/auth/index.js +21 -10
  6. package/lib/commonjs/modules/auth/index.js.map +1 -1
  7. package/lib/commonjs/modules/auth/session/logout-session.js +1 -1
  8. package/lib/commonjs/modules/auth/sign-in/components/social-logins/apple-login-button.web.js +73 -0
  9. package/lib/commonjs/modules/auth/sign-in/components/social-logins/apple-login-button.web.js.map +1 -0
  10. package/lib/commonjs/modules/auth/sign-in/components/social-logins/apple-login.js +1 -1
  11. package/lib/commonjs/modules/auth/sign-in/components/social-logins/google-login-button.web.js +73 -0
  12. package/lib/commonjs/modules/auth/sign-in/components/social-logins/google-login-button.web.js.map +1 -0
  13. package/lib/commonjs/modules/auth/sign-in/components/social-logins/google-login.js +1 -1
  14. package/lib/commonjs/modules/auth/sign-in/index.js +24 -0
  15. package/lib/commonjs/modules/auth/sign-in/index.js.map +1 -1
  16. package/lib/commonjs/modules/auth/sign-in/utils/apple-web-sign-in.js +90 -0
  17. package/lib/commonjs/modules/auth/sign-in/utils/apple-web-sign-in.js.map +1 -0
  18. package/lib/commonjs/modules/auth/sign-in/utils/google-redirect-sign-in.js +89 -0
  19. package/lib/commonjs/modules/auth/sign-in/utils/google-redirect-sign-in.js.map +1 -0
  20. package/lib/commonjs/modules/auth/sign-in/utils/jwt-claims.js +21 -0
  21. package/lib/commonjs/modules/auth/sign-in/utils/jwt-claims.js.map +1 -0
  22. package/lib/commonjs/modules/auth/utils/sign-out-google.web.js +10 -0
  23. package/lib/commonjs/modules/auth/utils/sign-out-google.web.js.map +1 -0
  24. package/lib/commonjs/modules/bt-management/components/bt-provider-child-wrapper.js +19 -7
  25. package/lib/commonjs/modules/bt-management/components/bt-provider-child-wrapper.js.map +1 -1
  26. package/lib/commonjs/modules/bt-management/hooks/runtime-context.js.map +1 -1
  27. package/lib/commonjs/modules/bt-management/index.js +12 -0
  28. package/lib/commonjs/modules/bt-management/index.js.map +1 -1
  29. package/lib/commonjs/modules/bt-management/services/bt-manager.js +27 -1
  30. package/lib/commonjs/modules/bt-management/services/bt-manager.js.map +1 -1
  31. package/lib/commonjs/modules/bt-management/services/custom/compile-custom-lepu.js +42 -2
  32. package/lib/commonjs/modules/bt-management/services/custom/compile-custom-lepu.js.map +1 -1
  33. package/lib/commonjs/modules/bt-management/services/devices/blood-glucose/blood-glucose.device.js +64 -44
  34. package/lib/commonjs/modules/bt-management/services/devices/blood-glucose/blood-glucose.device.js.map +1 -1
  35. package/lib/commonjs/modules/bt-management/services/devices/blood-glucose/telebgm.protocol.js +98 -0
  36. package/lib/commonjs/modules/bt-management/services/devices/blood-glucose/telebgm.protocol.js.map +1 -0
  37. package/lib/commonjs/modules/bt-management/services/devices/blood-glucose/telebgm.sequencer.js +127 -0
  38. package/lib/commonjs/modules/bt-management/services/devices/blood-glucose/telebgm.sequencer.js.map +1 -0
  39. package/lib/commonjs/modules/bt-management/services/devices/bp2/bp2.device.js +48 -17
  40. package/lib/commonjs/modules/bt-management/services/devices/bp2/bp2.device.js.map +1 -1
  41. package/lib/commonjs/modules/bt-management/services/devices/bp2/bp2.frame-reader.js +2 -2
  42. package/lib/commonjs/modules/bt-management/services/devices/bp2/bp2.frame-reader.js.map +1 -1
  43. package/lib/commonjs/modules/bt-management/services/devices/bp2/bp2.history-sequencer.js +78 -19
  44. package/lib/commonjs/modules/bt-management/services/devices/bp2/bp2.history-sequencer.js.map +1 -1
  45. package/lib/commonjs/modules/bt-management/services/devices/bt-command-writer.js +30 -2
  46. package/lib/commonjs/modules/bt-management/services/devices/bt-command-writer.js.map +1 -1
  47. package/lib/commonjs/modules/bt-management/services/devices/bt-data-processor.js +11 -3
  48. package/lib/commonjs/modules/bt-management/services/devices/bt-data-processor.js.map +1 -1
  49. package/lib/commonjs/modules/bt-management/services/devices/bt-managed-device.js +48 -3
  50. package/lib/commonjs/modules/bt-management/services/devices/bt-managed-device.js.map +1 -1
  51. package/lib/commonjs/modules/bt-management/services/devices/cofoe/cofoe.records.js +2 -7
  52. package/lib/commonjs/modules/bt-management/services/devices/cofoe/cofoe.records.js.map +1 -1
  53. package/lib/commonjs/modules/bt-management/services/devices/custom/custom-lepu-sequencer.js +6 -2
  54. package/lib/commonjs/modules/bt-management/services/devices/custom/custom-lepu-sequencer.js.map +1 -1
  55. package/lib/commonjs/modules/bt-management/services/devices/custom/custom.device.js +115 -26
  56. package/lib/commonjs/modules/bt-management/services/devices/custom/custom.device.js.map +1 -1
  57. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.advertisement.js +19 -2
  58. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.advertisement.js.map +1 -1
  59. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.connect-retry.js +32 -0
  60. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.connect-retry.js.map +1 -0
  61. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.delivered-files.js +73 -0
  62. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.delivered-files.js.map +1 -0
  63. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.ecg-transfer.js +130 -30
  64. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.ecg-transfer.js.map +1 -1
  65. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.encryption-handshake.js +103 -0
  66. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.encryption-handshake.js.map +1 -0
  67. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.file-transfer.js +20 -14
  68. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.file-transfer.js.map +1 -1
  69. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.frame-reader.js +4 -2
  70. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.frame-reader.js.map +1 -1
  71. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.identity-gate.js +94 -10
  72. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.identity-gate.js.map +1 -1
  73. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.live-ecg-chunks.js +75 -0
  74. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.live-ecg-chunks.js.map +1 -0
  75. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.pulse-wave-chunks.js +113 -0
  76. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.pulse-wave-chunks.js.map +1 -0
  77. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.pulse-wave.js +67 -0
  78. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.pulse-wave.js.map +1 -0
  79. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.recorder.js +55 -0
  80. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.recorder.js.map +1 -0
  81. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.recording-watch.js +57 -0
  82. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.recording-watch.js.map +1 -0
  83. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.session.js +49 -0
  84. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.session.js.map +1 -0
  85. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.stored-files.js +46 -0
  86. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.stored-files.js.map +1 -0
  87. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.transports.js +10 -4
  88. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.transports.js.map +1 -1
  89. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.waveform.js +27 -0
  90. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.waveform.js.map +1 -0
  91. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.bp-monitors.js +0 -1
  92. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.bp-monitors.js.map +1 -1
  93. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.ecg-files.js +75 -20
  94. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.ecg-files.js.map +1 -1
  95. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.js +21 -12
  96. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.js.map +1 -1
  97. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.ecg-recording-status.js +47 -0
  98. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.ecg-recording-status.js.map +1 -0
  99. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.oximeters.js +58 -32
  100. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.oximeters.js.map +1 -1
  101. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.wbp02.protocol.js +3 -7
  102. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.wbp02.protocol.js.map +1 -1
  103. package/lib/commonjs/modules/bt-management/services/series-recorder.js +27 -5
  104. package/lib/commonjs/modules/bt-management/services/series-recorder.js.map +1 -1
  105. package/lib/commonjs/modules/bt-management/types/device-waveform.js +6 -0
  106. package/lib/commonjs/modules/bt-management/types/device-waveform.js.map +1 -0
  107. package/lib/commonjs/modules/bt-management/utils/calculate-crc-16-modbus.js +23 -0
  108. package/lib/commonjs/modules/bt-management/utils/calculate-crc-16-modbus.js.map +1 -0
  109. package/lib/commonjs/modules/bt-management/utils/i-16-from-hex.js.map +1 -1
  110. package/lib/commonjs/modules/bt-management/utils/le-32-from-hex.js.map +1 -1
  111. package/lib/commonjs/modules/bt-management/utils/tenths-mmol-to-mg-per-dl.js +13 -0
  112. package/lib/commonjs/modules/bt-management/utils/tenths-mmol-to-mg-per-dl.js.map +1 -0
  113. package/lib/commonjs/modules/data-sync/components/apple/apple-health-authorization-provider.js +15 -8
  114. package/lib/commonjs/modules/data-sync/components/apple/apple-health-authorization-provider.js.map +1 -1
  115. package/lib/commonjs/modules/data-sync/components/apple/apple-health-authorization-utils.js +1 -1
  116. package/lib/commonjs/modules/data-sync/components/apple/apple-health-authorization-utils.js.map +1 -1
  117. package/lib/commonjs/modules/data-sync/constants.js +4 -1
  118. package/lib/commonjs/modules/data-sync/constants.js.map +1 -1
  119. package/lib/commonjs/modules/data-sync/hooks/use-listen-changes.js +6 -9
  120. package/lib/commonjs/modules/data-sync/hooks/use-listen-changes.js.map +1 -1
  121. package/lib/commonjs/modules/data-sync/services/managers/data-processor.js +8 -7
  122. package/lib/commonjs/modules/data-sync/services/managers/data-processor.js.map +1 -1
  123. package/lib/commonjs/modules/data-sync/types/health-sync-keys.js +13 -0
  124. package/lib/commonjs/modules/data-sync/types/health-sync-keys.js.map +1 -1
  125. package/lib/commonjs/modules/data-sync/utils/convert-ecg-samples-to-observation.js +47 -0
  126. package/lib/commonjs/modules/data-sync/utils/convert-ecg-samples-to-observation.js.map +1 -0
  127. package/lib/commonjs/modules/data-sync/utils/convert-generic-health-data.js +14 -6
  128. package/lib/commonjs/modules/data-sync/utils/convert-generic-health-data.js.map +1 -1
  129. package/lib/commonjs/modules/data-sync/utils/convert-samples-to-observation.js +7 -15
  130. package/lib/commonjs/modules/data-sync/utils/convert-samples-to-observation.js.map +1 -1
  131. package/lib/commonjs/modules/data-sync/utils/default-health-coding.js +68 -0
  132. package/lib/commonjs/modules/data-sync/utils/default-health-coding.js.map +1 -0
  133. package/lib/commonjs/modules/data-sync/utils/get-records-from-health-connect.js +20 -4
  134. package/lib/commonjs/modules/data-sync/utils/get-records-from-health-connect.js.map +1 -1
  135. package/lib/commonjs/modules/data-sync/utils/get-samples-from-health.js +43 -86
  136. package/lib/commonjs/modules/data-sync/utils/get-samples-from-health.js.map +1 -1
  137. package/lib/commonjs/modules/data-sync/utils/get-total-samples-count.js +6 -5
  138. package/lib/commonjs/modules/data-sync/utils/get-total-samples-count.js.map +1 -1
  139. package/lib/commonjs/modules/data-sync/utils/health-data-catalog.js +15 -15
  140. package/lib/commonjs/modules/data-sync/utils/health-data-catalog.js.map +1 -1
  141. package/lib/commonjs/modules/data-sync/utils/health-units.js +11 -1
  142. package/lib/commonjs/modules/data-sync/utils/health-units.js.map +1 -1
  143. package/lib/commonjs/modules/data-sync/utils/healthkit-daily-statistics.js +64 -0
  144. package/lib/commonjs/modules/data-sync/utils/healthkit-daily-statistics.js.map +1 -0
  145. package/lib/commonjs/modules/data-sync/utils/healthkit-data-types.js.map +1 -1
  146. package/lib/commonjs/modules/data-sync/utils/healthkit-query-options.js +20 -0
  147. package/lib/commonjs/modules/data-sync/utils/healthkit-query-options.js.map +1 -0
  148. package/lib/commonjs/modules/data-sync/utils/healthkit-sample-source.js +21 -0
  149. package/lib/commonjs/modules/data-sync/utils/healthkit-sample-source.js.map +1 -0
  150. package/lib/commonjs/modules/data-sync/utils/healthkit-samples.js +59 -0
  151. package/lib/commonjs/modules/data-sync/utils/healthkit-samples.js.map +1 -0
  152. package/lib/commonjs/modules/data-sync/utils/healthkit-series.js +20 -11
  153. package/lib/commonjs/modules/data-sync/utils/healthkit-series.js.map +1 -1
  154. package/lib/commonjs/modules/next/bluetooth/ble-plx/built-in-devices.js +12 -2
  155. package/lib/commonjs/modules/next/bluetooth/ble-plx/built-in-devices.js.map +1 -1
  156. package/lib/commonjs/modules/next/bluetooth/ble-plx/legacy-driver.js +39 -5
  157. package/lib/commonjs/modules/next/bluetooth/ble-plx/legacy-driver.js.map +1 -1
  158. package/lib/commonjs/modules/next/bluetooth/connections.js +45 -2
  159. package/lib/commonjs/modules/next/bluetooth/connections.js.map +1 -1
  160. package/lib/commonjs/modules/next/bluetooth/driver.js.map +1 -1
  161. package/lib/commonjs/modules/next/bluetooth/errors.js.map +1 -1
  162. package/lib/commonjs/modules/next/bluetooth/index.js.map +1 -1
  163. package/lib/commonjs/modules/next/bluetooth/readings.js +10 -2
  164. package/lib/commonjs/modules/next/bluetooth/readings.js.map +1 -1
  165. package/lib/commonjs/modules/next/bluetooth/runtime.js +37 -1
  166. package/lib/commonjs/modules/next/bluetooth/runtime.js.map +1 -1
  167. package/lib/commonjs/modules/next/bluetooth/web/index.js.map +1 -1
  168. package/lib/module/modules/auth/google-return-page/index.js +21 -0
  169. package/lib/module/modules/auth/google-return-page/index.js.map +1 -0
  170. package/lib/module/modules/auth/hooks/use-social-sign-in.web.js +10 -0
  171. package/lib/module/modules/auth/hooks/use-social-sign-in.web.js.map +1 -0
  172. package/lib/module/modules/auth/index.js +2 -1
  173. package/lib/module/modules/auth/index.js.map +1 -1
  174. package/lib/module/modules/auth/session/logout-session.js +1 -1
  175. package/lib/module/modules/auth/session/logout-session.js.map +1 -1
  176. package/lib/module/modules/auth/sign-in/components/social-logins/apple-login-button.web.js +67 -0
  177. package/lib/module/modules/auth/sign-in/components/social-logins/apple-login-button.web.js.map +1 -0
  178. package/lib/module/modules/auth/sign-in/components/social-logins/apple-login.js +1 -1
  179. package/lib/module/modules/auth/sign-in/components/social-logins/apple-login.js.map +1 -1
  180. package/lib/module/modules/auth/sign-in/components/social-logins/google-login-button.web.js +68 -0
  181. package/lib/module/modules/auth/sign-in/components/social-logins/google-login-button.web.js.map +1 -0
  182. package/lib/module/modules/auth/sign-in/components/social-logins/google-login.js +1 -1
  183. package/lib/module/modules/auth/sign-in/components/social-logins/google-login.js.map +1 -1
  184. package/lib/module/modules/auth/sign-in/index.js +2 -0
  185. package/lib/module/modules/auth/sign-in/index.js.map +1 -1
  186. package/lib/module/modules/auth/sign-in/utils/apple-web-sign-in.js +84 -0
  187. package/lib/module/modules/auth/sign-in/utils/apple-web-sign-in.js.map +1 -0
  188. package/lib/module/modules/auth/sign-in/utils/google-redirect-sign-in.js +84 -0
  189. package/lib/module/modules/auth/sign-in/utils/google-redirect-sign-in.js.map +1 -0
  190. package/lib/module/modules/auth/sign-in/utils/jwt-claims.js +17 -0
  191. package/lib/module/modules/auth/sign-in/utils/jwt-claims.js.map +1 -0
  192. package/lib/module/modules/auth/utils/sign-out-google.web.js +5 -0
  193. package/lib/module/modules/auth/utils/sign-out-google.web.js.map +1 -0
  194. package/lib/module/modules/bt-management/components/bt-provider-child-wrapper.js +19 -7
  195. package/lib/module/modules/bt-management/components/bt-provider-child-wrapper.js.map +1 -1
  196. package/lib/module/modules/bt-management/hooks/runtime-context.js.map +1 -1
  197. package/lib/module/modules/bt-management/index.js +1 -0
  198. package/lib/module/modules/bt-management/index.js.map +1 -1
  199. package/lib/module/modules/bt-management/services/bt-manager.js +27 -1
  200. package/lib/module/modules/bt-management/services/bt-manager.js.map +1 -1
  201. package/lib/module/modules/bt-management/services/custom/compile-custom-lepu.js +42 -2
  202. package/lib/module/modules/bt-management/services/custom/compile-custom-lepu.js.map +1 -1
  203. package/lib/module/modules/bt-management/services/devices/blood-glucose/blood-glucose.device.js +64 -44
  204. package/lib/module/modules/bt-management/services/devices/blood-glucose/blood-glucose.device.js.map +1 -1
  205. package/lib/module/modules/bt-management/services/devices/blood-glucose/telebgm.protocol.js +91 -0
  206. package/lib/module/modules/bt-management/services/devices/blood-glucose/telebgm.protocol.js.map +1 -0
  207. package/lib/module/modules/bt-management/services/devices/blood-glucose/telebgm.sequencer.js +123 -0
  208. package/lib/module/modules/bt-management/services/devices/blood-glucose/telebgm.sequencer.js.map +1 -0
  209. package/lib/module/modules/bt-management/services/devices/bp2/bp2.device.js +48 -17
  210. package/lib/module/modules/bt-management/services/devices/bp2/bp2.device.js.map +1 -1
  211. package/lib/module/modules/bt-management/services/devices/bp2/bp2.frame-reader.js +2 -3
  212. package/lib/module/modules/bt-management/services/devices/bp2/bp2.frame-reader.js.map +1 -1
  213. package/lib/module/modules/bt-management/services/devices/bp2/bp2.history-sequencer.js +77 -19
  214. package/lib/module/modules/bt-management/services/devices/bp2/bp2.history-sequencer.js.map +1 -1
  215. package/lib/module/modules/bt-management/services/devices/bt-command-writer.js +30 -2
  216. package/lib/module/modules/bt-management/services/devices/bt-command-writer.js.map +1 -1
  217. package/lib/module/modules/bt-management/services/devices/bt-data-processor.js +11 -3
  218. package/lib/module/modules/bt-management/services/devices/bt-data-processor.js.map +1 -1
  219. package/lib/module/modules/bt-management/services/devices/bt-managed-device.js +48 -3
  220. package/lib/module/modules/bt-management/services/devices/bt-managed-device.js.map +1 -1
  221. package/lib/module/modules/bt-management/services/devices/cofoe/cofoe.records.js +2 -7
  222. package/lib/module/modules/bt-management/services/devices/cofoe/cofoe.records.js.map +1 -1
  223. package/lib/module/modules/bt-management/services/devices/custom/custom-lepu-sequencer.js +6 -2
  224. package/lib/module/modules/bt-management/services/devices/custom/custom-lepu-sequencer.js.map +1 -1
  225. package/lib/module/modules/bt-management/services/devices/custom/custom.device.js +115 -26
  226. package/lib/module/modules/bt-management/services/devices/custom/custom.device.js.map +1 -1
  227. package/lib/module/modules/bt-management/services/devices/lepu/lepu.advertisement.js +17 -1
  228. package/lib/module/modules/bt-management/services/devices/lepu/lepu.advertisement.js.map +1 -1
  229. package/lib/module/modules/bt-management/services/devices/lepu/lepu.connect-retry.js +28 -0
  230. package/lib/module/modules/bt-management/services/devices/lepu/lepu.connect-retry.js.map +1 -0
  231. package/lib/module/modules/bt-management/services/devices/lepu/lepu.delivered-files.js +69 -0
  232. package/lib/module/modules/bt-management/services/devices/lepu/lepu.delivered-files.js.map +1 -0
  233. package/lib/module/modules/bt-management/services/devices/lepu/lepu.ecg-transfer.js +129 -30
  234. package/lib/module/modules/bt-management/services/devices/lepu/lepu.ecg-transfer.js.map +1 -1
  235. package/lib/module/modules/bt-management/services/devices/lepu/lepu.encryption-handshake.js +99 -0
  236. package/lib/module/modules/bt-management/services/devices/lepu/lepu.encryption-handshake.js.map +1 -0
  237. package/lib/module/modules/bt-management/services/devices/lepu/lepu.file-transfer.js +20 -14
  238. package/lib/module/modules/bt-management/services/devices/lepu/lepu.file-transfer.js.map +1 -1
  239. package/lib/module/modules/bt-management/services/devices/lepu/lepu.frame-reader.js +4 -2
  240. package/lib/module/modules/bt-management/services/devices/lepu/lepu.frame-reader.js.map +1 -1
  241. package/lib/module/modules/bt-management/services/devices/lepu/lepu.identity-gate.js +94 -10
  242. package/lib/module/modules/bt-management/services/devices/lepu/lepu.identity-gate.js.map +1 -1
  243. package/lib/module/modules/bt-management/services/devices/lepu/lepu.live-ecg-chunks.js +72 -0
  244. package/lib/module/modules/bt-management/services/devices/lepu/lepu.live-ecg-chunks.js.map +1 -0
  245. package/lib/module/modules/bt-management/services/devices/lepu/lepu.pulse-wave-chunks.js +109 -0
  246. package/lib/module/modules/bt-management/services/devices/lepu/lepu.pulse-wave-chunks.js.map +1 -0
  247. package/lib/module/modules/bt-management/services/devices/lepu/lepu.pulse-wave.js +64 -0
  248. package/lib/module/modules/bt-management/services/devices/lepu/lepu.pulse-wave.js.map +1 -0
  249. package/lib/module/modules/bt-management/services/devices/lepu/lepu.recorder.js +51 -0
  250. package/lib/module/modules/bt-management/services/devices/lepu/lepu.recorder.js.map +1 -0
  251. package/lib/module/modules/bt-management/services/devices/lepu/lepu.recording-watch.js +53 -0
  252. package/lib/module/modules/bt-management/services/devices/lepu/lepu.recording-watch.js.map +1 -0
  253. package/lib/module/modules/bt-management/services/devices/lepu/lepu.session.js +45 -0
  254. package/lib/module/modules/bt-management/services/devices/lepu/lepu.session.js.map +1 -0
  255. package/lib/module/modules/bt-management/services/devices/lepu/lepu.stored-files.js +42 -0
  256. package/lib/module/modules/bt-management/services/devices/lepu/lepu.stored-files.js.map +1 -0
  257. package/lib/module/modules/bt-management/services/devices/lepu/lepu.transports.js +10 -4
  258. package/lib/module/modules/bt-management/services/devices/lepu/lepu.transports.js.map +1 -1
  259. package/lib/module/modules/bt-management/services/devices/lepu/lepu.waveform.js +22 -0
  260. package/lib/module/modules/bt-management/services/devices/lepu/lepu.waveform.js.map +1 -0
  261. package/lib/module/modules/bt-management/services/devices/viatom/viatom.bp-monitors.js +0 -1
  262. package/lib/module/modules/bt-management/services/devices/viatom/viatom.bp-monitors.js.map +1 -1
  263. package/lib/module/modules/bt-management/services/devices/viatom/viatom.ecg-files.js +75 -21
  264. package/lib/module/modules/bt-management/services/devices/viatom/viatom.ecg-files.js.map +1 -1
  265. package/lib/module/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.js +21 -12
  266. package/lib/module/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.js.map +1 -1
  267. package/lib/module/modules/bt-management/services/devices/viatom/viatom.ecg-recording-status.js +44 -0
  268. package/lib/module/modules/bt-management/services/devices/viatom/viatom.ecg-recording-status.js.map +1 -0
  269. package/lib/module/modules/bt-management/services/devices/viatom/viatom.oximeters.js +58 -32
  270. package/lib/module/modules/bt-management/services/devices/viatom/viatom.oximeters.js.map +1 -1
  271. package/lib/module/modules/bt-management/services/devices/viatom/viatom.wbp02.protocol.js +3 -7
  272. package/lib/module/modules/bt-management/services/devices/viatom/viatom.wbp02.protocol.js.map +1 -1
  273. package/lib/module/modules/bt-management/services/series-recorder.js +27 -5
  274. package/lib/module/modules/bt-management/services/series-recorder.js.map +1 -1
  275. package/lib/module/modules/bt-management/types/device-waveform.js +4 -0
  276. package/lib/module/modules/bt-management/types/device-waveform.js.map +1 -0
  277. package/lib/module/modules/bt-management/utils/calculate-crc-16-modbus.js +18 -0
  278. package/lib/module/modules/bt-management/utils/calculate-crc-16-modbus.js.map +1 -0
  279. package/lib/module/modules/bt-management/utils/i-16-from-hex.js.map +1 -1
  280. package/lib/module/modules/bt-management/utils/le-32-from-hex.js.map +1 -1
  281. package/lib/module/modules/bt-management/utils/tenths-mmol-to-mg-per-dl.js +8 -0
  282. package/lib/module/modules/bt-management/utils/tenths-mmol-to-mg-per-dl.js.map +1 -0
  283. package/lib/module/modules/data-sync/components/apple/apple-health-authorization-provider.js +16 -9
  284. package/lib/module/modules/data-sync/components/apple/apple-health-authorization-provider.js.map +1 -1
  285. package/lib/module/modules/data-sync/components/apple/apple-health-authorization-utils.js +2 -2
  286. package/lib/module/modules/data-sync/components/apple/apple-health-authorization-utils.js.map +1 -1
  287. package/lib/module/modules/data-sync/constants.js +4 -1
  288. package/lib/module/modules/data-sync/constants.js.map +1 -1
  289. package/lib/module/modules/data-sync/hooks/use-listen-changes.js +7 -10
  290. package/lib/module/modules/data-sync/hooks/use-listen-changes.js.map +1 -1
  291. package/lib/module/modules/data-sync/services/managers/data-processor.js +8 -7
  292. package/lib/module/modules/data-sync/services/managers/data-processor.js.map +1 -1
  293. package/lib/module/modules/data-sync/types/health-sync-keys.js +13 -0
  294. package/lib/module/modules/data-sync/types/health-sync-keys.js.map +1 -1
  295. package/lib/module/modules/data-sync/utils/convert-ecg-samples-to-observation.js +43 -0
  296. package/lib/module/modules/data-sync/utils/convert-ecg-samples-to-observation.js.map +1 -0
  297. package/lib/module/modules/data-sync/utils/convert-generic-health-data.js +14 -6
  298. package/lib/module/modules/data-sync/utils/convert-generic-health-data.js.map +1 -1
  299. package/lib/module/modules/data-sync/utils/convert-samples-to-observation.js +7 -15
  300. package/lib/module/modules/data-sync/utils/convert-samples-to-observation.js.map +1 -1
  301. package/lib/module/modules/data-sync/utils/default-health-coding.js +65 -0
  302. package/lib/module/modules/data-sync/utils/default-health-coding.js.map +1 -0
  303. package/lib/module/modules/data-sync/utils/get-records-from-health-connect.js +20 -4
  304. package/lib/module/modules/data-sync/utils/get-records-from-health-connect.js.map +1 -1
  305. package/lib/module/modules/data-sync/utils/get-samples-from-health.js +44 -87
  306. package/lib/module/modules/data-sync/utils/get-samples-from-health.js.map +1 -1
  307. package/lib/module/modules/data-sync/utils/get-total-samples-count.js +5 -4
  308. package/lib/module/modules/data-sync/utils/get-total-samples-count.js.map +1 -1
  309. package/lib/module/modules/data-sync/utils/health-data-catalog.js +15 -15
  310. package/lib/module/modules/data-sync/utils/health-data-catalog.js.map +1 -1
  311. package/lib/module/modules/data-sync/utils/health-units.js +11 -1
  312. package/lib/module/modules/data-sync/utils/health-units.js.map +1 -1
  313. package/lib/module/modules/data-sync/utils/healthkit-daily-statistics.js +59 -0
  314. package/lib/module/modules/data-sync/utils/healthkit-daily-statistics.js.map +1 -0
  315. package/lib/module/modules/data-sync/utils/healthkit-data-types.js.map +1 -1
  316. package/lib/module/modules/data-sync/utils/healthkit-query-options.js +16 -0
  317. package/lib/module/modules/data-sync/utils/healthkit-query-options.js.map +1 -0
  318. package/lib/module/modules/data-sync/utils/healthkit-sample-source.js +17 -0
  319. package/lib/module/modules/data-sync/utils/healthkit-sample-source.js.map +1 -0
  320. package/lib/module/modules/data-sync/utils/healthkit-samples.js +52 -0
  321. package/lib/module/modules/data-sync/utils/healthkit-samples.js.map +1 -0
  322. package/lib/module/modules/data-sync/utils/healthkit-series.js +19 -10
  323. package/lib/module/modules/data-sync/utils/healthkit-series.js.map +1 -1
  324. package/lib/module/modules/next/bluetooth/ble-plx/built-in-devices.js +12 -2
  325. package/lib/module/modules/next/bluetooth/ble-plx/built-in-devices.js.map +1 -1
  326. package/lib/module/modules/next/bluetooth/ble-plx/legacy-driver.js +39 -5
  327. package/lib/module/modules/next/bluetooth/ble-plx/legacy-driver.js.map +1 -1
  328. package/lib/module/modules/next/bluetooth/connections.js +45 -2
  329. package/lib/module/modules/next/bluetooth/connections.js.map +1 -1
  330. package/lib/module/modules/next/bluetooth/driver.js.map +1 -1
  331. package/lib/module/modules/next/bluetooth/errors.js.map +1 -1
  332. package/lib/module/modules/next/bluetooth/index.js.map +1 -1
  333. package/lib/module/modules/next/bluetooth/readings.js +10 -2
  334. package/lib/module/modules/next/bluetooth/readings.js.map +1 -1
  335. package/lib/module/modules/next/bluetooth/runtime.js +37 -1
  336. package/lib/module/modules/next/bluetooth/runtime.js.map +1 -1
  337. package/lib/module/modules/next/bluetooth/web/index.js.map +1 -1
  338. package/lib/typescript/commonjs/src/modules/auth/google-return-page/index.d.ts +8 -0
  339. package/lib/typescript/commonjs/src/modules/auth/google-return-page/index.d.ts.map +1 -0
  340. package/lib/typescript/commonjs/src/modules/auth/hooks/use-social-sign-in.web.d.ts +7 -0
  341. package/lib/typescript/commonjs/src/modules/auth/hooks/use-social-sign-in.web.d.ts.map +1 -0
  342. package/lib/typescript/commonjs/src/modules/auth/index.d.ts +1 -0
  343. package/lib/typescript/commonjs/src/modules/auth/index.d.ts.map +1 -1
  344. package/lib/typescript/commonjs/src/modules/auth/register/components/register.d.ts +2 -2
  345. package/lib/typescript/commonjs/src/modules/auth/sign-in/components/sign-in.d.ts +2 -2
  346. package/lib/typescript/commonjs/src/modules/auth/sign-in/components/social-logins/apple-login-button.web.d.ts +5 -0
  347. package/lib/typescript/commonjs/src/modules/auth/sign-in/components/social-logins/apple-login-button.web.d.ts.map +1 -0
  348. package/lib/typescript/commonjs/src/modules/auth/sign-in/components/social-logins/apple-login.d.ts +1 -1
  349. package/lib/typescript/commonjs/src/modules/auth/sign-in/components/social-logins/google-login-button.web.d.ts +5 -0
  350. package/lib/typescript/commonjs/src/modules/auth/sign-in/components/social-logins/google-login-button.web.d.ts.map +1 -0
  351. package/lib/typescript/commonjs/src/modules/auth/sign-in/components/social-logins/google-login.d.ts +1 -1
  352. package/lib/typescript/commonjs/src/modules/auth/sign-in/components/social-logins/social-logins.d.ts +2 -2
  353. package/lib/typescript/commonjs/src/modules/auth/sign-in/index.d.ts +2 -0
  354. package/lib/typescript/commonjs/src/modules/auth/sign-in/index.d.ts.map +1 -1
  355. package/lib/typescript/commonjs/src/modules/auth/sign-in/types/apple-login-props.d.ts +13 -0
  356. package/lib/typescript/commonjs/src/modules/auth/sign-in/types/apple-login-props.d.ts.map +1 -1
  357. package/lib/typescript/commonjs/src/modules/auth/sign-in/types/google-login-props.d.ts +13 -0
  358. package/lib/typescript/commonjs/src/modules/auth/sign-in/types/google-login-props.d.ts.map +1 -1
  359. package/lib/typescript/commonjs/src/modules/auth/sign-in/utils/apple-web-sign-in.d.ts +17 -0
  360. package/lib/typescript/commonjs/src/modules/auth/sign-in/utils/apple-web-sign-in.d.ts.map +1 -0
  361. package/lib/typescript/commonjs/src/modules/auth/sign-in/utils/google-redirect-sign-in.d.ts +14 -0
  362. package/lib/typescript/commonjs/src/modules/auth/sign-in/utils/google-redirect-sign-in.d.ts.map +1 -0
  363. package/lib/typescript/commonjs/src/modules/auth/sign-in/utils/jwt-claims.d.ts +9 -0
  364. package/lib/typescript/commonjs/src/modules/auth/sign-in/utils/jwt-claims.d.ts.map +1 -0
  365. package/lib/typescript/commonjs/src/modules/auth/utils/sign-out-google.web.d.ts +3 -0
  366. package/lib/typescript/commonjs/src/modules/auth/utils/sign-out-google.web.d.ts.map +1 -0
  367. package/lib/typescript/commonjs/src/modules/bt-management/components/bt-provider-child-wrapper.d.ts.map +1 -1
  368. package/lib/typescript/commonjs/src/modules/bt-management/hooks/runtime-context.d.ts +4 -1
  369. package/lib/typescript/commonjs/src/modules/bt-management/hooks/runtime-context.d.ts.map +1 -1
  370. package/lib/typescript/commonjs/src/modules/bt-management/index.d.ts +1 -0
  371. package/lib/typescript/commonjs/src/modules/bt-management/index.d.ts.map +1 -1
  372. package/lib/typescript/commonjs/src/modules/bt-management/services/bt-manager.d.ts +21 -5
  373. package/lib/typescript/commonjs/src/modules/bt-management/services/bt-manager.d.ts.map +1 -1
  374. package/lib/typescript/commonjs/src/modules/bt-management/services/custom/compile-custom-lepu.d.ts.map +1 -1
  375. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/blood-glucose/blood-glucose.device.d.ts.map +1 -1
  376. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/blood-glucose/telebgm.protocol.d.ts +34 -0
  377. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/blood-glucose/telebgm.protocol.d.ts.map +1 -0
  378. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/blood-glucose/telebgm.sequencer.d.ts +32 -0
  379. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/blood-glucose/telebgm.sequencer.d.ts.map +1 -0
  380. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bp2/bp2.device.d.ts +4 -0
  381. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bp2/bp2.device.d.ts.map +1 -1
  382. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bp2/bp2.frame-reader.d.ts +2 -1
  383. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bp2/bp2.frame-reader.d.ts.map +1 -1
  384. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bp2/bp2.history-sequencer.d.ts +29 -3
  385. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bp2/bp2.history-sequencer.d.ts.map +1 -1
  386. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-command-writer.d.ts +6 -1
  387. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-command-writer.d.ts.map +1 -1
  388. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-data-processor.d.ts +2 -0
  389. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-data-processor.d.ts.map +1 -1
  390. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-managed-device.d.ts +23 -3
  391. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-managed-device.d.ts.map +1 -1
  392. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/cofoe/cofoe.records.d.ts.map +1 -1
  393. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/custom/custom-lepu-sequencer.d.ts +6 -3
  394. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/custom/custom-lepu-sequencer.d.ts.map +1 -1
  395. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/custom/custom.device.d.ts +20 -0
  396. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/custom/custom.device.d.ts.map +1 -1
  397. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.advertisement.d.ts +8 -1
  398. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.advertisement.d.ts.map +1 -1
  399. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.connect-retry.d.ts +12 -0
  400. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.connect-retry.d.ts.map +1 -0
  401. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.delivered-files.d.ts +24 -0
  402. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.delivered-files.d.ts.map +1 -0
  403. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.ecg-transfer.d.ts +40 -5
  404. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.ecg-transfer.d.ts.map +1 -1
  405. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.encryption-handshake.d.ts +20 -0
  406. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.encryption-handshake.d.ts.map +1 -0
  407. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.file-transfer.d.ts +6 -3
  408. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.file-transfer.d.ts.map +1 -1
  409. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.frame-reader.d.ts +3 -1
  410. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.frame-reader.d.ts.map +1 -1
  411. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.identity-gate.d.ts +26 -1
  412. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.identity-gate.d.ts.map +1 -1
  413. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.live-ecg-chunks.d.ts +42 -0
  414. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.live-ecg-chunks.d.ts.map +1 -0
  415. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.pulse-wave-chunks.d.ts +28 -0
  416. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.pulse-wave-chunks.d.ts.map +1 -0
  417. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.pulse-wave.d.ts +16 -0
  418. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.pulse-wave.d.ts.map +1 -0
  419. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.recorder.d.ts +32 -0
  420. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.recorder.d.ts.map +1 -0
  421. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.recording-watch.d.ts +28 -0
  422. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.recording-watch.d.ts.map +1 -0
  423. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.session.d.ts +17 -0
  424. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.session.d.ts.map +1 -0
  425. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.stored-files.d.ts +33 -0
  426. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.stored-files.d.ts.map +1 -0
  427. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.transports.d.ts +6 -1
  428. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.transports.d.ts.map +1 -1
  429. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.waveform.d.ts +9 -0
  430. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.waveform.d.ts.map +1 -0
  431. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.bp-monitors.d.ts.map +1 -1
  432. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.ecg-files.d.ts +9 -3
  433. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.ecg-files.d.ts.map +1 -1
  434. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.d.ts.map +1 -1
  435. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.ecg-recording-status.d.ts +8 -0
  436. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.ecg-recording-status.d.ts.map +1 -0
  437. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.oximeters.d.ts.map +1 -1
  438. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.wbp02.protocol.d.ts.map +1 -1
  439. package/lib/typescript/commonjs/src/modules/bt-management/services/series-recorder.d.ts +6 -1
  440. package/lib/typescript/commonjs/src/modules/bt-management/services/series-recorder.d.ts.map +1 -1
  441. package/lib/typescript/commonjs/src/modules/bt-management/types/create-device-params.d.ts +7 -1
  442. package/lib/typescript/commonjs/src/modules/bt-management/types/create-device-params.d.ts.map +1 -1
  443. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-lepu-spec.d.ts +47 -3
  444. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-lepu-spec.d.ts.map +1 -1
  445. package/lib/typescript/commonjs/src/modules/bt-management/types/device-connection-event.d.ts +17 -1
  446. package/lib/typescript/commonjs/src/modules/bt-management/types/device-connection-event.d.ts.map +1 -1
  447. package/lib/typescript/commonjs/src/modules/bt-management/types/device-waveform.d.ts +15 -0
  448. package/lib/typescript/commonjs/src/modules/bt-management/types/device-waveform.d.ts.map +1 -0
  449. package/lib/typescript/commonjs/src/modules/bt-management/utils/calculate-crc-16-modbus.d.ts +3 -0
  450. package/lib/typescript/commonjs/src/modules/bt-management/utils/calculate-crc-16-modbus.d.ts.map +1 -0
  451. package/lib/typescript/commonjs/src/modules/bt-management/utils/i-16-from-hex.d.ts +1 -1
  452. package/lib/typescript/commonjs/src/modules/bt-management/utils/i-16-from-hex.d.ts.map +1 -1
  453. package/lib/typescript/commonjs/src/modules/bt-management/utils/le-32-from-hex.d.ts +1 -1
  454. package/lib/typescript/commonjs/src/modules/bt-management/utils/le-32-from-hex.d.ts.map +1 -1
  455. package/lib/typescript/commonjs/src/modules/bt-management/utils/tenths-mmol-to-mg-per-dl.d.ts +3 -0
  456. package/lib/typescript/commonjs/src/modules/bt-management/utils/tenths-mmol-to-mg-per-dl.d.ts.map +1 -0
  457. package/lib/typescript/commonjs/src/modules/data-sync/components/apple/apple-health-authorization-provider.d.ts.map +1 -1
  458. package/lib/typescript/commonjs/src/modules/data-sync/components/apple/apple-health-authorization-utils.d.ts +2 -2
  459. package/lib/typescript/commonjs/src/modules/data-sync/components/apple/apple-health-authorization-utils.d.ts.map +1 -1
  460. package/lib/typescript/commonjs/src/modules/data-sync/constants.d.ts +3 -1
  461. package/lib/typescript/commonjs/src/modules/data-sync/constants.d.ts.map +1 -1
  462. package/lib/typescript/commonjs/src/modules/data-sync/hooks/use-listen-changes.d.ts.map +1 -1
  463. package/lib/typescript/commonjs/src/modules/data-sync/services/managers/data-processor.d.ts.map +1 -1
  464. package/lib/typescript/commonjs/src/modules/data-sync/types/apple-health-authorization-provider-props.d.ts +2 -2
  465. package/lib/typescript/commonjs/src/modules/data-sync/types/apple-health-authorization-provider-props.d.ts.map +1 -1
  466. package/lib/typescript/commonjs/src/modules/data-sync/types/apple-health-sync-props.d.ts +4 -7
  467. package/lib/typescript/commonjs/src/modules/data-sync/types/apple-health-sync-props.d.ts.map +1 -1
  468. package/lib/typescript/commonjs/src/modules/data-sync/types/get-data-from-provider-props.d.ts +3 -1
  469. package/lib/typescript/commonjs/src/modules/data-sync/types/get-data-from-provider-props.d.ts.map +1 -1
  470. package/lib/typescript/commonjs/src/modules/data-sync/types/health-authorization-status.d.ts +2 -2
  471. package/lib/typescript/commonjs/src/modules/data-sync/types/health-authorization-status.d.ts.map +1 -1
  472. package/lib/typescript/commonjs/src/modules/data-sync/types/health-sync-keys.d.ts +11 -1
  473. package/lib/typescript/commonjs/src/modules/data-sync/types/health-sync-keys.d.ts.map +1 -1
  474. package/lib/typescript/commonjs/src/modules/data-sync/types/health-sync-props.d.ts +1 -1
  475. package/lib/typescript/commonjs/src/modules/data-sync/types/health-sync-props.d.ts.map +1 -1
  476. package/lib/typescript/commonjs/src/modules/data-sync/utils/convert-ecg-samples-to-observation.d.ts +6 -0
  477. package/lib/typescript/commonjs/src/modules/data-sync/utils/convert-ecg-samples-to-observation.d.ts.map +1 -0
  478. package/lib/typescript/commonjs/src/modules/data-sync/utils/convert-generic-health-data.d.ts +1 -1
  479. package/lib/typescript/commonjs/src/modules/data-sync/utils/convert-generic-health-data.d.ts.map +1 -1
  480. package/lib/typescript/commonjs/src/modules/data-sync/utils/convert-samples-to-observation.d.ts.map +1 -1
  481. package/lib/typescript/commonjs/src/modules/data-sync/utils/default-health-coding.d.ts +10 -0
  482. package/lib/typescript/commonjs/src/modules/data-sync/utils/default-health-coding.d.ts.map +1 -0
  483. package/lib/typescript/commonjs/src/modules/data-sync/utils/get-records-from-health-connect.d.ts +1 -1
  484. package/lib/typescript/commonjs/src/modules/data-sync/utils/get-records-from-health-connect.d.ts.map +1 -1
  485. package/lib/typescript/commonjs/src/modules/data-sync/utils/get-samples-from-health.d.ts +12 -46
  486. package/lib/typescript/commonjs/src/modules/data-sync/utils/get-samples-from-health.d.ts.map +1 -1
  487. package/lib/typescript/commonjs/src/modules/data-sync/utils/get-total-samples-count.d.ts.map +1 -1
  488. package/lib/typescript/commonjs/src/modules/data-sync/utils/health-data-catalog.d.ts.map +1 -1
  489. package/lib/typescript/commonjs/src/modules/data-sync/utils/health-units.d.ts +2 -2
  490. package/lib/typescript/commonjs/src/modules/data-sync/utils/health-units.d.ts.map +1 -1
  491. package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-daily-statistics.d.ts +10 -0
  492. package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-daily-statistics.d.ts.map +1 -0
  493. package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-data-types.d.ts +5 -5
  494. package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-data-types.d.ts.map +1 -1
  495. package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-query-options.d.ts +7 -0
  496. package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-query-options.d.ts.map +1 -0
  497. package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-sample-source.d.ts +8 -0
  498. package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-sample-source.d.ts.map +1 -0
  499. package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-samples.d.ts +30 -0
  500. package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-samples.d.ts.map +1 -0
  501. package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-series.d.ts +2 -2
  502. package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-series.d.ts.map +1 -1
  503. package/lib/typescript/commonjs/src/modules/data-sync/utils/to-core-health-observations.d.ts +1 -0
  504. package/lib/typescript/commonjs/src/modules/data-sync/utils/to-core-health-observations.d.ts.map +1 -1
  505. package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/built-in-devices.d.ts +12 -1
  506. package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/built-in-devices.d.ts.map +1 -1
  507. package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/legacy-driver.d.ts +2 -1
  508. package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/legacy-driver.d.ts.map +1 -1
  509. package/lib/typescript/commonjs/src/modules/next/bluetooth/connections.d.ts +13 -1
  510. package/lib/typescript/commonjs/src/modules/next/bluetooth/connections.d.ts.map +1 -1
  511. package/lib/typescript/commonjs/src/modules/next/bluetooth/driver.d.ts +20 -0
  512. package/lib/typescript/commonjs/src/modules/next/bluetooth/driver.d.ts.map +1 -1
  513. package/lib/typescript/commonjs/src/modules/next/bluetooth/errors.d.ts +1 -1
  514. package/lib/typescript/commonjs/src/modules/next/bluetooth/errors.d.ts.map +1 -1
  515. package/lib/typescript/commonjs/src/modules/next/bluetooth/index.d.ts +2 -1
  516. package/lib/typescript/commonjs/src/modules/next/bluetooth/index.d.ts.map +1 -1
  517. package/lib/typescript/commonjs/src/modules/next/bluetooth/readings.d.ts +3 -2
  518. package/lib/typescript/commonjs/src/modules/next/bluetooth/readings.d.ts.map +1 -1
  519. package/lib/typescript/commonjs/src/modules/next/bluetooth/runtime.d.ts +19 -1
  520. package/lib/typescript/commonjs/src/modules/next/bluetooth/runtime.d.ts.map +1 -1
  521. package/lib/typescript/commonjs/src/modules/next/bluetooth/snapshot.d.ts +33 -1
  522. package/lib/typescript/commonjs/src/modules/next/bluetooth/snapshot.d.ts.map +1 -1
  523. package/lib/typescript/commonjs/src/modules/next/bluetooth/web/index.d.ts +1 -0
  524. package/lib/typescript/commonjs/src/modules/next/bluetooth/web/index.d.ts.map +1 -1
  525. package/lib/typescript/module/src/modules/auth/google-return-page/index.d.ts +8 -0
  526. package/lib/typescript/module/src/modules/auth/google-return-page/index.d.ts.map +1 -0
  527. package/lib/typescript/module/src/modules/auth/hooks/use-social-sign-in.web.d.ts +7 -0
  528. package/lib/typescript/module/src/modules/auth/hooks/use-social-sign-in.web.d.ts.map +1 -0
  529. package/lib/typescript/module/src/modules/auth/index.d.ts +1 -0
  530. package/lib/typescript/module/src/modules/auth/index.d.ts.map +1 -1
  531. package/lib/typescript/module/src/modules/auth/register/components/register.d.ts +2 -2
  532. package/lib/typescript/module/src/modules/auth/sign-in/components/sign-in.d.ts +2 -2
  533. package/lib/typescript/module/src/modules/auth/sign-in/components/social-logins/apple-login-button.web.d.ts +5 -0
  534. package/lib/typescript/module/src/modules/auth/sign-in/components/social-logins/apple-login-button.web.d.ts.map +1 -0
  535. package/lib/typescript/module/src/modules/auth/sign-in/components/social-logins/apple-login.d.ts +1 -1
  536. package/lib/typescript/module/src/modules/auth/sign-in/components/social-logins/google-login-button.web.d.ts +5 -0
  537. package/lib/typescript/module/src/modules/auth/sign-in/components/social-logins/google-login-button.web.d.ts.map +1 -0
  538. package/lib/typescript/module/src/modules/auth/sign-in/components/social-logins/google-login.d.ts +1 -1
  539. package/lib/typescript/module/src/modules/auth/sign-in/components/social-logins/social-logins.d.ts +2 -2
  540. package/lib/typescript/module/src/modules/auth/sign-in/index.d.ts +2 -0
  541. package/lib/typescript/module/src/modules/auth/sign-in/index.d.ts.map +1 -1
  542. package/lib/typescript/module/src/modules/auth/sign-in/types/apple-login-props.d.ts +13 -0
  543. package/lib/typescript/module/src/modules/auth/sign-in/types/apple-login-props.d.ts.map +1 -1
  544. package/lib/typescript/module/src/modules/auth/sign-in/types/google-login-props.d.ts +13 -0
  545. package/lib/typescript/module/src/modules/auth/sign-in/types/google-login-props.d.ts.map +1 -1
  546. package/lib/typescript/module/src/modules/auth/sign-in/utils/apple-web-sign-in.d.ts +17 -0
  547. package/lib/typescript/module/src/modules/auth/sign-in/utils/apple-web-sign-in.d.ts.map +1 -0
  548. package/lib/typescript/module/src/modules/auth/sign-in/utils/google-redirect-sign-in.d.ts +14 -0
  549. package/lib/typescript/module/src/modules/auth/sign-in/utils/google-redirect-sign-in.d.ts.map +1 -0
  550. package/lib/typescript/module/src/modules/auth/sign-in/utils/jwt-claims.d.ts +9 -0
  551. package/lib/typescript/module/src/modules/auth/sign-in/utils/jwt-claims.d.ts.map +1 -0
  552. package/lib/typescript/module/src/modules/auth/utils/sign-out-google.web.d.ts +3 -0
  553. package/lib/typescript/module/src/modules/auth/utils/sign-out-google.web.d.ts.map +1 -0
  554. package/lib/typescript/module/src/modules/bt-management/components/bt-provider-child-wrapper.d.ts.map +1 -1
  555. package/lib/typescript/module/src/modules/bt-management/hooks/runtime-context.d.ts +4 -1
  556. package/lib/typescript/module/src/modules/bt-management/hooks/runtime-context.d.ts.map +1 -1
  557. package/lib/typescript/module/src/modules/bt-management/index.d.ts +1 -0
  558. package/lib/typescript/module/src/modules/bt-management/index.d.ts.map +1 -1
  559. package/lib/typescript/module/src/modules/bt-management/services/bt-manager.d.ts +21 -5
  560. package/lib/typescript/module/src/modules/bt-management/services/bt-manager.d.ts.map +1 -1
  561. package/lib/typescript/module/src/modules/bt-management/services/custom/compile-custom-lepu.d.ts.map +1 -1
  562. package/lib/typescript/module/src/modules/bt-management/services/devices/blood-glucose/blood-glucose.device.d.ts.map +1 -1
  563. package/lib/typescript/module/src/modules/bt-management/services/devices/blood-glucose/telebgm.protocol.d.ts +34 -0
  564. package/lib/typescript/module/src/modules/bt-management/services/devices/blood-glucose/telebgm.protocol.d.ts.map +1 -0
  565. package/lib/typescript/module/src/modules/bt-management/services/devices/blood-glucose/telebgm.sequencer.d.ts +32 -0
  566. package/lib/typescript/module/src/modules/bt-management/services/devices/blood-glucose/telebgm.sequencer.d.ts.map +1 -0
  567. package/lib/typescript/module/src/modules/bt-management/services/devices/bp2/bp2.device.d.ts +4 -0
  568. package/lib/typescript/module/src/modules/bt-management/services/devices/bp2/bp2.device.d.ts.map +1 -1
  569. package/lib/typescript/module/src/modules/bt-management/services/devices/bp2/bp2.frame-reader.d.ts +2 -1
  570. package/lib/typescript/module/src/modules/bt-management/services/devices/bp2/bp2.frame-reader.d.ts.map +1 -1
  571. package/lib/typescript/module/src/modules/bt-management/services/devices/bp2/bp2.history-sequencer.d.ts +29 -3
  572. package/lib/typescript/module/src/modules/bt-management/services/devices/bp2/bp2.history-sequencer.d.ts.map +1 -1
  573. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-command-writer.d.ts +6 -1
  574. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-command-writer.d.ts.map +1 -1
  575. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-data-processor.d.ts +2 -0
  576. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-data-processor.d.ts.map +1 -1
  577. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-managed-device.d.ts +23 -3
  578. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-managed-device.d.ts.map +1 -1
  579. package/lib/typescript/module/src/modules/bt-management/services/devices/cofoe/cofoe.records.d.ts.map +1 -1
  580. package/lib/typescript/module/src/modules/bt-management/services/devices/custom/custom-lepu-sequencer.d.ts +6 -3
  581. package/lib/typescript/module/src/modules/bt-management/services/devices/custom/custom-lepu-sequencer.d.ts.map +1 -1
  582. package/lib/typescript/module/src/modules/bt-management/services/devices/custom/custom.device.d.ts +20 -0
  583. package/lib/typescript/module/src/modules/bt-management/services/devices/custom/custom.device.d.ts.map +1 -1
  584. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.advertisement.d.ts +8 -1
  585. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.advertisement.d.ts.map +1 -1
  586. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.connect-retry.d.ts +12 -0
  587. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.connect-retry.d.ts.map +1 -0
  588. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.delivered-files.d.ts +24 -0
  589. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.delivered-files.d.ts.map +1 -0
  590. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.ecg-transfer.d.ts +40 -5
  591. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.ecg-transfer.d.ts.map +1 -1
  592. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.encryption-handshake.d.ts +20 -0
  593. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.encryption-handshake.d.ts.map +1 -0
  594. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.file-transfer.d.ts +6 -3
  595. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.file-transfer.d.ts.map +1 -1
  596. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.frame-reader.d.ts +3 -1
  597. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.frame-reader.d.ts.map +1 -1
  598. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.identity-gate.d.ts +26 -1
  599. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.identity-gate.d.ts.map +1 -1
  600. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.live-ecg-chunks.d.ts +42 -0
  601. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.live-ecg-chunks.d.ts.map +1 -0
  602. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.pulse-wave-chunks.d.ts +28 -0
  603. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.pulse-wave-chunks.d.ts.map +1 -0
  604. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.pulse-wave.d.ts +16 -0
  605. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.pulse-wave.d.ts.map +1 -0
  606. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.recorder.d.ts +32 -0
  607. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.recorder.d.ts.map +1 -0
  608. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.recording-watch.d.ts +28 -0
  609. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.recording-watch.d.ts.map +1 -0
  610. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.session.d.ts +17 -0
  611. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.session.d.ts.map +1 -0
  612. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.stored-files.d.ts +33 -0
  613. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.stored-files.d.ts.map +1 -0
  614. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.transports.d.ts +6 -1
  615. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.transports.d.ts.map +1 -1
  616. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.waveform.d.ts +9 -0
  617. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.waveform.d.ts.map +1 -0
  618. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.bp-monitors.d.ts.map +1 -1
  619. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.ecg-files.d.ts +9 -3
  620. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.ecg-files.d.ts.map +1 -1
  621. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.d.ts.map +1 -1
  622. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.ecg-recording-status.d.ts +8 -0
  623. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.ecg-recording-status.d.ts.map +1 -0
  624. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.oximeters.d.ts.map +1 -1
  625. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.wbp02.protocol.d.ts.map +1 -1
  626. package/lib/typescript/module/src/modules/bt-management/services/series-recorder.d.ts +6 -1
  627. package/lib/typescript/module/src/modules/bt-management/services/series-recorder.d.ts.map +1 -1
  628. package/lib/typescript/module/src/modules/bt-management/types/create-device-params.d.ts +7 -1
  629. package/lib/typescript/module/src/modules/bt-management/types/create-device-params.d.ts.map +1 -1
  630. package/lib/typescript/module/src/modules/bt-management/types/custom-lepu-spec.d.ts +47 -3
  631. package/lib/typescript/module/src/modules/bt-management/types/custom-lepu-spec.d.ts.map +1 -1
  632. package/lib/typescript/module/src/modules/bt-management/types/device-connection-event.d.ts +17 -1
  633. package/lib/typescript/module/src/modules/bt-management/types/device-connection-event.d.ts.map +1 -1
  634. package/lib/typescript/module/src/modules/bt-management/types/device-waveform.d.ts +15 -0
  635. package/lib/typescript/module/src/modules/bt-management/types/device-waveform.d.ts.map +1 -0
  636. package/lib/typescript/module/src/modules/bt-management/utils/calculate-crc-16-modbus.d.ts +3 -0
  637. package/lib/typescript/module/src/modules/bt-management/utils/calculate-crc-16-modbus.d.ts.map +1 -0
  638. package/lib/typescript/module/src/modules/bt-management/utils/i-16-from-hex.d.ts +1 -1
  639. package/lib/typescript/module/src/modules/bt-management/utils/i-16-from-hex.d.ts.map +1 -1
  640. package/lib/typescript/module/src/modules/bt-management/utils/le-32-from-hex.d.ts +1 -1
  641. package/lib/typescript/module/src/modules/bt-management/utils/le-32-from-hex.d.ts.map +1 -1
  642. package/lib/typescript/module/src/modules/bt-management/utils/tenths-mmol-to-mg-per-dl.d.ts +3 -0
  643. package/lib/typescript/module/src/modules/bt-management/utils/tenths-mmol-to-mg-per-dl.d.ts.map +1 -0
  644. package/lib/typescript/module/src/modules/data-sync/components/apple/apple-health-authorization-provider.d.ts.map +1 -1
  645. package/lib/typescript/module/src/modules/data-sync/components/apple/apple-health-authorization-utils.d.ts +2 -2
  646. package/lib/typescript/module/src/modules/data-sync/components/apple/apple-health-authorization-utils.d.ts.map +1 -1
  647. package/lib/typescript/module/src/modules/data-sync/constants.d.ts +3 -1
  648. package/lib/typescript/module/src/modules/data-sync/constants.d.ts.map +1 -1
  649. package/lib/typescript/module/src/modules/data-sync/hooks/use-listen-changes.d.ts.map +1 -1
  650. package/lib/typescript/module/src/modules/data-sync/services/managers/data-processor.d.ts.map +1 -1
  651. package/lib/typescript/module/src/modules/data-sync/types/apple-health-authorization-provider-props.d.ts +2 -2
  652. package/lib/typescript/module/src/modules/data-sync/types/apple-health-authorization-provider-props.d.ts.map +1 -1
  653. package/lib/typescript/module/src/modules/data-sync/types/apple-health-sync-props.d.ts +4 -7
  654. package/lib/typescript/module/src/modules/data-sync/types/apple-health-sync-props.d.ts.map +1 -1
  655. package/lib/typescript/module/src/modules/data-sync/types/get-data-from-provider-props.d.ts +3 -1
  656. package/lib/typescript/module/src/modules/data-sync/types/get-data-from-provider-props.d.ts.map +1 -1
  657. package/lib/typescript/module/src/modules/data-sync/types/health-authorization-status.d.ts +2 -2
  658. package/lib/typescript/module/src/modules/data-sync/types/health-authorization-status.d.ts.map +1 -1
  659. package/lib/typescript/module/src/modules/data-sync/types/health-sync-keys.d.ts +11 -1
  660. package/lib/typescript/module/src/modules/data-sync/types/health-sync-keys.d.ts.map +1 -1
  661. package/lib/typescript/module/src/modules/data-sync/types/health-sync-props.d.ts +1 -1
  662. package/lib/typescript/module/src/modules/data-sync/types/health-sync-props.d.ts.map +1 -1
  663. package/lib/typescript/module/src/modules/data-sync/utils/convert-ecg-samples-to-observation.d.ts +6 -0
  664. package/lib/typescript/module/src/modules/data-sync/utils/convert-ecg-samples-to-observation.d.ts.map +1 -0
  665. package/lib/typescript/module/src/modules/data-sync/utils/convert-generic-health-data.d.ts +1 -1
  666. package/lib/typescript/module/src/modules/data-sync/utils/convert-generic-health-data.d.ts.map +1 -1
  667. package/lib/typescript/module/src/modules/data-sync/utils/convert-samples-to-observation.d.ts.map +1 -1
  668. package/lib/typescript/module/src/modules/data-sync/utils/default-health-coding.d.ts +10 -0
  669. package/lib/typescript/module/src/modules/data-sync/utils/default-health-coding.d.ts.map +1 -0
  670. package/lib/typescript/module/src/modules/data-sync/utils/get-records-from-health-connect.d.ts +1 -1
  671. package/lib/typescript/module/src/modules/data-sync/utils/get-records-from-health-connect.d.ts.map +1 -1
  672. package/lib/typescript/module/src/modules/data-sync/utils/get-samples-from-health.d.ts +12 -46
  673. package/lib/typescript/module/src/modules/data-sync/utils/get-samples-from-health.d.ts.map +1 -1
  674. package/lib/typescript/module/src/modules/data-sync/utils/get-total-samples-count.d.ts.map +1 -1
  675. package/lib/typescript/module/src/modules/data-sync/utils/health-data-catalog.d.ts.map +1 -1
  676. package/lib/typescript/module/src/modules/data-sync/utils/health-units.d.ts +2 -2
  677. package/lib/typescript/module/src/modules/data-sync/utils/health-units.d.ts.map +1 -1
  678. package/lib/typescript/module/src/modules/data-sync/utils/healthkit-daily-statistics.d.ts +10 -0
  679. package/lib/typescript/module/src/modules/data-sync/utils/healthkit-daily-statistics.d.ts.map +1 -0
  680. package/lib/typescript/module/src/modules/data-sync/utils/healthkit-data-types.d.ts +5 -5
  681. package/lib/typescript/module/src/modules/data-sync/utils/healthkit-data-types.d.ts.map +1 -1
  682. package/lib/typescript/module/src/modules/data-sync/utils/healthkit-query-options.d.ts +7 -0
  683. package/lib/typescript/module/src/modules/data-sync/utils/healthkit-query-options.d.ts.map +1 -0
  684. package/lib/typescript/module/src/modules/data-sync/utils/healthkit-sample-source.d.ts +8 -0
  685. package/lib/typescript/module/src/modules/data-sync/utils/healthkit-sample-source.d.ts.map +1 -0
  686. package/lib/typescript/module/src/modules/data-sync/utils/healthkit-samples.d.ts +30 -0
  687. package/lib/typescript/module/src/modules/data-sync/utils/healthkit-samples.d.ts.map +1 -0
  688. package/lib/typescript/module/src/modules/data-sync/utils/healthkit-series.d.ts +2 -2
  689. package/lib/typescript/module/src/modules/data-sync/utils/healthkit-series.d.ts.map +1 -1
  690. package/lib/typescript/module/src/modules/data-sync/utils/to-core-health-observations.d.ts +1 -0
  691. package/lib/typescript/module/src/modules/data-sync/utils/to-core-health-observations.d.ts.map +1 -1
  692. package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/built-in-devices.d.ts +12 -1
  693. package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/built-in-devices.d.ts.map +1 -1
  694. package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/legacy-driver.d.ts +2 -1
  695. package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/legacy-driver.d.ts.map +1 -1
  696. package/lib/typescript/module/src/modules/next/bluetooth/connections.d.ts +13 -1
  697. package/lib/typescript/module/src/modules/next/bluetooth/connections.d.ts.map +1 -1
  698. package/lib/typescript/module/src/modules/next/bluetooth/driver.d.ts +20 -0
  699. package/lib/typescript/module/src/modules/next/bluetooth/driver.d.ts.map +1 -1
  700. package/lib/typescript/module/src/modules/next/bluetooth/errors.d.ts +1 -1
  701. package/lib/typescript/module/src/modules/next/bluetooth/errors.d.ts.map +1 -1
  702. package/lib/typescript/module/src/modules/next/bluetooth/index.d.ts +2 -1
  703. package/lib/typescript/module/src/modules/next/bluetooth/index.d.ts.map +1 -1
  704. package/lib/typescript/module/src/modules/next/bluetooth/readings.d.ts +3 -2
  705. package/lib/typescript/module/src/modules/next/bluetooth/readings.d.ts.map +1 -1
  706. package/lib/typescript/module/src/modules/next/bluetooth/runtime.d.ts +19 -1
  707. package/lib/typescript/module/src/modules/next/bluetooth/runtime.d.ts.map +1 -1
  708. package/lib/typescript/module/src/modules/next/bluetooth/snapshot.d.ts +33 -1
  709. package/lib/typescript/module/src/modules/next/bluetooth/snapshot.d.ts.map +1 -1
  710. package/lib/typescript/module/src/modules/next/bluetooth/web/index.d.ts +1 -0
  711. package/lib/typescript/module/src/modules/next/bluetooth/web/index.d.ts.map +1 -1
  712. package/package.json +8 -3
@@ -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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CAAC,6CAA6C,CAAC;MAEpE,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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,OAAO,EAAEmB,OAAO,CAAC;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,yBA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C,CAClD,IAAI,CAAC3B,UAAU,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,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;IACxD,MAAMqB,aAAa,GAAGrB,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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G,CAAC,CAAC,EAAEzB,MAAM,CAACQ,MAAM,IAAId,mBAAmB,GAAG,CAAC,CAAC,CAAC;EAC/D;EAEQiB,gBAAgBA,CAACF,KAAe,EAAW;IACjD,MAAMiB,gBAAgB,GAAGjB,KAAK,CAACD,MAAM,GAAGhB,cAAc;IACtD,MAAMmC,QAAQ,GAAG,IAAAN,oBAAS,EAACZ,KAAK,CAACiB,gBAAgB,CAAC,IAAI,GAAG,CAAC;IAE1D,OAAOC,QAAQ,KAAK,IAAAC,2BAAa,EAACnB,KAAK,EAAEiB,gBAAgB,CAAC;EAC5D;AACF;AAACG,OAAA,CAAAlC,eAAA,GAAAA,eAAA","ignoreList":[]}
@@ -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,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,eAAA,GAAAJ,OAAA;AACA,IAAAK,iBAAA,GAAAL,OAAA;AAfA;;AAyDA,MAAMM,aAAa,GAAG,CAAC;AACvB,MAAMC,kBAAkB,GAAG,IAAI;;AAE/B;AACO,MAAMC,gBAAgB,CAA6B;EAChDC,YAAY,GAAG,KAAK;EACpBC,SAAS,GAAG,KAAK;EAIlBC,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,g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ChB,CAAC;AAED,MAAMU,2BAA2B,GAC/BhC,KAAwB,IACO;EAC/B,IAAI;IACF,MAAM2D,IAAI,GAAG3D,KAAK,CACf4D,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CACZC,GAAG,CAAEC,IAAI,IAAKrB,MAAM,CAACsB,YAAY,CAAC,IAAAzD,oBAAS,EAACwD,IAAI,CAAC,CAAC,CAAC,CACnDE,IAAI,CAAC,EAAE,CAAC,CACRC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;IAEtB,MAAMxD,IAAI,GAAGiC,IAAI,CAACwB,KAAK,CAACP,IAAI,CAA4B;IACxD,MAAM1C,UAAU,GAAGkD,MAAM,CAAC1D,IAAI,CAAC2D,KAAK,CAAC;IAErC,IAAI,CAACD,MAAM,CAACE,SAAS,CAACpD,UAAU,CAAC,EAAE;MACjC,OAAOf,SAAS;IAClB;IAEA,OAAO;MACLe,UAAU;MACVqD,iBAAiB,EAAE,CAAC;MACpBpD,UAAU,EAAEuB,MAAM,CAAChC,IAAI,CAAC8D,MAAM,IAAI,EAAE,CAAC;MACrCC,YAAY,EAAE/B,MAAM,CAAChC,IAAI,CAACgE,EAAE,IAAIhE,IAAI,CAACiE,YAAY,IAAI,EAAE;IACzD,CAAC;EACH,CAAC,CAAC,MAAM;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,M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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,IAAI,CAACJ,EAAE,CAACK,OAAO,CAAC,CAAC,GAAGJ,eAAe,GAAGX,aAAa,CAAC,CAAC;IAC9F,IAAI,CAACgB,SAAS,KAAK,IAAIF,IAAI,CAACJ,EAAE,CAACK,OAAO,CAAC,CAAC,GAAG,IAAI,CAACE,SAAS,CAACR,OAAO,CAACS,MAAM,CAAC,GAAGlB,aAAa,CAAC;IAC1F,IAAI,CAACG,MAAM,CAACgB,IAAI,CAAC,GAAGV,OAAO,CAAC;IAC5B,IAAI,CAACW,MAAM,GAAGV,EAAE;IAEhB,IAAI,IAAI,CAACO,SAAS,CAAC,IAAI,CAACd,MAAM,CAACe,MAAM,CAAC,IAAInB,a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G,CAAC,CAAC,IAAI,CAACpB,MAAM,EAAEL,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI,CAACC,SAAS,EAAED,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,IAAIf,aAAa;IACtG,MAAMyC,QAAQ,GAAGC,IAAI,CAACC,GAAG,CAAC,IAAI,CAACxC,MAAM,CAACe,MAAM,EAAEsB,WAAW,GAAG,IAAI,CAAClC,QAAQ,CAACiC,YAAY,CAAC;IAEvF,OAAOK,MAAM,CAAC,CAAC,IAAI,CAACzC,MAAM,CAACe,MAAM,GAAGuB,QAAQ,EAAEI,OAAO,CAAC5C,iBAAiB,CAAC,CAAC;EAC3E,CAAC;AACH;AAAC6C,OAAA,CAAA5C,aAAA,GAAAA,aAAA;AAED,MAAM6C,GAAG,GAAIC,KAAa,IAAaC,MAAM,CAACD,KAAK,CAAC,CAACE,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;;AAErE;AACA,MAAMrC,cAAc,GAAIsC,KAAW,IACjC,IAAIA,KAAK,CAACC,WAAW,CAAC,CAAC,GAAGL,GAAG,CAACI,KAAK,CAACE,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,GAAGN,GAAG,CAACI,KAAK,CAACG,OAAO,CAAC,CAAC,CAAC,EAAE,GAC5E,GAAGP,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,IAAe,EAAEC,EAAQ,KAAW;IACnD,IAAID,IAAI,CAACN,OAAO,CAACC,MAAM,KAAK,CAAC,EAAE;MAC7B;IACF;IAEA,MAAMO,OAAO,GAAGD,EAAE,CAACE,OAAO,CAAC,CAAC,GAAGH,IAAI,CAACN,OAAO,CAACC,MAAM,GAAGR,mCAAoB;IAEzE,IAAI,CAACiB,eAAe,CAACF,OAAO,CAAC;IAC7B,IAAI,CAACV,KAAK,KAAK;MAAEC,KAAK,EAAES,OAAO;MAAER,OAAO,EAAE;IAAG,CAAC;IAC9C,IAAI,CAACW,IAAI,CAACL,IAAI,CAACM,MAAM,GAAGN,IAAI,CAACN,OAAO,GAAGM,IAAI,CA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