@ovok/native 1.6.32 → 1.6.33

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 (178) hide show
  1. package/lib/commonjs/modules/bt-device/constants/device-instruction-pdfs.js +4 -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-device-catalog-entries.js +1 -1
  6. package/lib/commonjs/modules/bt-device/constants/supported-device-catalog-entries.js.map +1 -1
  7. package/lib/commonjs/modules/bt-device/constants/supported-devices.js +25 -0
  8. package/lib/commonjs/modules/bt-device/constants/supported-devices.js.map +1 -1
  9. package/lib/commonjs/modules/bt-management/constants/integrated-devices-map.js +2 -1
  10. package/lib/commonjs/modules/bt-management/constants/integrated-devices-map.js.map +1 -1
  11. package/lib/commonjs/modules/bt-management/index.js +77 -0
  12. package/lib/commonjs/modules/bt-management/index.js.map +1 -1
  13. package/lib/commonjs/modules/bt-management/services/background-sync/background-service-uuids.js +4 -0
  14. package/lib/commonjs/modules/bt-management/services/background-sync/background-service-uuids.js.map +1 -1
  15. package/lib/commonjs/modules/bt-management/services/device-creator.js +7 -1
  16. package/lib/commonjs/modules/bt-management/services/device-creator.js.map +1 -1
  17. package/lib/commonjs/modules/bt-management/services/devices/a606/a606.command-sequencer.js +68 -0
  18. package/lib/commonjs/modules/bt-management/services/devices/a606/a606.command-sequencer.js.map +1 -0
  19. package/lib/commonjs/modules/bt-management/services/devices/a606/a606.device.js +55 -0
  20. package/lib/commonjs/modules/bt-management/services/devices/a606/a606.device.js.map +1 -0
  21. package/lib/commonjs/modules/bt-management/services/devices/a606/a606.frame-parser.js +36 -0
  22. package/lib/commonjs/modules/bt-management/services/devices/a606/a606.frame-parser.js.map +1 -0
  23. package/lib/commonjs/modules/bt-management/services/devices/a606/a606.frame-reader.js +68 -0
  24. package/lib/commonjs/modules/bt-management/services/devices/a606/a606.frame-reader.js.map +1 -0
  25. package/lib/commonjs/modules/bt-management/services/devices/a606/a606.main-services.js +31 -0
  26. package/lib/commonjs/modules/bt-management/services/devices/a606/a606.main-services.js.map +1 -0
  27. package/lib/commonjs/modules/bt-management/services/devices/bpw1/bpw1.command-sequencer.js +73 -0
  28. package/lib/commonjs/modules/bt-management/services/devices/bpw1/bpw1.command-sequencer.js.map +1 -0
  29. package/lib/commonjs/modules/bt-management/services/devices/bpw1/bpw1.device.js +55 -0
  30. package/lib/commonjs/modules/bt-management/services/devices/bpw1/bpw1.device.js.map +1 -0
  31. package/lib/commonjs/modules/bt-management/services/devices/bpw1/bpw1.frame-parser.js +53 -0
  32. package/lib/commonjs/modules/bt-management/services/devices/bpw1/bpw1.frame-parser.js.map +1 -0
  33. package/lib/commonjs/modules/bt-management/services/devices/bpw1/bpw1.frame-reader.js +55 -0
  34. package/lib/commonjs/modules/bt-management/services/devices/bpw1/bpw1.frame-reader.js.map +1 -0
  35. package/lib/commonjs/modules/bt-management/services/devices/bpw1/bpw1.main-services.js +30 -0
  36. package/lib/commonjs/modules/bt-management/services/devices/bpw1/bpw1.main-services.js.map +1 -0
  37. package/lib/commonjs/modules/bt-management/services/devices/checkme/checkme.device.js +57 -0
  38. package/lib/commonjs/modules/bt-management/services/devices/checkme/checkme.device.js.map +1 -0
  39. package/lib/commonjs/modules/bt-management/services/devices/checkme/checkme.protocol.js +263 -0
  40. package/lib/commonjs/modules/bt-management/services/devices/checkme/checkme.protocol.js.map +1 -0
  41. package/lib/commonjs/modules/bt-management/services/devices/checkme/checkme.sequencer.js +255 -0
  42. package/lib/commonjs/modules/bt-management/services/devices/checkme/checkme.sequencer.js.map +1 -0
  43. package/lib/commonjs/modules/bt-management/types/clock-sync.js +1 -0
  44. package/lib/commonjs/modules/bt-management/types/clock-sync.js.map +1 -1
  45. package/lib/commonjs/modules/bt-management/types/integrated-devices.js +3 -0
  46. package/lib/commonjs/modules/bt-management/types/integrated-devices.js.map +1 -1
  47. package/lib/module/modules/bt-device/constants/device-instruction-pdfs.js +4 -1
  48. package/lib/module/modules/bt-device/constants/device-instruction-pdfs.js.map +1 -1
  49. package/lib/module/modules/bt-device/constants/supported-device-catalog-assets.js +3 -1
  50. package/lib/module/modules/bt-device/constants/supported-device-catalog-assets.js.map +1 -1
  51. package/lib/module/modules/bt-device/constants/supported-device-catalog-entries.js +1 -1
  52. package/lib/module/modules/bt-device/constants/supported-device-catalog-entries.js.map +1 -1
  53. package/lib/module/modules/bt-device/constants/supported-devices.js +26 -1
  54. package/lib/module/modules/bt-device/constants/supported-devices.js.map +1 -1
  55. package/lib/module/modules/bt-management/constants/integrated-devices-map.js +2 -1
  56. package/lib/module/modules/bt-management/constants/integrated-devices-map.js.map +1 -1
  57. package/lib/module/modules/bt-management/index.js +7 -0
  58. package/lib/module/modules/bt-management/index.js.map +1 -1
  59. package/lib/module/modules/bt-management/services/background-sync/background-service-uuids.js +4 -0
  60. package/lib/module/modules/bt-management/services/background-sync/background-service-uuids.js.map +1 -1
  61. package/lib/module/modules/bt-management/services/device-creator.js +7 -1
  62. package/lib/module/modules/bt-management/services/device-creator.js.map +1 -1
  63. package/lib/module/modules/bt-management/services/devices/a606/a606.command-sequencer.js +61 -0
  64. package/lib/module/modules/bt-management/services/devices/a606/a606.command-sequencer.js.map +1 -0
  65. package/lib/module/modules/bt-management/services/devices/a606/a606.device.js +45 -0
  66. package/lib/module/modules/bt-management/services/devices/a606/a606.device.js.map +1 -0
  67. package/lib/module/modules/bt-management/services/devices/a606/a606.frame-parser.js +32 -0
  68. package/lib/module/modules/bt-management/services/devices/a606/a606.frame-parser.js.map +1 -0
  69. package/lib/module/modules/bt-management/services/devices/a606/a606.frame-reader.js +63 -0
  70. package/lib/module/modules/bt-management/services/devices/a606/a606.frame-reader.js.map +1 -0
  71. package/lib/module/modules/bt-management/services/devices/a606/a606.main-services.js +28 -0
  72. package/lib/module/modules/bt-management/services/devices/a606/a606.main-services.js.map +1 -0
  73. package/lib/module/modules/bt-management/services/devices/bpw1/bpw1.command-sequencer.js +66 -0
  74. package/lib/module/modules/bt-management/services/devices/bpw1/bpw1.command-sequencer.js.map +1 -0
  75. package/lib/module/modules/bt-management/services/devices/bpw1/bpw1.device.js +45 -0
  76. package/lib/module/modules/bt-management/services/devices/bpw1/bpw1.device.js.map +1 -0
  77. package/lib/module/modules/bt-management/services/devices/bpw1/bpw1.frame-parser.js +48 -0
  78. package/lib/module/modules/bt-management/services/devices/bpw1/bpw1.frame-parser.js.map +1 -0
  79. package/lib/module/modules/bt-management/services/devices/bpw1/bpw1.frame-reader.js +50 -0
  80. package/lib/module/modules/bt-management/services/devices/bpw1/bpw1.frame-reader.js.map +1 -0
  81. package/lib/module/modules/bt-management/services/devices/bpw1/bpw1.main-services.js +26 -0
  82. package/lib/module/modules/bt-management/services/devices/bpw1/bpw1.main-services.js.map +1 -0
  83. package/lib/module/modules/bt-management/services/devices/checkme/checkme.device.js +53 -0
  84. package/lib/module/modules/bt-management/services/devices/checkme/checkme.device.js.map +1 -0
  85. package/lib/module/modules/bt-management/services/devices/checkme/checkme.protocol.js +247 -0
  86. package/lib/module/modules/bt-management/services/devices/checkme/checkme.protocol.js.map +1 -0
  87. package/lib/module/modules/bt-management/services/devices/checkme/checkme.sequencer.js +245 -0
  88. package/lib/module/modules/bt-management/services/devices/checkme/checkme.sequencer.js.map +1 -0
  89. package/lib/module/modules/bt-management/types/clock-sync.js +1 -0
  90. package/lib/module/modules/bt-management/types/clock-sync.js.map +1 -1
  91. package/lib/module/modules/bt-management/types/device-measurement-map.js.map +1 -1
  92. package/lib/module/modules/bt-management/types/integrated-devices.js +3 -0
  93. package/lib/module/modules/bt-management/types/integrated-devices.js.map +1 -1
  94. package/lib/typescript/commonjs/src/modules/bt-device/constants/device-instruction-pdfs.d.ts.map +1 -1
  95. package/lib/typescript/commonjs/src/modules/bt-device/constants/supported-device-catalog-assets.d.ts +3 -1
  96. package/lib/typescript/commonjs/src/modules/bt-device/constants/supported-device-catalog-assets.d.ts.map +1 -1
  97. package/lib/typescript/commonjs/src/modules/bt-device/constants/supported-device-catalog-entries.d.ts.map +1 -1
  98. package/lib/typescript/commonjs/src/modules/bt-device/constants/supported-devices.d.ts +7 -0
  99. package/lib/typescript/commonjs/src/modules/bt-device/constants/supported-devices.d.ts.map +1 -1
  100. package/lib/typescript/commonjs/src/modules/bt-management/constants/integrated-devices-map.d.ts.map +1 -1
  101. package/lib/typescript/commonjs/src/modules/bt-management/index.d.ts +7 -0
  102. package/lib/typescript/commonjs/src/modules/bt-management/index.d.ts.map +1 -1
  103. package/lib/typescript/commonjs/src/modules/bt-management/services/background-sync/background-service-uuids.d.ts.map +1 -1
  104. package/lib/typescript/commonjs/src/modules/bt-management/services/device-creator.d.ts.map +1 -1
  105. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/a606/a606.command-sequencer.d.ts +22 -0
  106. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/a606/a606.command-sequencer.d.ts.map +1 -0
  107. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/a606/a606.device.d.ts +24 -0
  108. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/a606/a606.device.d.ts.map +1 -0
  109. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/a606/a606.frame-parser.d.ts +10 -0
  110. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/a606/a606.frame-parser.d.ts.map +1 -0
  111. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/a606/a606.frame-reader.d.ts +9 -0
  112. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/a606/a606.frame-reader.d.ts.map +1 -0
  113. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/a606/a606.main-services.d.ts +4 -0
  114. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/a606/a606.main-services.d.ts.map +1 -0
  115. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bpw1/bpw1.command-sequencer.d.ts +21 -0
  116. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bpw1/bpw1.command-sequencer.d.ts.map +1 -0
  117. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bpw1/bpw1.device.d.ts +22 -0
  118. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bpw1/bpw1.device.d.ts.map +1 -0
  119. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bpw1/bpw1.frame-parser.d.ts +9 -0
  120. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bpw1/bpw1.frame-parser.d.ts.map +1 -0
  121. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bpw1/bpw1.frame-reader.d.ts +8 -0
  122. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bpw1/bpw1.frame-reader.d.ts.map +1 -0
  123. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bpw1/bpw1.main-services.d.ts +4 -0
  124. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bpw1/bpw1.main-services.d.ts.map +1 -0
  125. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/checkme/checkme.device.d.ts +18 -0
  126. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/checkme/checkme.device.d.ts.map +1 -0
  127. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/checkme/checkme.protocol.d.ts +79 -0
  128. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/checkme/checkme.protocol.d.ts.map +1 -0
  129. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/checkme/checkme.sequencer.d.ts +52 -0
  130. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/checkme/checkme.sequencer.d.ts.map +1 -0
  131. package/lib/typescript/commonjs/src/modules/bt-management/types/clock-sync.d.ts.map +1 -1
  132. package/lib/typescript/commonjs/src/modules/bt-management/types/device-measurement-map.d.ts +8 -0
  133. package/lib/typescript/commonjs/src/modules/bt-management/types/device-measurement-map.d.ts.map +1 -1
  134. package/lib/typescript/commonjs/src/modules/bt-management/types/integrated-devices.d.ts +4 -1
  135. package/lib/typescript/commonjs/src/modules/bt-management/types/integrated-devices.d.ts.map +1 -1
  136. package/lib/typescript/module/src/modules/bt-device/constants/device-instruction-pdfs.d.ts.map +1 -1
  137. package/lib/typescript/module/src/modules/bt-device/constants/supported-device-catalog-assets.d.ts +3 -1
  138. package/lib/typescript/module/src/modules/bt-device/constants/supported-device-catalog-assets.d.ts.map +1 -1
  139. package/lib/typescript/module/src/modules/bt-device/constants/supported-device-catalog-entries.d.ts.map +1 -1
  140. package/lib/typescript/module/src/modules/bt-device/constants/supported-devices.d.ts +7 -0
  141. package/lib/typescript/module/src/modules/bt-device/constants/supported-devices.d.ts.map +1 -1
  142. package/lib/typescript/module/src/modules/bt-management/constants/integrated-devices-map.d.ts.map +1 -1
  143. package/lib/typescript/module/src/modules/bt-management/index.d.ts +7 -0
  144. package/lib/typescript/module/src/modules/bt-management/index.d.ts.map +1 -1
  145. package/lib/typescript/module/src/modules/bt-management/services/background-sync/background-service-uuids.d.ts.map +1 -1
  146. package/lib/typescript/module/src/modules/bt-management/services/device-creator.d.ts.map +1 -1
  147. package/lib/typescript/module/src/modules/bt-management/services/devices/a606/a606.command-sequencer.d.ts +22 -0
  148. package/lib/typescript/module/src/modules/bt-management/services/devices/a606/a606.command-sequencer.d.ts.map +1 -0
  149. package/lib/typescript/module/src/modules/bt-management/services/devices/a606/a606.device.d.ts +24 -0
  150. package/lib/typescript/module/src/modules/bt-management/services/devices/a606/a606.device.d.ts.map +1 -0
  151. package/lib/typescript/module/src/modules/bt-management/services/devices/a606/a606.frame-parser.d.ts +10 -0
  152. package/lib/typescript/module/src/modules/bt-management/services/devices/a606/a606.frame-parser.d.ts.map +1 -0
  153. package/lib/typescript/module/src/modules/bt-management/services/devices/a606/a606.frame-reader.d.ts +9 -0
  154. package/lib/typescript/module/src/modules/bt-management/services/devices/a606/a606.frame-reader.d.ts.map +1 -0
  155. package/lib/typescript/module/src/modules/bt-management/services/devices/a606/a606.main-services.d.ts +4 -0
  156. package/lib/typescript/module/src/modules/bt-management/services/devices/a606/a606.main-services.d.ts.map +1 -0
  157. package/lib/typescript/module/src/modules/bt-management/services/devices/bpw1/bpw1.command-sequencer.d.ts +21 -0
  158. package/lib/typescript/module/src/modules/bt-management/services/devices/bpw1/bpw1.command-sequencer.d.ts.map +1 -0
  159. package/lib/typescript/module/src/modules/bt-management/services/devices/bpw1/bpw1.device.d.ts +22 -0
  160. package/lib/typescript/module/src/modules/bt-management/services/devices/bpw1/bpw1.device.d.ts.map +1 -0
  161. package/lib/typescript/module/src/modules/bt-management/services/devices/bpw1/bpw1.frame-parser.d.ts +9 -0
  162. package/lib/typescript/module/src/modules/bt-management/services/devices/bpw1/bpw1.frame-parser.d.ts.map +1 -0
  163. package/lib/typescript/module/src/modules/bt-management/services/devices/bpw1/bpw1.frame-reader.d.ts +8 -0
  164. package/lib/typescript/module/src/modules/bt-management/services/devices/bpw1/bpw1.frame-reader.d.ts.map +1 -0
  165. package/lib/typescript/module/src/modules/bt-management/services/devices/bpw1/bpw1.main-services.d.ts +4 -0
  166. package/lib/typescript/module/src/modules/bt-management/services/devices/bpw1/bpw1.main-services.d.ts.map +1 -0
  167. package/lib/typescript/module/src/modules/bt-management/services/devices/checkme/checkme.device.d.ts +18 -0
  168. package/lib/typescript/module/src/modules/bt-management/services/devices/checkme/checkme.device.d.ts.map +1 -0
  169. package/lib/typescript/module/src/modules/bt-management/services/devices/checkme/checkme.protocol.d.ts +79 -0
  170. package/lib/typescript/module/src/modules/bt-management/services/devices/checkme/checkme.protocol.d.ts.map +1 -0
  171. package/lib/typescript/module/src/modules/bt-management/services/devices/checkme/checkme.sequencer.d.ts +52 -0
  172. package/lib/typescript/module/src/modules/bt-management/services/devices/checkme/checkme.sequencer.d.ts.map +1 -0
  173. package/lib/typescript/module/src/modules/bt-management/types/clock-sync.d.ts.map +1 -1
  174. package/lib/typescript/module/src/modules/bt-management/types/device-measurement-map.d.ts +8 -0
  175. package/lib/typescript/module/src/modules/bt-management/types/device-measurement-map.d.ts.map +1 -1
  176. package/lib/typescript/module/src/modules/bt-management/types/integrated-devices.d.ts +4 -1
  177. package/lib/typescript/module/src/modules/bt-management/types/integrated-devices.d.ts.map +1 -1
  178. package/package.json +1 -1
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.bpw1MainServices = void 0;
7
+ var _core = require("@ovok/core");
8
+ var _caseType = require("../../../types/case-type.js");
9
+ /** Viatom BPW1's LHZL watch-profile GATT surface used by ViHealth. */
10
+ const bpw1MainServices = exports.bpw1MainServices = [{
11
+ uuid: "81eea003-e735-49ec-8a11-7e32cae1e14e",
12
+ writeUuid: {
13
+ uuid: "81eea002-e735-49ec-8a11-7e32cae1e14e",
14
+ mainCommandUuid: "e00000000000000001"
15
+ },
16
+ monitorUuids: [{
17
+ uuid: "81eea001-e735-49ec-8a11-7e32cae1e14e",
18
+ parsingModel: {
19
+ caseValuePosition: [4, 6],
20
+ cases: [{
21
+ caseValue: "0301",
22
+ caseType: _caseType.CaseType.DEPENDENT,
23
+ measurementTypeKey: _core.MeasurementTypeKey.bloodPressure,
24
+ minLengthBytes: 21,
25
+ parseDefinitions: []
26
+ }]
27
+ }
28
+ }]
29
+ }];
30
+ //# sourceMappingURL=bpw1.main-services.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_core","require","_caseType","bpw1MainServices","exports","uuid","writeUuid","mainCommandUuid","monitorUuids","parsingModel","caseValuePosition","cases","caseValue","caseType","CaseType","DEPENDENT","measurementTypeKey","MeasurementTypeKey","bloodPressure","minLengthBytes","parseDefinitions"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/bpw1/bpw1.main-services.ts"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AAGA;AACO,MAAME,gBAA4B,GAAAC,OAAA,CAAAD,gBAAA,GAAG,CAC1C;EACEE,IAAI,EAAE,sCAAsC;EAC5CC,SAAS,EAAE;IACTD,IAAI,EAAE,sCAAsC;IAC5CE,eAAe,EAAE;EACnB,CAAC;EACDC,YAAY,EAAE,CACZ;IACEH,IAAI,EAAE,sCAAsC;IAC5CI,YAAY,EAAE;MACZC,iBAAiB,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;MACzBC,KAAK,EAAE,CACL;QACEC,SAAS,EAAE,MAAM;QACjBC,QAAQ,EAAEC,kBAAQ,CAACC,SAAS;QAC5BC,kBAAkB,EAAEC,wBAAkB,CAACC,aAAa;QACpDC,cAAc,EAAE,EAAE;QAClBC,gBAAgB,EAAE;MACpB,CAAC;IAEL;EACF,CAAC;AAEL,CAAC,CACF","ignoreList":[]}
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.checkmeMainServices = exports.CheckmeProDevice = void 0;
7
+ var _caseType = require("../../../types/case-type.js");
8
+ var _btManagedDevice = require("../bt-managed-device.js");
9
+ var _checkmeProtocol = require("./checkme.protocol.js");
10
+ var _checkmeSequencer = require("./checkme.sequencer.js");
11
+ const STUCK_TIMEOUT_MS = 180_000;
12
+ const PREFERRED_MTU = 247;
13
+ const acceptEverything = {
14
+ caseValuePosition: [],
15
+ cases: [{
16
+ caseValue: "",
17
+ caseType: _caseType.CaseType.OTHER,
18
+ parseDefinitions: [],
19
+ description: "A Checkme history response decoded by the transfer sequencer"
20
+ }]
21
+ };
22
+ const checkmeMainServices = exports.checkmeMainServices = [{
23
+ uuid: _checkmeProtocol.CHECKME_SERVICE,
24
+ monitorUuids: [{
25
+ uuid: _checkmeProtocol.CHECKME_NOTIFY,
26
+ parsingModel: acceptEverything
27
+ }],
28
+ writeUuid: {
29
+ uuid: _checkmeProtocol.CHECKME_WRITE,
30
+ mainCommandUuid: "aa"
31
+ }
32
+ }];
33
+
34
+ /** Viatom Checkme Pro history transfer, matching the CheckmeBleInterface in ViHealth. */
35
+ class CheckmeProDevice extends _btManagedDevice.BTManagedDevice {
36
+ mainServices = checkmeMainServices;
37
+ stuckDataTimeout = STUCK_TIMEOUT_MS;
38
+ preferredMtu = PREFERRED_MTU;
39
+ onStreamStart = undefined;
40
+ validatePackage = () => true;
41
+ constructor(device, params) {
42
+ super(device, params);
43
+ this.frameReader = new _checkmeProtocol.CheckmeFrameReader();
44
+ this.createCommandSequencer = () => new _checkmeSequencer.CheckmeProSequencer({
45
+ write: {
46
+ serviceUuid: _checkmeProtocol.CHECKME_SERVICE,
47
+ characteristicUuid: _checkmeProtocol.CHECKME_WRITE
48
+ },
49
+ onResult: result => this.onResult?.(result)
50
+ });
51
+ }
52
+ handleSuccessResult() {
53
+ return;
54
+ }
55
+ }
56
+ exports.CheckmeProDevice = CheckmeProDevice;
57
+ //# sourceMappingURL=checkme.device.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_caseType","require","_btManagedDevice","_checkmeProtocol","_checkmeSequencer","STUCK_TIMEOUT_MS","PREFERRED_MTU","acceptEverything","caseValuePosition","cases","caseValue","caseType","CaseType","OTHER","parseDefinitions","description","checkmeMainServices","exports","uuid","CHECKME_SERVICE","monitorUuids","CHECKME_NOTIFY","parsingModel","writeUuid","CHECKME_WRITE","mainCommandUuid","CheckmeProDevice","BTManagedDevice","mainServices","stuckDataTimeout","preferredMtu","onStreamStart","undefined","validatePackage","constructor","device","params","frameReader","CheckmeFrameReader","createCommandSequencer","CheckmeProSequencer","write","serviceUuid","characteristicUuid","onResult","result","handleSuccessResult"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/checkme/checkme.device.ts"],"mappings":";;;;;;AAEA,IAAAA,SAAA,GAAAC,OAAA;AAMA,IAAAC,gBAAA,GAAAD,OAAA;AAEA,IAAAE,gBAAA,GAAAF,OAAA;AAMA,IAAAG,iBAAA,GAAAH,OAAA;AAEA,MAAMI,gBAAgB,GAAG,OAAO;A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
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.parseCheckmeTemperatureRecords = exports.parseCheckmeOxygenRecords = exports.parseCheckmeEcgRecords = exports.parseCheckmeDailyRecords = exports.parseCheckmeBloodPressureRecords = exports.decodeCheckmeResponse = exports.decodeCheckmeEcgFile = exports.checkmeReadFileStart = exports.checkmeReadEnd = exports.checkmeReadContent = exports.checkmeCommand = exports.CheckmeListType = exports.CheckmeFrameReader = exports.CheckmeCommand = exports.CHECKME_WRITE = exports.CHECKME_SERVICE = exports.CHECKME_NOTIFY = void 0;
7
+ var _frameReadStatus = require("../../../types/frame-read-status.js");
8
+ var _calculateCrc = require("../../../utils/calculate-crc-8.js");
9
+ var _hexToByte = require("../../../utils/hex-to-byte.js");
10
+ /* eslint-disable import/group-exports, max-lines */
11
+
12
+ const CHECKME_SERVICE = exports.CHECKME_SERVICE = "14839ac4-7d7e-415c-9a42-167340cf2339";
13
+ const CHECKME_WRITE = exports.CHECKME_WRITE = "8b00ace7-eb0b-49b0-bbe9-9aee0a26e1a3";
14
+ const CHECKME_NOTIFY = exports.CHECKME_NOTIFY = "0734594a-a8e7-4b1a-a6b1-cd5243059a57";
15
+ const CheckmeCommand = exports.CheckmeCommand = {
16
+ info: 0x14,
17
+ ping: 0x15,
18
+ syncParameters: 0x16,
19
+ readStart: 0x03,
20
+ readContent: 0x04,
21
+ readEnd: 0x05
22
+ };
23
+ const CheckmeListType = exports.CheckmeListType = {
24
+ daily: 0,
25
+ ecg: 1,
26
+ oxygen: 2,
27
+ bloodPressure: 3,
28
+ temperature: 5,
29
+ user: 8
30
+ };
31
+ const byte = value => (value & 0xff).toString(16).padStart(2, "0");
32
+ const littleEndian16 = (bytes, offset) => (0, _hexToByte.hexToByte)(bytes[offset] ?? "00") | (0, _hexToByte.hexToByte)(bytes[offset + 1] ?? "00") << 8;
33
+ const frame = (command, payload = []) => {
34
+ const length = payload.length ? payload.length + 1 : 0;
35
+ const result = ["aa", byte(command), byte(~command), "00", "00", byte(length), byte(length >> 8), ...payload, "00"];
36
+ result[result.length - 1] = byte((0, _calculateCrc.calculateCrc8)(result, result.length - 1));
37
+ return result;
38
+ };
39
+ const checkmeCommand = (command, payload = []) => frame(command, payload);
40
+ exports.checkmeCommand = checkmeCommand;
41
+ const checkmeReadFileStart = name => frame(CheckmeCommand.readStart, [...name].map(character => byte(character.charCodeAt(0))));
42
+ exports.checkmeReadFileStart = checkmeReadFileStart;
43
+ const checkmeReadContent = sequence => {
44
+ const result = frame(CheckmeCommand.readContent);
45
+ result[3] = byte(sequence);
46
+ result[4] = byte(sequence >> 8);
47
+ result[result.length - 1] = byte((0, _calculateCrc.calculateCrc8)(result, result.length - 1));
48
+ return result;
49
+ };
50
+ exports.checkmeReadContent = checkmeReadContent;
51
+ const checkmeReadEnd = () => frame(CheckmeCommand.readEnd);
52
+ exports.checkmeReadEnd = checkmeReadEnd;
53
+ /** Decodes the two response envelopes used by Checkme Pro's vendor library. */
54
+ const decodeCheckmeResponse = bytes => {
55
+ const head = (0, _hexToByte.hexToByte)(bytes[0] ?? "00");
56
+ if (head === 0x55) {
57
+ if (bytes.length < 8) {
58
+ return undefined;
59
+ }
60
+ const length = bytes.length - 8;
61
+ return {
62
+ head,
63
+ state: (0, _hexToByte.hexToByte)(bytes[1] ?? "01") === 0,
64
+ sequence: littleEndian16(bytes, 3),
65
+ content: bytes.slice(7, 7 + length)
66
+ };
67
+ }
68
+ if (head === 0xa5 && (0, _hexToByte.hexToByte)(bytes[1] ?? "00") === 0x5a) {
69
+ return {
70
+ head,
71
+ state: true,
72
+ sequence: 0,
73
+ content: bytes.slice(4)
74
+ };
75
+ }
76
+ return undefined;
77
+ };
78
+
79
+ /** Handles split notifications, concatenated notifications, and both vendor envelopes. */
80
+ exports.decodeCheckmeResponse = decodeCheckmeResponse;
81
+ class CheckmeFrameReader {
82
+ readFrame(buffer) {
83
+ const start = this.findStart(buffer);
84
+ if (start < 0) {
85
+ return {
86
+ status: _frameReadStatus.FrameReadStatus.INCOMPLETE,
87
+ consumedBytes: Math.max(0, buffer.length - 1)
88
+ };
89
+ }
90
+ const head = (0, _hexToByte.hexToByte)(buffer[start] ?? "00");
91
+ const frameLength = head === 0x55 ? 8 + littleEndian16(buffer, start + 5) : littleEndian16(buffer, start + 3);
92
+ if (frameLength < (head === 0x55 ? 8 : 4)) {
93
+ return {
94
+ status: _frameReadStatus.FrameReadStatus.CORRUPT,
95
+ consumedBytes: start + 2
96
+ };
97
+ }
98
+ if (start + frameLength > buffer.length) {
99
+ return {
100
+ status: _frameReadStatus.FrameReadStatus.INCOMPLETE,
101
+ consumedBytes: start
102
+ };
103
+ }
104
+ const frame = buffer.slice(start, start + frameLength);
105
+ if (head === 0x55 && !this.hasValidChecksum(frame)) {
106
+ return {
107
+ status: _frameReadStatus.FrameReadStatus.CORRUPT,
108
+ consumedBytes: start + 1
109
+ };
110
+ }
111
+ return {
112
+ status: _frameReadStatus.FrameReadStatus.COMPLETE,
113
+ consumedBytes: start + frameLength,
114
+ frame
115
+ };
116
+ }
117
+ findStart(buffer) {
118
+ for (let index = 0; index < buffer.length; index += 1) {
119
+ const value = (0, _hexToByte.hexToByte)(buffer[index] ?? "00");
120
+ if (value === 0xa5 && (0, _hexToByte.hexToByte)(buffer[index + 1] ?? "00") === 0x5a) {
121
+ return index;
122
+ }
123
+ if (value === 0x55 && index + 2 < buffer.length && (0, _hexToByte.hexToByte)(buffer[index + 1] ?? "00") === (~(0, _hexToByte.hexToByte)(buffer[index + 2] ?? "00") & 0xff)) {
124
+ return index;
125
+ }
126
+ }
127
+ return -1;
128
+ }
129
+ hasValidChecksum(frame) {
130
+ const checksum = (0, _hexToByte.hexToByte)(frame.at(-1) ?? "00");
131
+ return checksum === (0, _calculateCrc.calculateCrc8)([...frame], frame.length - 1);
132
+ }
133
+ }
134
+ exports.CheckmeFrameReader = CheckmeFrameReader;
135
+ const dateFrom = bytes => {
136
+ const year = littleEndian16(bytes, 0);
137
+ const month = (0, _hexToByte.hexToByte)(bytes[2] ?? "00");
138
+ const day = (0, _hexToByte.hexToByte)(bytes[3] ?? "00");
139
+ const hour = (0, _hexToByte.hexToByte)(bytes[4] ?? "00");
140
+ const minute = (0, _hexToByte.hexToByte)(bytes[5] ?? "00");
141
+ const second = (0, _hexToByte.hexToByte)(bytes[6] ?? "00");
142
+ const date = new Date(year, month - 1, day, hour, minute, second, 0);
143
+ if (month < 1 || month > 12 || day < 1 || day > 31 || hour > 23 || minute > 59 || second > 59 || date.getFullYear() !== year || date.getMonth() !== month - 1 || date.getDate() !== day || date.getHours() !== hour || date.getMinutes() !== minute || date.getSeconds() !== second) {
144
+ return undefined;
145
+ }
146
+ return date;
147
+ };
148
+ const recordNameFor = date => `${date.getFullYear().toString().padStart(4, "0")}${(date.getMonth() + 1).toString().padStart(2, "0")}${date.getDate().toString().padStart(2, "0")}${date.getHours().toString().padStart(2, "0")}${date.getMinutes().toString().padStart(2, "0")}${date.getSeconds().toString().padStart(2, "0")}`;
149
+ const parseCheckmeBloodPressureRecords = bytes => {
150
+ const records = [];
151
+ for (let offset = 0; offset + 11 <= bytes.length; offset += 11) {
152
+ const recordedAt = dateFrom(bytes.slice(offset, offset + 11));
153
+ if (!recordedAt) {
154
+ continue;
155
+ }
156
+ records.push({
157
+ recordedAt,
158
+ recordName: recordNameFor(recordedAt),
159
+ systolic: littleEndian16(bytes, offset + 7),
160
+ diastolic: (0, _hexToByte.hexToByte)(bytes[offset + 9] ?? "00"),
161
+ heartRate: (0, _hexToByte.hexToByte)(bytes[offset + 10] ?? "00")
162
+ });
163
+ }
164
+ return records;
165
+ };
166
+ exports.parseCheckmeBloodPressureRecords = parseCheckmeBloodPressureRecords;
167
+ const parseCheckmeDailyRecords = bytes => {
168
+ const records = [];
169
+ for (let offset = 0; offset + 17 <= bytes.length; offset += 17) {
170
+ const recordedAt = dateFrom(bytes.slice(offset, offset + 17));
171
+ if (!recordedAt) {
172
+ continue;
173
+ }
174
+ const diastolic = (0, _hexToByte.hexToByte)(bytes[offset + 13] ?? "ff");
175
+ const systolic = (0, _hexToByte.hexToByte)(bytes[offset + 14] ?? "ff");
176
+ records.push({
177
+ recordedAt,
178
+ recordName: recordNameFor(recordedAt),
179
+ heartRate: littleEndian16(bytes, offset + 7),
180
+ bloodOxygen: (0, _hexToByte.hexToByte)(bytes[offset + 10] ?? "00"),
181
+ ...(systolic !== 0xff && diastolic > 0 && diastolic !== 0xff ? {
182
+ systolic,
183
+ diastolic
184
+ } : {})
185
+ });
186
+ }
187
+ return records;
188
+ };
189
+ exports.parseCheckmeDailyRecords = parseCheckmeDailyRecords;
190
+ const parseCheckmeOxygenRecords = bytes => {
191
+ const records = [];
192
+ for (let offset = 0; offset + 12 <= bytes.length; offset += 12) {
193
+ const recordedAt = dateFrom(bytes.slice(offset, offset + 12));
194
+ if (!recordedAt) {
195
+ continue;
196
+ }
197
+ records.push({
198
+ recordedAt,
199
+ recordName: recordNameFor(recordedAt),
200
+ bloodOxygen: (0, _hexToByte.hexToByte)(bytes[offset + 8] ?? "00"),
201
+ heartRate: (0, _hexToByte.hexToByte)(bytes[offset + 9] ?? "00"),
202
+ perfusionIndex: (0, _hexToByte.hexToByte)(bytes[offset + 10] ?? "00") / 10
203
+ });
204
+ }
205
+ return records;
206
+ };
207
+ exports.parseCheckmeOxygenRecords = parseCheckmeOxygenRecords;
208
+ const parseCheckmeTemperatureRecords = bytes => {
209
+ const records = [];
210
+ for (let offset = 0; offset + 11 <= bytes.length; offset += 11) {
211
+ const recordedAt = dateFrom(bytes.slice(offset, offset + 11));
212
+ if (!recordedAt) {
213
+ continue;
214
+ }
215
+ records.push({
216
+ recordedAt,
217
+ recordName: recordNameFor(recordedAt),
218
+ temperature: littleEndian16(bytes, offset + 8) / 10
219
+ });
220
+ }
221
+ return records;
222
+ };
223
+ exports.parseCheckmeTemperatureRecords = parseCheckmeTemperatureRecords;
224
+ const parseCheckmeEcgRecords = bytes => {
225
+ const records = [];
226
+ for (let offset = 0; offset + 10 <= bytes.length; offset += 10) {
227
+ const recordedAt = dateFrom(bytes.slice(offset, offset + 10));
228
+ if (recordedAt) {
229
+ records.push({
230
+ recordedAt,
231
+ recordName: recordNameFor(recordedAt),
232
+ result: (0, _hexToByte.hexToByte)(bytes[offset + 8] ?? "00")
233
+ });
234
+ }
235
+ }
236
+ return records;
237
+ };
238
+ exports.parseCheckmeEcgRecords = parseCheckmeEcgRecords;
239
+ /** Decodes Checkme's 21-byte ECG header and little-endian signed waveform. */
240
+ const decodeCheckmeEcgFile = bytes => {
241
+ if (bytes.length < 21) {
242
+ return undefined;
243
+ }
244
+ const heartRate = littleEndian16(bytes, 6);
245
+ const recordingBytes = littleEndian16(bytes, 0);
246
+ const waveBytes = ((0, _hexToByte.hexToByte)(bytes[2] ?? "00") | (0, _hexToByte.hexToByte)(bytes[3] ?? "00") << 8 | (0, _hexToByte.hexToByte)(bytes[4] ?? "00") << 16 | (0, _hexToByte.hexToByte)(bytes[5] ?? "00") << 24) >>> 0;
247
+ const waveStart = 21 + recordingBytes;
248
+ const waveEnd = Math.min(bytes.length, waveStart + waveBytes);
249
+ const diagramPoints = [];
250
+ for (let offset = waveStart; offset + 1 < waveEnd; offset += 2) {
251
+ const raw = littleEndian16(bytes, offset);
252
+ const signed = raw & 0x8000 ? raw - 0x10000 : raw;
253
+ diagramPoints.push(signed * 4033 / 3145632);
254
+ }
255
+ return {
256
+ heartRate,
257
+ duration: recordingBytes / 2,
258
+ diagnosticResult: (0, _hexToByte.hexToByte)(bytes[16] ?? "00"),
259
+ diagramPoints
260
+ };
261
+ };
262
+ exports.decodeCheckmeEcgFile = decodeCheckmeEcgFile;
263
+ //# sourceMappingURL=checkme.protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_frameReadStatus","require","_calculateCrc","_hexToByte","CHECKME_SERVICE","exports","CHECKME_WRITE","CHECKME_NOTIFY","CheckmeCommand","info","ping","syncParameters","readStart","readContent","readEnd","CheckmeListType","daily","ecg","oxygen","bloodPressure","temperature","user","byte","value","toString","padStart","littleEndian16","bytes","offset","hexToByte","frame","command","payload","length","result","calculateCrc8","checkmeCommand","checkmeReadFileStart","name","map","character","charCodeAt","checkmeReadContent","sequence","checkmeReadEnd","decodeCheckmeResponse","head","undefined","state","content","slice","CheckmeFrameReader","readFrame","buffer","start","findStart","status","FrameReadStatus","INCOMPLETE","consumedBytes","Math","max","frameLength","CORRUPT","hasValidChecksum","COMPLETE","index","checksum","at","dateFrom","year","month","day","hour","minute","second","date","Date","getFullYear","getMonth","getDate","getHours","getMinutes","getSeconds","recordNameFor","parseCheckmeBloodPressureRecords","records","recordedAt","push","recordName","systolic","diastolic","heartRate","parseCheckmeDailyRecords","bloodOxygen","parseCheckmeOxygenRecords","perfusionIndex","parseCheckmeTemperatureRecords","parseCheckmeEcgRecords","decodeCheckmeEcgFile","recordingBytes","waveBytes","waveStart","waveEnd","min","diagramPoints","raw","signed","duration","diagnosticResult"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/checkme/checkme.protocol.ts"],"mappings":";;;;;;AAGA,IAAAA,gBAAA,GAAAC,OAAA;AAEA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AANA;;AAQO,MAAMG,eAAe,GAAAC,OAAA,CAAAD,eAAA,GAAG,sCAAsC;AAC9D,MAAME,aAAa,GAAAD,OAAA,CAAAC,aAAA,GAAG,sCAAsC;AAC5D,MAAMC,cAAc,GAAAF,OAAA,CAAAE,cAAA,GAAG,sCAAsC;AAE7D,MAAMC,cAAc,GAAAH,OAAA,CAAAG,cAAA,GAAG;EAC5BC,IAAI,EAAE,IAAI;EACVC,IAAI,EAAE,IAAI;EACVC,cAAc,EAAE,IAAI;EACpBC,SAAS,EAAE,IAAI;EACfC,WAAW,EAAE,IAAI;EACjBC,OAAO,EAAE;AACX,CAAU;AAEH,MAAMC,eAAe,GAAAV,OAAA,CAAAU,eAAA,GAAG;EAC7BC,KAAK,EAAE,CAAC;EACRC,GAAG,EAAE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G,GAAG,OAAO,GAAGA,GAAG;IAEjDD,aAAa,CAACjB,IAAI,CAAEmB,MAAM,GAAG,IAAI,GAAI,OAAO,CAAC;EAC/C;EAEA,OAAO;IACLf,SAAS;IACTgB,QAAQ,EAAER,cAAc,GAAG,CAAC;IAC5BS,gBAAgB,EAAE,IAAAhF,oBAAS,EAACF,KAAK,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC;IAC9C8E;EACF,CAAC;AACH,CAAC;AAACpG,OAAA,CAAA8F,oBAAA,GAAAA,oBAAA","ignoreList":[]}
@@ -0,0 +1,255 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "CheckmeListType", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _checkmeProtocol.CheckmeListType;
10
+ }
11
+ });
12
+ exports.CheckmeProSequencer = void 0;
13
+ var _core = require("@ovok/core");
14
+ var _caseType = require("../../../types/case-type.js");
15
+ var _checkmeProtocol = require("./checkme.protocol.js");
16
+ /* eslint-disable import/group-exports, max-lines */
17
+
18
+ const READ_TIMEOUT_MS = 5_000;
19
+ const MAX_RETRIES = 2;
20
+ const le32 = bytes => (Number.parseInt(bytes[0] ?? "00", 16) | Number.parseInt(bytes[1] ?? "00", 16) << 8 | Number.parseInt(bytes[2] ?? "00", 16) << 16 | Number.parseInt(bytes[3] ?? "00", 16) << 24) >>> 0;
21
+ const command = (write, frame) => ({
22
+ ...write,
23
+ frame,
24
+ withoutResponse: true
25
+ });
26
+ const valid = value => Number.isFinite(value) && value > 0;
27
+ const recordedAtFromName = name => {
28
+ const digits = name.replace(/\D/g, "");
29
+ if (digits.length < 14) {
30
+ return undefined;
31
+ }
32
+ const date = new Date(Number(digits.slice(0, 4)), Number(digits.slice(4, 6)) - 1, Number(digits.slice(6, 8)), Number(digits.slice(8, 10)), Number(digits.slice(10, 12)), Number(digits.slice(12, 14)));
33
+ return Number.isNaN(date.getTime()) ? undefined : date;
34
+ };
35
+
36
+ /**
37
+ * Downloads Checkme Pro history using the command exchange in ViHealth's CheckmeBleInterface.
38
+ * The device returns list records first; the daily list and ECG list then point to waveform
39
+ * files, which are read with the same offset-based transfer.
40
+ */
41
+ class CheckmeProSequencer {
42
+ phase = "info";
43
+ queue = [];
44
+ content = [];
45
+ expectedBytes = 0;
46
+ sequence = 0;
47
+ retries = 0;
48
+ reported = new Set();
49
+ constructor(params) {
50
+ this.params = params;
51
+ }
52
+ initialCommands = () => this.remember(checkmeCommandFor(this.params.write, _checkmeProtocol.CheckmeCommand.info));
53
+ isHistoryTransfer = () => true;
54
+ commandTimeoutMs = () => this.phase === "done" ? undefined : READ_TIMEOUT_MS;
55
+ onCommandTimeout = () => {
56
+ if (!this.lastCommand || this.retries >= MAX_RETRIES) {
57
+ this.phase = "done";
58
+ return {
59
+ terminal: true
60
+ };
61
+ }
62
+ this.retries += 1;
63
+ return {
64
+ commands: [this.lastCommand]
65
+ };
66
+ };
67
+ isNormalDisconnect = () => this.phase === "done";
68
+ nextCommand = frame => {
69
+ const response = (0, _checkmeProtocol.decodeCheckmeResponse)(frame);
70
+ if (!response || !response.state || this.phase === "done") {
71
+ return undefined;
72
+ }
73
+ this.retries = 0;
74
+ if (this.phase === "info") {
75
+ this.queue = [{
76
+ name: "usr.dat",
77
+ kind: "users"
78
+ }];
79
+ return this.startNextFile();
80
+ }
81
+ if (this.phase === "start") {
82
+ this.expectedBytes = le32(response.content);
83
+ this.content = [];
84
+ this.sequence = 0;
85
+ this.phase = "content";
86
+ return this.expectedBytes > 0 ? this.remember(this.write((0, _checkmeProtocol.checkmeReadContent)(this.sequence))) : this.finishFile();
87
+ }
88
+ if (this.phase === "content") {
89
+ this.content.push(...response.content);
90
+ if (this.content.length < this.expectedBytes) {
91
+ this.sequence += 1;
92
+ return this.remember(this.write((0, _checkmeProtocol.checkmeReadContent)(this.sequence)));
93
+ }
94
+ return this.finishFile();
95
+ }
96
+ return this.finishCurrentFile();
97
+ };
98
+ write = frame => command(this.params.write, frame);
99
+ remember = next => {
100
+ this.lastCommand = next;
101
+ return [next];
102
+ };
103
+ startNextFile = () => {
104
+ const next = this.queue.shift();
105
+ if (!next) {
106
+ this.phase = "done";
107
+ return undefined;
108
+ }
109
+ this.current = next;
110
+ this.phase = "start";
111
+ return this.remember(this.write((0, _checkmeProtocol.checkmeReadFileStart)(next.name)));
112
+ };
113
+ finishFile = () => {
114
+ this.phase = "end";
115
+ return this.remember(this.write((0, _checkmeProtocol.checkmeReadEnd)()));
116
+ };
117
+ finishCurrentFile = () => {
118
+ if (this.current) {
119
+ this.processFile(this.current, this.content);
120
+ }
121
+ return this.startNextFile();
122
+ };
123
+ processFile = (file, bytes) => {
124
+ switch (file.kind) {
125
+ case "users":
126
+ this.queue = this.filePlan(bytes);
127
+ return;
128
+ case "daily":
129
+ this.processDaily(bytes);
130
+ return;
131
+ case "ecg-list":
132
+ this.queue.unshift(...(0, _checkmeProtocol.parseCheckmeEcgRecords)(bytes).map(record => ({
133
+ name: record.recordName,
134
+ kind: "ecg-file"
135
+ })));
136
+ return;
137
+ case "oxygen":
138
+ (0, _checkmeProtocol.parseCheckmeOxygenRecords)(bytes).forEach(record => {
139
+ this.reportOnce(`${_core.MeasurementTypeKey.bloodOxygenPulseRate}:${record.recordName}`, {
140
+ measurementTypeKey: _core.MeasurementTypeKey.bloodOxygenPulseRate,
141
+ bloodOxygen: record.bloodOxygen,
142
+ pulseRate: record.heartRate,
143
+ perfusionIndex: record.perfusionIndex,
144
+ recordedAt: record.recordedAt
145
+ });
146
+ });
147
+ return;
148
+ case "blood-pressure":
149
+ (0, _checkmeProtocol.parseCheckmeBloodPressureRecords)(bytes).forEach(record => {
150
+ this.reportOnce(`${_core.MeasurementTypeKey.bloodPressure}:${record.recordName}`, {
151
+ measurementTypeKey: _core.MeasurementTypeKey.bloodPressure,
152
+ systolic: record.systolic,
153
+ diastolic: record.diastolic,
154
+ heartRate: record.heartRate,
155
+ recordedAt: record.recordedAt
156
+ });
157
+ });
158
+ return;
159
+ case "temperature":
160
+ (0, _checkmeProtocol.parseCheckmeTemperatureRecords)(bytes).forEach(record => {
161
+ this.reportOnce(`${_core.MeasurementTypeKey.temperature}:${record.recordName}`, {
162
+ measurementTypeKey: _core.MeasurementTypeKey.temperature,
163
+ bodyTemp: record.temperature,
164
+ recordedAt: record.recordedAt
165
+ });
166
+ });
167
+ return;
168
+ case "ecg-file":
169
+ {
170
+ const recording = (0, _checkmeProtocol.decodeCheckmeEcgFile)(bytes);
171
+ if (recording && recording.diagramPoints.length > 0) {
172
+ this.reportOnce(`${_core.MeasurementTypeKey.ecg}:${file.name}`, {
173
+ measurementTypeKey: _core.MeasurementTypeKey.ecg,
174
+ heartRate: recording.heartRate,
175
+ duration: recording.duration,
176
+ diagramPoints: recording.diagramPoints,
177
+ recordedAt: recordedAtFromName(file.name)
178
+ });
179
+ }
180
+ }
181
+ }
182
+ };
183
+ processDaily = bytes => {
184
+ const records = (0, _checkmeProtocol.parseCheckmeDailyRecords)(bytes);
185
+ records.forEach(record => {
186
+ if (valid(record.heartRate)) {
187
+ this.reportOnce(`${_core.MeasurementTypeKey.heartRate}:${record.recordName}`, {
188
+ measurementTypeKey: _core.MeasurementTypeKey.heartRate,
189
+ heartRate: record.heartRate,
190
+ recordedAt: record.recordedAt
191
+ });
192
+ }
193
+ if (valid(record.bloodOxygen)) {
194
+ this.reportOnce(`${_core.MeasurementTypeKey.bloodOxygenPulseRate}:${record.recordName}`, {
195
+ measurementTypeKey: _core.MeasurementTypeKey.bloodOxygenPulseRate,
196
+ bloodOxygen: record.bloodOxygen,
197
+ recordedAt: record.recordedAt
198
+ });
199
+ }
200
+ if (record.systolic && record.diastolic) {
201
+ this.reportOnce(`${_core.MeasurementTypeKey.bloodPressure}:${record.recordName}`, {
202
+ measurementTypeKey: _core.MeasurementTypeKey.bloodPressure,
203
+ systolic: record.systolic,
204
+ diastolic: record.diastolic,
205
+ recordedAt: record.recordedAt
206
+ });
207
+ }
208
+ });
209
+ };
210
+ filePlan = bytes => {
211
+ const userIds = new Set();
212
+ for (let offset = 0; offset + 27 <= bytes.length; offset += 27) {
213
+ const id = Number.parseInt(bytes[offset] ?? "00", 16);
214
+ if (Number.isInteger(id)) {
215
+ userIds.add(id);
216
+ }
217
+ }
218
+ const ids = [...userIds];
219
+ const plan = [];
220
+ ids.forEach(id => {
221
+ plan.push({
222
+ name: `${id}dlc.dat`,
223
+ kind: "daily"
224
+ });
225
+ plan.push({
226
+ name: `${id}nibp.dat`,
227
+ kind: "blood-pressure"
228
+ });
229
+ });
230
+ plan.push({
231
+ name: "ecg.dat",
232
+ kind: "ecg-list"
233
+ }, {
234
+ name: "oxi.dat",
235
+ kind: "oxygen"
236
+ }, {
237
+ name: "tmp.dat",
238
+ kind: "temperature"
239
+ });
240
+ return plan;
241
+ };
242
+ reportOnce = (key, measurement) => {
243
+ if (this.reported.has(key)) {
244
+ return;
245
+ }
246
+ this.reported.add(key);
247
+ this.params.onResult({
248
+ ...measurement,
249
+ caseType: _caseType.CaseType.RESULT
250
+ });
251
+ };
252
+ }
253
+ exports.CheckmeProSequencer = CheckmeProSequencer;
254
+ const checkmeCommandFor = (write, commandCode) => command(write, (0, _checkmeProtocol.checkmeCommand)(commandCode));
255
+ //# sourceMappingURL=checkme.sequencer.js.map