import {
BP7SModule,
BPProfileModule
} from '@ihealth/ihealthlibrary-react-native';
// add
notifyListener = DeviceEventEmitter.addListener(BP7SModule.Event_Notify, (event) => {
console.log(event);
});
// remove
notifyListener.remove();
BP7SModule.getBattery(mac);
notifyListener = DeviceEventEmitter.addListener(BP7SModule.Event_Notify, (event) => {
if (event.action === BPProfileModule.ACTION_BATTERY_BP) {
console.log(event[BPProfileModule.BATTERY_BP]);
}
});
The API can change the unit of the bg5 display.
// unit :0 mmHg;1 kPa
BP7SModule.setUnit(mac, 1);
// response
notifyListener = DeviceEventEmitter.addListener(BP7SModule.Event_Notify, (event) => {
if (event.action === BPProfileModule.ACTION_SET_UNIT_SUCCESS_BP) {
console.log("set Unit");
}
});
BP7SModule.getOfflineNum(mac);
// response
notifyListener = DeviceEventEmitter.addListener(BP7SModule.Event_Notify, (event) => {
if (e.action === BPProfileModule.ACTION_HISTORICAL_NUM_BP) {
console.log(event[BPProfileModule.HISTORICAL_NUM_BP]);
}
});
BP7SModule.getOfflineData(mac);
notifyListener = DeviceEventEmitter.addListener(BP7SModule.Event_Notify, (event) => {
if (e.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]);
}
}
}
});
BP7SModule.disConnect(mac);
/**
* leftHigh the maximum measure angle of left hand, the maximum value must less than 90
* leftLow the minimum measure angle of left hand, the minimum value must more than 0, and less than leftUpper
* rightHigh the maximum measure angle of right hand, the maximum value must less than 90
* leftLow the minimum measure angle of right hand, the minimum value must more than 0, and less than rightUpper
*/
BP7SModule.angleSet(mac, 80, 30, 80, 30);
// response
notifyListener = DeviceEventEmitter.addListener(BP7SModule.Event_Notify, (event) => {
if (e.action === BPProfileModule.ACTION_SET_ANGLE_SUCCESS_BP) {
console.log("set angle");
}
});
BP7SModule.getFunctionInfo(mac);
BP7SModule.getAllConnectedDevices();