@ovok/native 1.6.47 → 1.6.48

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 (237) hide show
  1. package/lib/commonjs/modules/bt-device/constants/baby-sleep-clip-catalog-asset.js +10 -0
  2. package/lib/commonjs/modules/bt-device/constants/baby-sleep-clip-catalog-asset.js.map +1 -0
  3. package/lib/commonjs/modules/bt-device/constants/device-instruction-pdfs.js +12 -1
  4. package/lib/commonjs/modules/bt-device/constants/device-instruction-pdfs.js.map +1 -1
  5. package/lib/commonjs/modules/bt-device/constants/supported-device-catalog-assets.js +5 -1
  6. package/lib/commonjs/modules/bt-device/constants/supported-device-catalog-assets.js.map +1 -1
  7. package/lib/commonjs/modules/bt-device/constants/supported-device-catalog-entries.js +19 -0
  8. package/lib/commonjs/modules/bt-device/constants/supported-device-catalog-entries.js.map +1 -1
  9. package/lib/commonjs/modules/bt-device/constants/supported-devices.js +38 -0
  10. package/lib/commonjs/modules/bt-device/constants/supported-devices.js.map +1 -1
  11. package/lib/commonjs/modules/bt-management/constants/integrated-devices-map.js +1 -1
  12. package/lib/commonjs/modules/bt-management/constants/integrated-devices-map.js.map +1 -1
  13. package/lib/commonjs/modules/bt-management/services/device-classes.js +95 -0
  14. package/lib/commonjs/modules/bt-management/services/device-classes.js.map +1 -0
  15. package/lib/commonjs/modules/bt-management/services/device-creator.js +5 -82
  16. package/lib/commonjs/modules/bt-management/services/device-creator.js.map +1 -1
  17. package/lib/commonjs/modules/bt-management/services/devices/bt-managed-device.js +6 -1
  18. package/lib/commonjs/modules/bt-management/services/devices/bt-managed-device.js.map +1 -1
  19. package/lib/commonjs/modules/bt-management/services/devices/viatom/baby-sleep-clip.device.js +57 -0
  20. package/lib/commonjs/modules/bt-management/services/devices/viatom/baby-sleep-clip.device.js.map +1 -0
  21. package/lib/commonjs/modules/bt-management/services/devices/viatom/baby-sleep-clip.protocol.js +106 -0
  22. package/lib/commonjs/modules/bt-management/services/devices/viatom/baby-sleep-clip.protocol.js.map +1 -0
  23. package/lib/commonjs/modules/bt-management/services/devices/viatom/baby-sleep-clip.sequencer.js +80 -0
  24. package/lib/commonjs/modules/bt-management/services/devices/viatom/baby-sleep-clip.sequencer.js.map +1 -0
  25. package/lib/commonjs/modules/bt-management/services/devices/viatom/lpm311.device.js +55 -0
  26. package/lib/commonjs/modules/bt-management/services/devices/viatom/lpm311.device.js.map +1 -0
  27. package/lib/commonjs/modules/bt-management/services/devices/viatom/lpm311.protocol.js +103 -0
  28. package/lib/commonjs/modules/bt-management/services/devices/viatom/lpm311.protocol.js.map +1 -0
  29. package/lib/commonjs/modules/bt-management/services/devices/viatom/lpm311.sequencer.js +33 -0
  30. package/lib/commonjs/modules/bt-management/services/devices/viatom/lpm311.sequencer.js.map +1 -0
  31. package/lib/commonjs/modules/bt-management/services/devices/viatom/oxy-s3.device.js +72 -0
  32. package/lib/commonjs/modules/bt-management/services/devices/viatom/oxy-s3.device.js.map +1 -0
  33. package/lib/commonjs/modules/bt-management/services/devices/viatom/oxy-s3.protocol.js +103 -0
  34. package/lib/commonjs/modules/bt-management/services/devices/viatom/oxy-s3.protocol.js.map +1 -0
  35. package/lib/commonjs/modules/bt-management/services/devices/viatom/oxy-s3.sequencer.js +110 -0
  36. package/lib/commonjs/modules/bt-management/services/devices/viatom/oxy-s3.sequencer.js.map +1 -0
  37. package/lib/commonjs/modules/bt-management/services/devices/viatom/pf10aw1.device.js +53 -0
  38. package/lib/commonjs/modules/bt-management/services/devices/viatom/pf10aw1.device.js.map +1 -0
  39. package/lib/commonjs/modules/bt-management/services/devices/viatom/pf10aw1.protocol.js +64 -0
  40. package/lib/commonjs/modules/bt-management/services/devices/viatom/pf10aw1.protocol.js.map +1 -0
  41. package/lib/commonjs/modules/bt-management/services/devices/viatom/pf10aw1.sequencer.js +96 -0
  42. package/lib/commonjs/modules/bt-management/services/devices/viatom/pf10aw1.sequencer.js.map +1 -0
  43. package/lib/commonjs/modules/bt-management/services/devices/viatom/sp20.device.js +54 -0
  44. package/lib/commonjs/modules/bt-management/services/devices/viatom/sp20.device.js.map +1 -0
  45. package/lib/commonjs/modules/bt-management/services/devices/viatom/sp20.protocol.js +102 -0
  46. package/lib/commonjs/modules/bt-management/services/devices/viatom/sp20.protocol.js.map +1 -0
  47. package/lib/commonjs/modules/bt-management/services/devices/viatom/sp20.sequencer.js +115 -0
  48. package/lib/commonjs/modules/bt-management/services/devices/viatom/sp20.sequencer.js.map +1 -0
  49. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom-lepu-crypto.js +81 -0
  50. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom-lepu-crypto.js.map +1 -0
  51. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom-r20.device.js +57 -0
  52. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom-r20.device.js.map +1 -0
  53. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom-r20.protocol.js +118 -0
  54. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom-r20.protocol.js.map +1 -0
  55. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom-r20.sequencer.js +95 -0
  56. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom-r20.sequencer.js.map +1 -0
  57. package/lib/commonjs/modules/bt-management/types/clock-sync.js +3 -0
  58. package/lib/commonjs/modules/bt-management/types/clock-sync.js.map +1 -1
  59. package/lib/commonjs/modules/bt-management/types/device-measurement-map.js.map +1 -1
  60. package/lib/commonjs/modules/bt-management/types/integrated-devices.js +11 -0
  61. package/lib/commonjs/modules/bt-management/types/integrated-devices.js.map +1 -1
  62. package/lib/module/modules/bt-device/constants/baby-sleep-clip-catalog-asset.js +7 -0
  63. package/lib/module/modules/bt-device/constants/baby-sleep-clip-catalog-asset.js.map +1 -0
  64. package/lib/module/modules/bt-device/constants/device-instruction-pdfs.js +12 -1
  65. package/lib/module/modules/bt-device/constants/device-instruction-pdfs.js.map +1 -1
  66. package/lib/module/modules/bt-device/constants/supported-device-catalog-assets.js +5 -1
  67. package/lib/module/modules/bt-device/constants/supported-device-catalog-assets.js.map +1 -1
  68. package/lib/module/modules/bt-device/constants/supported-device-catalog-entries.js +20 -1
  69. package/lib/module/modules/bt-device/constants/supported-device-catalog-entries.js.map +1 -1
  70. package/lib/module/modules/bt-device/constants/supported-devices.js +38 -0
  71. package/lib/module/modules/bt-device/constants/supported-devices.js.map +1 -1
  72. package/lib/module/modules/bt-management/constants/integrated-devices-map.js +1 -1
  73. package/lib/module/modules/bt-management/constants/integrated-devices-map.js.map +1 -1
  74. package/lib/module/modules/bt-management/services/device-classes.js +92 -0
  75. package/lib/module/modules/bt-management/services/device-classes.js.map +1 -0
  76. package/lib/module/modules/bt-management/services/device-creator.js +3 -81
  77. package/lib/module/modules/bt-management/services/device-creator.js.map +1 -1
  78. package/lib/module/modules/bt-management/services/devices/bt-managed-device.js +6 -1
  79. package/lib/module/modules/bt-management/services/devices/bt-managed-device.js.map +1 -1
  80. package/lib/module/modules/bt-management/services/devices/viatom/baby-sleep-clip.device.js +52 -0
  81. package/lib/module/modules/bt-management/services/devices/viatom/baby-sleep-clip.device.js.map +1 -0
  82. package/lib/module/modules/bt-management/services/devices/viatom/baby-sleep-clip.protocol.js +99 -0
  83. package/lib/module/modules/bt-management/services/devices/viatom/baby-sleep-clip.protocol.js.map +1 -0
  84. package/lib/module/modules/bt-management/services/devices/viatom/baby-sleep-clip.sequencer.js +75 -0
  85. package/lib/module/modules/bt-management/services/devices/viatom/baby-sleep-clip.sequencer.js.map +1 -0
  86. package/lib/module/modules/bt-management/services/devices/viatom/lpm311.device.js +50 -0
  87. package/lib/module/modules/bt-management/services/devices/viatom/lpm311.device.js.map +1 -0
  88. package/lib/module/modules/bt-management/services/devices/viatom/lpm311.protocol.js +98 -0
  89. package/lib/module/modules/bt-management/services/devices/viatom/lpm311.protocol.js.map +1 -0
  90. package/lib/module/modules/bt-management/services/devices/viatom/lpm311.sequencer.js +28 -0
  91. package/lib/module/modules/bt-management/services/devices/viatom/lpm311.sequencer.js.map +1 -0
  92. package/lib/module/modules/bt-management/services/devices/viatom/oxy-s3.device.js +67 -0
  93. package/lib/module/modules/bt-management/services/devices/viatom/oxy-s3.device.js.map +1 -0
  94. package/lib/module/modules/bt-management/services/devices/viatom/oxy-s3.protocol.js +94 -0
  95. package/lib/module/modules/bt-management/services/devices/viatom/oxy-s3.protocol.js.map +1 -0
  96. package/lib/module/modules/bt-management/services/devices/viatom/oxy-s3.sequencer.js +105 -0
  97. package/lib/module/modules/bt-management/services/devices/viatom/oxy-s3.sequencer.js.map +1 -0
  98. package/lib/module/modules/bt-management/services/devices/viatom/pf10aw1.device.js +48 -0
  99. package/lib/module/modules/bt-management/services/devices/viatom/pf10aw1.device.js.map +1 -0
  100. package/lib/module/modules/bt-management/services/devices/viatom/pf10aw1.protocol.js +57 -0
  101. package/lib/module/modules/bt-management/services/devices/viatom/pf10aw1.protocol.js.map +1 -0
  102. package/lib/module/modules/bt-management/services/devices/viatom/pf10aw1.sequencer.js +91 -0
  103. package/lib/module/modules/bt-management/services/devices/viatom/pf10aw1.sequencer.js.map +1 -0
  104. package/lib/module/modules/bt-management/services/devices/viatom/sp20.device.js +49 -0
  105. package/lib/module/modules/bt-management/services/devices/viatom/sp20.device.js.map +1 -0
  106. package/lib/module/modules/bt-management/services/devices/viatom/sp20.protocol.js +94 -0
  107. package/lib/module/modules/bt-management/services/devices/viatom/sp20.protocol.js.map +1 -0
  108. package/lib/module/modules/bt-management/services/devices/viatom/sp20.sequencer.js +110 -0
  109. package/lib/module/modules/bt-management/services/devices/viatom/sp20.sequencer.js.map +1 -0
  110. package/lib/module/modules/bt-management/services/devices/viatom/viatom-lepu-crypto.js +71 -0
  111. package/lib/module/modules/bt-management/services/devices/viatom/viatom-lepu-crypto.js.map +1 -0
  112. package/lib/module/modules/bt-management/services/devices/viatom/viatom-r20.device.js +52 -0
  113. package/lib/module/modules/bt-management/services/devices/viatom/viatom-r20.device.js.map +1 -0
  114. package/lib/module/modules/bt-management/services/devices/viatom/viatom-r20.protocol.js +110 -0
  115. package/lib/module/modules/bt-management/services/devices/viatom/viatom-r20.protocol.js.map +1 -0
  116. package/lib/module/modules/bt-management/services/devices/viatom/viatom-r20.sequencer.js +90 -0
  117. package/lib/module/modules/bt-management/services/devices/viatom/viatom-r20.sequencer.js.map +1 -0
  118. package/lib/module/modules/bt-management/types/clock-sync.js +3 -0
  119. package/lib/module/modules/bt-management/types/clock-sync.js.map +1 -1
  120. package/lib/module/modules/bt-management/types/device-measurement-map.js.map +1 -1
  121. package/lib/module/modules/bt-management/types/integrated-devices.js +11 -0
  122. package/lib/module/modules/bt-management/types/integrated-devices.js.map +1 -1
  123. package/lib/typescript/commonjs/src/modules/bt-device/constants/baby-sleep-clip-catalog-asset.d.ts +4 -0
  124. package/lib/typescript/commonjs/src/modules/bt-device/constants/baby-sleep-clip-catalog-asset.d.ts.map +1 -0
  125. package/lib/typescript/commonjs/src/modules/bt-device/constants/device-instruction-pdfs.d.ts.map +1 -1
  126. package/lib/typescript/commonjs/src/modules/bt-device/constants/supported-device-catalog-assets.d.ts +5 -1
  127. package/lib/typescript/commonjs/src/modules/bt-device/constants/supported-device-catalog-assets.d.ts.map +1 -1
  128. package/lib/typescript/commonjs/src/modules/bt-device/constants/supported-device-catalog-entries.d.ts.map +1 -1
  129. package/lib/typescript/commonjs/src/modules/bt-device/constants/supported-devices.d.ts +1 -1
  130. package/lib/typescript/commonjs/src/modules/bt-device/constants/supported-devices.d.ts.map +1 -1
  131. package/lib/typescript/commonjs/src/modules/bt-management/constants/integrated-devices-map.d.ts.map +1 -1
  132. package/lib/typescript/commonjs/src/modules/bt-management/services/device-classes.d.ts +89 -0
  133. package/lib/typescript/commonjs/src/modules/bt-management/services/device-classes.d.ts.map +1 -0
  134. package/lib/typescript/commonjs/src/modules/bt-management/services/device-creator.d.ts.map +1 -1
  135. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-managed-device.d.ts +2 -0
  136. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-managed-device.d.ts.map +1 -1
  137. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/baby-sleep-clip.device.d.ts +18 -0
  138. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/baby-sleep-clip.device.d.ts.map +1 -0
  139. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/baby-sleep-clip.protocol.d.ts +27 -0
  140. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/baby-sleep-clip.protocol.d.ts.map +1 -0
  141. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/baby-sleep-clip.sequencer.d.ts +32 -0
  142. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/baby-sleep-clip.sequencer.d.ts.map +1 -0
  143. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/lpm311.device.d.ts +9 -0
  144. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/lpm311.device.d.ts.map +1 -0
  145. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/lpm311.protocol.d.ts +14 -0
  146. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/lpm311.protocol.d.ts.map +1 -0
  147. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/lpm311.sequencer.d.ts +10 -0
  148. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/lpm311.sequencer.d.ts.map +1 -0
  149. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/oxy-s3.device.d.ts +18 -0
  150. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/oxy-s3.device.d.ts.map +1 -0
  151. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/oxy-s3.protocol.d.ts +42 -0
  152. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/oxy-s3.protocol.d.ts.map +1 -0
  153. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/oxy-s3.sequencer.d.ts +31 -0
  154. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/oxy-s3.sequencer.d.ts.map +1 -0
  155. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/pf10aw1.device.d.ts +19 -0
  156. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/pf10aw1.device.d.ts.map +1 -0
  157. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/pf10aw1.protocol.d.ts +30 -0
  158. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/pf10aw1.protocol.d.ts.map +1 -0
  159. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/pf10aw1.sequencer.d.ts +27 -0
  160. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/pf10aw1.sequencer.d.ts.map +1 -0
  161. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/sp20.device.d.ts +20 -0
  162. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/sp20.device.d.ts.map +1 -0
  163. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/sp20.protocol.d.ts +28 -0
  164. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/sp20.protocol.d.ts.map +1 -0
  165. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/sp20.sequencer.d.ts +26 -0
  166. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/sp20.sequencer.d.ts.map +1 -0
  167. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom-lepu-crypto.d.ts +7 -0
  168. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom-lepu-crypto.d.ts.map +1 -0
  169. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom-r20.device.d.ts +20 -0
  170. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom-r20.device.d.ts.map +1 -0
  171. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom-r20.protocol.d.ts +38 -0
  172. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom-r20.protocol.d.ts.map +1 -0
  173. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom-r20.sequencer.d.ts +35 -0
  174. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom-r20.sequencer.d.ts.map +1 -0
  175. package/lib/typescript/commonjs/src/modules/bt-management/types/clock-sync.d.ts.map +1 -1
  176. package/lib/typescript/commonjs/src/modules/bt-management/types/device-measurement-map.d.ts +12 -1
  177. package/lib/typescript/commonjs/src/modules/bt-management/types/device-measurement-map.d.ts.map +1 -1
  178. package/lib/typescript/commonjs/src/modules/bt-management/types/integrated-devices.d.ts +12 -1
  179. package/lib/typescript/commonjs/src/modules/bt-management/types/integrated-devices.d.ts.map +1 -1
  180. package/lib/typescript/module/src/modules/bt-device/constants/baby-sleep-clip-catalog-asset.d.ts +4 -0
  181. package/lib/typescript/module/src/modules/bt-device/constants/baby-sleep-clip-catalog-asset.d.ts.map +1 -0
  182. package/lib/typescript/module/src/modules/bt-device/constants/device-instruction-pdfs.d.ts.map +1 -1
  183. package/lib/typescript/module/src/modules/bt-device/constants/supported-device-catalog-assets.d.ts +5 -1
  184. package/lib/typescript/module/src/modules/bt-device/constants/supported-device-catalog-assets.d.ts.map +1 -1
  185. package/lib/typescript/module/src/modules/bt-device/constants/supported-device-catalog-entries.d.ts.map +1 -1
  186. package/lib/typescript/module/src/modules/bt-device/constants/supported-devices.d.ts +1 -1
  187. package/lib/typescript/module/src/modules/bt-device/constants/supported-devices.d.ts.map +1 -1
  188. package/lib/typescript/module/src/modules/bt-management/constants/integrated-devices-map.d.ts.map +1 -1
  189. package/lib/typescript/module/src/modules/bt-management/services/device-classes.d.ts +89 -0
  190. package/lib/typescript/module/src/modules/bt-management/services/device-classes.d.ts.map +1 -0
  191. package/lib/typescript/module/src/modules/bt-management/services/device-creator.d.ts.map +1 -1
  192. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-managed-device.d.ts +2 -0
  193. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-managed-device.d.ts.map +1 -1
  194. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/baby-sleep-clip.device.d.ts +18 -0
  195. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/baby-sleep-clip.device.d.ts.map +1 -0
  196. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/baby-sleep-clip.protocol.d.ts +27 -0
  197. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/baby-sleep-clip.protocol.d.ts.map +1 -0
  198. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/baby-sleep-clip.sequencer.d.ts +32 -0
  199. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/baby-sleep-clip.sequencer.d.ts.map +1 -0
  200. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/lpm311.device.d.ts +9 -0
  201. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/lpm311.device.d.ts.map +1 -0
  202. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/lpm311.protocol.d.ts +14 -0
  203. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/lpm311.protocol.d.ts.map +1 -0
  204. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/lpm311.sequencer.d.ts +10 -0
  205. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/lpm311.sequencer.d.ts.map +1 -0
  206. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/oxy-s3.device.d.ts +18 -0
  207. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/oxy-s3.device.d.ts.map +1 -0
  208. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/oxy-s3.protocol.d.ts +42 -0
  209. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/oxy-s3.protocol.d.ts.map +1 -0
  210. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/oxy-s3.sequencer.d.ts +31 -0
  211. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/oxy-s3.sequencer.d.ts.map +1 -0
  212. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/pf10aw1.device.d.ts +19 -0
  213. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/pf10aw1.device.d.ts.map +1 -0
  214. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/pf10aw1.protocol.d.ts +30 -0
  215. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/pf10aw1.protocol.d.ts.map +1 -0
  216. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/pf10aw1.sequencer.d.ts +27 -0
  217. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/pf10aw1.sequencer.d.ts.map +1 -0
  218. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/sp20.device.d.ts +20 -0
  219. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/sp20.device.d.ts.map +1 -0
  220. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/sp20.protocol.d.ts +28 -0
  221. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/sp20.protocol.d.ts.map +1 -0
  222. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/sp20.sequencer.d.ts +26 -0
  223. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/sp20.sequencer.d.ts.map +1 -0
  224. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom-lepu-crypto.d.ts +7 -0
  225. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom-lepu-crypto.d.ts.map +1 -0
  226. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom-r20.device.d.ts +20 -0
  227. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom-r20.device.d.ts.map +1 -0
  228. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom-r20.protocol.d.ts +38 -0
  229. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom-r20.protocol.d.ts.map +1 -0
  230. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom-r20.sequencer.d.ts +35 -0
  231. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom-r20.sequencer.d.ts.map +1 -0
  232. package/lib/typescript/module/src/modules/bt-management/types/clock-sync.d.ts.map +1 -1
  233. package/lib/typescript/module/src/modules/bt-management/types/device-measurement-map.d.ts +12 -1
  234. package/lib/typescript/module/src/modules/bt-management/types/device-measurement-map.d.ts.map +1 -1
  235. package/lib/typescript/module/src/modules/bt-management/types/integrated-devices.d.ts +12 -1
  236. package/lib/typescript/module/src/modules/bt-management/types/integrated-devices.d.ts.map +1 -1
  237. package/package.json +6 -4
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.decodeLpm311Record = exports.Lpm311FrameReader = exports.LPM311_RECORD_BYTES = exports.LPM311_MEASUREMENT_TYPE = void 0;
7
+ var _core = require("@ovok/core");
8
+ var _frameReadStatus = require("../../../types/frame-read-status.js");
9
+ var _hexToByte = require("../../../utils/hex-to-byte.js");
10
+ const LPM311_RECORD_BYTES = exports.LPM311_RECORD_BYTES = 44;
11
+ const LPM311_MEASUREMENT_TYPE = exports.LPM311_MEASUREMENT_TYPE = _core.MeasurementTypeKey.lipidPanel;
12
+ const ascii = bytes => bytes.map(byte => String.fromCharCode((0, _hexToByte.hexToByte)(byte))).join("");
13
+ const lipidValue = (bytes, scale) => {
14
+ const encoded = ascii(bytes);
15
+ if (/^f/i.test(encoded)) {
16
+ return undefined;
17
+ }
18
+ if (!/^[\da-f]{8}$/i.test(encoded)) {
19
+ return undefined;
20
+ }
21
+ const value = Number.parseInt(encoded, 16) / scale;
22
+ return Number.isFinite(value) ? value : undefined;
23
+ };
24
+ const recordedAt = bytes => {
25
+ const value = ascii(bytes);
26
+ if (!/^\d{14}$/.test(value)) {
27
+ return undefined;
28
+ }
29
+ const year = Number(value.slice(0, 4));
30
+ const month = Number(value.slice(4, 6));
31
+ const day = Number(value.slice(6, 8));
32
+ const hour = Number(value.slice(8, 10));
33
+ const minute = Number(value.slice(10, 12));
34
+ const second = Number(value.slice(12, 14));
35
+ const date = new Date(0);
36
+ date.setFullYear(year, month - 1, day);
37
+ date.setHours(hour, minute, second, 0);
38
+ return date.getFullYear() === year && date.getMonth() === month - 1 && date.getDate() === day && date.getHours() === hour && date.getMinutes() === minute && date.getSeconds() === second ? date : undefined;
39
+ };
40
+ const ratioWithinReferenceRange = (unit, total, hdl) => unit === "mmol/L" ? total >= 2.59 && total <= 12.93 && hdl >= 0.39 && hdl <= 2.59 : total >= 100 && total <= 500 && hdl >= 15 && hdl <= 100;
41
+
42
+ /** Decodes one 44-byte ASCII record emitted by the ViHealth LPM311 interface. */
43
+ const decodeLpm311Record = frame => {
44
+ if (frame.length !== LPM311_RECORD_BYTES) {
45
+ return undefined;
46
+ }
47
+ const unitCode = ascii(frame.slice(40, 41));
48
+ if (unitCode !== "0" && unitCode !== "1") {
49
+ return undefined;
50
+ }
51
+ const unit = unitCode === "0" ? "mmol/L" : "mg/dL";
52
+ const scale = unit === "mmol/L" ? 100 : 1;
53
+ const totalCholesterol = lipidValue(frame.slice(15, 23), scale);
54
+ const hdlCholesterol = lipidValue(frame.slice(23, 31), scale);
55
+ const triglycerides = lipidValue(frame.slice(31, 39), scale);
56
+ const complete = totalCholesterol !== undefined && hdlCholesterol !== undefined && triglycerides !== undefined && totalCholesterol > 0 && hdlCholesterol > 0 && triglycerides > 0;
57
+ const recorded = recordedAt(frame.slice(0, 14));
58
+ const result = {
59
+ measurementTypeKey: LPM311_MEASUREMENT_TYPE,
60
+ unit,
61
+ ...(totalCholesterol === undefined ? {} : {
62
+ totalCholesterol
63
+ }),
64
+ ...(hdlCholesterol === undefined ? {} : {
65
+ hdlCholesterol
66
+ }),
67
+ ...(triglycerides === undefined ? {} : {
68
+ triglycerides
69
+ }),
70
+ ...(recorded ? {
71
+ recordedAt: recorded
72
+ } : {})
73
+ };
74
+ if (complete) {
75
+ const conversion = unit === "mmol/L" ? 2.2 : 5;
76
+ const ldlCholesterol = totalCholesterol - hdlCholesterol - triglycerides / conversion;
77
+ result.ldlCholesterol = ldlCholesterol;
78
+ if (ratioWithinReferenceRange(unit, totalCholesterol, hdlCholesterol)) {
79
+ result.totalCholesterolHdlRatio = totalCholesterol / hdlCholesterol;
80
+ }
81
+ }
82
+ return result;
83
+ };
84
+
85
+ /** Reads fixed-width records; a notification may contain a fragment or several records. */
86
+ exports.decodeLpm311Record = decodeLpm311Record;
87
+ class Lpm311FrameReader {
88
+ readFrame(buffer) {
89
+ if (buffer.length < LPM311_RECORD_BYTES) {
90
+ return {
91
+ status: _frameReadStatus.FrameReadStatus.INCOMPLETE,
92
+ consumedBytes: 0
93
+ };
94
+ }
95
+ return {
96
+ status: _frameReadStatus.FrameReadStatus.COMPLETE,
97
+ consumedBytes: LPM311_RECORD_BYTES,
98
+ frame: buffer.slice(0, LPM311_RECORD_BYTES)
99
+ };
100
+ }
101
+ }
102
+ exports.Lpm311FrameReader = Lpm311FrameReader;
103
+ //# sourceMappingURL=lpm311.protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_core","require","_frameReadStatus","_hexToByte","LPM311_RECORD_BYTES","exports","LPM311_MEASUREMENT_TYPE","MeasurementTypeKey","lipidPanel","ascii","bytes","map","byte","String","fromCharCode","hexToByte","join","lipidValue","scale","encoded","test","undefined","value","Number","parseInt","isFinite","recordedAt","year","slice","month","day","hour","minute","second","date","Date","setFullYear","setHours","getFullYear","getMonth","getDate","getHours","getMinutes","getSeconds","ratioWithinReferenceRange","unit","total","hdl","decodeLpm311Record","frame","length","unitCode","totalCholesterol","hdlCholesterol","triglycerides","complete","recorded","result","measurementTypeKey","conversion","ldlCholesterol","totalCholesterolHdlRatio","Lpm311FrameReader","readFrame","buffer","status","FrameReadStatus","INCOMPLETE","consumedBytes","COMPLETE"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/viatom/lpm311.protocol.ts"],"mappings":";;;;;;AAAA,IAAAA,KAA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{
4
+ value: true
5
+ });
6
+ exports.Lpm311Sequencer = void 0;
7
+ var _lpm311Protocol = require("./lpm311.protocol.js");
8
+ const SERVICE = "0000ffe0-0000-1000-8000-00805f9b34fb";
9
+ const CHARACTERISTIC = "0000ffe1-0000-1000-8000-00805f9b34fb";
10
+ const command = (text, delayBeforeWriteMs) => ({
11
+ serviceUuid: SERVICE,
12
+ characteristicUuid: CHARACTERISTIC,
13
+ frame: [...text].map(character => character.charCodeAt(0).toString(16).padStart(2, "0")),
14
+ ...(delayBeforeWriteMs === undefined ? {} : {
15
+ delayBeforeWriteMs
16
+ })
17
+ });
18
+
19
+ /** Starts the LPM311 ASCII transfer and acknowledges its result by ending the session. */
20
+ class Lpm311Sequencer {
21
+ finished = false;
22
+ initialCommands = () => [command("connect", 1_000)];
23
+ nextCommand = frame => {
24
+ if (!(0, _lpm311Protocol.decodeLpm311Record)(frame)) {
25
+ return undefined;
26
+ }
27
+ this.finished = true;
28
+ return [command("disconnect")];
29
+ };
30
+ isNormalDisconnect = () => this.finished;
31
+ }
32
+ exports.Lpm311Sequencer = Lpm311Sequencer;
33
+ //# sourceMappingURL=lpm311.sequencer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_lpm311Protocol","require","SERVICE","CHARACTERISTIC","command","text","delayBeforeWriteMs","serviceUuid","characteristicUuid","frame","map","character","charCodeAt","toString","padStart","undefined","Lpm311Sequencer","finished","initialCommands","nextCommand","decodeLpm311Record","isNormalDisconnect","exports"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/viatom/lpm311.sequencer.ts"],"mappings":";;;;;;AAGA,IAAAA,eAAA,GAAAC,OAAA;AAEA,MAAMC,OAAO,GAAG,sCAAsC;AACtD,MAAMC,cAAc,GAAG,sCAAsC;AAE7D,MAAMC,OAAO,GAAGA,CAACC,IAAY,EAAEC,kBAA2B,MAAqB;EAC7EC,WAAW,EAAEL,OAAO;EACpBM,kBAAkB,EAAEL,cAAc;EAClCM,KAAK,EAAE,CAAC,GAAGJ,IAAI,CAAC,CAACK,GAAG,CAAEC,SAAS,IAC7BA,SAAS,CAACC,UAAU,CAAC,CAAC,CAAC,CAACC,QAAQ,CAAC,EAAE,CAAC,CAACC,QAAQ,CAAC,CAAC,EAAE,GAAG,CACtD,CAAC;EACD,IAAIR,kBAAkB,KAAKS,SAAS,GAAG,CAAC,CAAC,GAAG;IAAET;EAAmB,CAAC;AACpE,CAAC,CAAC;;AAEF;AACO,MAAMU,eAAe,CAA6B;EAC/CC,QAAQ,GAAG,KAAK;EAEjBC,eAAe,GAAGA,CAAA,KAAgC,CACvDd,OAAO,CAAC,SAAS,EAAE,KAAK,CAAC,CAC1B;EAEMe,WAAW,GAChBV,KAAwB,IACiB;IACzC,IAAI,CAAC,IAAAW,kCAAkB,EAACX,KAAK,CAAC,EAAE;MAC9B,OAAOM,SAAS;IAClB;IAEA,IAAI,CAACE,QAAQ,GAAG,IAAI;IAEpB,OAAO,CAACb,OAAO,CAAC,YAAY,CAAC,CAAC;EAChC,CAAC;EAEMiB,kBAAkB,GAAGA,CAAA,KAAe,IAAI,CAACJ,QAAQ;AAC1D;AAACK,OAAA,CAAAN,eAAA,GAAAA,eAAA","ignoreList":[]}
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.oxyS3MainServices = exports.OxyS3Device = void 0;
7
+ var _core = require("@ovok/core");
8
+ var _btManagedDevice = require("../bt-managed-device.js");
9
+ var _oxyS3Protocol = require("./oxy-s3.protocol.js");
10
+ var _oxyS3Sequencer = require("./oxy-s3.sequencer.js");
11
+ /* eslint-disable import/group-exports */
12
+
13
+ const acceptNothing = {
14
+ caseValuePosition: [],
15
+ cases: []
16
+ };
17
+ const oxyS3MainServices = exports.oxyS3MainServices = [{
18
+ uuid: _oxyS3Protocol.OXY_S3_V1_SERVICE,
19
+ monitorUuids: [{
20
+ uuid: _oxyS3Protocol.OXY_S3_V1_NOTIFY,
21
+ parsingModel: acceptNothing
22
+ }],
23
+ writeUuid: {
24
+ uuid: _oxyS3Protocol.OXY_S3_V1_WRITE,
25
+ mainCommandUuid: "55"
26
+ }
27
+ }, {
28
+ uuid: _oxyS3Protocol.OXY_S3_V2_SERVICE,
29
+ monitorUuids: [{
30
+ uuid: _oxyS3Protocol.OXY_S3_V2_NOTIFY,
31
+ parsingModel: acceptNothing
32
+ }],
33
+ writeUuid: {
34
+ uuid: _oxyS3Protocol.OXY_S3_V2_WRITE,
35
+ mainCommandUuid: "a5"
36
+ }
37
+ }];
38
+
39
+ /** ViHealth BBSM S3 uses both its legacy Oxy and OxyII GATT services. */
40
+ class OxyS3Device extends _btManagedDevice.BTManagedDevice {
41
+ mainServices = oxyS3MainServices;
42
+ stuckDataTimeout = 60_000;
43
+ onStreamStart = undefined;
44
+ preferredMtu = 247;
45
+ getSupportedMeasurementTypeKeys() {
46
+ return [_core.MeasurementTypeKey.bloodOxygenPulseRate];
47
+ }
48
+ constructor(device, params) {
49
+ super(device, params);
50
+ this.frameReader = new _oxyS3Protocol.OxyS3FrameReader();
51
+ this.createCommandSequencer = () => {
52
+ const advertisement = (0, _oxyS3Protocol.parseOxyS3Advertisement)(device.manufacturerData);
53
+ const protocol = advertisement.protocol;
54
+ const serviceUuid = protocol === "v2" ? _oxyS3Protocol.OXY_S3_V2_SERVICE : _oxyS3Protocol.OXY_S3_V1_SERVICE;
55
+ const characteristicUuid = protocol === "v2" ? _oxyS3Protocol.OXY_S3_V2_WRITE : _oxyS3Protocol.OXY_S3_V1_WRITE;
56
+ return new _oxyS3Sequencer.OxyS3Sequencer({
57
+ protocol,
58
+ encrypted: advertisement.encrypted,
59
+ write: {
60
+ serviceUuid,
61
+ characteristicUuid
62
+ },
63
+ onResult: result => this.onResult?.(result)
64
+ });
65
+ };
66
+ }
67
+ handleSuccessResult() {
68
+ return;
69
+ }
70
+ }
71
+ exports.OxyS3Device = OxyS3Device;
72
+ //# sourceMappingURL=oxy-s3.device.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_core","require","_btManagedDevice","_oxyS3Protocol","_oxyS3Sequencer","acceptNothing","caseValuePosition","cases","oxyS3MainServices","exports","uuid","OXY_S3_V1_SERVICE","monitorUuids","OXY_S3_V1_NOTIFY","parsingModel","writeUuid","OXY_S3_V1_WRITE","mainCommandUuid","OXY_S3_V2_SERVICE","OXY_S3_V2_NOTIFY","OXY_S3_V2_WRITE","OxyS3Device","BTManagedDevice","mainServices","stuckDataTimeout","onStreamStart","undefined","preferredMtu","getSupportedMeasurementTypeKeys","MeasurementTypeKey","bloodOxygenPulseRate","constructor","device","params","frameReader","OxyS3FrameReader","createCommandSequencer","advertisement","parseOxyS3Advertisement","manufacturerData","protocol","serviceUuid","characteristicUuid","OxyS3Sequencer","encrypted","write","onResult","result","handleSuccessResult"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/viatom/oxy-s3.device.ts"],"mappings":";;;;;;AAEA,IAAAA,KAAA,GAAAC,OAAA;AAQA,IAAAC,gBAAA,GAAAD,OAAA;AAEA,IAAAE,cAAA,GAAAF,OAAA;AAUA,IAAAG,eAAA,GAAAH,OAAA;AAtBA;;AAwBA,MAAMI,aAAa,GAAG;EAAEC,iBAAiB,EAAE,EAAE;EAAEC,KAAK,EAAE;AAAG,CAAC;AAEnD,MAAMC,iBAA6B,GAAAC,OAAA,CAAAD,iBAAA,GAAG,CAC3C;EACEE,IAAI,EAAEC,gCAAiB;EACvBC,YAAY,EAAE,CAAC;IAAEF,IAAI,EAAEG,+BAAgB;IAAEC,YAAY,EAAET;EAAc,CAAC,CAAC;EACvEU,SAAS,EAAE;IAAEL,IAAI,EAAEM,8BAAe;IAAEC,eAAe,EAAE;EAAK;AAC5D,CAAC,EACD;EACEP,IAAI,EAAEQ,gCAAiB;EACvBN,YAAY,EAAE,CAAC;IAAEF,IAAI,EAAES,+BAAgB;IAAEL,YAAY,EAAET;EAAc,CAAC,CAAC;EACvEU,SAAS,EAAE;IAAEL,IAAI,EAAEU,8BAAe;IAAEH,eAAe,EAAE;EAAK;AAC5D,CAAC,CACF;;AAED;AACO,MAAMI,WAAW,SAASC,gCAAe,CAA4B;EAChEC,YAAY,GAAGf,iBAAiB;EAChCgB,gBAAgB,GAAG,MAAM;EACzBC,aAAa,GAAGC,SAAS;EAChBC,YAAY,GAAG,GAAG;EAElBC,+BAA+BA,CAAA,EAAyB;IACzE,OAAO,CAACC,wBAAkB,CAACC,oBAAoB,CAAC;EAClD;EAEOC,WAAWA,CAChBC,MAAc,EACdC,MAAqD,EACrD;IACA,KAAK,CAACD,MAAM,EAAEC,MAAM,CAAC;IACrB,IAAI,CAACC,WAAW,GAAG,IAAIC,+BAAgB,CAAC,CAAC;IACzC,IAAI,CAACC,sBAAsB,GAAG,MAAM;MAClC,MAAMC,aAAa,GAAG,IAAAC,sCAAuB,EAACN,MAAM,CAACO,gBAAgB,CAAC;MACtE,MAAMC,QAAQ,GAAGH,aAAa,CAACG,QAAQ;MAEvC,MAAMC,WAAW,GACfD,QAAQ,KAAK,IAAI,GAAGtB,gCAAiB,GAAGP,gCAAiB;MAE3D,MAAM+B,kBAAkB,GACtBF,QAAQ,KAAK,IAAI,GAAGpB,8BAAe,GAAGJ,8BAAe;MAEvD,OAAO,IAAI2B,8BAAc,CAAC;QACxBH,QAAQ;QACRI,SAAS,EAAEP,aAAa,CAACO,SAAS;QAClCC,KAAK,EAAE;UAAEJ,WAAW;UAAEC;QAAmB,CAAC;QAC1CI,QAAQ,EAAGC,MAAM,IACf,IAAI,CAACD,QAAQ,GACXC,MAGF;MACJ,CAAC,CAAC;IACJ,CAAC;EACH;EAEUC,mBAAmBA,CAAA,EAAS;IACpC;EACF;AACF;AAACvC,OAAA,CAAAY,WAAA,GAAAA,WAAA","ignoreList":[]}
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.parseOxyS3Reading = exports.parseOxyS3Advertisement = exports.decodeOxyS3Response = exports.buildOxyS3LegacyFrame = exports.OxyS3FrameReader = exports.OxyS3Command = exports.OXY_S3_V2_WRITE = exports.OXY_S3_V2_SERVICE = exports.OXY_S3_V2_NOTIFY = exports.OXY_S3_V1_WRITE = exports.OXY_S3_V1_SERVICE = exports.OXY_S3_V1_NOTIFY = void 0;
7
+ var _calculateCrc = require("../../../utils/calculate-crc-8.js");
8
+ var _hexToByte = require("../../../utils/hex-to-byte.js");
9
+ var _le16FromHex = require("../../../utils/le-16-from-hex.js");
10
+ var _lepuAdvertisement = require("../lepu/lepu.advertisement.js");
11
+ var _lepuFrameReader = require("../lepu/lepu.frame-reader.js");
12
+ /* eslint-disable import/group-exports */
13
+
14
+ const OXY_S3_V1_SERVICE = exports.OXY_S3_V1_SERVICE = "14839ac4-7d7e-415c-9a42-167340cf2339";
15
+ const OXY_S3_V1_WRITE = exports.OXY_S3_V1_WRITE = "8b00ace7-eb0b-49b0-bbe9-9aee0a26e1a3";
16
+ const OXY_S3_V1_NOTIFY = exports.OXY_S3_V1_NOTIFY = "0734594a-a8e7-4b1a-a6b1-cd5243059a57";
17
+ const OXY_S3_V2_SERVICE = exports.OXY_S3_V2_SERVICE = "e8fb0001-a14b-98f9-831b-4e2941d01248";
18
+ const OXY_S3_V2_WRITE = exports.OXY_S3_V2_WRITE = "e8fb0002-a14b-98f9-831b-4e2941d01248";
19
+ const OXY_S3_V2_NOTIFY = exports.OXY_S3_V2_NOTIFY = "e8fb0003-a14b-98f9-831b-4e2941d01248";
20
+ const OxyS3Command = exports.OxyS3Command = {
21
+ authenticate: 0xff,
22
+ syncTime: 0xc0,
23
+ enableRealtimeParameters: 0x10,
24
+ realtimeParameters: 0x11,
25
+ legacySyncTime: 0x16,
26
+ legacyRealtimeParameters: 0x17
27
+ };
28
+ const byte = value => (value & 0xff).toString(16).padStart(2, "0");
29
+
30
+ /** The app selects V2 from manufacturer byte 4, otherwise it uses byte 3. */
31
+ const parseOxyS3Advertisement = manufacturerData => {
32
+ const bytes = (0, _lepuAdvertisement.manufacturerBytes)(manufacturerData ?? undefined);
33
+ const v2 = ((bytes[4] ?? 0) & 0x0f) === 2;
34
+ const protocolByte = v2 ? bytes[4] ?? 0 : bytes[3] ?? 0;
35
+ const encryptionLevel = (protocolByte & 0xf0) >> 4;
36
+ return {
37
+ protocol: v2 ? "v2" : "v1",
38
+ encrypted: encryptionLevel === 1 || encryptionLevel === 2
39
+ };
40
+ };
41
+
42
+ /** Oxy S3 notifications use the shared Lepu 55 (V1) or A5 (V2) frame. */
43
+ exports.parseOxyS3Advertisement = parseOxyS3Advertisement;
44
+ class OxyS3FrameReader {
45
+ reader = new _lepuFrameReader.LepuFrameReader(["55", "a5"]);
46
+ readFrame = buffer => this.reader.readFrame(buffer);
47
+ }
48
+ exports.OxyS3FrameReader = OxyS3FrameReader;
49
+ const decodeOxyS3Response = (frame, protocol) => {
50
+ const startByte = protocol === "v2" ? 0xa5 : 0x55;
51
+ if (frame.length < 8 || (0, _hexToByte.hexToByte)(frame[0] ?? "00") !== startByte) {
52
+ return undefined;
53
+ }
54
+ const commandOrStatus = (0, _hexToByte.hexToByte)(frame[1] ?? "00");
55
+ if ((0, _hexToByte.hexToByte)(frame[2] ?? "00") !== (~commandOrStatus & 0xff)) {
56
+ return undefined;
57
+ }
58
+ const payloadLength = (0, _le16FromHex.le16FromHex)(frame, 5);
59
+ const checksumIndex = frame.length - 1;
60
+ if (frame.length !== payloadLength + 8 || (0, _hexToByte.hexToByte)(frame[checksumIndex] ?? "00") !== (0, _calculateCrc.calculateCrc8)([...frame], checksumIndex)) {
61
+ return undefined;
62
+ }
63
+ return protocol === "v2" ? {
64
+ command: commandOrStatus,
65
+ status: (0, _hexToByte.hexToByte)(frame[3] ?? "00"),
66
+ payload: frame.slice(7, checksumIndex).map(value => (0, _hexToByte.hexToByte)(value))
67
+ } : {
68
+ // The legacy reply carries success in byte 1 and correlates by request order.
69
+ status: commandOrStatus === 0 ? 1 : 0,
70
+ payload: frame.slice(7, checksumIndex).map(value => (0, _hexToByte.hexToByte)(value))
71
+ };
72
+ };
73
+
74
+ /** Builds an Oxy V1 AA request; unlike the A5 family, its response does not echo opcodes. */
75
+ exports.decodeOxyS3Response = decodeOxyS3Response;
76
+ const buildOxyS3LegacyFrame = (command, payload = []) => {
77
+ const frame = ["aa", byte(command), byte(~command), "00", "00", byte(payload.length), byte(payload.length >>> 8), ...payload.map(byte), "00"];
78
+ frame[frame.length - 1] = byte((0, _calculateCrc.calculateCrc8)(frame, frame.length - 1));
79
+ return frame;
80
+ };
81
+ exports.buildOxyS3LegacyFrame = buildOxyS3LegacyFrame;
82
+ const parseOxyS3Reading = (payload, protocol) => {
83
+ if (protocol === "v1") {
84
+ if (payload.length < 12) {
85
+ return undefined;
86
+ }
87
+ return {
88
+ bloodOxygen: payload[0] ?? 0,
89
+ pulseRate: (payload[1] ?? 0) | (payload[2] ?? 0) << 8,
90
+ perfusionIndex: payload[10] ?? 0
91
+ };
92
+ }
93
+ if (payload.length < 14) {
94
+ return undefined;
95
+ }
96
+ return {
97
+ bloodOxygen: payload[6] ?? 0,
98
+ perfusionIndex: (payload[7] ?? 0) / 10,
99
+ pulseRate: (payload[8] ?? 0) | (payload[9] ?? 0) << 8
100
+ };
101
+ };
102
+ exports.parseOxyS3Reading = parseOxyS3Reading;
103
+ //# sourceMappingURL=oxy-s3.protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_calculateCrc","require","_hexToByte","_le16FromHex","_lepuAdvertisement","_lepuFrameReader","OXY_S3_V1_SERVICE","exports","OXY_S3_V1_WRITE","OXY_S3_V1_NOTIFY","OXY_S3_V2_SERVICE","OXY_S3_V2_WRITE","OXY_S3_V2_NOTIFY","OxyS3Command","authenticate","syncTime","enableRealtimeParameters","realtimeParameters","legacySyncTime","legacyRealtimeParameters","byte","value","toString","padStart","parseOxyS3Advertisement","manufacturerData","bytes","manufacturerBytes","undefined","v2","protocolByte","encryptionLevel","protocol","encrypted","OxyS3FrameReader","reader","LepuFrameReader","readFrame","buffer","decodeOxyS3Response","frame","startByte","length","hexToByte","commandOrStatus","payloadLength","le16FromHex","checksumIndex","calculateCrc8","command","status","payload","slice","map","buildOxyS3LegacyFrame","parseOxyS3Reading","bloodOxygen","pulseRate","perfusionIndex"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/viatom/oxy-s3.protocol.ts"],"mappings":";;;;;;AAGA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,kBAAA,GAAAH,OAAA;AACA,IAAAI,gBAAA,GAAAJ,OAAA;AAPA;;AASO,MAAMK,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAG,sCAAsC;AAChE,MAAME,eAAe,GAAAD,OAAA,CAAAC,eAAA,GAAG,sCAAsC;AAC9D,MAAMC,gBAAgB,GAAAF,OAAA,CAAAE,gBAAA,GAAG,sCAAsC;AAC/D,MAAMC,iBAAiB,GAAAH,OAAA,CAAAG,iBAAA,GAAG,sCAAsC;AAChE,MAAMC,eAAe,GAAAJ,OAAA,CAAAI,eAAA,GAAG,sCAAsC;AAC9D,MAAMC,gBAAgB,GAAAL,OAAA,CAAAK,gBAAA,GAAG,sCAAsC;AAE/D,MAAMC,YAAY,GAAAN,OAAA,CAAAM,YAAA,GAAG;EAC1BC,YAAY,EAAE,IAAI;EAClBC,QAAQ,EAAE,IAAI;EACdC,wBAAwB,EAAE,IAAI;EAC9BC,kBAAkB,EAAE,IAAI;EACxBC,cAAc,EAAE,IAAI;EACpBC,wBAAwB,EAAE;AAC5B,CAAU;AAqBV,MAAMC,IAAI,GAAIC,KAAa,IACzB,CAACA,KAAK,GAAG,IAAI,EAAEC,QAAQ,CAAC,EAAE,CAAC,CAACC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;;AAE9C;AACO,MAAMC,uBAAuB,GAClCC,gBAAgC,IACT;EACvB,MAAMC,KAAK,GAAG,IAAAC,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
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.OxyS3Sequencer = void 0;
7
+ var _core = require("@ovok/core");
8
+ var _caseType = require("../../../types/case-type.js");
9
+ var _lepuCommandBuilder = require("../lepu/lepu.command-builder.js");
10
+ var _oxyS3Protocol = require("./oxy-s3.protocol.js");
11
+ var _viatomLepuCrypto = require("./viatom-lepu-crypto.js");
12
+ const toBytes = value => Array.from(value, character => character.charCodeAt(0));
13
+ const validOxygen = value => value >= 50 && value <= 100;
14
+ const validPulse = value => value > 0 && value <= 300;
15
+
16
+ /** Drives the two Oxy S3 transports documented by ViHealth: legacy Oxy and encrypted A5. */
17
+ class OxyS3Sequencer {
18
+ commands = new _lepuCommandBuilder.LepuCommandBuilder("a5");
19
+ constructor(params) {
20
+ this.params = params;
21
+ this.phase = params.encrypted ? "authenticate" : "clock";
22
+ }
23
+ initialCommands = () => this.phase === "authenticate" ? [this.command(_oxyS3Protocol.OxyS3Command.authenticate, (0, _viatomLepuCrypto.createLepuAccessToken)(this.now()))] : [this.timeCommand()];
24
+ nextCommand = frame => {
25
+ const response = (0, _oxyS3Protocol.decodeOxyS3Response)(frame, this.params.protocol);
26
+ if (!response) {
27
+ return undefined;
28
+ }
29
+ if (this.phase === "authenticate") {
30
+ if (response.status !== 1 || this.params.protocol === "v2" && response.command !== _oxyS3Protocol.OxyS3Command.authenticate) {
31
+ return undefined;
32
+ }
33
+ const sessionKey = (0, _viatomLepuCrypto.parseLepuSessionKey)((0, _viatomLepuCrypto.decryptLepuHandshake)(response.payload));
34
+ if (!sessionKey) {
35
+ return undefined;
36
+ }
37
+ this.sessionKey = sessionKey;
38
+ this.phase = "clock";
39
+ return [this.timeCommand()];
40
+ }
41
+ if (this.phase === "clock") {
42
+ if (response.status !== 1 || this.params.protocol === "v2" && response.command !== _oxyS3Protocol.OxyS3Command.syncTime) {
43
+ return undefined;
44
+ }
45
+ if (this.params.protocol === "v1") {
46
+ this.phase = "ready";
47
+ return [this.readLegacyParameters()];
48
+ }
49
+ this.phase = "stream";
50
+ return [this.command(_oxyS3Protocol.OxyS3Command.enableRealtimeParameters, [1])];
51
+ }
52
+ if (this.phase === "stream") {
53
+ if (response.command !== _oxyS3Protocol.OxyS3Command.enableRealtimeParameters || response.status !== 1) {
54
+ return undefined;
55
+ }
56
+ this.phase = "ready";
57
+ return undefined;
58
+ }
59
+ if (this.params.protocol === "v2" && response.command === _oxyS3Protocol.OxyS3Command.realtimeParameters && response.status === 1) {
60
+ this.report(this.decrypt(response.payload));
61
+ } else if (this.params.protocol === "v1" && response.status === 1) {
62
+ this.report(this.decrypt(response.payload));
63
+ return [this.readLegacyParameters()];
64
+ }
65
+ return undefined;
66
+ };
67
+ command = (command, payload = []) => {
68
+ const encryptedPayload = this.sessionKey ? (0, _viatomLepuCrypto.encryptLepuPayload)(payload, this.sessionKey) : [...payload];
69
+ const frame = this.params.protocol === "v2" ? this.commands.build(command, encryptedPayload) : (0, _oxyS3Protocol.buildOxyS3LegacyFrame)(command, encryptedPayload);
70
+ return {
71
+ ...this.params.write,
72
+ frame,
73
+ withoutResponse: true
74
+ };
75
+ };
76
+ timeCommand = () => {
77
+ const date = this.now();
78
+ if (this.params.protocol === "v1") {
79
+ const time = `${date.getFullYear()}-${this.pad(date.getMonth() + 1)}-${this.pad(date.getDate())},${this.pad(date.getHours())}:${this.pad(date.getMinutes())}:${this.pad(date.getSeconds())}`;
80
+ return this.command(_oxyS3Protocol.OxyS3Command.legacySyncTime, toBytes(JSON.stringify({
81
+ SetTIME: time
82
+ })));
83
+ }
84
+ const year = date.getFullYear();
85
+ const timezoneOffsetTenthHours = Math.round(-date.getTimezoneOffset() / 6);
86
+ return this.command(_oxyS3Protocol.OxyS3Command.syncTime, [year & 0xff, year >>> 8, date.getMonth() + 1, date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), timezoneOffsetTenthHours & 0xff]);
87
+ };
88
+ readLegacyParameters = () => this.command(_oxyS3Protocol.OxyS3Command.legacyRealtimeParameters);
89
+ decrypt = payload => this.sessionKey ? (0, _viatomLepuCrypto.decryptLepuPayload)(payload, this.sessionKey) ?? [] : [...payload];
90
+ report = payload => {
91
+ const reading = (0, _oxyS3Protocol.parseOxyS3Reading)(payload, this.params.protocol);
92
+ if (!reading || !validOxygen(reading.bloodOxygen) || !validPulse(reading.pulseRate)) {
93
+ return;
94
+ }
95
+ this.params.onResult({
96
+ caseType: _caseType.CaseType.RESULT,
97
+ measurementTypeKey: _core.MeasurementTypeKey.bloodOxygenPulseRate,
98
+ bloodOxygen: reading.bloodOxygen,
99
+ pulseRate: reading.pulseRate,
100
+ ...(reading.perfusionIndex > 0 ? {
101
+ perfusionIndex: reading.perfusionIndex
102
+ } : {}),
103
+ recordedAt: this.now()
104
+ });
105
+ };
106
+ now = () => this.params.now?.() ?? new Date();
107
+ pad = value => value.toString().padStart(2, "0");
108
+ }
109
+ exports.OxyS3Sequencer = OxyS3Sequencer;
110
+ //# sourceMappingURL=oxy-s3.sequencer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_core","require","_caseType","_lepuCommandBuilder","_oxyS3Protocol","_viatomLepuCrypto","toBytes","value","Array","from","character","charCodeAt","validOxygen","validPulse","OxyS3Sequencer","commands","LepuCommandBuilder","constructor","params","phase","encrypted","initialCommands","command","OxyS3Command","authenticate","createLepuAccessToken","now","timeCommand","nextCommand","frame","response","decodeOxyS3Response","protocol","undefined","status","sessionKey","parseLepuSessionKey","decryptLepuHandshake","payload","syncTime","readLegacyParameters","enableRealtimeParameters","realtimeParameters","report","decrypt","encryptedPayload","encryptLepuPayload","build","buildOxyS3LegacyFrame","write","withoutResponse","date","time","getFullYear","pad","getMonth","getDate","getHours","getMinutes","getSeconds","legacySyncTime","JSON","stringify","SetTIME","year","timezoneOffsetTenthHours","Math","round","getTimezoneOffset","legacyRealtimeParameters","decryptLepuPayload","reading","parseOxyS3Reading","bloodOxygen","pulseRate","onResult","caseType","CaseType","RESULT","measurementTypeKey","MeasurementTypeKey","bloodOxygenPulseRate","perfusionIndex","recordedAt","Date","toString","padStart","exports"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/viatom/oxy-s3.sequencer.ts"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AAIA,IAAAE,mBAAA,GAAAF,OAAA;AAEA,IAAAG,cAAA,GAAAH,OAAA;AAOA,IAAAI,iBAAA,GAAAJ,OAAA;AAkBA,MAAMK,OAAO,GAAIC,KAAa,IAC5BC,KAAK,CAACC,IAAI,CAACF,KAAK,EAAGG,SAAS,IAAKA,SAAS,CAACC,UAAU,CAAC,CAAC,CAAC,CAAC;AAE3D,MAAMC,WAAW,GAAIL,KAAa,IAAcA,KAAK,IAAI,EAAE,IAAIA,KAAK,IAAI,GAAG;AAC3E,MAAMM,UAAU,GAAIN,KAAa,IAAcA,KAAK,GAAG,CAAC,IAAIA,KAAK,IAAI,GAAG;;AAExE;AACO,MAAMO,cAAc,CAA6B;EACrCC,QAAQ,GAAG,IAAIC,sCAAkB,CAAC,IAAI,CAAC;EAIjDC,WAAWA,CAAkBC,MAA4B,EAAE;IAAA,KAA9BA,MAA4B,GAA5BA,MAA4B;IAC9D,IAAI,CAACC,KAAK,GAAGD,MAAM,CAACE,SAAS,GAAG,cAAc,GAAG,OAAO;EAC1D;EAEOC,eAAe,GAAGA,CAAA,KACvB,IAAI,CAACF,KAAK,KAAK,cAAc,GACzB,CACE,IAAI,CAACG,OAAO,CACVC,2BAAY,CAACC,YAAY,EACzB,IAAAC,uCAAqB,EAAC,IAAI,CAACC,GAAG,CAAC,CAAC,CAClC,CAAC,CACF,GACD,CAAC,IAAI,CAACC,WAAW,CAAC,CAAC,CAAC;EAEnBC,WAAW,GAChBC,KAAwB,IACiB;IACzC,MAAMC,QAAQ,GAAG,IAAAC,kCAAmB,EAACF,KAAK,EAAE,IAAI,CAACX,MAAM,CAACc,QAAQ,CAAC;IAE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 +1,53 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.pf10Aw1MainServices = exports.Pf10Aw1Device = void 0;
7
+ var _core = require("@ovok/core");
8
+ var _btManagedDevice = require("../bt-managed-device.js");
9
+ var _pf10aw1Protocol = require("./pf10aw1.protocol.js");
10
+ var _pf10aw1Sequencer = require("./pf10aw1.sequencer.js");
11
+ /* eslint-disable import/group-exports */
12
+
13
+ const acceptNothing = {
14
+ caseValuePosition: [],
15
+ cases: []
16
+ };
17
+ const pf10Aw1MainServices = exports.pf10Aw1MainServices = [{
18
+ uuid: _pf10aw1Protocol.PF10AW1_SERVICE,
19
+ monitorUuids: [{
20
+ uuid: _pf10aw1Protocol.PF10AW1_NOTIFY,
21
+ parsingModel: acceptNothing
22
+ }],
23
+ writeUuid: {
24
+ uuid: _pf10aw1Protocol.PF10AW1_WRITE,
25
+ mainCommandUuid: "a5"
26
+ }
27
+ }];
28
+
29
+ /** ViHealth PF10AW-ME, SA10AW-PU, and PF10BW-VE encrypted oximeter driver. */
30
+ class Pf10Aw1Device extends _btManagedDevice.BTManagedDevice {
31
+ mainServices = pf10Aw1MainServices;
32
+ stuckDataTimeout = 60_000;
33
+ onStreamStart = undefined;
34
+ getSupportedMeasurementTypeKeys() {
35
+ return [_core.MeasurementTypeKey.bloodOxygenPulseRate];
36
+ }
37
+ constructor(device, params) {
38
+ super(device, params);
39
+ this.frameReader = new _pf10aw1Protocol.Pf10Aw1FrameReader();
40
+ this.createCommandSequencer = () => new _pf10aw1Sequencer.Pf10Aw1Sequencer({
41
+ write: {
42
+ serviceUuid: _pf10aw1Protocol.PF10AW1_SERVICE,
43
+ characteristicUuid: _pf10aw1Protocol.PF10AW1_WRITE
44
+ },
45
+ onResult: result => this.onResult?.(result)
46
+ });
47
+ }
48
+ handleSuccessResult() {
49
+ return;
50
+ }
51
+ }
52
+ exports.Pf10Aw1Device = Pf10Aw1Device;
53
+ //# sourceMappingURL=pf10aw1.device.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_core","require","_btManagedDevice","_pf10aw1Protocol","_pf10aw1Sequencer","acceptNothing","caseValuePosition","cases","pf10Aw1MainServices","exports","uuid","PF10AW1_SERVICE","monitorUuids","PF10AW1_NOTIFY","parsingModel","writeUuid","PF10AW1_WRITE","mainCommandUuid","Pf10Aw1Device","BTManagedDevice","mainServices","stuckDataTimeout","onStreamStart","undefined","getSupportedMeasurementTypeKeys","MeasurementTypeKey","bloodOxygenPulseRate","constructor","device","params","frameReader","Pf10Aw1FrameReader","createCommandSequencer","Pf10Aw1Sequencer","write","serviceUuid","characteristicUuid","onResult","result","handleSuccessResult"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/viatom/pf10aw1.device.ts"],"mappings":";;;;;;AAEA,IAAAA,KAAA,GAAAC,OAAA;AAQA,IAAAC,gBAAA,GAAAD,OAAA;AAEA,IAAAE,gBAAA,GAAAF,OAAA;AAMA,IAAAG,iBAAA,GAAAH,OAAA;AAlBA;;AAyBA,MAAMI,aAAa,GAAG;EAAEC,iBAAiB,EAAE,EAAE;EAAEC,KAAK,EAAE;AAAG,CAAC;AAEnD,MAAMC,mBAA+B,GAAAC,OAAA,CAAAD,mBAAA,GAAG,CAC7C;EACEE,IAAI,EAAEC,gCAAe;EACrBC,YAAY,EAAE,CAAC;IAAEF,IAAI,EAAEG,+BAAc;IAAEC,YAAY,EAAET;EAAc,CAAC,CAAC;EACrEU,SAAS,EAAE;IAAEL,IAAI,EAAEM,8BAAa;IAAEC,eAAe,EAAE;EAAK;AAC1D,CAAC,CACF;;AAED;AACO,MAAMC,aAAa,SAASC,gCAAe,CAAkB;EACxDC,YAAY,GAAGZ,mBAAmB;EAClCa,gBAAgB,GAAG,MAAM;EACzBC,aAAa,GAAGC,SAAS;EAEhBC,+BAA+BA,CAAA,EAAyB;IACzE,OAAO,CAACC,wBAAkB,CAACC,oBAAoB,CAAC;EAClD;EAEOC,WAAWA,CAChBC,MAAc,EACdC,MAA2C,EAC3C;IACA,KAAK,CAACD,MAAM,EAAEC,MAAM,CAAC;IACrB,IAAI,CAACC,WAAW,GAAG,IAAIC,mCAAkB,CAAC,CAAC;IAC3C,IAAI,CAACC,sBAAsB,GAAG,MAC5B,IAAIC,kCAAgB,CAAC;MACnBC,KAAK,EAAE;QACLC,WAAW,EAAExB,gCAAe;QAC5ByB,kBAAkB,EAAEpB;MACtB,CAAC;MACDqB,QAAQ,EAAGC,MAAM,IACf,IAAI,CAACD,QAAQ,GACXC,MAGF;IACJ,CAAC,CAAC;EACN;EAEUC,mBAAmBA,CAAA,EAAS;IACpC;EACF;AACF;AAAC9B,OAAA,CAAAS,aAAA,GAAAA,aAAA","ignoreList":[]}
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.parsePf10Aw1OximeterReading = exports.decodePf10Aw1Response = exports.Pf10Aw1FrameReader = exports.Pf10Aw1Command = exports.PF10AW1_WRITE = exports.PF10AW1_SERVICE = exports.PF10AW1_NOTIFY = void 0;
7
+ var _calculateCrc = require("../../../utils/calculate-crc-8.js");
8
+ var _hexToByte = require("../../../utils/hex-to-byte.js");
9
+ var _le16FromHex = require("../../../utils/le-16-from-hex.js");
10
+ var _lepuFrameReader = require("../lepu/lepu.frame-reader.js");
11
+ /* eslint-disable import/group-exports */
12
+
13
+ const PF10AW1_SERVICE = exports.PF10AW1_SERVICE = "e8fb0001-a14b-98f9-831b-4e2941d01248";
14
+ const PF10AW1_WRITE = exports.PF10AW1_WRITE = "e8fb0002-a14b-98f9-831b-4e2941d01248";
15
+ const PF10AW1_NOTIFY = exports.PF10AW1_NOTIFY = "e8fb0003-a14b-98f9-831b-4e2941d01248";
16
+ const Pf10Aw1Command = exports.Pf10Aw1Command = {
17
+ authenticate: 0xff,
18
+ setUtcTime: 0xc0,
19
+ enableParameters: 0x02,
20
+ enableWave: 0x03,
21
+ realtimeParameters: 0x04
22
+ };
23
+ /** PF10AW1 uses the shared Lepu A5 frame and CRC-8/ATM. */
24
+ class Pf10Aw1FrameReader {
25
+ reader = new _lepuFrameReader.LepuFrameReader(["a5"]);
26
+ readFrame = buffer => this.reader.readFrame(buffer);
27
+ }
28
+ exports.Pf10Aw1FrameReader = Pf10Aw1FrameReader;
29
+ const decodePf10Aw1Response = frame => {
30
+ if (frame.length < 8 || (0, _hexToByte.hexToByte)(frame[0] ?? "00") !== 0xa5) {
31
+ return undefined;
32
+ }
33
+ const command = (0, _hexToByte.hexToByte)(frame[1] ?? "00");
34
+ if ((0, _hexToByte.hexToByte)(frame[2] ?? "00") !== (~command & 0xff)) {
35
+ return undefined;
36
+ }
37
+ const payloadLength = (0, _le16FromHex.le16FromHex)(frame, 5);
38
+ if (frame.length !== payloadLength + 8) {
39
+ return undefined;
40
+ }
41
+ const checksumIndex = frame.length - 1;
42
+ if ((0, _hexToByte.hexToByte)(frame[checksumIndex] ?? "00") !== (0, _calculateCrc.calculateCrc8)([...frame], checksumIndex)) {
43
+ return undefined;
44
+ }
45
+ return {
46
+ command,
47
+ status: (0, _hexToByte.hexToByte)(frame[3] ?? "00"),
48
+ payload: frame.slice(7, checksumIndex).map(value => (0, _hexToByte.hexToByte)(value))
49
+ };
50
+ };
51
+ exports.decodePf10Aw1Response = decodePf10Aw1Response;
52
+ const parsePf10Aw1OximeterReading = payload => {
53
+ if (payload.length < 5) {
54
+ return undefined;
55
+ }
56
+ return {
57
+ bloodOxygen: payload[0] ?? 0,
58
+ pulseRate: payload[1] ?? 0,
59
+ perfusionIndex: (payload[2] ?? 0) / 10,
60
+ probeOff: ((payload[3] ?? 0) & 0x02) !== 0
61
+ };
62
+ };
63
+ exports.parsePf10Aw1OximeterReading = parsePf10Aw1OximeterReading;
64
+ //# sourceMappingURL=pf10aw1.protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_calculateCrc","require","_hexToByte","_le16FromHex","_lepuFrameReader","PF10AW1_SERVICE","exports","PF10AW1_WRITE","PF10AW1_NOTIFY","Pf10Aw1Command","authenticate","setUtcTime","enableParameters","enableWave","realtimeParameters","Pf10Aw1FrameReader","reader","LepuFrameReader","readFrame","buffer","decodePf10Aw1Response","frame","length","hexToByte","undefined","command","payloadLength","le16FromHex","checksumIndex","calculateCrc8","status","payload","slice","map","value","parsePf10Aw1OximeterReading","bloodOxygen","pulseRate","perfusionIndex","probeOff"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/viatom/pf10aw1.protocol.ts"],"mappings":";;;;;;AAGA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAH,OAAA;AANA;;AAQO,MAAMI,eAAe,GAAAC,OAAA,CAAAD,eAAA,GAAG,sCAAsC;AAC9D,MAAME,aAAa,GAAAD,OAAA,CAAAC,aAAA,GAAG,sCAAsC;AAC5D,MAAMC,cAAc,GAAAF,OAAA,CAAAE,cAAA,GAAG,sCAAsC;AAE7D,MAAMC,cAAc,GAAAH,OAAA,CAAAG,cAAA,GAAG;EAC5BC,YAAY,EAAE,IAAI;EAClBC,UAAU,EAAE,IAAI;EAChBC,gBAAgB,EAAE,IAAI;EACtBC,UAAU,EAAE,IAAI;EAChBC,kBAAkB,EAAE;AACtB,CAAU;AAeV;AACO,MAAMC,kBAAkB,CAAwB;EACpCC,MAAM,GAAG,IAAIC,gCAAe,CAAC,CAAC,IAAI,CAAC,CAAC;EAE9CC,SAAS,GAAIC,MAAyB,IAAK,IAAI,CAACH,MAAM,CAACE,SAAS,CAACC,MAAM,CAAC;AACjF;AAACb,OAAA,CAAAS,kBAAA,GAAAA,kBAAA;AAEM,MAAMK,qBAAqB,GAChCC,KAAwB,IACQ;EAChC,IAAIA,KAAK,CAACC,MAAM,GAAG,CAAC,IAAI,IAAAC,oBAAS,EAACF,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,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