blob: f6e8bad91559833dc69fe67963f7efd95b928673 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
# KN550 Workflow
## import KN550 module
```js
import {
BP550BTModule,
BPProfileModule
} from '@ihealth/ihealthlibrary-react-native';
```
## APIs
### add and remove listener
```js
// add
notifyListener = DeviceEventEmitter.addListener(BP550BTModule.Event_Notify, (event) => {
console.log(event);
});
// remove
notifyListener.remove();
```
### get battery
```js
BP550BTModule.getBattery(mac);
notifyListener = DeviceEventEmitter.addListener(BP550BTModule.Event_Notify, (event) => {
if (event.action === BPProfileModule.ACTION_BATTERY_BP) {
console.log(event[BPProfileModule.BATTERY_BP]);
}
});
```
### get KN550 function
```js
BP550BTModule.getFunctionInfo(mac);
notifyListener = DeviceEventEmitter.addListener(BP550BTModule.Event_Notify, (event) => {
if (event.action === BPProfileModule.ACTION_FUNCTION_INFORMATION_BP) {
console.log(event[BPProfileModule.FUNCTION_IS_UPAIR_MEASURE]);
console.log(event[BPProfileModule.FUNCTION_IS_ARM_MEASURE]);
console.log(event[BPProfileModule.FUNCTION_HAVE_ANGLE_SENSOR]);
console.log(event[BPProfileModule.FUNCTION_HAVE_OFFLINE]);
console.log(event[BPProfileModule.FUNCTION_HAVE_HSD]);
console.log(event[BPProfileModule.FUNCTION_HAVE_ANGLE_SETTING]);
console.log(event[BPProfileModule.FUNCTION_IS_MULTI_UPLOAD]);
console.log(event[BPProfileModule.FUNCTION_HAVE_SELF_UPDATE]);
}
});
```
### get quantity of data stored in the KN550 device
```js
BP550BTModule.getOfflineNum(mac);
notifyListener = DeviceEventEmitter.addListener(BP550BTModule.Event_Notify, (event) => {
if (e.action === BPProfileModule.ACTION_HISTORICAL_NUM_BP) {
console.log(event[BPProfileModule.HISTORICAL_NUM_BP]);
}
});
```
### get data stored in the KN550 device
```js
BP550BTModule.getOfflineData(mac);
notifyListener = DeviceEventEmitter.addListener(BP550BTModule.Event_Notify, (event) => {
if (event.action === BPProfileModule.ACTION_HISTORICAL_DATA_BP) {
let dataArray = event[BPProfileModule.HISTORICAL_DATA_BP];
if (dataArray == undefined) {
result = "There is not offline data in device"
}else {
for (let i = 0; i < dataArray.length; i++) {
let offlineData = dataArray[i];
console.log(offlineData[BPProfileModule.MEASUREMENT_DATE_BP]);
console.log(offlineData[BPProfileModule.HIGH_BLOOD_PRESSURE_BP]);
console.log(offlineData[BPProfileModule.LOW_BLOOD_PRESSURE_BP]);
console.log(offlineData[BPProfileModule.PULSE_BP]);
console.log(offlineData[BPProfileModule.MEASUREMENT_AHR_BP]);
console.log(offlineData[BPProfileModule.MEASUREMENT_HSD_BP]);
console.log(offlineData[BPProfileModule.DATAID]);
}
}
}
});
```
### disconnect device
```js
BP550BTModule.disconnect(mac);
```
### get device information
```js
iHealthDeviceManagerModule.getDevicesIDPS(mac, (event) => {
console.info(event);
})
```
### get all connected devices
```js
BP550BTModule.getAllConnectedDevices();
```
|