@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.
- package/lib/commonjs/modules/bt-device/constants/device-instruction-pdfs.js +4 -1
- package/lib/commonjs/modules/bt-device/constants/device-instruction-pdfs.js.map +1 -1
- package/lib/commonjs/modules/bt-device/constants/supported-device-catalog-assets.js +3 -1
- package/lib/commonjs/modules/bt-device/constants/supported-device-catalog-assets.js.map +1 -1
- package/lib/commonjs/modules/bt-device/constants/supported-device-catalog-entries.js +1 -1
- package/lib/commonjs/modules/bt-device/constants/supported-device-catalog-entries.js.map +1 -1
- package/lib/commonjs/modules/bt-device/constants/supported-devices.js +25 -0
- package/lib/commonjs/modules/bt-device/constants/supported-devices.js.map +1 -1
- package/lib/commonjs/modules/bt-management/constants/integrated-devices-map.js +2 -1
- package/lib/commonjs/modules/bt-management/constants/integrated-devices-map.js.map +1 -1
- package/lib/commonjs/modules/bt-management/index.js +77 -0
- package/lib/commonjs/modules/bt-management/index.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/background-sync/background-service-uuids.js +4 -0
- package/lib/commonjs/modules/bt-management/services/background-sync/background-service-uuids.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/device-creator.js +7 -1
- package/lib/commonjs/modules/bt-management/services/device-creator.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/a606/a606.command-sequencer.js +68 -0
- package/lib/commonjs/modules/bt-management/services/devices/a606/a606.command-sequencer.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/a606/a606.device.js +55 -0
- package/lib/commonjs/modules/bt-management/services/devices/a606/a606.device.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/a606/a606.frame-parser.js +36 -0
- package/lib/commonjs/modules/bt-management/services/devices/a606/a606.frame-parser.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/a606/a606.frame-reader.js +68 -0
- package/lib/commonjs/modules/bt-management/services/devices/a606/a606.frame-reader.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/a606/a606.main-services.js +31 -0
- package/lib/commonjs/modules/bt-management/services/devices/a606/a606.main-services.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/bpw1/bpw1.command-sequencer.js +73 -0
- package/lib/commonjs/modules/bt-management/services/devices/bpw1/bpw1.command-sequencer.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/bpw1/bpw1.device.js +55 -0
- package/lib/commonjs/modules/bt-management/services/devices/bpw1/bpw1.device.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/bpw1/bpw1.frame-parser.js +53 -0
- package/lib/commonjs/modules/bt-management/services/devices/bpw1/bpw1.frame-parser.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/bpw1/bpw1.frame-reader.js +55 -0
- package/lib/commonjs/modules/bt-management/services/devices/bpw1/bpw1.frame-reader.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/bpw1/bpw1.main-services.js +30 -0
- package/lib/commonjs/modules/bt-management/services/devices/bpw1/bpw1.main-services.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/checkme/checkme.device.js +57 -0
- package/lib/commonjs/modules/bt-management/services/devices/checkme/checkme.device.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/checkme/checkme.protocol.js +263 -0
- package/lib/commonjs/modules/bt-management/services/devices/checkme/checkme.protocol.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/checkme/checkme.sequencer.js +255 -0
- package/lib/commonjs/modules/bt-management/services/devices/checkme/checkme.sequencer.js.map +1 -0
- package/lib/commonjs/modules/bt-management/types/clock-sync.js +1 -0
- package/lib/commonjs/modules/bt-management/types/clock-sync.js.map +1 -1
- package/lib/commonjs/modules/bt-management/types/integrated-devices.js +3 -0
- package/lib/commonjs/modules/bt-management/types/integrated-devices.js.map +1 -1
- package/lib/module/modules/bt-device/constants/device-instruction-pdfs.js +4 -1
- package/lib/module/modules/bt-device/constants/device-instruction-pdfs.js.map +1 -1
- package/lib/module/modules/bt-device/constants/supported-device-catalog-assets.js +3 -1
- package/lib/module/modules/bt-device/constants/supported-device-catalog-assets.js.map +1 -1
- package/lib/module/modules/bt-device/constants/supported-device-catalog-entries.js +1 -1
- package/lib/module/modules/bt-device/constants/supported-device-catalog-entries.js.map +1 -1
- package/lib/module/modules/bt-device/constants/supported-devices.js +26 -1
- package/lib/module/modules/bt-device/constants/supported-devices.js.map +1 -1
- package/lib/module/modules/bt-management/constants/integrated-devices-map.js +2 -1
- package/lib/module/modules/bt-management/constants/integrated-devices-map.js.map +1 -1
- package/lib/module/modules/bt-management/index.js +7 -0
- package/lib/module/modules/bt-management/index.js.map +1 -1
- package/lib/module/modules/bt-management/services/background-sync/background-service-uuids.js +4 -0
- package/lib/module/modules/bt-management/services/background-sync/background-service-uuids.js.map +1 -1
- package/lib/module/modules/bt-management/services/device-creator.js +7 -1
- package/lib/module/modules/bt-management/services/device-creator.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/a606/a606.command-sequencer.js +61 -0
- package/lib/module/modules/bt-management/services/devices/a606/a606.command-sequencer.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/a606/a606.device.js +45 -0
- package/lib/module/modules/bt-management/services/devices/a606/a606.device.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/a606/a606.frame-parser.js +32 -0
- package/lib/module/modules/bt-management/services/devices/a606/a606.frame-parser.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/a606/a606.frame-reader.js +63 -0
- package/lib/module/modules/bt-management/services/devices/a606/a606.frame-reader.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/a606/a606.main-services.js +28 -0
- package/lib/module/modules/bt-management/services/devices/a606/a606.main-services.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/bpw1/bpw1.command-sequencer.js +66 -0
- package/lib/module/modules/bt-management/services/devices/bpw1/bpw1.command-sequencer.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/bpw1/bpw1.device.js +45 -0
- package/lib/module/modules/bt-management/services/devices/bpw1/bpw1.device.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/bpw1/bpw1.frame-parser.js +48 -0
- package/lib/module/modules/bt-management/services/devices/bpw1/bpw1.frame-parser.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/bpw1/bpw1.frame-reader.js +50 -0
- package/lib/module/modules/bt-management/services/devices/bpw1/bpw1.frame-reader.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/bpw1/bpw1.main-services.js +26 -0
- package/lib/module/modules/bt-management/services/devices/bpw1/bpw1.main-services.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/checkme/checkme.device.js +53 -0
- package/lib/module/modules/bt-management/services/devices/checkme/checkme.device.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/checkme/checkme.protocol.js +247 -0
- package/lib/module/modules/bt-management/services/devices/checkme/checkme.protocol.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/checkme/checkme.sequencer.js +245 -0
- package/lib/module/modules/bt-management/services/devices/checkme/checkme.sequencer.js.map +1 -0
- package/lib/module/modules/bt-management/types/clock-sync.js +1 -0
- package/lib/module/modules/bt-management/types/clock-sync.js.map +1 -1
- package/lib/module/modules/bt-management/types/device-measurement-map.js.map +1 -1
- package/lib/module/modules/bt-management/types/integrated-devices.js +3 -0
- package/lib/module/modules/bt-management/types/integrated-devices.js.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-device/constants/device-instruction-pdfs.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-device/constants/supported-device-catalog-assets.d.ts +3 -1
- package/lib/typescript/commonjs/src/modules/bt-device/constants/supported-device-catalog-assets.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-device/constants/supported-device-catalog-entries.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-device/constants/supported-devices.d.ts +7 -0
- package/lib/typescript/commonjs/src/modules/bt-device/constants/supported-devices.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/constants/integrated-devices-map.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/index.d.ts +7 -0
- package/lib/typescript/commonjs/src/modules/bt-management/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/background-sync/background-service-uuids.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/device-creator.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/a606/a606.command-sequencer.d.ts +22 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/a606/a606.command-sequencer.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/a606/a606.device.d.ts +24 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/a606/a606.device.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/a606/a606.frame-parser.d.ts +10 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/a606/a606.frame-parser.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/a606/a606.frame-reader.d.ts +9 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/a606/a606.frame-reader.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/a606/a606.main-services.d.ts +4 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/a606/a606.main-services.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bpw1/bpw1.command-sequencer.d.ts +21 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bpw1/bpw1.command-sequencer.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bpw1/bpw1.device.d.ts +22 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bpw1/bpw1.device.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bpw1/bpw1.frame-parser.d.ts +9 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bpw1/bpw1.frame-parser.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bpw1/bpw1.frame-reader.d.ts +8 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bpw1/bpw1.frame-reader.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bpw1/bpw1.main-services.d.ts +4 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bpw1/bpw1.main-services.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/checkme/checkme.device.d.ts +18 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/checkme/checkme.device.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/checkme/checkme.protocol.d.ts +79 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/checkme/checkme.protocol.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/checkme/checkme.sequencer.d.ts +52 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/checkme/checkme.sequencer.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/clock-sync.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/device-measurement-map.d.ts +8 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/device-measurement-map.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/integrated-devices.d.ts +4 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/integrated-devices.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-device/constants/device-instruction-pdfs.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-device/constants/supported-device-catalog-assets.d.ts +3 -1
- package/lib/typescript/module/src/modules/bt-device/constants/supported-device-catalog-assets.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-device/constants/supported-device-catalog-entries.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-device/constants/supported-devices.d.ts +7 -0
- package/lib/typescript/module/src/modules/bt-device/constants/supported-devices.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/constants/integrated-devices-map.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/index.d.ts +7 -0
- package/lib/typescript/module/src/modules/bt-management/index.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/background-sync/background-service-uuids.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/device-creator.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/a606/a606.command-sequencer.d.ts +22 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/a606/a606.command-sequencer.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/a606/a606.device.d.ts +24 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/a606/a606.device.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/a606/a606.frame-parser.d.ts +10 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/a606/a606.frame-parser.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/a606/a606.frame-reader.d.ts +9 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/a606/a606.frame-reader.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/a606/a606.main-services.d.ts +4 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/a606/a606.main-services.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/bpw1/bpw1.command-sequencer.d.ts +21 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/bpw1/bpw1.command-sequencer.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/bpw1/bpw1.device.d.ts +22 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/bpw1/bpw1.device.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/bpw1/bpw1.frame-parser.d.ts +9 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/bpw1/bpw1.frame-parser.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/bpw1/bpw1.frame-reader.d.ts +8 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/bpw1/bpw1.frame-reader.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/bpw1/bpw1.main-services.d.ts +4 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/bpw1/bpw1.main-services.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/checkme/checkme.device.d.ts +18 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/checkme/checkme.device.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/checkme/checkme.protocol.d.ts +79 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/checkme/checkme.protocol.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/checkme/checkme.sequencer.d.ts +52 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/checkme/checkme.sequencer.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/types/clock-sync.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/types/device-measurement-map.d.ts +8 -0
- package/lib/typescript/module/src/modules/bt-management/types/device-measurement-map.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/types/integrated-devices.d.ts +4 -1
- package/lib/typescript/module/src/modules/bt-management/types/integrated-devices.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["MeasurementTypeKey","CaseType","BTManagedDevice","A606CommandSequencer","parseA606Record","A606FrameReader","a606MainServices","A606Device","mainServices","stuckDataTimeout","onStreamStart","undefined","frameReader","constructor","device","params","createCommandSequencer","clockSync","handleDependentResult","data","frame","record","onResult","caseType","RESULT","measurementTypeKey","bloodGlucose","recordedAt","parsingCase","OTHER","handleSuccessResult"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/a606/a606.device.ts"],"mappings":";;AAAA,SAAkCA,kBAAkB,QAAQ,YAAY;AAGxE,SAASC,QAAQ,QAAQ,6BAA0B;AAQnD,SAASC,eAAe,QAAQ,yBAAsB;AAEtD,SAASC,oBAAoB,QAAQ,6BAA0B;AAC/D,SAASC,eAAe,QAAQ,wBAAqB;AACrD,SAASC,eAAe,QAAQ,wBAAqB;AACrD,SAASC,gBAAgB,QAAQ,yBAAsB;AAMvD;AACA,MAAMC,UAAU,SAASL,eAAe,CAA+B;EAC3DM,YAAY,GAAeF,gBAAgB;EAC3CG,gBAAgB,GAAG,OAAO;EAC1BC,aAAa,GAAGC,SAAS;EACzBC,WAAW,GAAG,IAAIP,eAAe,CAAC,CAAC;EAEtCQ,WAAWA,CAChBC,MAAc,EACdC,MAAwD,EACxD;IACA,KAAK,CAACD,MAAM,EAAEC,MAAM,CAAC;IACrB,IAAI,CAACC,sBAAsB,GAAG,MAC5B,IAAIb,oBAAoB,CAACY,MAAM,CAACE,SAAS,CAAC;EAC9C;EAEUC,qBAAqB,GAC7BC,IAAmD,IACD;IAClD,IAAIA,IAAI,CAACC,KAAK,EAAE;MACd,MAAMC,MAAM,GAAGjB,eAAe,CAACe,IAAI,CAACC,KAAK,CAAC;MAE1C,IAAIC,MAAM,EAAE;QACV,IAAI,CAACC,QAAQ,GAAG;UACdC,QAAQ,EAAEtB,QAAQ,CAACuB,MAAM;UACzBC,kBAAkB,EAAEzB,kBAAkB,CAAC0B,YAAY;UACnDA,YAAY,EAAEL,MAAM,CAACK,YAAY;UACjCC,UAAU,EAAEN,MAAM,CAACM;QACrB,CAAwE,CAAC;MAC3E;IACF;IAEA,OAAO;MACL,GAAGR,IAAI;MACPS,WAAW,EAAE;QAAE,GAAGT,IAAI,CAACS,WAAW;QAAEL,QAAQ,EAAEtB,QAAQ,CAAC4B;MAAM;IAC/D,CAAC;EACH,CAAC;EAESC,mBAAmBA,CAAA,EAAmB;IAC9C;EACF;AACF;AAEA,SAASvB,UAAU,EAAED,gBAAgB","ignoreList":[]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { hexToByte } from "../../../utils/hex-to-byte.js";
|
|
4
|
+
const bigEndian = (frame, from) => (hexToByte(frame[from] ?? "00") << 8) + hexToByte(frame[from + 1] ?? "00");
|
|
5
|
+
|
|
6
|
+
/** Decodes the 12-byte glucose payload inside a verified 16-byte ZH-SG record. */
|
|
7
|
+
const parseA606Record = frame => {
|
|
8
|
+
if (frame.length < 16 || hexToByte(frame[0] ?? "00") !== 0x26 || hexToByte(frame[1] ?? "00") !== 0x44 || hexToByte(frame[2] ?? "00") !== 0x45) {
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
const year = 2000 + hexToByte(frame[8] ?? "00");
|
|
12
|
+
const month = hexToByte(frame[9] ?? "00");
|
|
13
|
+
const day = hexToByte(frame[10] ?? "00");
|
|
14
|
+
const hour = hexToByte(frame[11] ?? "00");
|
|
15
|
+
const minute = hexToByte(frame[12] ?? "00");
|
|
16
|
+
const second = hexToByte(frame[13] ?? "00");
|
|
17
|
+
const recordedAt = new Date(year, month - 1, day, hour, minute, second, 0);
|
|
18
|
+
if (month < 1 || month > 12 || day < 1 || day > 31 || hour > 23 || minute > 59 || second > 59 || recordedAt.getFullYear() !== year || recordedAt.getMonth() !== month - 1 || recordedAt.getDate() !== day || recordedAt.getHours() !== hour || recordedAt.getMinutes() !== minute || recordedAt.getSeconds() !== second) {
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
const bloodGlucose = bigEndian(frame, 6);
|
|
22
|
+
if (bloodGlucose === 0) {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
bloodGlucose,
|
|
27
|
+
recordedAt,
|
|
28
|
+
dataPosition: bigEndian(frame, 4)
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export { parseA606Record };
|
|
32
|
+
//# sourceMappingURL=a606.frame-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["hexToByte","bigEndian","frame","from","parseA606Record","length","undefined","year","month","day","hour","minute","second","recordedAt","Date","getFullYear","getMonth","getDate","getHours","getMinutes","getSeconds","bloodGlucose","dataPosition"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/a606/a606.frame-parser.ts"],"mappings":";;AAAA,SAASA,SAAS,QAAQ,+BAA4B;AAQtD,MAAMC,SAAS,GAAGA,CAACC,KAAwB,EAAEC,IAAY,KACvD,CAACH,SAAS,CAACE,KAAK,CAACC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAIH,SAAS,CAACE,KAAK,CAACC,IAAI,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC;;AAE5E;AACA,MAAMC,eAAe,GAAIF,KAAwB,IAA6B;EAC5E,IACEA,KAAK,CAACG,MAAM,GAAG,EAAE,IACjBL,SAAS,CAACE,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,IAAI,IACpCF,SAAS,CAACE,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,IAAI,IACpCF,SAAS,CAACE,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,IAAI,EACpC;IACA,OAAOI,SAAS;EAClB;EAEA,MAAMC,IAAI,GAAG,IAAI,GAAGP,SAAS,CAACE,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;EAC/C,MAAMM,KAAK,GAAGR,SAAS,CAACE,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;EACzC,MAAMO,GAAG,GAAGT,SAAS,CAACE,KAAK,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC;EACxC,MAAMQ,IAAI,GAAGV,SAAS,CAACE,KAAK,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC;EACzC,MAAMS,MAAM,GAAGX,SAAS,CAACE,KAAK,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC;EAC3C,MAAMU,MAAM,GAAGZ,SAAS,CAACE,KAAK,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC;EAC3C,MAAMW,UAAU,GAAG,IAAIC,IAAI,CAACP,IAAI,EAAEC,KAAK,GAAG,CAAC,EAAEC,GAAG,EAAEC,IAAI,EAAEC,MAAM,EAAEC,MAAM,EAAE,CAAC,CAAC;EAE1E,IACEJ,KAAK,GAAG,CAAC,IACTA,KAAK,GAAG,EAAE,IACVC,GAAG,GAAG,CAAC,IACPA,GAAG,GAAG,EAAE,IACRC,IAAI,GAAG,EAAE,IACTC,MAAM,GAAG,EAAE,IACXC,MAAM,GAAG,EAAE,IACXC,UAAU,CAACE,WAAW,CAAC,CAAC,KAAKR,IAAI,IACjCM,UAAU,CAACG,QAAQ,CAAC,CAAC,KAAKR,KAAK,GAAG,CAAC,IACnCK,UAAU,CAACI,OAAO,CAAC,CAAC,KAAKR,GAAG,IAC5BI,UAAU,CAACK,QAAQ,CAAC,CAAC,KAAKR,IAAI,IAC9BG,UAAU,CAACM,UAAU,CAAC,CAAC,KAAKR,MAAM,IAClCE,UAAU,CAACO,UAAU,CAAC,CAAC,KAAKR,MAAM,EAClC;IACA,OAAON,SAAS;EAClB;EAEA,MAAMe,YAAY,GAAGpB,SAAS,CAACC,KAAK,EAAE,CAAC,CAAC;EAExC,IAAImB,YAAY,KAAK,CAAC,EAAE;IACtB,OAAOf,SAAS;EAClB;EAEA,OAAO;IACLe,YAAY;IACZR,UAAU;IACVS,YAAY,EAAErB,SAAS,CAACC,KAAK,EAAE,CAAC;EAClC,CAAC;AACH,CAAC;AAED,SAASE,eAAe","ignoreList":[]}
|
|
@@ -0,0 +1,63 @@
|
|
|
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 = 0x26;
|
|
6
|
+
const TYPE_GET = 0x43;
|
|
7
|
+
const TYPE_UPLOAD = 0x44;
|
|
8
|
+
const TYPE_INDEX = 1;
|
|
9
|
+
const CHECKSUM_BYTES = 1;
|
|
10
|
+
|
|
11
|
+
/** Reads the `& C/D ... checksum` frames used by Viatom's ZH-SG glucose protocol. */
|
|
12
|
+
export class A606FrameReader {
|
|
13
|
+
readFrame(buffer) {
|
|
14
|
+
const start = this.findStart(buffer);
|
|
15
|
+
if (start < 0) {
|
|
16
|
+
return {
|
|
17
|
+
status: FrameReadStatus.INCOMPLETE,
|
|
18
|
+
consumedBytes: Math.max(0, buffer.length - 1)
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
const type = hexToByte(buffer[start + TYPE_INDEX] ?? "00");
|
|
22
|
+
const frameLength = type === TYPE_UPLOAD ? 16 : type === TYPE_GET ? 7 : 0;
|
|
23
|
+
if (frameLength === 0) {
|
|
24
|
+
return {
|
|
25
|
+
status: FrameReadStatus.CORRUPT,
|
|
26
|
+
consumedBytes: start + 1
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
if (start + frameLength > buffer.length) {
|
|
30
|
+
return {
|
|
31
|
+
status: FrameReadStatus.INCOMPLETE,
|
|
32
|
+
consumedBytes: start
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
const frame = buffer.slice(start, start + frameLength);
|
|
36
|
+
if (!this.hasValidChecksum(frame)) {
|
|
37
|
+
return {
|
|
38
|
+
status: FrameReadStatus.CORRUPT,
|
|
39
|
+
consumedBytes: start + 1
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
status: FrameReadStatus.COMPLETE,
|
|
44
|
+
consumedBytes: start + frameLength,
|
|
45
|
+
frame
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
findStart(buffer) {
|
|
49
|
+
for (let index = 0; index + 2 < buffer.length; index++) {
|
|
50
|
+
const type = hexToByte(buffer[index + TYPE_INDEX] ?? "00");
|
|
51
|
+
if (hexToByte(buffer[index] ?? "00") === START && (type === TYPE_GET || type === TYPE_UPLOAD)) {
|
|
52
|
+
return index;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return -1;
|
|
56
|
+
}
|
|
57
|
+
hasValidChecksum(frame) {
|
|
58
|
+
const checksumIndex = frame.length - CHECKSUM_BYTES;
|
|
59
|
+
const checksum = frame.slice(0, checksumIndex).reduce((sum, byte) => sum + hexToByte(byte) & 0xff, 0);
|
|
60
|
+
return checksum === hexToByte(frame[checksumIndex] ?? "00");
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=a606.frame-reader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["FrameReadStatus","hexToByte","START","TYPE_GET","TYPE_UPLOAD","TYPE_INDEX","CHECKSUM_BYTES","A606FrameReader","readFrame","buffer","start","findStart","status","INCOMPLETE","consumedBytes","Math","max","length","type","frameLength","CORRUPT","frame","slice","hasValidChecksum","COMPLETE","index","checksumIndex","checksum","reduce","sum","byte"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/a606/a606.frame-reader.ts"],"mappings":";;AACA,SAASA,eAAe,QAAQ,qCAAkC;AAElE,SAASC,SAAS,QAAQ,+BAA4B;AAEtD,MAAMC,KAAK,GAAG,IAAI;AAClB,MAAMC,QAAQ,GAAG,IAAI;AACrB,MAAMC,WAAW,GAAG,IAAI;AACxB,MAAMC,UAAU,GAAG,CAAC;AACpB,MAAMC,cAAc,GAAG,CAAC;;AAExB;AACA,OAAO,MAAMC,eAAe,CAAwB;EAC3CC,SAASA,CAACC,MAAyB,EAAmB;IAC3D,MAAMC,KAAK,GAAG,IAAI,CAACC,SAAS,CAACF,MAAM,CAAC;IAEpC,IAAIC,KAAK,GAAG,CAAC,EAAE;MACb,OAAO;QACLE,MAAM,EAAEZ,eAAe,CAACa,UAAU;QAClCC,aAAa,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IAAIJ,SAAS,CAACQ,MAAM,CAACgB,KAAK,CAAC,IAAI,IAAI,CAAC,KAAKvB,KAAK,KAAKgB,IAAI,KAAKf,QAAQ,IAAIe,IAAI,KAAKd,WAAW,CAAC,EAAE;QAC7F,OAAOqB,KAAK;MACd;IACF;IAEA,OAAO,CAAC,CAAC;EACX;EAEQF,gBAAgBA,CAACF,KAAwB,EAAW;IAC1D,MAAMK,aAAa,GAAGL,KAAK,CAACJ,MAAM,GAAGX,cAAc;IAEnD,MAAMqB,QAAQ,GAAGN,KAAK,CACnBC,KAAK,CAAC,CAAC,EAAEI,aAAa,CAAC,CACvBE,MAAM,CAAC,CAACC,GAAG,EAAEC,IAAI,KAAMD,GAAG,GAAG5B,SAAS,CAAC6B,IAAI,CAAC,GAAI,IAAI,EAAE,CAAC,CAAC;IAE3D,OAAOH,QAAQ,KAAK1B,SAAS,CAACoB,KAAK,CAACK,aAAa,CAAC,IAAI,IAAI,CAAC;EAC7D;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { MeasurementTypeKey } from "@ovok/core";
|
|
4
|
+
import { CaseType } from "../../../types/case-type.js";
|
|
5
|
+
import { A606_NOTIFY, A606_SERVICE, A606_WRITE } from "./a606.command-sequencer.js";
|
|
6
|
+
|
|
7
|
+
/** ZH-SG's fixed GATT profile and its 16-byte stored glucose record. */
|
|
8
|
+
export const a606MainServices = [{
|
|
9
|
+
uuid: A606_SERVICE,
|
|
10
|
+
writeUuid: {
|
|
11
|
+
uuid: A606_WRITE,
|
|
12
|
+
mainCommandUuid: "26440346200120"
|
|
13
|
+
},
|
|
14
|
+
monitorUuids: [{
|
|
15
|
+
uuid: A606_NOTIFY,
|
|
16
|
+
parsingModel: {
|
|
17
|
+
caseValuePosition: [1, 2],
|
|
18
|
+
cases: [{
|
|
19
|
+
caseValue: "4445",
|
|
20
|
+
caseType: CaseType.DEPENDENT,
|
|
21
|
+
measurementTypeKey: MeasurementTypeKey.bloodGlucose,
|
|
22
|
+
minLengthBytes: 16,
|
|
23
|
+
parseDefinitions: []
|
|
24
|
+
}]
|
|
25
|
+
}
|
|
26
|
+
}]
|
|
27
|
+
}];
|
|
28
|
+
//# sourceMappingURL=a606.main-services.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["MeasurementTypeKey","CaseType","A606_NOTIFY","A606_SERVICE","A606_WRITE","a606MainServices","uuid","writeUuid","mainCommandUuid","monitorUuids","parsingModel","caseValuePosition","cases","caseValue","caseType","DEPENDENT","measurementTypeKey","bloodGlucose","minLengthBytes","parseDefinitions"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/a606/a606.main-services.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,YAAY;AAE/C,SAASC,QAAQ,QAAQ,6BAA0B;AAGnD,SAASC,WAAW,EAAEC,YAAY,EAAEC,UAAU,QAAQ,6BAA0B;;AAEhF;AACA,OAAO,MAAMC,gBAA4B,GAAG,CAC1C;EACEC,IAAI,EAAEH,YAAY;EAClBI,SAAS,EAAE;IACTD,IAAI,EAAEF,UAAU;IAChBI,eAAe,EAAE;EACnB,CAAC;EACDC,YAAY,EAAE,CACZ;IACEH,IAAI,EAAEJ,WAAW;IACjBQ,YAAY,EAAE;MACZC,iBAAiB,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;MACzBC,KAAK,EAAE,CACL;QACEC,SAAS,EAAE,MAAM;QACjBC,QAAQ,EAAEb,QAAQ,CAACc,SAAS;QAC5BC,kBAAkB,EAAEhB,kBAAkB,CAACiB,YAAY;QACnDC,cAAc,EAAE,EAAE;QAClBC,gBAAgB,EAAE;MACpB,CAAC;IAEL;EACF,CAAC;AAEL,CAAC,CACF","ignoreList":[]}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { hexToByte } from "../../../utils/hex-to-byte.js";
|
|
4
|
+
const SERVICE = "81eea003-e735-49ec-8a11-7e32cae1e14e";
|
|
5
|
+
const WRITE = "81eea002-e735-49ec-8a11-7e32cae1e14e";
|
|
6
|
+
const FEATURE_TYPE = 0x00;
|
|
7
|
+
const SYNC_TYPE = 0x01;
|
|
8
|
+
const HISTORY_TYPE = 0x03;
|
|
9
|
+
const FRAME_START = "e0";
|
|
10
|
+
const byte = value => (value & 0xff).toString(16).padStart(2, "0");
|
|
11
|
+
const withChecksum = frame => {
|
|
12
|
+
const checksum = frame.reduce((sum, value, index) => index === 3 ? sum : sum + hexToByte(value) & 0xff, 0);
|
|
13
|
+
return [...frame.slice(0, 3), byte(checksum), ...frame.slice(3)];
|
|
14
|
+
};
|
|
15
|
+
const commandFor = (frame, delayBeforeWriteMs) => ({
|
|
16
|
+
serviceUuid: SERVICE,
|
|
17
|
+
characteristicUuid: WRITE,
|
|
18
|
+
frame,
|
|
19
|
+
...(delayBeforeWriteMs === undefined ? {} : {
|
|
20
|
+
delayBeforeWriteMs
|
|
21
|
+
})
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
/** Builds an LHZL command after applying the checksum inserted by the vendor BLE writer. */
|
|
25
|
+
const buildBpw1Command = (type, protocolVersion, key, payload) => {
|
|
26
|
+
const payloadLength = payload.length;
|
|
27
|
+
const frame = [FRAME_START, byte(payloadLength + 5 >> 8), byte(payloadLength + 5), byte(type), byte(protocolVersion), byte(key), byte(payloadLength >> 8), byte(payloadLength), ...payload.map(byte)];
|
|
28
|
+
return withChecksum(frame);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/** Builds the vendor's acknowledgement for one accepted LHZL frame. */
|
|
32
|
+
const buildBpw1Ack = frame => {
|
|
33
|
+
const type = hexToByte(frame[4] ?? "00");
|
|
34
|
+
const protocolVersion = hexToByte(frame[5] ?? "00");
|
|
35
|
+
const key = hexToByte(frame[6] ?? "00");
|
|
36
|
+
return withChecksum(["0e", "00", "06", byte(type), byte(protocolVersion), byte(key), "00", "01", "00"]);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/** ViHealth's initial feature probe for the BPW1 LHZL profile. */
|
|
40
|
+
const buildBpw1FeatureCommand = () => buildBpw1Command(FEATURE_TYPE, 0, 0, [1]);
|
|
41
|
+
|
|
42
|
+
/** Requests all stored health-history packets after the feature reply. */
|
|
43
|
+
const buildBpw1HistoryCommand = protocolVersion => buildBpw1Command(SYNC_TYPE, protocolVersion, 0, [1]);
|
|
44
|
+
|
|
45
|
+
/** Answers the feature probe, then starts the vendor's all-history transfer. */
|
|
46
|
+
class Bpw1CommandSequencer {
|
|
47
|
+
protocolVersion = 0;
|
|
48
|
+
historyRequested = false;
|
|
49
|
+
initialCommands = () => [commandFor(buildBpw1FeatureCommand(), 300)];
|
|
50
|
+
nextCommand = frame => {
|
|
51
|
+
if (frame.length < 7) {
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
const type = hexToByte(frame[4] ?? "00");
|
|
55
|
+
const acknowledgement = commandFor(buildBpw1Ack(frame));
|
|
56
|
+
if (type === FEATURE_TYPE && !this.historyRequested) {
|
|
57
|
+
this.protocolVersion = hexToByte(frame[5] ?? "00");
|
|
58
|
+
this.historyRequested = true;
|
|
59
|
+
return [acknowledgement, commandFor(buildBpw1HistoryCommand(this.protocolVersion))];
|
|
60
|
+
}
|
|
61
|
+
return [acknowledgement];
|
|
62
|
+
};
|
|
63
|
+
isHistoryTransfer = () => true;
|
|
64
|
+
}
|
|
65
|
+
export { Bpw1CommandSequencer, buildBpw1Ack, buildBpw1FeatureCommand, buildBpw1HistoryCommand, SERVICE as BPW1_SERVICE, WRITE as BPW1_WRITE, HISTORY_TYPE as BPW1_HISTORY_TYPE };
|
|
66
|
+
//# sourceMappingURL=bpw1.command-sequencer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["hexToByte","SERVICE","WRITE","FEATURE_TYPE","SYNC_TYPE","HISTORY_TYPE","FRAME_START","byte","value","toString","padStart","withChecksum","frame","checksum","reduce","sum","index","slice","commandFor","delayBeforeWriteMs","serviceUuid","characteristicUuid","undefined","buildBpw1Command","type","protocolVersion","key","payload","payloadLength","length","map","buildBpw1Ack","buildBpw1FeatureCommand","buildBpw1HistoryCommand","Bpw1CommandSequencer","historyRequested","initialCommands","nextCommand","acknowledgement","isHistoryTransfer","BPW1_SERVICE","BPW1_WRITE","BPW1_HISTORY_TYPE"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/bpw1/bpw1.command-sequencer.ts"],"mappings":";;AAEA,SAASA,SAAS,QAAQ,+BAA4B;AAEtD,MAAMC,OAAO,GAAG,sCAAsC;AACtD,MAAMC,KAAK,GAAG,sCAAsC;AACpD,MAAMC,YAAY,GAAG,IAAI;AACzB,MAAMC,SAAS,GAAG,IAAI;AACtB,MAAMC,YAAY,GAAG,IAAI;AACzB,MAAMC,WAAW,GAAG,IAAI;AAExB,MAAMC,IAAI,GAAIC,KAAa,IACzB,CAACA,KAAK,GAAG,IAAI,EAAEC,QAAQ,CAAC,EAAE,CAAC,CAACC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;AAE9C,MAAMC,YAAY,GAAIC,KAAwB,IAAe;EAC3D,MAAMC,QAAQ,GAAGD,KAAK,CAACE,MAAM,CAC3B,CAACC,GAAG,EAAEP,KAAK,EAAEQ,KAAK,KAChBA,KAAK,KAAK,CAAC,GAAGD,GAAG,GAAIA,GAAG,GAAGf,SAAS,CAACQ,KAAK,CAAC,GAAI,IAAI,EACrD,CACF,CAAC;EAED,OAAO,CAAC,GAAGI,KAAK,CAACK,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAEV,IAAI,CAACM,QAAQ,CAAC,EAAE,GAAGD,KAAK,CAACK,KAAK,CAAC,CAAC,CAAC,CAAC;AAClE,CAAC;AAED,MAAMC,UAAU,GAAGA,CACjBN,KAAwB,EACxBO,kBAA2B,MACR;EACnBC,WAAW,EAAEnB,OAAO;EACpBoB,kBAAkB,EAAEnB,KAAK;EAC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,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { MeasurementTypeKey } from "@ovok/core";
|
|
4
|
+
import { CaseType } from "../../../types/case-type.js";
|
|
5
|
+
import { BTManagedDevice } from "../bt-managed-device.js";
|
|
6
|
+
import { Bpw1CommandSequencer } from "./bpw1.command-sequencer.js";
|
|
7
|
+
import { parseBpw1BloodPressureRecords } from "./bpw1.frame-parser.js";
|
|
8
|
+
import { Bpw1FrameReader } from "./bpw1.frame-reader.js";
|
|
9
|
+
import { bpw1MainServices } from "./bpw1.main-services.js";
|
|
10
|
+
/** Viatom BPW1 watch, including stored blood-pressure history. */
|
|
11
|
+
class Bpw1Device extends BTManagedDevice {
|
|
12
|
+
mainServices = bpw1MainServices;
|
|
13
|
+
stuckDataTimeout = 120_000;
|
|
14
|
+
onStreamStart = undefined;
|
|
15
|
+
frameReader = new Bpw1FrameReader();
|
|
16
|
+
constructor(device, params) {
|
|
17
|
+
super(device, params);
|
|
18
|
+
this.createCommandSequencer = () => new Bpw1CommandSequencer();
|
|
19
|
+
}
|
|
20
|
+
handleDependentResult = data => {
|
|
21
|
+
if (data.frame) {
|
|
22
|
+
for (const record of parseBpw1BloodPressureRecords(data.frame)) {
|
|
23
|
+
this.onResult?.({
|
|
24
|
+
caseType: CaseType.RESULT,
|
|
25
|
+
measurementTypeKey: MeasurementTypeKey.bloodPressure,
|
|
26
|
+
systolic: record.systolic,
|
|
27
|
+
diastolic: record.diastolic,
|
|
28
|
+
recordedAt: record.recordedAt
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
...data,
|
|
34
|
+
parsingCase: {
|
|
35
|
+
...data.parsingCase,
|
|
36
|
+
caseType: CaseType.OTHER
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
handleSuccessResult() {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export { Bpw1Device, bpw1MainServices };
|
|
45
|
+
//# sourceMappingURL=bpw1.device.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["MeasurementTypeKey","CaseType","BTManagedDevice","Bpw1CommandSequencer","parseBpw1BloodPressureRecords","Bpw1FrameReader","bpw1MainServices","Bpw1Device","mainServices","stuckDataTimeout","onStreamStart","undefined","frameReader","constructor","device","params","createCommandSequencer","handleDependentResult","data","frame","record","onResult","caseType","RESULT","measurementTypeKey","bloodPressure","systolic","diastolic","recordedAt","parsingCase","OTHER","handleSuccessResult"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/bpw1/bpw1.device.ts"],"mappings":";;AAAA,SAAmCA,kBAAkB,QAAQ,YAAY;AAGzE,SAASC,QAAQ,QAAQ,6BAA0B;AAQnD,SAASC,eAAe,QAAQ,yBAAsB;AAEtD,SAASC,oBAAoB,QAAQ,6BAA0B;AAC/D,SAASC,6BAA6B,QAAQ,wBAAqB;AACnE,SAASC,eAAe,QAAQ,wBAAqB;AACrD,SAASC,gBAAgB,QAAQ,yBAAsB;AAIvD;AACA,MAAMC,UAAU,SAASL,eAAe,CAAyB;EACrDM,YAAY,GAAeF,gBAAgB;EAC3CG,gBAAgB,GAAG,OAAO;EAC1BC,aAAa,GAAGC,SAAS;EACzBC,WAAW,GAAG,IAAIP,eAAe,CAAC,CAAC;EAEtCQ,WAAWA,CAChBC,MAAc,EACdC,MAAkD,EAClD;IACA,KAAK,CAACD,MAAM,EAAEC,MAAM,CAAC;IACrB,IAAI,CAACC,sBAAsB,GAAG,MAC5B,IAAIb,oBAAoB,CAAC,CAAC;EAC9B;EAEUc,qBAAqB,GAC7BC,IAAmD,IACD;IAClD,IAAIA,IAAI,CAACC,KAAK,EAAE;MACd,KAAK,MAAMC,MAAM,IAAIhB,6BAA6B,CAACc,IAAI,CAACC,KAAK,CAAC,EAAE;QAC9D,IAAI,CAACE,QAAQ,GAAG;UACdC,QAAQ,EAAErB,QAAQ,CAACsB,MAAM;UACzBC,kBAAkB,EAAExB,kBAAkB,CAACyB,aAAa;UACpDC,QAAQ,EAAEN,MAAM,CAACM,QAAQ;UACzBC,SAAS,EAAEP,MAAM,CAACO,SAAS;UAC3BC,UAAU,EAAER,MAAM,CAACQ;QACrB,CAAyE,CAAC;MAC5E;IACF;IAEA,OAAO;MACL,GAAGV,IAAI;MACPW,WAAW,EAAE;QAAE,GAAGX,IAAI,CAACW,WAAW;QAAEP,QAAQ,EAAErB,QAAQ,CAAC6B;MAAM;IAC/D,CAAC;EACH,CAAC;EAESC,mBAAmBA,CAAA,EAAmB;IAC9C;EACF;AACF;AAEA,SAASxB,UAAU,EAAED,gBAAgB","ignoreList":[]}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { hexToByte } from "../../../utils/hex-to-byte.js";
|
|
4
|
+
const bigEndian = (frame, from) => hexToByte(frame[from] ?? "00") << 24 | hexToByte(frame[from + 1] ?? "00") << 16 | hexToByte(frame[from + 2] ?? "00") << 8 | hexToByte(frame[from + 3] ?? "00");
|
|
5
|
+
const validDate = (year, month, day) => {
|
|
6
|
+
if (month < 1 || month > 12 || day < 1 || day > 31) {
|
|
7
|
+
return undefined;
|
|
8
|
+
}
|
|
9
|
+
const date = new Date(year, month - 1, day);
|
|
10
|
+
return date.getFullYear() === year && date.getMonth() === month - 1 && date.getDate() === day ? date : undefined;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
/** Decodes BP records from ViHealth's generic LHZL health-history packet. */
|
|
14
|
+
export const parseBpw1BloodPressureRecords = frame => {
|
|
15
|
+
if (frame.length < 21 || hexToByte(frame[0] ?? "00") !== 0xe0 || hexToByte(frame[4] ?? "00") !== 0x03 || hexToByte(frame[6] ?? "00") !== 0x01) {
|
|
16
|
+
return [];
|
|
17
|
+
}
|
|
18
|
+
const year = 2000 + ((hexToByte(frame[9] ?? "00") & 0x7f) >> 1);
|
|
19
|
+
const month = (hexToByte(frame[9] ?? "00") & 0x01) << 3 | (hexToByte(frame[10] ?? "00") & 0xe0) >> 5;
|
|
20
|
+
const day = hexToByte(frame[10] ?? "00") & 0x1f;
|
|
21
|
+
const date = validDate(year, month, day);
|
|
22
|
+
const count = hexToByte(frame[11] ?? "00") << 8 | hexToByte(frame[12] ?? "00");
|
|
23
|
+
if (!date || count === 0) {
|
|
24
|
+
return [];
|
|
25
|
+
}
|
|
26
|
+
const records = [];
|
|
27
|
+
for (let index = 0; index < count; index++) {
|
|
28
|
+
const offset = 13 + index * 8;
|
|
29
|
+
if (offset + 7 >= frame.length) {
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
const secondsSinceMidnight = bigEndian(frame, offset);
|
|
33
|
+
const systolic = hexToByte(frame[offset + 6] ?? "00");
|
|
34
|
+
const diastolic = hexToByte(frame[offset + 7] ?? "00");
|
|
35
|
+
if (secondsSinceMidnight < 0 || secondsSinceMidnight >= 24 * 60 * 60 || systolic < 50 || systolic > 300 || diastolic < 30 || diastolic > 200) {
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
const recordedAt = new Date(date);
|
|
39
|
+
recordedAt.setSeconds(secondsSinceMidnight);
|
|
40
|
+
records.push({
|
|
41
|
+
systolic,
|
|
42
|
+
diastolic,
|
|
43
|
+
recordedAt
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return records;
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=bpw1.frame-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["hexToByte","bigEndian","frame","from","validDate","year","month","day","undefined","date","Date","getFullYear","getMonth","getDate","parseBpw1BloodPressureRecords","length","count","records","index","offset","secondsSinceMidnight","systolic","diastolic","recordedAt","setSeconds","push"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/bpw1/bpw1.frame-parser.ts"],"mappings":";;AAAA,SAASA,SAAS,QAAQ,+BAA4B;AAQtD,MAAMC,SAAS,GAAGA,CA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oB,GAAG,CAAC,IACxBA,oBAAoB,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,IACpCC,QAAQ,GAAG,EAAE,IACbA,QAAQ,GAAG,GAAG,IACdC,SAAS,GAAG,EAAE,IACdA,SAAS,GAAG,GAAG,EACf;MACA;IACF;IAEA,MAAMC,UAAU,GAAG,IAAIb,IAAI,CAACD,IAAI,CAAC;IAEjCc,UAAU,CAACC,UAAU,CAACJ,oBAAoB,CAAC;IAC3CH,OAAO,CAACQ,IAAI,CAAC;MAAEJ,QAAQ;MAAEC,SAAS;MAAEC;IAAW,CAAC,CAAC;EACnD;EAEA,OAAON,OAAO;AAChB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,50 @@
|
|
|
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 = 0xe0;
|
|
6
|
+
const HEADER_BYTES = 4;
|
|
7
|
+
|
|
8
|
+
/** Reads the length-prefixed, checksummed LHZL history frames used by BPW1. */
|
|
9
|
+
export class Bpw1FrameReader {
|
|
10
|
+
readFrame(buffer) {
|
|
11
|
+
const start = buffer.findIndex((byte, index) => hexToByte(byte) === START && index + 2 < buffer.length);
|
|
12
|
+
if (start < 0) {
|
|
13
|
+
return {
|
|
14
|
+
status: FrameReadStatus.INCOMPLETE,
|
|
15
|
+
consumedBytes: Math.max(0, buffer.length - 1)
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
const payloadLength = hexToByte(buffer[start + 1] ?? "00") << 8 | hexToByte(buffer[start + 2] ?? "00");
|
|
19
|
+
const frameLength = payloadLength + HEADER_BYTES;
|
|
20
|
+
if (frameLength < 9) {
|
|
21
|
+
return {
|
|
22
|
+
status: FrameReadStatus.CORRUPT,
|
|
23
|
+
consumedBytes: start + 1
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
if (start + frameLength > buffer.length) {
|
|
27
|
+
return {
|
|
28
|
+
status: FrameReadStatus.INCOMPLETE,
|
|
29
|
+
consumedBytes: start
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const frame = buffer.slice(start, start + frameLength);
|
|
33
|
+
if (!this.hasValidChecksum(frame)) {
|
|
34
|
+
return {
|
|
35
|
+
status: FrameReadStatus.CORRUPT,
|
|
36
|
+
consumedBytes: start + 1
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
status: FrameReadStatus.COMPLETE,
|
|
41
|
+
consumedBytes: start + frameLength,
|
|
42
|
+
frame
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
hasValidChecksum(frame) {
|
|
46
|
+
const checksum = frame.reduce((sum, byte, index) => index === 3 ? sum : sum + hexToByte(byte) & 0xff, 0);
|
|
47
|
+
return checksum === hexToByte(frame[3] ?? "00");
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=bpw1.frame-reader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["FrameReadStatus","hexToByte","START","HEADER_BYTES","Bpw1FrameReader","readFrame","buffer","start","findIndex","byte","index","length","status","INCOMPLETE","consumedBytes","Math","max","payloadLength","frameLength","CORRUPT","frame","slice","hasValidChecksum","COMPLETE","checksum","reduce","sum"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/bpw1/bpw1.frame-reader.ts"],"mappings":";;AACA,SAASA,eAAe,QAAQ,qCAAkC;AAElE,SAASC,SAAS,QAAQ,+BAA4B;AAEtD,MAAMC,KAAK,GAAG,IAAI;AAClB,MAAMC,YAAY,GAAG,CAAC;;AAEtB;AACA,OAAO,MAAMC,eAAe,CAAwB;EAC3CC,SAASA,CAACC,MAAyB,EAAmB;IAC3D,MAAMC,KAAK,GAAGD,MAAM,CAACE,SAAS,CAC5B,CAACC,IAAI,EAAEC,KAAK,KAAKT,SAAS,CAACQ,IAAI,CAAC,KA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K,MAAM,CAC3B,CAACC,GAAG,EAAEjB,IAAI,EAAEC,KAAK,KACfA,KAAK,KAAK,CAAC,GAAGgB,GAAG,GAAIA,GAAG,GAAGzB,SAAS,CAACQ,IAAI,CAAC,GAAI,IAAI,EACpD,CACF,CAAC;IAED,OAAOe,QAAQ,KAAKvB,SAAS,CAACmB,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;EACjD;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { MeasurementTypeKey } from "@ovok/core";
|
|
4
|
+
import { CaseType } from "../../../types/case-type.js";
|
|
5
|
+
/** Viatom BPW1's LHZL watch-profile GATT surface used by ViHealth. */
|
|
6
|
+
export const bpw1MainServices = [{
|
|
7
|
+
uuid: "81eea003-e735-49ec-8a11-7e32cae1e14e",
|
|
8
|
+
writeUuid: {
|
|
9
|
+
uuid: "81eea002-e735-49ec-8a11-7e32cae1e14e",
|
|
10
|
+
mainCommandUuid: "e00000000000000001"
|
|
11
|
+
},
|
|
12
|
+
monitorUuids: [{
|
|
13
|
+
uuid: "81eea001-e735-49ec-8a11-7e32cae1e14e",
|
|
14
|
+
parsingModel: {
|
|
15
|
+
caseValuePosition: [4, 6],
|
|
16
|
+
cases: [{
|
|
17
|
+
caseValue: "0301",
|
|
18
|
+
caseType: CaseType.DEPENDENT,
|
|
19
|
+
measurementTypeKey: MeasurementTypeKey.bloodPressure,
|
|
20
|
+
minLengthBytes: 21,
|
|
21
|
+
parseDefinitions: []
|
|
22
|
+
}]
|
|
23
|
+
}
|
|
24
|
+
}]
|
|
25
|
+
}];
|
|
26
|
+
//# sourceMappingURL=bpw1.main-services.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["MeasurementTypeKey","CaseType","bpw1MainServices","uuid","writeUuid","mainCommandUuid","monitorUuids","parsingModel","caseValuePosition","cases","caseValue","caseType","DEPENDENT","measurementTypeKey","bloodPressure","minLengthBytes","parseDefinitions"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/bpw1/bpw1.main-services.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,YAAY;AAE/C,SAASC,QAAQ,QAAQ,6BAA0B;AAGnD;AACA,OAAO,MAAMC,gBAA4B,GAAG,CAC1C;EACEC,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,EAAEV,QAAQ,CAACW,SAAS;QAC5BC,kBAAkB,EAAEb,kBAAkB,CAACc,aAAa;QACpDC,cAAc,EAAE,EAAE;QAClBC,gBAAgB,EAAE;MACpB,CAAC;IAEL;EACF,CAAC;AAEL,CAAC,CACF","ignoreList":[]}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { CaseType } from "../../../types/case-type.js";
|
|
4
|
+
import { BTManagedDevice } from "../bt-managed-device.js";
|
|
5
|
+
import { CHECKME_NOTIFY, CHECKME_SERVICE, CHECKME_WRITE, CheckmeFrameReader } from "./checkme.protocol.js";
|
|
6
|
+
import { CheckmeProSequencer } from "./checkme.sequencer.js";
|
|
7
|
+
const STUCK_TIMEOUT_MS = 180_000;
|
|
8
|
+
const PREFERRED_MTU = 247;
|
|
9
|
+
const acceptEverything = {
|
|
10
|
+
caseValuePosition: [],
|
|
11
|
+
cases: [{
|
|
12
|
+
caseValue: "",
|
|
13
|
+
caseType: CaseType.OTHER,
|
|
14
|
+
parseDefinitions: [],
|
|
15
|
+
description: "A Checkme history response decoded by the transfer sequencer"
|
|
16
|
+
}]
|
|
17
|
+
};
|
|
18
|
+
const checkmeMainServices = [{
|
|
19
|
+
uuid: CHECKME_SERVICE,
|
|
20
|
+
monitorUuids: [{
|
|
21
|
+
uuid: CHECKME_NOTIFY,
|
|
22
|
+
parsingModel: acceptEverything
|
|
23
|
+
}],
|
|
24
|
+
writeUuid: {
|
|
25
|
+
uuid: CHECKME_WRITE,
|
|
26
|
+
mainCommandUuid: "aa"
|
|
27
|
+
}
|
|
28
|
+
}];
|
|
29
|
+
|
|
30
|
+
/** Viatom Checkme Pro history transfer, matching the CheckmeBleInterface in ViHealth. */
|
|
31
|
+
class CheckmeProDevice extends BTManagedDevice {
|
|
32
|
+
mainServices = checkmeMainServices;
|
|
33
|
+
stuckDataTimeout = STUCK_TIMEOUT_MS;
|
|
34
|
+
preferredMtu = PREFERRED_MTU;
|
|
35
|
+
onStreamStart = undefined;
|
|
36
|
+
validatePackage = () => true;
|
|
37
|
+
constructor(device, params) {
|
|
38
|
+
super(device, params);
|
|
39
|
+
this.frameReader = new CheckmeFrameReader();
|
|
40
|
+
this.createCommandSequencer = () => new CheckmeProSequencer({
|
|
41
|
+
write: {
|
|
42
|
+
serviceUuid: CHECKME_SERVICE,
|
|
43
|
+
characteristicUuid: CHECKME_WRITE
|
|
44
|
+
},
|
|
45
|
+
onResult: result => this.onResult?.(result)
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
handleSuccessResult() {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
export { CheckmeProDevice, checkmeMainServices };
|
|
53
|
+
//# sourceMappingURL=checkme.device.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["CaseType","BTManagedDevice","CHECKME_NOTIFY","CHECKME_SERVICE","CHECKME_WRITE","CheckmeFrameReader","CheckmeProSequencer","STUCK_TIMEOUT_MS","PREFERRED_MTU","acceptEverything","caseValuePosition","cases","caseValue","caseType","OTHER","parseDefinitions","description","checkmeMainServices","uuid","monitorUuids","parsingModel","writeUuid","mainCommandUuid","CheckmeProDevice","mainServices","stuckDataTimeout","preferredMtu","onStreamStart","undefined","validatePackage","constructor","device","params","frameReader","createCommandSequencer","write","serviceUuid","characteristicUuid","onResult","result","handleSuccessResult"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/checkme/checkme.device.ts"],"mappings":";;AAEA,SAASA,QAAQ,QAAQ,6BAA0B;AAMnD,SAASC,eAAe,QAAQ,yBAAsB;AAEtD,SACEC,cAAc,EACdC,eAAe,EACfC,aAAa,EACbC,kBAAkB,QACb,uBAAoB;AAC3B,SAASC,mBAAmB,QAAQ,wBAAqB;AAEzD,MAAMC,gBAAgB,GAAG,OAAO;AAChC,MAAMC,aAAa,GAAG,GAAG;AAEzB,MAAMC,gBAAgB,GAAG;EACvBC,iBAAiB,EAAE,EAAE;EACrBC,KAAK,EAAE,CACL;IACEC,SAAS,EAAE,EAAE;IACbC,QAAQ,EAAEb,QAAQ,CAACc,KAAK;IACxBC,gBAAgB,EAAE,EAAE;IACpBC,WAAW,EAAE;EACf,CAAC;AAEL,CAAC;AAED,MAAMC,mBAA+B,GAAG,CACtC;EACEC,IAAI,EAAEf,eAAe;EACrBgB,YAAY,EAAE,CAAC;IAAED,IAAI,EAAEhB,cAAc;IAAEkB,YAAY,EAAEX;EAAiB,CAAC,CAAC;EACxEY,SAAS,EAAE;IACTH,IAAI,EAAEd,aAAa;IACnBkB,eAAe,EAAE;EACnB;AACF,CAAC,CACF;;AAED;AACA,MAAMC,gBAAgB,SAAStB,eAAe,CAA4B;EAC9DuB,YAAY,GAAGP,mBAAmB;EAClCQ,gBAAgB,GAAGlB,gBAAgB;EAC1BmB,YAAY,GAAGlB,aAAa;EACrCmB,aAAa,GAAGC,SAAS;EAChBC,eAAe,GAAGA,CAAA,KAAe,IAAI;EAEjDC,WAAWA,CAChBC,MAAc,EACdC,MAAqD,EACrD;IACA,KAAK,CAACD,MAAM,EAAEC,MAAM,CAAC;IACrB,IAAI,CAACC,WAAW,G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