}
sendTempBroadcast(wristTemp, bodyTemp, envTemp);
//写到设置项里,供各个地方获取
- temperatureSave2Db(wristTemp, bodyTemp, envTemp);
+ try {
+ temperatureSave2Db(wristTemp, bodyTemp, envTemp);
+ } catch (Exception e) {
+ //有可能没有数据库
+ }
}
public static final String PATH = "settings";
return sInstance;
}
+ private final int ZERO_MAX_TIME = 20;
+
+ private int zeroTime = 0;
+
public double MW13C(double bodyTemp, double boardTemp) throws TempValueException {
+ if (bodyTemp == 0.0) {
+ zeroTime++;
+ return 0.0;
+ } else {
+ zeroTime = 0;
+ }
+ if (zeroTime > ZERO_MAX_TIME) {
+ //超过20次,我们就认为传感器检测不到温度了
+ zeroTime = 0;
+ throw new TempValueException(
+ mContext.getString(R.string.sensor_break) + ":" + bodyTemp,
+ ERROR_HARD_WEAR_ERROR);
+ }
//对体温值进行检查
if (bodyTemp <= 28.0f) {
throw new TempValueException(
}
public static final int ERROR_HARD_WEAR_TOO_HIGH = 1;
+ public static final int ERROR_HARD_WEAR_ERROR = 2;
public static final int ERROR_SENSOR_TOO_HIGH = 3;
public static final int ERROR_SENSOR_TOO_LOW = 4;
ICLogger.d("final wrist temp == > " + bodyTempResult);
}
} else if ("MW13C".equals(property)) {
- AlgorithmUtils.getInstance(WorkServiceApp.sContext).MW13C(bodyTemp, boardTemp);
+ bodyTemp = AlgorithmUtils.getInstance(WorkServiceApp.sContext).MW13C(bodyTemp, boardTemp);
+ if (bodyTemp == 0) {
+ return null;
+ }
+ lastBodyTemp = getBodyTemp(bodyTemp, 26.1f);
} else {
// double bodyTempResult = AlgorithmUtils.l004Pt(bodyTemp, evnTemp);
ICLogger.d("wrist TempResult == > " + bodyTemp);
--- /dev/null
+<resources>
+ <string name="app_name">IcWorkService</string>
+ <string name="body_sensor_value_too_low_text">sensor temperature too low</string>
+ <string name="body_sensor_value_too_high_text">sensor temperature too high</string>
+ <string name="board_temperature_high_text">board temperature too high</string>
+ <string name="sensor_break">传感器检测不到温度</string>
+</resources>
<resources>
<string name="app_name">IcWorkService</string>
- <string name="program_abnormal">很抱歉,程序出现异常,即将退出</string>
+ <string name="program_abnormal" translatable="false">很抱歉,程序出现异常,即将退出</string>
<string name="body_sensor_value_too_low_text">体温传感器温度过低</string>
<string name="body_sensor_value_too_high_text">体温传感器温度过高</string>
- <string name="board_temperature_low_text">主板温度低影响测试结果</string>
<string name="board_temperature_high_text">主板温度过高</string>
+ <string name="sensor_break">传感器检测不到温度</string>
</resources>