|
|
|
@ -127,6 +127,9 @@ public class MpMasterService extends Service {
|
|
|
|
|
|
|
|
|
|
private long mPreviousMpHbTime = 0;
|
|
|
|
|
|
|
|
|
|
private int mMaxBCV = 0;
|
|
|
|
|
private long mMaxBCVTime = 0;
|
|
|
|
|
|
|
|
|
|
private String mIccid1 = null;
|
|
|
|
|
private String mIccid2 = null;
|
|
|
|
|
|
|
|
|
@ -198,6 +201,8 @@ public class MpMasterService extends Service {
|
|
|
|
|
|
|
|
|
|
mPreviousMpHbTime = System.currentTimeMillis();
|
|
|
|
|
|
|
|
|
|
buildChargingBatteryVoltage(System.currentTimeMillis());
|
|
|
|
|
|
|
|
|
|
logger.info("MpMaster started version=" + mMpMasterVersion);
|
|
|
|
|
|
|
|
|
|
mHander = new Handler();
|
|
|
|
@ -530,6 +535,8 @@ public class MpMasterService extends Service {
|
|
|
|
|
mService.mPreviousHeartbeatTime = 0;
|
|
|
|
|
mService.registerHeartbeatTimer();
|
|
|
|
|
|
|
|
|
|
mService.buildChargingBatteryVoltage(System.currentTimeMillis());
|
|
|
|
|
|
|
|
|
|
if (!keepAlive) {
|
|
|
|
|
mService.startMaster(false);
|
|
|
|
|
}
|
|
|
|
@ -546,6 +553,7 @@ public class MpMasterService extends Service {
|
|
|
|
|
|
|
|
|
|
mService.registerHeartbeatTimer();
|
|
|
|
|
|
|
|
|
|
mService.buildChargingBatteryVoltage(System.currentTimeMillis());
|
|
|
|
|
if (!mService.mSeparateNetwork && (!mService.mMntnMode)) {
|
|
|
|
|
mService.startMaster(true);
|
|
|
|
|
}
|
|
|
|
@ -609,7 +617,6 @@ public class MpMasterService extends Service {
|
|
|
|
|
SysApi.installOTA(context, context.getPackageName(), path);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void registerHeartbeatTimer() {
|
|
|
|
@ -919,6 +926,57 @@ public class MpMasterService extends Service {
|
|
|
|
|
return signalLevel;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static String getBatteryVoltage() {
|
|
|
|
|
int val = 0;
|
|
|
|
|
for (int idx = 0; idx < 3; idx++) {
|
|
|
|
|
val = MpMasterService.getInt(115);
|
|
|
|
|
if (val > 0) {
|
|
|
|
|
return Integer.toString(val / 1000) + "." + Integer.toString((val % 1000) / 100);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void buildChargingBatteryVoltage(long ts) {
|
|
|
|
|
int val = 0;
|
|
|
|
|
for (int idx = 0; idx < 3; idx++) {
|
|
|
|
|
val = MpMasterService.getInt(112);
|
|
|
|
|
if (val > 0) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (val > 0) {
|
|
|
|
|
if (val > mMaxBCV) {
|
|
|
|
|
mMaxBCV = val;
|
|
|
|
|
mMaxBCVTime = ts;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getAndResetMaxBCV() {
|
|
|
|
|
String val = Integer.toString(mMaxBCV / 1000) + "." + Integer.toString((mMaxBCV % 1000) / 100)
|
|
|
|
|
+ "/" + Long.toString(mMaxBCVTime / 1000);
|
|
|
|
|
|
|
|
|
|
mMaxBCV = 0;
|
|
|
|
|
mMaxBCVTime = 0;
|
|
|
|
|
|
|
|
|
|
return val;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static String getChargingBatteryVoltage() {
|
|
|
|
|
int val = 0;
|
|
|
|
|
for (int idx = 0; idx < 3; idx++) {
|
|
|
|
|
val = MpMasterService.getInt(112);
|
|
|
|
|
if (val > 0) {
|
|
|
|
|
return Integer.toString(val / 1000) + "." + Integer.toString((val % 1000) / 100);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void downloadAndInstall(final String url) {
|
|
|
|
|
|
|
|
|
|
final Context context = getApplicationContext();
|
|
|
|
|