@ovok/native 1.10.10 → 1.10.11

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 (302) hide show
  1. package/lib/commonjs/modules/bt-device/constants/device-instruction-pdfs.js +19 -1
  2. package/lib/commonjs/modules/bt-device/constants/device-instruction-pdfs.js.map +1 -1
  3. package/lib/commonjs/modules/bt-device/constants/supported-device-catalog-and-medical-variants.js +47 -0
  4. package/lib/commonjs/modules/bt-device/constants/supported-device-catalog-and-medical-variants.js.map +1 -0
  5. package/lib/commonjs/modules/bt-device/constants/supported-device-catalog-cofoe-variants.js +119 -0
  6. package/lib/commonjs/modules/bt-device/constants/supported-device-catalog-cofoe-variants.js.map +1 -0
  7. package/lib/commonjs/modules/bt-device/constants/supported-device-catalog-standard-variants.js +6 -0
  8. package/lib/commonjs/modules/bt-device/constants/supported-device-catalog-standard-variants.js.map +1 -1
  9. package/lib/commonjs/modules/bt-device/constants/supported-device-catalog-taidoc-variants.js +173 -0
  10. package/lib/commonjs/modules/bt-device/constants/supported-device-catalog-taidoc-variants.js.map +1 -0
  11. package/lib/commonjs/modules/bt-device/constants/supported-device-catalog-variants.js +8 -0
  12. package/lib/commonjs/modules/bt-device/constants/supported-device-catalog-variants.js.map +1 -1
  13. package/lib/commonjs/modules/bt-device/constants/supported-device-catalog-yonker-variants.js +113 -0
  14. package/lib/commonjs/modules/bt-device/constants/supported-device-catalog-yonker-variants.js.map +1 -0
  15. package/lib/commonjs/modules/bt-device/constants/supported-devices.js +2 -37
  16. package/lib/commonjs/modules/bt-device/constants/supported-devices.js.map +1 -1
  17. package/lib/commonjs/modules/bt-management/constants/and-medical-device-variants.js +39 -0
  18. package/lib/commonjs/modules/bt-management/constants/and-medical-device-variants.js.map +1 -0
  19. package/lib/commonjs/modules/bt-management/constants/built-in-measurement-types.js +84 -0
  20. package/lib/commonjs/modules/bt-management/constants/built-in-measurement-types.js.map +1 -0
  21. package/lib/commonjs/modules/bt-management/constants/cofoe-device-variants.js +101 -0
  22. package/lib/commonjs/modules/bt-management/constants/cofoe-device-variants.js.map +1 -0
  23. package/lib/commonjs/modules/bt-management/constants/device-variants.js +5 -1
  24. package/lib/commonjs/modules/bt-management/constants/device-variants.js.map +1 -1
  25. package/lib/commonjs/modules/bt-management/constants/standard-device-variants.js +5 -0
  26. package/lib/commonjs/modules/bt-management/constants/standard-device-variants.js.map +1 -1
  27. package/lib/commonjs/modules/bt-management/constants/taidoc-device-variants.js +144 -0
  28. package/lib/commonjs/modules/bt-management/constants/taidoc-device-variants.js.map +1 -0
  29. package/lib/commonjs/modules/bt-management/constants/yonker-device-variants.js +93 -0
  30. package/lib/commonjs/modules/bt-management/constants/yonker-device-variants.js.map +1 -0
  31. package/lib/commonjs/modules/bt-management/services/background-sync/background-service-uuids.js +18 -0
  32. package/lib/commonjs/modules/bt-management/services/background-sync/background-service-uuids.js.map +1 -1
  33. package/lib/commonjs/modules/bt-management/services/device-classes.js +23 -1
  34. package/lib/commonjs/modules/bt-management/services/device-classes.js.map +1 -1
  35. package/lib/commonjs/modules/bt-management/services/devices/and-medical/and-medical.device.js +61 -0
  36. package/lib/commonjs/modules/bt-management/services/devices/and-medical/and-medical.device.js.map +1 -0
  37. package/lib/commonjs/modules/bt-management/services/devices/and-medical/and-medical.protocol.js +113 -0
  38. package/lib/commonjs/modules/bt-management/services/devices/and-medical/and-medical.protocol.js.map +1 -0
  39. package/lib/commonjs/modules/bt-management/services/devices/and-medical/and-medical.sequencer.js +77 -0
  40. package/lib/commonjs/modules/bt-management/services/devices/and-medical/and-medical.sequencer.js.map +1 -0
  41. package/lib/commonjs/modules/bt-management/services/devices/aoj/aoj-70b.device.js +1 -1
  42. package/lib/commonjs/modules/bt-management/services/devices/aoj/aoj-70b.device.js.map +1 -1
  43. package/lib/commonjs/modules/bt-management/services/devices/blood-glucose/blood-glucose.device.js +7 -25
  44. package/lib/commonjs/modules/bt-management/services/devices/blood-glucose/blood-glucose.device.js.map +1 -1
  45. package/lib/commonjs/modules/bt-management/services/devices/bt-managed-device.js +7 -2
  46. package/lib/commonjs/modules/bt-management/services/devices/bt-managed-device.js.map +1 -1
  47. package/lib/commonjs/modules/bt-management/services/devices/cofoe/cofoe-bp.sequencer.js +86 -0
  48. package/lib/commonjs/modules/bt-management/services/devices/cofoe/cofoe-bp.sequencer.js.map +1 -0
  49. package/lib/commonjs/modules/bt-management/services/devices/cofoe/cofoe-glucose.sequencer.js +155 -0
  50. package/lib/commonjs/modules/bt-management/services/devices/cofoe/cofoe-glucose.sequencer.js.map +1 -0
  51. package/lib/commonjs/modules/bt-management/services/devices/cofoe/cofoe-thermometer.sequencer.js +33 -0
  52. package/lib/commonjs/modules/bt-management/services/devices/cofoe/cofoe-thermometer.sequencer.js.map +1 -0
  53. package/lib/commonjs/modules/bt-management/services/devices/cofoe/cofoe.device.js +87 -0
  54. package/lib/commonjs/modules/bt-management/services/devices/cofoe/cofoe.device.js.map +1 -0
  55. package/lib/commonjs/modules/bt-management/services/devices/cofoe/cofoe.protocol.js +185 -0
  56. package/lib/commonjs/modules/bt-management/services/devices/cofoe/cofoe.protocol.js.map +1 -0
  57. package/lib/commonjs/modules/bt-management/services/devices/cofoe/cofoe.records.js +86 -0
  58. package/lib/commonjs/modules/bt-management/services/devices/cofoe/cofoe.records.js.map +1 -0
  59. package/lib/commonjs/modules/bt-management/services/devices/jumper/jumper.device.js +1 -1
  60. package/lib/commonjs/modules/bt-management/services/devices/jumper/jumper.device.js.map +1 -1
  61. package/lib/commonjs/modules/bt-management/services/devices/live-oximeter.sequencer.js +10 -6
  62. package/lib/commonjs/modules/bt-management/services/devices/live-oximeter.sequencer.js.map +1 -1
  63. package/lib/commonjs/modules/bt-management/services/devices/taidoc/taidoc.device.js +50 -0
  64. package/lib/commonjs/modules/bt-management/services/devices/taidoc/taidoc.device.js.map +1 -0
  65. package/lib/commonjs/modules/bt-management/services/devices/taidoc/taidoc.protocol.js +127 -0
  66. package/lib/commonjs/modules/bt-management/services/devices/taidoc/taidoc.protocol.js.map +1 -0
  67. package/lib/commonjs/modules/bt-management/services/devices/taidoc/taidoc.records.js +181 -0
  68. package/lib/commonjs/modules/bt-management/services/devices/taidoc/taidoc.records.js.map +1 -0
  69. package/lib/commonjs/modules/bt-management/services/devices/taidoc/taidoc.sequencer.js +139 -0
  70. package/lib/commonjs/modules/bt-management/services/devices/taidoc/taidoc.sequencer.js.map +1 -0
  71. package/lib/commonjs/modules/bt-management/services/devices/yonker/yonker.device.js +90 -0
  72. package/lib/commonjs/modules/bt-management/services/devices/yonker/yonker.device.js.map +1 -0
  73. package/lib/commonjs/modules/bt-management/services/devices/yonker/yonker.protocol.js +202 -0
  74. package/lib/commonjs/modules/bt-management/services/devices/yonker/yonker.protocol.js.map +1 -0
  75. package/lib/commonjs/modules/bt-management/services/devices/yonker/yonker.sequencer.js +137 -0
  76. package/lib/commonjs/modules/bt-management/services/devices/yonker/yonker.sequencer.js.map +1 -0
  77. package/lib/commonjs/modules/bt-management/types/integrated-devices.js +18 -0
  78. package/lib/commonjs/modules/bt-management/types/integrated-devices.js.map +1 -1
  79. package/lib/module/modules/bt-device/constants/device-instruction-pdfs.js +19 -1
  80. package/lib/module/modules/bt-device/constants/device-instruction-pdfs.js.map +1 -1
  81. package/lib/module/modules/bt-device/constants/supported-device-catalog-and-medical-variants.js +45 -0
  82. package/lib/module/modules/bt-device/constants/supported-device-catalog-and-medical-variants.js.map +1 -0
  83. package/lib/module/modules/bt-device/constants/supported-device-catalog-cofoe-variants.js +117 -0
  84. package/lib/module/modules/bt-device/constants/supported-device-catalog-cofoe-variants.js.map +1 -0
  85. package/lib/module/modules/bt-device/constants/supported-device-catalog-standard-variants.js +6 -0
  86. package/lib/module/modules/bt-device/constants/supported-device-catalog-standard-variants.js.map +1 -1
  87. package/lib/module/modules/bt-device/constants/supported-device-catalog-taidoc-variants.js +171 -0
  88. package/lib/module/modules/bt-device/constants/supported-device-catalog-taidoc-variants.js.map +1 -0
  89. package/lib/module/modules/bt-device/constants/supported-device-catalog-variants.js +8 -0
  90. package/lib/module/modules/bt-device/constants/supported-device-catalog-variants.js.map +1 -1
  91. package/lib/module/modules/bt-device/constants/supported-device-catalog-yonker-variants.js +111 -0
  92. package/lib/module/modules/bt-device/constants/supported-device-catalog-yonker-variants.js.map +1 -0
  93. package/lib/module/modules/bt-device/constants/supported-devices.js +2 -37
  94. package/lib/module/modules/bt-device/constants/supported-devices.js.map +1 -1
  95. package/lib/module/modules/bt-management/constants/and-medical-device-variants.js +37 -0
  96. package/lib/module/modules/bt-management/constants/and-medical-device-variants.js.map +1 -0
  97. package/lib/module/modules/bt-management/constants/built-in-measurement-types.js +82 -0
  98. package/lib/module/modules/bt-management/constants/built-in-measurement-types.js.map +1 -0
  99. package/lib/module/modules/bt-management/constants/cofoe-device-variants.js +99 -0
  100. package/lib/module/modules/bt-management/constants/cofoe-device-variants.js.map +1 -0
  101. package/lib/module/modules/bt-management/constants/device-variants.js +5 -1
  102. package/lib/module/modules/bt-management/constants/device-variants.js.map +1 -1
  103. package/lib/module/modules/bt-management/constants/standard-device-variants.js +5 -0
  104. package/lib/module/modules/bt-management/constants/standard-device-variants.js.map +1 -1
  105. package/lib/module/modules/bt-management/constants/taidoc-device-variants.js +142 -0
  106. package/lib/module/modules/bt-management/constants/taidoc-device-variants.js.map +1 -0
  107. package/lib/module/modules/bt-management/constants/yonker-device-variants.js +91 -0
  108. package/lib/module/modules/bt-management/constants/yonker-device-variants.js.map +1 -0
  109. package/lib/module/modules/bt-management/services/background-sync/background-service-uuids.js +18 -0
  110. package/lib/module/modules/bt-management/services/background-sync/background-service-uuids.js.map +1 -1
  111. package/lib/module/modules/bt-management/services/device-classes.js +23 -1
  112. package/lib/module/modules/bt-management/services/device-classes.js.map +1 -1
  113. package/lib/module/modules/bt-management/services/devices/and-medical/and-medical.device.js +57 -0
  114. package/lib/module/modules/bt-management/services/devices/and-medical/and-medical.device.js.map +1 -0
  115. package/lib/module/modules/bt-management/services/devices/and-medical/and-medical.protocol.js +106 -0
  116. package/lib/module/modules/bt-management/services/devices/and-medical/and-medical.protocol.js.map +1 -0
  117. package/lib/module/modules/bt-management/services/devices/and-medical/and-medical.sequencer.js +74 -0
  118. package/lib/module/modules/bt-management/services/devices/and-medical/and-medical.sequencer.js.map +1 -0
  119. package/lib/module/modules/bt-management/services/devices/aoj/aoj-70b.device.js +2 -2
  120. package/lib/module/modules/bt-management/services/devices/aoj/aoj-70b.device.js.map +1 -1
  121. package/lib/module/modules/bt-management/services/devices/blood-glucose/blood-glucose.device.js +6 -24
  122. package/lib/module/modules/bt-management/services/devices/blood-glucose/blood-glucose.device.js.map +1 -1
  123. package/lib/module/modules/bt-management/services/devices/bt-managed-device.js +7 -2
  124. package/lib/module/modules/bt-management/services/devices/bt-managed-device.js.map +1 -1
  125. package/lib/module/modules/bt-management/services/devices/cofoe/cofoe-bp.sequencer.js +82 -0
  126. package/lib/module/modules/bt-management/services/devices/cofoe/cofoe-bp.sequencer.js.map +1 -0
  127. package/lib/module/modules/bt-management/services/devices/cofoe/cofoe-glucose.sequencer.js +148 -0
  128. package/lib/module/modules/bt-management/services/devices/cofoe/cofoe-glucose.sequencer.js.map +1 -0
  129. package/lib/module/modules/bt-management/services/devices/cofoe/cofoe-thermometer.sequencer.js +30 -0
  130. package/lib/module/modules/bt-management/services/devices/cofoe/cofoe-thermometer.sequencer.js.map +1 -0
  131. package/lib/module/modules/bt-management/services/devices/cofoe/cofoe.device.js +83 -0
  132. package/lib/module/modules/bt-management/services/devices/cofoe/cofoe.device.js.map +1 -0
  133. package/lib/module/modules/bt-management/services/devices/cofoe/cofoe.protocol.js +173 -0
  134. package/lib/module/modules/bt-management/services/devices/cofoe/cofoe.protocol.js.map +1 -0
  135. package/lib/module/modules/bt-management/services/devices/cofoe/cofoe.records.js +78 -0
  136. package/lib/module/modules/bt-management/services/devices/cofoe/cofoe.records.js.map +1 -0
  137. package/lib/module/modules/bt-management/services/devices/jumper/jumper.device.js +2 -2
  138. package/lib/module/modules/bt-management/services/devices/jumper/jumper.device.js.map +1 -1
  139. package/lib/module/modules/bt-management/services/devices/live-oximeter.sequencer.js +10 -6
  140. package/lib/module/modules/bt-management/services/devices/live-oximeter.sequencer.js.map +1 -1
  141. package/lib/module/modules/bt-management/services/devices/taidoc/taidoc.device.js +46 -0
  142. package/lib/module/modules/bt-management/services/devices/taidoc/taidoc.device.js.map +1 -0
  143. package/lib/module/modules/bt-management/services/devices/taidoc/taidoc.protocol.js +114 -0
  144. package/lib/module/modules/bt-management/services/devices/taidoc/taidoc.protocol.js.map +1 -0
  145. package/lib/module/modules/bt-management/services/devices/taidoc/taidoc.records.js +168 -0
  146. package/lib/module/modules/bt-management/services/devices/taidoc/taidoc.records.js.map +1 -0
  147. package/lib/module/modules/bt-management/services/devices/taidoc/taidoc.sequencer.js +136 -0
  148. package/lib/module/modules/bt-management/services/devices/taidoc/taidoc.sequencer.js.map +1 -0
  149. package/lib/module/modules/bt-management/services/devices/yonker/yonker.device.js +86 -0
  150. package/lib/module/modules/bt-management/services/devices/yonker/yonker.device.js.map +1 -0
  151. package/lib/module/modules/bt-management/services/devices/yonker/yonker.protocol.js +186 -0
  152. package/lib/module/modules/bt-management/services/devices/yonker/yonker.protocol.js.map +1 -0
  153. package/lib/module/modules/bt-management/services/devices/yonker/yonker.sequencer.js +133 -0
  154. package/lib/module/modules/bt-management/services/devices/yonker/yonker.sequencer.js.map +1 -0
  155. package/lib/module/modules/bt-management/types/device-measurement-map.js.map +1 -1
  156. package/lib/module/modules/bt-management/types/integrated-devices.js +18 -0
  157. package/lib/module/modules/bt-management/types/integrated-devices.js.map +1 -1
  158. package/lib/typescript/commonjs/src/modules/bt-device/constants/device-instruction-pdfs.d.ts.map +1 -1
  159. package/lib/typescript/commonjs/src/modules/bt-device/constants/supported-device-catalog-and-medical-variants.d.ts +5 -0
  160. package/lib/typescript/commonjs/src/modules/bt-device/constants/supported-device-catalog-and-medical-variants.d.ts.map +1 -0
  161. package/lib/typescript/commonjs/src/modules/bt-device/constants/supported-device-catalog-cofoe-variants.d.ts +5 -0
  162. package/lib/typescript/commonjs/src/modules/bt-device/constants/supported-device-catalog-cofoe-variants.d.ts.map +1 -0
  163. package/lib/typescript/commonjs/src/modules/bt-device/constants/supported-device-catalog-standard-variants.d.ts.map +1 -1
  164. package/lib/typescript/commonjs/src/modules/bt-device/constants/supported-device-catalog-taidoc-variants.d.ts +5 -0
  165. package/lib/typescript/commonjs/src/modules/bt-device/constants/supported-device-catalog-taidoc-variants.d.ts.map +1 -0
  166. package/lib/typescript/commonjs/src/modules/bt-device/constants/supported-device-catalog-variants.d.ts.map +1 -1
  167. package/lib/typescript/commonjs/src/modules/bt-device/constants/supported-device-catalog-yonker-variants.d.ts +5 -0
  168. package/lib/typescript/commonjs/src/modules/bt-device/constants/supported-device-catalog-yonker-variants.d.ts.map +1 -0
  169. package/lib/typescript/commonjs/src/modules/bt-device/constants/supported-devices.d.ts.map +1 -1
  170. package/lib/typescript/commonjs/src/modules/bt-management/constants/and-medical-device-variants.d.ts +5 -0
  171. package/lib/typescript/commonjs/src/modules/bt-management/constants/and-medical-device-variants.d.ts.map +1 -0
  172. package/lib/typescript/commonjs/src/modules/bt-management/constants/built-in-measurement-types.d.ts +9 -0
  173. package/lib/typescript/commonjs/src/modules/bt-management/constants/built-in-measurement-types.d.ts.map +1 -0
  174. package/lib/typescript/commonjs/src/modules/bt-management/constants/cofoe-device-variants.d.ts +5 -0
  175. package/lib/typescript/commonjs/src/modules/bt-management/constants/cofoe-device-variants.d.ts.map +1 -0
  176. package/lib/typescript/commonjs/src/modules/bt-management/constants/device-variants.d.ts.map +1 -1
  177. package/lib/typescript/commonjs/src/modules/bt-management/constants/standard-device-variants.d.ts.map +1 -1
  178. package/lib/typescript/commonjs/src/modules/bt-management/constants/taidoc-device-variants.d.ts +5 -0
  179. package/lib/typescript/commonjs/src/modules/bt-management/constants/taidoc-device-variants.d.ts.map +1 -0
  180. package/lib/typescript/commonjs/src/modules/bt-management/constants/yonker-device-variants.d.ts +5 -0
  181. package/lib/typescript/commonjs/src/modules/bt-management/constants/yonker-device-variants.d.ts.map +1 -0
  182. package/lib/typescript/commonjs/src/modules/bt-management/services/background-sync/background-service-uuids.d.ts.map +1 -1
  183. package/lib/typescript/commonjs/src/modules/bt-management/services/device-classes.d.ts +22 -0
  184. package/lib/typescript/commonjs/src/modules/bt-management/services/device-classes.d.ts.map +1 -1
  185. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/and-medical/and-medical.device.d.ts +18 -0
  186. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/and-medical/and-medical.device.d.ts.map +1 -0
  187. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/and-medical/and-medical.protocol.d.ts +30 -0
  188. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/and-medical/and-medical.protocol.d.ts.map +1 -0
  189. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/and-medical/and-medical.sequencer.d.ts +26 -0
  190. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/and-medical/and-medical.sequencer.d.ts.map +1 -0
  191. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/blood-glucose/blood-glucose.device.d.ts.map +1 -1
  192. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-managed-device.d.ts +4 -1
  193. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-managed-device.d.ts.map +1 -1
  194. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/cofoe/cofoe-bp.sequencer.d.ts +32 -0
  195. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/cofoe/cofoe-bp.sequencer.d.ts.map +1 -0
  196. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/cofoe/cofoe-glucose.sequencer.d.ts +46 -0
  197. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/cofoe/cofoe-glucose.sequencer.d.ts.map +1 -0
  198. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/cofoe/cofoe-thermometer.sequencer.d.ts +15 -0
  199. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/cofoe/cofoe-thermometer.sequencer.d.ts.map +1 -0
  200. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/cofoe/cofoe.device.d.ts +18 -0
  201. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/cofoe/cofoe.device.d.ts.map +1 -0
  202. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/cofoe/cofoe.protocol.d.ts +75 -0
  203. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/cofoe/cofoe.protocol.d.ts.map +1 -0
  204. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/cofoe/cofoe.records.d.ts +22 -0
  205. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/cofoe/cofoe.records.d.ts.map +1 -0
  206. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/jumper/jumper.device.d.ts.map +1 -1
  207. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/live-oximeter.sequencer.d.ts +6 -2
  208. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/live-oximeter.sequencer.d.ts.map +1 -1
  209. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/taidoc/taidoc.device.d.ts +16 -0
  210. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/taidoc/taidoc.device.d.ts.map +1 -0
  211. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/taidoc/taidoc.protocol.d.ts +50 -0
  212. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/taidoc/taidoc.protocol.d.ts.map +1 -0
  213. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/taidoc/taidoc.records.d.ts +40 -0
  214. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/taidoc/taidoc.records.d.ts.map +1 -0
  215. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/taidoc/taidoc.sequencer.d.ts +38 -0
  216. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/taidoc/taidoc.sequencer.d.ts.map +1 -0
  217. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/yonker/yonker.device.d.ts +21 -0
  218. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/yonker/yonker.device.d.ts.map +1 -0
  219. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/yonker/yonker.protocol.d.ts +62 -0
  220. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/yonker/yonker.protocol.d.ts.map +1 -0
  221. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/yonker/yonker.sequencer.d.ts +46 -0
  222. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/yonker/yonker.sequencer.d.ts.map +1 -0
  223. package/lib/typescript/commonjs/src/modules/bt-management/types/device-data.d.ts +1 -0
  224. package/lib/typescript/commonjs/src/modules/bt-management/types/device-data.d.ts.map +1 -1
  225. package/lib/typescript/commonjs/src/modules/bt-management/types/device-measurement-map.d.ts +18 -0
  226. package/lib/typescript/commonjs/src/modules/bt-management/types/device-measurement-map.d.ts.map +1 -1
  227. package/lib/typescript/commonjs/src/modules/bt-management/types/integrated-devices.d.ts +19 -1
  228. package/lib/typescript/commonjs/src/modules/bt-management/types/integrated-devices.d.ts.map +1 -1
  229. package/lib/typescript/commonjs/src/modules/data-sync/utils/get-samples-from-health.d.ts +2 -2
  230. package/lib/typescript/module/src/modules/bt-device/constants/device-instruction-pdfs.d.ts.map +1 -1
  231. package/lib/typescript/module/src/modules/bt-device/constants/supported-device-catalog-and-medical-variants.d.ts +5 -0
  232. package/lib/typescript/module/src/modules/bt-device/constants/supported-device-catalog-and-medical-variants.d.ts.map +1 -0
  233. package/lib/typescript/module/src/modules/bt-device/constants/supported-device-catalog-cofoe-variants.d.ts +5 -0
  234. package/lib/typescript/module/src/modules/bt-device/constants/supported-device-catalog-cofoe-variants.d.ts.map +1 -0
  235. package/lib/typescript/module/src/modules/bt-device/constants/supported-device-catalog-standard-variants.d.ts.map +1 -1
  236. package/lib/typescript/module/src/modules/bt-device/constants/supported-device-catalog-taidoc-variants.d.ts +5 -0
  237. package/lib/typescript/module/src/modules/bt-device/constants/supported-device-catalog-taidoc-variants.d.ts.map +1 -0
  238. package/lib/typescript/module/src/modules/bt-device/constants/supported-device-catalog-variants.d.ts.map +1 -1
  239. package/lib/typescript/module/src/modules/bt-device/constants/supported-device-catalog-yonker-variants.d.ts +5 -0
  240. package/lib/typescript/module/src/modules/bt-device/constants/supported-device-catalog-yonker-variants.d.ts.map +1 -0
  241. package/lib/typescript/module/src/modules/bt-device/constants/supported-devices.d.ts.map +1 -1
  242. package/lib/typescript/module/src/modules/bt-management/constants/and-medical-device-variants.d.ts +5 -0
  243. package/lib/typescript/module/src/modules/bt-management/constants/and-medical-device-variants.d.ts.map +1 -0
  244. package/lib/typescript/module/src/modules/bt-management/constants/built-in-measurement-types.d.ts +9 -0
  245. package/lib/typescript/module/src/modules/bt-management/constants/built-in-measurement-types.d.ts.map +1 -0
  246. package/lib/typescript/module/src/modules/bt-management/constants/cofoe-device-variants.d.ts +5 -0
  247. package/lib/typescript/module/src/modules/bt-management/constants/cofoe-device-variants.d.ts.map +1 -0
  248. package/lib/typescript/module/src/modules/bt-management/constants/device-variants.d.ts.map +1 -1
  249. package/lib/typescript/module/src/modules/bt-management/constants/standard-device-variants.d.ts.map +1 -1
  250. package/lib/typescript/module/src/modules/bt-management/constants/taidoc-device-variants.d.ts +5 -0
  251. package/lib/typescript/module/src/modules/bt-management/constants/taidoc-device-variants.d.ts.map +1 -0
  252. package/lib/typescript/module/src/modules/bt-management/constants/yonker-device-variants.d.ts +5 -0
  253. package/lib/typescript/module/src/modules/bt-management/constants/yonker-device-variants.d.ts.map +1 -0
  254. package/lib/typescript/module/src/modules/bt-management/services/background-sync/background-service-uuids.d.ts.map +1 -1
  255. package/lib/typescript/module/src/modules/bt-management/services/device-classes.d.ts +22 -0
  256. package/lib/typescript/module/src/modules/bt-management/services/device-classes.d.ts.map +1 -1
  257. package/lib/typescript/module/src/modules/bt-management/services/devices/and-medical/and-medical.device.d.ts +18 -0
  258. package/lib/typescript/module/src/modules/bt-management/services/devices/and-medical/and-medical.device.d.ts.map +1 -0
  259. package/lib/typescript/module/src/modules/bt-management/services/devices/and-medical/and-medical.protocol.d.ts +30 -0
  260. package/lib/typescript/module/src/modules/bt-management/services/devices/and-medical/and-medical.protocol.d.ts.map +1 -0
  261. package/lib/typescript/module/src/modules/bt-management/services/devices/and-medical/and-medical.sequencer.d.ts +26 -0
  262. package/lib/typescript/module/src/modules/bt-management/services/devices/and-medical/and-medical.sequencer.d.ts.map +1 -0
  263. package/lib/typescript/module/src/modules/bt-management/services/devices/blood-glucose/blood-glucose.device.d.ts.map +1 -1
  264. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-managed-device.d.ts +4 -1
  265. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-managed-device.d.ts.map +1 -1
  266. package/lib/typescript/module/src/modules/bt-management/services/devices/cofoe/cofoe-bp.sequencer.d.ts +32 -0
  267. package/lib/typescript/module/src/modules/bt-management/services/devices/cofoe/cofoe-bp.sequencer.d.ts.map +1 -0
  268. package/lib/typescript/module/src/modules/bt-management/services/devices/cofoe/cofoe-glucose.sequencer.d.ts +46 -0
  269. package/lib/typescript/module/src/modules/bt-management/services/devices/cofoe/cofoe-glucose.sequencer.d.ts.map +1 -0
  270. package/lib/typescript/module/src/modules/bt-management/services/devices/cofoe/cofoe-thermometer.sequencer.d.ts +15 -0
  271. package/lib/typescript/module/src/modules/bt-management/services/devices/cofoe/cofoe-thermometer.sequencer.d.ts.map +1 -0
  272. package/lib/typescript/module/src/modules/bt-management/services/devices/cofoe/cofoe.device.d.ts +18 -0
  273. package/lib/typescript/module/src/modules/bt-management/services/devices/cofoe/cofoe.device.d.ts.map +1 -0
  274. package/lib/typescript/module/src/modules/bt-management/services/devices/cofoe/cofoe.protocol.d.ts +75 -0
  275. package/lib/typescript/module/src/modules/bt-management/services/devices/cofoe/cofoe.protocol.d.ts.map +1 -0
  276. package/lib/typescript/module/src/modules/bt-management/services/devices/cofoe/cofoe.records.d.ts +22 -0
  277. package/lib/typescript/module/src/modules/bt-management/services/devices/cofoe/cofoe.records.d.ts.map +1 -0
  278. package/lib/typescript/module/src/modules/bt-management/services/devices/jumper/jumper.device.d.ts.map +1 -1
  279. package/lib/typescript/module/src/modules/bt-management/services/devices/live-oximeter.sequencer.d.ts +6 -2
  280. package/lib/typescript/module/src/modules/bt-management/services/devices/live-oximeter.sequencer.d.ts.map +1 -1
  281. package/lib/typescript/module/src/modules/bt-management/services/devices/taidoc/taidoc.device.d.ts +16 -0
  282. package/lib/typescript/module/src/modules/bt-management/services/devices/taidoc/taidoc.device.d.ts.map +1 -0
  283. package/lib/typescript/module/src/modules/bt-management/services/devices/taidoc/taidoc.protocol.d.ts +50 -0
  284. package/lib/typescript/module/src/modules/bt-management/services/devices/taidoc/taidoc.protocol.d.ts.map +1 -0
  285. package/lib/typescript/module/src/modules/bt-management/services/devices/taidoc/taidoc.records.d.ts +40 -0
  286. package/lib/typescript/module/src/modules/bt-management/services/devices/taidoc/taidoc.records.d.ts.map +1 -0
  287. package/lib/typescript/module/src/modules/bt-management/services/devices/taidoc/taidoc.sequencer.d.ts +38 -0
  288. package/lib/typescript/module/src/modules/bt-management/services/devices/taidoc/taidoc.sequencer.d.ts.map +1 -0
  289. package/lib/typescript/module/src/modules/bt-management/services/devices/yonker/yonker.device.d.ts +21 -0
  290. package/lib/typescript/module/src/modules/bt-management/services/devices/yonker/yonker.device.d.ts.map +1 -0
  291. package/lib/typescript/module/src/modules/bt-management/services/devices/yonker/yonker.protocol.d.ts +62 -0
  292. package/lib/typescript/module/src/modules/bt-management/services/devices/yonker/yonker.protocol.d.ts.map +1 -0
  293. package/lib/typescript/module/src/modules/bt-management/services/devices/yonker/yonker.sequencer.d.ts +46 -0
  294. package/lib/typescript/module/src/modules/bt-management/services/devices/yonker/yonker.sequencer.d.ts.map +1 -0
  295. package/lib/typescript/module/src/modules/bt-management/types/device-data.d.ts +1 -0
  296. package/lib/typescript/module/src/modules/bt-management/types/device-data.d.ts.map +1 -1
  297. package/lib/typescript/module/src/modules/bt-management/types/device-measurement-map.d.ts +18 -0
  298. package/lib/typescript/module/src/modules/bt-management/types/device-measurement-map.d.ts.map +1 -1
  299. package/lib/typescript/module/src/modules/bt-management/types/integrated-devices.d.ts +19 -1
  300. package/lib/typescript/module/src/modules/bt-management/types/integrated-devices.d.ts.map +1 -1
  301. package/lib/typescript/module/src/modules/data-sync/utils/get-samples-from-health.d.ts +2 -2
  302. package/package.json +1 -1
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+
3
+ import { IntegratedDevices } from "../../../types/integrated-devices.js";
4
+ import { BTManagedDevice } from "../bt-managed-device.js";
5
+ import { CofoeBpSequencer } from "./cofoe-bp.sequencer.js";
6
+ import { CofoeCgh25Sequencer, CofoeKfb06Sequencer } from "./cofoe-glucose.sequencer.js";
7
+ import { CofoeThermometerSequencer } from "./cofoe-thermometer.sequencer.js";
8
+ import { COFOE_GATT, CofoeFrameReader } from "./cofoe.protocol.js";
9
+ const passThrough = {
10
+ caseValuePosition: [],
11
+ cases: []
12
+ };
13
+ const service = ({
14
+ service: uuid,
15
+ notify
16
+ }, optional = false) => ({
17
+ uuid,
18
+ optional,
19
+ monitorUuids: [{
20
+ uuid: notify,
21
+ parsingModel: passThrough
22
+ }]
23
+ });
24
+
25
+ /** The 0x18F0 generation is declared under both UUID layouts MedM's build could mean. */
26
+ const historyServices = [service(COFOE_GATT.history, true), service(COFOE_GATT.historyReversed, true)];
27
+ const SERVICES = {
28
+ [IntegratedDevices.COFOE_BPM]: [service(COFOE_GATT.bloodPressure)],
29
+ [IntegratedDevices.COFOE_BPM_HISTORY]: historyServices,
30
+ [IntegratedDevices.COFOE_GLUCOMETER]: [service(COFOE_GATT.glucometer)],
31
+ [IntegratedDevices.COFOE_GLUCOMETER_CGH25]: [service(COFOE_GATT.glucometer)],
32
+ [IntegratedDevices.COFOE_THERMOMETER]: historyServices
33
+ };
34
+ const FRAMING = {
35
+ [IntegratedDevices.COFOE_BPM]: "bloodPressure",
36
+ [IntegratedDevices.COFOE_BPM_HISTORY]: "bloodPressure",
37
+ [IntegratedDevices.COFOE_GLUCOMETER]: "kfb06",
38
+ [IntegratedDevices.COFOE_GLUCOMETER_CGH25]: "cgh25"
39
+ };
40
+
41
+ /** Cofoe KF-6x blood-pressure monitors, KF-B06 and CGH glucometers and the KF-HW-081A thermometer. */
42
+ class CofoeDeviceClass extends BTManagedDevice {
43
+ stuckDataTimeout = 90_000;
44
+ onStreamStart = undefined;
45
+ constructor(device, params) {
46
+ super(device, params);
47
+ this.mainServices = SERVICES[params.deviceName];
48
+ const framing = FRAMING[params.deviceName];
49
+ if (framing) {
50
+ this.frameReader = new CofoeFrameReader(framing);
51
+ }
52
+ const onResult = result => this.onResult?.(result);
53
+ this.createCommandSequencer = () => {
54
+ switch (params.deviceName) {
55
+ case IntegratedDevices.COFOE_GLUCOMETER:
56
+ return new CofoeKfb06Sequencer({
57
+ onResult
58
+ });
59
+ case IntegratedDevices.COFOE_GLUCOMETER_CGH25:
60
+ return new CofoeCgh25Sequencer({
61
+ onResult
62
+ });
63
+ case IntegratedDevices.COFOE_THERMOMETER:
64
+ return new CofoeThermometerSequencer({
65
+ onResult
66
+ });
67
+ default:
68
+ return new CofoeBpSequencer({
69
+ history: params.deviceName === IntegratedDevices.COFOE_BPM_HISTORY,
70
+ onResult
71
+ });
72
+ }
73
+ };
74
+ }
75
+
76
+ /** The thermometer has no frame reader: one notification is one message. */
77
+ validatePackage = () => true;
78
+ handleSuccessResult() {
79
+ return;
80
+ }
81
+ }
82
+ export { CofoeDeviceClass as CofoeDevice };
83
+ //# sourceMappingURL=cofoe.device.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["IntegratedDevices","BTManagedDevice","CofoeBpSequencer","CofoeCgh25Sequencer","CofoeKfb06Sequencer","CofoeThermometerSequencer","COFOE_GATT","CofoeFrameReader","passThrough","caseValuePosition","cases","service","uuid","notify","optional","monitorUuids","parsingModel","historyServices","history","historyReversed","SERVICES","COFOE_BPM","bloodPressure","COFOE_BPM_HISTORY","COFOE_GLUCOMETER","glucometer","COFOE_GLUCOMETER_CGH25","COFOE_THERMOMETER","FRAMING","CofoeDeviceClass","stuckDataTimeout","onStreamStart","undefined","constructor","device","params","mainServices","deviceName","framing","frameReader","onResult","result","createCommandSequencer","validatePackage","handleSuccessResult","CofoeDevice"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/cofoe/cofoe.device.ts"],"mappings":";;AAIA,SAASA,iBAAiB,QAAQ,sCAAmC;AAGrE,SAASC,eAAe,QAAQ,yBAAsB;AAEtD,SAASC,gBAAgB,QAAQ,yBAAsB;AACvD,SAASC,mBAAmB,EAAEC,mBAAmB,QAAQ,8BAA2B;AACpF,SAASC,yBAAyB,QAAQ,kCAA+B;AACzE,SAASC,UAAU,EAAgBC,gBAAgB,QAAQ,qBAAkB;AAS7E,MAAMC,WAAW,GAAG;EAAEC,iBAAiB,EAAE,EAAE;EAAEC,KAAK,EAAE;AAAG,CAAC;AAExD,MAAMC,OAAO,GAAGA,CACd;EAAEA,OAAO,EAAEC,IAAI;EAAEC;AAA4C,CAAC,EAC9DC,QAAQ,GAAG,KAAK,MACF;EAAEF,IAAI;EAAEE,QAAQ;EAAEC,YAAY,EAAE,CAAC;IAAEH,IAAI,EAAEC,MAAM;IAAEG,YAAY,EAAER;EAAY,CAAC;AAAE,CAAC,CAAC;;AAEhG;AACA,MAAMS,eAAe,GAAG,CAACN,OAAO,CAACL,UAAU,CAACY,OAAO,EAAE,IAAI,CAAC,EAAEP,OAAO,CAACL,UAAU,CAACa,eAAe,EAAE,IAAI,CAAC,CAAC;AAEtG,MAAMC,QAAyC,GAAG;EAChD,CAACpB,iBAAiB,CAACqB,SAAS,GAAG,CAACV,OAAO,CAACL,UAAU,CAACgB,aAAa,CAAC,CAAC;EAClE,CAACtB,iBAAiB,CAACuB,iBAAiB,GAAGN,eAAe;EACtD,CAACjB,iBAAiB,CAACwB,gBAAgB,GAAG,CAACb,OAAO,CAACL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AAiB;UACtC,OAAO,IAAItB,yBAAyB,CAAC;YAAEmC;UAAS,CAAC,CAAC;QACpD;UACE,OAAO,IAAItC,gBAAgB,CAAC;YAC1BgB,OAAO,EAAEiB,MAAM,CAACE,UAAU,KAAKrC,iBAAiB,CAACuB,iBAAiB;YAClEiB;UACF,CAAC,CAAC;MACN;IACF,CAAC;EACH;;EAEA;EACUG,eAAe,GAAGA,CAAA,KAAe,IAAI;EAErCC,mBAAmBA,CAAA,EAAS;IACpC;EACF;AACF;AAEA,SAASf,gBAAgB,IAAIgB,WAAW","ignoreList":[]}
@@ -0,0 +1,173 @@
1
+ "use strict";
2
+
3
+ /* eslint-disable import/group-exports */
4
+
5
+ import { FrameReadStatus } from "../../../types/frame-read-status.js";
6
+ import { calculateCrc8Maxim } from "../../../utils/calculate-crc-8-maxim.js";
7
+ import { hexToByte } from "../../../utils/hex-to-byte.js";
8
+
9
+ /**
10
+ * Cofoe blood-pressure monitors, glucometers and thermometer, from MedM Health Diary 3.12.11's
11
+ * `CCofoe_*` classes. Three binary framings and one ASCII one:
12
+ *
13
+ * - `FF FF len cmd payload ck` (blood pressure): `len` is the whole frame, `ck` makes the byte
14
+ * sum from `len` on zero.
15
+ * - `5A A5 cmd seq len payload crc` (KF-B06 glucometers): CRC-8/MAXIM over `cmd … payload`.
16
+ * - `$PCL A cmd len payload sum` (CGH25 glucometers): the 8-bit sum of everything after `$`.
17
+ * - `<me>o=VVVVx=T\r\n` (KF-HW-081A thermometer), one notification each.
18
+ *
19
+ * MedM does not check the KF-66EP+ checksum and only drops a KF-B06 frame whose CRC happens to
20
+ * be zero; every frame here is verified and dropped when it does not add up.
21
+ */
22
+ const sig16 = assigned => `0000${assigned}-0000-1000-8000-00805f9b34fb`;
23
+
24
+ /**
25
+ * MedM builds the KF-66EP+ and thermometer UUIDs with their words reversed, which reads as
26
+ * `fb349b5f-8000-0080-0010-0000XXXX0000`. Which of the two the hardware exposes is unknown, so
27
+ * both are declared, optional, and the one discovery finds is used.
28
+ */
29
+ const reversed = assigned => `fb349b5f-8000-0080-0010-0000${assigned.slice(2)}${assigned.slice(0, 2)}0000`;
30
+ const gatt = (service, notify, write, wrap) => ({
31
+ service: wrap(service),
32
+ notify: wrap(notify),
33
+ write: wrap(write)
34
+ });
35
+ export const COFOE_GATT = {
36
+ bloodPressure: gatt("f018", "f02a", "f12a", sig16),
37
+ history: gatt("18f0", "2af0", "2af1", sig16),
38
+ historyReversed: gatt("18f0", "2af0", "2af1", reversed),
39
+ glucometer: gatt("ae30", "ae02", "ae01", sig16)
40
+ };
41
+ const toHex = bytes => bytes.map(value => (value & 0xff).toString(16).padStart(2, "0"));
42
+ export const toBytes = frame => frame.map(byte => hexToByte(byte));
43
+ const sum = bytes => bytes.reduce((total, value) => total + value, 0) & 0xff;
44
+
45
+ /* ---------------------------------------------------------------- framing */
46
+
47
+ /** `FF FF len cmd payload ck`. */
48
+ export const bpFrame = (command, payload = []) => {
49
+ const covered = [payload.length + 5, command, ...payload];
50
+ return toHex([0xff, 0xff, ...covered, -sum(covered) & 0xff]);
51
+ };
52
+
53
+ /** `5A A5 cmd seq len payload crc`. */
54
+ export const kfb06Frame = (command, sequence, payload = []) => {
55
+ const covered = toHex([command, sequence, payload.length, ...payload]);
56
+ return [...toHex([0x5a, 0xa5]), ...covered, ...toHex([calculateCrc8Maxim(covered, covered.length)])];
57
+ };
58
+ const PCL = [0x24, 0x50, 0x43, 0x4c];
59
+
60
+ /** `$PCL A cmd len payload sum`. */
61
+ export const cgh25Frame = (command, payload = []) => {
62
+ const bytes = [...PCL, 0x41, command, payload.length, ...payload];
63
+ return toHex([...bytes, sum(bytes.slice(1))]);
64
+ };
65
+ const FRAMINGS = {
66
+ bloodPressure: {
67
+ magic: [0xff, 0xff],
68
+ header: 4,
69
+ length: frame => frame[2] ?? 0,
70
+ valid: frame => frame.length >= 5 && sum(frame.slice(2)) === 0
71
+ },
72
+ kfb06: {
73
+ magic: [0x5a, 0xa5],
74
+ header: 5,
75
+ length: frame => (frame[4] ?? 0) + 6,
76
+ valid: frame => calculateCrc8Maxim(toHex(frame.slice(2, -1)), frame.length - 3) === frame[frame.length - 1]
77
+ },
78
+ cgh25: {
79
+ magic: PCL,
80
+ header: 7,
81
+ length: frame => (frame[6] ?? 0) + 8,
82
+ valid: frame => sum(frame.slice(1, -1)) === frame[frame.length - 1]
83
+ }
84
+ };
85
+ /** Isolates verified frames of one framing whatever the notification boundaries. */
86
+ export class CofoeFrameReader {
87
+ constructor(framing) {
88
+ this.framing = FRAMINGS[framing];
89
+ }
90
+ readFrame(buffer) {
91
+ const {
92
+ magic,
93
+ header,
94
+ length,
95
+ valid
96
+ } = this.framing;
97
+ const values = toBytes(buffer);
98
+ const start = values.findIndex((_, index) => magic.every((byte, offset) => index + offset >= values.length || values[index + offset] === byte));
99
+ if (start === -1) {
100
+ return {
101
+ status: FrameReadStatus.INCOMPLETE,
102
+ consumedBytes: values.length
103
+ };
104
+ }
105
+ if (start + header > values.length) {
106
+ return {
107
+ status: FrameReadStatus.INCOMPLETE,
108
+ consumedBytes: start
109
+ };
110
+ }
111
+ const total = length(values.slice(start));
112
+ if (total < header + 1) {
113
+ return {
114
+ status: FrameReadStatus.CORRUPT,
115
+ consumedBytes: start + 1
116
+ };
117
+ }
118
+ if (start + total > values.length) {
119
+ return {
120
+ status: FrameReadStatus.INCOMPLETE,
121
+ consumedBytes: start
122
+ };
123
+ }
124
+ if (!valid(values.slice(start, start + total))) {
125
+ return {
126
+ status: FrameReadStatus.CORRUPT,
127
+ consumedBytes: start + 1
128
+ };
129
+ }
130
+ return {
131
+ status: FrameReadStatus.COMPLETE,
132
+ consumedBytes: start + total,
133
+ frame: buffer.slice(start, start + total)
134
+ };
135
+ }
136
+ }
137
+
138
+ /** The command and body of a verified frame. */
139
+ export const unframe = (framing, frame) => {
140
+ const bytes = toBytes(frame);
141
+ if (framing === "kfb06") {
142
+ return {
143
+ command: (bytes[2] ?? 0) & 0x3f,
144
+ sequence: bytes[3] ?? 0,
145
+ body: bytes.slice(5, -1)
146
+ };
147
+ }
148
+ const at = framing === "bloodPressure" ? 3 : 5;
149
+ return {
150
+ command: bytes[at] ?? 0,
151
+ sequence: 0,
152
+ body: bytes.slice(FRAMINGS[framing].header, -1)
153
+ };
154
+ };
155
+
156
+ /* ------------------------------------------------------------------ time */
157
+
158
+ const toBcd = value => Math.floor(value / 10) % 10 << 4 | value % 10;
159
+ const clock = now => [now.getFullYear() - 2000, now.getMonth() + 1, now.getDate(), now.getHours(), now.getMinutes(), now.getSeconds()];
160
+
161
+ /** `Cofoe_BPM` set-time, `08`: binary `YY MM DD hh mm ss`. */
162
+ export const bpSetTime = now => bpFrame(0x08, clock(now));
163
+
164
+ /** `Cofoe_KF66EP` set-time, `08`: BCD `YY MM DD hh mm ss`. */
165
+ export const historySetTime = now => bpFrame(0x08, clock(now).map(toBcd));
166
+
167
+ /** KF-B06 set-time, `10`: binary `YY MM DD hh mm ss`. */
168
+ export const kfb06SetTime = (sequence, now) => kfb06Frame(0x10, sequence, clock(now));
169
+
170
+ /** CGH25 set-time, `01`: `00 00 YY MM DD hh mm 00 00`. */
171
+ export const cgh25SetTime = now => cgh25Frame(0x01, [0, 0, ...clock(now).slice(0, 5), 0, 0]);
172
+ export const BP_ACK = bpFrame(0x05);
173
+ //# sourceMappingURL=cofoe.protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["FrameReadStatus","calculateCrc8Maxim","hexToByte","sig16","assigned","reversed","slice","gatt","service","notify","write","wrap","COFOE_GATT","bloodPressure","history","historyReversed","glucometer","toHex","bytes","map","value","toString","padStart","toBytes","frame","byte","sum","reduce","total","bpFrame","command","payload","covered","length","kfb06Frame","sequence","PCL","cgh25Frame","FRAMINGS","magic","header","valid","kfb06","cgh25","CofoeFrameReader","constructor","framing","readFrame","buffer","values","start","findIndex","_","index","every","offset","status","INCOMPLETE","consumedBytes","CORRUPT","COMPLETE","unframe","body","at","toBcd","Math","floor","clock","now","getFullYear","getMonth","getDate","getHours","getMinutes","getSeconds","bpSetTime","historySetTime","kfb06SetTime","cgh25SetTime","BP_ACK"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/cofoe/cofoe.protocol.ts"],"mappings":";;AAAA;;AAGA,SAASA,eAAe,QAAQ,qCAAkC;AAElE,SAASC,kBAAkB,QAAQ,yCAAsC;AACzE,SAASC,SAAS,QAAQ,+BAA4B;;AAEtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,KAAK,GAAIC,QAAgB,IAAa,OAAOA,QAAQ,8BAA8B;;AAEzF;AACA;AACA;AACA;AACA;AACA,MAAMC,QAAQ,GAAID,QAAgB,IAChC,+BAA+BA,QAAQ,CAACE,KAAK,CAAC,CAAC,CAAC,GAAGF,QAAQ,CAACE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM;AAE/E,MAAMC,IAAI,GAAGA,CAACC,OAAe,EAAEC,MAAc,EAAEC,KAAa,EAAEC,IAA4B,MAAM;EAC9FH,OAAO,EAAEG,IAAI,CAACH,OAAO,CAAC;EACtBC,MAAM,EAAEE,IAAI,CAACF,MAAM,CAAC;EACpBC,KAAK,EAAEC,IAAI,CAACD,KAAK;AACnB,CAAC,CAAC;AAEF,OAAO,MAAME,UAAU,GAAG;EACxBC,aAAa,EAAEN,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAEJ,KAAK,CAAC;EAClDW,OAAO,EAAEP,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAEJ,KAAK,CAAC;EAC5CY,eAAe,EAAER,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAEF,QAAQ,CAAC;EACvDW,UAAU,EAAET,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAEJ,KAAK;AAChD,CAAU;AAEV,MAAMc,KAAK,GAAIC,KAAwB,IACrCA,KAAK,CAACC,GAAG,CAAEC,KAAK,IAAK,CAACA,KAA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AAC","ignoreList":[]}
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+
3
+ /* eslint-disable import/group-exports */
4
+
5
+ import { toBytes } from "./cofoe.protocol.js";
6
+
7
+ /**
8
+ * Cofoe record decoders. Times are local wall-clock with no zone; a field out of range drops
9
+ * the record rather than letting `Date` roll it into a plausible wrong time.
10
+ */
11
+ const fromBcd = value => value >> 4 > 9 || (value & 0x0f) > 9 ? undefined : (value >> 4) * 10 + (value & 0x0f);
12
+
13
+ /** `[year - 2000, month, day, hour, minute, second]` as phone-local time, or undefined if any field is out of range. */
14
+ const localTime = fields => {
15
+ if (fields.some(field => field === undefined)) {
16
+ return undefined;
17
+ }
18
+ const [year, month, day, hour, minute, second] = fields.map((field, index) => index === 0 ? field + 2000 : field);
19
+ const time = new Date(year, month - 1, day, hour, minute, second);
20
+ return time.getMonth() === month - 1 && time.getDate() === day && time.getHours() === hour && time.getMinutes() === minute && time.getSeconds() === second ? time : undefined;
21
+ };
22
+ /** Pulse, systolic - 20, diastolic - 20 (mmHg), irregular-pulse flag. */
23
+ const readPressures = bytes => {
24
+ if (bytes.length < 4) {
25
+ return undefined;
26
+ }
27
+ const [heartRate, systolic, diastolic, flag] = bytes;
28
+ return systolic > diastolic && heartRate > 0 ? {
29
+ systolic: systolic + 20,
30
+ diastolic: diastolic + 20,
31
+ heartRate,
32
+ irregularHeartbeat: flag !== 0
33
+ } : undefined;
34
+ };
35
+
36
+ /** `Cofoe_BPM` result, `03`: four bytes, timed by the phone. */
37
+ export const readBpResult = body => body.length === 4 ? readPressures(body) : undefined;
38
+
39
+ /** `Cofoe_KF66EP` record, `02`/`03`: BCD `YY MM DD hh mm ss`, then the four result bytes. */
40
+ export const readBpRecord = body => {
41
+ const recordedAt = body.length === 10 ? localTime(body.slice(0, 6).map(fromBcd)) : undefined;
42
+ const pressures = readPressures(body.slice(6));
43
+ return recordedAt && pressures && {
44
+ ...pressures,
45
+ recordedAt
46
+ };
47
+ };
48
+
49
+ /** One mmol/L of glucose (180.16 g/mol) is 18.016 mg/dL, as in the SIG glucose profile. */
50
+ const MG_PER_DL_PER_MMOL_PER_L = 18.016;
51
+
52
+ /** Tenths of a mmol/L, rounded to whole mg/dL. */
53
+ const mgPerDl = tenthsMmol => Math.round(tenthsMmol / 10 * MG_PER_DL_PER_MMOL_PER_L);
54
+ const glucose = (tenthsMmol, recordedAt) => recordedAt && tenthsMmol > 0 && tenthsMmol < 0xffff ? {
55
+ bloodGlucose: mgPerDl(tenthsMmol),
56
+ recordedAt
57
+ } : undefined;
58
+ const KFB06_GLUCOSE_TYPE = 9;
59
+
60
+ /** KF-B06 record, `11`: binary `YY MM DD hh mm ss`, type (`9` = glucose), u16 LE tenths of mmol/L. */
61
+ export const readKfb06Glucose = body => body.length === 9 && body[6] === KFB06_GLUCOSE_TYPE ? glucose((body[8] ?? 0) << 8 | (body[7] ?? 0), localTime(body.slice(0, 6))) : undefined;
62
+
63
+ /** CGH25 record, `00`/`02`: index (u16 BE), `YY MM DD hh mm`, u16 BE tenths of mmol/L. */
64
+ export const readCgh25Glucose = body => body.length === 9 ? glucose((body[7] ?? 0) << 8 | (body[8] ?? 0), localTime([...body.slice(2, 7), 0])) : undefined;
65
+
66
+ /** `<me>…o=VVVV…x=T…\r\n`: hundredths of a degree Celsius; type `3` is dropped, as MedM does. */
67
+ const THERMOMETER_TEXT = /^<me>(.*)\r\n$/s;
68
+ export const readThermometerText = frame => {
69
+ const text = THERMOMETER_TEXT.exec(String.fromCharCode(...toBytes(frame)))?.[1];
70
+ const type = text && /x=([0-9-])/.exec(text)?.[1];
71
+ const value = text && /o=([0-9-]{1,4})/.exec(text)?.[1];
72
+ if (!type || !value || type === "3" || !/^-?\d+$/.test(value)) {
73
+ return undefined;
74
+ }
75
+ const hundredths = Number.parseInt(value, 10);
76
+ return hundredths > 0 ? hundredths / 100 : undefined;
77
+ };
78
+ //# sourceMappingURL=cofoe.records.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["toBytes","fromBcd","value","undefined","localTime","fields","some","field","year","month","day","hour","minute","second","map","index","time","Date","getMonth","getDate","getHours","getMinutes","getSeconds","readPressures","bytes","length","heartRate","systolic","diastolic","flag","irregularHeartbeat","readBpResult","body","readBpRecord","recordedAt","slice","pressures","MG_PER_DL_PER_MMOL_PER_L","mgPerDl","tenthsMmol","Math","round","glucose","bloodGlucose","KFB06_GLUCOSE_TYPE","readKfb06Glucose","readCgh25Glucose","THERMOMETER_TEXT","readThermometerText","frame","text","exec","String","fromCharCode","type","test","hundredths","Number","parseInt"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/cofoe/cofoe.records.ts"],"mappings":";;AAAA;;AAEA,SAASA,OAAO,QAAQ,qBAAkB;;AAE1C;AACA;AACA;AACA;AACA,MAAMC,OAAO,GAAIC,KAAa,IAC3BA,KAAK,IAAI,CAAC,GAAI,CAAC,IAAI,CAACA,KAAK,GAAG,IAAI,IAAI,CAAC,GAAGC,SAAS,GAAG,CAACD,KAAK,IAAI,CAAC,IAAI,EAAE,IAAIA,KAAK,GAAG,IAAI,CAAC;;AAEzF;AACA,MAAME,SAAS,GAAIC,MAAuC,IAAuB;EAC/E,IAAIA,MAAM,CAACC,IAAI,CAAEC,KAAK,IAAKA,KAAK,KAAKJ,SAAS,CAAC,EAAE;IAC/C,OAAOA,SAAS;EAClB;EAEA,MAAM,CAACK,IAAI,EAAEC,KAAK,EAAEC,GAAG,EAAEC,IAAI,EAAEC,MAAM,EAAEC,MAAM,CAAC,GAAIR,MAAM,CAAcS,GAAG,CAAC,CAACP,KAAK,EAAEQ,KAAK,KACrFA,KAAK,KAAK,CAAC,GAAGR,KAAK,GAAG,IAAI,GAAGA,KAC/B,CAAqD;EAErD,MAAMS,IAAI,GAAG,IAAIC,IAAI,CAACT,IAAI,EAAEC,KAAK,GAAG,CAAC,EAAEC,GAAG,EAAEC,IAAI,EAAEC,MAAM,EAAEC,MAAM,CAAC;EAEjE,OAAOG,IAAI,CAACE,QAAQ,CAAC,CAAC,KA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,MAAM,CAACC,YAAY,CAAC,GAAGrD,OAAO,CAACiD,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;EAC/E,MAAMK,IAAI,GAAGJ,IAAI,IAAI,YAAY,CAACC,IAAI,CAACD,IAAI,CAAC,GAAG,CAAC,CAAC;EACjD,MAAMhD,KAAK,GAAGgD,IAAI,IAAI,iBAAiB,CAACC,IAAI,CAACD,IAAI,CAAC,GAAG,CAAC,CAAC;EAEvD,IAAI,CAACI,IAAI,IAAI,CAACpD,KAAK,IAAIoD,IAAI,KAAK,GAAG,IAAI,CAAC,SAAS,CAACC,IAAI,CAACrD,KAAK,CAAC,EAAE;IAC7D,OAAOC,SAAS;EAClB;EAEA,MAAMqD,UAAU,GAAGC,MAAM,CAACC,QAAQ,CAACxD,KAAK,EAAE,EAAE,CAAC;EAE7C,OAAOsD,UAAU,GAAG,CAAC,GAAGA,UAAU,GAAG,GAAG,GAAGrD,SAAS;AACtD,CAAC","ignoreList":[]}
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { IntegratedDevices } from "../../../types/integrated-devices.js";
4
4
  import { BTManagedDevice } from "../bt-managed-device.js";
