瀏覽代碼

add version

master
陈福行 4 年之前
父節點
當前提交
2e6aebd867
共有 1 個文件被更改,包括 16 次插入1 次删除
  1. 16
    1
      app/src/main/java/aicare/net/cn/iweightdemo/MyActivity.java

+ 16
- 1
app/src/main/java/aicare/net/cn/iweightdemo/MyActivity.java 查看文件

showInfo(getString(R.string.state_error, errMsg, errCode), true); showInfo(getString(R.string.state_error, errMsg, errCode), true);
} }


private long mOldBM15DataTime = 0;
private String mOldData = "";

@Override @Override
public void onGetWeightData(final WeightData weightData) { public void onGetWeightData(final WeightData weightData) {
if (weightData == null) if (weightData == null)
} }
if (weightData.getDeviceType() == AicareBleConfig.BM_15) { if (weightData.getDeviceType() == AicareBleConfig.BM_15) {
if (weightData.getCmdType() != 3) { if (weightData.getCmdType() != 3) {
long time = System.currentTimeMillis();
isNewBM15TestData = true; isNewBM15TestData = true;
showInfo(weightData.toString(), false);
if (weightData.toString().equalsIgnoreCase(mOldData)) {
if (time - mOldBM15DataTime > 1000) {
mOldBM15DataTime = time;
showInfo(weightData.toString(), false);
}
} else {
mOldBM15DataTime = time;
showInfo(weightData.toString(), false);
}
mOldData = weightData.toString();

} }
if (weightData.getCmdType() == 3 && weightData.getAdc() > 0 && isNewBM15TestData) { if (weightData.getCmdType() == 3 && weightData.getAdc() > 0 && isNewBM15TestData) {
isNewBM15TestData = false; isNewBM15TestData = false;
switch (index) { switch (index) {
case WBYService.BLE_VERSION: case WBYService.BLE_VERSION:
showInfo(getString(R.string.ble_version, result), true); showInfo(getString(R.string.ble_version, result), true);
tv_version.setText(getString(R.string.ble_version, result));
break; break;
case WBYService.USER_ID: case WBYService.USER_ID:
showInfo(getString(R.string.user_id, result), true); showInfo(getString(R.string.user_id, result), true);

Loading…
取消
儲存