@ovok/native 0.4.5 → 0.4.7
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-management/index.js +176 -0
- package/lib/commonjs/modules/bt-management/index.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/custom/compile-case-fields.js +49 -0
- package/lib/commonjs/modules/bt-management/services/custom/compile-case-fields.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/custom/compile-custom-case.js +47 -41
- 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-frame.js +48 -2
- package/lib/commonjs/modules/bt-management/services/custom/compile-custom-frame.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/custom/compile-custom-lepu.js +98 -0
- package/lib/commonjs/modules/bt-management/services/custom/compile-custom-lepu.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/custom/define-custom-device.js +24 -1
- package/lib/commonjs/modules/bt-management/services/custom/define-custom-device.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/device-creator.js +15 -8
- package/lib/commonjs/modules/bt-management/services/device-creator.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/aoj/aoj.thermometers.js +85 -0
- package/lib/commonjs/modules/bt-management/services/devices/aoj/aoj.thermometers.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/bp2/bp2.frame-reader.js +8 -74
- package/lib/commonjs/modules/bt-management/services/devices/bp2/bp2.frame-reader.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/bt-command-writer.js +141 -0
- package/lib/commonjs/modules/bt-management/services/devices/bt-command-writer.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/bt-connection-handler.js +16 -50
- package/lib/commonjs/modules/bt-management/services/devices/bt-connection-handler.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/bt-data-processor.js +17 -6
- package/lib/commonjs/modules/bt-management/services/devices/bt-data-processor.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/bt-managed-device.js +21 -14
- package/lib/commonjs/modules/bt-management/services/devices/bt-managed-device.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/custom/custom-lepu-sequencer.js +36 -0
- package/lib/commonjs/modules/bt-management/services/devices/custom/custom-lepu-sequencer.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/custom/custom.device.js +81 -14
- package/lib/commonjs/modules/bt-management/services/devices/custom/custom.device.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.command-builder.js +48 -0
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.command-builder.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.commands.js +37 -0
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.commands.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.device-info.js +83 -0
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.device-info.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.device-names.js +26 -0
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.device-names.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.file-names.js +36 -0
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.file-names.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.file-transfer.js +155 -0
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.file-transfer.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.frame-reader.js +98 -0
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.frame-reader.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.frame.js +29 -0
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.frame.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.identity-gate.js +103 -0
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.identity-gate.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.name-match.js +32 -0
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.name-match.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.response-type.js +64 -0
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.response-type.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.transports.js +143 -0
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.transports.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/polling-command-sequencer.js +38 -0
- package/lib/commonjs/modules/bt-management/services/devices/polling-command-sequencer.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.js +156 -0
- package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.bp-monitors.js +124 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.bp-monitors.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.js +113 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.lepod.js +117 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.lepod.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.oximeters.js +82 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.oximeters.js.map +1 -0
- package/lib/commonjs/modules/bt-management/types/command-sequencer.js +6 -0
- package/lib/commonjs/modules/bt-management/types/command-sequencer.js.map +1 -0
- package/lib/commonjs/modules/bt-management/types/custom-checksum-algorithm.js +2 -0
- package/lib/commonjs/modules/bt-management/types/custom-checksum-algorithm.js.map +1 -0
- package/lib/commonjs/modules/bt-management/types/custom-checksum-spec.js +6 -0
- package/lib/commonjs/modules/bt-management/types/custom-checksum-spec.js.map +1 -0
- package/lib/commonjs/modules/bt-management/types/custom-lepu-spec.js +2 -0
- package/lib/commonjs/modules/bt-management/types/custom-lepu-spec.js.map +1 -0
- package/lib/commonjs/modules/bt-management/types/custom-measurement-spec.js +6 -0
- package/lib/commonjs/modules/bt-management/types/custom-measurement-spec.js.map +1 -0
- package/lib/commonjs/modules/bt-management/types/device-command.js +2 -0
- package/lib/commonjs/modules/bt-management/types/device-command.js.map +1 -0
- package/lib/commonjs/modules/bt-management/types/measurement-group.js +6 -0
- package/lib/commonjs/modules/bt-management/types/measurement-group.js.map +1 -0
- package/lib/commonjs/modules/bt-management/utils/calculate-checksum.js +49 -0
- package/lib/commonjs/modules/bt-management/utils/calculate-checksum.js.map +1 -0
- package/lib/commonjs/modules/bt-management/utils/create-frame-validator.js +9 -0
- package/lib/commonjs/modules/bt-management/utils/create-frame-validator.js.map +1 -1
- package/lib/commonjs/modules/bt-management/utils/hex-to-bytes.js +19 -0
- package/lib/commonjs/modules/bt-management/utils/hex-to-bytes.js.map +1 -0
- package/lib/commonjs/modules/bt-management/utils/le-32-to-bytes.js +13 -0
- package/lib/commonjs/modules/bt-management/utils/le-32-to-bytes.js.map +1 -0
- package/lib/commonjs/modules/bt-management/utils/summarise-measurement-for-log.js +22 -0
- package/lib/commonjs/modules/bt-management/utils/summarise-measurement-for-log.js.map +1 -0
- package/lib/commonjs/modules/bt-management/utils/supported-measurement-type-keys.js +18 -0
- package/lib/commonjs/modules/bt-management/utils/supported-measurement-type-keys.js.map +1 -0
- package/lib/module/modules/bt-management/index.js +16 -0
- package/lib/module/modules/bt-management/index.js.map +1 -1
- package/lib/module/modules/bt-management/services/custom/compile-case-fields.js +44 -0
- package/lib/module/modules/bt-management/services/custom/compile-case-fields.js.map +1 -0
- package/lib/module/modules/bt-management/services/custom/compile-custom-case.js +47 -41
- 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-frame.js +48 -2
- package/lib/module/modules/bt-management/services/custom/compile-custom-frame.js.map +1 -1
- package/lib/module/modules/bt-management/services/custom/compile-custom-lepu.js +93 -0
- package/lib/module/modules/bt-management/services/custom/compile-custom-lepu.js.map +1 -0
- package/lib/module/modules/bt-management/services/custom/define-custom-device.js +24 -1
- package/lib/module/modules/bt-management/services/custom/define-custom-device.js.map +1 -1
- package/lib/module/modules/bt-management/services/device-creator.js +16 -8
- package/lib/module/modules/bt-management/services/device-creator.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/aoj/aoj.thermometers.js +81 -0
- package/lib/module/modules/bt-management/services/devices/aoj/aoj.thermometers.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/bp2/bp2.frame-reader.js +8 -73
- package/lib/module/modules/bt-management/services/devices/bp2/bp2.frame-reader.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/bt-command-writer.js +136 -0
- package/lib/module/modules/bt-management/services/devices/bt-command-writer.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/bt-connection-handler.js +16 -50
- package/lib/module/modules/bt-management/services/devices/bt-connection-handler.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/bt-data-processor.js +17 -6
- package/lib/module/modules/bt-management/services/devices/bt-data-processor.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/bt-managed-device.js +21 -14
- package/lib/module/modules/bt-management/services/devices/bt-managed-device.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/custom/custom-lepu-sequencer.js +32 -0
- package/lib/module/modules/bt-management/services/devices/custom/custom-lepu-sequencer.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/custom/custom.device.js +81 -14
- package/lib/module/modules/bt-management/services/devices/custom/custom.device.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.command-builder.js +43 -0
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.command-builder.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.commands.js +33 -0
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.commands.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.device-info.js +79 -0
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.device-info.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.device-names.js +22 -0
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.device-names.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.file-names.js +32 -0
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.file-names.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.file-transfer.js +150 -0
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.file-transfer.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.frame-reader.js +93 -0
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.frame-reader.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.frame.js +24 -0
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.frame.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.identity-gate.js +98 -0
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.identity-gate.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.name-match.js +27 -0
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.name-match.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.response-type.js +59 -0
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.response-type.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.transports.js +140 -0
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.transports.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/polling-command-sequencer.js +34 -0
- package/lib/module/modules/bt-management/services/devices/polling-command-sequencer.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.js +149 -0
- package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/viatom/viatom.bp-monitors.js +118 -0
- package/lib/module/modules/bt-management/services/devices/viatom/viatom.bp-monitors.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.js +108 -0
- package/lib/module/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/viatom/viatom.lepod.js +114 -0
- package/lib/module/modules/bt-management/services/devices/viatom/viatom.lepod.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/viatom/viatom.oximeters.js +79 -0
- package/lib/module/modules/bt-management/services/devices/viatom/viatom.oximeters.js.map +1 -0
- package/lib/module/modules/bt-management/types/command-sequencer.js +4 -0
- package/lib/module/modules/bt-management/types/command-sequencer.js.map +1 -0
- package/lib/module/modules/bt-management/types/custom-checksum-algorithm.js +2 -0
- package/lib/module/modules/bt-management/types/custom-checksum-algorithm.js.map +1 -0
- package/lib/module/modules/bt-management/types/custom-checksum-spec.js +4 -0
- package/lib/module/modules/bt-management/types/custom-checksum-spec.js.map +1 -0
- package/lib/module/modules/bt-management/types/custom-device-definition.js.map +1 -1
- package/lib/module/modules/bt-management/types/custom-lepu-spec.js +2 -0
- package/lib/module/modules/bt-management/types/custom-lepu-spec.js.map +1 -0
- package/lib/module/modules/bt-management/types/custom-measurement-spec.js +4 -0
- package/lib/module/modules/bt-management/types/custom-measurement-spec.js.map +1 -0
- package/lib/module/modules/bt-management/types/device-command.js +2 -0
- package/lib/module/modules/bt-management/types/device-command.js.map +1 -0
- package/lib/module/modules/bt-management/types/measurement-group.js +4 -0
- package/lib/module/modules/bt-management/types/measurement-group.js.map +1 -0
- package/lib/module/modules/bt-management/utils/calculate-checksum.js +44 -0
- package/lib/module/modules/bt-management/utils/calculate-checksum.js.map +1 -0
- package/lib/module/modules/bt-management/utils/create-frame-validator.js +9 -0
- package/lib/module/modules/bt-management/utils/create-frame-validator.js.map +1 -1
- package/lib/module/modules/bt-management/utils/hex-to-bytes.js +14 -0
- package/lib/module/modules/bt-management/utils/hex-to-bytes.js.map +1 -0
- package/lib/module/modules/bt-management/utils/le-32-to-bytes.js +8 -0
- package/lib/module/modules/bt-management/utils/le-32-to-bytes.js.map +1 -0
- package/lib/module/modules/bt-management/utils/summarise-measurement-for-log.js +17 -0
- package/lib/module/modules/bt-management/utils/summarise-measurement-for-log.js.map +1 -0
- package/lib/module/modules/bt-management/utils/supported-measurement-type-keys.js +13 -0
- package/lib/module/modules/bt-management/utils/supported-measurement-type-keys.js.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/index.d.ts +16 -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-fields.d.ts +13 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/custom/compile-case-fields.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-frame.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/custom/compile-custom-lepu.d.ts +11 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/custom/compile-custom-lepu.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/custom/define-custom-device.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/aoj/aoj.thermometers.d.ts +24 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/aoj/aoj.thermometers.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bp2/bp2.frame-reader.d.ts +5 -8
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bp2/bp2.frame-reader.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-command-writer.d.ts +67 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-command-writer.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-connection-handler.d.ts +6 -4
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-connection-handler.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-data-processor.d.ts +20 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-data-processor.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-managed-device.d.ts +12 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-managed-device.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/custom/custom-lepu-sequencer.d.ts +21 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/custom/custom-lepu-sequencer.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/custom/custom.device.d.ts +33 -0
- 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/lepu/lepu.command-builder.d.ts +24 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.command-builder.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.commands.d.ts +32 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.commands.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.device-info.d.ts +27 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.device-info.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.device-names.d.ts +20 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.device-names.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.file-names.d.ts +14 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.file-names.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.file-transfer.d.ts +75 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.file-transfer.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.frame-reader.d.ts +28 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.frame-reader.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.frame.d.ts +12 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.frame.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.identity-gate.d.ts +81 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.identity-gate.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.name-match.d.ts +17 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.name-match.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.response-type.d.ts +33 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.response-type.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.transports.d.ts +85 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.transports.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/polling-command-sequencer.d.ts +27 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/polling-command-sequencer.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.d.ts +44 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.bp-monitors.d.ts +44 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.bp-monitors.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.d.ts +32 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.lepod.d.ts +25 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.lepod.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.oximeters.d.ts +39 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.oximeters.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/command-sequencer.d.ts +26 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/command-sequencer.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/custom-case-spec.d.ts +13 -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-checksum-algorithm.d.ts +10 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/custom-checksum-algorithm.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/custom-checksum-spec.d.ts +23 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/custom-checksum-spec.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/custom-device-definition.d.ts +5 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/custom-device-definition.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/custom-device-spec.d.ts +12 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/custom-device-spec.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/custom-frame-spec.d.ts +8 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/custom-frame-spec.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/custom-lepu-spec.d.ts +44 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/custom-lepu-spec.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/custom-measurement-spec.d.ts +9 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/custom-measurement-spec.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/device-command.d.ts +18 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/device-command.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/measurement-group.d.ts +14 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/measurement-group.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/parsing-case.d.ts +9 -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/calculate-checksum.d.ts +13 -0
- package/lib/typescript/commonjs/src/modules/bt-management/utils/calculate-checksum.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/utils/create-frame-validator.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/utils/hex-to-bytes.d.ts +10 -0
- package/lib/typescript/commonjs/src/modules/bt-management/utils/hex-to-bytes.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/utils/le-32-to-bytes.d.ts +3 -0
- package/lib/typescript/commonjs/src/modules/bt-management/utils/le-32-to-bytes.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/utils/summarise-measurement-for-log.d.ts +9 -0
- package/lib/typescript/commonjs/src/modules/bt-management/utils/summarise-measurement-for-log.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/utils/supported-measurement-type-keys.d.ts +10 -0
- package/lib/typescript/commonjs/src/modules/bt-management/utils/supported-measurement-type-keys.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/index.d.ts +16 -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-fields.d.ts +13 -0
- package/lib/typescript/module/src/modules/bt-management/services/custom/compile-case-fields.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-frame.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/custom/compile-custom-lepu.d.ts +11 -0
- package/lib/typescript/module/src/modules/bt-management/services/custom/compile-custom-lepu.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/custom/define-custom-device.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/aoj/aoj.thermometers.d.ts +24 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/aoj/aoj.thermometers.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/bp2/bp2.frame-reader.d.ts +5 -8
- package/lib/typescript/module/src/modules/bt-management/services/devices/bp2/bp2.frame-reader.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/bt-command-writer.d.ts +67 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/bt-command-writer.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/bt-connection-handler.d.ts +6 -4
- package/lib/typescript/module/src/modules/bt-management/services/devices/bt-connection-handler.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/bt-data-processor.d.ts +20 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/bt-data-processor.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/bt-managed-device.d.ts +12 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/bt-managed-device.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/custom/custom-lepu-sequencer.d.ts +21 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/custom/custom-lepu-sequencer.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/custom/custom.device.d.ts +33 -0
- 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/lepu/lepu.command-builder.d.ts +24 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.command-builder.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.commands.d.ts +32 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.commands.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.device-info.d.ts +27 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.device-info.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.device-names.d.ts +20 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.device-names.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.file-names.d.ts +14 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.file-names.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.file-transfer.d.ts +75 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.file-transfer.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.frame-reader.d.ts +28 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.frame-reader.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.frame.d.ts +12 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.frame.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.identity-gate.d.ts +81 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.identity-gate.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.name-match.d.ts +17 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.name-match.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.response-type.d.ts +33 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.response-type.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.transports.d.ts +85 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.transports.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/polling-command-sequencer.d.ts +27 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/polling-command-sequencer.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.d.ts +44 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.bp-monitors.d.ts +44 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.bp-monitors.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.d.ts +32 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.lepod.d.ts +25 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.lepod.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.oximeters.d.ts +39 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.oximeters.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/types/command-sequencer.d.ts +26 -0
- package/lib/typescript/module/src/modules/bt-management/types/command-sequencer.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/types/custom-case-spec.d.ts +13 -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-checksum-algorithm.d.ts +10 -0
- package/lib/typescript/module/src/modules/bt-management/types/custom-checksum-algorithm.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/types/custom-checksum-spec.d.ts +23 -0
- package/lib/typescript/module/src/modules/bt-management/types/custom-checksum-spec.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/types/custom-device-definition.d.ts +5 -0
- package/lib/typescript/module/src/modules/bt-management/types/custom-device-definition.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/types/custom-device-spec.d.ts +12 -0
- package/lib/typescript/module/src/modules/bt-management/types/custom-device-spec.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/types/custom-frame-spec.d.ts +8 -0
- package/lib/typescript/module/src/modules/bt-management/types/custom-frame-spec.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/types/custom-lepu-spec.d.ts +44 -0
- package/lib/typescript/module/src/modules/bt-management/types/custom-lepu-spec.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/types/custom-measurement-spec.d.ts +9 -0
- package/lib/typescript/module/src/modules/bt-management/types/custom-measurement-spec.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/types/device-command.d.ts +18 -0
- package/lib/typescript/module/src/modules/bt-management/types/device-command.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/types/measurement-group.d.ts +14 -0
- package/lib/typescript/module/src/modules/bt-management/types/measurement-group.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/types/parsing-case.d.ts +9 -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/calculate-checksum.d.ts +13 -0
- package/lib/typescript/module/src/modules/bt-management/utils/calculate-checksum.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/utils/create-frame-validator.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/utils/hex-to-bytes.d.ts +10 -0
- package/lib/typescript/module/src/modules/bt-management/utils/hex-to-bytes.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/utils/le-32-to-bytes.d.ts +3 -0
- package/lib/typescript/module/src/modules/bt-management/utils/le-32-to-bytes.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/utils/summarise-measurement-for-log.d.ts +9 -0
- package/lib/typescript/module/src/modules/bt-management/utils/summarise-measurement-for-log.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/utils/supported-measurement-type-keys.d.ts +10 -0
- package/lib/typescript/module/src/modules/bt-management/utils/supported-measurement-type-keys.d.ts.map +1 -0
- package/package.json +12 -1
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
import { sentryLogger } from "../../../helpers/utils/sentry-logger.js";
|
|
4
4
|
import { DeviceStatus } from "../../types/device-status.js";
|
|
5
|
+
import { summariseMeasurementForLog } from "../../utils/summarise-measurement-for-log.js";
|
|
6
|
+
import { supportedMeasurementTypeKeys } from "../../utils/supported-measurement-type-keys.js";
|
|
5
7
|
import { BTConnectionHandler } from "./bt-connection-handler.js";
|
|
6
8
|
import { BTDataProcessor } from "./bt-data-processor.js";
|
|
9
|
+
import { pollingSequencerFor } from "./polling-command-sequencer.js";
|
|
7
10
|
export class BTManagedDevice {
|
|
8
11
|
/**
|
|
9
12
|
* The timeout in milliseconds for the stuck data.
|
|
@@ -18,6 +21,17 @@ export class BTManagedDevice {
|
|
|
18
21
|
* @returns The handled data.
|
|
19
22
|
*/
|
|
20
23
|
|
|
24
|
+
/**
|
|
25
|
+
* Builds the policy that decides what to send this device, and when.
|
|
26
|
+
*
|
|
27
|
+
* A factory rather than an instance, because a sequencer carries the state of the
|
|
28
|
+
* exchange - whether the device has identified itself, how far a file read has got. One
|
|
29
|
+
* shared across connections would resume a conversation the device has forgotten.
|
|
30
|
+
*
|
|
31
|
+
* A device that leaves this undefined polls with the command its services declare, which
|
|
32
|
+
* is what every device did before a policy could be expressed at all.
|
|
33
|
+
*/
|
|
34
|
+
|
|
21
35
|
/**
|
|
22
36
|
* Locates frame boundaries inside the notification buffer.
|
|
23
37
|
*
|
|
@@ -91,10 +105,7 @@ export class BTManagedDevice {
|
|
|
91
105
|
...data
|
|
92
106
|
}) => {
|
|
93
107
|
sentryLogger("info", "BT_MANAGER: Calling onResult callback", {
|
|
94
|
-
data:
|
|
95
|
-
...data,
|
|
96
|
-
diagramPoints: "diagramPoints" in data ? data.diagramPoints.length : undefined
|
|
97
|
-
},
|
|
108
|
+
data: summariseMeasurementForLog(data),
|
|
98
109
|
deviceData: this.deviceData,
|
|
99
110
|
deviceName: this.deviceData.name
|
|
100
111
|
});
|
|
@@ -118,7 +129,8 @@ export class BTManagedDevice {
|
|
|
118
129
|
};
|
|
119
130
|
connect = async () => {
|
|
120
131
|
// To access the abstract property in the constructor, we need to set it here
|
|
121
|
-
this.deviceData.measurementTypes = this.
|
|
132
|
+
this.deviceData.measurementTypes = supportedMeasurementTypeKeys(this.mainServices);
|
|
133
|
+
const sequencer = this.createCommandSequencer?.() ?? pollingSequencerFor(this.mainServices);
|
|
122
134
|
this.connectionHandler = new BTConnectionHandler(this.device, this.mainServices, {
|
|
123
135
|
onStatusChanged: status => {
|
|
124
136
|
this.onDeviceStatusChanged?.bind(this)(status);
|
|
@@ -130,7 +142,8 @@ export class BTManagedDevice {
|
|
|
130
142
|
onError: error => this.onError?.bind(this)(error),
|
|
131
143
|
onDataReceived: (uuid, hexValue) => {
|
|
132
144
|
this.dataProcessor?.processData(uuid, hexValue);
|
|
133
|
-
}
|
|
145
|
+
},
|
|
146
|
+
initialCommands: () => sequencer.initialCommands()
|
|
134
147
|
}, this.preferredMtu);
|
|
135
148
|
this.dataProcessor = new BTDataProcessor(this.device, this.mainServices, this.stuckDataTimeout, {
|
|
136
149
|
onStatusChanged: this.onDeviceStatusChanged?.bind(this),
|
|
@@ -143,18 +156,12 @@ export class BTManagedDevice {
|
|
|
143
156
|
this.onError?.bind(this)(error);
|
|
144
157
|
}
|
|
145
158
|
},
|
|
146
|
-
|
|
159
|
+
nextCommand: frame => sequencer.nextCommand(frame),
|
|
160
|
+
sendCommands: commands => void this.connectionHandler?.sendCommands(commands),
|
|
147
161
|
onError: this.onError?.bind(this),
|
|
148
162
|
handleDependentResult: this.handleDependentResult?.bind(this)
|
|
149
163
|
}, this.frameReader);
|
|
150
164
|
await this.connectionHandler.connect();
|
|
151
165
|
};
|
|
152
|
-
getSupportedMeasurementTypeKeys = () => {
|
|
153
|
-
const measurementTypes = this.mainServices.flatMap(service => {
|
|
154
|
-
return service.monitorUuids.flatMap(uuid => uuid.parsingModel.cases.map(c => c.measurementTypeKey) || []);
|
|
155
|
-
}).filter(type => type !== undefined);
|
|
156
|
-
const uniqueMeasurementTypes = [...new Set(measurementTypes.flat())];
|
|
157
|
-
return uniqueMeasurementTypes;
|
|
158
|
-
};
|
|
159
166
|
}
|
|
160
167
|
//# sourceMappingURL=bt-managed-device.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["sentryLogger","DeviceStatus","BTConnectionHandler","BTDataProcessor","BTManagedDevice","constructor","device","deviceName","onError","onErrorCallback","onDeviceStatusChanged","onDeviceStatusChangedCallback","onResult","onResultCallback","onDeviceDisconnected","onDeviceDisconnectedCallback","deviceId","id","deviceData","name","localName","manufacturerData","sn","measurementTypes","status","measurementTypeKey","error","Error","message","caseType","_","data","
|
|
1
|
+
{"version":3,"names":["sentryLogger","DeviceStatus","summariseMeasurementForLog","supportedMeasurementTypeKeys","BTConnectionHandler","BTDataProcessor","pollingSequencerFor","BTManagedDevice","constructor","device","deviceName","onError","onErrorCallback","onDeviceStatusChanged","onDeviceStatusChangedCallback","onResult","onResultCallback","onDeviceDisconnected","onDeviceDisconnectedCallback","deviceId","id","deviceData","name","localName","manufacturerData","sn","measurementTypes","status","measurementTypeKey","error","Error","message","caseType","_","data","destroy","connectionHandler","dataProcessor","undefined","connect","mainServices","sequencer","createCommandSequencer","onStatusChanged","bind","DISCONNECTED","onDataReceived","uuid","hexValue","processData","initialCommands","preferredMtu","stuckDataTimeout","onStreamStart","validatePackage","parsedData","collectedValues","handleSuccessResult","nextCommand","frame","sendCommands","commands","handleDependentResult","frameReader"],"sourceRoot":"../../../../../../src","sources":["modules/bt-management/services/devices/bt-managed-device.ts"],"mappings":";;AAGA,SAASA,YAAY,QAAQ,yCAAsC;AAOnE,SAASC,YAAY,QAAQ,8BAA2B;AAMxD,SAASC,0BAA0B,QAAQ,8CAA2C;AACtF,SAASC,4BAA4B,QAAQ,gDAA6C;AAE1F,SAASC,mBAAmB,QAAQ,4BAAyB;AAC7D,SAASC,eAAe,QAAQ,wBAAqB;AACrD,SAASC,mBAAmB,QAAQ,gCAA6B;AAEjE,OAAO,MAAeC,eAAe,CAErC;EASE;AACF;AACA;;EAGE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;;EAOE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;EAGE;AACF;AACA;AACA;AACA;AACA;AACA;;EAGE;AACF;AACA;AACA;AACA;AACA;;EAGE;AACF;AACA;AACA;AACA;AACA;;EAiBEC,WAAWA,CACOC,MAAc,EAE9B;IACEC,UAAU;IACVC,OAAO,EAAEC,eAAe;IACxBC,qBAAqB,EAAEC,6BAA6B;IACpDC,QAAQ,EAAEC,gBAAgB;IAC1BC,oBAAoB,EAAEC;EACD,CAAC,EACxB;IAAA,KATgBT,MAAc,GAAdA,MAAc;IAU9BT,YAAY,CAAC,MAAM,EAAE,sC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,IACrB,KAAK,IAAI,CAACzB,iBAAiB,EAAEwB,YAAY,CAACC,QAAQ,CAAC;MACrDlD,OAAO,EAAE,IAAI,CAACA,OAAO,EAAEiC,IAAI,CAAC,IAAI,CAAC;MACjCkB,qBAAqB,EAAE,IAAI,CAACA,qBAAqB,EAAElB,IAAI,CAAC,IAAI;IAC9D,CAAC,EACD,IAAI,CAACmB,WACP,CAAC;IAED,MAAM,IAAI,CAAC3B,iBAAiB,CAACG,OAAO,CAAC,CAAC;EACxC,CAAC;AAEH","ignoreList":[]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { LepuCommandBuilder } from "../lepu/lepu.command-builder.js";
|
|
4
|
+
import { LepuIdentityGate } from "../lepu/lepu.identity-gate.js";
|
|
5
|
+
|
|
6
|
+
/** Registration guarantees at least one start byte; this keeps the indexed read total. */
|
|
7
|
+
const DEFAULT_START_BYTE = "a5";
|
|
8
|
+
/**
|
|
9
|
+
* Builds the gate a Lepu declaration asks for.
|
|
10
|
+
*
|
|
11
|
+
* A fresh builder each time, because its sequence number is per connection: one shared
|
|
12
|
+
* across devices would interleave their counters, which is a defect the vendor's own global
|
|
13
|
+
* counter has.
|
|
14
|
+
*
|
|
15
|
+
* Frames are built with the first declared start byte. A device that accepts either still
|
|
16
|
+
* answers on the one it is addressed with, so the list matters for reading and its head for
|
|
17
|
+
* writing.
|
|
18
|
+
*/
|
|
19
|
+
export const createLepuSequencer = (lepu, report) => new LepuIdentityGate({
|
|
20
|
+
write: {
|
|
21
|
+
serviceUuid: lepu.write.serviceUuid,
|
|
22
|
+
characteristicUuid: lepu.write.characteristicUuid
|
|
23
|
+
},
|
|
24
|
+
builder: new LepuCommandBuilder(lepu.startBytes[0] ?? DEFAULT_START_BYTE),
|
|
25
|
+
expectedDeviceTypes: lepu.expectedDeviceTypes,
|
|
26
|
+
...(lepu.pollCommand === undefined ? {} : {
|
|
27
|
+
pollCommand: lepu.pollCommand
|
|
28
|
+
}),
|
|
29
|
+
onIdentified: report.onIdentified,
|
|
30
|
+
onRefused: report.onRefused
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=custom-lepu-sequencer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["LepuCommandBuilder","LepuIdentityGate","DEFAULT_START_BYTE","createLepuSequencer","lepu","report","write","serviceUuid","characteristicUuid","builder","startBytes","expectedDeviceTypes","pollCommand","undefined","onIdentified","onRefused"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/custom/custom-lepu-sequencer.ts"],"mappings":";;AAEA,SAASA,kBAAkB,QAAQ,iCAA8B;AAEjE,SAASC,gBAAgB,QAAQ,+BAA4B;;AAE7D;AACA,MAAMC,kBAAkB,GAAG,IAAI;AAO/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,mBAAmB,GAAGA,CACjCC,IAAoB,EACpBC,MAAsB,KAEtB,IAAIJ,gBAAgB,CAAC;EACnBK,KAAK,EAAE;IACLC,WAAW,EAAEH,IAAI,CAACE,KAAK,CAACC,WAAW;IACnCC,kBAAkB,EAAEJ,IAAI,CAACE,KAAK,CAACE;EACjC,CAAC;EACDC,OAAO,EAAE,IAAIT,kBAAkB,CAACI,IAAI,CAACM,UAAU,CAAC,CAAC,CAAC,IAAIR,kBAAkB,CAAC;EACzES,mBAAmB,EAAEP,IAAI,CAACO,mBAAmB;EAC7C,IAAIP,IAAI,CAACQ,WAAW,KAAKC,SAAS,GAAG,CAAC,CAAC,GAAG;IAAED,WAAW,EAAER,IAAI,CAACQ;EAAY,CAAC,CAAC;EAC5EE,YAAY,EAAET,MAAM,CAACS,YAAY;EACjCC,SAAS,EAAEV,MAAM,CAACU;AACpB,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import { sentryLogger } from "../../../../helpers/utils/sentry-logger.js";
|
|
3
4
|
import { CaseType } from "../../../types/case-type.js";
|
|
4
5
|
import { createFrameValidator } from "../../../utils/create-frame-validator.js";
|
|
5
6
|
import { BTManagedDevice } from "../bt-managed-device.js";
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
import { LepuFrameReader } from "../lepu/lepu.frame-reader.js";
|
|
8
|
+
import { createLepuSequencer } from "./custom-lepu-sequencer.js";
|
|
8
9
|
/**
|
|
9
10
|
* Runs a device registered with defineCustomDevice.
|
|
10
11
|
*
|
|
@@ -21,10 +22,59 @@ export class CustomDevice extends BTManagedDevice {
|
|
|
21
22
|
this.definition = definition;
|
|
22
23
|
this.mainServices = definition.mainServices;
|
|
23
24
|
this.stuckDataTimeout = definition.stuckDataTimeout;
|
|
25
|
+
if (definition.preferredMtu !== undefined) {
|
|
26
|
+
this.preferredMtu = definition.preferredMtu;
|
|
27
|
+
}
|
|
28
|
+
this.declareLepuProtocol(definition);
|
|
24
29
|
definition.frames.forEach((frame, uuid) => {
|
|
25
30
|
this.validators.set(uuid, createFrameValidator(frame));
|
|
26
31
|
});
|
|
27
32
|
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Gives a Lepu declaration its frame reader and its command sequence.
|
|
36
|
+
*
|
|
37
|
+
* Both or neither: the reader finds frame edges the family's own way, and the gate is
|
|
38
|
+
* what decides anything may be sent at all. A declaration that had the reader without the
|
|
39
|
+
* gate would poll hardware it had not identified, which is the case the gate exists for.
|
|
40
|
+
*/
|
|
41
|
+
declareLepuProtocol(definition) {
|
|
42
|
+
const lepu = definition.lepu;
|
|
43
|
+
if (!lepu) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
this.frameReader = new LepuFrameReader(lepu.startBytes);
|
|
47
|
+
this.createCommandSequencer = () => createLepuSequencer(lepu, {
|
|
48
|
+
onIdentified: this.onIdentified,
|
|
49
|
+
onRefused: this.onIdentityRefused
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Records what the device said it was.
|
|
55
|
+
*
|
|
56
|
+
* The model number is logged because it is the only place one exists: the vendor's SDK
|
|
57
|
+
* never reads the field back, so a declaration written without it is completed by
|
|
58
|
+
* connecting once and reading this line.
|
|
59
|
+
*/
|
|
60
|
+
onIdentified = info => {
|
|
61
|
+
this.deviceData.sn = info.serialNumber;
|
|
62
|
+
sentryLogger("info", "BT_MANAGER: Device identified itself", {
|
|
63
|
+
deviceId: this.deviceData.id,
|
|
64
|
+
deviceName: this.deviceData.name,
|
|
65
|
+
deviceType: info.deviceType,
|
|
66
|
+
branchCode: info.branchCode,
|
|
67
|
+
protocolMaxLength: info.protocolMaxLength
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Nothing is sent to a device that could not be identified, because the same opcode means
|
|
73
|
+
* different things on different models in this family.
|
|
74
|
+
*/
|
|
75
|
+
onIdentityRefused = reason => {
|
|
76
|
+
this.onError?.(new Error(`Custom device "${this.definition.id}" was not addressed: ${reason}.`));
|
|
77
|
+
};
|
|
28
78
|
validatePackage = (pkg, uuid) => {
|
|
29
79
|
const validate = this.validators.get(String(uuid ?? "").toLowerCase());
|
|
30
80
|
if (!validate) {
|
|
@@ -40,7 +90,7 @@ export class CustomDevice extends BTManagedDevice {
|
|
|
40
90
|
*/
|
|
41
91
|
handleDependentResult = data => {
|
|
42
92
|
try {
|
|
43
|
-
this.report(data.parsedData);
|
|
93
|
+
this.report(data.parsedData, data.parsingCase);
|
|
44
94
|
} catch (error) {
|
|
45
95
|
this.onError?.(error);
|
|
46
96
|
}
|
|
@@ -60,23 +110,40 @@ export class CustomDevice extends BTManagedDevice {
|
|
|
60
110
|
handleSuccessResult() {
|
|
61
111
|
return;
|
|
62
112
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Reports every reading the frame carried.
|
|
116
|
+
*
|
|
117
|
+
* One frame is often one reading, but a multi-parameter monitor sends a heart rate, an
|
|
118
|
+
* oxygen saturation and a temperature together. Those are separate measurements, so they
|
|
119
|
+
* are reported separately rather than merged into one object whose properties came from
|
|
120
|
+
* different instruments.
|
|
121
|
+
*
|
|
122
|
+
* A reading that fails its checks is discarded on its own. A temperature the device could
|
|
123
|
+
* not take is no reason to withhold the heart rate in the same frame.
|
|
124
|
+
*/
|
|
125
|
+
report(parsedData, parsingCase) {
|
|
126
|
+
const measurements = parsingCase.measurements ?? [];
|
|
127
|
+
if (measurements.length === 0) {
|
|
66
128
|
this.fail("a result frame carries no measurement type", parsedData);
|
|
67
129
|
return;
|
|
68
130
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
131
|
+
measurements.forEach(measurement => this.reportMeasurement(parsedData, measurement));
|
|
132
|
+
}
|
|
133
|
+
reportMeasurement(parsedData, measurement) {
|
|
134
|
+
const reading = {
|
|
135
|
+
caseType: parsedData.caseType,
|
|
136
|
+
measurementTypeKey: measurement.measurementTypeKey
|
|
137
|
+
};
|
|
138
|
+
measurement.fieldNames.forEach(name => {
|
|
139
|
+
reading[name] = parsedData[name];
|
|
140
|
+
});
|
|
141
|
+
const rejection = measurement.fieldNames.map(name => this.reject(measurement.measurementTypeKey, name, reading[name])).find(message => message !== undefined);
|
|
75
142
|
if (rejection) {
|
|
76
|
-
this.fail(rejection,
|
|
143
|
+
this.fail(rejection, reading);
|
|
77
144
|
return;
|
|
78
145
|
}
|
|
79
|
-
this.onResult?.(
|
|
146
|
+
this.onResult?.(reading);
|
|
80
147
|
}
|
|
81
148
|
reject(measurementTypeKey, name, value) {
|
|
82
149
|
const field = this.definition.fields.get(`${measurementTypeKey}:${name}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CaseType","createFrameValidator","BTManagedDevice","
|
|
1
|
+
{"version":3,"names":["sentryLogger","CaseType","createFrameValidator","BTManagedDevice","LepuFrameReader","createLepuSequencer","CustomDevice","validators","Map","constructor","device","params","definition","mainServices","stuckDataTimeout","preferredMtu","undefined","declareLepuProtocol","frames","forEach","frame","uuid","set","lepu","frameReader","startBytes","createCommandSequencer","onIdentified","onRefused","onIdentityRefused","info","deviceData","sn","serialNumber","deviceId","id","deviceName","name","deviceType","branchCode","protocolMaxLength","reason","onError","Error","validatePackage","pkg","validate","get","String","toLowerCase","handleDependentResult","data","report","parsedData","parsingCase","error","caseType","OTHER","handleSuccessResult","measurements","length","fail","measurement","reportMeasurement","reading","measurementTypeKey","fieldNames","rejection","map","reject","find","message","onResult","value","field","fields","Number","isFinite","min","max","unit","JSON","stringify"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/custom/custom.device.ts"],"mappings":";;AAEA,SAASA,YAAY,QAAQ,4CAAyC;AACtE,SAASC,QAAQ,QAAQ,6BAA0B;AAUnD,SAASC,oBAAoB,QAAQ,0CAAuC;AAC5E,SAASC,eAAe,QAAQ,yBAAsB;AAEtD,SAASC,eAAe,QAAQ,8BAA2B;AAE3D,SAASC,mBAAmB,QAAQ,4BAAyB;AAK7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,YAAY,SAASH,eAAe,CAAiB;EAM/CI,UAAU,GAAG,IAAIC,GAAG,CAAqC,CAAC;EAE3EC,WAAWA,CACTC,MAAc,EACdC,MAA0C,EAC1CC,UAAkC,EAClC;IACA,KAAK,CAACF,MAAM,EAAEC,MAAM,CAAC;IAErB,IAAI,CAACC,UAAU,GAAGA,UAAU;IAC5B,IAAI,CAACC,YAAY,GAAGD,UAAU,CAACC,YAAY;IAC3C,IAAI,CAACC,gBAAgB,GAAGF,UAAU,CAACE,gBAAgB;IAEnD,IAAIF,UAAU,CAACG,YAAY,KAAKC,SAAS,EAAE;MACzC,IAAI,CAACD,YAAY,GAAGH,UAAU,CAACG,YAAY;IAC7C;IAEA,IAAI,CAACE,mBAAmB,CAACL,UAAU,CAAC;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IAEA,OAAOhE,SAAS;EAClB;EAEQ6C,IAAIA,CAACpB,MAAc,EAAEY,UAAwB,EAAQ;IAC3D,IAAI,CAACX,OAAO,GACV,IAAIC,KAAK,CACP,kBAAkB,IAAI,CAAC/B,UAAU,CAACuB,EAAE,MAAMM,MAAM,wCAAwCwC,IAAI,CAACC,SAAS,CAAC7B,UAAU,CAAC,IACpH,CACF,CAAC;EACH;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { calculateCrc8 } from "../../../utils/calculate-crc-8.js";
|
|
4
|
+
const REQUEST_TYPE = 0x00;
|
|
5
|
+
const BYTE_MASK = 0xff;
|
|
6
|
+
const BYTE_VALUES = 0x100;
|
|
7
|
+
|
|
8
|
+
/** The sequence number wraps here, matching the vendor's own counter. */
|
|
9
|
+
const MAX_SEQUENCE_NUMBER = 254;
|
|
10
|
+
const toHex = byte => (byte & BYTE_MASK).toString(16).padStart(2, "0");
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Builds the commands a Lepu device accepts.
|
|
14
|
+
*
|
|
15
|
+
* Layout: `start | cmd | ~cmd | type | seq | lenLow lenHigh | payload | crc8`, the same frame
|
|
16
|
+
* the device answers with. The type byte is 0x00 on a request, and the checksum covers every
|
|
17
|
+
* byte before it.
|
|
18
|
+
*
|
|
19
|
+
* The sequence number is write-only bookkeeping: it wraps at 254 and nothing in the response
|
|
20
|
+
* path reads it back, so it cannot correlate a reply to its request. Correlation is by opcode,
|
|
21
|
+
* and the protocol relies on at most one command being outstanding - which is the constraint
|
|
22
|
+
* any sequencer built on this has to respect.
|
|
23
|
+
*
|
|
24
|
+
* The counter makes a builder stateful, so each connection needs its own. One builder shared
|
|
25
|
+
* across devices would interleave their sequence numbers, which is a defect the vendor's own
|
|
26
|
+
* global counter has and this avoids by construction.
|
|
27
|
+
*/
|
|
28
|
+
export class LepuCommandBuilder {
|
|
29
|
+
sequenceNumber = 0;
|
|
30
|
+
constructor(startByte = "a5") {
|
|
31
|
+
this.startByte = startByte;
|
|
32
|
+
}
|
|
33
|
+
build(command, payload = []) {
|
|
34
|
+
const header = [this.startByte, toHex(command), toHex(~command), toHex(REQUEST_TYPE), toHex(this.sequenceNumber), toHex(payload.length), toHex(Math.floor(payload.length / BYTE_VALUES))];
|
|
35
|
+
const frame = [...header, ...payload.map(toHex)];
|
|
36
|
+
this.advanceSequence();
|
|
37
|
+
return [...frame, toHex(calculateCrc8(frame, frame.length))];
|
|
38
|
+
}
|
|
39
|
+
advanceSequence() {
|
|
40
|
+
this.sequenceNumber = this.sequenceNumber >= MAX_SEQUENCE_NUMBER ? 0 : this.sequenceNumber + 1;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=lepu.command-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["calculateCrc8","REQUEST_TYPE","BYTE_MASK","BYTE_VALUES","MAX_SEQUENCE_NUMBER","toHex","byte","toString","padStart","LepuCommandBuilder","sequenceNumber","constructor","startByte","build","command","payload","header","length","Math","floor","frame","map","advanceSequence"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/lepu/lepu.command-builder.ts"],"mappings":";;AAAA,SAASA,aAAa,QAAQ,mCAAgC;AAE9D,MAAMC,YAAY,GAAG,IAAI;AACzB,MAAMC,SAAS,GAAG,IAAI;AACtB,MAAMC,WAAW,GAAG,KAAK;;AAEzB;AACA,MAAMC,mBAAmB,GAAG,GAAG;AAE/B,MAAMC,KAAK,GAAIC,IAAY,IACzB,CAACA,IAAI,GAAGJ,SAAS,EAAEK,QAAQ,CAAC,EAAE,CAAC,CAACC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;;AAElD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,kBAAkB,CAAC;EACtBC,cAAc,GAAG,CAAC;EAEnBC,WAAWA,CAAkBC,SAAiB,GAAG,IAAI,EAAE;IAAA,KAA1BA,SAAiB,GAAjBA,SAAiB;EAAU;EAExDC,KAAKA,CAACC,OAAe,EAAEC,OAA0B,GAAG,EAAE,EAAY;IACvE,MAAMC,MAAM,GAAG,CACb,IAAI,CAACJ,SAAS,EACdP,KAAK,CAACS,OAAO,CAAC,EACdT,KAAK,CAAC,CAACS,OAAO,CAAC,EACfT,KAAK,CAACJ,YAAY,CAAC,EACnBI,KAAK,CAAC,IAAI,CAACK,cAAc,CAAC,EAC1BL,KAAK,CAACU,OAAO,CAACE,MAAM,CAAC,EACrBZ,KAAK,CAACa,IAAI,CAACC,KAAK,CAACJ,OAAO,CAACE,MAAM,GAAGd,WAAW,CAAC,CAAC,CAChD;IAED,MAAMiB,KAAK,GAAG,CAAC,GAAGJ,MAAM,EAAE,GAAGD,OAAO,CAACM,GAAG,CAAChB,KAAK,CAAC,CAAC;IAEhD,IAAI,CAACiB,eAAe,CAAC,CAAC;IAEtB,OAAO,CAAC,GAAGF,KAAK,EAAEf,KAAK,CAACL,aAAa,CAACoB,KAAK,EAAEA,KAAK,CAACH,MAAM,CAAC,CAAC,CAAC;EAC9D;EAEQK,eAAeA,CAAA,EAAS;IAC9B,IAAI,CAACZ,cAAc,GACjB,IAAI,CAACA,cAAc,IAAIN,mBAAmB,GAAG,CAAC,GAAG,IAAI,CAACM,cAAc,GAAG,CAAC;EAC5E;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The commands every Lepu device understands.
|
|
5
|
+
*
|
|
6
|
+
* These are the generic opcodes, shared across the whole family. Device-specific opcodes live
|
|
7
|
+
* below 0x40 and belong with their driver, because the same number means different things on
|
|
8
|
+
* different hardware - 0x08 polls realtime data on a BP2 and starts a measurement on others.
|
|
9
|
+
* That collision is why this module holds only the opcodes that are genuinely common, and why
|
|
10
|
+
* a driver must never assume a low opcode is safe to send to an unidentified device.
|
|
11
|
+
*/
|
|
12
|
+
export const LepuCommand = {
|
|
13
|
+
/** Link keepalive and round-trip test. Inert. */
|
|
14
|
+
ECHO: 0xe0,
|
|
15
|
+
/**
|
|
16
|
+
* Device information, including the model string.
|
|
17
|
+
*
|
|
18
|
+
* Inert and identical family-wide, which makes it the one command safe to send before a
|
|
19
|
+
* device has been identified - and therefore the way to confirm what something is before
|
|
20
|
+
* addressing it with an opcode that means something else on the wrong hardware.
|
|
21
|
+
*/
|
|
22
|
+
GET_INFO: 0xe1,
|
|
23
|
+
GET_BATTERY: 0xe4,
|
|
24
|
+
/** Enumerate the records stored on the device. */
|
|
25
|
+
GET_FILE_LIST: 0xf1,
|
|
26
|
+
/** Begin a read: a 20-byte payload of file name plus a 32-bit offset. */
|
|
27
|
+
READ_FILE_START: 0xf2,
|
|
28
|
+
/** Fetch the next chunk of the file being read. */
|
|
29
|
+
READ_FILE_DATA: 0xf3,
|
|
30
|
+
/** End the read and release the device's file handle. */
|
|
31
|
+
READ_FILE_END: 0xf4
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=lepu.commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["LepuCommand","ECHO","GET_INFO","GET_BATTERY","GET_FILE_LIST","READ_FILE_START","READ_FILE_DATA","READ_FILE_END"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/lepu/lepu.commands.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,WAAW,GAAG;EACzB;EACAC,IAAI,EAAE,IAAI;EAEV;AACF;AACA;AACA;AACA;AACA;AACA;EACEC,QAAQ,EAAE,IAAI;EAEdC,WAAW,EAAE,IAAI;EAEjB;EACAC,aAAa,EAAE,IAAI;EAEnB;EACAC,eAAe,EAAE,IAAI;EAErB;EACAC,cAAc,EAAE,IAAI;EAEpB;EACAC,aAAa,EAAE;AACjB,CAAU","ignoreList":[]}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { hexToByte } from "../../../utils/hex-to-byte.js";
|
|
4
|
+
import { le16FromHex } from "../../../utils/le-16-from-hex.js";
|
|
5
|
+
import { LepuCommand } from "./lepu.commands.js";
|
|
6
|
+
import { isLepuSuccess } from "./lepu.response-type.js";
|
|
7
|
+
const COMMAND_INDEX = 1;
|
|
8
|
+
const HEADER_BYTES = 7;
|
|
9
|
+
|
|
10
|
+
/** Offsets within the payload, per the vendor's own `Bp2DeviceInfo` layout. */
|
|
11
|
+
const BRANCH_CODE_OFFSET = 9;
|
|
12
|
+
const BRANCH_CODE_BYTES = 8;
|
|
13
|
+
const DEVICE_TYPE_OFFSET = 20;
|
|
14
|
+
const PROTOCOL_MAX_LENGTH_OFFSET = 31;
|
|
15
|
+
const SERIAL_LENGTH_OFFSET = 37;
|
|
16
|
+
const SERIAL_OFFSET = 38;
|
|
17
|
+
|
|
18
|
+
/** The vendor clamps the reported serial length, implying firmware has overstated it. */
|
|
19
|
+
const MAX_SERIAL_BYTES = 18;
|
|
20
|
+
|
|
21
|
+
/** Everything up to and including the serial length. Less than this is not device info. */
|
|
22
|
+
const MIN_PAYLOAD_BYTES = SERIAL_OFFSET;
|
|
23
|
+
const NUL = 0;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Reads a zero-padded ASCII field.
|
|
27
|
+
*
|
|
28
|
+
* These fields are fixed width rather than length-prefixed, so the padding is where the
|
|
29
|
+
* value ends. Reading the full width would append NULs to every string.
|
|
30
|
+
*/
|
|
31
|
+
const asciiAt = (frame, start, length) => {
|
|
32
|
+
let text = "";
|
|
33
|
+
for (let index = start; index < start + length; index++) {
|
|
34
|
+
const byte = hexToByte(frame[index] ?? "0");
|
|
35
|
+
if (byte === NUL) {
|
|
36
|
+
return text;
|
|
37
|
+
}
|
|
38
|
+
text += String.fromCharCode(byte);
|
|
39
|
+
}
|
|
40
|
+
return text;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/** What a Lepu device says it is, in answer to `GET_INFO`. */
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Reads the reply to `GET_INFO`, or nothing if the frame is not one.
|
|
47
|
+
*
|
|
48
|
+
* The command byte is checked rather than assumed, because this is the answer a driver
|
|
49
|
+
* decides its identity on: parsing some other frame as device info would produce a model
|
|
50
|
+
* number out of whatever bytes happened to sit at offset 20, and the gate would then pass
|
|
51
|
+
* on a coincidence.
|
|
52
|
+
*
|
|
53
|
+
* A frame too short to hold the layout is refused for the same reason, as is one whose
|
|
54
|
+
* response type is anything but success: an error reply carries a reason where the device
|
|
55
|
+
* information would be, and reading it as a model number would identify the hardware from
|
|
56
|
+
* an error code. The vendor's own struct is at least 56 bytes; anything shorter than the
|
|
57
|
+
* serial length field cannot be read without inventing the parts that are missing.
|
|
58
|
+
*/
|
|
59
|
+
const parseLepuDeviceInfo = frame => {
|
|
60
|
+
if (hexToByte(frame[COMMAND_INDEX] ?? "0") !== LepuCommand.GET_INFO) {
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
if (!isLepuSuccess(frame)) {
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
if (frame.length < HEADER_BYTES + MIN_PAYLOAD_BYTES) {
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
const payload = HEADER_BYTES;
|
|
70
|
+
const serialLength = Math.min(hexToByte(frame[payload + SERIAL_LENGTH_OFFSET] ?? "0"), MAX_SERIAL_BYTES);
|
|
71
|
+
return {
|
|
72
|
+
deviceType: le16FromHex(frame, payload + DEVICE_TYPE_OFFSET),
|
|
73
|
+
protocolMaxLength: le16FromHex(frame, payload + PROTOCOL_MAX_LENGTH_OFFSET),
|
|
74
|
+
branchCode: asciiAt(frame, payload + BRANCH_CODE_OFFSET, BRANCH_CODE_BYTES),
|
|
75
|
+
serialNumber: asciiAt(frame, payload + SERIAL_OFFSET, serialLength)
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
export { parseLepuDeviceInfo };
|
|
79
|
+
//# sourceMappingURL=lepu.device-info.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["hexToByte","le16FromHex","LepuCommand","isLepuSuccess","COMMAND_INDEX","HEADER_BYTES","BRANCH_CODE_OFFSET","BRANCH_CODE_BYTES","DEVICE_TYPE_OFFSET","PROTOCOL_MAX_LENGTH_OFFSET","SERIAL_LENGTH_OFFSET","SERIAL_OFFSET","MAX_SERIAL_BYTES","MIN_PAYLOAD_BYTES","NUL","asciiAt","frame","start","length","text","index","byte","String","fromCharCode","parseLepuDeviceInfo","GET_INFO","undefined","payload","serialLength","Math","min","deviceType","protocolMaxLength","branchCode","serialNumber"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/lepu/lepu.device-info.ts"],"mappings":";;AAAA,SAASA,SAAS,QAAQ,+BAA4B;AACtD,SAASC,WAAW,QAAQ,kCAA+B;AAE3D,SAASC,WAAW,QAAQ,oBAAiB;AAC7C,SAASC,aAAa,QAAQ,yBAAsB;AAEpD,MAAMC,aAAa,GAAG,CAAC;AACvB,MAAMC,YAAY,GAAG,CAAC;;AAEtB;AACA,MAAMC,kBAAkB,GAAG,CAAC;AAC5B,MAAMC,iBAAiB,GAAG,CAAC;AAC3B,MAAMC,kBAAkB,GAAG,EAAE;AAC7B,MAAMC,0BAA0B,GAAG,EAAE;AACrC,MAAMC,oBAAoB,GAAG,EAAE;AAC/B,MAAMC,aAAa,GAAG,EAAE;;AAExB;AACA,MAAMC,gBAAgB,GAAG,EAAE;;AAE3B;AACA,MAAMC,iBAAiB,GAAGF,aAAa;AAEvC,MAAMG,GAAG,GAAG,CAAC;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,OAAO,GAAGA,CACdC,KAAwB,EACxBC,KAAa,EACbC,MAAc,KACH;EACX,IAAIC,IAAI,GAAG,EAAE;EAEb,KAAK,I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W,OAAO,GAAGhB,aAAa,EAAEiB,YAAY;EACpE,CAAC;AACH,CAAC;AAED,SAASJ,mBAAmB","ignoreList":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The names the Lepu/Viatom family advertises, as its own SDK matches them.
|
|
5
|
+
*
|
|
6
|
+
* Taken from the vendor's `getDeviceModel`, a 732-line cascade of substring checks that is
|
|
7
|
+
* the whole of how that SDK decides which product it is talking to. The order there matters,
|
|
8
|
+
* because 27 of these names are a prefix of another - `BP2` of `BP2A`, `BP2T`, `BP2W` and
|
|
9
|
+
* three more - so a check that ran in the wrong order would bind a BP2W as a BP2 and poll it
|
|
10
|
+
* with an opcode written for different hardware.
|
|
11
|
+
*
|
|
12
|
+
* It is that function's vocabulary, not a catalogue of everything the vendor sells: a few
|
|
13
|
+
* products - the ER3 and the M12 among them - are identified elsewhere in that app and never
|
|
14
|
+
* reach this list. `lepuNameMatch` accepts a name that is absent, and derives no exclusions
|
|
15
|
+
* for it, which is correct exactly when no name here extends it.
|
|
16
|
+
*
|
|
17
|
+
* They are held here as a flat vocabulary rather than an ordered cascade, because
|
|
18
|
+
* `lepuNameMatch` derives the exclusions from the list itself. Adding a name automatically
|
|
19
|
+
* narrows every name it extends, which an ordered list would leave to whoever inserted it.
|
|
20
|
+
*/
|
|
21
|
+
export const LEPU_DEVICE_NAMES = ["AI-S100", "AITele", "AIView VS", "AP-20", "AP-20-WPS", "AirBP", "Aura_BP2", "BBSM BS1", "BBSM P1", "BBSM S1", "BBSM S2", "BBSM S3", "BM10", "BP2", "BP2A", "BP2A Nexus", "BP2B", "BP2T", "BP2V", "BP2W", "BP3", "BP3-B", "BP3-C1", "BP3-C2", "BP3A", "BP3B", "BP3C", "BP3D", "BP3E", "BP3F", "BP3G", "BP3H", "BP3K", "BP3L", "BP3Z", "BP4 Flex", "BPWATCH", "BUZUD-CML", "Band-WU", "Bioland-BGM", "CB1L-1", "CMB590611", "CMB590840", "CMB592254", "CMI_PC303", "CMRing", "CMTouch", "CPR Feedback", "CPR-01", "CPR-02", "CheckADV", "Checkme", "Checkme EX", "Checkme Pod", "Checkme Pod-WPS", "Checkme lite A", "CheckmeLE", "CheckmeLP", "DUAL-SPP", "EM-B", "EM-W", "ER1", "ER1-H", "ER1-L", "ER1-S", "ER1-SP", "ER1-W", "ER1S", "ER2", "ER2-S", "EZY-HB-01", "EZY-HBB-02", "GM_300SNT", "GM_300SNT-BLE", "Genial-T31", "HDM3D", "HDM3G", "HHM1", "HHM2", "HHM3", "HHM4", "JFK1001", "JFR1001", "KCA", "KCB", "KS-60FW", "KardiaBP", "KidsO2-WPS", "LBM-1", "LEPU AED", "LEPU ER1", "LEPU-ER2", "LP ER2", "LP-BP2W", "LPM311", "LPRE", "Le S5", "Le-F2 Pro", "Le-W", "LeRes", "Lepod", "LepodPro", "Lepu PO6", "Lescale F3", "Lescale F4L", "Lescale F4P", "Lescale P3", "M5", "MY-SS2501", "N9+BP2", "O2 Intg", "O2M-WPS", "O2R WAVE", "O2RMed S", "O2Ring", "O2Ring S", "O2Ring SC", "O2Ring SF", "O2Ring SP", "O2Ring-RE", "O2RingF", "OxyU", "OxyU SE", "Oxyfit", "Oxyfit-WPS", "PC-100", "PC-200", "PC-200-BLE", "PC-60B_SN", "PC-60F_SN", "PC-60NW", "PC-60NW-1_SN", "PC-60NW-WPS", "PC-60NW_BLE", "PC-60NW_SN", "PC-66B", "PC-68B", "PC66B-VE", "PC80B", "PC80B-BLE", "PC80B_BLE:", "PC_300SNT", "PC_300SNT-BLE", "PF-10", "PF-10AW", "PF-10AW-1", "PF-10AW1", "PF-10BW", "PF-10BW1", "PF-10BWS", "PF-20", "PF-20AW", "PF-20B", "PF10AW-ME", "PF10BW-VE", "PM10", "PO6B-WE", "POD-1W-WU", "POD-1_SN", "POD-2B_SN", "PoctorM3102", "QC-200", "R10", "R11", "R20", "R200", "R21", "S5W-VU", "S5W_SN", "S6W", "S6W1", "S7BW", "S7W", "S8-AW", "SA10AW-PU", "SHQFlex", "SHQO2Pro", "SI PO2", "SI PO4", "SI PO6", "SP-20", "SP-20-BLE", "SP-20-WPS", "T-201", "TMB-2288", "TMB_2088", "VCOMIN", "VTM AD5", "W12c", "WBP-02", "ZH-SG", "ZH-SG-A606", "aed_box", "iGate", "int-ER2", "le B1", "le S1"];
|
|
22
|
+
//# sourceMappingURL=lepu.device-names.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["LEPU_DEVICE_NAMES"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/lepu/lepu.device-names.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,iBAAoC,GAAG,CAClD,SAAS,EACT,QAAQ,EACR,WAAW,EACX,OAAO,EACP,WAAW,EACX,OAAO,EACP,UAAU,EACV,UAAU,EACV,SAAS,EACT,SAAS,EACT,SAAS,EACT,SAAS,EACT,MAAM,EACN,KAAK,EACL,MAAM,EACN,YAAY,EACZ,MAAM,EACN,MAAM,EACN,MAAM,EACN,MAAM,EACN,KAAK,EACL,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,MAAM,EACN,MAAM,EACN,MAAM,EACN,MAAM,EACN,MAAM,EACN,MAAM,EACN,MAAM,EACN,MAAM,EACN,MAAM,EACN,MAAM,EACN,UAAU,EACV,SAAS,EACT,WAAW,EACX,SAAS,EACT,aAAa,EACb,QAAQ,EACR,WAAW,EACX,WAAW,EACX,WAAW,EACX,WAAW,EACX,QAAQ,EACR,SAAS,EACT,cAAc,EACd,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,SAAS,EACT,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACX,WAAW,EACX,UAAU,EACV,MAAM,EACN,MAAM,EACN,KAAK,EACL,OAAO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EACP,WAAW,EACX,SAAS,EACT,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,WAAW,EACX,WAAW,EACX,OAAO,EACP,UAAU,EACV,UAAU,EACV,QAAQ,EACR,SAAS,EACT,MAAM,EACN,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,SAAS,EACT,OAAO,EACP,SAAS,EACT,OAAO,EACP,OAAO,CACR","ignoreList":[]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { hexToByte } from "../../../utils/hex-to-byte.js";
|
|
4
|
+
|
|
5
|
+
/** Names are a fixed sixteen bytes, zero padded, in both the listing and the request. */
|
|
6
|
+
const NAME_BYTES = 16;
|
|
7
|
+
const BYTE_MASK = 0xff;
|
|
8
|
+
const NUL = 0;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A file name as the device expects it: sixteen bytes, zero padded, truncated.
|
|
12
|
+
*
|
|
13
|
+
* The truncation is the device's, not ours - it copies at most sixteen bytes and pads the
|
|
14
|
+
* rest - so two names that agree in their first sixteen bytes are the same file as far as
|
|
15
|
+
* the protocol is concerned.
|
|
16
|
+
*/
|
|
17
|
+
const lepuNameBytes = name => Array.from({
|
|
18
|
+
length: NAME_BYTES
|
|
19
|
+
}, (_, index) => index < name.length ? name.charCodeAt(index) & BYTE_MASK : NUL);
|
|
20
|
+
|
|
21
|
+
/** The names in a file listing: a count, then that many fixed-width padded names. */
|
|
22
|
+
const lepuNamesFrom = payload => {
|
|
23
|
+
const count = hexToByte(payload[0] ?? "0");
|
|
24
|
+
return Array.from({
|
|
25
|
+
length: count
|
|
26
|
+
}, (_, index) => {
|
|
27
|
+
const start = 1 + index * NAME_BYTES;
|
|
28
|
+
return payload.slice(start, start + NAME_BYTES).map(byte => hexToByte(byte)).filter(byte => byte !== NUL).map(byte => String.fromCharCode(byte)).join("").trim();
|
|
29
|
+
}).filter(name => name.length > 0);
|
|
30
|
+
};
|
|
31
|
+
export { lepuNameBytes, lepuNamesFrom, NAME_BYTES };
|
|
32
|
+
//# sourceMappingURL=lepu.file-names.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["hexToByte","NAME_BYTES","BYTE_MASK","NUL","lepuNameBytes","name","Array","from","length","_","index","charCodeAt","lepuNamesFrom","payload","count","start","slice","map","byte","filter","String","fromCharCode","join","trim"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/lepu/lepu.file-names.ts"],"mappings":";;AAAA,SAASA,SAAS,QAAQ,+BAA4B;;AAEtD;AACA,MAAMC,UAAU,GAAG,EAAE;AACrB,MAAMC,SAAS,GAAG,IAAI;AACtB,MAAMC,GAAG,GAAG,CAAC;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,aAAa,GAAIC,IAAY,IACjCC,KAAK,CAACC,IAAI,CAAC;EAAEC,MAAM,EAAEP;AAAW,CAAC,EAAE,CAACQ,CAAC,EAAEC,KAAK,KAC1CA,KAAK,GAAGL,IAAI,CAACG,MAAM,GAAGH,IAAI,CAACM,UAAU,CAACD,KAAK,CAAC,GAAGR,SAAS,GAAGC,GAC7D,CAAC;;AAEH;AACA,MAAMS,aAAa,GAAIC,OAA0B,IAAe;EAC9D,MAAMC,KAAK,GAAGd,SAAS,CAACa,OAAO,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC;EAE1C,OAAOP,KAAK,CAACC,IAAI,CAAC;IAAEC,MAAM,EAAEM;EAAM,CAAC,EAAE,CAACL,CAAC,EAAEC,KAAK,KAAK;IACjD,MAAMK,KAAK,GAAG,CAAC,GAAGL,KAAK,GAAGT,UAAU;IAEpC,OAAOY,OAAO,CACXG,KAAK,CAACD,KAAK,EAAEA,KAAK,GAAGd,UAAU,CAAC,CAChCgB,GAAG,CAAEC,IAAI,IAAKlB,SAAS,CAACkB,IAAI,CAAC,CAAC,CAC9BC,MAAM,CAAED,IAAI,IAAKA,IAAI,KAAKf,GA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