|
|
@ -95,50 +95,7 @@ public class MainActivity extends AppCompatActivity {
|
|
|
|
protected void onResume() {
|
|
|
|
protected void onResume() {
|
|
|
|
super.onResume();
|
|
|
|
super.onResume();
|
|
|
|
|
|
|
|
|
|
|
|
Context context = getApplicationContext();
|
|
|
|
loadConfigInfo();
|
|
|
|
MicroPhotoContext.AppConfig appConfig = MicroPhotoContext.getMpAppConfig(context);
|
|
|
|
|
|
|
|
StringBuilder stringBuilder = new StringBuilder();
|
|
|
|
|
|
|
|
stringBuilder.append("CMDID:" + (TextUtils.isEmpty(appConfig.cmdid) ? "" : appConfig.cmdid));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MicroPhotoContext.MasterConfig masterConfig = MicroPhotoContext.getMasterConfig(context);
|
|
|
|
|
|
|
|
stringBuilder.append("\r\n");
|
|
|
|
|
|
|
|
stringBuilder.append("运维主站:" + (TextUtils.isEmpty(masterConfig.server) ? MicroPhotoContext.DEFAULT_MASTER_SERVER : masterConfig.server));
|
|
|
|
|
|
|
|
stringBuilder.append(":");
|
|
|
|
|
|
|
|
stringBuilder.append(Integer.toString((masterConfig.port != 0) ? masterConfig.port : MicroPhotoContext.DEFAULT_MASTER_PORT));
|
|
|
|
|
|
|
|
stringBuilder.append("\r\n");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stringBuilder.append("心跳模式:");
|
|
|
|
|
|
|
|
if (masterConfig.usingAbsHbTime != 0) {
|
|
|
|
|
|
|
|
stringBuilder.append("固定时间心跳 ");
|
|
|
|
|
|
|
|
if (masterConfig.absHeartbeats != null && masterConfig.absHeartbeats.length > 0) {
|
|
|
|
|
|
|
|
for (int item : masterConfig.absHeartbeats) {
|
|
|
|
|
|
|
|
stringBuilder.append(MicroPhotoContext.formatHeartbeatTime(item));
|
|
|
|
|
|
|
|
stringBuilder.append(" ");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
stringBuilder.append(MicroPhotoContext.formatHeartbeatTime(MicroPhotoContext.DEFAULT_HEARTBEAT_TIME_FOR_SEPARATE_NW));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
stringBuilder.append("周期性心跳 / " + masterConfig.heartbeat + "分钟");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
stringBuilder.append("\r\n");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stringBuilder.append("运维网络:");
|
|
|
|
|
|
|
|
stringBuilder.append(masterConfig.separateNetwork != 0 ? "独立网络" : "公用网络");
|
|
|
|
|
|
|
|
stringBuilder.append("\r\n");
|
|
|
|
|
|
|
|
stringBuilder.append("\r\n");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stringBuilder.append("启动时间:");
|
|
|
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
|
|
|
Date dt = new Date(mLaunchTime);
|
|
|
|
|
|
|
|
stringBuilder.append(sdf.format(dt));
|
|
|
|
|
|
|
|
stringBuilder.append("\r\n");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
((TextView) findViewById((R.id.cmdid))).setText(stringBuilder.toString());
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
@ -176,6 +133,10 @@ public class MainActivity extends AppCompatActivity {
|
|
|
|
MpMasterService.restartApp(getApplicationContext());
|
|
|
|
MpMasterService.restartApp(getApplicationContext());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case R.id.action_refresh:{
|
|
|
|
|
|
|
|
loadConfigInfo();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -183,4 +144,48 @@ public class MainActivity extends AppCompatActivity {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void loadConfigInfo() {
|
|
|
|
|
|
|
|
Context context = getApplicationContext();
|
|
|
|
|
|
|
|
MicroPhotoContext.AppConfig appConfig = MicroPhotoContext.getMpAppConfig(context);
|
|
|
|
|
|
|
|
StringBuilder stringBuilder = new StringBuilder();
|
|
|
|
|
|
|
|
stringBuilder.append("CMDID:" + (TextUtils.isEmpty(appConfig.cmdid) ? "" : appConfig.cmdid));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MicroPhotoContext.MasterConfig masterConfig = MicroPhotoContext.getMasterConfig(context);
|
|
|
|
|
|
|
|
stringBuilder.append("\r\n");
|
|
|
|
|
|
|
|
stringBuilder.append("运维主站:" + (TextUtils.isEmpty(masterConfig.server) ? MicroPhotoContext.DEFAULT_MASTER_SERVER : masterConfig.server));
|
|
|
|
|
|
|
|
stringBuilder.append(":");
|
|
|
|
|
|
|
|
stringBuilder.append(Integer.toString((masterConfig.port != 0) ? masterConfig.port : MicroPhotoContext.DEFAULT_MASTER_PORT));
|
|
|
|
|
|
|
|
stringBuilder.append("\r\n");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stringBuilder.append("心跳模式:");
|
|
|
|
|
|
|
|
if (masterConfig.usingAbsHbTime != 0) {
|
|
|
|
|
|
|
|
stringBuilder.append("固定时间心跳 ");
|
|
|
|
|
|
|
|
if (masterConfig.absHeartbeats != null && masterConfig.absHeartbeats.length > 0) {
|
|
|
|
|
|
|
|
for (int item : masterConfig.absHeartbeats) {
|
|
|
|
|
|
|
|
stringBuilder.append(MicroPhotoContext.formatHeartbeatTime(item));
|
|
|
|
|
|
|
|
stringBuilder.append(" ");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
stringBuilder.append(MicroPhotoContext.formatHeartbeatTime(MicroPhotoContext.DEFAULT_HEARTBEAT_TIME_FOR_SEPARATE_NW));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
stringBuilder.append("周期性心跳 / " + masterConfig.heartbeat + "分钟");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
stringBuilder.append("\r\n");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stringBuilder.append("运维网络:");
|
|
|
|
|
|
|
|
stringBuilder.append(masterConfig.separateNetwork != 0 ? "独立网络" : "公用网络");
|
|
|
|
|
|
|
|
stringBuilder.append("\r\n");
|
|
|
|
|
|
|
|
stringBuilder.append("\r\n");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stringBuilder.append("启动时间:");
|
|
|
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
|
|
|
Date dt = new Date(mLaunchTime);
|
|
|
|
|
|
|
|
stringBuilder.append(sdf.format(dt));
|
|
|
|
|
|
|
|
stringBuilder.append("\r\n");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
((TextView) findViewById((R.id.cmdid))).setText(stringBuilder.toString());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|