@ovok/native 1.4.0 → 1.5.0

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 (202) hide show
  1. package/lib/commonjs/modules/bt-device/constants/device-instruction-pdfs.js +2 -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-assets.js +3 -1
  4. package/lib/commonjs/modules/bt-device/constants/supported-device-catalog-assets.js.map +1 -1
  5. package/lib/commonjs/modules/bt-device/constants/supported-devices.js +15 -1
  6. package/lib/commonjs/modules/bt-device/constants/supported-devices.js.map +1 -1
  7. package/lib/commonjs/modules/bt-management/constants/integrated-devices-map.js +1 -1
  8. package/lib/commonjs/modules/bt-management/constants/integrated-devices-map.js.map +1 -1
  9. package/lib/commonjs/modules/bt-management/services/custom/compile-custom-case.js +2 -0
  10. package/lib/commonjs/modules/bt-management/services/custom/compile-custom-case.js.map +1 -1
  11. package/lib/commonjs/modules/bt-management/services/custom/compile-custom-field.js +2 -1
  12. package/lib/commonjs/modules/bt-management/services/custom/compile-custom-field.js.map +1 -1
  13. package/lib/commonjs/modules/bt-management/services/custom/compile-custom-lepu.js +24 -0
  14. package/lib/commonjs/modules/bt-management/services/custom/compile-custom-lepu.js.map +1 -1
  15. package/lib/commonjs/modules/bt-management/services/custom/compile-custom-monitor.js +8 -1
  16. package/lib/commonjs/modules/bt-management/services/custom/compile-custom-monitor.js.map +1 -1
  17. package/lib/commonjs/modules/bt-management/services/device-creator.js +4 -0
  18. package/lib/commonjs/modules/bt-management/services/device-creator.js.map +1 -1
  19. package/lib/commonjs/modules/bt-management/services/devices/bt-connection-handler.js +6 -2
  20. package/lib/commonjs/modules/bt-management/services/devices/bt-connection-handler.js.map +1 -1
  21. package/lib/commonjs/modules/bt-management/services/devices/bt-data-processor.js +5 -0
  22. package/lib/commonjs/modules/bt-management/services/devices/bt-data-processor.js.map +1 -1
  23. package/lib/commonjs/modules/bt-management/services/devices/bt-managed-device.js +3 -1
  24. package/lib/commonjs/modules/bt-management/services/devices/bt-managed-device.js.map +1 -1
  25. package/lib/commonjs/modules/bt-management/services/devices/custom/custom-lepu-sequencer.js +6 -1
  26. package/lib/commonjs/modules/bt-management/services/devices/custom/custom-lepu-sequencer.js.map +1 -1
  27. package/lib/commonjs/modules/bt-management/services/devices/custom/custom.device.js +6 -1
  28. package/lib/commonjs/modules/bt-management/services/devices/custom/custom.device.js.map +1 -1
  29. package/lib/commonjs/modules/bt-management/services/devices/frame-parser.js +13 -1
  30. package/lib/commonjs/modules/bt-management/services/devices/frame-parser.js.map +1 -1
  31. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.command-builder.js +6 -3
  32. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.command-builder.js.map +1 -1
  33. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.identity-gate.js +84 -38
  34. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.identity-gate.js.map +1 -1
  35. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.transports.js +10 -1
  36. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.transports.js.map +1 -1
  37. package/lib/commonjs/modules/bt-management/services/devices/spo/oxyfit.device.js +18 -0
  38. package/lib/commonjs/modules/bt-management/services/devices/spo/oxyfit.device.js.map +1 -0
  39. package/lib/commonjs/modules/bt-management/services/devices/uebe/mysense.device.js +78 -0
  40. package/lib/commonjs/modules/bt-management/services/devices/uebe/mysense.device.js.map +1 -0
  41. package/lib/commonjs/modules/bt-management/services/devices/uebe/mysense.frame-reader.js +83 -0
  42. package/lib/commonjs/modules/bt-management/services/devices/uebe/mysense.frame-reader.js.map +1 -0
  43. package/lib/commonjs/modules/bt-management/services/devices/uebe/mysense.sequencer.js +60 -0
  44. package/lib/commonjs/modules/bt-management/services/devices/uebe/mysense.sequencer.js.map +1 -0
  45. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.oximeters.js +54 -39
  46. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.oximeters.js.map +1 -1
  47. package/lib/commonjs/modules/bt-management/types/integrated-devices.js +1 -0
  48. package/lib/commonjs/modules/bt-management/types/integrated-devices.js.map +1 -1
  49. package/lib/commonjs/modules/bt-management/utils/create-custom-field-parser.js +3 -0
  50. package/lib/commonjs/modules/bt-management/utils/create-custom-field-parser.js.map +1 -1
  51. package/lib/module/modules/bt-device/constants/device-instruction-pdfs.js +2 -1
  52. package/lib/module/modules/bt-device/constants/device-instruction-pdfs.js.map +1 -1
  53. package/lib/module/modules/bt-device/constants/supported-device-catalog-assets.js +3 -1
  54. package/lib/module/modules/bt-device/constants/supported-device-catalog-assets.js.map +1 -1
  55. package/lib/module/modules/bt-device/constants/supported-devices.js +16 -2
  56. package/lib/module/modules/bt-device/constants/supported-devices.js.map +1 -1
  57. package/lib/module/modules/bt-management/constants/integrated-devices-map.js +1 -1
  58. package/lib/module/modules/bt-management/constants/integrated-devices-map.js.map +1 -1
  59. package/lib/module/modules/bt-management/services/custom/compile-custom-case.js +2 -0
  60. package/lib/module/modules/bt-management/services/custom/compile-custom-case.js.map +1 -1
  61. package/lib/module/modules/bt-management/services/custom/compile-custom-field.js +2 -1
  62. package/lib/module/modules/bt-management/services/custom/compile-custom-field.js.map +1 -1
  63. package/lib/module/modules/bt-management/services/custom/compile-custom-lepu.js +24 -0
  64. package/lib/module/modules/bt-management/services/custom/compile-custom-lepu.js.map +1 -1
  65. package/lib/module/modules/bt-management/services/custom/compile-custom-monitor.js +8 -1
  66. package/lib/module/modules/bt-management/services/custom/compile-custom-monitor.js.map +1 -1
  67. package/lib/module/modules/bt-management/services/device-creator.js +4 -0
  68. package/lib/module/modules/bt-management/services/device-creator.js.map +1 -1
  69. package/lib/module/modules/bt-management/services/devices/bt-connection-handler.js +6 -2
  70. package/lib/module/modules/bt-management/services/devices/bt-connection-handler.js.map +1 -1
  71. package/lib/module/modules/bt-management/services/devices/bt-data-processor.js +5 -0
  72. package/lib/module/modules/bt-management/services/devices/bt-data-processor.js.map +1 -1
  73. package/lib/module/modules/bt-management/services/devices/bt-managed-device.js +3 -1
  74. package/lib/module/modules/bt-management/services/devices/bt-managed-device.js.map +1 -1
  75. package/lib/module/modules/bt-management/services/devices/custom/custom-lepu-sequencer.js +6 -1
  76. package/lib/module/modules/bt-management/services/devices/custom/custom-lepu-sequencer.js.map +1 -1
  77. package/lib/module/modules/bt-management/services/devices/custom/custom.device.js +6 -1
  78. package/lib/module/modules/bt-management/services/devices/custom/custom.device.js.map +1 -1
  79. package/lib/module/modules/bt-management/services/devices/frame-parser.js +13 -1
  80. package/lib/module/modules/bt-management/services/devices/frame-parser.js.map +1 -1
  81. package/lib/module/modules/bt-management/services/devices/lepu/lepu.command-builder.js +6 -3
  82. package/lib/module/modules/bt-management/services/devices/lepu/lepu.command-builder.js.map +1 -1
  83. package/lib/module/modules/bt-management/services/devices/lepu/lepu.identity-gate.js +84 -38
  84. package/lib/module/modules/bt-management/services/devices/lepu/lepu.identity-gate.js.map +1 -1
  85. package/lib/module/modules/bt-management/services/devices/lepu/lepu.transports.js +10 -1
  86. package/lib/module/modules/bt-management/services/devices/lepu/lepu.transports.js.map +1 -1
  87. package/lib/module/modules/bt-management/services/devices/spo/oxyfit.device.js +14 -0
  88. package/lib/module/modules/bt-management/services/devices/spo/oxyfit.device.js.map +1 -0
  89. package/lib/module/modules/bt-management/services/devices/uebe/mysense.device.js +73 -0
  90. package/lib/module/modules/bt-management/services/devices/uebe/mysense.device.js.map +1 -0
  91. package/lib/module/modules/bt-management/services/devices/uebe/mysense.frame-reader.js +78 -0
  92. package/lib/module/modules/bt-management/services/devices/uebe/mysense.frame-reader.js.map +1 -0
  93. package/lib/module/modules/bt-management/services/devices/uebe/mysense.sequencer.js +55 -0
  94. package/lib/module/modules/bt-management/services/devices/uebe/mysense.sequencer.js.map +1 -0
  95. package/lib/module/modules/bt-management/services/devices/viatom/viatom.oximeters.js +54 -39
  96. package/lib/module/modules/bt-management/services/devices/viatom/viatom.oximeters.js.map +1 -1
  97. package/lib/module/modules/bt-management/types/device-measurement-map.js.map +1 -1
  98. package/lib/module/modules/bt-management/types/integrated-devices.js +1 -0
  99. package/lib/module/modules/bt-management/types/integrated-devices.js.map +1 -1
  100. package/lib/module/modules/bt-management/utils/create-custom-field-parser.js +3 -0
  101. package/lib/module/modules/bt-management/utils/create-custom-field-parser.js.map +1 -1
  102. package/lib/typescript/commonjs/src/modules/bt-device/constants/device-instruction-pdfs.d.ts.map +1 -1
  103. package/lib/typescript/commonjs/src/modules/bt-device/constants/supported-device-catalog-assets.d.ts +3 -1
  104. package/lib/typescript/commonjs/src/modules/bt-device/constants/supported-device-catalog-assets.d.ts.map +1 -1
  105. package/lib/typescript/commonjs/src/modules/bt-device/constants/supported-devices.d.ts +7 -0
  106. package/lib/typescript/commonjs/src/modules/bt-device/constants/supported-devices.d.ts.map +1 -1
  107. package/lib/typescript/commonjs/src/modules/bt-management/constants/integrated-devices-map.d.ts.map +1 -1
  108. package/lib/typescript/commonjs/src/modules/bt-management/services/custom/compile-custom-case.d.ts.map +1 -1
  109. package/lib/typescript/commonjs/src/modules/bt-management/services/custom/compile-custom-field.d.ts.map +1 -1
  110. package/lib/typescript/commonjs/src/modules/bt-management/services/custom/compile-custom-lepu.d.ts.map +1 -1
  111. package/lib/typescript/commonjs/src/modules/bt-management/services/custom/compile-custom-monitor.d.ts.map +1 -1
  112. package/lib/typescript/commonjs/src/modules/bt-management/services/device-creator.d.ts.map +1 -1
  113. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-connection-handler.d.ts +4 -0
  114. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-connection-handler.d.ts.map +1 -1
  115. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-data-processor.d.ts +2 -0
  116. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-data-processor.d.ts.map +1 -1
  117. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-managed-device.d.ts.map +1 -1
  118. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/custom/custom-lepu-sequencer.d.ts.map +1 -1
  119. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/custom/custom.device.d.ts +2 -0
  120. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/custom/custom.device.d.ts.map +1 -1
  121. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/frame-parser.d.ts +1 -0
  122. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/frame-parser.d.ts.map +1 -1
  123. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.command-builder.d.ts +6 -1
  124. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.command-builder.d.ts.map +1 -1
  125. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.identity-gate.d.ts +10 -51
  126. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.identity-gate.d.ts.map +1 -1
  127. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.transports.d.ts +6 -0
  128. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.transports.d.ts.map +1 -1
  129. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/spo/oxyfit.device.d.ts +9 -0
  130. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/spo/oxyfit.device.d.ts.map +1 -0
  131. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/uebe/mysense.device.d.ts +15 -0
  132. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/uebe/mysense.device.d.ts.map +1 -0
  133. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/uebe/mysense.frame-reader.d.ts +8 -0
  134. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/uebe/mysense.frame-reader.d.ts.map +1 -0
  135. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/uebe/mysense.sequencer.d.ts +17 -0
  136. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/uebe/mysense.sequencer.d.ts.map +1 -0
  137. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.oximeters.d.ts +4 -7
  138. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.oximeters.d.ts.map +1 -1
  139. package/lib/typescript/commonjs/src/modules/bt-management/types/command-sequencer.d.ts +2 -0
  140. package/lib/typescript/commonjs/src/modules/bt-management/types/command-sequencer.d.ts.map +1 -1
  141. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-field-encoding.d.ts +2 -1
  142. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-field-encoding.d.ts.map +1 -1
  143. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-lepu-spec.d.ts +8 -0
  144. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-lepu-spec.d.ts.map +1 -1
  145. package/lib/typescript/commonjs/src/modules/bt-management/types/device-measurement-map.d.ts +1 -0
  146. package/lib/typescript/commonjs/src/modules/bt-management/types/device-measurement-map.d.ts.map +1 -1
  147. package/lib/typescript/commonjs/src/modules/bt-management/types/integrated-devices.d.ts +1 -0
  148. package/lib/typescript/commonjs/src/modules/bt-management/types/integrated-devices.d.ts.map +1 -1
  149. package/lib/typescript/commonjs/src/modules/bt-management/types/parsing-case.d.ts +1 -0
  150. package/lib/typescript/commonjs/src/modules/bt-management/types/parsing-case.d.ts.map +1 -1
  151. package/lib/typescript/commonjs/src/modules/bt-management/utils/create-custom-field-parser.d.ts.map +1 -1
  152. package/lib/typescript/module/src/modules/bt-device/constants/device-instruction-pdfs.d.ts.map +1 -1
  153. package/lib/typescript/module/src/modules/bt-device/constants/supported-device-catalog-assets.d.ts +3 -1
  154. package/lib/typescript/module/src/modules/bt-device/constants/supported-device-catalog-assets.d.ts.map +1 -1
  155. package/lib/typescript/module/src/modules/bt-device/constants/supported-devices.d.ts +7 -0
  156. package/lib/typescript/module/src/modules/bt-device/constants/supported-devices.d.ts.map +1 -1
  157. package/lib/typescript/module/src/modules/bt-management/constants/integrated-devices-map.d.ts.map +1 -1
  158. package/lib/typescript/module/src/modules/bt-management/services/custom/compile-custom-case.d.ts.map +1 -1
  159. package/lib/typescript/module/src/modules/bt-management/services/custom/compile-custom-field.d.ts.map +1 -1
  160. package/lib/typescript/module/src/modules/bt-management/services/custom/compile-custom-lepu.d.ts.map +1 -1
  161. package/lib/typescript/module/src/modules/bt-management/services/custom/compile-custom-monitor.d.ts.map +1 -1
  162. package/lib/typescript/module/src/modules/bt-management/services/device-creator.d.ts.map +1 -1
  163. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-connection-handler.d.ts +4 -0
  164. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-connection-handler.d.ts.map +1 -1
  165. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-data-processor.d.ts +2 -0
  166. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-data-processor.d.ts.map +1 -1
  167. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-managed-device.d.ts.map +1 -1
  168. package/lib/typescript/module/src/modules/bt-management/services/devices/custom/custom-lepu-sequencer.d.ts.map +1 -1
  169. package/lib/typescript/module/src/modules/bt-management/services/devices/custom/custom.device.d.ts +2 -0
  170. package/lib/typescript/module/src/modules/bt-management/services/devices/custom/custom.device.d.ts.map +1 -1
  171. package/lib/typescript/module/src/modules/bt-management/services/devices/frame-parser.d.ts +1 -0
  172. package/lib/typescript/module/src/modules/bt-management/services/devices/frame-parser.d.ts.map +1 -1
  173. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.command-builder.d.ts +6 -1
  174. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.command-builder.d.ts.map +1 -1
  175. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.identity-gate.d.ts +10 -51
  176. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.identity-gate.d.ts.map +1 -1
  177. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.transports.d.ts +6 -0
  178. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.transports.d.ts.map +1 -1
  179. package/lib/typescript/module/src/modules/bt-management/services/devices/spo/oxyfit.device.d.ts +9 -0
  180. package/lib/typescript/module/src/modules/bt-management/services/devices/spo/oxyfit.device.d.ts.map +1 -0
  181. package/lib/typescript/module/src/modules/bt-management/services/devices/uebe/mysense.device.d.ts +15 -0
  182. package/lib/typescript/module/src/modules/bt-management/services/devices/uebe/mysense.device.d.ts.map +1 -0
  183. package/lib/typescript/module/src/modules/bt-management/services/devices/uebe/mysense.frame-reader.d.ts +8 -0
  184. package/lib/typescript/module/src/modules/bt-management/services/devices/uebe/mysense.frame-reader.d.ts.map +1 -0
  185. package/lib/typescript/module/src/modules/bt-management/services/devices/uebe/mysense.sequencer.d.ts +17 -0
  186. package/lib/typescript/module/src/modules/bt-management/services/devices/uebe/mysense.sequencer.d.ts.map +1 -0
  187. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.oximeters.d.ts +4 -7
  188. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.oximeters.d.ts.map +1 -1
  189. package/lib/typescript/module/src/modules/bt-management/types/command-sequencer.d.ts +2 -0
  190. package/lib/typescript/module/src/modules/bt-management/types/command-sequencer.d.ts.map +1 -1
  191. package/lib/typescript/module/src/modules/bt-management/types/custom-field-encoding.d.ts +2 -1
  192. package/lib/typescript/module/src/modules/bt-management/types/custom-field-encoding.d.ts.map +1 -1
  193. package/lib/typescript/module/src/modules/bt-management/types/custom-lepu-spec.d.ts +8 -0
  194. package/lib/typescript/module/src/modules/bt-management/types/custom-lepu-spec.d.ts.map +1 -1
  195. package/lib/typescript/module/src/modules/bt-management/types/device-measurement-map.d.ts +1 -0
  196. package/lib/typescript/module/src/modules/bt-management/types/device-measurement-map.d.ts.map +1 -1
  197. package/lib/typescript/module/src/modules/bt-management/types/integrated-devices.d.ts +1 -0
  198. package/lib/typescript/module/src/modules/bt-management/types/integrated-devices.d.ts.map +1 -1
  199. package/lib/typescript/module/src/modules/bt-management/types/parsing-case.d.ts +1 -0
  200. package/lib/typescript/module/src/modules/bt-management/types/parsing-case.d.ts.map +1 -1
  201. package/lib/typescript/module/src/modules/bt-management/utils/create-custom-field-parser.d.ts.map +1 -1
  202. package/package.json +1 -1
