diff options
| author | hc <haocheng.xie@respiree.com> | 2026-04-13 15:17:52 +0800 |
|---|---|---|
| committer | hc <haocheng.xie@respiree.com> | 2026-04-13 15:17:52 +0800 |
| commit | d6d9a09d505d11148599a95a5be3e1351edbe0ac (patch) | |
| tree | a5f5891983d1ff207e99f683a5e151519cef4980 /libs/ihealth-sdk/doc/hs4s.md | |
| parent | e4fb9966e762852bf17f21c8406501d42fae0b61 (diff) | |
Local iHealth SDK, device detail screen, iOS event fixes
Diffstat (limited to 'libs/ihealth-sdk/doc/hs4s.md')
| -rw-r--r-- | libs/ihealth-sdk/doc/hs4s.md | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/libs/ihealth-sdk/doc/hs4s.md b/libs/ihealth-sdk/doc/hs4s.md new file mode 100644 index 0000000..5cc7446 --- /dev/null +++ b/libs/ihealth-sdk/doc/hs4s.md | |||
| @@ -0,0 +1,84 @@ | |||
| 1 | # HS4S Workflow | ||
| 2 | |||
| 3 | ## import HS4S module | ||
| 4 | |||
| 5 | ```js | ||
| 6 | import { | ||
| 7 | HS4SModule, | ||
| 8 | HSProfileModule | ||
| 9 | } from '@ihealth/ihealthlibrary-react-native'; | ||
| 10 | ``` | ||
| 11 | |||
| 12 | ## APIs | ||
| 13 | |||
| 14 | ### add and remove listener | ||
| 15 | |||
| 16 | ```js | ||
| 17 | // add | ||
| 18 | notifyListener = DeviceEventEmitter.addListener(HS4SModule.Event_Notify, (event) => { | ||
| 19 | console.log(event); | ||
| 20 | }); | ||
| 21 | |||
| 22 | // remove | ||
| 23 | notifyListener.remove(); | ||
| 24 | ``` | ||
| 25 | |||
| 26 | ### start a measurement | ||
| 27 | |||
| 28 | The API is asyn function. It will return message until finish measurement. | ||
| 29 | |||
| 30 | ```js | ||
| 31 | HS4SModule.startMeasure(mac); | ||
| 32 | |||
| 33 | notifyListener = DeviceEventEmitter.addListener(HS4SModule.Event_Notify, (event) => { | ||
| 34 | if (event.action === HSProfileModule.ACTION_ONLINE_RESULT_HS) { | ||
| 35 | console.log(event[HSProfileModule.DATAID]); | ||
| 36 | console.log(event[HSProfileModule.WEIGHT_HS]); | ||
| 37 | console.log(event[HSProfileModule.FAT_HS]); | ||
| 38 | console.log(event[HSProfileModule.WATER_HS]); | ||
| 39 | console.log(event[HSProfileModule.MUSCLE_HS]); | ||
| 40 | console.log(event[HSProfileModule.SKELETON_HS]); | ||
| 41 | console.log(event[HSProfileModule.FATELEVEL_HS]); | ||
| 42 | console.log(event[HSProfileModule.DCI_HS]); | ||
| 43 | } | ||
| 44 | }); | ||
| 45 | ``` | ||
| 46 | |||
| 47 | ### get data stored in the HS4S device | ||
| 48 | |||
| 49 | ```js | ||
| 50 | HS4SModule.getOfflineData(mac); | ||
| 51 | |||
| 52 | notifyListener = DeviceEventEmitter.addListener(HS4SModule.Event_Notify, (event) => { | ||
| 53 | if (event.action === HSProfileModule.ACTION_HISTORICAL_DATA_HS) { | ||
| 54 | let dataArray = event[HSProfileModule.HISTORDATA_HS]; | ||
| 55 | if (dataArray == undefined) { | ||
| 56 | result = "There is not offline data in device" | ||
| 57 | }else { | ||
| 58 | for (let i = 0; i < dataArray.length; i++) { | ||
| 59 | let offlineData = dataArray[i]; | ||
| 60 | console.log(offlineData[HSProfileModule.MEASUREMENT_DATE_HS]); | ||
| 61 | console.log(offlineData[HSProfileModule.WEIGHT_HS]); | ||
| 62 | console.log(offlineData[HSProfileModule.FAT_HS]); | ||
| 63 | console.log(offlineData[HSProfileModule.WATER_HS]); | ||
| 64 | console.log(offlineData[HSProfileModule.MUSCLE_HS]); | ||
| 65 | console.log(offlineData[HSProfileModule.SKELETON_HS]); | ||
| 66 | console.log(offlineData[HSProfileModule.FATELEVEL_HS]); | ||
| 67 | console.log(offlineData[HSProfileModule.DATAID]); | ||
| 68 | } | ||
| 69 | } | ||
| 70 | } | ||
| 71 | }); | ||
| 72 | ``` | ||
| 73 | |||
| 74 | ### disconnect device | ||
| 75 | |||
| 76 | ```js | ||
| 77 | BP3LModule.disConnect(mac); | ||
| 78 | ``` | ||
| 79 | |||
| 80 | ### get all connected devices | ||
| 81 | |||
| 82 | ```js | ||
| 83 | BP3LModule.getAllConnectedDevices(); | ||
| 84 | ``` | ||
