summaryrefslogtreecommitdiff
path: root/libs/ihealth-sdk/doc/bp7.md
diff options
context:
space:
mode:
Diffstat (limited to 'libs/ihealth-sdk/doc/bp7.md')
-rw-r--r--libs/ihealth-sdk/doc/bp7.md175
1 files changed, 175 insertions, 0 deletions
diff --git a/libs/ihealth-sdk/doc/bp7.md b/libs/ihealth-sdk/doc/bp7.md
new file mode 100644
index 0000000..1e03e68
--- /dev/null
+++ b/libs/ihealth-sdk/doc/bp7.md
@@ -0,0 +1,175 @@
1# BP7 Workflow
2
3## import BP7 module
4
5```js
6import {
7 BP7Module,
8 BPProfileModule
9} from '@ihealth/ihealthlibrary-react-native';
10```
11
12## APIs
13
14### add and remove listener
15
16```js
17// add
18notifyListener = DeviceEventEmitter.addListener(BP7Module.Event_Notify, (event) => {
19 console.log(event);
20});
21
22// remove
23notifyListener.remove();
24```
25
26### start a measurement
27
28The API is asyn function. It will return message until finish measurement.
29
30```js
31// When you start a measurement, need call startMeasure function firstly, you will get angle of BP7
32// make sure your angle is below the 30 degree, then call conformAngle function, the BP7 will start a measurement.
33BP5Module.startMeasure(mac);
34
35BP5Module.conformAngle(mac);
36
37notifyListener = DeviceEventEmitter.addListener(BP5Module.Event_Notify, (event) => {
38 if (event.action === BPProfileModule.ACTION_ANGLE_BP) {
39 // {"which_arm":0,"value":22}
40 console.log(event[BPProfileModule.WHICH_ARM]);
41 console.log(event[BPProfileModule.ANGLE_BP]);
42
43 } else if (event.action === BPProfileModule.ACTION_ZOREING_BP) {
44 console.log("zero adjustment");
45
46 } else if (event.action === BPProfileModule.ACTION_ZOREOVER_BP) {
47 console.log("zero adjustment is done");
48
49 } else if (event.action === BPProfileModule.ACTION_ONLINE_PRESSURE_BP) {
50 // {"pressure":3}
51 console.log(event[BPProfileModule.BLOOD_PRESSURE_BP]);
52
53 } else if (event.action === BPProfileModule.ACTION_ONLINE_PULSEWAVE_BP) {
54 // {"pressure":31,"heartbeat":false,"wave":"[15,15,15,15,15,15,15,15]"}
55 console.log(event[BPProfileModule.BLOOD_PRESSURE_BP]);
56 console.log(event[BPProfileModule.FLAG_HEARTBEAT_BP]);
57 console.log(event[BPProfileModule.PULSEWAVE_BP]);
58
59 } else if (event.action === BPProfileModule.ACTION_ONLINE_RESULT_BP) {
60 // {"sys":122,"dia":87,"heartRate":75,"arrhythmia":false,"hsd":false,"dataID":"E3FC99C20A7FA7F7B7F8FC4B9DD059DF"}
61 console.log(event[BPProfileModule.HIGH_BLOOD_PRESSURE_BP]);
62 console.log(event[BPProfileModule.LOW_BLOOD_PRESSURE_BP]);
63 console.log(event[BPProfileModule.PULSE_BP]);
64 console.log(event[BPProfileModule.MEASUREMENT_AHR_BP]);
65 console.log(event[BPProfileModule.DATAID]);
66
67 } else if (event.action === BPProfileModule.ACTION_ERROR_BP) {
68 console.log(event[BPProfileModule.ERROR_NUM_BP]);
69 console.log(event[BPProfileModule.ERROR_DESCRIPTION_BP]);
70 }
71});
72```
73
74### cancel current measurement
75
76```js
77BP5Module.stopMeasure(mac);
78```
79
80### get battery
81
82```js
83BP5Module.getBattery(mac);
84
85notifyListener = DeviceEventEmitter.addListener(BP5Module.Event_Notify, (event) => {
86 if (event.action === BPProfileModule.ACTION_BATTERY_BP) {
87 console.log(event[BPProfileModule.BATTERY_BP]);
88 }
89});
90```
91
92### enable offline mode
93
94```js
95BP5Module.enbleOffline(mac);
96```
97
98### disable offline mode
99
100```js
101BP5Module.disableOffline(mac);
102```
103
104### is enable offline mode
105
106```js
107BP5Module.isEnableOffline(mac);
108
109notifyListener = DeviceEventEmitter.addListener(BP5Module.Event_Notify, (event) => {
110 if (e.action === BPProfileModule.ACTION_IS_ENABLE_OFFLINE) {
111 console.log(event[BPProfileModule.IS_ENABLE_OFFLINE]);
112 }
113});
114```
115
116### get quantity of data stored in the bp5 device
117
118```js
119BP5Module.getOfflineNum(mac);
120
121notifyListener = DeviceEventEmitter.addListener(BP5Module.Event_Notify, (event) => {
122 if (e.action === BPProfileModule.ACTION_HISTORICAL_NUM_BP) {
123 // {"offlinenum":2}
124 console.log(event[BPProfileModule.HISTORICAL_NUM_BP]);
125 }
126});
127```
128
129### get data stored in the bp5 device
130
131```js
132BP5Module.getOfflineData(mac);
133
134notifyListener = DeviceEventEmitter.addListener(BP5Module.Event_Notify, (event) => {
135 // {"data":[{"time":"2009-01-02 15:12:00","sys":120,"dia":72,"heartRate":71,"arrhythmia":false,"hsd":false,"dataID":"F77B50204315322FAB3B31548E6CDC4E"},{"time":"2009-01-02 15:13:00","sys":115,"dia":73,"heartRate":68,"arrhythmia":false,"hsd":false,"dataID":"F75BC53C3E43ACC3BA3DE1343B317398"}]}
136 if (event.action === BPProfileModule.ACTION_HISTORICAL_DATA_BP) {
137 let dataArray = event[BPProfileModule.HISTORICAL_DATA_BP];
138 if (dataArray == undefined) {
139 result = "There is not offline data in device"
140 }else {
141 for (let i = 0; i < dataArray.length; i++) {
142 let offlineData = dataArray[i];
143
144 console.log(offlineData[BPProfileModule.MEASUREMENT_DATE_BP]);
145 console.log(offlineData[BPProfileModule.HIGH_BLOOD_PRESSURE_BP]);
146 console.log(offlineData[BPProfileModule.LOW_BLOOD_PRESSURE_BP]);
147 console.log(offlineData[BPProfileModule.PULSE_BP]);
148 console.log(offlineData[BPProfileModule.MEASUREMENT_AHR_BP]);
149 console.log(offlineData[BPProfileModule.MEASUREMENT_HSD_BP]);
150 console.log(offlineData[BPProfileModule.DATAID]);
151 }
152 }
153 }
154});
155```
156
157### disconnect device
158
159```js
160BP5Module.disConnect(mac);
161```
162
163### get device information
164
165```js
166iHealthDeviceManagerModule.getDevicesIDPS(mac, (event) => {
167 console.info(event);
168})
169```
170
171### get all connected devices
172
173```js
174BP5Module.getAllConnectedDevices();
175```