@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,105 @@
1
+ "use strict";
2
+
3
+ import { MeasurementTypeKey } from "@ovok/core";
4
+ import { CaseType } from "../../../types/case-type.js";
5
+ import { LepuCommandBuilder } from "../lepu/lepu.command-builder.js";
6
+ import { buildOxyS3LegacyFrame, decodeOxyS3Response, OxyS3Command, parseOxyS3Reading } from "./oxy-s3.protocol.js";
7
+ import { createLepuAccessToken, decryptLepuHandshake, decryptLepuPayload, encryptLepuPayload, parseLepuSessionKey } from "./viatom-lepu-crypto.js";
8
+ const toBytes = value => Array.from(value, character => character.charCodeAt(0));
9
+ const validOxygen = value => value >= 50 && value <= 100;
10
+ const validPulse = value => value > 0 && value <= 300;
11
+
12
+ /** Drives the two Oxy S3 transports documented by ViHealth: legacy Oxy and encrypted A5. */
13
+ export class OxyS3Sequencer {
14
+ commands = new LepuCommandBuilder("a5");
15
+ constructor(params) {
16
+ this.params = params;
17
+ this.phase = params.encrypted ? "authenticate" : "clock";
18
+ }
19
+ initialCommands = () => this.phase === "authenticate" ? [this.command(OxyS3Command.authenticate, createLepuAccessToken(this.now()))] : [this.timeCommand()];
20
+ nextCommand = frame => {
21
+ const response = decodeOxyS3Response(frame, this.params.protocol);
22
+ if (!response) {
23
+ return undefined;
24
+ }
25
+ if (this.phase === "authenticate") {
26
+ if (response.status !== 1 || this.params.protocol === "v2" && response.command !== OxyS3Command.authenticate) {
27
+ return undefined;
28
+ }
29
+ const sessionKey = parseLepuSessionKey(decryptLepuHandshake(response.payload));
30
+ if (!sessionKey) {
31
+ return undefined;
32
+ }
33
+ this.sessionKey = sessionKey;
34
+ this.phase = "clock";
35
+ return [this.timeCommand()];
36
+ }
37
+ if (this.phase === "clock") {
38
+ if (response.status !== 1 || this.params.protocol === "v2" && response.command !== OxyS3Command.syncTime) {
39
+ return undefined;
40
+ }
41
+ if (this.params.protocol === "v1") {
42
+ this.phase = "ready";
43
+ return [this.readLegacyParameters()];
44
+ }
45
+ this.phase = "stream";
46
+ return [this.command(OxyS3Command.enableRealtimeParameters, [1])];
47
+ }
48
+ if (this.phase === "stream") {
49
+ if (response.command !== OxyS3Command.enableRealtimeParameters || response.status !== 1) {
50
+ return undefined;
51
+ }
52
+ this.phase = "ready";
53
+ return undefined;
54
+ }
55
+ if (this.params.protocol === "v2" && response.command === OxyS3Command.realtimeParameters && response.status === 1) {
56
+ this.report(this.decrypt(response.payload));
57
+ } else if (this.params.protocol === "v1" && response.status === 1) {
58
+ this.report(this.decrypt(response.payload));
59
+ return [this.readLegacyParameters()];
60
+ }
61
+ return undefined;
62
+ };
63
+ command = (command, payload = []) => {
64
+ const encryptedPayload = this.sessionKey ? encryptLepuPayload(payload, this.sessionKey) : [...payload];
65
+ const frame = this.params.protocol === "v2" ? this.commands.build(command, encryptedPayload) : buildOxyS3LegacyFrame(command, encryptedPayload);
66
+ return {
67
+ ...this.params.write,
68
+ frame,
69
+ withoutResponse: true
70
+ };
71
+ };
72
+ timeCommand = () => {
73
+ const date = this.now();
74
+ if (this.params.protocol === "v1") {
75
+ 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())}`;
76
+ return this.command(OxyS3Command.legacySyncTime, toBytes(JSON.stringify({
77
+ SetTIME: time
78
+ })));
79
+ }
80
+ const year = date.getFullYear();
81
+ const timezoneOffsetTenthHours = Math.round(-date.getTimezoneOffset() / 6);
82
+ return this.command(OxyS3Command.syncTime, [year & 0xff, year >>> 8, date.getMonth() + 1, date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), timezoneOffsetTenthHours & 0xff]);
83
+ };
84
+ readLegacyParameters = () => this.command(OxyS3Command.legacyRealtimeParameters);
85
+ decrypt = payload => this.sessionKey ? decryptLepuPayload(payload, this.sessionKey) ?? [] : [...payload];
86
+ report = payload => {
87
+ const reading = parseOxyS3Reading(payload, this.params.protocol);
88
+ if (!reading || !validOxygen(reading.bloodOxygen) || !validPulse(reading.pulseRate)) {
89
+ return;
90
+ }
91
+ this.params.onResult({
92
+ caseType: CaseType.RESULT,
93
+ measurementTypeKey: MeasurementTypeKey.bloodOxygenPulseRate,
94
+ bloodOxygen: reading.bloodOxygen,
95
+ pulseRate: reading.pulseRate,
96
+ ...(reading.perfusionIndex > 0 ? {
97
+ perfusionIndex: reading.perfusionIndex
98
+ } : {}),
99
+ recordedAt: this.now()
100
+ });
101
+ };
102
+ now = () => this.params.now?.() ?? new Date();
103
+ pad = value => value.toString().padStart(2, "0");
104
+ }
105
+ //# sourceMappingURL=oxy-s3.sequencer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["MeasurementTypeKey","CaseType","LepuCommandBuilder","buildOxyS3LegacyFrame","decodeOxyS3Response","OxyS3Command","parseOxyS3Reading","createLepuAccessToken","decryptLepuHandshake","decryptLepuPayload","encryptLepuPayload","parseLepuSessionKey","toBytes","value","Array","from","character","charCodeAt","validOxygen","validPulse","OxyS3Sequencer","commands","constructor","params","phase","encrypted","initialCommands","command","authenticate","now","timeCommand","nextCommand","frame","response","protocol","undefined","status","sessionKey","payload","syncTime","readLegacyParameters","enableRealtimeParameters","realtimeParameters","report","decrypt","encryptedPayload","build","write","withoutResponse","date","time","getFullYear","pad","getMonth","getDate","getHours","getMinutes","getSeconds","legacySyncTime","JSON","stringify","SetTIME","year","timezoneOffsetTenthHours","Math","round","getTimezoneOffset","legacyRealtimeParameters","reading","bloodOxygen","pulseRate","onResult","caseType","RESULT","measurementTypeKey","bloodOxygenPulseRate","perfusionIndex","recordedAt","Date","toString","padStart"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/viatom/oxy-s3.sequencer.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAkC,YAAY;AAEzE,SAASC,QAAQ,QAAQ,6BAA0B;AAInD,SAASC,kBAAkB,QAAQ,iCAA8B;AAEjE,SACEC,qBAAqB,EACrBC,mBAAmB,EACnBC,YAAY,EAEZC,iBAAiB,QACZ,sBAAmB;AAC1B,SACEC,qBAAqB,EACrBC,oBAAoB,EACpBC,kBAAkB,EAClBC,kBAAkB,EAClBC,mBAAmB,QACd,yBAAsB;AAY7B,MAAMC,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;AACA,OAAO,MAAMO,cAAc,CAA6B;EACrCC,QAAQ,GAAG,IAAInB,kBAAkB,CAAC,IAAI,CAAC;EAIjDoB,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,CACVtB,YAAY,CAACuB,YAAY,EACzBrB,qBAAqB,CAAC,IAAI,CAACsB,GAAG,CAAC,CAAC,CAClC,CAAC,CACF,GACD,CAAC,IAAI,CAACC,WAAW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C,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;AAC5E","ignoreList":[]}
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+
3
+ /* eslint-disable import/group-exports */
4
+
5
+ import { MeasurementTypeKey } from "@ovok/core";
6
+ import { BTManagedDevice } from "../bt-managed-device.js";
7
+ import { PF10AW1_NOTIFY, PF10AW1_SERVICE, PF10AW1_WRITE, Pf10Aw1FrameReader } from "./pf10aw1.protocol.js";
8
+ import { Pf10Aw1Sequencer } from "./pf10aw1.sequencer.js";
9
+ const acceptNothing = {
10
+ caseValuePosition: [],
11
+ cases: []
12
+ };
13
+ export const pf10Aw1MainServices = [{
14
+ uuid: PF10AW1_SERVICE,
15
+ monitorUuids: [{
16
+ uuid: PF10AW1_NOTIFY,
17
+ parsingModel: acceptNothing
18
+ }],
19
+ writeUuid: {
20
+ uuid: PF10AW1_WRITE,
21
+ mainCommandUuid: "a5"
22
+ }
23
+ }];
24
+
25
+ /** ViHealth PF10AW-ME, SA10AW-PU, and PF10BW-VE encrypted oximeter driver. */
26
+ export class Pf10Aw1Device extends BTManagedDevice {
27
+ mainServices = pf10Aw1MainServices;
28
+ stuckDataTimeout = 60_000;
29
+ onStreamStart = undefined;
30
+ getSupportedMeasurementTypeKeys() {
31
+ return [MeasurementTypeKey.bloodOxygenPulseRate];
32
+ }
33
+ constructor(device, params) {
34
+ super(device, params);
35
+ this.frameReader = new Pf10Aw1FrameReader();
36
+ this.createCommandSequencer = () => new Pf10Aw1Sequencer({
37
+ write: {
38
+ serviceUuid: PF10AW1_SERVICE,
39
+ characteristicUuid: PF10AW1_WRITE
40
+ },
41
+ onResult: result => this.onResult?.(result)
42
+ });
43
+ }
44
+ handleSuccessResult() {
45
+ return;
46
+ }
47
+ }
48
+ //# sourceMappingURL=pf10aw1.device.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["MeasurementTypeKey","BTManagedDevice","PF10AW1_NOTIFY","PF10AW1_SERVICE","PF10AW1_WRITE","Pf10Aw1FrameReader","Pf10Aw1Sequencer","acceptNothing","caseValuePosition","cases","pf10Aw1MainServices","uuid","monitorUuids","parsingModel","writeUuid","mainCommandUuid","Pf10Aw1Device","mainServices","stuckDataTimeout","onStreamStart","undefined","getSupportedMeasurementTypeKeys","bloodOxygenPulseRate","constructor","device","params","frameReader","createCommandSequencer","write","serviceUuid","characteristicUuid","onResult","result","handleSuccessResult"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/viatom/pf10aw1.device.ts"],"mappings":";;AAAA;;AAEA,SAASA,kBAAkB,QAAQ,YAAY;AAQ/C,SAASC,eAAe,QAAQ,yBAAsB;AAEtD,SACEC,cAAc,EACdC,eAAe,EACfC,aAAa,EACbC,kBAAkB,QACb,uBAAoB;AAC3B,SAASC,gBAAgB,QAAQ,wBAAqB;AAOtD,MAAMC,aAAa,GAAG;EAAEC,iBAAiB,EAAE,EAAE;EAAEC,KAAK,EAAE;AAAG,CAAC;AAE1D,OAAO,MAAMC,mBAA+B,GAAG,CAC7C;EACEC,IAAI,EAAER,eAAe;EACrBS,YAAY,EAAE,CAAC;IAAED,IAAI,EAAET,cAAc;IAAEW,YAAY,EAAEN;EAAc,CAAC,CAAC;EACrEO,SAAS,EAAE;IAAEH,IAAI,EAAEP,aAAa;IAAEW,eAAe,EAAE;EAAK;AAC1D,CAAC,CACF;;AAED;AACA,OAAO,MAAMC,aAAa,SAASf,eAAe,CAAkB;EACxDgB,YAAY,GAAGP,mBAAmB;EAClCQ,gBAAgB,GAAG,MAAM;EACzBC,aAAa,GAAGC,SAAS;EAEhBC,+BAA+BA,CAAA,EAAyB;IACzE,OAAO,CAACrB,kBAAkB,CAACsB,oBAAoB,CAAC;EAClD;EAEOC,WAAWA,CAChBC,MAAc,EACdC,MAA2C,EAC3C;IACA,KAAK,CAACD,MAAM,EAAEC,MAAM,CAAC;IACrB,IAAI,CAACC,WAAW,GAAG,IAAIrB,kBAAkB,CAAC,CAAC;IAC3C,IAAI,CAACsB,sBAAsB,GAAG,MAC5B,IAAIrB,gBAAgB,CAAC;MACnBsB,KAAK,EAAE;QACLC,WAAW,EAAE1B,eAAe;QAC5B2B,kBAAkB,EAAE1B;MACtB,CAAC;MACD2B,QAAQ,EAAGC,MAAM,IACf,IAAI,CAACD,QAAQ,GACXC,MAGF;IACJ,CAAC,CAAC;EACN;EAEUC,mBAAmBA,CAAA,EAAS;IACpC;EACF;AACF","ignoreList":[]}
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+
3
+ /* eslint-disable import/group-exports */
4
+
5
+ import { calculateCrc8 } from "../../../utils/calculate-crc-8.js";
6
+ import { hexToByte } from "../../../utils/hex-to-byte.js";
7
+ import { le16FromHex } from "../../../utils/le-16-from-hex.js";
8
+ import { LepuFrameReader } from "../lepu/lepu.frame-reader.js";
9
+ export const PF10AW1_SERVICE = "e8fb0001-a14b-98f9-831b-4e2941d01248";
10
+ export const PF10AW1_WRITE = "e8fb0002-a14b-98f9-831b-4e2941d01248";
11
+ export const PF10AW1_NOTIFY = "e8fb0003-a14b-98f9-831b-4e2941d01248";
12
+ export const Pf10Aw1Command = {
13
+ authenticate: 0xff,
14
+ setUtcTime: 0xc0,
15
+ enableParameters: 0x02,
16
+ enableWave: 0x03,
17
+ realtimeParameters: 0x04
18
+ };
19
+ /** PF10AW1 uses the shared Lepu A5 frame and CRC-8/ATM. */
20
+ export class Pf10Aw1FrameReader {
21
+ reader = new LepuFrameReader(["a5"]);
22
+ readFrame = buffer => this.reader.readFrame(buffer);
23
+ }
24
+ export const decodePf10Aw1Response = frame => {
25
+ if (frame.length < 8 || hexToByte(frame[0] ?? "00") !== 0xa5) {
26
+ return undefined;
27
+ }
28
+ const command = hexToByte(frame[1] ?? "00");
29
+ if (hexToByte(frame[2] ?? "00") !== (~command & 0xff)) {
30
+ return undefined;
31
+ }
32
+ const payloadLength = le16FromHex(frame, 5);
33
+ if (frame.length !== payloadLength + 8) {
34
+ return undefined;
35
+ }
36
+ const checksumIndex = frame.length - 1;
37
+ if (hexToByte(frame[checksumIndex] ?? "00") !== calculateCrc8([...frame], checksumIndex)) {
38
+ return undefined;
39
+ }
40
+ return {
41
+ command,
42
+ status: hexToByte(frame[3] ?? "00"),
43
+ payload: frame.slice(7, checksumIndex).map(value => hexToByte(value))
44
+ };
45
+ };
46
+ export const parsePf10Aw1OximeterReading = payload => {
47
+ if (payload.length < 5) {
48
+ return undefined;
49
+ }
50
+ return {
51
+ bloodOxygen: payload[0] ?? 0,
52
+ pulseRate: payload[1] ?? 0,
53
+ perfusionIndex: (payload[2] ?? 0) / 10,
54
+ probeOff: ((payload[3] ?? 0) & 0x02) !== 0
55
+ };
56
+ };
57
+ //# sourceMappingURL=pf10aw1.protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["calculateCrc8","hexToByte","le16FromHex","LepuFrameReader","PF10AW1_SERVICE","PF10AW1_WRITE","PF10AW1_NOTIFY","Pf10Aw1Command","authenticate","setUtcTime","enableParameters","enableWave","realtimeParameters","Pf10Aw1FrameReader","reader","readFrame","buffer","decodePf10Aw1Response","frame","length","undefined","command","payloadLength","checksumIndex","status","payload","slice","map","value","parsePf10Aw1OximeterReading","bloodOxygen","pulseRate","perfusionIndex","probeOff"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/viatom/pf10aw1.protocol.ts"],"mappings":";;AAAA;;AAGA,SAASA,aAAa,QAAQ,mCAAgC;AAC9D,SAASC,SAAS,QAAQ,+BAA4B;AACtD,SAASC,WAAW,QAAQ,kCAA+B;AAC3D,SAASC,eAAe,QAAQ,8BAA2B;AAE3D,OAAO,MAAMC,eAAe,GAAG,sCAAsC;AACrE,OAAO,MAAMC,aAAa,GAAG,sCAAsC;AACnE,OAAO,MAAMC,cAAc,GAAG,sCAAsC;AAEpE,OAAO,MAAMC,cAAc,GAAG;EAC5BC,YAAY,EAAE,IAAI;EAClBC,UAAU,EAAE,IAAI;EAChBC,gBAAgB,EAAE,IAAI;EACtBC,UAAU,EAAE,IAAI;EAChBC,kBAA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,CAAC;EACxE,CAAC;AACH,CAAC;AAED,OAAO,MAAMC,2BAA2B,GACtCJ,OAA0B,IACa;EACvC,IAAIA,OAAO,CAACN,MAAM,GAAG,CAAC,EAAE;IACtB,OAAOC,SAAS;EAClB;EAEA,OAAO;IACLU,WAAW,EAAEL,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;IAC5BM,SAAS,EAAEN,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;IAC1BO,cAAc,EAAE,CAACP,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE;IACtCQ,QAAQ,EAAE,CAAC,CAACR,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,IAAI,MAAM;EAC3C,CAAC;AACH,CAAC","ignoreList":[]}
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+
3
+ import { MeasurementTypeKey } from "@ovok/core";
4
+ import { CaseType } from "../../../types/case-type.js";
5
+ import { LepuCommandBuilder } from "../lepu/lepu.command-builder.js";
6
+ import { decodePf10Aw1Response, parsePf10Aw1OximeterReading, Pf10Aw1Command } from "./pf10aw1.protocol.js";
7
+ import { createLepuAccessToken, decryptLepuHandshake, decryptLepuPayload, encryptLepuPayload, parseLepuSessionKey } from "./viatom-lepu-crypto.js";
8
+ const isValidOxygen = value => value >= 50 && value <= 100;
9
+ const isValidPulse = value => value > 0 && value <= 300;
10
+
11
+ /** Drives the vendor-encrypted A5 exchange used by the PF10AW1 oximeter models. */
12
+ export class Pf10Aw1Sequencer {
13
+ commands = new LepuCommandBuilder("a5");
14
+ phase = "authenticate";
15
+ constructor(params) {
16
+ this.params = params;
17
+ }
18
+ initialCommands = () => [this.write(this.commands.build(Pf10Aw1Command.authenticate, createLepuAccessToken(this.params.now?.() ?? new Date())))];
19
+ nextCommand = frame => {
20
+ const response = decodePf10Aw1Response(frame);
21
+ if (!response) {
22
+ return undefined;
23
+ }
24
+ if (this.phase === "authenticate") {
25
+ return this.acceptHandshake(response.command, response.status, response.payload);
26
+ }
27
+ if (this.phase === "clock" && response.command === Pf10Aw1Command.setUtcTime) {
28
+ if (response.status !== 1) {
29
+ return undefined;
30
+ }
31
+ this.phase = "parameters";
32
+ return [this.buildEncryptedCommand(Pf10Aw1Command.enableParameters, [1])];
33
+ }
34
+ if (this.phase === "parameters" && response.command === Pf10Aw1Command.enableParameters && response.status === 1) {
35
+ this.phase = "wave";
36
+ return [this.buildEncryptedCommand(Pf10Aw1Command.enableWave, [1])];
37
+ }
38
+ if (this.phase === "wave" && response.command === Pf10Aw1Command.enableWave && response.status === 1) {
39
+ this.phase = "ready";
40
+ return undefined;
41
+ }
42
+ if (this.phase === "ready" && response.command === Pf10Aw1Command.realtimeParameters && response.status === 1) {
43
+ this.report(this.decrypt(response.payload));
44
+ }
45
+ return undefined;
46
+ };
47
+ acceptHandshake = (command, status, payload) => {
48
+ if (command !== Pf10Aw1Command.authenticate || status !== 1) {
49
+ return undefined;
50
+ }
51
+ const key = parseLepuSessionKey(decryptLepuHandshake(payload));
52
+ if (!key) {
53
+ return undefined;
54
+ }
55
+ this.sessionKey = key;
56
+ this.phase = "clock";
57
+ return [this.buildEncryptedCommand(Pf10Aw1Command.setUtcTime, this.timePayload())];
58
+ };
59
+ buildEncryptedCommand = (command, payload) => {
60
+ const encrypted = encryptLepuPayload(payload, this.sessionKey ?? []);
61
+ return this.write(this.commands.build(command, encrypted));
62
+ };
63
+ decrypt = payload => (this.sessionKey && decryptLepuPayload(payload, this.sessionKey)) ?? [];
64
+ timePayload = () => {
65
+ const date = this.params.now?.() ?? new Date();
66
+ const timezoneOffsetTenthHours = Math.round(-date.getTimezoneOffset() / 6);
67
+ return [date.getFullYear() & 0xff, date.getFullYear() >>> 8 & 0xff, date.getMonth() + 1, date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), timezoneOffsetTenthHours & 0xff];
68
+ };
69
+ report = payload => {
70
+ const reading = parsePf10Aw1OximeterReading(payload);
71
+ if (!reading || reading.probeOff || !isValidOxygen(reading.bloodOxygen) || !isValidPulse(reading.pulseRate)) {
72
+ return;
73
+ }
74
+ this.params.onResult({
75
+ caseType: CaseType.RESULT,
76
+ measurementTypeKey: MeasurementTypeKey.bloodOxygenPulseRate,
77
+ bloodOxygen: reading.bloodOxygen,
78
+ pulseRate: reading.pulseRate,
79
+ ...(reading.perfusionIndex > 0 ? {
80
+ perfusionIndex: reading.perfusionIndex
81
+ } : {}),
82
+ recordedAt: this.params.now?.() ?? new Date()
83
+ });
84
+ };
85
+ write = frame => ({
86
+ ...this.params.write,
87
+ frame,
88
+ withoutResponse: true
89
+ });
90
+ }
91
+ //# sourceMappingURL=pf10aw1.sequencer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["MeasurementTypeKey","CaseType","LepuCommandBuilder","decodePf10Aw1Response","parsePf10Aw1OximeterReading","Pf10Aw1Command","createLepuAccessToken","decryptLepuHandshake","decryptLepuPayload","encryptLepuPayload","parseLepuSessionKey","isValidOxygen","value","isValidPulse","Pf10Aw1Sequencer","commands","phase","constructor","params","initialCommands","write","build","authenticate","now","Date","nextCommand","frame","response","undefined","acceptHandshake","command","status","payload","setUtcTime","buildEncryptedCommand","enableParameters","enableWave","realtimeParameters","report","decrypt","key","sessionKey","timePayload","encrypted","date","timezoneOffsetTenthHours","Math","round","getTimezoneOffset","getFullYear","getMonth","getDate","getHours","getMinutes","getSeconds","reading","probeOff","bloodOxygen","pulseRate","onResult","caseType","RESULT","measurementTypeKey","bloodOxygenPulseRate","perfusionIndex","recordedAt","withoutResponse"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/viatom/pf10aw1.sequencer.ts"],"mappings":";;AAEA,SAASA,kBAAkB,QAAkC,YAAY;AAEzE,SAASC,QAAQ,QAAQ,6BAA0B;AAInD,SAASC,kBAAkB,QAAQ,iCAA8B;AAEjE,SACEC,qBAAqB,EACrBC,2BAA2B,EAC3BC,cAAc,QACT,uBAAoB;AAC3B,SACEC,qBAAqB,EACrBC,oBAAoB,EACpBC,kBAAkB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E,CAACuB,OAAO,IACRA,OAAO,CAACC,QAAQ,IAChB,CAAC7C,aAAa,CAAC4C,OAAO,CAACE,WAAW,CAAC,IACnC,CAAC5C,YAAY,CAAC0C,OAAO,CAACG,SAAS,CAAC,EAChC;MACA;IACF;IAEA,IAAI,CAACxC,MAAM,CAACyC,QAAQ,CAAC;MACnBC,QAAQ,EAAE3D,QAAQ,CAAC4D,MAAM;MACzBC,kBAAkB,EAAE9D,kBAAkB,CAAC+D,oBAAoB;MAC3DN,WAAW,EAAEF,OAAO,CAACE,WAAW;MAChCC,SAAS,EAAEH,OAAO,CAACG,SAAS;MAC5B,IAAIH,OAAO,CAACS,cAAc,GAAG,CAAC,GAC1B;QAAEA,cAAc,EAAET,OAAO,CAACS;MAAe,CAAC,GAC1C,CAAC,CAAC,CAAC;MACPC,UAAU,EAAE,IAAI,CAAC/C,MAAM,CAACK,GAAG,GAAG,CAAC,IAAI,IAAIC,IAAI,CAAC;IAC9C,CAAC,CAAC;EACJ,CAAC;EAEOJ,KAAK,GAAIM,KAAwB,KAAqB;IAC5D,GAAG,IAAI,CAACR,MAAM,CAACE,KAAK;IACpBM,KAAK;IACLwC,eAAe,EAAE;EACnB,CAAC,CAAC;AACJ","ignoreList":[]}
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+
3
+ /* eslint-disable import/group-exports */
4
+
5
+ import { MeasurementTypeKey } from "@ovok/core";
6
+ import { BTManagedDevice } from "../bt-managed-device.js";
7
+ import { SP20_NOTIFY, SP20_SERVICE, SP20_WRITE, Sp20FrameReader } from "./sp20.protocol.js";
8
+ import { Sp20Sequencer } from "./sp20.sequencer.js";
9
+ const acceptNothing = {
10
+ caseValuePosition: [],
11
+ cases: []
12
+ };
13
+ export const sp20MainServices = [{
14
+ uuid: SP20_SERVICE,
15
+ monitorUuids: [{
16
+ uuid: SP20_NOTIFY,
17
+ parsingModel: acceptNothing
18
+ }],
19
+ writeUuid: {
20
+ uuid: SP20_WRITE,
21
+ mainCommandUuid: "aa55"
22
+ }
23
+ }];
24
+
25
+ /** ViHealth SP-20, SP-20-BLE, and SP-20-WPS encrypted realtime oximeter. */
26
+ export class Sp20Device extends BTManagedDevice {
27
+ mainServices = sp20MainServices;
28
+ stuckDataTimeout = 60_000;
29
+ onStreamStart = undefined;
30
+ preferredMtu = 247;
31
+ getSupportedMeasurementTypeKeys() {
32
+ return [MeasurementTypeKey.bloodOxygenPulseRate];
33
+ }
34
+ constructor(device, params) {
35
+ super(device, params);
36
+ this.frameReader = new Sp20FrameReader();
37
+ this.createCommandSequencer = () => new Sp20Sequencer({
38
+ write: {
39
+ serviceUuid: SP20_SERVICE,
40
+ characteristicUuid: SP20_WRITE
41
+ },
42
+ onResult: result => this.onResult?.(result)
43
+ });
44
+ }
45
+ handleSuccessResult() {
46
+ return;
47
+ }
48
+ }
49
+ //# sourceMappingURL=sp20.device.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["MeasurementTypeKey","BTManagedDevice","SP20_NOTIFY","SP20_SERVICE","SP20_WRITE","Sp20FrameReader","Sp20Sequencer","acceptNothing","caseValuePosition","cases","sp20MainServices","uuid","monitorUuids","parsingModel","writeUuid","mainCommandUuid","Sp20Device","mainServices","stuckDataTimeout","onStreamStart","undefined","preferredMtu","getSupportedMeasurementTypeKeys","bloodOxygenPulseRate","constructor","device","params","frameReader","createCommandSequencer","write","serviceUuid","characteristicUuid","onResult","result","handleSuccessResult"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/viatom/sp20.device.ts"],"mappings":";;AAAA;;AAEA,SAASA,kBAAkB,QAAQ,YAAY;AAQ/C,SAASC,eAAe,QAAQ,yBAAsB;AAEtD,SACEC,WAAW,EACXC,YAAY,EACZC,UAAU,EACVC,eAAe,QACV,oBAAiB;AACxB,SAASC,aAAa,QAAQ,qBAAkB;AAOhD,MAAMC,aAAa,GAAG;EAAEC,iBAAiB,EAAE,EAAE;EAAEC,KAAK,EAAE;AAAG,CAAC;AAE1D,OAAO,MAAMC,gBAA4B,GAAG,CAC1C;EACEC,IAAI,EAAER,YAAY;EAClBS,YAAY,EAAE,CAAC;IAAED,IAAI,EAAET,WAAW;IAAEW,YAAY,EAAEN;EAAc,CAAC,CAAC;EAClEO,SAAS,EAAE;IAAEH,IAAI,EAAEP,UAAU;IAAEW,eAAe,EAAE;EAAO;AACzD,CAAC,CACF;;AAED;AACA,OAAO,MAAMC,UAAU,SAASf,eAAe,CAAe;EAClDgB,YAAY,GAAGP,gBAAgB;EAC/BQ,gBAAgB,GAAG,MAAM;EACzBC,aAAa,GAAGC,SAAS;EAChBC,YAAY,GAAG,GAAG;EAClBC,+BAA+BA,CAAA,EAAyB;IACzE,OAAO,CAACtB,kBAAkB,CAACuB,oBAAoB,CAAC;EAClD;EAEOC,WAAWA,CAChBC,MAAc,EACdC,MAAwC,EACxC;IACA,KAAK,CAACD,MAAM,EAAEC,MAAM,CAAC;IACrB,IAAI,CAACC,WAAW,GAAG,IAAItB,eAAe,CAAC,CAAC;IACxC,IAAI,CAACuB,sBAAsB,GAAG,MAC5B,IAAItB,aAAa,CAAC;MAChBuB,KAAK,EAAE;QAAEC,WAAW,EAAE3B,YAAY;QAAE4B,kBAAkB,EAAE3B;MAAW,CAAC;MACpE4B,QAAQ,EAAGC,MAAM,IACf,IAAI,CAACD,QAAQ,GACXC,MAGF;IACJ,CAAC,CAAC;EACN;EAEUC,mBAAmBA,CAAA,EAAS;IACpC;EACF;AACF","ignoreList":[]}
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+
3
+ /* eslint-disable import/group-exports */
4
+
5
+ import { FrameReadStatus } from "../../../types/frame-read-status.js";
6
+ import { calculateCrc8Pc } from "../../../utils/calculate-crc-8-pc.js";
7
+ import { hexToByte } from "../../../utils/hex-to-byte.js";
8
+ export const SP20_SERVICE = "0000fff0-0000-1000-8000-00805f9b34fb";
9
+ export const SP20_NOTIFY = "0000fff1-0000-1000-8000-00805f9b34fb";
10
+ export const SP20_WRITE = "0000fff2-0000-1000-8000-00805f9b34fb";
11
+ const byte = value => (value & 0xff).toString(16).padStart(2, "0");
12
+ export const buildSp20Frame = (token, type, payload = []) => {
13
+ const frame = ["aa", "55", byte(token), byte(payload.length + 2), byte(type), ...payload.map(byte), "00"];
14
+ frame[frame.length - 1] = byte(calculateCrc8Pc(frame));
15
+ return frame;
16
+ };
17
+ export const decodeSp20Frame = frame => {
18
+ if (hexToByte(frame[0] ?? "00") !== 0xaa || hexToByte(frame[1] ?? "00") !== 0x55 || frame.length < 6 || frame.length !== hexToByte(frame[3] ?? "00") + 4 || calculateCrc8Pc(frame) !== hexToByte(frame.at(-1) ?? "00")) {
19
+ return undefined;
20
+ }
21
+ return {
22
+ token: hexToByte(frame[2] ?? "00"),
23
+ type: hexToByte(frame[4] ?? "00"),
24
+ content: frame.slice(5, -1).map(value => hexToByte(value)),
25
+ cipherText: frame.slice(4, -1).map(value => hexToByte(value))
26
+ };
27
+ };
28
+ export const parseSp20OximeterReading = content => {
29
+ if (content.length < 6) {
30
+ return undefined;
31
+ }
32
+ const flags = content[4] ?? 0;
33
+ return {
34
+ bloodOxygen: content[0] ?? 0,
35
+ pulseRate: (content[1] ?? 0) | (content[2] ?? 0) << 8,
36
+ perfusionIndex: content[3] ?? 0,
37
+ probeOff: (flags & 0x02) !== 0,
38
+ pulseSearching: (flags & 0x04) !== 0,
39
+ checkProbe: (flags & 0x08) !== 0
40
+ };
41
+ };
42
+
43
+ /** AA55 frames carry their length at byte 3; notifications may split or batch them. */
44
+ export class Sp20FrameReader {
45
+ readFrame(buffer) {
46
+ const start = this.findHeader(buffer);
47
+ if (start < 0) {
48
+ return {
49
+ status: FrameReadStatus.INCOMPLETE,
50
+ consumedBytes: Math.max(0, buffer.length - 1)
51
+ };
52
+ }
53
+ if (start + 4 > buffer.length) {
54
+ return {
55
+ status: FrameReadStatus.INCOMPLETE,
56
+ consumedBytes: start
57
+ };
58
+ }
59
+ const length = hexToByte(buffer[start + 3] ?? "00") + 4;
60
+ if (length < 6) {
61
+ return {
62
+ status: FrameReadStatus.CORRUPT,
63
+ consumedBytes: start + 2
64
+ };
65
+ }
66
+ if (start + length > buffer.length) {
67
+ return {
68
+ status: FrameReadStatus.INCOMPLETE,
69
+ consumedBytes: start
70
+ };
71
+ }
72
+ const frame = buffer.slice(start, start + length);
73
+ if (calculateCrc8Pc(frame) !== hexToByte(frame.at(-1) ?? "00")) {
74
+ return {
75
+ status: FrameReadStatus.CORRUPT,
76
+ consumedBytes: start + 2
77
+ };
78
+ }
79
+ return {
80
+ status: FrameReadStatus.COMPLETE,
81
+ consumedBytes: start + length,
82
+ frame
83
+ };
84
+ }
85
+ findHeader = buffer => {
86
+ for (let index = 0; index < buffer.length - 1; index += 1) {
87
+ if (hexToByte(buffer[index] ?? "00") === 0xaa && hexToByte(buffer[index + 1] ?? "00") === 0x55) {
88
+ return index;
89
+ }
90
+ }
91
+ return -1;
92
+ };
93
+ }
94
+ //# sourceMappingURL=sp20.protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["FrameReadStatus","calculateCrc8Pc","hexToByte","SP20_SERVICE","SP20_NOTIFY","SP20_WRITE","byte","value","toString","padStart","buildSp20Frame","token","type","payload","frame","length","map","decodeSp20Frame","at","undefined","content","slice","cipherText","parseSp20OximeterReading","flags","bloodOxygen","pulseRate","perfusionIndex","probeOff","pulseSearching","checkProbe","Sp20FrameReader","readFrame","buffer","start","findHeader","status","INCOMPLETE","consumedBytes","Math","max","CORRUPT","COMPLETE","index"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/viatom/sp20.protocol.ts"],"mappings":";;AAAA;;AAGA,SAASA,eAAe,QAAQ,qCAAkC;AAElE,SAASC,eAAe,QAAQ,sCAAmC;AACnE,SAASC,SAAS,QAAQ,+BAA4B;AAEtD,OAAO,MAAMC,YAAY,GAAG,sCAAsC;AAClE,OAAO,MAAMC,WAAW,GAAG,sCAAsC;AACjE,OAAO,MAAMC,UAAU,GAAG,sCAAsC;AAEhE,MAAMC,IAAI,GAAIC,K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,IAAI,IACzCzC,SAAS,CAAC+B,MAAM,CAACU,KAAK,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,IAAI,EAC7C;QACA,OAAOA,KAAK;MACd;IACF;IAEA,OAAO,CAAC,CAAC;EACX,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+
3
+ import { MeasurementTypeKey } from "@ovok/core";
4
+ import { CaseType } from "../../../types/case-type.js";
5
+ import { calculateCrc8Pc } from "../../../utils/calculate-crc-8-pc.js";
6
+ import { buildSp20Frame, decodeSp20Frame, parseSp20OximeterReading } from "./sp20.protocol.js";
7
+ import { decryptLepuHandshake, decryptLepuPayload, encryptLepuPayload, parseLepuSessionKey, createLepuAccessToken } from "./viatom-lepu-crypto.js";
8
+ const command = (write, frame) => ({
9
+ ...write,
10
+ frame,
11
+ withoutResponse: true
12
+ });
13
+ const validOxygen = value => value >= 50 && value <= 100;
14
+ const validPulse = value => value > 0 && value <= 300;
15
+
16
+ /** Handles the encrypted AA55 exchange used by the ViHealth SP-20 variants. */
17
+ export class Sp20Sequencer {
18
+ phase = "authenticate";
19
+ constructor(params) {
20
+ this.params = params;
21
+ }
22
+ initialCommands = () => {
23
+ const token = createLepuAccessToken(this.params.now?.() ?? new Date());
24
+ return [this.write(buildSp20Frame(0xff, 0x81, token))];
25
+ };
26
+ nextCommand = frame => {
27
+ const raw = decodeSp20Frame(frame);
28
+ if (!raw) {
29
+ return undefined;
30
+ }
31
+ const response = this.decodePayload(raw);
32
+ if (!response) {
33
+ return undefined;
34
+ }
35
+ if (this.phase === "authenticate") {
36
+ return this.acceptHandshake(raw, response);
37
+ }
38
+ if (this.phase === "clock" && response.token === 0x0f && response.type === 7) {
39
+ this.phase = "parameters";
40
+ return [this.encryptedCommand(0x84, [1])];
41
+ }
42
+ if (this.phase === "parameters" && response.token === 0x0f && response.type === 4) {
43
+ this.phase = "wave";
44
+ return [this.encryptedCommand(0x85, [1])];
45
+ }
46
+ if (this.phase === "wave" && response.token === 0x0f && response.type === 5) {
47
+ this.phase = "ready";
48
+ return undefined;
49
+ }
50
+ if (this.phase === "ready" && response.token === 0xf0 && response.type === 1) {
51
+ this.report(response.content);
52
+ }
53
+ return undefined;
54
+ };
55
+ decodePayload = response => {
56
+ if (response.token === 0xff && !this.sessionKey) {
57
+ return response;
58
+ }
59
+ if (!this.sessionKey) {
60
+ return undefined;
61
+ }
62
+ const decrypted = decryptLepuPayload(response.cipherText, this.sessionKey);
63
+ return decrypted?.length ? {
64
+ token: response.token,
65
+ type: decrypted[0] ?? 0,
66
+ content: decrypted.slice(1),
67
+ cipherText: response.cipherText
68
+ } : undefined;
69
+ };
70
+ acceptHandshake = (raw, response) => {
71
+ if (raw.token !== 0xff || raw.type !== 1) {
72
+ return undefined;
73
+ }
74
+ const key = parseLepuSessionKey(decryptLepuHandshake(response.content));
75
+ if (!key) {
76
+ return undefined;
77
+ }
78
+ this.sessionKey = key;
79
+ this.phase = "clock";
80
+ return [this.encryptedCommand(0x87, this.timePayload())];
81
+ };
82
+ encryptedCommand = (type, payload) => {
83
+ const encrypted = encryptLepuPayload([type, ...payload], this.sessionKey ?? []);
84
+ const frame = ["aa", "55", "0f", (encrypted.length + 1 & 0xff).toString(16).padStart(2, "0"), ...encrypted.map(value => value.toString(16).padStart(2, "0")), "00"];
85
+ frame[frame.length - 1] = calculateCrc8Pc(frame).toString(16).padStart(2, "0");
86
+ return this.write(frame);
87
+ };
88
+ timePayload = () => {
89
+ const date = this.params.now?.() ?? new Date();
90
+ return [date.getFullYear() >>> 8 & 0xff, date.getFullYear() & 0xff, date.getMonth() + 1, date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds()];
91
+ };
92
+ report = content => {
93
+ const reading = parseSp20OximeterReading(content);
94
+ if (!reading || reading.probeOff || reading.pulseSearching || reading.checkProbe || !validOxygen(reading.bloodOxygen) || !validPulse(reading.pulseRate)) {
95
+ return;
96
+ }
97
+ this.params.onResult({
98
+ caseType: CaseType.RESULT,
99
+ measurementTypeKey: MeasurementTypeKey.bloodOxygenPulseRate,
100
+ bloodOxygen: reading.bloodOxygen,
101
+ pulseRate: reading.pulseRate,
102
+ ...(reading.perfusionIndex > 0 ? {
103
+ perfusionIndex: reading.perfusionIndex
104
+ } : {}),
105
+ recordedAt: this.params.now?.() ?? new Date()
106
+ });
107
+ };
108
+ write = frame => command(this.params.write, frame);
109
+ }
110
+ //# sourceMappingURL=sp20.sequencer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["MeasurementTypeKey","CaseType","calculateCrc8Pc","buildSp20Frame","decodeSp20Frame","parseSp20OximeterReading","decryptLepuHandshake","decryptLepuPayload","encryptLepuPayload","parseLepuSessionKey","createLepuAccessToken","command","write","frame","withoutResponse","validOxygen","value","validPulse","Sp20Sequencer","phase","constructor","params","initialCommands","token","now","Date","nextCommand","raw","undefined","response","decodePayload","acceptHandshake","type","encryptedCommand","report","content","sessionKey","decrypted","cipherText","length","slice","key","timePayload","payload","encrypted","toString","padStart","map","date","getFullYear","getMonth","getDate","getHours","getMinutes","getSeconds","reading","probeOff","pulseSearching","checkProbe","bloodOxygen","pulseRate","onResult","caseType","RESULT","measurementTypeKey","bloodOxygenPulseRate","perfusionIndex","recordedAt"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/viatom/sp20.sequencer.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAkC,YAAY;AAEzE,SAASC,QAAQ,QAAQ,6BAA0B;AAInD,SAASC,eAAe,QAAQ,sCAAmC;AAEnE,SACEC,cAAc,EACdC,eAAe,EACfC,wBAAwB,QAEnB,oBAAiB;AACxB,SACEC,oBAAoB,EACpBC,kBAAkB,EAClBC,kBAAkB,EAClBC,mBAAmB,EACnBC,qBAAqB,QAChB,yBAAsB;AAU7B,MAAMC,OAAO,GAAGA,CACdC,KAAmC,EACnCC,KAAwB,MACL;EAAE,GAAGD,KAAK;EAAEC,KAAK;EAAEC,eAAe,EAAE;AAAK,CAAC,CAAC;AAEh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