@ovok/native 0.4.7 → 0.4.8
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 +3 -1
- package/lib/commonjs/modules/bt-device/constants/device-instruction-pdfs.js.map +1 -1
- package/lib/commonjs/modules/bt-management/constants/integrated-devices-map.js +1 -1
- package/lib/commonjs/modules/bt-management/constants/integrated-devices-map.js.map +1 -1
- package/lib/commonjs/modules/bt-management/index.js +44 -0
- package/lib/commonjs/modules/bt-management/index.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/custom/compile-case-shape.js +52 -0
- package/lib/commonjs/modules/bt-management/services/custom/compile-case-shape.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/custom/compile-custom-case.js +8 -2
- package/lib/commonjs/modules/bt-management/services/custom/compile-custom-case.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/custom/compile-custom-field.js +3 -0
- package/lib/commonjs/modules/bt-management/services/custom/compile-custom-field.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/device-creator.js +5 -1
- package/lib/commonjs/modules/bt-management/services/device-creator.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/bt-command-writer.js +15 -1
- package/lib/commonjs/modules/bt-management/services/devices/bt-command-writer.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/custom/custom-lepu-sequencer.js +20 -1
- package/lib/commonjs/modules/bt-management/services/devices/custom/custom-lepu-sequencer.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/custom/custom.device.js +30 -44
- package/lib/commonjs/modules/bt-management/services/devices/custom/custom.device.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/frame-parser.js +2 -1
- package/lib/commonjs/modules/bt-management/services/devices/frame-parser.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/sentinel-frame-reader.js +84 -0
- package/lib/commonjs/modules/bt-management/services/devices/sentinel-frame-reader.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.js +27 -53
- package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.js +55 -0
- package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/veroval/veroval.bp-monitors.js +43 -0
- package/lib/commonjs/modules/bt-management/services/devices/veroval/veroval.bp-monitors.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/veroval/veroval.duo-control-device.js +113 -0
- package/lib/commonjs/modules/bt-management/services/devices/veroval/veroval.duo-control-device.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/veroval/veroval.duo-control-sequencer.js +120 -0
- package/lib/commonjs/modules/bt-management/services/devices/veroval/veroval.duo-control-sequencer.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/veroval/veroval.ecg-device.js +92 -0
- package/lib/commonjs/modules/bt-management/services/devices/veroval/veroval.ecg-device.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/veroval/veroval.ecg-samples.js +64 -0
- package/lib/commonjs/modules/bt-management/services/devices/veroval/veroval.ecg-samples.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/veroval/veroval.ecg-transfer.js +94 -0
- package/lib/commonjs/modules/bt-management/services/devices/veroval/veroval.ecg-transfer.js.map +1 -0
- package/lib/commonjs/modules/bt-management/types/integrated-devices.js +2 -0
- package/lib/commonjs/modules/bt-management/types/integrated-devices.js.map +1 -1
- package/lib/commonjs/modules/bt-management/utils/create-custom-field-parser.js +21 -0
- package/lib/commonjs/modules/bt-management/utils/create-custom-field-parser.js.map +1 -1
- package/lib/commonjs/modules/bt-management/utils/parse-measurement.js +10 -7
- package/lib/commonjs/modules/bt-management/utils/parse-measurement.js.map +1 -1
- package/lib/commonjs/modules/bt-management/utils/reject-custom-reading.js +34 -0
- package/lib/commonjs/modules/bt-management/utils/reject-custom-reading.js.map +1 -0
- package/lib/module/modules/bt-device/constants/device-instruction-pdfs.js +3 -1
- package/lib/module/modules/bt-device/constants/device-instruction-pdfs.js.map +1 -1
- package/lib/module/modules/bt-management/constants/integrated-devices-map.js +1 -1
- package/lib/module/modules/bt-management/constants/integrated-devices-map.js.map +1 -1
- package/lib/module/modules/bt-management/index.js +4 -0
- package/lib/module/modules/bt-management/index.js.map +1 -1
- package/lib/module/modules/bt-management/services/custom/compile-case-shape.js +48 -0
- package/lib/module/modules/bt-management/services/custom/compile-case-shape.js.map +1 -0
- package/lib/module/modules/bt-management/services/custom/compile-custom-case.js +8 -2
- package/lib/module/modules/bt-management/services/custom/compile-custom-case.js.map +1 -1
- package/lib/module/modules/bt-management/services/custom/compile-custom-field.js +3 -0
- package/lib/module/modules/bt-management/services/custom/compile-custom-field.js.map +1 -1
- package/lib/module/modules/bt-management/services/device-creator.js +5 -1
- package/lib/module/modules/bt-management/services/device-creator.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/bt-command-writer.js +15 -1
- package/lib/module/modules/bt-management/services/devices/bt-command-writer.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/custom/custom-lepu-sequencer.js +20 -1
- package/lib/module/modules/bt-management/services/devices/custom/custom-lepu-sequencer.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/custom/custom.device.js +31 -45
- package/lib/module/modules/bt-management/services/devices/custom/custom.device.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/frame-parser.js +2 -1
- package/lib/module/modules/bt-management/services/devices/frame-parser.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/sentinel-frame-reader.js +79 -0
- package/lib/module/modules/bt-management/services/devices/sentinel-frame-reader.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.js +19 -45
- package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.js +50 -0
- package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/veroval/veroval.bp-monitors.js +38 -0
- package/lib/module/modules/bt-management/services/devices/veroval/veroval.bp-monitors.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/veroval/veroval.duo-control-device.js +108 -0
- package/lib/module/modules/bt-management/services/devices/veroval/veroval.duo-control-device.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/veroval/veroval.duo-control-sequencer.js +116 -0
- package/lib/module/modules/bt-management/services/devices/veroval/veroval.duo-control-sequencer.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/veroval/veroval.ecg-device.js +87 -0
- package/lib/module/modules/bt-management/services/devices/veroval/veroval.ecg-device.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/veroval/veroval.ecg-samples.js +60 -0
- package/lib/module/modules/bt-management/services/devices/veroval/veroval.ecg-samples.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/veroval/veroval.ecg-transfer.js +89 -0
- package/lib/module/modules/bt-management/services/devices/veroval/veroval.ecg-transfer.js.map +1 -0
- package/lib/module/modules/bt-management/types/device-measurement-map.js +3 -3
- package/lib/module/modules/bt-management/types/device-measurement-map.js.map +1 -1
- package/lib/module/modules/bt-management/types/integrated-devices.js +2 -0
- package/lib/module/modules/bt-management/types/integrated-devices.js.map +1 -1
- package/lib/module/modules/bt-management/utils/create-custom-field-parser.js +21 -0
- package/lib/module/modules/bt-management/utils/create-custom-field-parser.js.map +1 -1
- package/lib/module/modules/bt-management/utils/parse-measurement.js +10 -7
- package/lib/module/modules/bt-management/utils/parse-measurement.js.map +1 -1
- package/lib/module/modules/bt-management/utils/reject-custom-reading.js +29 -0
- package/lib/module/modules/bt-management/utils/reject-custom-reading.js.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-device/constants/device-instruction-pdfs.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 +4 -0
- package/lib/typescript/commonjs/src/modules/bt-management/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/custom/compile-case-shape.d.ts +19 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/custom/compile-case-shape.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/custom/compile-custom-case.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/custom/compile-custom-field.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/bt-command-writer.d.ts +7 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-command-writer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/custom/custom-lepu-sequencer.d.ts +11 -2
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/custom/custom-lepu-sequencer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/custom/custom.device.d.ts +10 -13
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/custom/custom.device.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/frame-parser.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/sentinel-frame-reader.d.ts +52 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/sentinel-frame-reader.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.d.ts +22 -13
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.d.ts +45 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/veroval/veroval.bp-monitors.d.ts +18 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/veroval/veroval.bp-monitors.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/veroval/veroval.duo-control-device.d.ts +19 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/veroval/veroval.duo-control-device.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/veroval/veroval.duo-control-sequencer.d.ts +45 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/veroval/veroval.duo-control-sequencer.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/veroval/veroval.ecg-device.d.ts +30 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/veroval/veroval.ecg-device.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/veroval/veroval.ecg-samples.d.ts +39 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/veroval/veroval.ecg-samples.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/veroval/veroval.ecg-transfer.d.ts +35 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/veroval/veroval.ecg-transfer.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/custom-case-spec.d.ts +30 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/custom-case-spec.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/custom-field-encoding.d.ts +7 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/custom-field-encoding.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/dependent-result-handler-params.d.ts +7 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/dependent-result-handler-params.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/device-command.d.ts +9 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/device-command.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/device-measurement-map.d.ts +2 -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 +3 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/integrated-devices.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/parsing-case.d.ts +8 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/parsing-case.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/utils/create-custom-field-parser.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/utils/parse-measurement.d.ts +4 -1
- package/lib/typescript/commonjs/src/modules/bt-management/utils/parse-measurement.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/utils/reject-custom-reading.d.ts +15 -0
- package/lib/typescript/commonjs/src/modules/bt-management/utils/reject-custom-reading.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-device/constants/device-instruction-pdfs.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 +4 -0
- package/lib/typescript/module/src/modules/bt-management/index.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/custom/compile-case-shape.d.ts +19 -0
- package/lib/typescript/module/src/modules/bt-management/services/custom/compile-case-shape.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/custom/compile-custom-case.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/custom/compile-custom-field.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/bt-command-writer.d.ts +7 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/bt-command-writer.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/custom/custom-lepu-sequencer.d.ts +11 -2
- package/lib/typescript/module/src/modules/bt-management/services/devices/custom/custom-lepu-sequencer.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/custom/custom.device.d.ts +10 -13
- package/lib/typescript/module/src/modules/bt-management/services/devices/custom/custom.device.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/frame-parser.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/sentinel-frame-reader.d.ts +52 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/sentinel-frame-reader.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.d.ts +22 -13
- package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.d.ts +45 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/veroval/veroval.bp-monitors.d.ts +18 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/veroval/veroval.bp-monitors.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/veroval/veroval.duo-control-device.d.ts +19 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/veroval/veroval.duo-control-device.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/veroval/veroval.duo-control-sequencer.d.ts +45 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/veroval/veroval.duo-control-sequencer.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/veroval/veroval.ecg-device.d.ts +30 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/veroval/veroval.ecg-device.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/veroval/veroval.ecg-samples.d.ts +39 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/veroval/veroval.ecg-samples.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/veroval/veroval.ecg-transfer.d.ts +35 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/veroval/veroval.ecg-transfer.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/types/custom-case-spec.d.ts +30 -0
- package/lib/typescript/module/src/modules/bt-management/types/custom-case-spec.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/types/custom-field-encoding.d.ts +7 -1
- package/lib/typescript/module/src/modules/bt-management/types/custom-field-encoding.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/types/dependent-result-handler-params.d.ts +7 -0
- package/lib/typescript/module/src/modules/bt-management/types/dependent-result-handler-params.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/types/device-command.d.ts +9 -0
- package/lib/typescript/module/src/modules/bt-management/types/device-command.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/types/device-measurement-map.d.ts +2 -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 +3 -1
- package/lib/typescript/module/src/modules/bt-management/types/integrated-devices.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/types/parsing-case.d.ts +8 -0
- package/lib/typescript/module/src/modules/bt-management/types/parsing-case.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/utils/create-custom-field-parser.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/utils/parse-measurement.d.ts +4 -1
- package/lib/typescript/module/src/modules/bt-management/utils/parse-measurement.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/utils/reject-custom-reading.d.ts +15 -0
- package/lib/typescript/module/src/modules/bt-management/utils/reject-custom-reading.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["parseMeasurement","FrameParser","constructor","mainServices","parse","uuid","frame","parsingModel","findParsingModel","caseValue","readCaseValue","parsingCase","cases","find","declared","parsedData","measurementTypeKey","mainService","characteristic","monitorUuids","monitored","toLowerCase","undefined","caseValuePosition","map","index","join"],"sourceRoot":"../../../../../../src","sources":["modules/bt-management/services/devices/frame-parser.ts"],"mappings":";;AAMA,SAASA,gBAAgB,QAAQ,kCAA+B;;AAEhE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,WAAW,CAAwB;EAC9CC,WAAWA,CAAkBC,YAA2C,EAAE;IAAA,KAA7CA,YAA2C,GAA3CA,YAA2C;EAAG;EAEpEC,KAAKA,CACVC,IAAY,EACZC,KAAe,EAC8B;IAC7C,MAAMC,YAAY,GAAG,IAAI,CAACC,gBAAgB,CAACH,IAAI,CAAC;IAEhD,IAAI,CAACE,YAAY,EAAE;MACjB;IACF;IAEA,MAAME,SAAS,GAAG,IAAI,CAACC,aAAa,CAACH,YAAY,EAAED,KAAK,CAAC;IAEzD,MAAMK,WAAW,GAAGJ,YAAY,CAACK,KAAK,EAAEC,IAAI,CACzCC,QAAQ,IAAKA,QAAQ,CAACL,SAAS,KAAKA,SACvC,CAAC;IAED,IAAI,CAACE,WAAW,EAAE;MAChB;IACF;IAEA,MAAMI,UAAU,GAAGf,gBAAgB,CAACM,KAAK,EAAEK,WAAW,CAAC;IAEvD,IAAI,CAACI,UAAU,EAAE;MACf;IACF;IAEA,OAAO;MACLJ,WAAW;MACXK,kBAAkB,EAAEL,WAAW,CAACK,kBAAkB;MAClDD,UAAU,EAAEA;
|
|
1
|
+
{"version":3,"names":["parseMeasurement","FrameParser","constructor","mainServices","parse","uuid","frame","parsingModel","findParsingModel","caseValue","readCaseValue","parsingCase","cases","find","declared","parsedData","measurementTypeKey","mainService","characteristic","monitorUuids","monitored","toLowerCase","undefined","caseValuePosition","map","index","join"],"sourceRoot":"../../../../../../src","sources":["modules/bt-management/services/devices/frame-parser.ts"],"mappings":";;AAMA,SAASA,gBAAgB,QAAQ,kCAA+B;;AAEhE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,WAAW,CAAwB;EAC9CC,WAAWA,CAAkBC,YAA2C,EAAE;IAAA,KAA7CA,YAA2C,GAA3CA,YAA2C;EAAG;EAEpEC,KAAKA,CACVC,IAAY,EACZC,KAAe,EAC8B;IAC7C,MAAMC,YAAY,GAAG,IAAI,CAACC,gBAAgB,CAACH,IAAI,CAAC;IAEhD,IAAI,CAACE,YAAY,EAAE;MACjB;IACF;IAEA,MAAME,SAAS,GAAG,IAAI,CAACC,aAAa,CAACH,YAAY,EAAED,KAAK,CAAC;IAEzD,MAAMK,WAAW,GAAGJ,YAAY,CAACK,KAAK,EAAEC,IAAI,CACzCC,QAAQ,IAAKA,QAAQ,CAACL,SAAS,KAAKA,SACvC,CAAC;IAED,IAAI,CAACE,WAAW,EAAE;MAChB;IACF;IAEA,MAAMI,UAAU,GAAGf,gBAAgB,CAACM,KAAK,EAAEK,WAAW,CAAC;IAEvD,IAAI,CAACI,UAAU,EAAE;MACf;IACF;IAEA,OAAO;MACLJ,WAAW;MACXK,kBAAkB,EAAEL,WAAW,CAACK,kBAAkB;MAClDD,UAAU,EAAEA,UAAwC;MACpDT;IACF,CAAC;EACH;EAEQE,gBAAgBA,CAACH,IAAY,EAA4B;IAC/D,KAAK,MAAMY,WAAW,IAAI,IAAI,CAACd,YAAY,EAAE;MAC3C,MAAMe,cAAc,GAAGD,WAAW,CAACE,YAAY,CAACN,IAAI,CACjDO,SAAS,IAAKA,SAAS,CAACf,IAAI,CAACgB,WAAW,CAAC,CAAC,KAAKhB,IAAI,CAACgB,WAAW,CAAC,CACnE,CAAC;MAED,IAAIH,cAAc,EAAE;QAClB,OAAOA,cAAc,CAACX,YAAY;MACpC;IACF;IAEA,OAAOe,SAAS;EAClB;EAEQZ,aAAaA,CAACH,YAA0B,EAAED,KAAe,EAAU;IACzE,OACEC,YAAY,CAACgB,iBAAiB,EAAEC,GAAG,CAAEC,KAAK,IAAKnB,KAAK,CAACmB,KAAK,CAAC,CAAC,CAACC,IAAI,CAAC,EAAE,CAAC,IACrE,EAAE;EAEN;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { FrameReadStatus } from "../../types/frame-read-status.js";
|
|
4
|
+
const lower = byte => (byte ?? "").toLowerCase();
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Reads a reply that ends on a sentinel byte rather than declaring its length.
|
|
8
|
+
*
|
|
9
|
+
* The Veroval duo control answers this way, as serial protocols generally do: a request is
|
|
10
|
+
* answered across as many notifications as it takes and the end is marked, not counted. The
|
|
11
|
+
* reader therefore cannot know how much is coming and holds the buffer until the terminator
|
|
12
|
+
* lands - which is why the cap exists.
|
|
13
|
+
*
|
|
14
|
+
* There is no integrity check to make. A sentinel protocol carries no checksum, so a frame
|
|
15
|
+
* that reaches a parser here has been delimited, not verified, and whatever decodes it is
|
|
16
|
+
* the only thing standing between a corrupted reply and a reported reading. Declare a range
|
|
17
|
+
* for every field.
|
|
18
|
+
*/
|
|
19
|
+
export class SentinelFrameReader {
|
|
20
|
+
constructor(spec) {
|
|
21
|
+
this.spec = spec;
|
|
22
|
+
}
|
|
23
|
+
readFrame(buffer) {
|
|
24
|
+
const first = lower(buffer[0]);
|
|
25
|
+
if (buffer.length > 0 && (this.spec.standaloneBytes ?? []).includes(first)) {
|
|
26
|
+
return {
|
|
27
|
+
status: FrameReadStatus.COMPLETE,
|
|
28
|
+
consumedBytes: 1,
|
|
29
|
+
frame: [first]
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const start = this.frameStart(buffer);
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* A declared start byte is one byte, so there is no partial match to preserve: a buffer
|
|
36
|
+
* without it holds no frame start and is junk in its entirety.
|
|
37
|
+
*/
|
|
38
|
+
if (start === undefined) {
|
|
39
|
+
return {
|
|
40
|
+
status: FrameReadStatus.INCOMPLETE,
|
|
41
|
+
consumedBytes: buffer.length
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
const end = buffer.findIndex((byte, index) => index >= start && lower(byte) === this.spec.terminator);
|
|
45
|
+
if (end === -1) {
|
|
46
|
+
return this.incompleteOrOverlong(buffer, start);
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
status: FrameReadStatus.COMPLETE,
|
|
50
|
+
consumedBytes: end + 1,
|
|
51
|
+
frame: buffer.slice(start, end)
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Where the payload begins: after the start byte when one is declared, and at zero when
|
|
57
|
+
* none is. A declared start byte that has not arrived means the reply has not begun.
|
|
58
|
+
*/
|
|
59
|
+
frameStart(buffer) {
|
|
60
|
+
if (this.spec.start === undefined) {
|
|
61
|
+
return 0;
|
|
62
|
+
}
|
|
63
|
+
const index = buffer.findIndex(byte => lower(byte) === this.spec.start);
|
|
64
|
+
return index === -1 ? undefined : index + 1;
|
|
65
|
+
}
|
|
66
|
+
incompleteOrOverlong(buffer, start) {
|
|
67
|
+
if (buffer.length - start <= this.spec.maxFrameBytes) {
|
|
68
|
+
return {
|
|
69
|
+
status: FrameReadStatus.INCOMPLETE,
|
|
70
|
+
consumedBytes: 0
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
status: FrameReadStatus.CORRUPT,
|
|
75
|
+
consumedBytes: buffer.length
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=sentinel-frame-reader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["FrameReadStatus","lower","byte","toLowerCase","SentinelFrameReader","constructor","spec","readFrame","buffer","first","length","standaloneBytes","includes","status","COMPLETE","consumedBytes","frame","start","frameStart","undefined","INCOMPLETE","end","findIndex","index","terminator","incompleteOrOverlong","slice","maxFrameBytes","CORRUPT"],"sourceRoot":"../../../../../../src","sources":["modules/bt-management/services/devices/sentinel-frame-reader.ts"],"mappings":";;AACA,SAASA,eAAe,QAAQ,kCAA+B;AAgC/D,MAAMC,KAAK,GAAIC,IAAwB,IAAa,CAACA,IAAI,IAAI,EAAE,EAAEC,WAAW,CAAC,CAAC;;AAE9E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,mBAAmB,CAAwB;EAC/CC,WAAWA,CAAkBC,IAAuB,EAAE;IAAA,KAAzBA,IAAuB,GAAvBA,IAAuB;EAAG;EAEvDC,SAASA,CAACC,MAAyB,EAAmB;IAC3D,MAAMC,KAAK,GAAGR,KAAK,CAACO,MAAM,CAAC,CAAC,CAAC,CAAC;IAE9B,IAAIA,MAAM,CAACE,MAAM,GAAG,CAAC,IAAI,CAAC,IAAI,CAACJ,IAAI,CAACK,eAAe,IAAI,EAAE,EAAEC,QAAQ,CAACH,KAAK,CAAC,EAAE;MAC1E,OAAO;QACLI,MAAM,EAAEb,eAAe,CAACc,QAAQ;QAChCC,aAAa,EAAE,CAAC;QAChBC,KAAK,EAAE,CAACP,KAAK;MACf,CAAC;IACH;IAEA,MAAMQ,KAAK,GAAG,IAAI,CAACC,UAAU,CAACV,MAAM,CAAC;;IAErC;AACJ;AACA;AACA;IACI,IAAIS,KAAK,KAAKE,SAAS,EAAE;MACvB,OAAO;QAAEN,MAAM,EAAEb,eAAe,CAACoB,UAAU;QAAEL,aAAa,EAAEP,MAAM,CAACE;MAAO,CAAC;IAC7E;IAEA,MAAMW,GAAG,GAAGb,MAAM,CAACc,SAAS,CAC1B,CAACpB,IAAI,EAAEqB,KAAK,KAAKA,KAAK,IAAIN,KAAK,IAAIhB,KAAK,CAACC,IAAI,CAAC,KAAK,IAAI,CAACI,IAAI,CAACkB,UAC/D,CAAC;IAED,IAAIH,GAAG,KAAK,CAAC,CAAC,EAAE;MACd,OAAO,IAAI,CAACI,oBAAoB,CAACjB,MAAM,EAAES,KAAK,CAAC;IACjD;IAEA,OAAO;MACLJ,MAAM,EAAEb,eAAe,CAACc,QAAQ;MAChCC,aAAa,EAAEM,GAAG,GAAG,CAAC;MACtBL,KAAK,EAAER,MAAM,CAACkB,KAAK,CAACT,KAAK,EAAEI,GAAG;IAChC,CAAC;EACH;;EAEA;AACF;AACA;AACA;EACUH,UAAUA,CAACV,MAAyB,EAAsB;IAChE,IAAI,IAAI,CAACF,IAAI,CAACW,KAAK,KAAKE,SAAS,EAAE;MACjC,OAAO,CAAC;IACV;IAEA,MAAMI,KAAK,GAAGf,MAAM,CAACc,SAAS,CAAEpB,IAAI,IAAKD,KAAK,CAACC,IAAI,CAAC,KAAK,IAAI,CAACI,IAAI,CAACW,KAAK,CAAC;IAEzE,OAAOM,KAAK,KAAK,CAAC,CAAC,GAAGJ,SAAS,GAAGI,KAAK,GAAG,CAAC;EAC7C;EAEQE,oBAAoBA,CAC1BjB,MAAyB,EACzBS,KAAa,EACI;IACjB,IAAIT,MAAM,CAACE,MAAM,GAAGO,KAAK,IAAI,IAAI,CAACX,IAAI,CAACqB,aAAa,EAAE;MACpD,OAAO;QAAEd,MAAM,EAAEb,eAAe,CAACoB,UAAU;QAAEL,aAAa,EAAE;MAAE,CAAC;IACjE;IAEA,OAAO;MAAEF,MAAM,EAAEb,eAAe,CAAC4B,OAAO;MAAEb,aAAa,EAAEP,MAAM,CAACE;IAAO,CAAC;EAC1E;AACF","ignoreList":[]}
|
package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { MeasurementTypeKey } from "@ovok/core";
|
|
4
|
-
import {
|
|
4
|
+
import { declareProfile, littleEndian } from "./standard-gatt.profile.js";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Declarations for the Bluetooth SIG vital-signs profiles.
|
|
@@ -20,52 +20,14 @@ import { defineCustomDevice } from "../../custom/define-custom-device.js";
|
|
|
20
20
|
* such a device yields no reading rather than one that is quietly wrong.
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
|
-
/** Milliseconds a spot-check device may take to produce its reading. */
|
|
24
|
-
const SPOT_CHECK_TIMEOUT_MS = 60_000;
|
|
25
|
-
const sigUuid = assigned => `0000${assigned}-0000-1000-8000-00805f9b34fb`;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* The flags byte selects the case, because it decides which optional fields are present and
|
|
29
|
-
* therefore where the later ones sit. Every declared case reads the same offsets, so only
|
|
30
|
-
* fields that keep their position across all of them may be declared.
|
|
31
|
-
*/
|
|
32
|
-
const declareProfile = (params, profile) => defineCustomDevice({
|
|
33
|
-
id: params.id,
|
|
34
|
-
nameMatch: params.nameMatch,
|
|
35
|
-
stuckDataTimeoutMs: params.stuckDataTimeoutMs ?? SPOT_CHECK_TIMEOUT_MS,
|
|
36
|
-
services: [{
|
|
37
|
-
uuid: sigUuid(profile.service),
|
|
38
|
-
monitor: [{
|
|
39
|
-
uuid: sigUuid(profile.characteristic),
|
|
40
|
-
frame: {
|
|
41
|
-
minLengthBytes: profile.minLengthBytes
|
|
42
|
-
},
|
|
43
|
-
caseSelectorBytes: [0],
|
|
44
|
-
cases: profile.selectors.map(selector => ({
|
|
45
|
-
selector,
|
|
46
|
-
kind: "result",
|
|
47
|
-
measurementTypeKey: profile.measurementTypeKey,
|
|
48
|
-
fields: [...profile.fields]
|
|
49
|
-
}))
|
|
50
|
-
}]
|
|
51
|
-
}]
|
|
52
|
-
});
|
|
53
|
-
const littleEndian = (name, byteIndexes, unit, encoding) => ({
|
|
54
|
-
name,
|
|
55
|
-
byteIndexes,
|
|
56
|
-
byteOrder: "little",
|
|
57
|
-
encoding,
|
|
58
|
-
unit
|
|
59
|
-
});
|
|
60
|
-
|
|
61
23
|
/**
|
|
62
24
|
* Blood Pressure Service 0x1810, Blood Pressure Measurement 0x2A35.
|
|
63
25
|
*
|
|
64
|
-
* The
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
26
|
+
* The pressures sit at bytes 1-4 whatever the flags say. The pulse rate sits behind two of
|
|
27
|
+
* them: bit 1 puts a seven-byte timestamp in front of it and bit 2 says whether it is there
|
|
28
|
+
* at all, so it is read at byte 7 in one shape and byte 14 in the other, and each shape
|
|
29
|
+
* declares the length it needs. A device that reports no pulse still decodes, because the
|
|
30
|
+
* flags value it sends selects a case that never looks for one.
|
|
69
31
|
*/
|
|
70
32
|
const standardBloodPressureDevice = params => declareProfile(params, {
|
|
71
33
|
service: "1810",
|
|
@@ -74,7 +36,19 @@ const standardBloodPressureDevice = params => declareProfile(params, {
|
|
|
74
36
|
measurementTypeKey: MeasurementTypeKey.bloodPressure,
|
|
75
37
|
/** mmHg, with and without the timestamp and pulse the pressures sit in front of. */
|
|
76
38
|
selectors: ["00", "02", "04", "06"],
|
|
77
|
-
fields: [littleEndian("systolic", [1, 2], "mmHg", "sfloat"), littleEndian("diastolic", [3, 4], "mmHg", "sfloat")]
|
|
39
|
+
fields: [littleEndian("systolic", [1, 2], "mmHg", "sfloat"), littleEndian("diastolic", [3, 4], "mmHg", "sfloat")],
|
|
40
|
+
optionalFields: {
|
|
41
|
+
/** Pulse, no timestamp: it follows the mean pressure. */
|
|
42
|
+
"04": {
|
|
43
|
+
fields: [littleEndian("heartRate", [7, 8], "bpm", "sfloat")],
|
|
44
|
+
minLengthBytes: 9
|
|
45
|
+
},
|
|
46
|
+
/** Pulse behind a seven-byte timestamp. */
|
|
47
|
+
"06": {
|
|
48
|
+
fields: [littleEndian("heartRate", [14, 15], "bpm", "sfloat")],
|
|
49
|
+
minLengthBytes: 16
|
|
50
|
+
}
|
|
51
|
+
}
|
|
78
52
|
});
|
|
79
53
|
|
|
80
54
|
/** Health Thermometer Service 0x1809, Temperature Measurement 0x2A1C. */
|
package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["MeasurementTypeKey","
|
|
1
|
+
{"version":3,"names":["MeasurementTypeKey","declareProfile","littleEndian","standardBloodPressureDevice","params","service","characteristic","minLengthBytes","measurementTypeKey","bloodPressure","selectors","fields","optionalFields","standardThermometerDevice","temperature","WEIGHT_KG_PER_COUNT","standardWeightScaleDevice","bodyWeight","scale","decimals","standardPulseOximeterDevice","bloodOxygenPulseRate","standardHeartRateDevice","heartRate","name","byteIndexes","encoding","unit"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,YAAY;AAI/C,SACEC,cAAc,EACdC,YAAY,QAEP,4BAAyB;;AAEhC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,2BAA2B,GAC/BC,MAA4B,IAE5BH,cAAc,CAACG,MAAM,EAAE;EACrBC,OAAO,EAAE,MAAM;EACfC,cAAc,EAAE,MAAM;EACtBC,cAAc,EAAE,CAAC;EACjBC,kBAAkB,EAAER,kBAAkB,CAACS,aAAa;EAEpD;EACAC,SAAS,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;EACnCC,MAAM,EAAE,CACNT,YAAY,CAAC,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAClDA,YAAY,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,CACpD;EACDU,cAAc,EAAE;IACd;IACA,IAAI,EAAE;MACJD,MAAM,EAAE,CAACT,YAAY,CAAC,WAAW,EAAE,CAA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,MAAMC,2BAA2B,GAC/BhB,MAA4B,IAE5BH,cAAc,CAACG,MAAM,EAAE;EACrBC,OAAO,EAAE,MAAM;EACfC,cAAc,EAAE,MAAM;EACtBC,cAAc,EAAE,CAAC;EACjBC,kBAAkB,EAAER,kBAAkB,CAACqB,oBAAoB;EAC3DX,SAAS,EAAE,CAAC,IAAI,CAAC;EACjBC,MAAM,EAAE,CACNT,YAAY,CAAC,aAAa,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,QAAQ,CAAC,EAClDA,YAAY,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC;AAEtD,CAAC,CAAC;;AAEJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMoB,uBAAuB,GAC3BlB,MAA4B,IAE5BH,cAAc,CAACG,MAAM,EAAE;EACrBC,OAAO,EAAE,MAAM;EACfC,cAAc,EAAE,MAAM;EACtBC,cAAc,EAAE,CAAC;EACjBC,kBAAkB,EAAER,kBAAkB,CAACuB,SAAS;EAChDb,SAAS,EAAE,CAAC,IAAI,CAAC;EACjBC,MAAM,EAAE,CACN;IAAEa,IAAI,EAAE,WAAW;IAAEC,WAAW,EAAE,CAAC,CAAC,CAAC;IAAEC,QAAQ,EAAE,MAAM;IAAEC,IAAI,EAAE;EAAM,CAAC;AAE1E,CAAC,CAAC;AAEJ,SACExB,2BAA2B,EAC3BmB,uBAAuB,EACvBF,2BAA2B,EAC3BP,yBAAyB,EACzBG,yBAAyB","ignoreList":[]}
|
package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { defineCustomDevice } from "../../custom/define-custom-device.js";
|
|
4
|
+
|
|
5
|
+
/** Milliseconds a spot-check device may take to produce its reading. */
|
|
6
|
+
const SPOT_CHECK_TIMEOUT_MS = 60_000;
|
|
7
|
+
const sigUuid = assigned => `0000${assigned}-0000-1000-8000-00805f9b34fb`;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The flags byte selects the case, because it decides which optional fields are present and
|
|
11
|
+
* therefore where the later ones sit. Fields common to every shape are declared once; a
|
|
12
|
+
* field a flag adds is declared against the selector that carries it, at the offset that
|
|
13
|
+
* flag combination puts it and with the frame length that shape guarantees.
|
|
14
|
+
*/
|
|
15
|
+
const declareProfile = (params, profile) => defineCustomDevice({
|
|
16
|
+
id: params.id,
|
|
17
|
+
nameMatch: params.nameMatch,
|
|
18
|
+
stuckDataTimeoutMs: params.stuckDataTimeoutMs ?? SPOT_CHECK_TIMEOUT_MS,
|
|
19
|
+
services: [{
|
|
20
|
+
uuid: sigUuid(profile.service),
|
|
21
|
+
monitor: [{
|
|
22
|
+
uuid: sigUuid(profile.characteristic),
|
|
23
|
+
frame: {
|
|
24
|
+
minLengthBytes: profile.minLengthBytes
|
|
25
|
+
},
|
|
26
|
+
caseSelectorBytes: [0],
|
|
27
|
+
cases: profile.selectors.map(selector => {
|
|
28
|
+
const optional = profile.optionalFields?.[selector];
|
|
29
|
+
return {
|
|
30
|
+
selector,
|
|
31
|
+
kind: "result",
|
|
32
|
+
measurementTypeKey: profile.measurementTypeKey,
|
|
33
|
+
fields: [...profile.fields, ...(optional?.fields ?? [])],
|
|
34
|
+
...(optional ? {
|
|
35
|
+
minLengthBytes: optional.minLengthBytes
|
|
36
|
+
} : {})
|
|
37
|
+
};
|
|
38
|
+
})
|
|
39
|
+
}]
|
|
40
|
+
}]
|
|
41
|
+
});
|
|
42
|
+
const littleEndian = (name, byteIndexes, unit, encoding) => ({
|
|
43
|
+
name,
|
|
44
|
+
byteIndexes,
|
|
45
|
+
byteOrder: "little",
|
|
46
|
+
encoding,
|
|
47
|
+
unit
|
|
48
|
+
});
|
|
49
|
+
export { declareProfile, littleEndian, sigUuid };
|
|
50
|
+
//# sourceMappingURL=standard-gatt.profile.js.map
|
package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["defineCustomDevice","SPOT_CHECK_TIMEOUT_MS","sigUuid","assigned","declareProfile","params","profile","id","nameMatch","stuckDataTimeoutMs","services","uuid","service","monitor","characteristic","frame","minLengthBytes","caseSelectorBytes","cases","selectors","map","selector","optional","optionalFields","kind","measurementTypeKey","fields","littleEndian","name","byteIndexes","unit","encoding","byteOrder"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.ts"],"mappings":";;AAIA,SAASA,kBAAkB,QAAQ,sCAAmC;;AAEtE;AACA,MAAMC,qBAAqB,GAAG,MAAM;AAyCpC,MAAMC,OAAO,GAAIC,QAAgB,IAC/B,OAAOA,QAAQ,8BAA8B;;AAE/C;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,cAAc,GAAGA,CACrBC,MAA4B,EAC5BC,OAAoB,KAEpBN,kBAAkB,CAAC;EACjBO,EAAE,EAAEF,MAAM,CAACE,EAAE;EACbC,SAAS,EAAEH,MAAM,CAACG,SAAS;EAC3BC,kBAAkB,EAAEJ,MAAM,CAACI,kBAAkB,IAAIR,qBAAqB;EACtES,QAAQ,EAAE,CACR;IACEC,IAAI,EAAET,OAAO,CAACI,OAAO,CAACM,OAAO,CAAC;IAC9BC,OAAO,EAAE,CACP;MACEF,IAAI,EAAET,OAAO,CAACI,OAAO,CAACQ,cAAc,CAAC;MACrCC,KAAK,EAAE;QAAEC,cAAc,EAAEV,OAAO,CAACU;MAAe,CAAC;MACjDC,iBAAiB,EAAE,CAAC,CAAC,CAAC;MACtBC,KAAK,EAAEZ,OAAO,CAACa,SAAS,CAACC,GAAG,CAAEC,QAAQ,IAAK;QACzC,MAAMC,QAAQ,GAAGhB,OAAO,CAACiB,cAAc,GAAGF,QAAQ,CAAC;QAEnD,OAAO;UACLA,QAAQ;UACRG,IAAI,EAAE,QAAiB;UACvBC,kBAAkB,EAAEnB,OAAO,CAACmB,kBAAkB;UAC9CC,MAAM,EAAE,CAAC,GAAGpB,OAAO,CAACoB,MAAM,EAAE,IAAIJ,QAAQ,EAAEI,MAAM,IAAI,EAAE,CAAC,CAAC;UACxD,IAAIJ,QAAQ,GACR;YAAEN,cAAc,EAAEM,QAAQ,CAACN;UAAe,CAAC,GAC3C,CAAC,CAAC;QACR,CAAC;MACH,CAAC;IACH,CAAC;EAEL,CAAC;AAEL,CAAC,CAAC;AAEJ,MAAMW,YAAY,GAAGA,CACnBC,IAAY,EACZC,WAAqB,EACrBC,IAAY,EACZC,QAAqC,MAChB;EACrBH,IAAI;EACJC,WAAW;EACXG,SAAS,EAAE,QAAQ;EACnBD,QAAQ;EACRD;AACF,CAAC,CAAC;AAEF,SAAS1B,cAAc,EAAEuB,YAAY,EAAEzB,OAAO","ignoreList":[]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { standardBloodPressureDevice } from "../standard-gatt/standard-gatt.devices.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The Veroval compact+ blood-pressure monitors.
|
|
7
|
+
*
|
|
8
|
+
* There is nothing vendor-specific to decode here: these implement the Bluetooth
|
|
9
|
+
* blood-pressure profile as published - service 0x1810, measurement 0x2A35, notifications on
|
|
10
|
+
* the standard descriptor - so the layout comes from the specification and the SDK already
|
|
11
|
+
* reads it. What this adds is the identity, which is the only part the specification does
|
|
12
|
+
* not supply.
|
|
13
|
+
*
|
|
14
|
+
* The vendor's own app compares the advertised name for exact equality, ignoring case, so
|
|
15
|
+
* that is what these matchers do. The duo control and the Fusion are not here: those speak a
|
|
16
|
+
* protocol of their own on a private service, and so does the ECG.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
const BPU_26 = "BPU26";
|
|
20
|
+
const BPW_26 = "BPW26";
|
|
21
|
+
const verovalCompactMonitor = (advertisedName, params) => standardBloodPressureDevice({
|
|
22
|
+
id: params.id,
|
|
23
|
+
nameMatch: params.nameMatch ?? new RegExp(`^${advertisedName}$`, "i"),
|
|
24
|
+
...(params.stuckDataTimeoutMs === undefined ? {} : {
|
|
25
|
+
stuckDataTimeoutMs: params.stuckDataTimeoutMs
|
|
26
|
+
})
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
/** BPU 26, the Veroval compact+ upper-arm monitor. */
|
|
30
|
+
const bpu26Monitor = params => verovalCompactMonitor(BPU_26, params);
|
|
31
|
+
|
|
32
|
+
/** BPW 26, the Veroval compact+ wrist monitor. */
|
|
33
|
+
const bpw26Monitor = params => verovalCompactMonitor(BPW_26, params);
|
|
34
|
+
|
|
35
|
+
/** The names these monitors advertise. */
|
|
36
|
+
const VEROVAL_BP_MODEL_NAMES = [BPU_26, BPW_26];
|
|
37
|
+
export { bpu26Monitor, bpw26Monitor, VEROVAL_BP_MODEL_NAMES, verovalCompactMonitor };
|
|
38
|
+
//# sourceMappingURL=veroval.bp-monitors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["standardBloodPressureDevice","BPU_26","BPW_26","verovalCompactMonitor","advertisedName","params","id","nameMatch","RegExp","stuckDataTimeoutMs","undefined","bpu26Monitor","bpw26Monitor","VEROVAL_BP_MODEL_NAMES"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/veroval/veroval.bp-monitors.ts"],"mappings":";;AACA,SAASA,2BAA2B,QAAQ,2CAAwC;;AAEpF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMC,MAAM,GAAG,OAAO;AACtB,MAAMC,MAAM,GAAG,OAAO;AActB,MAAMC,qBAAqB,GAAGA,CAC5BC,cAAsB,EACtBC,MAAuB,KAEvBL,2BAA2B,CAAC;EAC1BM,EAAE,EAAED,MAAM,CAACC,EAAE;EACbC,SAAS,EAAEF,MAAM,CAACE,SAAS,IAAI,IAAIC,MAAM,CAAC,IAAIJ,cAAc,GAAG,EAAE,GAAG,CAAC;EACrE,IAAIC,MAAM,CAACI,kBAAkB,KAAKC,SAAS,GACvC,CAAC,CAAC,GACF;IAAED,kBAAkB,EAAEJ,MAAM,CAACI;EAAmB,CAAC;AACvD,CAAC,CAAC;;AAEJ;AACA,MAAME,YAAY,GAAIN,MAAuB,IAC3CF,qBAAqB,CAACF,MAAM,EAAEI,MAAM,CAAC;;AAEvC;AACA,MAAMO,YAAY,GAAIP,MAAuB,IAC3CF,qBAAqB,CAACD,MAAM,EAAEG,MAAM,CAAC;;AAEvC;AACA,MAAMQ,sBAAyC,GAAG,CAACZ,MAAM,EAAEC,MAAM,CAAC;AAElE,SACES,YAAY,EACZC,YAAY,EACZC,sBAAsB,EACtBV,qBAAqB","ignoreList":[]}
|
package/lib/module/modules/bt-management/services/devices/veroval/veroval.duo-control-device.js
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { MeasurementTypeKey } from "@ovok/core";
|
|
4
|
+
import { defineCustomDevice } from "../../custom/define-custom-device.js";
|
|
5
|
+
import { CustomDevice } from "../custom/custom.device.js";
|
|
6
|
+
import { SentinelFrameReader } from "../sentinel-frame-reader.js";
|
|
7
|
+
import { VerovalDuoControlSequencer } from "./veroval.duo-control-sequencer.js";
|
|
8
|
+
const SERVICE = "5d4b8aa6-a26a-4a1b-99f5-cd4473c786e3";
|
|
9
|
+
const NOTIFY = "5d4b8aa6-a26a-4a1b-99f5-cd4473c786e4";
|
|
10
|
+
const WRITE = "5d4b8aa6-a26a-4a1b-99f5-cd4473c786e5";
|
|
11
|
+
const STX = "02";
|
|
12
|
+
const ETX = "03";
|
|
13
|
+
const ACK = "06";
|
|
14
|
+
const NAK = "15";
|
|
15
|
+
|
|
16
|
+
/** One stored measurement, as the device writes it: twenty-six characters. */
|
|
17
|
+
const RECORD_BYTES = 26;
|
|
18
|
+
|
|
19
|
+
/** A reply opens by echoing the four-character command it answers. */
|
|
20
|
+
const TAG_BYTES = 4;
|
|
21
|
+
|
|
22
|
+
/** `?MDR`, the reply carrying stored records. */
|
|
23
|
+
const DATA_REPLY = "3f4d4452";
|
|
24
|
+
|
|
25
|
+
/** `?MRN`, the reply carrying a record count. The sequencer reads it; no reading comes of it. */
|
|
26
|
+
const COUNT_REPLY = "3f4d524e";
|
|
27
|
+
|
|
28
|
+
/** Two memories of a hundred records each, plus the echo, with room to spare. */
|
|
29
|
+
const MAX_REPLY_BYTES = 8_192;
|
|
30
|
+
|
|
31
|
+
/** The device sleeps between measurements, so it is given a while to answer. */
|
|
32
|
+
const STUCK_TIMEOUT_MS = 120_000;
|
|
33
|
+
const asciiField = (name, from, unit) => ({
|
|
34
|
+
name,
|
|
35
|
+
byteIndexes: [from, from + 1, from + 2],
|
|
36
|
+
encoding: "ascii",
|
|
37
|
+
unit
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The record layout, read from HARTMANN's own application.
|
|
42
|
+
*
|
|
43
|
+
* Offsets are relative to a record, and every field is decimal digits written as text. The
|
|
44
|
+
* timestamp at the front of each record is not declared: the SDK stamps a reading when it
|
|
45
|
+
* arrives, and a stored record's own clock would need the device's timezone to be
|
|
46
|
+
* meaningful.
|
|
47
|
+
*/
|
|
48
|
+
const duoControlDefinition = defineCustomDevice({
|
|
49
|
+
id: "veroval-duo-control",
|
|
50
|
+
nameMatch: /^Veroval duo control$/i,
|
|
51
|
+
stuckDataTimeoutMs: STUCK_TIMEOUT_MS,
|
|
52
|
+
services: [{
|
|
53
|
+
uuid: SERVICE,
|
|
54
|
+
monitor: [{
|
|
55
|
+
uuid: NOTIFY,
|
|
56
|
+
frame: {
|
|
57
|
+
minLengthBytes: TAG_BYTES + RECORD_BYTES
|
|
58
|
+
},
|
|
59
|
+
caseSelectorBytes: [0, 1, 2, 3],
|
|
60
|
+
cases: [{
|
|
61
|
+
selector: DATA_REPLY,
|
|
62
|
+
kind: "result",
|
|
63
|
+
measurementTypeKey: MeasurementTypeKey.bloodPressure,
|
|
64
|
+
description: "Stored measurements, one record each",
|
|
65
|
+
repeatedRecords: {
|
|
66
|
+
recordBytes: RECORD_BYTES,
|
|
67
|
+
from: TAG_BYTES
|
|
68
|
+
},
|
|
69
|
+
fields: [asciiField("systolic", 11, "mmHg"), asciiField("diastolic", 14, "mmHg"), asciiField("heartRate", 17, "bpm")]
|
|
70
|
+
}, {
|
|
71
|
+
selector: COUNT_REPLY,
|
|
72
|
+
kind: "idle",
|
|
73
|
+
description: "How many records a memory holds"
|
|
74
|
+
}]
|
|
75
|
+
}]
|
|
76
|
+
}]
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* The Veroval duo control.
|
|
81
|
+
*
|
|
82
|
+
* A device class rather than a declaration, because reading it is a conversation: the two
|
|
83
|
+
* user memories are asked in turn, and the device answers with bare control bytes as often
|
|
84
|
+
* as with payload. The decoding is still declared - the class supplies the framing and the
|
|
85
|
+
* walk, and nothing else.
|
|
86
|
+
*
|
|
87
|
+
* Readings are stored measurements, not live ones. The device hands over its history when
|
|
88
|
+
* asked, so what arrives was taken before the connection and may be days old.
|
|
89
|
+
*/
|
|
90
|
+
export class VerovalDuoControlDevice extends CustomDevice {
|
|
91
|
+
constructor(device, params) {
|
|
92
|
+
super(device, params, duoControlDefinition);
|
|
93
|
+
this.frameReader = new SentinelFrameReader({
|
|
94
|
+
start: STX,
|
|
95
|
+
terminator: ETX,
|
|
96
|
+
maxFrameBytes: MAX_REPLY_BYTES,
|
|
97
|
+
standaloneBytes: [ACK, NAK]
|
|
98
|
+
});
|
|
99
|
+
this.createCommandSequencer = () => new VerovalDuoControlSequencer({
|
|
100
|
+
write: {
|
|
101
|
+
serviceUuid: SERVICE,
|
|
102
|
+
characteristicUuid: WRITE
|
|
103
|
+
},
|
|
104
|
+
onRefused: reason => this.onError?.(new Error(`Veroval duo control: ${reason}.`))
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=veroval.duo-control-device.js.map
|
package/lib/module/modules/bt-management/services/devices/veroval/veroval.duo-control-device.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["MeasurementTypeKey","defineCustomDevice","CustomDevice","SentinelFrameReader","VerovalDuoControlSequencer","SERVICE","NOTIFY","WRITE","STX","ETX","ACK","NAK","RECORD_BYTES","TAG_BYTES","DATA_REPLY","COUNT_REPLY","MAX_REPLY_BYTES","STUCK_TIMEOUT_MS","asciiField","name","from","unit","byteIndexes","encoding","duoControlDefinition","id","nameMatch","stuckDataTimeoutMs","services","uuid","monitor","frame","minLengthBytes","caseSelectorBytes","cases","selector","kind","measurementTypeKey","bloodPressure","description","repeatedRecords","recordBytes","fields","VerovalDuoControlDevice","constructor","device","params","frameReader","start","terminator","maxFrameBytes","standaloneBytes","createCommandSequencer","write","serviceUuid","characteristicUuid","onRefused","reason","onError","Error"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/veroval/veroval.duo-control-device.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,YAAY;AAK/C,SAASC,kBAAkB,QAAQ,sCAAmC;AACtE,SAASC,YAAY,QAAQ,4BAAyB;AACtD,SAASC,mBAAmB,QAAQ,6BAA0B;AAE9D,SAASC,0BAA0B,QAAQ,oCAAiC;AAE5E,MAAMC,OAAO,GAAG,sCAAsC;AACtD,MAAMC,MAAM,GAAG,sCAAsC;AACrD,MAAMC,KAAK,GAAG,sCAAsC;AAEpD,MAAMC,GAAG,GAAG,IAAI;AAChB,MAAMC,GAAG,GAAG,IAAI;AAChB,MAAMC,GAAG,GAAG,IAAI;AAChB,MAAMC,GAAG,GAAG,IAAI;;AAEhB;AACA,MAAMC,YAAY,GAAG,EAAE;;AAEvB;AACA,MAAMC,SAAS,GAAG,CAAC;;AAEnB;AACA,MAAMC,UAAU,GAAG,UAAU;;AAE7B;AACA,MAAMC,WAAW,GAAG,UAAU;;AAE9B;AACA,MA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CAAC;EAEL,CAAC;AAEL,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMI,uBAAuB,SAASzC,YAAY,CAAC;EACjD0C,WAAWA,CAChBC,MAAc,EACdC,MAA0C,EAC1C;IACA,KAAK,CAACD,MAAM,EAAEC,MAAM,EAAEtB,oBAAoB,CAAC;IAE3C,IAAI,CAACuB,WAAW,GAAG,IAAI5C,mBAAmB,CAAC;MACzC6C,KAAK,EAAExC,GAAG;MACVyC,UAAU,EAAExC,GAAG;MACfyC,aAAa,EAAElC,eAAe;MAC9BmC,eAAe,EAAE,CAACzC,GAAG,EAAEC,GAAG;IAC5B,CAAC,CAAC;IAEF,IAAI,CAACyC,sBAAsB,GAAG,MAC5B,IAAIhD,0BAA0B,CAAC;MAC7BiD,KAAK,EAAE;QAAEC,WAAW,EAAEjD,OAAO;QAAEkD,kBAAkB,EAAEhD;MAAM,CAAC;MAC1DiD,SAAS,EAAGC,MAAM,IAChB,IAAI,CAACC,OAAO,GAAG,IAAIC,KAAK,CAAC,wBAAwBF,MAAM,GAAG,CAAC;IAC/D,CAAC,CAAC;EACN;AACF","ignoreList":[]}
|
package/lib/module/modules/bt-management/services/devices/veroval/veroval.duo-control-sequencer.js
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { hexToByte } from "../../../utils/hex-to-byte.js";
|
|
4
|
+
|
|
5
|
+
/** The control bytes of the serial protocol this device speaks over BLE. */
|
|
6
|
+
const ACK = 0x06;
|
|
7
|
+
const NAK = 0x15;
|
|
8
|
+
const ENQ = "05";
|
|
9
|
+
|
|
10
|
+
/** The device holds two user memories, and each is asked for a count and then its data. */
|
|
11
|
+
const STEPS = ["?MRN1", "?MDR1A", "?MRN2", "?MDR2A"];
|
|
12
|
+
|
|
13
|
+
/** A reply echoes the four-character command it answers, after the byte the reader strips. */
|
|
14
|
+
const TAG_FROM = 0;
|
|
15
|
+
const TAG_BYTES = 4;
|
|
16
|
+
const COUNT_BYTES = 3;
|
|
17
|
+
const ASCII_ZERO = 0x30;
|
|
18
|
+
const ASCII_NINE = 0x39;
|
|
19
|
+
const asciiOf = (frame, from, count) => frame.slice(from, from + count).map(byte => String.fromCharCode(hexToByte(byte))).join("");
|
|
20
|
+
const asciiNumberOf = (frame, from, count) => {
|
|
21
|
+
const codes = frame.slice(from, from + count).map(byte => hexToByte(byte));
|
|
22
|
+
if (codes.length !== count || codes.some(code => code < ASCII_ZERO || code > ASCII_NINE)) {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
return Number(codes.map(code => code - ASCII_ZERO).join(""));
|
|
26
|
+
};
|
|
27
|
+
const asciiCommand = (write, text) => ({
|
|
28
|
+
...write,
|
|
29
|
+
frame: [...text].map(character => character.charCodeAt(0).toString(16).padStart(2, "0")),
|
|
30
|
+
withoutResponse: true
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Walks the Veroval duo control through its stored history.
|
|
35
|
+
*
|
|
36
|
+
* The device answers one request at a time and holds two user memories, so the exchange is
|
|
37
|
+
* a fixed walk: ask user one how many records it has, read them, then user two. A memory
|
|
38
|
+
* that reports none is skipped rather than read.
|
|
39
|
+
*
|
|
40
|
+
* Two of its replies are not payload at all. A bare `ACK` means the device has more to send
|
|
41
|
+
* and is waiting to be asked, which is what `ENQ` does - so an acknowledgement provokes an
|
|
42
|
+
* enquiry rather than advancing the walk. A bare `NAK` is a refusal and ends it.
|
|
43
|
+
*
|
|
44
|
+
* Everything here is derived from HARTMANN's own application. The one part that is an
|
|
45
|
+
* inference rather than a reading is `ENQ` as flow control: the app writes it on receiving
|
|
46
|
+
* `ACK`, which is what that pair means in the serial protocol this is descended from, but
|
|
47
|
+
* the pacing was not observed on hardware.
|
|
48
|
+
*/
|
|
49
|
+
export class VerovalDuoControlSequencer {
|
|
50
|
+
step = 0;
|
|
51
|
+
isDone = false;
|
|
52
|
+
constructor(params) {
|
|
53
|
+
this.params = params;
|
|
54
|
+
}
|
|
55
|
+
initialCommands = () => [this.commandFor(0)];
|
|
56
|
+
nextCommand = frame => {
|
|
57
|
+
if (this.isDone) {
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
|
60
|
+
if (frame.length === 1) {
|
|
61
|
+
return this.answerControlByte(hexToByte(frame[0] ?? "0"));
|
|
62
|
+
}
|
|
63
|
+
const tag = asciiOf(frame, TAG_FROM, TAG_BYTES);
|
|
64
|
+
if (tag === "?MRN") {
|
|
65
|
+
return this.answerCount(frame);
|
|
66
|
+
}
|
|
67
|
+
return tag === "?MDR" ? this.advance() : undefined;
|
|
68
|
+
};
|
|
69
|
+
answerControlByte = code => {
|
|
70
|
+
if (code === ACK) {
|
|
71
|
+
return [asciiCommandFromHex(this.params.write, ENQ)];
|
|
72
|
+
}
|
|
73
|
+
if (code === NAK) {
|
|
74
|
+
return this.stop("the device refused the request");
|
|
75
|
+
}
|
|
76
|
+
return undefined;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* A memory reporting no records is skipped. Asking for the data of an empty memory is a
|
|
81
|
+
* request the device answers with nothing, which would stall the walk on its own reply.
|
|
82
|
+
*/
|
|
83
|
+
answerCount = frame => {
|
|
84
|
+
const count = asciiNumberOf(frame, TAG_BYTES, COUNT_BYTES);
|
|
85
|
+
if (count === undefined) {
|
|
86
|
+
return this.stop("the device answered a record count that was not a number");
|
|
87
|
+
}
|
|
88
|
+
return count > 0 ? this.advance() : this.skipMemory();
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
/** Past this memory's data command, to the next memory's count. */
|
|
92
|
+
skipMemory = () => {
|
|
93
|
+
this.step += 1;
|
|
94
|
+
return this.advance();
|
|
95
|
+
};
|
|
96
|
+
advance = () => {
|
|
97
|
+
this.step += 1;
|
|
98
|
+
if (this.step >= STEPS.length) {
|
|
99
|
+
this.isDone = true;
|
|
100
|
+
return undefined;
|
|
101
|
+
}
|
|
102
|
+
return [this.commandFor(this.step)];
|
|
103
|
+
};
|
|
104
|
+
stop = reason => {
|
|
105
|
+
this.isDone = true;
|
|
106
|
+
this.params.onRefused(reason);
|
|
107
|
+
return undefined;
|
|
108
|
+
};
|
|
109
|
+
commandFor = step => asciiCommand(this.params.write, STEPS[step] ?? "");
|
|
110
|
+
}
|
|
111
|
+
const asciiCommandFromHex = (write, hex) => ({
|
|
112
|
+
...write,
|
|
113
|
+
frame: [hex],
|
|
114
|
+
withoutResponse: true
|
|
115
|
+
});
|
|
116
|
+
//# sourceMappingURL=veroval.duo-control-sequencer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["hexToByte","ACK","NAK","ENQ","STEPS","TAG_FROM","TAG_BYTES","COUNT_BYTES","ASCII_ZERO","ASCII_NINE","asciiOf","frame","from","count","slice","map","byte","String","fromCharCode","join","asciiNumberOf","codes","length","some","code","undefined","Number","asciiCommand","write","text","character","charCodeAt","toString","padStart","withoutResponse","VerovalDuoControlSequencer","step","isDone","constructor","params","initialCommands","commandFor","nextCommand","answerControlByte","tag","answerCount","advance","asciiCommandFromHex","stop","skipMemory","reason","onRefused","hex"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/veroval/veroval.duo-control-sequencer.ts"],"mappings":";;AAEA,SAASA,SAAS,QAAQ,+BAA4B;;AAEtD;AACA,MAAMC,GAAG,GAAG,IAAI;AAChB,MAAMC,GAAG,GAAG,IAAI;AAChB,MAAMC,GAAG,GAAG,IAAI;;AAEhB;AACA,MAAMC,KAAK,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAU;;AAE7D;AACA,MAAMC,QAAQ,GAAG,CAAC;AAClB,MAAMC,SAAS,GAAG,CAAC;AACnB,MAAMC,WAAW,GAAG,CAAC;AACrB,MAAMC,UAAU,GAAG,IAAI;AACvB,MAAMC,UAAU,GAAG,IAAI;AAEvB,MAAMC,OAAO,GAAGA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AA0D,CAAC;IAC9E;IAEA,OAAOnC,KAAK,GAAG,CAAC,GAAG,IAAI,CAACiC,OAAO,CAAC,CAAC,GAAG,IAAI,CAACG,UAAU,CAAC,CAAC;EACvD,CAAC;;EAED;EACQA,UAAU,GAAGA,CAAA,KAA4C;IAC/D,IAAI,CAACb,IAAI,IAAI,CAAC;IAEd,OAAO,IAAI,CAACU,OAAO,CAAC,CAAC;EACvB,CAAC;EAEOA,OAAO,GAAGA,CAAA,KAA4C;IAC5D,IAAI,CAACV,IAAI,IAAI,CAAC;IAEd,IAAI,IAAI,CAACA,IAAI,IAAIhC,KAAK,CAACkB,MAAM,EAAE;MAC7B,IAAI,CAACe,MAAM,GAAG,IAAI;MAElB,OAAOZ,SAAS;IAClB;IAEA,OAAO,CAAC,IAAI,CAACgB,UAAU,CAAC,IAAI,CAACL,IAAI,CAAC,CAAC;EACrC,CAAC;EAEOY,IAAI,GAAIE,MAAc,IAAgB;IAC5C,IAAI,CAACb,MAAM,GAAG,IAAI;IAClB,IAAI,CAACE,MAAM,CAACY,SAAS,CAACD,MAAM,CAAC;IAE7B,OAAOzB,SAAS;EAClB,CAAC;EAEOgB,UAAU,GAAIL,IAAY,IAChCT,YAAY,CAAC,IAAI,CAACY,MAAM,CAACX,KAAK,EAAExB,KAAK,CAACgC,IAAI,CAAC,IAAI,EAAE,CAAC;AACtD;AAEA,MAAMW,mBAAmB,GAAGA,CAC1BnB,KAAmC,EACnCwB,GAAW,MACQ;EAAE,GAAGxB,KAAK;EAAEjB,KAAK,EAAE,CAACyC,GAAG,CAAC;EAAElB,eAAe,EAAE;AAAK,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,87 @@
|
|
|
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 { decodeVerovalEcgSamples, VEROVAL_ECG_SAMPLE_RATE_HZ } from "./veroval.ecg-samples.js";
|
|
7
|
+
import { VerovalEcgTransfer } from "./veroval.ecg-transfer.js";
|
|
8
|
+
const SERVICE = "0000a000-0000-1000-8000-00805f9b34fb";
|
|
9
|
+
|
|
10
|
+
/** Requests go to one characteristic and every reply arrives on the other. */
|
|
11
|
+
const CONTROL_POINT = "00002a37-0000-1000-8000-00805f9b34fb";
|
|
12
|
+
const NOTIFY = "00002a36-0000-1000-8000-00805f9b34fb";
|
|
13
|
+
|
|
14
|
+
/** A recording is thirty-four seconds, and the device waits on a person before sending it. */
|
|
15
|
+
const STUCK_TIMEOUT_MS = 180_000;
|
|
16
|
+
const PREFERRED_MTU = 247;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Every notification matches this, and none of them is a measurement.
|
|
20
|
+
*
|
|
21
|
+
* The transfer assembles the recording itself and reports it once, so the parser is given a
|
|
22
|
+
* case that matches anything and decodes nothing. Without it each of the five hundred odd
|
|
23
|
+
* packets would be logged as a frame nothing declared.
|
|
24
|
+
*/
|
|
25
|
+
const acceptEverything = {
|
|
26
|
+
caseValuePosition: [],
|
|
27
|
+
cases: [{
|
|
28
|
+
caseValue: "",
|
|
29
|
+
caseType: CaseType.OTHER,
|
|
30
|
+
parseDefinitions: [],
|
|
31
|
+
description: "A packet of a download, assembled by the transfer"
|
|
32
|
+
}]
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The Veroval ECG.
|
|
37
|
+
*
|
|
38
|
+
* Reading it is a download rather than a decode, so the whole recording is assembled before
|
|
39
|
+
* anything is reported: thirty-four seconds of samples at 128 Hz, two bytes each, converted
|
|
40
|
+
* to millivolts with the device's own calibration.
|
|
41
|
+
*
|
|
42
|
+
* The vendor's app plots a thirty-second window of this with a baseline-wander filter
|
|
43
|
+
* applied. That is a display transform, not calibration, so it is deliberately not
|
|
44
|
+
* reproduced here - what is reported is what the device recorded.
|
|
45
|
+
*/
|
|
46
|
+
export class VerovalEcgDevice extends BTManagedDevice {
|
|
47
|
+
stuckDataTimeout = STUCK_TIMEOUT_MS;
|
|
48
|
+
preferredMtu = PREFERRED_MTU;
|
|
49
|
+
onStreamStart = undefined;
|
|
50
|
+
mainServices = [{
|
|
51
|
+
uuid: SERVICE,
|
|
52
|
+
monitorUuids: [{
|
|
53
|
+
uuid: NOTIFY,
|
|
54
|
+
parsingModel: acceptEverything
|
|
55
|
+
}]
|
|
56
|
+
}];
|
|
57
|
+
validatePackage = () => true;
|
|
58
|
+
createCommandSequencer = () => new VerovalEcgTransfer({
|
|
59
|
+
write: {
|
|
60
|
+
serviceUuid: SERVICE,
|
|
61
|
+
characteristicUuid: CONTROL_POINT
|
|
62
|
+
},
|
|
63
|
+
onRecording: this.reportRecording
|
|
64
|
+
});
|
|
65
|
+
constructor(device, params) {
|
|
66
|
+
super(device, params);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** Nothing is reported per packet; the transfer reports the recording when it is whole. */
|
|
70
|
+
handleSuccessResult() {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
reportRecording = bytes => {
|
|
74
|
+
const diagramPoints = decodeVerovalEcgSamples(bytes);
|
|
75
|
+
if (diagramPoints.length === 0) {
|
|
76
|
+
this.onError?.(new Error("Veroval ECG: the recording held no samples."));
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
this.onResult?.({
|
|
80
|
+
measurementTypeKey: MeasurementTypeKey.ecg,
|
|
81
|
+
caseType: CaseType.RESULT,
|
|
82
|
+
diagramPoints,
|
|
83
|
+
duration: diagramPoints.length / VEROVAL_ECG_SAMPLE_RATE_HZ
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=veroval.ecg-device.js.map
|