5
- import { JUMPER_VALUES, LiveOximeterSequencer } from "../live-oximeter.sequencer.js";
5
+ import { JUMPER_VALUES, LiveOximeterSequencer, readOximeterData } from "../live-oximeter.sequencer.js";
6
6
  import { JUMPER_GATT, JUMPER_NOTIFY, JUMPER_SERVICE } from "./jumper.protocol.js";
7
7
  import { JumperSequencer } from "./jumper.sequencer.js";
8
8
  const passThrough = {
@@ -34,7 +34,7 @@ class JumperDeviceClass extends BTManagedDevice {
34
34
  this.mainServices = SERVICES[params.deviceName];
35
35
  const onResult = result => this.onResult?.(result);
36
36
  this.createCommandSequencer = () => params.deviceName === IntegratedDevices.JUMPER_OXIMETER ? new LiveOximeterSequencer({
37
- isValuesFrame: JUMPER_VALUES,
37
+ readValues: frame => readOximeterData(frame, JUMPER_VALUES),
38
38
  onResult
39
39
  }) : new JumperSequencer({
40
40
  kind: params.deviceName === IntegratedDevices.JUMPER_BPM ? "blood-pressure" : "thermometer",
@@ -1 +1 @@
1
- {"version":3,"names":["IntegratedDevices","BTManagedDevice","JUMPER_VALUES","LiveOximeterSequencer","JUMPER_GATT","JUMPER_NOTIFY","JUMPER_SERVICE","JumperSequencer","passThrough","caseValuePosition","cases","service","uuid","notify","optional","monitorUuids","parsingModel","SERVICES","JUMPER_OXIMETER","oximeterAlternate","JUMPER_THERMOMETER","thermometerAlternate","JUMPER_BPM","bloodPressure","JumperDeviceClass","stuckDataTimeout","onStreamStart","undefined","constructor","device","params","mainServices","deviceName","onResult","result","createCommandSequencer","isValuesFrame","kind","validatePackage","handleSuccessResult","JumperDevice"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/jumper/jumper.device.ts"],"mappings":";;AAIA,SAASA,iBAAiB,QAAQ,sCAAmC;AAGrE,SAASC,eAAe,QAAQ,yBAAsB;AACtD,SAASC,aAAa,EAAEC,qBAAqB,QAAQ,+BAA4B;AAEjF,SAASC,WAAW,EAAEC,aAAa,EAAEC,cAAc,QAAQ,sBAAmB;AAC9E,SAASC,eAAe,QAAQ,uBAAoB;AAOpD,MAAMC,WAAW,GAAG;EAAEC,iBAAiB,EAAE,EAAE;EAAEC,KAAK,EAAE;AAAG,CAAC;AAExD,MAAMC,OAAO,GAAGA,CAACC,IAAY,EAAEC,MAAc,EAAEC,QAAiB,MAAgB;EAC9EF,IAAI;EACJE,QAAQ;EACRC,YAAY,EAAE,CAAC;IAAEH,IAAI,EAAEC,MAAM;IAAEG,YAAY,EAAER;EAAY,CAAC;AAC5D,CAAC,CAAC;;AAEF;AACA,MAAMS,QAA0C,GAAG;EACjD,CAACjB,iBAAiB,CAACkB,eAAe,GAAG,CACnCP,OAAO,CAACL,cAAc,EAAED,aAAa,EAAE,IAAI,CAAC,EAC5CM,OAAO,CAACP,WAAW,CAACe,iBAAiB,CAACR,OAAO,EAAEP,WAAW,CAACe,iBAAiB,CAACN,MAAM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TManagedDevice","JUMPER_VALUES","LiveOximeterSequencer","readOximeterData","JUMPER_GATT","JUMPER_NOTIFY","JUMPER_SERVICE","JumperSequencer","passThrough","caseValuePosition","cases","service","uuid","notify","optional","monitorUuids","parsingModel","SERVICES","JUMPER_OXIMETER","oximeterAlternate","JUMPER_THERMOMETER","thermometerAlternate","JUMPER_BPM","bloodPressure","JumperDeviceClass","stuckDataTimeout","onStreamStart","undefined","constructor","device","params","mainServices","deviceName","onResult","result","createCommandSequencer","readValues","frame","kind","validatePackage","handleSuccessResult","JumperDevice"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/jumper/jumper.device.ts"],"mappings":";;AAIA,SAASA,iBAAiB,QAAQ,sCAAmC;AAGrE,SAASC,eAAe,QAAQ,yBAAsB;AACtD,SAASC,aAAa,EAAEC,qBAAqB,EAAEC,gBAAgB,QAAQ,+BAA4B;AAEnG,SAASC,WAAW,EAAEC,aAAa,EAAEC,cAAc,QAAQ,sBAAmB;AAC9E,SAASC,eAAe,QAAQ,uBAAoB;AAOpD,MAAMC,WAAW,GAAG;EAAEC,iBAAiB,EAAE,EAAE;EAAEC,KAAK,EAAE;AAAG,CAAC;AAExD,MAAMC,OAAO,GAAGA,CAACC,IAAY,EAAEC,MAAc,EAAEC,QAAiB,MAAgB;EAC9EF,IAAI;EACJE,QAAQ;EACRC,YAAY,EAAE,CAAC;IAAEH,IAAI,EAAEC,MAAM;IAAEG,YAAY,EAAER;EAAY,CAAC;AAC5D,CAAC,CAAC;;AAEF;AACA,MAAMS,QAA0C,GAAG;EACjD,CAAClB,iBAAiB,CAACmB,eAAe,GAAG,CACnCP,OAAO,CAACL,cAAc,EAAED,aAAa,EAAE,IAAI,CAAC,EAC5CM,OAAO,CAACP,WAAW,CAACe,iBAAiB,CAACR,OAAO,EAAEP,WAAW,CAACe,iBAAiB,CAACN,MAAM,EAAE,IAAI,CAAC,CAC3F;EACD,CAACd,iBAAiB,CAACqB,kBAAkB,GAAG,CACtCT,OAAO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te } from "../../utils/hex-to-byte.js";
6
6
 
7
7
  /**
8
- * Pulse oximeters that only notify live values - `PR SpO2 PI×10` after a header byte - with no
9
- * stored records and no clock: the AOJ-70A/70B and Jumper JPD-500D families.
8
+ * Pulse oximeters that only notify live values - `PR SpO2 PI×10` after a header byte (Yonker YK-81C:
9
+ * `SpO2 PR PI×10`, the AOJ header) - with no stored records and no clock: the AOJ-70A/70B, Jumper JPD-500D and
10
+ * Yonker YK-81C/YK-80B families.
10
11
  *
11
12
  * A spot reading is the last valid saturation and pulse once valid values stop for a few
12
13
  * seconds - the finger came out or the device went to sleep - which is also how MedM forms one.
@@ -16,6 +17,8 @@ const SETTLE_MS = 3_000;
16
17
 
17
18
  /** Picks the values frame out of whatever else the device sends (waveform, status). */
18
19
 
20
+ /** Which of pulse and SpO2 comes first after the header byte. */
21
+
19
22
  /** AOJ-70: header exactly `81`, extra bytes ignored. */
20
23
  const AOJ_VALUES = (header, length) => header === 0x81 && length >= 4;
21
24
 
@@ -23,12 +26,13 @@ const AOJ_VALUES = (header, length) => header === 0x81 && length >= 4;
23
26
  const JUMPER_VALUES = (header, length) => (header & 0x0f) === 1 && length === 4;
24
27
 
25
28
  /** Pulse rate counts at 1-254 bpm, SpO2 is invalid at 0 or 0x7F, PI 0 means none. */
26
- const readOximeterData = (frame, isValuesFrame = AOJ_VALUES) => {
29
+ const readOximeterData = (frame, isValuesFrame = AOJ_VALUES, fieldOrder = "pulse-spo2") => {
27
30
  if (!isValuesFrame(hexToByte(frame[0] ?? "00"), frame.length)) {
28
31
  return undefined;
29
32
  }
30
- const pulseRate = hexToByte(frame[1] ?? "00");
31
- const bloodOxygen = hexToByte(frame[2] ?? "00");
33
+ const first = hexToByte(frame[1] ?? "00");
34
+ const second = hexToByte(frame[2] ?? "00");
35
+ const [pulseRate, bloodOxygen] = fieldOrder === "pulse-spo2" ? [first, second] : [second, first];
32
36
  const perfusionIndex = hexToByte(frame[3] ?? "00");
33
37
  if (pulseRate < 1 || pulseRate > 254 || bloodOxygen === 0 || bloodOxygen === 0x7f) {
34
38
  return undefined;
@@ -63,7 +67,7 @@ class LiveOximeterSequencer {
63
67
 
64
68
  /** A valid value restarts the settle time; anything else leaves it running. */
65
69
  commandProgress = frame => {
66
- const values = readOximeterData(frame, this.params.isValuesFrame);
70
+ const values = this.params.readValues(frame);
67
71
  if (!values) {
68
72
  return "ignored";
69
73
  }
@@ -1 +1 @@
1
- {"version":3,"names":["MeasurementTypeKey","CaseType","hexToByte","SETTLE_MS","AOJ_VALUES","header","length","JUMPER_VALUES","readOximeterData","frame","isValuesFrame","undefined","pulseRate","bloodOxygen","perfusionIndex","LiveOximeterSequencer","constructor","params","initialCommands","isNormalDisconnect","commandTimeoutMs","latest","onCommandTimeout","onResult","caseType","RESULT","measurementTypeKey","bloodOxygenPulseRate","commandProgress","values","recordedAt","Date","nextCommand"],"sourceRoot":"../../../../../../src","sources":["modules/bt-management/services/devices/live-oximeter.sequencer.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,YAAY;AAE/C,SAASC,QAAQ,QAAQ,0BAAuB;AAGhD,SAASC,SAAS,QAAQ,4BAAyB;;AAEnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,SAAS,GAAG,KAAK;;AASvB;;AAGA;AACA,MAAMC,UAAyB,GAAGA,CAACC,MAAM,EAAEC,MAAM,KAAKD,MAAM,KAAK,IAAI,IAAIC,MAAM,IAAI,CAAC;;AAEpF;AACA,MAAMC,aAA4B,GAAGA,CAACF,MAAM,EAAEC,MAAM,KAAK,CAACD,MAAM,GAAG,IAAI,MAAM,CAAC,IAAIC,MAAM,KAAK,CAAC;;AAE9F;AACA,MAAME,gBAAgB,GAAGA,CACvBC,KAAwB,EACxBC,aAA4B,GAAGN,UAAU,KACE;EAC3C,IAAI,CAACM,aAAa,CAACR,SAAS,CAACO,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,EAAEA,KAAK,CAACH,MAAM,CAAC,EAAE;IAC7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AMoB,MAAM,GAAGrB,gBAAgB,CAACC,KAAK,EAAE,IAAI,CAACQ,MAAM,CAACP,aAAa,CAAC;IAEjE,IAAI,CAACmB,MAAM,EAAE;MACX,OAAO,SAAS;IAClB;IAEA,IAAI,CAACR,MAAM,GAAG;MAAE,GAAGQ,MAAM;MAAEC,UAAU,EAAE,IAAIC,IAAI,CAAC;IAAE,CAAC;IAEnD,OAAO,SAAS;EAClB,CAAC;EAEMC,WAAW,GAAGA,CAAA,KAAiBrB,SAAS;AACjD;AAEA,SAASP,UAAU,EAAEG,aAAa,EAAEQ,qBAAqB,EAAEP,gBAAgB","ignoreList":[]}
1
+ {"version":3,"names":["MeasurementTypeKey","CaseType","hexToByte","SETTLE_MS","AOJ_VALUES","header","length","JUMPER_VALUES","readOximeterData","frame","isValuesFrame","fieldOrder","undefined","first","second","pulseRate","bloodOxygen","perfusionIndex","LiveOximeterSequencer","constructor","params","initialCommands","isNormalDisconnect","commandTimeoutMs","latest","onCommandTimeout","onResult","caseType","RESULT","measurementTypeKey","bloodOxygenPulseRate","commandProgress","values","readValues","recordedAt","Date","nextCommand"],"sourceRoot":"../../../../../../src","sources":["modules/bt-management/services/devices/live-oximeter.sequencer.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,YAAY;AAE/C,SAASC,QAAQ,QAAQ,0BAAuB;AAGhD,SAASC,SAAS,QAAQ,4BAAyB;;AAEnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,SAAS,GAAG,KAAK;;AAWvB;;AAGA;;AAGA;AACA,MAAMC,UAAyB,GAAGA,CAACC,MAAM,EAAEC,MAAM,KAAKD,MAAM,KAAK,IAAI,IAAIC,MAAM,IAAI,CAAC;;AAEpF;AACA,MAAMC,aAA4B,GAAGA,CAACF,MAAM,EAAEC,MAAM,KAAK,CAACD,MAAM,GAAG,IAAI,MAAM,CAAC,IAAIC,MAAM,KAAK,CAAC;;AAE9F;AACA,MAAME,gBAAgB,GAAGA,CACvB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AI,CAACA,MAAM;IAE1B,IAAI,CAACA,MAAM,GAAGZ,SAAS;IAEvB,IAAIY,MAAM,EAAE;MACV,IAAI,CAACJ,MAAM,CAACM,QAAQ,CAAC;QACnBC,QAAQ,EAAE1B,QAAQ,CAAC2B,MAAM;QACzBC,kBAAkB,EAAE7B,kBAAkB,CAAC8B,oBAAoB;QAC3D,GAAGN;MACL,CAAC,CAAC;IACJ;IAEA,OAAO,CAAC,CAAC;EACX,CAAC;;EAED;EACOO,eAAe,GAAItB,KAAwB,IAAyC;IACzF,MAAMuB,MAAM,GAAG,IAAI,CAACZ,MAAM,CAACa,UAAU,CAACxB,KAAK,CAAC;IAE5C,IAAI,CAACuB,MAAM,EAAE;MACX,OAAO,SAAS;IAClB;IAEA,IAAI,CAACR,MAAM,GAAG;MAAE,GAAGQ,MAAM;MAAEE,UAAU,EAAE,IAAIC,IAAI,CAAC;IAAE,CAAC;IAEnD,OAAO,SAAS;EAClB,CAAC;EAEMC,WAAW,GAAGA,CAAA,KAAiBxB,SAAS;AACjD;AAGA,SAASR,UAAU,EAAEG,aAAa,EAAEW,qBAAqB,EAAEV,gBAAgB","ignoreList":[]}
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+
3
+ import { IntegratedDevices } from "../../../types/integrated-devices.js";
4
+ import { BTManagedDevice } from "../bt-managed-device.js";
5
+ import { TAIDOC_CHARACTERISTIC, TAIDOC_SERVICE, TaidocFrameReader } from "./taidoc.protocol.js";
6
+ import { TaidocSequencer } from "./taidoc.sequencer.js";
7
+ const KIND = {
8
+ [IntegratedDevices.TAIDOC_MULTI]: "multi",
9
+ [IntegratedDevices.TAIDOC_BPM]: "bpm",
10
+ [IntegratedDevices.TAIDOC_THERMOMETER]: "thermometer",
11
+ [IntegratedDevices.TAIDOC_OXIMETER]: "oximeter",
12
+ [IntegratedDevices.TAIDOC_SCALE]: "scale"
13
+ };
14
+
15
+ /** The sequencer decodes records itself; the declarative parser only passes frames on. */
16
+ const passThrough = {
17
+ caseValuePosition: [],
18
+ cases: []
19
+ };
20
+ const taidocMainServices = [{
21
+ uuid: TAIDOC_SERVICE,
22
+ monitorUuids: [{
23
+ uuid: TAIDOC_CHARACTERISTIC,
24
+ parsingModel: passThrough
25
+ }]
26
+ }];
27
+
28
+ /** TaiDoc and FORA meters on the 0x51 command protocol: history download of every device user. */
29
+ class TaidocDeviceClass extends BTManagedDevice {
30
+ mainServices = taidocMainServices;
31
+ stuckDataTimeout = 90_000;
32
+ onStreamStart = undefined;
33
+ constructor(device, params) {
34
+ super(device, params);
35
+ this.frameReader = new TaidocFrameReader();
36
+ this.createCommandSequencer = () => new TaidocSequencer({
37
+ kind: KIND[params.deviceName],
38
+ onResult: result => this.onResult?.(result)
39
+ });
40
+ }
41
+ handleSuccessResult() {
42
+ return;
43
+ }
44
+ }
45
+ export { TaidocDeviceClass as TaidocDevice };
46
+ //# sourceMappingURL=taidoc.device.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["IntegratedDevices","BTManagedDevice","TAIDOC_CHARACTERISTIC","TAIDOC_SERVICE","TaidocFrameReader","TaidocSequencer","KIND","TAIDOC_MULTI","TAIDOC_BPM","TAIDOC_THERMOMETER","TAIDOC_OXIMETER","TAIDOC_SCALE","passThrough","caseValuePosition","cases","taidocMainServices","uuid","monitorUuids","parsingModel","TaidocDeviceClass","mainServices","stuckDataTimeout","onStreamStart","undefined","constructor","device","params","frameReader","createCommandSequencer","kind","deviceName","onResult","result","handleSuccessResult","TaidocDevice"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/taidoc/taidoc.device.ts"],"mappings":";;AAIA,SAASA,iBAAiB,QAAQ,sCAAmC;AAGrE,SAASC,eAAe,QAAQ,yBAAsB;AAEtD,SAASC,qBAAqB,EAAEC,cAAc,EAAEC,iBAAiB,QAAQ,sBAAmB;AAE5F,SAASC,eAAe,QAAQ,uBAAoB;AASpD,MAAMC,IAAsC,GAAG;EAC7C,CAACN,iBAAiB,CAACO,YAAY,GAAG,OAAO;EACzC,CAACP,iBAAiB,CAACQ,UAAU,GAAG,KAAK;EACrC,CAACR,iBAAiB,CAACS,kBAAkB,GAAG,aAAa;EACrD,CAACT,iBAAiB,CAACU,eAAe,GAAG,UAAU;EAC/C,CAACV,iBAAiB,CAACW,YAAY,GAAG;AACpC,CAAC;;AAED;AACA,MAAMC,WAAW,GAAG;EAAEC,iBAAiB,EAAE,EAAE;EAAEC,KAAK,EAAE;AAAG,CAAC;AAExD,MAAMC,kBAA8B,GAAG,CACrC;EACEC,IAAI,EAAEb,cAAc;EACpBc,YAAY,EAAE,CAAC;IAAED,IAAI,EAAEd,qBAAqB;IAAEgB,YAAY,EAAEN;EAAY,CAAC;AAC3E,CAAC,CACF;;AAED;AACA,MAAMO,iBAAiB,SAASlB,eAAe,CAAe;EAClDmB,YAAY,GAAGL,kBAAkB;EACjCM,gBAAgB,GAAG,MAAM;EACzBC,aAAa,GAAGC,SAAS;EAE5BC,WAAWA,CAACC,MAAc,EAAEC,MAAwC,EAAE;IAC3E,KAAK,CAACD,MAAM,EAAEC,MAAM,CAAC;IACrB,IAAI,CAACC,WAAW,GAAG,IAAIvB,iBAAiB,CAAC,CAAC;IAC1C,IAAI,CAACwB,sBAAsB,GAAG,MAC5B,IAAIvB,eAAe,CAAC;MAClBwB,IAAI,EAAEvB,IAAI,CAACoB,MAAM,CAACI,UAAU,CAAC;MAC7BC,QAAQ,EAAGC,MAAM,IACf,IAAI,CAACD,QAAQ,GACXC,MAGF;IACJ,CAAC,CAAC;EACN;EAEUC,mBAAmBA,CAAA,EAAS;IACpC;EACF;AACF;AAEA,SAASd,iBAAiB,IAAIe,YAAY","ignoreList":[]}
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+
3
+ /* eslint-disable import/group-exports */
4
+
5
+ import { FrameReadStatus } from "../../../types/frame-read-status.js";
6
+ import { hexToByte } from "../../../utils/hex-to-byte.js";
7
+
8
+ /**
9
+ * TaiDoc's "0x51" command protocol, shared by its glucose meters, blood-pressure monitors,
10
+ * thermometers, pulse oximeters and scales. Layouts are from MedM Health Diary 3.12.11's
11
+ * `CTaiDocCommandDevice` and its per-driver subclasses.
12
+ *
13
+ * A frame is `51 cmd d0 d1 d2 d3 end cs`: `end` is A3 from the app and A5 from the device, and
14
+ * `cs` is the 8-bit sum of every byte before it. The scale's record and set-user frames are
15
+ * variable, `51 cmd LL data[LL] end cs`. One characteristic is both written and notified, so
16
+ * the device echoes every command back; an A3-terminated frame is that echo.
17
+ */
18
+ export const TAIDOC_SERVICE = "00001523-1212-efde-1523-785feabcd123";
19
+ export const TAIDOC_CHARACTERISTIC = "00001524-1212-efde-1523-785feabcd123";
20
+ export const TAIDOC = {
21
+ wakeUp: 0x22,
22
+ deviceTime: 0x23,
23
+ model: 0x24,
24
+ readingTime: 0x25,
25
+ readingResult: 0x26,
26
+ serial1: 0x27,
27
+ serial2: 0x28,
28
+ oximeterAfterTime: 0x29,
29
+ readingCount: 0x2b,
30
+ setTime: 0x33,
31
+ shutdown: 0x50,
32
+ wakeNotice: 0x54,
33
+ weightRecord: 0x71,
34
+ setUser: 0x72,
35
+ busy: 0xe0
36
+ };
37
+ const START = 0x51;
38
+ const HOST_END = 0xa3;
39
+ const DEVICE_END = 0xa5;
40
+ const FIXED_FRAME_BYTES = 8;
41
+ const VARIABLE_COMMANDS = [TAIDOC.weightRecord, TAIDOC.setUser];
42
+ const toHex = bytes => bytes.map(value => (value & 0xff).toString(16).padStart(2, "0"));
43
+ const byteAt = (frame, index) => hexToByte(frame[index] ?? "00");
44
+ const sum = bytes => bytes.reduce((total, value) => total + value, 0) & 0xff;
45
+ const withChecksum = bytes => toHex([...bytes, sum(bytes)]);
46
+ export const commandOf = frame => byteAt(frame, 1);
47
+
48
+ /** `51 cmd a b c d A3 cs`. */
49
+ export const taidocCommand = (command, a = 0, b = 0, c = 0, d = 0) => withChecksum([START, command, a, b, c, d, HOST_END]);
50
+ export const readingCountCommand = user => taidocCommand(TAIDOC.readingCount, user);
51
+ export const readingCommand = (command, index, user) => taidocCommand(command, index & 0xff, index >> 8 & 0xff, 0, user);
52
+
53
+ /** `date16 = yy << 9 | month << 5 | day`, then minute and hour; the meter keeps local time. */
54
+ export const setTimeCommand = now => {
55
+ const date = now.getFullYear() % 100 << 9 | now.getMonth() + 1 << 5 | now.getDate();
56
+ return taidocCommand(TAIDOC.setTime, date & 0xff, date >> 8, now.getMinutes(), now.getHours());
57
+ };
58
+
59
+ /** The scale's record request, `51 71 02 idxLo idxHi A3 cs`. */
60
+ export const weightRecordCommand = index => withChecksum([START, TAIDOC.weightRecord, 2, index & 0xff, index >> 8 & 0xff, HOST_END]);
61
+
62
+ /** The app's own command, echoed back on the shared characteristic. */
63
+ export const isHostFrame = frame => byteAt(frame, frame.length - 2) === HOST_END;
64
+
65
+ /** Isolates 0x51 frames whatever the notification boundaries, skipping noise to the next start. */
66
+ export class TaidocFrameReader {
67
+ readFrame(buffer) {
68
+ const start = buffer.findIndex(byte => hexToByte(byte) === START);
69
+ if (start === -1) {
70
+ return {
71
+ status: FrameReadStatus.INCOMPLETE,
72
+ consumedBytes: buffer.length
73
+ };
74
+ }
75
+ if (start + 3 > buffer.length) {
76
+ return {
77
+ status: FrameReadStatus.INCOMPLETE,
78
+ consumedBytes: start
79
+ };
80
+ }
81
+ const length = VARIABLE_COMMANDS.includes(byteAt(buffer, start + 1)) ? byteAt(buffer, start + 2) + 5 : FIXED_FRAME_BYTES;
82
+ if (start + length > buffer.length) {
83
+ return {
84
+ status: FrameReadStatus.INCOMPLETE,
85
+ consumedBytes: start
86
+ };
87
+ }
88
+ const received = buffer.slice(start, start + length);
89
+ const bytes = received.map(byte => hexToByte(byte));
90
+ const end = bytes[length - 2];
91
+ if (end !== HOST_END && end !== DEVICE_END || sum(bytes.slice(0, -1)) !== bytes[length - 1]) {
92
+ return {
93
+ status: FrameReadStatus.CORRUPT,
94
+ consumedBytes: start + 1
95
+ };
96
+ }
97
+ return {
98
+ status: FrameReadStatus.COMPLETE,
99
+ consumedBytes: start + length,
100
+ frame: received
101
+ };
102
+ }
103
+ }
104
+
105
+ /**
106
+ * Device users by the project code of the 0x24 answer (`d0 | d1 << 8`), from
107
+ * `CTaiDocBTM::OnProjectCode`. Any other code is a single-user meter.
108
+ */
109
+ const MULTI_USER_CODES = new Set([0x3128, 0x3132, 0x3252, 0x3261]);
110
+ export const usersFor = model => MULTI_USER_CODES.has(byteAt(model, 2) | byteAt(model, 3) << 8) ? 4 : 1;
111
+
112
+ /** The 0x2B answer: the current user's record count, little-endian. */
113
+ export const readCount = frame => byteAt(frame, 2) | byteAt(frame, 3) << 8;
114
+ //# sourceMappingURL=taidoc.protocol.js.map