diff options
Diffstat (limited to 'libs/ihealth-sdk/doc/ecg.md')
| -rw-r--r-- | libs/ihealth-sdk/doc/ecg.md | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/libs/ihealth-sdk/doc/ecg.md b/libs/ihealth-sdk/doc/ecg.md new file mode 100644 index 0000000..2dbba6a --- /dev/null +++ b/libs/ihealth-sdk/doc/ecg.md | |||
| @@ -0,0 +1,69 @@ | |||
| 1 | # ECG3 Workflow | ||
| 2 | |||
| 3 | ## import ECG3 module | ||
| 4 | |||
| 5 | ```js | ||
| 6 | import { | ||
| 7 | ECGModule, | ||
| 8 | ECGProfileModule | ||
| 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(ECGModule.Event_Notify, (event) => { | ||
| 19 | console.log(event); | ||
| 20 | }); | ||
| 21 | |||
| 22 | // remove | ||
| 23 | notifyListener.remove(); | ||
| 24 | ``` | ||
| 25 | |||
| 26 | ### get all connected devices | ||
| 27 | |||
| 28 | ```js | ||
| 29 | ECGModule.getAllConnectedDevices(); | ||
| 30 | ``` | ||
| 31 | |||
| 32 | ### start a measurement | ||
| 33 | |||
| 34 | ```js | ||
| 35 | ECGModule.startMeasure(mac); | ||
| 36 | |||
| 37 | // response | ||
| 38 | notifyListener = DeviceEventEmitter.addListener(ECGModule.Event_Notify, (event) => { | ||
| 39 | if (event.action === ECGModule.ACTION_ELECTRODE_STATUS) { | ||
| 40 | console.log(event[ECGProfileModule.ELECTRODE_STATUS]); | ||
| 41 | console.log(event[ECGProfileModule.ERROR_DESCRIPTION_ECG]); | ||
| 42 | } | ||
| 43 | }); | ||
| 44 | ``` | ||
| 45 | |||
| 46 | ### cancel a measurement | ||
| 47 | |||
| 48 | ```js | ||
| 49 | ECGModule.stopMeasure(mac); | ||
| 50 | ``` | ||
| 51 | |||
| 52 | ### get battery | ||
| 53 | |||
| 54 | ```js | ||
| 55 | ECGModule.getBattery(mac); | ||
| 56 | |||
| 57 | // response | ||
| 58 | notifyListener = DeviceEventEmitter.addListener(ECGModule.Event_Notify, (event) => { | ||
| 59 | if (event.action === ECGModule.ACTION_BATTERY_ECG) { | ||
| 60 | console.log(event[ECGProfileModule.BATTERY_ECG]) | ||
| 61 | } | ||
| 62 | }); | ||
| 63 | ``` | ||
| 64 | |||
| 65 | ### set current time to device | ||
| 66 | |||
| 67 | ```js | ||
| 68 | ECGModule.sysTime(mac); | ||
| 69 | ``` | ||
