From d6d9a09d505d11148599a95a5be3e1351edbe0ac Mon Sep 17 00:00:00 2001 From: hc Date: Mon, 13 Apr 2026 15:17:52 +0800 Subject: Local iHealth SDK, device detail screen, iOS event fixes --- libs/ihealth-sdk/doc/bg1s.md | 66 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 libs/ihealth-sdk/doc/bg1s.md (limited to 'libs/ihealth-sdk/doc/bg1s.md') diff --git a/libs/ihealth-sdk/doc/bg1s.md b/libs/ihealth-sdk/doc/bg1s.md new file mode 100644 index 0000000..9622f29 --- /dev/null +++ b/libs/ihealth-sdk/doc/bg1s.md @@ -0,0 +1,66 @@ +# BG1S Workflow + +## Import BG1S Module + +```js +import { + BG1SModule, + BG1SProfileModule +} from '@ihealth/ihealthlibrary-react-native'; +``` + +## APIs + +### Add and remove listener + +```js +// add +notifyListener = DeviceEventEmitter.addListener(BG1SModule.Event_Notify, (event) => { + console.log(event); +}); + +// remove +notifyListener.remove(); +``` + +### get function + +Set current time to BG1S and return battery level, bg1s code version. + +```js +BG1SModule.getFunction(mac); + +// response +// {"action": "action_get_device_info", "battery": 100, "info_version_code_blood_bg1s": 1, "info_version_code_ctl_bg1s": 2, "mac": "F65FF0CBA330", "type": "BG1S"} +notifyListener = DeviceEventEmitter.addListener(BG1SModule.Event_Notify, (event) => { + if (event.action === BG1SProfileModule.ACTION_CODE_ANALYSIS) { + console.log(event[BG1SProfileModule.INFO_BATTERY_BG1S]); + console.log(event[BG1SProfileModule.INFO_VERSION_CODE_BLOOD_BG1S]); + console.log(event[BG1SProfileModule.INFO_VERSION_CODE_CTL_BG1S]); + } +}); +``` + +### start a measurement + +```js +// measureMode 0: measure with real blood, 1: measure with control solution +BG1SModule.measure(mac, 1); + +// response +notifyListener = DeviceEventEmitter.addListener(BG1SModule.Event_Notify, (event) => { + if (event.action === BG1SProfileModule.ACTION_STRIP_INSERTION_STATUS) { + // {"action": "action_strip_insertion_status", "describe": "strip in", "insertion_status": 1, "mac": "F65FF0CBA330", "type": "BG1S"} + console.log("strip in"); + + } else if (event.action === BG1SProfileModule.ACTION_GET_BLOOD) { + // {"action": "action_get_blood", "describe": "get blood", "mac": "F65FF0CBA330", "type": "BG1S"} + console.log("blood"); + + } else if (event.action === BG1SProfileModule.ACTION_MEASURE_RESULT) { + // {"action": "action_measure_result", "mac": "F65FF0CBA330", "measure_mode": 0, "measure_result": 0, "type": "BG1S"} + console.log(event[BG1SProfileModule.MEASURE_MODE]); + console.log(event[BG1SProfileModule.MEASURE_RESULT]); + } +}); +``` -- cgit