@ovok/native 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/modules/auth/sign-in/components/social-logins/apple-login-button.js +9 -3
- package/lib/commonjs/modules/auth/sign-in/components/social-logins/apple-login-button.js.map +1 -1
- package/lib/commonjs/modules/auth/sign-in/components/social-logins/google-login-button.js +8 -2
- package/lib/commonjs/modules/auth/sign-in/components/social-logins/google-login-button.js.map +1 -1
- package/lib/commonjs/modules/bt-device/constants/device-instruction-pdfs.js +22 -22
- package/lib/commonjs/modules/bt-device/constants/device-instruction-pdfs.js.map +1 -1
- package/lib/commonjs/modules/bt-device/constants/device-list-items.js +36 -0
- package/lib/commonjs/modules/bt-device/constants/device-list-items.js.map +1 -1
- package/lib/commonjs/modules/bt-device/constants/supported-device-catalog-assets.js +36 -0
- package/lib/commonjs/modules/bt-device/constants/supported-device-catalog-assets.js.map +1 -0
- package/lib/commonjs/modules/bt-device/constants/supported-device-catalog-entries.js +45 -0
- package/lib/commonjs/modules/bt-device/constants/supported-device-catalog-entries.js.map +1 -0
- package/lib/commonjs/modules/bt-device/constants/supported-devices.js +198 -42
- package/lib/commonjs/modules/bt-device/constants/supported-devices.js.map +1 -1
- package/lib/commonjs/modules/bt-management/components/bluetooth-device-picker.js +88 -0
- package/lib/commonjs/modules/bt-management/components/bluetooth-device-picker.js.map +1 -0
- package/lib/commonjs/modules/bt-management/components/bt-provider-child-wrapper.js +15 -8
- package/lib/commonjs/modules/bt-management/components/bt-provider-child-wrapper.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 +55 -0
- package/lib/commonjs/modules/bt-management/index.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/background-sync/background-sync-coordinator.js +10 -4
- package/lib/commonjs/modules/bt-management/services/background-sync/background-sync-coordinator.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/bt-manager.js +43 -5
- package/lib/commonjs/modules/bt-management/services/bt-manager.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/custom/define-custom-device.js +6 -2
- 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 +19 -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 +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/aoj/aoj.thermometers.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/bc01/bc01-command-builders.js +50 -0
- package/lib/commonjs/modules/bt-management/services/devices/bc01/bc01-command-builders.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/bc01/bc01-command-sequencer.js +78 -127
- package/lib/commonjs/modules/bt-management/services/devices/bc01/bc01-command-sequencer.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/bc01/bc01.device.js +2 -0
- package/lib/commonjs/modules/bt-management/services/devices/bc01/bc01.device.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/bc01/bc01.frame-reader.js +60 -0
- package/lib/commonjs/modules/bt-management/services/devices/bc01/bc01.frame-reader.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/blood-glucose/blood-glucose.device.js +74 -0
- package/lib/commonjs/modules/bt-management/services/devices/blood-glucose/blood-glucose.device.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/boso/boso.medicus.js +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/boso/boso.medicus.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/bt-command-writer.js +3 -0
- package/lib/commonjs/modules/bt-management/services/devices/bt-command-writer.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/bt-connection-handler.js +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/bt-connection-handler.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/custom/custom.device.js +37 -4
- 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.file-transfer.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.transports.js +4 -1
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.transports.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.js +2 -1
- package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/uebe/visomat.comfort-soft-bt.js +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/uebe/visomat.comfort-soft-bt.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/veroval/veroval.bp-monitors.js +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/veroval/veroval.bp-monitors.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.bp-monitors.js +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.bp-monitors.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.ecg-files.js +35 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.ecg-files.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.js +3 -2
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.lepod.js +2 -1
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.lepod.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.oximeters.js +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.oximeters.js.map +1 -1
- package/lib/commonjs/modules/bt-management/types/device-measurement-map.js.map +1 -1
- package/lib/commonjs/modules/data-sync/services/managers/data-processor.js +11 -2
- package/lib/commonjs/modules/data-sync/services/managers/data-processor.js.map +1 -1
- package/lib/commonjs/modules/data-sync/utils/get-samples-from-health.js +3 -1
- package/lib/commonjs/modules/data-sync/utils/get-samples-from-health.js.map +1 -1
- package/lib/commonjs/modules/data-sync/utils/get-total-samples-count.js +3 -1
- package/lib/commonjs/modules/data-sync/utils/get-total-samples-count.js.map +1 -1
- package/lib/commonjs/modules/data-sync/utils/health-units.js +22 -0
- package/lib/commonjs/modules/data-sync/utils/health-units.js.map +1 -0
- package/lib/module/modules/auth/sign-in/components/social-logins/apple-login-button.js +9 -3
- package/lib/module/modules/auth/sign-in/components/social-logins/apple-login-button.js.map +1 -1
- package/lib/module/modules/auth/sign-in/components/social-logins/google-login-button.js +8 -2
- package/lib/module/modules/auth/sign-in/components/social-logins/google-login-button.js.map +1 -1
- package/lib/module/modules/bt-device/constants/device-instruction-pdfs.js +1 -1
- package/lib/module/modules/bt-device/constants/device-instruction-pdfs.js.map +1 -1
- package/lib/module/modules/bt-device/constants/device-list-items.js +36 -0
- package/lib/module/modules/bt-device/constants/device-list-items.js.map +1 -1
- package/lib/module/modules/bt-device/constants/supported-device-catalog-assets.js +33 -0
- package/lib/module/modules/bt-device/constants/supported-device-catalog-assets.js.map +1 -0
- package/lib/module/modules/bt-device/constants/supported-device-catalog-entries.js +41 -0
- package/lib/module/modules/bt-device/constants/supported-device-catalog-entries.js.map +1 -0
- package/lib/module/modules/bt-device/constants/supported-devices.js +188 -32
- package/lib/module/modules/bt-device/constants/supported-devices.js.map +1 -1
- package/lib/module/modules/bt-management/components/bluetooth-device-picker.js +83 -0
- package/lib/module/modules/bt-management/components/bluetooth-device-picker.js.map +1 -0
- package/lib/module/modules/bt-management/components/bt-provider-child-wrapper.js +15 -8
- package/lib/module/modules/bt-management/components/bt-provider-child-wrapper.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 +5 -0
- package/lib/module/modules/bt-management/index.js.map +1 -1
- package/lib/module/modules/bt-management/services/background-sync/background-sync-coordinator.js +10 -4
- package/lib/module/modules/bt-management/services/background-sync/background-sync-coordinator.js.map +1 -1
- package/lib/module/modules/bt-management/services/bt-manager.js +45 -6
- package/lib/module/modules/bt-management/services/bt-manager.js.map +1 -1
- package/lib/module/modules/bt-management/services/custom/define-custom-device.js +6 -2
- 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 +19 -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 +1 -1
- package/lib/module/modules/bt-management/services/devices/aoj/aoj.thermometers.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/bc01/bc01-command-builders.js +40 -0
- package/lib/module/modules/bt-management/services/devices/bc01/bc01-command-builders.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/bc01/bc01-command-sequencer.js +59 -109
- package/lib/module/modules/bt-management/services/devices/bc01/bc01-command-sequencer.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/bc01/bc01.device.js +2 -0
- package/lib/module/modules/bt-management/services/devices/bc01/bc01.device.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/bc01/bc01.frame-reader.js +56 -0
- package/lib/module/modules/bt-management/services/devices/bc01/bc01.frame-reader.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/blood-glucose/blood-glucose.device.js +69 -0
- package/lib/module/modules/bt-management/services/devices/blood-glucose/blood-glucose.device.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/boso/boso.medicus.js +1 -1
- package/lib/module/modules/bt-management/services/devices/boso/boso.medicus.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/bt-command-writer.js +3 -0
- package/lib/module/modules/bt-management/services/devices/bt-command-writer.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/bt-connection-handler.js +1 -1
- package/lib/module/modules/bt-management/services/devices/bt-connection-handler.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/custom/custom.device.js +36 -4
- 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.file-transfer.js +2 -1
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.file-transfer.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.transports.js +4 -1
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.transports.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.js +2 -1
- package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/uebe/visomat.comfort-soft-bt.js +1 -1
- package/lib/module/modules/bt-management/services/devices/uebe/visomat.comfort-soft-bt.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/veroval/veroval.bp-monitors.js +1 -1
- package/lib/module/modules/bt-management/services/devices/veroval/veroval.bp-monitors.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/viatom/viatom.bp-monitors.js +1 -1
- package/lib/module/modules/bt-management/services/devices/viatom/viatom.bp-monitors.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/viatom/viatom.ecg-files.js +31 -0
- package/lib/module/modules/bt-management/services/devices/viatom/viatom.ecg-files.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.js +3 -2
- package/lib/module/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/viatom/viatom.lepod.js +2 -1
- package/lib/module/modules/bt-management/services/devices/viatom/viatom.lepod.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/viatom/viatom.oximeters.js +1 -1
- package/lib/module/modules/bt-management/services/devices/viatom/viatom.oximeters.js.map +1 -1
- package/lib/module/modules/bt-management/types/device-measurement-map.js.map +1 -1
- package/lib/module/modules/data-sync/services/managers/data-processor.js +11 -2
- package/lib/module/modules/data-sync/services/managers/data-processor.js.map +1 -1
- package/lib/module/modules/data-sync/utils/get-samples-from-health.js +3 -1
- package/lib/module/modules/data-sync/utils/get-samples-from-health.js.map +1 -1
- package/lib/module/modules/data-sync/utils/get-total-samples-count.js +3 -1
- package/lib/module/modules/data-sync/utils/get-total-samples-count.js.map +1 -1
- package/lib/module/modules/data-sync/utils/health-units.js +17 -0
- package/lib/module/modules/data-sync/utils/health-units.js.map +1 -0
- package/lib/typescript/commonjs/src/modules/auth/sign-in/components/social-logins/apple-login-button.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/auth/sign-in/components/social-logins/google-login-button.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-device/constants/device-instruction-pdfs.d.ts +1 -1
- package/lib/typescript/commonjs/src/modules/bt-device/constants/device-instruction-pdfs.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-device/constants/device-list-items.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-device/constants/supported-device-catalog-assets.d.ts +31 -0
- package/lib/typescript/commonjs/src/modules/bt-device/constants/supported-device-catalog-assets.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-device/constants/supported-device-catalog-entries.d.ts +3 -0
- package/lib/typescript/commonjs/src/modules/bt-device/constants/supported-device-catalog-entries.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-device/constants/supported-devices.d.ts +36 -22
- package/lib/typescript/commonjs/src/modules/bt-device/constants/supported-devices.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/components/bluetooth-device-picker.d.ts +11 -0
- package/lib/typescript/commonjs/src/modules/bt-management/components/bluetooth-device-picker.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/components/bt-provider-child-wrapper.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/index.d.ts +5 -0
- package/lib/typescript/commonjs/src/modules/bt-management/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/background-sync/background-sync-coordinator.d.ts +5 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/background-sync/background-sync-coordinator.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/bt-manager.d.ts +19 -2
- package/lib/typescript/commonjs/src/modules/bt-management/services/bt-manager.d.ts.map +1 -1
- 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 +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 +2 -2
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/aoj/aoj.thermometers.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bc01/bc01-command-builders.d.ts +31 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bc01/bc01-command-builders.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bc01/bc01-command-sequencer.d.ts +6 -5
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bc01/bc01-command-sequencer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bc01/bc01.device.d.ts +2 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bc01/bc01.device.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bc01/bc01.frame-reader.d.ts +16 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bc01/bc01.frame-reader.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/blood-glucose/blood-glucose.device.d.ts +19 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/blood-glucose/blood-glucose.device.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/boso/boso.medicus.d.ts +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/boso/boso.medicus.d.ts.map +1 -1
- 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.device.d.ts +1 -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.file-transfer.d.ts +3 -2
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.file-transfer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.transports.d.ts +3 -2
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.transports.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.d.ts +2 -2
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/uebe/visomat.comfort-soft-bt.d.ts +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/uebe/visomat.comfort-soft-bt.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/veroval/veroval.bp-monitors.d.ts +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/veroval/veroval.bp-monitors.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.bp-monitors.d.ts +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.bp-monitors.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.ecg-files.d.ts +9 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.ecg-files.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.d.ts +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.lepod.d.ts +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.lepod.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.oximeters.d.ts +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.oximeters.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/custom-device-definition.d.ts +1 -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 +6 -4
- 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-lepu-spec.d.ts +2 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/custom-lepu-spec.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/device-command.d.ts +5 -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 +4 -4
- package/lib/typescript/commonjs/src/modules/bt-management/types/device-measurement-map.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/services/managers/data-processor.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/utils/get-samples-from-health.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/utils/get-total-samples-count.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/utils/health-units.d.ts +3 -0
- package/lib/typescript/commonjs/src/modules/data-sync/utils/health-units.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/auth/sign-in/components/social-logins/apple-login-button.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/auth/sign-in/components/social-logins/google-login-button.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-device/constants/device-instruction-pdfs.d.ts +1 -1
- package/lib/typescript/module/src/modules/bt-device/constants/device-instruction-pdfs.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-device/constants/device-list-items.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-device/constants/supported-device-catalog-assets.d.ts +31 -0
- package/lib/typescript/module/src/modules/bt-device/constants/supported-device-catalog-assets.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-device/constants/supported-device-catalog-entries.d.ts +3 -0
- package/lib/typescript/module/src/modules/bt-device/constants/supported-device-catalog-entries.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-device/constants/supported-devices.d.ts +36 -22
- package/lib/typescript/module/src/modules/bt-device/constants/supported-devices.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/components/bluetooth-device-picker.d.ts +11 -0
- package/lib/typescript/module/src/modules/bt-management/components/bluetooth-device-picker.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/components/bt-provider-child-wrapper.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/index.d.ts +5 -0
- package/lib/typescript/module/src/modules/bt-management/index.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/background-sync/background-sync-coordinator.d.ts +5 -1
- package/lib/typescript/module/src/modules/bt-management/services/background-sync/background-sync-coordinator.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/bt-manager.d.ts +19 -2
- package/lib/typescript/module/src/modules/bt-management/services/bt-manager.d.ts.map +1 -1
- 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 +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 +2 -2
- package/lib/typescript/module/src/modules/bt-management/services/devices/aoj/aoj.thermometers.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/bc01/bc01-command-builders.d.ts +31 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/bc01/bc01-command-builders.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/bc01/bc01-command-sequencer.d.ts +6 -5
- package/lib/typescript/module/src/modules/bt-management/services/devices/bc01/bc01-command-sequencer.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/bc01/bc01.device.d.ts +2 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/bc01/bc01.device.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/bc01/bc01.frame-reader.d.ts +16 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/bc01/bc01.frame-reader.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/blood-glucose/blood-glucose.device.d.ts +19 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/blood-glucose/blood-glucose.device.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/boso/boso.medicus.d.ts +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/boso/boso.medicus.d.ts.map +1 -1
- 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.device.d.ts +1 -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.file-transfer.d.ts +3 -2
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.file-transfer.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.transports.d.ts +3 -2
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.transports.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.d.ts +2 -2
- package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/uebe/visomat.comfort-soft-bt.d.ts +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/uebe/visomat.comfort-soft-bt.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/veroval/veroval.bp-monitors.d.ts +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/veroval/veroval.bp-monitors.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.bp-monitors.d.ts +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.bp-monitors.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.ecg-files.d.ts +9 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.ecg-files.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.d.ts +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.lepod.d.ts +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.lepod.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.oximeters.d.ts +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.oximeters.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/types/custom-device-definition.d.ts +1 -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 +6 -4
- 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-lepu-spec.d.ts +2 -0
- package/lib/typescript/module/src/modules/bt-management/types/custom-lepu-spec.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/types/device-command.d.ts +5 -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 +4 -4
- package/lib/typescript/module/src/modules/bt-management/types/device-measurement-map.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/data-sync/services/managers/data-processor.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/data-sync/utils/get-samples-from-health.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/data-sync/utils/get-total-samples-count.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/data-sync/utils/health-units.d.ts +3 -0
- package/lib/typescript/module/src/modules/data-sync/utils/health-units.d.ts.map +1 -0
- package/package.json +5 -3
|
@@ -4,6 +4,7 @@ import { integratedDevicesMap } from "../constants/integrated-devices-map.js";
|
|
|
4
4
|
import { IntegratedDevices } from "../types/integrated-devices.js";
|
|
5
5
|
import { isCustomDeviceDefinition } from "../utils/is-custom-device-definition.js";
|
|
6
6
|
import { BC01Device } from "./devices/bc01/bc01.device.js";
|
|
7
|
+
import { BloodGlucoseDevice } from "./devices/blood-glucose/blood-glucose.device.js";
|
|
7
8
|
import { BP2Device } from "./devices/bp2/bp2.device.js";
|
|
8
9
|
import { CustomDevice } from "./devices/custom/custom.device.js";
|
|
9
10
|
import { F4Device } from "./devices/f4/f4.device.js";
|
|
@@ -23,6 +24,9 @@ const DEVICE_CLASSES = {
|
|
|
23
24
|
[IntegratedDevices.F4]: F4Device,
|
|
24
25
|
[IntegratedDevices.PC60WF]: SPO2Device,
|
|
25
26
|
[IntegratedDevices.BC01]: BC01Device,
|
|
27
|
+
[IntegratedDevices.TAIDOC_GLUCOSE]: BloodGlucoseDevice,
|
|
28
|
+
[IntegratedDevices.GLUCOCHECK]: BloodGlucoseDevice,
|
|
29
|
+
[IntegratedDevices.BGM]: BloodGlucoseDevice,
|
|
26
30
|
[IntegratedDevices.VEROVAL_DUO_CONTROL]: VerovalDuoControlDevice,
|
|
27
31
|
[IntegratedDevices.VEROVAL_ECG]: VerovalEcgDevice
|
|
28
32
|
};
|
|
@@ -39,11 +43,13 @@ const collectCustomDevices = acceptedDevices => {
|
|
|
39
43
|
if (customDevices.has(entry.id)) {
|
|
40
44
|
throw new Error(`acceptedDevices[${index}] registers the custom device "${entry.id}" twice`);
|
|
41
45
|
}
|
|
42
|
-
if (matchers.has(entry.nameMatch.source)) {
|
|
46
|
+
if (!entry.matchByService && matchers.has(entry.nameMatch.source)) {
|
|
43
47
|
throw new Error(`acceptedDevices[${index}] ("${entry.id}") matches the same advertised name as an earlier custom device, so one would silently shadow the other`);
|
|
44
48
|
}
|
|
45
49
|
customDevices.set(entry.id, entry);
|
|
46
|
-
|
|
50
|
+
if (!entry.matchByService) {
|
|
51
|
+
matchers.add(entry.nameMatch.source);
|
|
52
|
+
}
|
|
47
53
|
});
|
|
48
54
|
return customDevices;
|
|
49
55
|
};
|
|
@@ -54,14 +60,18 @@ export class DeviceCreator {
|
|
|
54
60
|
this.acceptedDeviceNames = acceptedDeviceNames;
|
|
55
61
|
this.customDevices = collectCustomDevices(acceptedDeviceNames);
|
|
56
62
|
}
|
|
57
|
-
getDeviceName = foundName => {
|
|
58
|
-
|
|
63
|
+
getDeviceName = (foundName, serviceUUIDs = []) => {
|
|
64
|
+
const normalizedServices = new Set(serviceUUIDs.map(uuid => uuid.toLowerCase()));
|
|
65
|
+
if (!foundName && normalizedServices.size === 0) {
|
|
59
66
|
return undefined;
|
|
60
67
|
}
|
|
68
|
+
if (!foundName && normalizedServices.size > 0) {
|
|
69
|
+
return this.matchDeviceName(foundName, normalizedServices);
|
|
70
|
+
}
|
|
61
71
|
if (this.deviceNameCache.has(foundName)) {
|
|
62
72
|
return this.deviceNameCache.get(foundName) ?? undefined;
|
|
63
73
|
}
|
|
64
|
-
const matched = this.matchDeviceName(foundName);
|
|
74
|
+
const matched = this.matchDeviceName(foundName, normalizedServices);
|
|
65
75
|
|
|
66
76
|
// Cache the result (store null for non-matches to avoid repeated tests)
|
|
67
77
|
this.cacheDeviceName(foundName, matched ?? null);
|
|
@@ -80,7 +90,7 @@ export class DeviceCreator {
|
|
|
80
90
|
* `localName` carries the advertised name instead. Accept either so a scan-time
|
|
81
91
|
* `createDevice` call for a real iOS ad is not rejected before it can connect.
|
|
82
92
|
*/
|
|
83
|
-
if (!params.device.name?.trim() && !params.device.localName?.trim()) {
|
|
93
|
+
if (!params.device.name?.trim() && !params.device.localName?.trim() && !this.customDevices.get(params.deviceName)?.matchByService) {
|
|
84
94
|
throw new Error("Device name is required");
|
|
85
95
|
}
|
|
86
96
|
if (!params.device.id) {
|
|
@@ -107,14 +117,15 @@ export class DeviceCreator {
|
|
|
107
117
|
* A built-in device always wins over a declaration: its decoder is compiled and tested,
|
|
108
118
|
* and a declaration that happens to match the same advertised name must not displace it.
|
|
109
119
|
*/
|
|
110
|
-
matchDeviceName = deviceName => {
|
|
120
|
+
matchDeviceName = (deviceName, serviceUUIDs) => {
|
|
111
121
|
for (const [regex, deviceType] of integratedDevicesMap) {
|
|
112
122
|
if (regex.test(deviceName) && this.acceptedDeviceNames.some(name => name === deviceType)) {
|
|
113
123
|
return deviceType;
|
|
114
124
|
}
|
|
115
125
|
}
|
|
116
126
|
for (const custom of this.customDevices.values()) {
|
|
117
|
-
|
|
127
|
+
const serviceMatch = custom.matchByService && custom.mainServices.some(service => serviceUUIDs.has(service.uuid.toLowerCase()));
|
|
128
|
+
if (serviceMatch || deviceName && custom.nameMatch.test(deviceName)) {
|
|
118
129
|
return custom.id;
|
|
119
130
|
}
|
|
120
131
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["integratedDevicesMap","IntegratedDevices","isCustomDeviceDefinition","BC01Device","BP2Device","CustomDevice","F4Device","SPO2Device","VerovalDuoControlDevice","VerovalEcgDevice","DEVICE_CLASSES","BP2","F4","PC60WF","BC01","VEROVAL_DUO_CONTROL","VEROVAL_ECG","collectCustomDevices","acceptedDevices","customDevices","Map","matchers","Set","forEach","entry","index","Error","has","id","nameMatch","source","set","add","DeviceCreator","deviceNameCache","CACHE_MAX_SIZE","constructor","acceptedDeviceNames","getDeviceName","foundName","
|
|
1
|
+
{"version":3,"names":["integratedDevicesMap","IntegratedDevices","isCustomDeviceDefinition","BC01Device","BloodGlucoseDevice","BP2Device","CustomDevice","F4Device","SPO2Device","VerovalDuoControlDevice","VerovalEcgDevice","DEVICE_CLASSES","BP2","F4","PC60WF","BC01","TAIDOC_GLUCOSE","GLUCOCHECK","BGM","VEROVAL_DUO_CONTROL","VEROVAL_ECG","collectCustomDevices","acceptedDevices","customDevices","Map","matchers","Set","forEach","entry","index","Error","has","id","matchByService","nameMatch","source","set","add","DeviceCreator","deviceNameCache","CACHE_MAX_SIZE","constructor","acceptedDeviceNames","getDeviceName","foundName","serviceUUIDs","normalizedServices","map","uuid","toLowerCase","size","undefined","matchDeviceName","get","matched","cacheDeviceName","createDevice","params","String","deviceName","trim","device","name","localName","custom","deviceClass","Object","keys","join","destroy","clear","regex","deviceType","test","some","values","serviceMatch","mainServices","service","firstKey","next","value","delete"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/services/device-creator.ts"],"mappings":";;AAAA,SAASA,oBAAoB,QAAQ,wCAAqC;AAM1E,SAASC,iBAAiB,QAAQ,gCAA6B;AAC/D,SAASC,wBAAwB,QAAQ,yCAAsC;AAE/E,SAASC,UAAU,QAAQ,+BAA4B;AACvD,SAASC,kBAAkB,QAAQ,iDAA8C;AACjF,SAASC,SAAS,QAAQ,6BAA0B;AAEpD,SAASC,YAAY,QAAQ,mCAAgC;AAC7D,SAASC,QAAQ,QAAQ,2BAAwB;AACjD,SAASC,UAAU,QAAQ,8BAA2B;AACtD,SAASC,uBAAuB,QAAQ,iD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,CAAC,CAACC,KAAK;MAEzD,IAAIF,QAAQ,KAAK5B,SAAS,EAAE;QAC1B,IAAI,CAACZ,eAAe,CAAC2C,MAAM,CAACH,QAAQ,CAAC;MACvC;IACF;IAEA,IAAI,CAACxC,eAAe,CAACH,GAAG,CAACuB,UAAU,EAAEa,UAAU,CAAC;EAClD;AACF","ignoreList":[]}
|
|
@@ -45,7 +45,7 @@ const SPOT_CHECK_TIMEOUT_MS = 60_000;
|
|
|
45
45
|
* measurement would post old readings as though they had just been taken.
|
|
46
46
|
*/
|
|
47
47
|
export const aoj20aThermometer = params => defineCustomDevice({
|
|
48
|
-
id: params.id,
|
|
48
|
+
id: params.id ?? "aoj-20a-thermometer",
|
|
49
49
|
nameMatch: params.nameMatch,
|
|
50
50
|
stuckDataTimeoutMs: params.stuckDataTimeoutMs ?? SPOT_CHECK_TIMEOUT_MS,
|
|
51
51
|
services: [{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["MeasurementTypeKey","defineCustomDevice","FRAME_HEADER","COMMAND_BYTE","FRAME_BYTES","CHECKSUM_INDEX","CHECKSUM_FROM","PAYLOAD","TEMPERATURE_REPLY","TEMPERATURE_SCALE","TEMPERATURE_DECIMALS","SPOT_CHECK_TIMEOUT_MS","aoj20aThermometer","params","id","nameMatch","stuckDataTimeoutMs","services","uuid","monitor","frame","header","minLengthBytes","checksum","algorithm","index","from","caseSelectorBytes","cases","selector","kind","measurementTypeKey","temperature","fields","name","byteIndexes","byteOrder","unit","scale","decimals"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/aoj/aoj.thermometers.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,YAAY;AAG/C,SAASC,kBAAkB,QAAQ,sCAAmC;;AAEtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,MAAMC,YAAY,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC;AAEjC,MAAMC,YAAY,GAAG,CAAC;;AAEtB;AACA,MAAMC,WAAW,GAAG,CAAC;AACrB,MAAMC,cAAc,GAAG,CAAC;;AAExB;AACA,MAAMC,aAAa,GAAG,CAAC;AAEvB,MAAMC,OAAO,GAAG,CAAC;;AAEjB;AACA,MAAMC,iBAAiB,GAAG,IAAI;;AAE9B;AACA,MAAMC,iBAAiB,GAAG,IAAI;AAC9B,MAAMC,oBAAoB,GAAG,CAAC;AAE9B,MAAMC,qBAAqB,GAAG,MAAM;AAapC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,iBAAiB,GAC5BC,MAAuB,IAEvBZ,kBAAkB,CAAC;EACjBa,EAAE,EAAED,MAAM,CAACC,EAAE;
|
|
1
|
+
{"version":3,"names":["MeasurementTypeKey","defineCustomDevice","FRAME_HEADER","COMMAND_BYTE","FRAME_BYTES","CHECKSUM_INDEX","CHECKSUM_FROM","PAYLOAD","TEMPERATURE_REPLY","TEMPERATURE_SCALE","TEMPERATURE_DECIMALS","SPOT_CHECK_TIMEOUT_MS","aoj20aThermometer","params","id","nameMatch","stuckDataTimeoutMs","services","uuid","monitor","frame","header","minLengthBytes","checksum","algorithm","index","from","caseSelectorBytes","cases","selector","kind","measurementTypeKey","temperature","fields","name","byteIndexes","byteOrder","unit","scale","decimals"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/aoj/aoj.thermometers.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,YAAY;AAG/C,SAASC,kBAAkB,QAAQ,sCAAmC;;AAEtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,MAAMC,YAAY,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC;AAEjC,MAAMC,YAAY,GAAG,CAAC;;AAEtB;AACA,MAAMC,WAAW,GAAG,CAAC;AACrB,MAAMC,cAAc,GAAG,CAAC;;AAExB;AACA,MAAMC,aAAa,GAAG,CAAC;AAEvB,MAAMC,OAAO,GAAG,CAAC;;AAEjB;A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|
+
/** Wire constants and frame builders shared by the BC401 command sequencer. */
|
|
4
|
+
const OP_RESET = 0x80;
|
|
5
|
+
const OP_REQUEST_VERSION = 0x82;
|
|
6
|
+
const OP_SET_TIME = 0x83;
|
|
7
|
+
const OP_REQUEST_COUNT = 0x90;
|
|
8
|
+
const OP_REQUEST_RECORDS = 0x92;
|
|
9
|
+
const OP_REQUEST_QUANTITATIVE_RECORDS = 0x95;
|
|
10
|
+
const ACK_LAST_OF_SET = 0x7e;
|
|
11
|
+
const REQUEST_ALL = 0x00;
|
|
12
|
+
const REQUEST_NEXT_RECORD_GROUP = 0x01;
|
|
13
|
+
const RETRY_RECORD_GROUP = 0x02;
|
|
14
|
+
const FINAL_RECORD_DELAY_MS = 200;
|
|
15
|
+
const RESET_DELAY_MS = 100;
|
|
16
|
+
const RX = {
|
|
17
|
+
ACK: 0xf0,
|
|
18
|
+
VERSION_REPLY: 0xf2,
|
|
19
|
+
TIME_SYNC_ACK: 0xf3,
|
|
20
|
+
COUNT_REPLY: 0xe0,
|
|
21
|
+
STORED_RECORD_URS: 0xe1,
|
|
22
|
+
STORED_RECORD_PAGED: 0xe2,
|
|
23
|
+
FINISH: 0xe3,
|
|
24
|
+
STORED_QUANTITATIVE: 0xe4,
|
|
25
|
+
STORED_QUANTITATIVE_PAGED: 0xe5
|
|
26
|
+
};
|
|
27
|
+
const RECORD_FLAGS_INDEX = 1;
|
|
28
|
+
const RECORD_LAST_OF_SET_BIT = 0x40;
|
|
29
|
+
const asHex = byte => (byte & 0xff).toString(16).padStart(2, "0");
|
|
30
|
+
const bc401Checksum = bytes => bytes.reduce((acc, byte) => acc + (byte & 0x7f), 0) & 0x7f;
|
|
31
|
+
const buildCommand = (opcode, arg) => [opcode, arg, bc401Checksum([opcode, arg])];
|
|
32
|
+
const buildResetCommand = () => [OP_RESET, 0x00];
|
|
33
|
+
const buildRequestVersionCommand = () => [OP_REQUEST_VERSION, bc401Checksum([OP_REQUEST_VERSION])];
|
|
34
|
+
const buildSetTimeCommand = now => {
|
|
35
|
+
const payload = [OP_SET_TIME, now.getFullYear() - 2000, now.getMonth() + 1, now.getDate(), now.getHours(), now.getMinutes(), now.getSeconds(), now.getMilliseconds() & 0xff, now.getMilliseconds() >> 8 & 0xff];
|
|
36
|
+
return [...payload, bc401Checksum(payload)];
|
|
37
|
+
};
|
|
38
|
+
const buildDeleteCommand = () => [0x93, 0x13];
|
|
39
|
+
export { ACK_LAST_OF_SET, asHex, bc401Checksum, buildCommand, buildDeleteCommand, buildRequestVersionCommand, buildResetCommand, buildSetTimeCommand, FINAL_RECORD_DELAY_MS, OP_REQUEST_COUNT, OP_REQUEST_QUANTITATIVE_RECORDS, OP_REQUEST_RECORDS, RECORD_FLAGS_INDEX, RECORD_LAST_OF_SET_BIT, REQUEST_ALL, REQUEST_NEXT_RECORD_GROUP, RESET_DELAY_MS, RETRY_RECORD_GROUP, RX };
|
|
40
|
+
//# sourceMappingURL=bc01-command-builders.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["OP_RESET","OP_REQUEST_VERSION","OP_SET_TIME","OP_REQUEST_COUNT","OP_REQUEST_RECORDS","OP_REQUEST_QUANTITATIVE_RECORDS","ACK_LAST_OF_SET","REQUEST_ALL","REQUEST_NEXT_RECORD_GROUP","RETRY_RECORD_GROUP","FINAL_RECORD_DELAY_MS","RESET_DELAY_MS","RX","ACK","VERSION_REPLY","TIME_SYNC_ACK","COUNT_REPLY","STORED_RECORD_URS","STORED_RECORD_PAGED","FINISH","STORED_QUANTITATIVE","STORED_QUANTITATIVE_PAGED","RECORD_FLAGS_INDEX","RECORD_LAST_OF_SET_BIT","asHex","byte","toString","padStart","bc401Checksum","bytes","reduce","acc","buildCommand","opcode","arg","buildResetCommand","buildRequestVersionCommand","buildSetTimeCommand","now","payload","getFullYear","getMonth","getDate","getHours","getMinutes","getSeconds","getMilliseconds","buildDeleteCommand"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/bc01/bc01-command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the BC401 firmware speaks, as reverse-engineered from
|
|
7
|
-
* PHMS 3.0.03 (`I1/b.java` for the switch, `B3/B5.java` for the builders and
|
|
8
|
-
* checksum, `L1/f.java` for the reset write).
|
|
9
|
-
*/
|
|
10
|
-
const OP_RESET = 0x80;
|
|
11
|
-
const OP_REQUEST_VERSION = 0x82;
|
|
12
|
-
const OP_SET_TIME = 0x83;
|
|
13
|
-
const OP_REQUEST_COUNT = 0x90;
|
|
14
|
-
const OP_REQUEST_RECORDS = 0x92;
|
|
15
|
-
|
|
16
|
-
/** Payload byte for `OP_REQUEST_RECORDS` that acknowledges the last record of the set. */
|
|
17
|
-
const ACK_LAST_OF_SET = 0x7e;
|
|
18
|
-
|
|
19
|
-
/** Payload byte for `OP_REQUEST_COUNT` and the initial `OP_REQUEST_RECORDS`. */
|
|
20
|
-
const REQUEST_ALL = 0x00;
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Device-to-host frame prefixes the FSM keys on. Values are decimal opcodes as
|
|
24
|
-
* they appear in the decompiled Java (`switch(bArr[0])`), rendered here as
|
|
25
|
-
* their real hex opcodes.
|
|
26
|
-
*/
|
|
27
|
-
const RX = {
|
|
28
|
-
ACK: 0xf0,
|
|
29
|
-
VERSION_REPLY: 0xf2,
|
|
30
|
-
TIME_SYNC_ACK: 0xf3,
|
|
31
|
-
COUNT_REPLY: 0xe0,
|
|
32
|
-
STORED_RECORD_URS: 0xe1,
|
|
33
|
-
STORED_RECORD_PAGED: 0xe2,
|
|
34
|
-
FINISH: 0xe3
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
/** Position in a 16-byte URS record where the flags byte sits; bit 0x40 marks the last of a set. */
|
|
38
|
-
const RECORD_FLAGS_INDEX = 1;
|
|
39
|
-
const RECORD_LAST_OF_SET_BIT = 0x40;
|
|
40
|
-
/**
|
|
41
|
-
* Formats one byte as a two-digit lowercase hex string, matching the way the
|
|
42
|
-
* SDK's transport already spells raw bytes.
|
|
43
|
-
*/
|
|
44
|
-
const asHex = byte => (byte & 0xff).toString(16).padStart(2, "0");
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* BC401 checksum: sum of the low 7 bits of every byte, folded back into 7 bits.
|
|
48
|
-
* Matches `B5.a` in the decompiled Java exactly.
|
|
49
|
-
*/
|
|
50
|
-
const bc401Checksum = bytes => bytes.reduce((acc, byte) => acc + (byte & 0x7f), 0) & 0x7f;
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Builds a "one payload byte plus checksum" command frame. This is the shape
|
|
54
|
-
* of every BC401 host-to-device command that carries an argument: opcode,
|
|
55
|
-
* argument, checksum-over-both.
|
|
56
|
-
*/
|
|
57
|
-
const buildCommand = (opcode, arg) => {
|
|
58
|
-
const chk = bc401Checksum([opcode, arg]);
|
|
59
|
-
return [opcode, arg, chk];
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Builds the two-byte reset frame. It is the one command that does not carry
|
|
64
|
-
* an argument or a checksum — PHMS writes it as `[0x80, 0x00]` verbatim
|
|
65
|
-
* (`L1/f.java:694`).
|
|
66
|
-
*/
|
|
67
|
-
const buildResetCommand = () => [OP_RESET, 0x00];
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Builds the request-version reply. The Java sends it as `[0x82, 0x02]` where
|
|
71
|
-
* `0x02` doubles as the checksum of `0x82` under the BC401 rule
|
|
72
|
-
* (`0x82 & 0x7f = 0x02`), so the same formula that guards every other command
|
|
73
|
-
* produces the right byte here.
|
|
74
|
-
*/
|
|
75
|
-
const buildRequestVersionCommand = () => {
|
|
76
|
-
const chk = bc401Checksum([OP_REQUEST_VERSION]);
|
|
77
|
-
return [OP_REQUEST_VERSION, chk];
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Builds the `SET_TIME` frame for the moment the sequencer receives it. The
|
|
82
|
-
* device does not run its own clock across power cycles, so timestamps on
|
|
83
|
-
* stored records only make sense once the app tells it what "now" is.
|
|
84
|
-
* Millisecond field is written little-endian, matching `I1/b.java`.
|
|
85
|
-
*/
|
|
86
|
-
const buildSetTimeCommand = now => {
|
|
87
|
-
const yy = now.getFullYear() - 2000;
|
|
88
|
-
const mo = now.getMonth() + 1;
|
|
89
|
-
const dd = now.getDate();
|
|
90
|
-
const hh = now.getHours();
|
|
91
|
-
const mi = now.getMinutes();
|
|
92
|
-
const ss = now.getSeconds();
|
|
93
|
-
const ms = now.getMilliseconds();
|
|
94
|
-
const msLo = ms & 0xff;
|
|
95
|
-
const msHi = ms >> 8 & 0xff;
|
|
96
|
-
const payload = [OP_SET_TIME, yy, mo, dd, hh, mi, ss, msLo, msHi];
|
|
97
|
-
const chk = bc401Checksum(payload);
|
|
98
|
-
return [...payload, chk];
|
|
99
|
-
};
|
|
100
|
-
|
|
4
|
+
import { ACK_LAST_OF_SET, asHex, bc401Checksum, buildCommand, buildDeleteCommand, buildRequestVersionCommand, buildResetCommand, buildSetTimeCommand, FINAL_RECORD_DELAY_MS, OP_REQUEST_COUNT, OP_REQUEST_QUANTITATIVE_RECORDS, OP_REQUEST_RECORDS, RECORD_FLAGS_INDEX, RECORD_LAST_OF_SET_BIT, REQUEST_ALL, REQUEST_NEXT_RECORD_GROUP, RESET_DELAY_MS, RETRY_RECORD_GROUP, RX } from "./bc01-command-builders.js";
|
|
101
5
|
/**
|
|
102
6
|
* Walks the BC401 through its post-reset handshake and pulls every stored
|
|
103
7
|
* record.
|
|
@@ -118,13 +22,19 @@ const buildSetTimeCommand = now => {
|
|
|
118
22
|
export class Bc01CommandSequencer {
|
|
119
23
|
isDone = false;
|
|
120
24
|
|
|
25
|
+
/** Ten standard pages per request group; 10 means a new group. */
|
|
26
|
+
standardPage = 10;
|
|
27
|
+
|
|
28
|
+
/** Five quantitative pages per request group; 5 means a new group. */
|
|
29
|
+
quantitativePage = 5;
|
|
30
|
+
|
|
121
31
|
/** Injectable for tests; production reads `Date.now()`. */
|
|
122
32
|
|
|
123
33
|
constructor(params, clock = () => new Date()) {
|
|
124
34
|
this.params = params;
|
|
125
35
|
this.clock = clock;
|
|
126
36
|
}
|
|
127
|
-
initialCommands = () => [this.commandFor(buildResetCommand())];
|
|
37
|
+
initialCommands = () => [this.commandFor(buildResetCommand(), RESET_DELAY_MS)];
|
|
128
38
|
nextCommand = frame => {
|
|
129
39
|
if (this.isDone || frame.length === 0) {
|
|
130
40
|
return undefined;
|
|
@@ -141,7 +51,10 @@ export class Bc01CommandSequencer {
|
|
|
141
51
|
return [this.commandFor(buildCommand(OP_REQUEST_RECORDS, REQUEST_ALL))];
|
|
142
52
|
case RX.STORED_RECORD_URS:
|
|
143
53
|
case RX.STORED_RECORD_PAGED:
|
|
144
|
-
return this.answerStoredRecord(frame);
|
|
54
|
+
return this.answerStoredRecord(opcode, frame);
|
|
55
|
+
case RX.STORED_QUANTITATIVE:
|
|
56
|
+
case RX.STORED_QUANTITATIVE_PAGED:
|
|
57
|
+
return this.answerQuantitativeRecord(opcode, frame);
|
|
145
58
|
case RX.FINISH:
|
|
146
59
|
this.isDone = true;
|
|
147
60
|
return undefined;
|
|
@@ -149,23 +62,60 @@ export class Bc01CommandSequencer {
|
|
|
149
62
|
return undefined;
|
|
150
63
|
}
|
|
151
64
|
};
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
65
|
+
answerStoredRecord = (opcode, frame) => {
|
|
66
|
+
const flags = hexToByte(frame[RECORD_FLAGS_INDEX] ?? "0");
|
|
67
|
+
if (opcode === RX.STORED_RECORD_URS) {
|
|
68
|
+
return this.finishStoredRecords(OP_REQUEST_RECORDS);
|
|
69
|
+
}
|
|
70
|
+
const page = flags & 0x0f;
|
|
71
|
+
if (this.standardPage === 10) {
|
|
72
|
+
this.standardPage = 0;
|
|
73
|
+
}
|
|
74
|
+
if (page !== this.standardPage) {
|
|
75
|
+
this.standardPage = 10;
|
|
76
|
+
return [this.commandFor(buildCommand(OP_REQUEST_RECORDS, RETRY_RECORD_GROUP))];
|
|
77
|
+
}
|
|
78
|
+
this.standardPage += 1;
|
|
79
|
+
if (this.standardPage === 10 && (flags & RECORD_LAST_OF_SET_BIT) === 0) {
|
|
80
|
+
return [this.commandFor(buildCommand(OP_REQUEST_RECORDS, REQUEST_NEXT_RECORD_GROUP))];
|
|
81
|
+
}
|
|
82
|
+
if ((flags & RECORD_LAST_OF_SET_BIT) === 0) {
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
|
85
|
+
this.standardPage = 10;
|
|
86
|
+
return this.finishStoredRecords(OP_REQUEST_RECORDS);
|
|
87
|
+
};
|
|
88
|
+
answerQuantitativeRecord = (opcode, frame) => {
|
|
159
89
|
const flags = hexToByte(frame[RECORD_FLAGS_INDEX] ?? "0");
|
|
90
|
+
if (opcode === RX.STORED_QUANTITATIVE) {
|
|
91
|
+
return this.finishStoredRecords(OP_REQUEST_QUANTITATIVE_RECORDS);
|
|
92
|
+
}
|
|
93
|
+
const page = flags & 0x0f;
|
|
94
|
+
if (this.quantitativePage === 5) {
|
|
95
|
+
this.quantitativePage = 0;
|
|
96
|
+
}
|
|
97
|
+
if (page !== this.quantitativePage) {
|
|
98
|
+
this.quantitativePage = 5;
|
|
99
|
+
return [this.commandFor(buildCommand(OP_REQUEST_QUANTITATIVE_RECORDS, RETRY_RECORD_GROUP))];
|
|
100
|
+
}
|
|
101
|
+
this.quantitativePage += 1;
|
|
102
|
+
if (this.quantitativePage === 5 && (flags & RECORD_LAST_OF_SET_BIT) === 0) {
|
|
103
|
+
return [this.commandFor(buildCommand(OP_REQUEST_QUANTITATIVE_RECORDS, REQUEST_NEXT_RECORD_GROUP))];
|
|
104
|
+
}
|
|
160
105
|
if ((flags & RECORD_LAST_OF_SET_BIT) === 0) {
|
|
161
106
|
return undefined;
|
|
162
107
|
}
|
|
163
|
-
|
|
108
|
+
this.quantitativePage = 5;
|
|
109
|
+
return this.finishStoredRecords(OP_REQUEST_QUANTITATIVE_RECORDS);
|
|
110
|
+
};
|
|
111
|
+
finishStoredRecords = opcode => {
|
|
112
|
+
this.isDone = true;
|
|
113
|
+
return [this.commandFor(buildCommand(opcode, ACK_LAST_OF_SET)), this.commandFor(buildDeleteCommand(), FINAL_RECORD_DELAY_MS)];
|
|
164
114
|
};
|
|
165
|
-
commandFor = bytes => ({
|
|
115
|
+
commandFor = (bytes, delayBeforeWriteMs = 0) => ({
|
|
166
116
|
...this.params.write,
|
|
167
117
|
frame: bytes.map(asHex),
|
|
168
|
-
|
|
118
|
+
delayBeforeWriteMs
|
|
169
119
|
});
|
|
170
120
|
}
|
|
171
121
|
|
package/lib/module/modules/bt-management/services/devices/bc01/bc01-command-sequencer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["hexToByte","
|
|
1
|
+
{"version":3,"names":["hexToByte","ACK_LAST_OF_SET","asHex","bc401Checksum","buildCommand","buildDeleteCommand","buildRequestVersionCommand","buildResetCommand","buildSetTimeCommand","FINAL_RECORD_DELAY_MS","OP_REQUEST_COUNT","OP_REQUEST_QUANTITATIVE_RECORDS","OP_REQUEST_RECORDS","RECORD_FLAGS_INDEX","RECORD_LAST_OF_SET_BIT","REQUEST_ALL","REQUEST_NEXT_RECORD_GROUP","RESET_DELAY_MS","RETRY_RECORD_GROUP","RX","Bc01CommandSequencer","isDone","standardPage","quantitativePage","constructor","params","clock","Date","initialCommands","commandFor","nextCommand","frame","length","undefined","opcode","ACK","VERSION_REPLY","TIME_SYNC_ACK","COUNT_REPLY","STORED_RECORD_URS","STORED_RECORD_PAGED","answerStoredRecord","STORED_QUANTITATIVE","STORED_QUANTITATIVE_PAGED","answerQuantitativeRecord","FINISH","flags","finishStoredRecords","page","bytes","delayBeforeWriteMs","write","map","bc01CommandSequencerInternals"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/bc01/bc01-command-sequencer.ts"],"mappings":";;AAEA,SAASA,SAAS,QAAQ,+BAA4B;AAEtD,SACEC,eAAe,EACfC,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ACL,IAAI,CAACe,UAAU,CACbzB,YAAY,CACVO,+BAA+B,EAC/BK,yBACF,CACF,CAAC,CACF;IACH;IAEA,IAAI,CAAC8B,KAAK,GAAGhC,sBAAsB,MAAM,CAAC,EAAE;MAC1C,OAAOmB,SAAS;IAClB;IAEA,IAAI,CAACV,gBAAgB,GAAG,CAAC;IAEzB,OAAO,IAAI,CAACwB,mBAAmB,CAACpC,+BAA+B,CAAC;EAClE,CAAC;EAEOoC,mBAAmB,GAAIb,MAAc,IAA+B;IAC1E,IAAI,CAACb,MAAM,GAAG,IAAI;IAElB,OAAO,CACL,IAAI,CAACQ,UAAU,CAACzB,YAAY,CAAC8B,MAAM,EAAEjC,eAAe,CAAC,CAAC,EACtD,IAAI,CAAC4B,UAAU,CAACxB,kBAAkB,CAAC,CAAC,EAAEI,qBAAqB,CAAC,CAC7D;EACH,CAAC;EAEOoB,UAAU,GAAGA,CACnBoB,KAAwB,EACxBC,kBAAkB,GAAG,CAAC,MACH;IACnB,GAAG,IAAI,CAACzB,MAAM,CAAC0B,KAAK;IACpBpB,KAAK,EAAEkB,KAAK,CAACG,GAAG,CAAClD,KAAK,CAAC;IACvBgD;EACF,CAAC,CAAC;AACJ;;AAEA;AACA,OAAO,MAAMG,6BAA6B,GAAG;EAC3ClD,aAAa;EACbC,YAAY;EACZG,iBAAiB;EACjBD,0BAA0B;EAC1BE;AACF,CAAC","ignoreList":[]}
|
|
@@ -6,6 +6,7 @@ import { hexToByte } from "../../../utils/hex-to-byte.js";
|
|
|
6
6
|
import { BTManagedDevice } from "../bt-managed-device.js";
|
|
7
7
|
import { Bc01CommandSequencer } from "./bc01-command-sequencer.js";
|
|
8
8
|
import { BC01_ANALYTE_ORDER, parseBc01Record } from "./bc01-frame-parser.js";
|
|
9
|
+
import { Bc01FrameReader } from "./bc01.frame-reader.js";
|
|
9
10
|
import { bc01MainServices } from "./bc01.main-services.js";
|
|
10
11
|
|
|
11
12
|
/** Minimum bytes a complete frame carries, keyed by its opening opcode. */
|
|
@@ -42,6 +43,7 @@ const BC01_FRAME_MIN_LENGTH = {
|
|
|
42
43
|
export class BC01Device extends BTManagedDevice {
|
|
43
44
|
onStreamStart = () => {};
|
|
44
45
|
mainServices = bc01MainServices;
|
|
46
|
+
frameReader = new Bc01FrameReader();
|
|
45
47
|
|
|
46
48
|
/**
|
|
47
49
|
* 90 s covers the maximum firmware-side reagent-pad settle time on a URS-7
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["MeasurementTypeKey","CaseType","hexToByte","BTManagedDevice","Bc01CommandSequencer","BC01_ANALYTE_ORDER","parseBc01Record","bc01MainServices","BC01_FRAME_MIN_LENGTH","BC01Device","onStreamStart","mainServices","stuckDataTimeout","constructor","device","params","createCommandSequencer","write","serviceUuid","uuid","characteristicUuid","writeUuid","onRefused","reason","onError","Error","validatePackage","pkg","length","opcode","minLength","undefined","handleDependentResult","data","frame","reportUrsRecord","parsingCase","caseType","OTHER","handleSuccessResult","parsed","measuredValues","reduce","acc","analyte","value","values","Object","keys","reading","RESULT","measurementTypeKey","uricAcid","urineValues","recordedAt","timestamp","onResult"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/bc01/bc01.device.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAiC,YAAY;AAGxE,SAASC,QAAQ,QAAQ,6BAA0B;AAQnD,SAASC,SAAS,QAAQ,+BAA4B;AACtD,SAASC,eAAe,QAAQ,yBAAsB;AAEtD,SAASC,oBAAoB,QAAQ,6BAA0B;AAC/D,SAASC,kBAAkB,EAAEC,eAAe,QAAQ,wBAAqB;AACzE,SAASC,gBAAgB,QAAQ,yBAAsB;;AAEvD;AACA,MAAMC,qBAA6C,GAAG;EACpD,IAAI,EAAE,CAAC;EAAE;EACT,IAAI,EAAE,CAAC;EAAE;EACT,IAAI,EAAE,CAAC;EAAE;EACT,IAAI,EAAE,CAAC;EAAE;EACT,IAAI,EAAE,EAAE;EAAE;EACV,IAAI,EAAE,EAAE;EAAE;EACV,IAAI,EAAE,CAAC;EAAE;EACT,IAAI,EAAE,EAAE;EAAE;EACV,IAAI,EAAE,EAAE,CAAE;AACZ,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,UAAU,
|
|
1
|
+
{"version":3,"names":["MeasurementTypeKey","CaseType","hexToByte","BTManagedDevice","Bc01CommandSequencer","BC01_ANALYTE_ORDER","parseBc01Record","Bc01FrameReader","bc01MainServices","BC01_FRAME_MIN_LENGTH","BC01Device","onStreamStart","mainServices","frameReader","stuckDataTimeout","constructor","device","params","createCommandSequencer","write","serviceUuid","uuid","characteristicUuid","writeUuid","onRefused","reason","onError","Error","validatePackage","pkg","length","opcode","minLength","undefined","handleDependentResult","data","frame","reportUrsRecord","parsingCase","caseType","OTHER","handleSuccessResult","parsed","measuredValues","reduce","acc","analyte","value","values","Object","keys","reading","RESULT","measurementTypeKey","uricAcid","urineValues","recordedAt","timestamp","onResult"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/bc01/bc01.device.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAiC,YAAY;AAGxE,SAASC,QAAQ,QAAQ,6BAA0B;AAQnD,SAASC,SAAS,QAAQ,+BAA4B;AACtD,SAASC,eAAe,QAAQ,yBAAsB;AAEtD,SAASC,oBAAoB,QAAQ,6BAA0B;AAC/D,SAASC,kBAAkB,EAAEC,eAAe,QAAQ,wBAAqB;AACzE,SAASC,eAAe,QAAQ,wBAAqB;AACrD,SAASC,gBAAgB,QAAQ,yBAAsB;;AAEvD;AACA,MAAMC,qBAA6C,GAAG;EACpD,IAAI,EAAE,CAAC;EAAE;EACT,IAAI,EAAE,CAAC;EAAE;EACT,IAAI,EAAE,CAAC;EAAE;EACT,IAAI,EAAE,CAAC;EAAE;EACT,IAAI,EAAE,EAAE;EAAE;EACV,IAAI,EAAE,EAAE;EAAE;EACV,IAAI,EAAE,CAAC;EAAE;EACT,IAAI,EAAE,EAAE;E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
2
|
+
|
|
3
|
+
import { FrameReadStatus } from "../../../types/frame-read-status.js";
|
|
4
|
+
/** Fixed BC401 reply lengths, keyed by the first byte of each PHMS frame. */
|
|
5
|
+
const BC01_FRAME_LENGTHS = {
|
|
6
|
+
f0: 2,
|
|
7
|
+
f2: 8,
|
|
8
|
+
f3: 3,
|
|
9
|
+
e0: 7,
|
|
10
|
+
e1: 16,
|
|
11
|
+
e2: 16,
|
|
12
|
+
e3: 3,
|
|
13
|
+
e4: 36,
|
|
14
|
+
e5: 36
|
|
15
|
+
};
|
|
16
|
+
const lower = byte => (byte ?? "").toLowerCase();
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Isolates the fixed-length frames used by Contec BC401BT.
|
|
20
|
+
*
|
|
21
|
+
* PHMS keeps a byte queue and repeatedly consumes complete replies. BLE notifications are
|
|
22
|
+
* not frame boundaries, so the SDK must retain partial replies and drain multiple replies
|
|
23
|
+
* when Android combines them into one notification.
|
|
24
|
+
*/
|
|
25
|
+
class Bc01FrameReader {
|
|
26
|
+
readFrame(buffer) {
|
|
27
|
+
const start = buffer.findIndex(byte => Object.prototype.hasOwnProperty.call(BC01_FRAME_LENGTHS, lower(byte)));
|
|
28
|
+
if (start === -1) {
|
|
29
|
+
return {
|
|
30
|
+
status: FrameReadStatus.INCOMPLETE,
|
|
31
|
+
consumedBytes: buffer.length
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
const opcode = lower(buffer[start]);
|
|
35
|
+
const length = BC01_FRAME_LENGTHS[opcode];
|
|
36
|
+
if (length === undefined) {
|
|
37
|
+
return {
|
|
38
|
+
status: FrameReadStatus.INCOMPLETE,
|
|
39
|
+
consumedBytes: start + 1
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
if (start + length > buffer.length) {
|
|
43
|
+
return {
|
|
44
|
+
status: FrameReadStatus.INCOMPLETE,
|
|
45
|
+
consumedBytes: start
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
status: FrameReadStatus.COMPLETE,
|
|
50
|
+
consumedBytes: start + length,
|
|
51
|
+
frame: buffer.slice(start, start + length)
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
export { Bc01FrameReader, BC01_FRAME_LENGTHS as bc01FrameLengths };
|
|
56
|
+
//# sourceMappingURL=bc01.frame-reader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["FrameReadStatus","BC01_FRAME_LENGTHS","f0","f2","f3","e0","e1","e2","e3","e4","e5","lower","byte","toLowerCase","Bc01FrameReader","readFrame","buffer","start","findIndex","Object","prototype","hasOwnProperty","call","status","INCOMPLETE","consumedBytes","length","opcode","undefined","COMPLETE","frame","slice","bc01FrameLengths"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/bc01/bc01.frame-reader.ts"],"mappings":";;AACA,SAASA,eAAe,QAAQ,qCAAkC;AAGlE;AACA,MAAMC,kBAAoD,GAAG;EAC3DC,EAAE,EAAE,CAAC;EACLC,EAAE,EAAE,CAAC;EACLC,EAAE,EAAE,CAAC;EACLC,EAAE,EAAE,CAAC;EACLC,EAAE,EAAE,EAAE;EACNC,EAAE,EAAE,EAAE;EACNC,EAAE,EAAE,CAAC;EACLC,EAAE,EAAE,EAAE;EACNC,EAAE,EAAE;AACN,CAAC;AAED,MAAMC,KAAK,GAAIC,IAAwB,IAAa,CAACA,IAAI,IAAI,EAAE,EAAEC,WAAW,CAAC,CAAC;;AAE9E;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,eAAe,CAAwB;EACpCC,SAASA,CAACC,MAAyB,EAAmB;IAC3D,MAAMC,KAAK,GAAGD,MAAM,CAACE,SAAS,CAAEN,IAAI,IAClCO,MAAM,CAACC,SAAS,CAACC,cAAc,CAACC,IAAI,CAACrB,kBAAkB,EAAEU,KAAK,CAACC,IAAI,CAAC,CACtE,CAAC;IAED,IAAIK,KAAK,KAAK,CAAC,CAAC,EAAE;MAChB,OAAO;QACLM,MAAM,EAAEvB,eAAe,CAACwB,UAAU;QAClCC,aAAa,EAAET,MAAM,CAACU;MACxB,CAAC;IACH;IAEA,MAAMC,MAAM,GAAGhB,KAAK,CAACK,MAAM,CAACC,KAAK,CAAC,CAAC;IACnC,MAAMS,MAAM,GAAGzB,kBAAkB,CAAC0B,MAAM,CAAC;IAEzC,IAAID,MAAM,KAAKE,SAAS,EAAE;MACxB,OAAO;QACLL,MAAM,EAAEvB,eAAe,CAACwB,UAAU;QAClCC,aAAa,EAAER,KAAK,GAAG;MACzB,CAAC;IACH;IAEA,IAAIA,KAAK,GAAGS,MAAM,GAAGV,MAAM,CAACU,MAAM,EAAE;MAClC,OAAO;QACLH,MAAM,EAAEvB,eAAe,CAACwB,UAAU;QAClCC,aAAa,EAAER;MACjB,CAAC;IACH;IAEA,OAAO;MACLM,MAAM,EAAEvB,eAAe,CAAC6B,QAAQ;MAChCJ,aAAa,EAAER,KAAK,GAAGS,MAAM;MAC7BI,KAAK,EAAEd,MAAM,CAACe,KAAK,CAACd,KAAK,EAAEA,KAAK,GAAGS,MAAM;IAC3C,CAAC;EACH;AACF;AAEA,SAASZ,eAAe,EAAEb,kBAAkB,IAAI+B,gBAAgB","ignoreList":[]}
|
package/lib/module/modules/bt-management/services/devices/blood-glucose/blood-glucose.device.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { MeasurementTypeKey } from "@ovok/core";
|
|
4
|
+
import { CaseType } from "../../../types/case-type.js";
|
|
5
|
+
import { IntegratedDevices } from "../../../types/integrated-devices.js";
|
|
6
|
+
import { hexToByte } from "../../../utils/hex-to-byte.js";
|
|
7
|
+
import { BTManagedDevice } from "../bt-managed-device.js";
|
|
8
|
+
const LEGACY_SERVICE = "00001523-1212-efde-1523-785feabcd123";
|
|
9
|
+
const LEGACY_CHARACTERISTIC = "00001524-1212-efde-1523-785feabcd123";
|
|
10
|
+
const BGM_SERVICE = "0003cdd0-0000-1000-8000-00805f9b0131";
|
|
11
|
+
const BGM_CHARACTERISTIC = "0003cdd1-0000-1000-8000-00805f9b0131";
|
|
12
|
+
const GLUCOSE_REQUEST = "512600000000a31a";
|
|
13
|
+
const servicesFor = device => {
|
|
14
|
+
const isBgm = device === IntegratedDevices.BGM;
|
|
15
|
+
return [{
|
|
16
|
+
uuid: isBgm ? BGM_SERVICE : LEGACY_SERVICE,
|
|
17
|
+
monitorUuids: [{
|
|
18
|
+
uuid: isBgm ? BGM_CHARACTERISTIC : LEGACY_CHARACTERISTIC,
|
|
19
|
+
parsingModel: {
|
|
20
|
+
caseValuePosition: [isBgm ? 9 : 1],
|
|
21
|
+
cases: [...(isBgm ? ["00", "0b", "10", "11", "18", "22", "33", "55"] : ["46", ...(device === IntegratedDevices.GLUCOCHECK ? ["50"] : [])]).map(caseValue => ({
|
|
22
|
+
caseType: CaseType.OTHER,
|
|
23
|
+
caseValue,
|
|
24
|
+
parseDefinitions: []
|
|
25
|
+
})), {
|
|
26
|
+
measurementTypeKey: MeasurementTypeKey.bloodGlucose,
|
|
27
|
+
caseType: CaseType.RESULT,
|
|
28
|
+
caseValue: isBgm ? "44" : "26",
|
|
29
|
+
parseDefinitions: [{
|
|
30
|
+
name: "bloodGlucose",
|
|
31
|
+
parseType: "custom",
|
|
32
|
+
byteIndexes: isBgm ? [10, 11] : [3, 2],
|
|
33
|
+
parseReference: 16,
|
|
34
|
+
customParserDefinition: value => {
|
|
35
|
+
if (isBgm) {
|
|
36
|
+
return hexToByte(value.slice(0, 2)) * 100 + hexToByte(value.slice(2, 4));
|
|
37
|
+
}
|
|
38
|
+
const raw = parseInt(value, 16);
|
|
39
|
+
return device === IntegratedDevices.TAIDOC_GLUCOSE ? Number((raw * 18).toFixed(2)) : raw;
|
|
40
|
+
}
|
|
41
|
+
}]
|
|
42
|
+
}]
|
|
43
|
+
}
|
|
44
|
+
}],
|
|
45
|
+
...(isBgm ? {} : {
|
|
46
|
+
writeUuid: {
|
|
47
|
+
uuid: LEGACY_CHARACTERISTIC,
|
|
48
|
+
mainCommandUuid: GLUCOSE_REQUEST
|
|
49
|
+
}
|
|
50
|
+
})
|
|
51
|
+
}];
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/** Decodes the legacy TaiDoc, GlucoCheck Gold and TeleBGM glucose protocols. */
|
|
55
|
+
export class BloodGlucoseDevice extends BTManagedDevice {
|
|
56
|
+
stuckDataTimeout = 60_000;
|
|
57
|
+
constructor(device, params) {
|
|
58
|
+
super(device, params);
|
|
59
|
+
this.mainServices = servicesFor(params.deviceName);
|
|
60
|
+
}
|
|
61
|
+
validatePackage = pkg => pkg.length >= (this.deviceData.name === IntegratedDevices.BGM ? 12 : 8);
|
|
62
|
+
handleSuccessResult(result) {
|
|
63
|
+
if (result.caseType !== CaseType.RESULT || result.bloodGlucose === 0) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
this.onResult?.(result);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=blood-glucose.device.js.map
|
package/lib/module/modules/bt-management/services/devices/blood-glucose/blood-glucose.device.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["MeasurementTypeKey","CaseType","IntegratedDevices","hexToByte","BTManagedDevice","LEGACY_SERVICE","LEGACY_CHARACTERISTIC","BGM_SERVICE","BGM_CHARACTERISTIC","GLUCOSE_REQUEST","servicesFor","device","isBgm","BGM","uuid","monitorUuids","parsingModel","caseValuePosition","cases","GLUCOCHECK","map","caseValue","caseType","OTHER","parseDefinitions","measurementTypeKey","bloodGlucose","RESULT","name","parseType","byteIndexes","parseReference","customParserDefinition","value","slice","raw","parseInt","TAIDOC_GLUCOSE","Number","toFixed","writeUuid","mainCommandUuid","BloodGlucoseDevice","stuckDataTimeout","constructor","params","mainServices","deviceName","validatePackage","pkg","length","deviceData","handleSuccessResult","result","onResult"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/dev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