|
|
@ -122,6 +122,8 @@ public class MpMasterService extends Service {
|
|
|
|
private PendingIntent mPreviousHB = null;
|
|
|
|
private PendingIntent mPreviousHB = null;
|
|
|
|
private long mPreviousHeartbeatTime = 0;
|
|
|
|
private long mPreviousHeartbeatTime = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private long mPreviousMpHbTime = 0;
|
|
|
|
|
|
|
|
|
|
|
|
private String mIccid1 = null;
|
|
|
|
private String mIccid1 = null;
|
|
|
|
private String mIccid2 = null;
|
|
|
|
private String mIccid2 = null;
|
|
|
|
|
|
|
|
|
|
|
@ -477,6 +479,8 @@ public class MpMasterService extends Service {
|
|
|
|
mService.startMpApp();
|
|
|
|
mService.startMpApp();
|
|
|
|
|
|
|
|
|
|
|
|
} else if (TextUtils.equals(MicroPhotoContext.ACTION_HEARTBEAT_MP, action)) {
|
|
|
|
} else if (TextUtils.equals(MicroPhotoContext.ACTION_HEARTBEAT_MP, action)) {
|
|
|
|
|
|
|
|
mService.mPreviousMpHbTime = System.currentTimeMillis();
|
|
|
|
|
|
|
|
|
|
|
|
if (!mService.mSeparateNetwork || (mService.mMntnMode || mService.mQuickHbMode)) {
|
|
|
|
if (!mService.mSeparateNetwork || (mService.mMntnMode || mService.mQuickHbMode)) {
|
|
|
|
mService.logger.info("Heartbeat Timer Fired By MpAPP ACTION=" + action);
|
|
|
|
mService.logger.info("Heartbeat Timer Fired By MpAPP ACTION=" + action);
|
|
|
|
|
|
|
|
|
|
|
@ -643,7 +647,12 @@ public class MpMasterService extends Service {
|
|
|
|
Log.i(TAG, "AppPath=" + appPath + " cmdid=" + cmdid);
|
|
|
|
Log.i(TAG, "AppPath=" + appPath + " cmdid=" + cmdid);
|
|
|
|
|
|
|
|
|
|
|
|
// startMaster(false);
|
|
|
|
// startMaster(false);
|
|
|
|
|
|
|
|
mHander.postDelayed(new Runnable() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void run() {
|
|
|
|
startMpApp();
|
|
|
|
startMpApp();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}, 5000);
|
|
|
|
|
|
|
|
|
|
|
|
registerHeartbeatTimer();
|
|
|
|
registerHeartbeatTimer();
|
|
|
|
|
|
|
|
|
|
|
@ -669,7 +678,7 @@ public class MpMasterService extends Service {
|
|
|
|
mHander.postDelayed(
|
|
|
|
mHander.postDelayed(
|
|
|
|
new Runnable() {
|
|
|
|
new Runnable() {
|
|
|
|
public void run() {
|
|
|
|
public void run() {
|
|
|
|
Log.d(TAG, "Bluetooth Low Energy device is connected!!");
|
|
|
|
// Log.d(TAG, "Bluetooth Low Energy device is connected!!");
|
|
|
|
Toast.makeText(getApplicationContext(), "Connected!", Toast.LENGTH_SHORT).show();
|
|
|
|
Toast.makeText(getApplicationContext(), "Connected!", Toast.LENGTH_SHORT).show();
|
|
|
|
mStateService = STATE_SERVICE.CONNECTED;
|
|
|
|
mStateService = STATE_SERVICE.CONNECTED;
|
|
|
|
startForeground(NOTIFICATION_ID_FOREGROUND_SERVICE, prepareNotification());
|
|
|
|
startForeground(NOTIFICATION_ID_FOREGROUND_SERVICE, prepareNotification());
|
|
|
@ -822,79 +831,6 @@ public class MpMasterService extends Service {
|
|
|
|
th.start();
|
|
|
|
th.start();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public String getSystemInfo() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
boolean isXyPlatform = mModelName.startsWith("tb8788");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IntentFilter intentFilter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED);
|
|
|
|
|
|
|
|
Intent intent = getApplicationContext().registerReceiver(null, intentFilter);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int batteryStatus = intent.getIntExtra(BatteryManager.EXTRA_STATUS, -1);
|
|
|
|
|
|
|
|
int isCahrging = ((batteryStatus == BatteryManager.BATTERY_STATUS_CHARGING) ||
|
|
|
|
|
|
|
|
(batteryStatus == BatteryManager.BATTERY_STATUS_FULL)) ? 1 : 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int level = intent.getIntExtra("level", 0); ///电池剩余电量
|
|
|
|
|
|
|
|
int scale = intent.getIntExtra("scale", 0); ///获取电池满电量数值
|
|
|
|
|
|
|
|
// intent.getStringExtra("technology"); ///获取电池技术支持
|
|
|
|
|
|
|
|
// intent.getIntExtra("status",BatteryManager.BATTERY_STATUS_UNKNOWN); ///获取电池状态
|
|
|
|
|
|
|
|
// intent.getIntExtra("plugged", 0); ///获取电源信息
|
|
|
|
|
|
|
|
// intent.getIntExtra("health",BatteryManager.BATTERY_HEALTH_UNKNOWN); ///获取电池健康度
|
|
|
|
|
|
|
|
int bv = intent.getIntExtra("voltage", 0); /// mv
|
|
|
|
|
|
|
|
int temp = intent.getIntExtra("temperature", 0); ///获取电池温度
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BatteryManager manager = (BatteryManager) getSystemService(BATTERY_SERVICE);
|
|
|
|
|
|
|
|
// manager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CHARGE_COUNTER);
|
|
|
|
|
|
|
|
int bca = manager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CURRENT_AVERAGE);
|
|
|
|
|
|
|
|
int bc = manager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CURRENT_NOW);
|
|
|
|
|
|
|
|
level = manager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
float bcaVal = (bca < 0) ? ((-bca)/1000000000) : (bca / 1000000000);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sb.append("&BC=" + Float.toString(bcaVal));
|
|
|
|
|
|
|
|
sb.append("&BV=" + Float.toString(((float)bv) / 1000));
|
|
|
|
|
|
|
|
sb.append("&BP=" + level);
|
|
|
|
|
|
|
|
sb.append("&BS=" + scale);
|
|
|
|
|
|
|
|
sb.append("&CS=" + isCahrging);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ConnectivityManager cm = (ConnectivityManager)getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE);
|
|
|
|
|
|
|
|
boolean isMetered = cm.isActiveNetworkMetered();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sb.append("&NS=" + (isMetered ? "1" : "0"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final TelephonyManager telephonyManager = (TelephonyManager) getApplicationContext().getSystemService(Context.TELEPHONY_SERVICE);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SignalStrength ss = telephonyManager.getSignalStrength();
|
|
|
|
|
|
|
|
// List<CellSignalStrength> css = ss.getCellSignalStrengths();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (ss != null) {
|
|
|
|
|
|
|
|
int signalLevel = ss.getLevel();
|
|
|
|
|
|
|
|
sb.append("&Signal4G=" + signalLevel);
|
|
|
|
|
|
|
|
sb.append("&Signal2G=" + signalLevel);
|
|
|
|
|
|
|
|
sb.append("&SL=" + signalLevel);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isXyPlatform) {
|
|
|
|
|
|
|
|
java.text.DecimalFormat fmt=new java.text.DecimalFormat("0.0");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
double val = SysApi.getChargingVoltage() / 200.0;
|
|
|
|
|
|
|
|
sb.append("&CV=" + fmt.format(val)); // ChargeVol *5/1000
|
|
|
|
|
|
|
|
sb.append("&CC=" + SysApi.getChargingCurrent()); // ChargeCurrent
|
|
|
|
|
|
|
|
sb.append("&CP=" + SysApi.getChargingPower()); // ChargePower:
|
|
|
|
|
|
|
|
sb.append("&CBV=" + SysApi.getChargingBusVoltage()); // ChargeBusVol
|
|
|
|
|
|
|
|
val = SysApi.getBatteryVoltage() * 3.0 / 1000.0;
|
|
|
|
|
|
|
|
sb.append("&BV=" + fmt.format(val)); // BatVol
|
|
|
|
|
|
|
|
sb.append("&BC=" + SysApi.getBatteryCurrent()); // BatCurrent
|
|
|
|
|
|
|
|
sb.append("&BP=" + SysApi.getBatteryPower()); // BattaryPower
|
|
|
|
|
|
|
|
sb.append("&BBV=" + SysApi.getBatteryBusVoltage()); // BattaryBusVol
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// SysApi.getCpuRate();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return sb.toString();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void reboot(final int rebootType) {
|
|
|
|
public void reboot(final int rebootType) {
|
|
|
|
|
|
|
|
|
|
|
|
Runnable runnable = new Runnable() {
|
|
|
|
Runnable runnable = new Runnable() {
|
|
|
|