BG5
WorkFlow
Scan and connect BG5 blood pressure monitor.
BG5 only support online measurement.
Connection to device
1.Listen to device notify
private iHealthDevicesCallback miHealthDevicesCallback = new iHealthDevicesCallback() {
@Override
public void onScanDevice(String mac, String deviceType, int rssi, Map manufactorData) { }
@Override
public void onDeviceConnectionStateChange(String mac, String deviceType, int status, int errorID, Map manufactorData){ }
@Override
public void onScanError(String reason, long latency) { }
@Override
public void onScanFinish() { }
@Override
public void onDeviceNotify(String mac, String deviceType,
String action, String message) { }
}
int callbackId = iHealthDevicesManager.getInstance().registerClientCallback(miHealthDevicesCallback);
iHealthDevicesManager.getInstance().addCallbackFilterForDeviceType(callbackId, iHealthDevicesManager.TYPE_BG5);
iHealthDevicesManager.getInstance().addCallbackFilterForAddress(callbackId, String... macs)
2.Scan for BG5 devices
iHealthDevicesManager.getInstance().startDiscovery(DiscoveryTypeEnum.BG5);
3.Connect to BG5 devices
iHealthDevicesManager.getInstance().connectDevice("", mac, iHealthDevicesManager.TYPE_BG5)
Bg5Control control = iHealthDevicesManager.getInstance().getBg5Control(mDeviceMac);
API reference
Keep in connection
Bg5Control control = iHealthDevicesManager.getInstance().getBg5Control(mDeviceMac);
control.holdLink();
// Return value
private iHealthDevicesCallback miHealthDevicesCallback = new iHealthDevicesCallback() {
@Override
public void onDeviceNotify(String mac, String deviceType, String action, String message) {
if (Bg5Profile.ACTION_KEEP_LINK.equals(action)) {
}
}
}
Set time to BG5 device
Bg5Control control = iHealthDevicesManager.getInstance().getBg5Control(mDeviceMac);
control.startMeasure();
// Return value
private iHealthDevicesCallback miHealthDevicesCallback = new iHealthDevicesCallback() {
@Override
public void onDeviceNotify(String mac, String deviceType, String action, String message) {
if (Bg5Profile.ACTION_SET_TIME.equals(action)) {
}
}
}
Set unit to Bg5 device
Bg5Control control = iHealthDevicesManager.getInstance().getBg5Control(mDeviceMac);
control.setUnit(int type);
// Return value
private iHealthDevicesCallback miHealthDevicesCallback = new iHealthDevicesCallback() {
@Override
public void onDeviceNotify(String mac, String deviceType, String action, String message) {
if (Bg5Profile.ACTION_SET_UNIT.equals(action)) {
}
}
}
Get the Bg5 battery status
Bg5Control control = iHealthDevicesManager.getInstance().getBg5Control(mDeviceMac);
control.getBattery();
// Return value
private iHealthDevicesCallback miHealthDevicesCallback = new iHealthDevicesCallback() {
@Override
public void onDeviceNotify(String mac, String deviceType, String action, String message) {
if (Bg5Profile.ACTION_BATTERY_BG.equals(action)) {
try {
JSONObject obj = new JSONObject(message);
int battery = obj.getInt((Bg5Profile.BATTERY_BG);
} catch (JSONException e) {
e.printStackTrace();
}
}
}
}
Start On-line measurement
Bg5Control control = iHealthDevicesManager.getInstance().getBg5Control(mDeviceMac);
/**
* @param type 1: test with blood;
* 2: test with control liquid <br/>
* <b>Range:</b> 1, 2
*/
control.startMeasure(int type);
// Return value
private iHealthDevicesCallback miHealthDevicesCallback = new iHealthDevicesCallback() {
@Override
public void onDeviceNotify(String mac, String deviceType, String action, String message) {
if (Bg5Profile.ACTION_BATTERY_BG.equals(action)) {
try {
JSONObject obj = new JSONObject(message);
int battery = obj.getInt((Bg5Profile.BATTERY_BG);
} catch (JSONException e) {
e.printStackTrace();
}
}
}
}
Get historical data
Bg5Control control = iHealthDevicesManager.getInstance().getBg5Control(mDeviceMac);
control.getDeviceInfo();
// Return value
private iHealthDevicesCallback miHealthDevicesCallback = new iHealthDevicesCallback() {
@Override
public void onDeviceNotify(String mac, String deviceType, String action, String message) {
if (BpProfile.ACTION_INTERRUPTED_BP.equals(action)) {
try {
JSONObject obj = new JSONObject(message);
int battery = obj.getInt((Bg5Profile.BATTERY_BG);
} catch (JSONException e) {
e.printStackTrace();
}
}
}
}
Delete historical data
Bg5Control control = iHealthDevicesManager.getInstance().getBg5Control(mDeviceMac);
control.getDeviceInfo();
// Return value
private iHealthDevicesCallback miHealthDevicesCallback = new iHealthDevicesCallback() {
@Override
public void onDeviceNotify(String mac, String deviceType, String action, String message) {
if (BpProfile.ACTION_INTERRUPTED_BP.equals(action)) {
try {
JSONObject obj = new JSONObject(message);
int battery = obj.getInt((Bg5Profile.BATTERY_BG);
} catch (JSONException e) {
e.printStackTrace();
}
}
}
}
Set bottle info to Bg5 device
Bg5Control control = iHealthDevicesManager.getInstance().getBg5Control(mDeviceMac);
control.setBottleMessageWithInfo(int stripType, int measureType, String QRCode, int stripNum, String overDate);
// Return value
private iHealthDevicesCallback miHealthDevicesCallback = new iHealthDevicesCallback() {
@Override
public void onDeviceNotify(String mac, String deviceType, String action, String message) {
if (BpProfile.ACTION_INTERRUPTED_BP.equals(action)) {
try {
JSONObject obj = new JSONObject(message);
int battery = obj.getInt((Bg5Profile.BATTERY_BG);
} catch (JSONException e) {
e.printStackTrace();
}
}
}
}
Send bottleId to current BG5 device
Bg5Control control = iHealthDevicesManager.getInstance().getBg5Control(mDeviceMac);
control.setBottleMessageWithInfo(int stripType, int measureType, String QRCode, int stripNum, String overDate);
// Return value
private iHealthDevicesCallback miHealthDevicesCallback = new iHealthDevicesCallback() {
@Override
public void onDeviceNotify(String mac, String deviceType, String action, String message) {
if (BpProfile.ACTION_INTERRUPTED_BP.equals(action)) {
try {
JSONObject obj = new JSONObject(message);
int battery = obj.getInt((Bg5Profile.BATTERY_BG);
} catch (JSONException e) {
e.printStackTrace();
}
}
}
}
Get bottleId from current BG5 device
Bg5Control control = iHealthDevicesManager.getInstance().getBg5Control(mDeviceMac);
control.setBottleMessageWithInfo(int stripType, int measureType, String QRCode, int stripNum, String overDate);
// Return value
private iHealthDevicesCallback miHealthDevicesCallback = new iHealthDevicesCallback() {
@Override
public void onDeviceNotify(String mac, String deviceType, String action, String message) {
if (BpProfile.ACTION_INTERRUPTED_BP.equals(action)) {
try {
JSONObject obj = new JSONObject(message);
int battery = obj.getInt((Bg5Profile.BATTERY_BG);
} catch (JSONException e) {
e.printStackTrace();
}
}
}
}
Parse bottle Info of the QRCode
Bg5Control.getBottleInfoFromQR(String QRCode);
// Return value
private iHealthDevicesCallback miHealthDevicesCallback = new iHealthDevicesCallback() {
@Override
public void onDeviceNotify(String mac, String deviceType, String action, String message) {
if (BpProfile.ACTION_INTERRUPTED_BP.equals(action)) {
try {
JSONObject obj = new JSONObject(message);
int battery = obj.getInt((Bg5Profile.BATTERY_BG);
} catch (JSONException e) {
e.printStackTrace();
}
}
}
}