diff options
Diffstat (limited to 'libs/ihealth-sdk/doc/po3.md')
| -rw-r--r-- | libs/ihealth-sdk/doc/po3.md | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/libs/ihealth-sdk/doc/po3.md b/libs/ihealth-sdk/doc/po3.md new file mode 100644 index 0000000..1a11df1 --- /dev/null +++ b/libs/ihealth-sdk/doc/po3.md | |||
| @@ -0,0 +1,87 @@ | |||
| 1 | # PO3 Workflow | ||
| 2 | |||
| 3 | ## Import PO3 Module | ||
| 4 | |||
| 5 | ```js | ||
| 6 | import { | ||
| 7 | PO3Module, | ||
| 8 | POProfileModule | ||
| 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(PO3Module.Event_Notify, (event) => { | ||
| 19 | console.log(event); | ||
| 20 | }); | ||
| 21 | |||
| 22 | // remove | ||
| 23 | notifyListener.remove(); | ||
| 24 | ``` | ||
| 25 | |||
| 26 | ### get battery | ||
| 27 | |||
| 28 | ```js | ||
| 29 | PO3Module.getBattery(mac); | ||
| 30 | |||
| 31 | // response | ||
| 32 | notifyListener = DeviceEventEmitter.addListener(PO3Module.Event_Notify, (event) => { | ||
| 33 | if (event.action === POProfileModule.ACTION_BATTERY_PO) { | ||
| 34 | console.log(event[POProfileModule.BATTERY_PO]); | ||
| 35 | } | ||
| 36 | }); | ||
| 37 | ``` | ||
| 38 | |||
| 39 | ### start a measurement with app | ||
| 40 | |||
| 41 | ```js | ||
| 42 | PO3Module.startMeasure(mac); | ||
| 43 | |||
| 44 | // response | ||
| 45 | notifyListener = DeviceEventEmitter.addListener(PO3Module.Event_Notify, (event) => { | ||
| 46 | if (event.action === POProfileModule.ACTION_LIVEDA_PO) { | ||
| 47 | console.log(event[POProfileModule.PULSE_WAVE_PO]); | ||
| 48 | console.log(event[POProfileModule.PI_PO]); | ||
| 49 | console.log(event[POProfileModule.PULSE_STRENGTH_PO]); | ||
| 50 | console.log(event[POProfileModule.BLOOD_OXYGEN_PO]); | ||
| 51 | console.log(event[POProfileModule.PULSE_RATE_PO]); | ||
| 52 | } else if(){ | ||
| 53 | // final result | ||
| 54 | console.log(event[POProfileModule.PULSE_WAVE_PO]); | ||
| 55 | console.log(event[POProfileModule]); | ||
| 56 | console.log(event[POProfileModule.PI_PO]); | ||
| 57 | console.log(event[POProfileModule.PULSE_STRENGTH_PO]); | ||
| 58 | console.log(event[POProfileModule.BLOOD_OXYGEN_PO]); | ||
| 59 | console.log(event[POProfileModule.PULSE_RATE_PO]); | ||
| 60 | } | ||
| 61 | }); | ||
| 62 | ``` | ||
| 63 | |||
| 64 | ### get data stored in the po3 device | ||
| 65 | |||
| 66 | ```js | ||
| 67 | PO3Module.getHistoryData(mac); | ||
| 68 | |||
| 69 | // response | ||
| 70 | notifyListener = DeviceEventEmitter.addListener(PO3Module.Event_Notify, (event) => { | ||
| 71 | if (event.action === POProfileModule.ACTION_NO_OFFLINEDATA_PO) { | ||
| 72 | console.log("There is no more data stored in the po3 device."); | ||
| 73 | } else if (event.action === POProfileModule.ACTION_OFFLINEDATA_PO) { | ||
| 74 | const dataArray = event[POProfileModule.OFFLINEDATA_PO]; | ||
| 75 | for (let i = 0; i < dataArray.length; i++) { | ||
| 76 | let offlineData = dataArray[i]; | ||
| 77 | console.log(offlineData[POProfileModule.MEASUREMENT_DATE_BP]); | ||
| 78 | console.log(offlineData[POProfileModule.HIGH_BLOOD_PRESSURE_BP]); | ||
| 79 | console.log(offlineData[POProfileModule.LOW_BLOOD_PRESSURE_BP]); | ||
| 80 | console.log(offlineData[POProfileModule.PULSE_BP]); | ||
| 81 | console.log(offlineData[POProfileModule.MEASUREMENT_AHR_BP]); | ||
| 82 | console.log(offlineData[POProfileModule.MEASUREMENT_HSD_BP]); | ||
| 83 | console.log(offlineData[POProfileModule.DATAID]); | ||
| 84 | } | ||
| 85 | } | ||
| 86 | }); | ||
| 87 | ``` \ No newline at end of file | ||
