summaryrefslogtreecommitdiff
path: root/libs/ihealth-sdk/doc/bg1s.md
diff options
context:
space:
mode:
authorhc <haocheng.xie@respiree.com>2026-04-13 15:17:52 +0800
committerhc <haocheng.xie@respiree.com>2026-04-13 15:17:52 +0800
commitd6d9a09d505d11148599a95a5be3e1351edbe0ac (patch)
treea5f5891983d1ff207e99f683a5e151519cef4980 /libs/ihealth-sdk/doc/bg1s.md
parente4fb9966e762852bf17f21c8406501d42fae0b61 (diff)
Local iHealth SDK, device detail screen, iOS event fixes
Diffstat (limited to 'libs/ihealth-sdk/doc/bg1s.md')
-rw-r--r--libs/ihealth-sdk/doc/bg1s.md66
1 files changed, 66 insertions, 0 deletions
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 @@
1# BG1S Workflow
2
3## Import BG1S Module
4
5```js
6import {
7 BG1SModule,
8 BG1SProfileModule
9} from '@ihealth/ihealthlibrary-react-native';
10```
11
12## APIs
13
14### Add and remove listener
15
16```js
17// add
18notifyListener = DeviceEventEmitter.addListener(BG1SModule.Event_Notify, (event) => {
19 console.log(event);
20});
21
22// remove
23notifyListener.remove();
24```
25
26### get function
27
28Set current time to BG1S and return battery level, bg1s code version.
29
30```js
31BG1SModule.getFunction(mac);
32
33// response
34// {"action": "action_get_device_info", "battery": 100, "info_version_code_blood_bg1s": 1, "info_version_code_ctl_bg1s": 2, "mac": "F65FF0CBA330", "type": "BG1S"}
35notifyListener = DeviceEventEmitter.addListener(BG1SModule.Event_Notify, (event) => {
36 if (event.action === BG1SProfileModule.ACTION_CODE_ANALYSIS) {
37 console.log(event[BG1SProfileModule.INFO_BATTERY_BG1S]);
38 console.log(event[BG1SProfileModule.INFO_VERSION_CODE_BLOOD_BG1S]);
39 console.log(event[BG1SProfileModule.INFO_VERSION_CODE_CTL_BG1S]);
40 }
41});
42```
43
44### start a measurement
45
46```js
47// measureMode 0: measure with real blood, 1: measure with control solution
48BG1SModule.measure(mac, 1);
49
50// response
51notifyListener = DeviceEventEmitter.addListener(BG1SModule.Event_Notify, (event) => {
52 if (event.action === BG1SProfileModule.ACTION_STRIP_INSERTION_STATUS) {
53 // {"action": "action_strip_insertion_status", "describe": "strip in", "insertion_status": 1, "mac": "F65FF0CBA330", "type": "BG1S"}
54 console.log("strip in");
55
56 } else if (event.action === BG1SProfileModule.ACTION_GET_BLOOD) {
57 // {"action": "action_get_blood", "describe": "get blood", "mac": "F65FF0CBA330", "type": "BG1S"}
58 console.log("blood");
59
60 } else if (event.action === BG1SProfileModule.ACTION_MEASURE_RESULT) {
61 // {"action": "action_measure_result", "mac": "F65FF0CBA330", "measure_mode": 0, "measure_result": 0, "type": "BG1S"}
62 console.log(event[BG1SProfileModule.MEASURE_MODE]);
63 console.log(event[BG1SProfileModule.MEASURE_RESULT]);
64 }
65});
66```