@@ -5,40 +5,28 @@ import { LepuCommand } from "./lepu.commands.js";
5
5
  import { parseLepuDeviceInfo } from "./lepu.device-info.js";
6
6
  import { describeLepuResponseType, isLepuSuccess } from "./lepu.response-type.js";
7
7
  const COMMAND_INDEX = 1;
8
+ const VIATOM_OXYGEN_INFO = 0x14;
8
9
 
9
- /**
10
- * Asks a Lepu device what it is before sending it anything that acts.
11
- *
12
- * The family shares one frame format, one checksum and one opcode space, but not one
13
- * meaning: `0x08` polls realtime data on a BP2, starts a blood-pressure measurement on an
14
- * AirBp and starts an ECG on a Lepod. A frame built for the wrong device is therefore
15
- * perfectly well-formed - the CRC is computed the same way on every one of them - so
16
- * nothing in the protocol catches a driver bound to the wrong hardware. What comes back is
17
- * a cuff inflating on someone's arm because a name matched during a scan.
18
- *
19
- * `GET_INFO` is the one command that cannot cause that: it is generic, inert, and answered
20
- * identically family-wide. So it goes first, and everything else waits on its reply.
21
- *
22
- * A declaration that names the models it was written for is refused permanently when the
23
- * device answers with a different one. A declaration that names none is identified by the
24
- * advertised name it already matched, which is the basis the vendor's own SDK binds every
25
- * one of its products on; it is asked what it is anyway, and the answer reported, because
26
- * that is the only place these model numbers exist - the vendor never reads the field back,
27
- * so there is no table of them to copy.
28
- *
29
- * A reply that never arrives leaves the gate closed and nothing sent, which the data
30
- * processor's stuck-data timeout reports and disconnects on. That is the watchdog for this
31
- * too - the protocol has no retry of its own, so a dropped reply is recovered by
32
- * reconnecting rather than by asking again.
33
- */
10
+ /** Identifies a device before sending it a model-specific command. */
34
11
  export class LepuIdentityGate {
35
12
  isIdentified = false;
36
13
  isRefused = false;
37
14
  constructor(params) {
38
15
  this.params = params;
39
16
  }
40
- initialCommands = () => [this.commandFor(LepuCommand.GET_INFO)];
17
+ initialCommands = () => {
18
+ if (this.params.protocol === "viatom-oxygen") {
19
+ const command = this.params.setClockBeforeInfo ? this.commandFor(0x16, oxyClockPayload()) : this.commandFor(VIATOM_OXYGEN_INFO);
20
+ this.pendingCommand = this.params.setClockBeforeInfo ? 0x16 : VIATOM_OXYGEN_INFO;
21
+ return [command];
22
+ }
23
+ this.pendingCommand = LepuCommand.GET_INFO;
24
+ return [this.commandFor(LepuCommand.GET_INFO)];
25
+ };
41
26
  nextCommand = frame => {
27
+ if (this.params.protocol === "viatom-oxygen") {
28
+ return this.nextViatomOxygenCommand(frame);
29
+ }
42
30
  if (this.isRefused) {
43
31
  return undefined;
44
32
  }
@@ -48,16 +36,7 @@ export class LepuIdentityGate {
48
36
  return this.admit(frame);
49
37
  };
50
38
 
51
- /**
52
- * Decides on the reply to `GET_INFO`.
53
- *
54
- * A frame that is not that reply leaves the gate as it was rather than provoking another
55
- * command, because the only command outstanding is the one still being waited on.
56
- *
57
- * A reply that is that command but carries an error type is refused rather than parsed.
58
- * The payload of an error is the reason for it, so reading a model number out of it would
59
- * identify the hardware from an error code.
60
- */
39
+ /** Decides on the reply to the generic `GET_INFO` command. */
61
40
  admit = frame => {
62
41
  if (hexToByte(frame[COMMAND_INDEX] ?? "0") !== LepuCommand.GET_INFO) {
63
42
  return undefined;
@@ -90,9 +69,76 @@ export class LepuIdentityGate {
90
69
 
91
70
  /** Nothing, for a declaration that asks what the device is and stops there. */
92
71
  poll = () => this.params.pollCommand === undefined ? undefined : [this.commandFor(this.params.pollCommand)];
93
- commandFor = command => ({
72
+ commandFor = (command, payload = [], delayBeforeWriteMs) => ({
94
73
  ...this.params.write,
95
- frame: this.params.builder.build(command)
74
+ frame: this.params.builder.build(command, payload),
75
+ ...(this.params.writeWithoutResponse ? {
76
+ withoutResponse: true
77
+ } : {}),
78
+ ...(delayBeforeWriteMs === undefined ? {} : {
79
+ delayBeforeWriteMs
80
+ })
96
81
  });
82
+ nextViatomOxygenCommand = frame => {
83
+ if (this.isRefused || this.pendingCommand === undefined) {
84
+ return undefined;
85
+ }
86
+ const status = hexToByte(frame[1] ?? "ff");
87
+ if (status !== 0) {
88
+ if (this.pendingCommand === 0x17 && this.isIdentified) {
89
+ return [this.commandFor(0x17, [], 3_000)];
90
+ }
91
+ return this.refuse(`the device rejected command 0x${this.pendingCommand.toString(16).padStart(2, "0")} with status 0x${status.toString(16).padStart(2, "0")}`);
92
+ }
93
+ switch (this.pendingCommand) {
94
+ case 0x16:
95
+ this.pendingCommand = VIATOM_OXYGEN_INFO;
96
+ return [this.commandFor(VIATOM_OXYGEN_INFO)];
97
+ case VIATOM_OXYGEN_INFO:
98
+ {
99
+ const info = parseViatomOxygenDeviceInfo(frame);
100
+ if (!info) {
101
+ return this.refuse("the device answered INFO without a JSON model number");
102
+ }
103
+ this.params.onIdentified?.(info);
104
+ if (this.params.expectedDeviceTypes.length > 0 && !this.params.expectedDeviceTypes.includes(info.deviceType)) {
105
+ return this.refuse(`the hardware reported model ${info.deviceType}, which this declaration was not written for`);
106
+ }
107
+ this.isIdentified = true;
108
+ this.pendingCommand = 0x17;
109
+ return [this.commandFor(0x17, [], 1_000)];
110
+ }
111
+ case 0x17:
112
+ return [this.commandFor(0x17, [], 1_000)];
113
+ default:
114
+ return undefined;
115
+ }
116
+ };
97
117
  }
118
+ const oxyClockPayload = () => {
119
+ const now = new Date();
120
+ const pad = value => String(value).padStart(2, "0");
121
+ const payload = JSON.stringify({
122
+ SetTIME: `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())},${pad(now.getHours())}:${pad(now.getMinutes())}:${pad(now.getSeconds())}`
123
+ });
124
+ return Array.from(new TextEncoder().encode(payload));
125
+ };
126
+ const parseViatomOxygenDeviceInfo = frame => {
127
+ try {
128
+ const text = frame.slice(7, -1).map(byte => String.fromCharCode(hexToByte(byte))).join("").replace(/\0+$/, "");
129
+ const info = JSON.parse(text);
130
+ const deviceType = Number(info.Model);
131
+ if (!Number.isInteger(deviceType)) {
132
+ return undefined;
133
+ }
134
+ return {
135
+ deviceType,
136
+ protocolMaxLength: 0,
137
+ branchCode: String(info.Branch ?? ""),
138
+ serialNumber: String(info.SN ?? info.SerialNumber ?? "")
139
+ };
140
+ } catch {
141
+ return undefined;
142
+ }
143
+ };
98
144
  //# sourceMappingURL=lepu.identity-gate.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["hexToByte","LepuCommand","parseLepuDeviceInfo","describeLepuResponseType","isLepuSuccess","COMMAND_INDEX","LepuIdentityGate","isIdentified","isRefused","constructor","params","initialCommands","commandFor","GET_INFO","nextCommand","frame","undefined","poll","admit","refuse","info","onIdentified","pollCommand","isNarrowed","expectedDeviceTypes","length","includes","deviceType","branchCode","reason","onRefused","command","write","builder","build"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/lepu/lepu.identity-gate.ts"],"mappings":";;AAEA,SAASA,SAAS,QAAQ,+BAA4B;AAGtD,SAASC,WAAW,QAAQ,oBAAiB;AAC7C,SAAyBC,mBAAmB,QAAQ,uBAAoB;AACxE,SACEC,wBAAwB,EACxBC,aAAa,QACR,yBAAsB;AAmC7B,MAAMC,aAAa,GAAG,CAAC;;AAEvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,CAA6B;EAChDC,YAAY,GAAG,KAAK;EACpBC,SAAS,GAAG,KAAK;EAElBC,WAAWA,CAAkBC,MAA8B,EAAE;IAAA,KAAhCA,MAA8B,GAA9BA,MAA8B;EAAG;EAE9DC,eAAe,GAAGA,CAAA,KAAgC,CACvD,IAAI,CAACC,UAAU,CAACX,WAAW,CAACY,QAAQ,CAAC,CACtC;EAEMC,WAAW,GAChBC,KAAwB,IACiB;IACzC,IAAI,IAAI,CAACP,SAAS,EAAE;MAClB,OAAOQ,SAAS;IAClB;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S,GAAG,IAAI;IACrB,IAAI,CAACE,MAAM,CAACoB,SAAS,CAACD,MAAM,CAAC;IAE7B,OAAOb,SAAS;EAClB,CAAC;;EAED;EACQC,IAAI,GAAGA,CAAA,KACb,IAAI,CAACP,MAAM,CAACY,WAAW,KAAKN,SAAS,GACjCA,SAAS,GACT,CAAC,IAAI,CAACJ,UAAU,CAAC,IAAI,CAACF,MAAM,CAACY,WAAW,CAAC,CAAC;EAExCV,UAAU,GAAImB,OAAe,KAAqB;IACxD,GAAG,IAAI,CAACrB,MAAM,CAACsB,KAAK;IACpBjB,KAAK,EAAE,IAAI,CAACL,MAAM,CAACuB,OAAO,CAACC,KAAK,CAACH,OAAO;EAC1C,CAAC,CAAC;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["hexToByte","LepuCommand","parseLepuDeviceInfo","describeLepuResponseType","isLepuSuccess","COMMAND_INDEX","VIATOM_OXYGEN_INFO","LepuIdentityGate","isIdentified","isRefused","constructor","params","initialCommands","protocol","command","setClockBeforeInfo","commandFor","oxyClockPayload","pendingCommand","GET_INFO","nextCommand","frame","nextViatomOxygenCommand","undefined","poll","admit","refuse","info","onIdentified","pollCommand","isNarrowed","expectedDeviceTypes","length","includes","deviceType","branchCode","reason","onRefused","payload","delayBeforeWriteMs","write","builder","build","writeWithoutResponse","withoutResponse","status","toString","padStart","parseViatomOxygenDeviceInfo","now","Date","pad","value","String","JSON","stringify","SetTIME","getFullYear","getMonth","getDate","getHours","getMinutes","getSeconds","Array","from","TextEncoder","encode","text","slice","map","byte","fromCharCode","join","replace","parse","Number","Model","isInteger","protocolMaxLength","Branch","serialNumber","SN","SerialNumber"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/lepu/lepu.identity-gate.ts"],"mappings":";;AAEA,SAASA,SAAS,QAAQ,+BAA4B;AAGtD,SAASC,WAAW,QAAQ,oBAAiB;AAC7C,SAAyBC,mBAAmB,QAAQ,uBAAoB;AACxE,SACEC,wBAAwB,EACxBC,aAAa,Q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
  const COMMAND_BYTE = 1;
108
108
  const lepuDevice = params => {
109
109
  const transport = lepuTransports[params.transport ?? "standard"];
110
+ const viatomOxygen = params.protocol === "viatom-oxygen";
110
111
  return defineCustomDevice({
111
112
  id: params.id ?? "lepu-device",
112
113
  nameMatch: params.nameMatch,
113
114
  stuckDataTimeoutMs: params.stuckDataTimeoutMs ?? DEFAULT_STUCK_TIMEOUT_MS,
114
115
  preferredMtu: transport.preferredMtu,
115
116
  lepu: {
116
- startBytes: [START_BYTE],
117
+ protocol: params.protocol,
118
+ startBytes: [viatomOxygen ? "55" : START_BYTE],
119
+ requestStartByte: viatomOxygen ? "aa" : START_BYTE,
117
120
  write: {
118
121
  serviceUuid: transport.serviceUuid,
119
122
  characteristicUuid: transport.writeUuid
@@ -124,6 +127,12 @@ const lepuDevice = params => {
124
127
  }),
125
128
  ...(params.pollCommand === undefined ? {} : {
126
129
  pollCommand: params.pollCommand
130
+ }),
131
+ ...(params.writeWithoutResponse === undefined ? {} : {
132
+ writeWithoutResponse: params.writeWithoutResponse
133
+ }),
134
+ ...(params.setClockBeforeInfo === undefined ? {} : {
135
+ setClockBeforeInfo: params.setClockBeforeInfo
127
136
  })
128
137
  },
129
138
  services: [{
@@ -1 +1 @@
1
- {"version":3,"names":["defineCustomDevice","STANDARD_SERVICE","STANDARD_WRITE","STANDARD_NOTIFY","AW1_SERVICE","AW1_WRITE","AW1_NOTIFY","DING_SERVICE","DING_WRITE","DING_NOTIFY","AI_TELE_SERVICE","AI_TELE_WRITE","AI_TELE_NOTIFY","PREFERRED_MTU","MINIMUM_MTU","DEFAULT_STUCK_TIMEOUT_MS","START_BYTE","lepuTransports","standard","serviceUuid","notifyUuid","writeUuid","preferredMtu","standardSmallMtu","aw1","ding","aiTele","COMMAND_BYTE","lepuDevice","params","transport","id","nameMatch","stuckDataTimeoutMs","lepu","startBytes","write","characteristicUuid","expectedDeviceTypes","fileTransfer","undefined","pollCommand","services","uuid","monitor","frame","minLengthBytes","caseSelectorBytes","cases"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/lepu/lepu.transports.ts"],"mappings":";;AAEA,SAASA,kBAAkB,QAAQ,sCAAmC;;AAEtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,gBAAgB,GAAG,sCAAsC;AAC/D,MAAMC,cAAc,GAAG,sCAAsC;AAC7D,MAAMC,eAAe,GAAG,sCAAsC;;AAE9D;AACA,MAAMC,WAAW,GAAG,sCAAsC;AAC1D,MAAMC,SAAS,GAAG,sCAAsC;AACxD,MAAMC,UAAU,GAAG,sCAAsC;;AAEzD;AACA;AACA;AACA;AACA,MAAMC,YAAY,GAAG,sCAAsC;AAC3D,MAAMC,UAAU,GAAG,sCAAsC;AACzD,MAAMC,WAAW,GAAG,sCAAsC;;AAE1D;AACA,MAAMC,eAAe,GAAG,sCAAsC;AAC9D,MAAMC,aAAa,GAAG,sCAAsC;AAC5D,MAAMC,cAAc,GAAG,sCAAsC;;AAE7D;AACA,MAAMC,aAAa,GAAG,GAAG;;AAEzB;AACA,MAAMC,WAAW,GAAG,EAAE;;AAEtB;AACA,MAAMC,wBAAwB,GAAG,MAAM;AAEvC,MAAMC,UAAU,GAAG,IAAI;AASvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,cAAc,GAAG;EACrBC,QAAQ,EAAE;IACRC,WAAW,EAAElB,gBAAgB;IAC7BmB,UAAU,EAAEjB,eAAe;IAC3BkB,SAAS,EAAEnB,cAAc;IACzBoB,YAAY,EAAET;EAChB,CAAC;EAED;EACAU,gBAAgB,EAAE;IAChBJ,WAAW,EAAElB,gBAAgB;IAC7BmB,UAAU,EAAEjB,eAAe;IAC3BkB,SAAS,EAAEnB,cAAc;IACzBoB,YAAY,EAAER;EAChB,CAAC;EAEDU,GAAG,EAAE;IACHL,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;IACDC,QAAQ,EAAE,CACR;MACEC,IAAI,EAAEb,SAAS,CAACX,WAAW;MAC3ByB,OAAO,EAAE,CACP;QACED,IAAI,EAAEb,SAAS,CAACV,UAAU;QAC1ByB,KAAK,EAAE;UAAEC,cAAc,EAAEjB,MAAM,CAACiB;QAAe,CAAC;QAChDC,iBAAiB,EAAElB,MAAM,CAACkB,iBAAiB,IAAI,CAACpB,YAAY,CAAC;QAC7DqB,KAAK,EAAEnB,MAAM,CAACmB;MAChB,CAAC;IAEL,CAAC;EAEL,CAAC,CAAC;AACJ,CAAC;AAED,SAASpB,UAAU,EAAEX,cAAc","ignoreList":[]}
1
+ {"version":3,"names":["defineCustomDevice","STANDARD_SERVICE","STANDARD_WRITE","STANDARD_NOTIFY","AW1_SERVICE","AW1_WRITE","AW1_NOTIFY","DING_SERVICE","DING_WRITE","DING_NOTIFY","AI_TELE_SERVICE","AI_TELE_WRITE","AI_TELE_NOTIFY","PREFERRED_MTU","MINIMUM_MTU","DEFAULT_STUCK_TIMEOUT_MS","START_BYTE","lepuTransports","standard","serviceUuid","notifyUuid","writeUuid","preferredMtu","standardSmallMtu","aw1","ding","aiTele","COMMAND_BYTE","lepuDevice","params","transport","viatomOxygen","protocol","id","nameMatch","stuckDataTimeoutMs","lepu","startBytes","requestStartByte","write","characteristicUuid","expectedDeviceTypes","fileTransfer","undefined","pollCommand","writeWithoutResponse","setClockBeforeInfo","services","uuid","monitor","frame","minLengthBytes","caseSelectorBytes","cases"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/lepu/lepu.transports.ts"],"mappings":";;AAEA,SAASA,kBAAkB,QAAQ,sCAAmC;;AAEtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,gBAAgB,GAAG,sCAAsC;AAC/D,MAAMC,cAAc,GAAG,sCA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AAM,CAACiB,kBAAkB,KAAKH,SAAS,GACvC,CAAC,CAAC,GACF;QAAEG,kBAAkB,EAAEjB,MAAM,CAACiB;MAAmB,CAAC;IACvD,CAAC;IACDC,QAAQ,EAAE,CACR;MACEC,IAAI,EAAElB,SAAS,CAACX,WAAW;MAC3B8B,OAAO,EAAE,CACP;QACED,IAAI,EAAElB,SAAS,CAACV,UAAU;QAC1B8B,KAAK,EAAE;UAAEC,cAAc,EAAEtB,MAAM,CAACsB;QAAe,CAAC;QAChDC,iBAAiB,EAAEvB,MAAM,CAACuB,iBAAiB,IAAI,CAACzB,YAAY,CAAC;QAC7D0B,KAAK,EAAExB,MAAM,CAACwB;MAChB,CAAC;IAEL,CAAC;EAEL,CAAC,CAAC;AACJ,CAAC;AAED,SAASzB,UAAU,EAAEX,cAAc","ignoreList":[]}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ import { CustomDevice } from "../custom/custom.device.js";
4
+ import { viatomOximeter } from "../viatom/viatom.oximeters.js";
5
+
6
+ /** Keeps the legacy IntegratedDevices.SPO2 entry on the working Viatom protocol. */
7
+ export class OxyfitDevice extends CustomDevice {
8
+ constructor(device, params) {
9
+ super(device, params, viatomOximeter("Oxyfit", {
10
+ id: "integrated-oxyfit"
11
+ }));
12
+ }
13
+ }
14
+ //# sourceMappingURL=oxyfit.device.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["CustomDevice","viatomOximeter","OxyfitDevice","constructor","device","params","id"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/spo/oxyfit.device.ts"],"mappings":";;AAKA,SAASA,YAAY,QAAQ,4BAAyB;AACtD,SAASC,cAAc,QAAQ,+BAA4B;;AAE3D;AACA,OAAO,MAAMC,YAAY,SAASF,YAAY,CAAC;EACtCG,WAAWA,CAChBC,MAAc,EACdC,MAAkD,EAClD;IACA,KAAK,CACHD,MAAM,EACNC,MAAM,EACNJ,cAAc,CAAC,QAAQ,EAAE;MAAEK,EAAE,EAAE;IAAoB,CAAC,CACtD,CAAC;EACH;AACF","ignoreList":[]}
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+
3
+ import { MeasurementTypeKey } from "@ovok/core";
4
+ import { defineCustomDevice } from "../../custom/define-custom-device.js";
5
+ import { CustomDevice } from "../custom/custom.device.js";
6
+ import { MySenseFrameReader } from "./mysense.frame-reader.js";
7
+ import { MySenseSequencer } from "./mysense.sequencer.js";
8
+ const SERVICE = "0000fff0-0000-1000-8000-00805f9b34fb";
9
+ const NOTIFY = "0000fff1-0000-1000-8000-00805f9b34fb";
10
+ const definition = defineCustomDevice({
11
+ id: "cyclotest-mysense",
12
+ nameMatch: "mySense",
13
+ stuckDataTimeoutMs: 30_000,
14
+ services: [{
15
+ uuid: SERVICE,
16
+ monitor: [{
17
+ uuid: NOTIFY,
18
+ frame: {
19
+ minLengthBytes: 17
20
+ },
21
+ caseSelectorBytes: [4],
22
+ cases: [{
23
+ selector: "a1",
24
+ kind: "idle",
25
+ minLengthBytes: 20,
26
+ description: "mySense greeting"
27
+ }, {
28
+ selector: "a3",
29
+ kind: "result",
30
+ minLengthBytes: 17,
31
+ repeatedRecords: {
32
+ recordBytes: 9,
33
+ from: 8
34
+ },
35
+ measurementTypeKey: MeasurementTypeKey.temperature,
36
+ description: "mySense stored temperature history",
37
+ fields: [{
38
+ name: "bodyTemp",
39
+ byteIndexes: [5, 6],
40
+ encoding: "decimal-pair",
41
+ unit: "Cel",
42
+ decimals: 2
43
+ }]
44
+ }]
45
+ }]
46
+ }]
47
+ });
48
+ export class MySenseDevice extends CustomDevice {
49
+ reportedHistory = false;
50
+ constructor(device, params) {
51
+ super(device, params, definition);
52
+ this.frameReader = new MySenseFrameReader();
53
+ this.createCommandSequencer = () => {
54
+ this.reportedHistory = false;
55
+ return new MySenseSequencer({
56
+ onGreeting: frame => {
57
+ this.deviceData.sn = frame.slice(5, 11).join(":");
58
+ }
59
+ });
60
+ };
61
+ }
62
+ shouldReportDependentResult = data => {
63
+ if (data.parsingCase.caseValue !== "a3") {
64
+ return true;
65
+ }
66
+ if (this.reportedHistory) {
67
+ return false;
68
+ }
69
+ this.reportedHistory = true;
70
+ return true;
71
+ };
72
+ }
73
+ //# sourceMappingURL=mysense.device.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["MeasurementTypeKey","defineCustomDevice","CustomDevice","MySenseFrameReader","MySenseSequencer","SERVICE","NOTIFY","definition","id","nameMatch","stuckDataTimeoutMs","services","uuid","monitor","frame","minLengthBytes","caseSelectorBytes","cases","selector","kind","description","repeatedRecords","recordBytes","from","measurementTypeKey","temperature","fields","name","byteIndexes","encoding","unit","decimals","MySenseDevice","reportedHistory","constructor","device","params","frameReader","createCommandSequencer","onGreeting","deviceData","sn","slice","join","shouldReportDependentResult","data","parsingCase","caseValue"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/uebe/mysense.device.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,YAAY;AAQ/C,SAASC,kBAAkB,QAAQ,sCAAmC;AACtE,SAASC,YAAY,QAAQ,4BAAyB;AAEtD,SAASC,kBAAkB,QAAQ,2BAAwB;AAC3D,SAASC,gBAAgB,QAAQ,wBAAqB;AAEtD,MAAMC,OAAO,GAAG,sCAAsC;AACtD,MAAMC,MAAM,GAAG,sCAAsC;AAMrD,MAAMC,UAAU,GAAGN,kBAAkB,CAAC;EACpCO,EAAE,EAAE,mBAAmB;EACvBC,SAAS,EAAE,SAAS;EACpBC,kBAAkB,EAAE,MAAM;EAC1BC,QAAQ,EAAE,CACR;IACEC,IAAI,EAAEP,OAAO;IACbQ,OAAO,EAAE,CACP;MACED,IAAI,EAAEN,MAAM;MACZQ,KAAK,EAAE;QAAEC,cAAc,EAAE;MAAG,CAAC;MAC7BC,iBAAiB,EAAE,CAAC,CAAC,CAAC;MACtBC,KAAK,EAAE,CACL;QACEC,QAAQ,EAAE,IAAI;QACdC,IAAI,EAAE,MAAM;QACZJ,cAAc,EAAE,EAAE;QAClBK,WAAW,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,GAAG,IAAI;IAE3B,OAAO,IAAI;EACb,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+
3
+ import { FrameReadStatus } from "../../../types/frame-read-status.js";
4
+ import { hexToByte } from "../../../utils/hex-to-byte.js";
5
+ const START = "4d";
6
+ const HEADER_BYTES = 4;
7
+ const MAX_FRAME_BYTES = 512;
8
+ const A3 = 0xa3;
9
+ const byteAt = (frame, index) => hexToByte(frame[index] ?? "0");
10
+
11
+ /** Reads mySense frames by their big-endian length, independent of notification boundaries. */
12
+ export class MySenseFrameReader {
13
+ readFrame(buffer) {
14
+ const start = buffer.findIndex(byte => byte.toLowerCase() === START);
15
+ if (start === -1) {
16
+ return {
17
+ status: FrameReadStatus.INCOMPLETE,
18
+ consumedBytes: Math.max(0, buffer.length - 1)
19
+ };
20
+ }
21
+ if (start + HEADER_BYTES > buffer.length) {
22
+ return {
23
+ status: FrameReadStatus.INCOMPLETE,
24
+ consumedBytes: start
25
+ };
26
+ }
27
+ const payloadLength = byteAt(buffer, start + 2) << 8 | byteAt(buffer, start + 3);
28
+ const frameLength = HEADER_BYTES + payloadLength;
29
+ if (payloadLength < 2 || frameLength > MAX_FRAME_BYTES) {
30
+ return {
31
+ status: FrameReadStatus.CORRUPT,
32
+ consumedBytes: start + 1
33
+ };
34
+ }
35
+ if (start + frameLength > buffer.length) {
36
+ return {
37
+ status: FrameReadStatus.INCOMPLETE,
38
+ consumedBytes: start
39
+ };
40
+ }
41
+ const frame = buffer.slice(start, start + frameLength);
42
+ if (!this.isValid(frame)) {
43
+ return {
44
+ status: FrameReadStatus.CORRUPT,
45
+ consumedBytes: start + 1
46
+ };
47
+ }
48
+ return {
49
+ status: FrameReadStatus.COMPLETE,
50
+ consumedBytes: start + frameLength,
51
+ frame
52
+ };
53
+ }
54
+ isValid(frame) {
55
+ const declared = byteAt(frame, frame.length - 1);
56
+ const actual = frame.slice(0, -1).reduce((sum, _, index, bytes) => sum + byteAt(bytes, index) & 0xff, 0);
57
+ if (declared !== actual) {
58
+ return false;
59
+ }
60
+ if (byteAt(frame, 4) !== A3) {
61
+ return true;
62
+ }
63
+ const count = byteAt(frame, 6) << 8 | byteAt(frame, 7);
64
+ const recordsStart = 8;
65
+ if (frame.length !== recordsStart + count * 9 + 1) {
66
+ return false;
67
+ }
68
+ for (let record = 0; record < count; record++) {
69
+ const from = recordsStart + record * 9;
70
+ const recordSum = frame.slice(from, from + 8).reduce((sum, _, index, bytes) => sum + byteAt(bytes, index) & 0xff, 0);
71
+ if (recordSum !== byteAt(frame, from + 8)) {
72
+ return false;
73
+ }
74
+ }
75
+ return true;
76
+ }
77
+ }
78
+ //# sourceMappingURL=mysense.frame-reader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["FrameReadStatus","hexToByte","START","HEADER_BYTES","MAX_FRAME_BYTES","A3","byteAt","frame","index","MySenseFrameReader","readFrame","buffer","start","findIndex","byte","toLowerCase","status","INCOMPLETE","consumedBytes","Math","max","length","payloadLength","frameLength","CORRUPT","slice","isValid","COMPLETE","declared","actual","reduce","sum","_","bytes","count","recordsStart","record","from","recordSum"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/uebe/mysense.frame-reader.ts"],"mappings":";;AACA,SAASA,eAAe,QAAQ,qCAAkC;AAElE,SAASC,SAAS,QAAQ,+BAA4B;AAEtD,MAAMC,KAAK,GAAG,IAAI;AAClB,MAAMC,YAAY,GAAG,CAAC;AACtB,MAAMC,eAAe,GAAG,GAAG;AAC3B,MAAMC,EAAE,GAAG,IAAI;AAEf,MAAMC,MAAM,GAAGA,CAACC,KAAwB,EAAEC,KAAa,KACrDP,SAAS,CAACM,KAAK,CAACC,KAAK,CAAC,IAAI,GAAG,CAAC;;AAEhC;AACA,OAAO,MAAMC,kBAAkB,CAAwB;EAC9CC,SAASA,CAACC,MAAyB,EAAmB;IAC3D,MAAMC,KAAK,GAAGD,MAAM,CAACE,SAAS,CAAEC,IAAI,IAAKA,IAAI,CAACC,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,IAAI,EAAE,CAAC,CAAC;MAE3E,IAAI8B,SAAS,KAAKhC,MAAM,CAACC,KAAK,EAAE8B,IAAI,GAAG,CAAC,CAAC,EAAE;QACzC,OAAO,KAAK;MACd;IACF;IAEA,OAAO,IAAI;EACb;AACF","ignoreList":[]}
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ import { hexToByte } from "../../../utils/hex-to-byte.js";
4
+ const SERVICE = "0000fff0-0000-1000-8000-00805f9b34fb";
5
+ const WRITE = "0000fff2-0000-1000-8000-00805f9b34fb";
6
+ const START = 0x4d;
7
+ const DEVICE_ROLE = 0x61;
8
+ const APP_ROLE = 0xfc;
9
+ const REQUEST = 0xa1;
10
+ const HISTORY = 0xa3;
11
+ const byte = value => (value & 0xff).toString(16).padStart(2, "0");
12
+ const frameFor = (role, opcode, data) => {
13
+ const length = 1 + data.length + 1;
14
+ const frame = [START, role, length >> 8 & 0xff, length & 0xff, opcode, ...data];
15
+ const sum = frame.reduce((total, value) => total + value & 0xff, 0);
16
+ return [...frame, sum].map(byte);
17
+ };
18
+ const nowData = () => {
19
+ const now = new Date();
20
+ return [now.getFullYear() % 100, now.getMonth() + 1, now.getDate(), now.getHours(), now.getMinutes(), 0x0f];
21
+ };
22
+ /** Answers the greeting, then acknowledges each valid history frame exactly once. */
23
+ export class MySenseSequencer {
24
+ normalDisconnect = false;
25
+ constructor(params) {
26
+ this.params = params;
27
+ }
28
+ initialCommands = () => [];
29
+ nextCommand = frame => {
30
+ if (hexToByte(frame[0] ?? "0") !== START || hexToByte(frame[1] ?? "0") !== DEVICE_ROLE) {
31
+ return undefined;
32
+ }
33
+ switch (hexToByte(frame[4] ?? "0")) {
34
+ case REQUEST:
35
+ this.params.onGreeting(frame);
36
+ this.normalDisconnect = true;
37
+ return [this.commandFor(frameFor(APP_ROLE, REQUEST, nowData()))];
38
+ case HISTORY:
39
+ {
40
+ const count = hexToByte(frame[6] ?? "0") << 8 | hexToByte(frame[7] ?? "0");
41
+ this.normalDisconnect = true;
42
+ return [this.commandFor(frameFor(APP_ROLE, HISTORY, [count >> 8, count & 0xff]))];
43
+ }
44
+ default:
45
+ return undefined;
46
+ }
47
+ };
48
+ isNormalDisconnect = () => this.normalDisconnect;
49
+ commandFor = frame => ({
50
+ serviceUuid: SERVICE,
51
+ characteristicUuid: WRITE,
52
+ frame
53
+ });
54
+ }
55
+ //# sourceMappingURL=mysense.sequencer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["hexToByte","SERVICE","WRITE","START","DEVICE_ROLE","APP_ROLE","REQUEST","HISTORY","byte","value","toString","padStart","frameFor","role","opcode","data","length","frame","sum","reduce","total","map","nowData","now","Date","getFullYear","getMonth","getDate","getHours","getMinutes","MySenseSequencer","normalDisconnect","constructor","params","initialCommands","nextCommand","undefined","onGreeting","commandFor","count","isNormalDisconnect","serviceUuid","characteristicUuid"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/uebe/mysense.sequencer.ts"],"mappings":";;AAEA,SAASA,SAAS,QAAQ,+BAA4B;AAEtD,MAAMC,OAAO,GAAG,sCAAsC;AACtD,MAAMC,KAAK,GAAG,sCAAsC;AACpD,MAAMC,KAAK,GAAG,IAAI;AAClB,MAAMC,WAAW,GAAG,IAAI;AACxB,MAAMC,QAAQ,GAAG,IAAI;AACrB,MAAMC,OAAO,GAAG,IAAI;AACpB,MAAMC,OAAO,GAAG,IAAI;AAEpB,MAAMC,IAAI,GAAIC,KAAa,IAAa,CAACA,KAAK,GAAG,IAAI,EAAEC,QAAQ,CAAC,EAAE,CAAC,CAACC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;AAEpF,MAAMC,QAAQ,GAAGA,CAACC,IAAY,EAAEC,MAAc,EAAEC,IAAuB,KAAe;EACpF,MAAMC,MAAM,GAAG,CAAC,GAAGD,IAAI,CAACC,MAAM,GAAG,CAAC;EAElC,MAAMC,KAAK,GAAG,CACZd,KAAK,EACLU,IAAI,EACHG,MAAM,IAAI,CAAC,GAAI,I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;QAE5B,OAAO,CAAC,IAAI,CAACO,UAAU,CAAC1B,QAAQ,CAACP,QAAQ,EAAEC,OAAO,EAAEgB,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;MAElE,KAAKf,OAAO;QAAE;UACZ,MAAMgC,KAAK,GAAIvC,SAAS,CAACiB,KAAK,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,GAAIjB,SAAS,CAACiB,KAAK,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC;UAE5E,IAAI,CAACc,gBAAgB,GAAG,IAAI;UAE5B,OAAO,CACL,IAAI,CAACO,UAAU,CAAC1B,QAAQ,CAACP,QAAQ,EAAEE,OAAO,EAAE,CAACgC,KAAK,IAAI,CAAC,EAAEA,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CACzE;QACH;MAEA;QACE,OAAOH,SAAS;IACpB;EACF,CAAC;EAEMI,kBAAkB,GAAGA,CAAA,KAAe,IAAI,CAACT,gBAAgB;EAExDO,UAAU,GAAIrB,KAAwB,KAAqB;IACjEwB,WAAW,EAAExC,OAAO;IACpByC,kBAAkB,EAAExC,KAAK;IACzBe;EACF,CAAC,CAAC;AACJ","ignoreList":[]}
@@ -17,53 +17,68 @@ import { lepuDevice } from "../lepu/lepu.transports.js";
17
17
  /** Realtime parameters. A read: it reports what the sensor sees and starts nothing. */
18
18
  const RT_PARAM = 0x17;
19
19
 
20
- /** Only the command byte, because what makes a reading valid here is a bit, not a byte. */
21
- const CASE_SELECTOR_BYTES = [1];
20
+ /** Status, payload length, oxygen, pulse and sensor-state bytes distinguish these frames. */
21
+ const CASE_SELECTOR_BYTES = [1, 5, 6, 7, 8, 9, 18];
22
22
 
23
- /** Header plus the realtime parameters through the pulse rate. */
24
- const MIN_LENGTH_BYTES = 10;
23
+ /** Header plus the complete realtime response, including sensor state and checksum. */
24
+ const MIN_LENGTH_BYTES = 21;
25
25
  const PAYLOAD = 7;
26
26
  const SPOT_CHECK_TIMEOUT_MS = 60_000;
27
27
  /**
28
28
  * Declares one oximeter of the range.
29
29
  *
30
- * **A finger that is not in the sensor yields no reading, reported as an error.** The device
31
- * answers every poll whether or not it is measuring, and marks an unusable reading in two
32
- * bits of a status byte - which a declaration cannot read, because a case is selected by
33
- * whole bytes. What it can do is refuse the number: an oxygen saturation measured off the
34
- * finger falls outside the physiological range, so it is discarded rather than reported.
35
- * The reading is therefore never wrong, but a device left connected with nobody wearing it
36
- * reports a decoding failure on each poll. Reading those bits quietly needs a device class.
30
+ * The ViHealth wire protocol uses a distinct `AA` request / `55` response envelope. Replies
31
+ * carry a status byte rather than echoing the opcode, and the sensor state at byte 18 tells
32
+ * us whether the reading is usable. No-finger and acquiring frames are deliberately idle:
33
+ * they are normal states while the user puts the ring on, not decoding failures.
37
34
  */
38
- const viatomOximeter = (advertisedName, params) => lepuDevice({
39
- id: params.id ?? `viatom-${advertisedName.toLowerCase().replace(/[^a-z0-9]+/g, "-")}`,
40
- nameMatch: params.nameMatch ?? lepuNameMatch(advertisedName),
41
- stuckDataTimeoutMs: SPOT_CHECK_TIMEOUT_MS,
42
- pollCommand: RT_PARAM,
43
- minLengthBytes: MIN_LENGTH_BYTES,
44
- caseSelectorBytes: CASE_SELECTOR_BYTES,
45
- cases: [{
46
- selector: "17",
47
- kind: "result",
48
- measurementTypeKey: MeasurementTypeKey.bloodOxygenPulseRate,
49
- description: "Realtime parameters",
50
- fields: [{
51
- name: "bloodOxygen",
52
- byteIndexes: [PAYLOAD],
53
- encoding: "uint",
54
- unit: "%"
35
+ const viatomOximeter = (advertisedName, params) => {
36
+ const expectedDeviceTypes = params.expectedDeviceTypes ?? (advertisedName === "O2Ring" ? [1652] : advertisedName === "Oxyfit" ? [1654] : undefined);
37
+ return lepuDevice({
38
+ id: params.id ?? `viatom-${advertisedName.toLowerCase().replace(/[^a-z0-9]+/g, "-")}`,
39
+ nameMatch: params.nameMatch ?? lepuNameMatch(advertisedName),
40
+ stuckDataTimeoutMs: SPOT_CHECK_TIMEOUT_MS,
41
+ protocol: "viatom-oxygen",
42
+ setClockBeforeInfo: advertisedName === "O2Ring",
43
+ writeWithoutResponse: true,
44
+ pollCommand: RT_PARAM,
45
+ minLengthBytes: MIN_LENGTH_BYTES,
46
+ caseSelectorBytes: CASE_SELECTOR_BYTES,
47
+ cases: [{
48
+ selector: "000002????????",
49
+ kind: "idle",
50
+ description: "Device information response"
55
51
  }, {
56
- name: "pulseRate",
57
- byteIndexes: [PAYLOAD + 1, PAYLOAD + 2],
58
- byteOrder: "little",
59
- encoding: "uint",
60
- unit: "bpm"
61
- }]
62
- }],
63
- ...(params.expectedDeviceTypes ? {
64
- expectedDeviceTypes: params.expectedDeviceTypes
65
- } : {})
66
- });
52
+ selector: "000d00ffffff00",
53
+ kind: "idle",
54
+ description: "No finger detected"
55
+ }, {
56
+ selector: "000d0000000001",
57
+ kind: "idle",
58
+ description: "Sensor acquiring"
59
+ }, {
60
+ selector: "000d00??????01",
61
+ kind: "result",
62
+ measurementTypeKey: MeasurementTypeKey.bloodOxygenPulseRate,
63
+ description: "Realtime parameters",
64
+ fields: [{
65
+ name: "bloodOxygen",
66
+ byteIndexes: [PAYLOAD],
67
+ encoding: "uint",
68
+ unit: "%"
69
+ }, {
70
+ name: "pulseRate",
71
+ byteIndexes: [PAYLOAD + 1, PAYLOAD + 2],
72
+ byteOrder: "little",
73
+ encoding: "uint",
74
+ unit: "bpm"
75
+ }]
76
+ }],
77
+ ...(expectedDeviceTypes === undefined ? {} : {
78
+ expectedDeviceTypes
79
+ })
80
+ });
81
+ };
67
82
 
68
83
  /**
69
84
  * The names the oximeter range advertises.
@@ -1 +1 @@
1
- {"version":3,"names":["MeasurementTypeKey","lepuNameMatch","lepuDevice","RT_PARAM","CASE_SELECTOR_BYTES","MIN_LENGTH_BYTES","PAYLOAD","SPOT_CHECK_TIMEOUT_MS","viatomOximeter","advertisedName","params","id","toLowerCase","replace","nameMatch","stuckDataTimeoutMs","pollCommand","minLengthBytes","caseSelectorBytes","cases","selector","kind","measurementTypeKey","bloodOxygenPulseRate","description","fields","name","byteIndexes","encoding","unit","byteOrder","expectedDeviceTypes","VIATOM_OXIMETER_NAMES"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/viatom/viatom.oximeters.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,YAAY;AAG/C,SAASC,aAAa,QAAQ,4BAAyB;AACvD,SAASC,UAAU,QAAQ,4BAAyB;;AAEpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,MAAMC,QAAQ,GAAG,IAAI;;AAErB;AACA,MAAMC,mBAAmB,GAAG,CAAC,CAAC,CAAC;;AAE/B;AACA,MAAMC,gBAAgB,GAAG,EAAE;AAE3B,MAAMC,OAAO,GAAG,CAAC;AAEjB,MAAMC,qBAAqB,GAAG,MAAM;AAoBpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,cAAc,GAAGA,CACrBC,cAAsB,EACtBC,MAA4B,KAE5BR,UAAU,CAAC;EACTS,EAAE,EAAED,MAAM,CAACC,EAAE,IAAI,UAAUF,cAAc,CAACG,WAAW,CAAC,CAAC,CAACC,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC,EAAE;EACrFC,SAAS,EAAEJ,MAAM,CAACI,SAAS,IAAIb,aAAa,CAACQ,cAAc,CAAC;EAC5DM,kBAAkB,EAAER,qBAAqB;EACzCS,WAAW,EAAEb,QAAQ;EACrBc,cAAc,EAAEZ,gBAAgB;EAChCa,iBAAiB,EAAEd,mBAAmB;EACtCe,KAAK,EAAE,CACL;IACEC,QAAQ,EAAE,IAAI;IACdC,IAAI,EAAE,QAAQ;IACdC,kBAAkB,EAAEtB,kBAAkB,CAACuB,oBAAoB;IAC3DC,WAAW,EAAE,qBAAqB;IAClCC,MAAM,EAAE,CACN;MACEC,IAAI,EAAE,aAAa;MACnBC,WAAW,EAAE,CAACrB,OAAO,CAAC;MACtBsB,QAAQ,EAAE,MAAM;MAChBC,IAAI,EAAE;IACR,CAAC,EACD;MACEH,IAAI,EAAE,WAAW;MACjBC,WAAW,EAAE,CAACrB,OAAO,GAAG,CAAC,EAAEA,OAAO,GAAG,CAAC,CAAC;MACvCwB,SAAS,EAAE,QAAQ;MACnBF,QAAQ,EAAE,MAAM;MAChBC,IAAI,EAAE;IACR,CAAC;EAEL,CAAC,CACF;EACD,IAAInB,MAAM,CAACqB,mBAAmB,GAC1B;IAAEA,mBAAmB,EAAErB,MAAM,CAACqB;EAAoB,CAAC,GACnD,CAAC,CAAC;AACR,CAAC,CAAC;;AAEJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,qBAAwC,GAAG,CAC/C,SAAS,EACT,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,SAAS,EACT,UAAU,EACV,UAAU,EACV,QAAQ,EACR,UAAU,EACV,WAAW,EACX,WAAW,EACX,WAAW,EACX,WAAW,EACX,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,MAAM,EACN,SAAS,EACT,QAAQ,CACT;AAED,SAASA,qBAAqB,EAAExB,cAAc","ignoreList":[]}
1
+ {"version":3,"names":["MeasurementTypeKey","lepuNameMatch","lepuDevice","RT_PARAM","CASE_SELECTOR_BYTES","MIN_LENGTH_BYTES","PAYLOAD","SPOT_CHECK_TIMEOUT_MS","viatomOximeter","advertisedName","params","expectedDeviceTypes","undefined","id","toLowerCase","replace","nameMatch","stuckDataTimeoutMs","protocol","setClockBeforeInfo","writeWithoutResponse","pollCommand","minLengthBytes","caseSelectorBytes","cases","selector","kind","description","measurementTypeKey","bloodOxygenPulseRate","fields","name","byteIndexes","encoding","unit","byteOrder","VIATOM_OXIMETER_NAMES"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/viatom/viatom.oximeters.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,YAAY;AAG/C,SAASC,aAAa,QAAQ,4BAAyB;AACvD,SAASC,UAAU,QAAQ,4B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f,CAAC,EACD;MACEF,QAAQ,EAAE,gBAAgB;MAC1BC,IAAI,EAAE,MAAM;MACZC,WAAW,EAAE;IACf,CAAC,EACD;MACEF,QAAQ,EAAE,gBAAgB;MAC1BC,IAAI,EAAE,QAAQ;MACdE,kBAAkB,EAAE5B,kBAAkB,CAAC6B,oBAAoB;MAC3DF,WAAW,EAAE,qBAAqB;MAClCG,MAAM,EAAE,CACN;QACEC,IAAI,EAAE,aAAa;QACnBC,WAAW,EAAE,CAAC1B,OAAO,CAAC;QACtB2B,QAAQ,EAAE,MAAM;QAChBC,IAAI,EAAE;MACR,CAAC,EACD;QACEH,IAAI,EAAE,WAAW;QACjBC,WAAW,EAAE,CAAC1B,OAAO,GAAG,CAAC,EAAEA,OAAO,GAAG,CAAC,CAAC;QACvC6B,SAAS,EAAE,QAAQ;QACnBF,QAAQ,EAAE,MAAM;QAChBC,IAAI,EAAE;MACR,CAAC;IAEL,CAAC,CACF;IACD,IAAIvB,mBAAmB,KAAKC,SAAS,GAAG,CAAC,CAAC,GAAG;MAAED;IAAoB,CAAC;EACtE,CAAC,CAAC;AACJ,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMyB,qBAAwC,GAAG,CAC/C,SAAS,EACT,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,SAAS,EACT,UAAU,EACV,UAAU,EACV,QAAQ,EACR,UAAU,EACV,WAAW,EACX,WAAW,EACX,WAAW,EACX,WAAW,EACX,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,MAAM,EACN,SAAS,EACT,QAAQ,CACT;AAED,SAASA,qBAAqB,EAAE5B,cAAc","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["IntegratedDevices"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/types/device-measurement-map.ts"],"mappings":";;AAYA,SAASA,iBAAiB,QAAQ,yBAAsB;;AA0BxD;AACA;AACA;AACA","ignoreList":[]}
1
+ {"version":3,"names":["IntegratedDevices"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/types/device-measurement-map.ts"],"mappings":";;AAYA,SAASA,iBAAiB,QAAQ,yBAAsB;;AA2BxD;AACA;AACA;AACA","ignoreList":[]}
@@ -4,6 +4,7 @@ export let IntegratedDevices = /*#__PURE__*/function (IntegratedDevices) {
4
4
  IntegratedDevices["F4"] = "F4";
5
5
  IntegratedDevices["BP2"] = "BP2";
6
6
  IntegratedDevices["SPO2"] = "Oxyfit";
7
+ IntegratedDevices["MYSENSE"] = "mySense";
7
8
  IntegratedDevices["AOJ20A"] = "AOJ-20A";
8
9
  IntegratedDevices["PC60WF"] = "OxySmart";
9
10
  IntegratedDevices["TAIDOC_GLUCOSE"] = "TAIDOC TD4216";
@@ -1 +1 @@
1
- {"version":3,"names":["IntegratedDevices"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/types/integrated-devices.ts"],"mappings":";;AAAA,WAAYA,iBAAiB,0BAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAA,OAAjBA,iBAAiB;AAAA","ignoreList":[]}
1
+ {"version":3,"names":["IntegratedDevices"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/types/integrated-devices.ts"],"mappings":";;AAAA,WAAYA,iBAAiB,0BAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAA,OAAjBA,iBAAiB;AAAA","ignoreList":[]}