diff options
Diffstat (limited to 'libs/ihealth-sdk/doc/bp3l.md')
| -rw-r--r-- | libs/ihealth-sdk/doc/bp3l.md | 161 |
1 files changed, 161 insertions, 0 deletions
diff --git a/libs/ihealth-sdk/doc/bp3l.md b/libs/ihealth-sdk/doc/bp3l.md new file mode 100644 index 0000000..37e51ed --- /dev/null +++ b/libs/ihealth-sdk/doc/bp3l.md | |||
| @@ -0,0 +1,161 @@ | |||
| 1 | # BP3L Workflow | ||
| 2 | |||
| 3 | ## import BP3L module | ||
| 4 | |||
| 5 | ```js | ||
| 6 | import { | ||
| 7 | BP3LModule, | ||
| 8 | BPProfileModule | ||
| 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(BP3LModule.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 | BP3LModule.startMeasure(mac); | ||
| 32 | |||
| 33 | notifyListener = DeviceEventEmitter.addListener(BP3LModule.Event_Notify, (event) => { | ||
| 34 | if (event.action === BPProfileModule.ACTION_ZOREING_BP) { | ||
| 35 | console.log("zero adjustment"); | ||
| 36 | |||
| 37 | } else if (event.action === BPProfileModule.ACTION_ZOREOVER_BP) { | ||
| 38 | console.log("zero adjustment is done"); | ||
| 39 | |||
| 40 | } else if (event.action === BPProfileModule.ACTION_ONLINE_PRESSURE_BP) { | ||
| 41 | console.log(event[BPProfileModule.BLOOD_PRESSURE_BP]); | ||
| 42 | |||
| 43 | } else if (event.action === BPProfileModule.ACTION_ONLINE_PULSEWAVE_BP) { | ||
| 44 | console.log(event[BPProfileModule.BLOOD_PRESSURE_BP]); | ||
| 45 | console.log(event[BPProfileModule.FLAG_HEARTBEAT_BP]); | ||
| 46 | console.log(event[BPProfileModule.PULSEWAVE_BP]); | ||
| 47 | |||
| 48 | } else if (event.action === BPProfileModule.ACTION_ONLINE_RESULT_BP) { | ||
| 49 | console.log(event[BPProfileModule.HIGH_BLOOD_PRESSURE_BP]); | ||
| 50 | console.log(event[BPProfileModule.LOW_BLOOD_PRESSURE_BP]); | ||
| 51 | console.log(event[BPProfileModule.PULSE_BP]); | ||
| 52 | console.log(event[BPProfileModule.MEASUREMENT_AHR_BP]); | ||
| 53 | console.log(event[BPProfileModule.DATAID]); | ||
| 54 | |||
| 55 | } else if (event.action === BPProfileModule.ACTION_ERROR_BP) { | ||
| 56 | console.log(event[BPProfileModule.ERROR_NUM_BP]); | ||
| 57 | console.log(event[BPProfileModule.ERROR_DESCRIPTION_BP]); | ||
| 58 | } | ||
| 59 | }); | ||
| 60 | ``` | ||
| 61 | |||
| 62 | ### cancel current measurement | ||
| 63 | |||
| 64 | ```js | ||
| 65 | BP3LModule.stopMeasure(mac); | ||
| 66 | ``` | ||
| 67 | |||
| 68 | ### get battery | ||
| 69 | |||
| 70 | ```js | ||
| 71 | BP3LModule.getBattery(mac); | ||
| 72 | |||
| 73 | notifyListener = DeviceEventEmitter.addListener(BP3LModule.Event_Notify, (event) => { | ||
| 74 | if (event.action === BPProfileModule.ACTION_BATTERY_BP) { | ||
| 75 | console.log(event[BPProfileModule.BATTERY_BP]); | ||
| 76 | } | ||
| 77 | }); | ||
| 78 | ``` | ||
| 79 | |||
| 80 | ### enable offline mode | ||
| 81 | |||
| 82 | ```js | ||
| 83 | BP3LModule.enbleOffline(mac); | ||
| 84 | ``` | ||
| 85 | |||
| 86 | ### disable offline mode | ||
| 87 | |||
| 88 | ```js | ||
| 89 | BP3LModule.disableOffline(mac); | ||
| 90 | ``` | ||
| 91 | |||
| 92 | ### is enable offline mode | ||
| 93 | |||
| 94 | ```js | ||
| 95 | BP3LModule.isEnableOffline(mac); | ||
| 96 | |||
| 97 | notifyListener = DeviceEventEmitter.addListener(BP3LModule.Event_Notify, (event) => { | ||
| 98 | if (e.action === BPProfileModule.ACTION_IS_ENABLE_OFFLINE) { | ||
| 99 | console.log(event[BPProfileModule.IS_ENABLE_OFFLINE]); | ||
| 100 | } | ||
| 101 | }); | ||
| 102 | ``` | ||
| 103 | |||
| 104 | ### get quantity of data stored in the bp5 device | ||
| 105 | |||
| 106 | ```js | ||
| 107 | BP3LModule.getOfflineNum(mac); | ||
| 108 | |||
| 109 | notifyListener = DeviceEventEmitter.addListener(BP3LModule.Event_Notify, (event) => { | ||
| 110 | if (e.action === BPProfileModule.ACTION_HISTORICAL_NUM_BP) { | ||
| 111 | console.log(event[BPProfileModule.HISTORICAL_NUM_BP]); | ||
| 112 | } | ||
| 113 | }); | ||
| 114 | ``` | ||
| 115 | |||
| 116 | ### get data stored in the bp5 device | ||
| 117 | |||
| 118 | ```js | ||
| 119 | BP3LModule.getOfflineData(mac); | ||
| 120 | |||
| 121 | notifyListener = DeviceEventEmitter.addListener(BP3LModule.Event_Notify, (event) => { | ||
| 122 | if (event.action === BPProfileModule.ACTION_HISTORICAL_DATA_BP) { | ||
| 123 | let dataArray = event[BPProfileModule.HISTORICAL_DATA_BP]; | ||
| 124 | if (dataArray == undefined) { | ||
| 125 | result = "There is not offline data in device" | ||
| 126 | }else { | ||
| 127 | for (let i = 0; i < dataArray.length; i++) { | ||
| 128 | let offlineData = dataArray[i]; | ||
| 129 | |||
| 130 | console.log(offlineData[BPProfileModule.MEASUREMENT_DATE_BP]); | ||
| 131 | console.log(offlineData[BPProfileModule.HIGH_BLOOD_PRESSURE_BP]); | ||
| 132 | console.log(offlineData[BPProfileModule.LOW_BLOOD_PRESSURE_BP]); | ||
| 133 | console.log(offlineData[BPProfileModule.PULSE_BP]); | ||
| 134 | console.log(offlineData[BPProfileModule.MEASUREMENT_AHR_BP]); | ||
| 135 | console.log(offlineData[BPProfileModule.MEASUREMENT_HSD_BP]); | ||
| 136 | console.log(offlineData[BPProfileModule.DATAID]); | ||
| 137 | } | ||
| 138 | } | ||
| 139 | } | ||
| 140 | }); | ||
| 141 | ``` | ||
| 142 | |||
| 143 | ### disconnect device | ||
| 144 | |||
| 145 | ```js | ||
| 146 | BP3LModule.disConnect(mac); | ||
| 147 | ``` | ||
| 148 | |||
| 149 | ### get device information | ||
| 150 | |||
| 151 | ```js | ||
| 152 | iHealthDeviceManagerModule.getDevicesIDPS(mac, (event) => { | ||
| 153 | console.info(event); | ||
| 154 | }) | ||
| 155 | ``` | ||
| 156 | |||
| 157 | ### get all connected devices | ||
| 158 | |||
| 159 | ```js | ||
| 160 | BP3LModule.getAllConnectedDevices(); | ||
| 161 | ``` | ||
