summaryrefslogtreecommitdiff
path: root/libs/ihealth-sdk/doc/bp7s.md
diff options
context:
space:
mode:
Diffstat (limited to 'libs/ihealth-sdk/doc/bp7s.md')
-rw-r--r--libs/ihealth-sdk/doc/bp7s.md129
1 files changed, 129 insertions, 0 deletions
diff --git a/libs/ihealth-sdk/doc/bp7s.md b/libs/ihealth-sdk/doc/bp7s.md
new file mode 100644
index 0000000..178b5e1
--- /dev/null
+++ b/libs/ihealth-sdk/doc/bp7s.md
@@ -0,0 +1,129 @@
1# BP7S Workflow
2
3## Import BP7S Module
4
5```js
6import {
7 BP7SModule,
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(BP7SModule.Event_Notify, (event) => {
19 console.log(event);
20});
21
22// remove
23notifyListener.remove();
24```
25
26### get battery
27
28```js
29BP7SModule.getBattery(mac);
30
31notifyListener = DeviceEventEmitter.addListener(BP7SModule.Event_Notify, (event) => {
32 if (event.action === BPProfileModule.ACTION_BATTERY_BP) {
33 console.log(event[BPProfileModule.BATTERY_BP]);
34 }
35});
36```
37
38### set unit
39
40The API can change the unit of the bg5 display.
41
42```js
43// unit :0 mmHg;1 kPa
44BP7SModule.setUnit(mac, 1);
45
46// response
47notifyListener = DeviceEventEmitter.addListener(BP7SModule.Event_Notify, (event) => {
48 if (event.action === BPProfileModule.ACTION_SET_UNIT_SUCCESS_BP) {
49 console.log("set Unit");
50 }
51});
52```
53
54### get quantity of data stored in the bp5 device
55
56```js
57BP7SModule.getOfflineNum(mac);
58
59// response
60notifyListener = DeviceEventEmitter.addListener(BP7SModule.Event_Notify, (event) => {
61 if (e.action === BPProfileModule.ACTION_HISTORICAL_NUM_BP) {
62 console.log(event[BPProfileModule.HISTORICAL_NUM_BP]);
63 }
64});
65```
66
67### get data stored in the bp5 device
68
69```js
70BP7SModule.getOfflineData(mac);
71
72notifyListener = DeviceEventEmitter.addListener(BP7SModule.Event_Notify, (event) => {
73 if (e.action === BPProfileModule.ACTION_HISTORICAL_DATA_BP) {
74 let dataArray = event[BPProfileModule.HISTORICAL_DATA_BP];
75 if (dataArray == undefined) {
76 result = "There is not offline data in device"
77 }else {
78 for (let i = 0; i < dataArray.length; i++) {
79 let offlineData = dataArray[i];
80
81 console.log(offlineData[BPProfileModule.MEASUREMENT_DATE_BP]);
82 console.log(offlineData[BPProfileModule.HIGH_BLOOD_PRESSURE_BP]);
83 console.log(offlineData[BPProfileModule.LOW_BLOOD_PRESSURE_BP]);
84 console.log(offlineData[BPProfileModule.PULSE_BP]);
85 console.log(offlineData[BPProfileModule.MEASUREMENT_AHR_BP]);
86 console.log(offlineData[BPProfileModule.MEASUREMENT_HSD_BP]);
87 console.log(offlineData[BPProfileModule.DATAID]);
88 }
89 }
90 }
91});
92```
93
94### disconnect device
95
96```js
97BP7SModule.disConnect(mac);
98```
99
100### set angle range
101
102```js
103/**
104 * leftHigh the maximum measure angle of left hand, the maximum value must less than 90
105 * leftLow the minimum measure angle of left hand, the minimum value must more than 0, and less than leftUpper
106 * rightHigh the maximum measure angle of right hand, the maximum value must less than 90
107 * leftLow the minimum measure angle of right hand, the minimum value must more than 0, and less than rightUpper
108 */
109BP7SModule.angleSet(mac, 80, 30, 80, 30);
110
111// response
112notifyListener = DeviceEventEmitter.addListener(BP7SModule.Event_Notify, (event) => {
113 if (e.action === BPProfileModule.ACTION_SET_ANGLE_SUCCESS_BP) {
114 console.log("set angle");
115 }
116});
117```
118
119### get bp7s device information
120
121```js
122BP7SModule.getFunctionInfo(mac);
123```
124
125### get all connected devices
126
127```js
128BP7SModule.getAllConnectedDevices();
129``` \ No newline at end of file