summaryrefslogtreecommitdiff
path: root/libs/ihealth-sdk/doc/bp5.md
diff options
context:
space:
mode:
Diffstat (limited to 'libs/ihealth-sdk/doc/bp5.md')
-rw-r--r--libs/ihealth-sdk/doc/bp5.md161
1 files changed, 161 insertions, 0 deletions
diff --git a/libs/ihealth-sdk/doc/bp5.md b/libs/ihealth-sdk/doc/bp5.md
new file mode 100644
index 0000000..9829b05
--- /dev/null
+++ b/libs/ihealth-sdk/doc/bp5.md
@@ -0,0 +1,161 @@
1# BP5 Workflow
2
3## import BP5 module
4
5```js
6import {
7 BP5Module,
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(BP5Module.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
31BP5Module.startMeasure(mac);
32
33notifyListener = DeviceEventEmitter.addListener(BP5Module.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
65BP5Module.stopMeasure(mac);
66```
67
68### get battery
69
70```js
71BP5Module.getBattery(mac);
72
73notifyListener = DeviceEventEmitter.addListener(BP5Module.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
83BP5Module.enbleOffline(mac);
84```
85
86### disable offline mode
87
88```js
89BP5Module.disableOffline(mac);
90```
91
92### is enable offline mode
93
94```js
95BP5Module.isEnableOffline(mac);
96
97notifyListener = DeviceEventEmitter.addListener(BP5Module.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
107BP5Module.getOfflineNum(mac);
108
109notifyListener = DeviceEventEmitter.addListener(BP5Module.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
119BP5Module.getOfflineData(mac);
120
121notifyListener = DeviceEventEmitter.addListener(BP5Module.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
146BP5Module.disConnect(mac);
147```
148
149### get device information
150
151```js
152iHealthDeviceManagerModule.getDevicesIDPS(mac, (event) => {
153 console.info(event);
154})
155```
156
157### get all connected devices
158
159```js
160BP5Module.getAllConnectedDevices();
161```