|
|
@ -35,6 +35,7 @@ import com.xypower.common.NetworkUtils;
|
|
|
|
import com.xypower.common.RegexUtil;
|
|
|
|
import com.xypower.common.RegexUtil;
|
|
|
|
import com.xypower.mpmaster.MpMasterService;
|
|
|
|
import com.xypower.mpmaster.MpMasterService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.json.JSONArray;
|
|
|
|
import org.json.JSONException;
|
|
|
|
import org.json.JSONException;
|
|
|
|
import org.json.JSONObject;
|
|
|
|
import org.json.JSONObject;
|
|
|
|
|
|
|
|
|
|
|
@ -85,541 +86,459 @@ public class SimUtil {
|
|
|
|
if (StringUtils.isEmpty(content)) {
|
|
|
|
if (StringUtils.isEmpty(content)) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (content.toLowerCase().contains(SmsTypeEnum.CFG.value().toLowerCase())) {
|
|
|
|
if (content.toLowerCase().contains(SmsTypeEnum.UPD_CFG_FILE.value().toLowerCase())) { //修改配置文件中参数
|
|
|
|
String[] cmdSpilt = StringUtils.splitString2(content);
|
|
|
|
updateConfig(content);
|
|
|
|
if (cmdSpilt != null && cmdSpilt.length > 1) {
|
|
|
|
} else if (content.toLowerCase().contains(SmsTypeEnum.GET_CFG_FILE.value().toLowerCase())) {//获取配置文件中参数
|
|
|
|
|
|
|
|
queryConfig(content);
|
|
|
|
String actType = null;
|
|
|
|
} else if (content.toLowerCase().contains(SmsTypeEnum.UPD_FILE.value().toLowerCase())) {//替换配置文件
|
|
|
|
String restartType = null;
|
|
|
|
updateFile(content);
|
|
|
|
ArrayList<HashMap> list = new ArrayList<>();
|
|
|
|
} else if (content.toLowerCase().contains(SmsTypeEnum.GET_FILE.value().toLowerCase())) {//获取整个配置文件
|
|
|
|
for (int i = 0; i < cmdSpilt.length; i++) {
|
|
|
|
queryFile(content);
|
|
|
|
String cmd = cmdSpilt[i];
|
|
|
|
} else if (content.contains(SmsTypeEnum.REBOOT1.value())) {
|
|
|
|
if (StringUtils.isEmpty(cmd)) {
|
|
|
|
ifmessageCorrect = true;
|
|
|
|
break;
|
|
|
|
restartType = 0;
|
|
|
|
|
|
|
|
sendmessage = getSendString(content, ifmessageCorrect);
|
|
|
|
|
|
|
|
} else if (content.contains(SmsTypeEnum.REBOOT2.value()) || content.contains(SmsTypeEnum.REBOOT3.value())) {
|
|
|
|
|
|
|
|
ifmessageCorrect = true;
|
|
|
|
|
|
|
|
restartType = 0;
|
|
|
|
|
|
|
|
sendmessage = getSendString(content, ifmessageCorrect);
|
|
|
|
|
|
|
|
} else if (content.contains(SmsTypeEnum.RESTART_MP.value()) || content.contains(SmsTypeEnum.RESTART_MP2.value())) {
|
|
|
|
|
|
|
|
ifmessageCorrect = true;
|
|
|
|
|
|
|
|
restartType = 1;
|
|
|
|
|
|
|
|
sendmessage = getSendString(content, ifmessageCorrect);
|
|
|
|
|
|
|
|
} else if (content.contains(SmsTypeEnum.RESTART_MPMST.value()) || content.contains(SmsTypeEnum.RESTART_MPMST2.value())) {
|
|
|
|
|
|
|
|
ifmessageCorrect = true;
|
|
|
|
|
|
|
|
restartType = 2;
|
|
|
|
|
|
|
|
sendmessage = getSendString(content, ifmessageCorrect);
|
|
|
|
|
|
|
|
} else if (content.contains(SmsTypeEnum.RESTART_BOTH_APPS.value()) || content.contains(SmsTypeEnum.RESTART_BOTH_APPS2.value())) {
|
|
|
|
|
|
|
|
ifmessageCorrect = true;
|
|
|
|
|
|
|
|
restartType = 3;
|
|
|
|
|
|
|
|
sendmessage = getSendString(content, ifmessageCorrect);
|
|
|
|
|
|
|
|
} else if (content.contains(SmsTypeEnum.SET_YW_SCHEDULE.value())) {
|
|
|
|
|
|
|
|
ifmessageCorrect = true;
|
|
|
|
|
|
|
|
String[] split1 = StringUtils.splitString1(content);
|
|
|
|
|
|
|
|
if (split1 != null && split1.length == 2) {
|
|
|
|
|
|
|
|
String s = split1[1];
|
|
|
|
|
|
|
|
String[] split2 = StringUtils.splitString2(s);
|
|
|
|
|
|
|
|
int spilt2len = split2.length;
|
|
|
|
|
|
|
|
if (split2 != null && spilt2len > 1 && spilt2len % 2 == 1) {
|
|
|
|
|
|
|
|
String num = split2[0];
|
|
|
|
|
|
|
|
Integer integer = StringUtils.convert2Int(num);
|
|
|
|
|
|
|
|
if (integer != null) {
|
|
|
|
|
|
|
|
if (integer == 0) {//删除所有运维
|
|
|
|
|
|
|
|
ifmessageCorrect = true;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if (spilt2len == integer * 2 + 1) {
|
|
|
|
|
|
|
|
int times = 0;
|
|
|
|
|
|
|
|
for (int i = 0; i < spilt2len; i++) {
|
|
|
|
|
|
|
|
if (i == 0) {
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
String ts = split2[i];
|
|
|
|
|
|
|
|
Integer time = StringUtils.convert2Int(ts);
|
|
|
|
|
|
|
|
if (i % 2 == 1) {
|
|
|
|
|
|
|
|
if (time > 23) {
|
|
|
|
|
|
|
|
ifmessageCorrect = false;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
times = time * 3600;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if (time > 59) {
|
|
|
|
|
|
|
|
ifmessageCorrect = false;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
times += time * 60;
|
|
|
|
|
|
|
|
abslist.add(times);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ifmessageCorrect) {
|
|
|
|
|
|
|
|
UpdateSysConfigUtil.setAbsHeartbeats(context, abslist);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
String[] actSpilt = StringUtils.splitString1(cmd);
|
|
|
|
}
|
|
|
|
if (actSpilt == null || actSpilt.length != 2) {
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
restartType = 2;
|
|
|
|
|
|
|
|
sendmessage = getSendString(content, ifmessageCorrect);
|
|
|
|
|
|
|
|
} else if (content.contains(SmsTypeEnum.GET_YW_SCHEDULE.value())) {
|
|
|
|
|
|
|
|
List<Integer> absHeartbeats = UpdateSysConfigUtil.getAbsHeartbeats(context);
|
|
|
|
|
|
|
|
if (absHeartbeats == null || absHeartbeats.size() == 0) {
|
|
|
|
|
|
|
|
sendmessage = SmsTypeEnum.GET_YW_SCHEDULE.value() + "=0";
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
int length = absHeartbeats.size();
|
|
|
|
|
|
|
|
sendmessage = SmsTypeEnum.GET_YW_SCHEDULE.value() + "=" + length;
|
|
|
|
|
|
|
|
for (int i = 0; i < length; i++) {
|
|
|
|
|
|
|
|
int mAbsHeartbeatTime = 0;
|
|
|
|
|
|
|
|
mAbsHeartbeatTime = absHeartbeats.get(i);
|
|
|
|
|
|
|
|
int hour = mAbsHeartbeatTime / 3600;
|
|
|
|
|
|
|
|
int minute = (mAbsHeartbeatTime % 3600) / 60;
|
|
|
|
|
|
|
|
sendmessage += "," + hour + "," + minute;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if (content.contains(SmsTypeEnum.SET_OPERATE.value())) {
|
|
|
|
|
|
|
|
String[] split1 = StringUtils.splitString1(content);
|
|
|
|
|
|
|
|
if (split1 != null && split1.length > 1) {
|
|
|
|
|
|
|
|
String s = split1[1];
|
|
|
|
|
|
|
|
Integer integer = StringUtils.convert2Int(s);
|
|
|
|
|
|
|
|
if (integer != null) {
|
|
|
|
|
|
|
|
if (integer == 0 || integer == 1) {
|
|
|
|
|
|
|
|
ifmessageCorrect = true;
|
|
|
|
|
|
|
|
UpdateSysConfigUtil.setMntnMode(context, integer);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
String key = actSpilt[0];
|
|
|
|
}
|
|
|
|
String value = actSpilt[1];
|
|
|
|
}
|
|
|
|
if (cmd.toLowerCase().contains(SmsTypeEnum.ACT.value().toLowerCase())) {
|
|
|
|
restartType = 2;
|
|
|
|
if (value.toLowerCase().contains(SmsTypeEnum.SET.value().toLowerCase()) || value.toLowerCase().contains(SmsTypeEnum.GET.value().toLowerCase()) || value.toLowerCase().contains(SmsTypeEnum.SETFILE.value().toLowerCase()) || value.toLowerCase().contains(SmsTypeEnum.GETFILE.value().toLowerCase())) {
|
|
|
|
sendmessage = getSendString(content, ifmessageCorrect);
|
|
|
|
actType = value;
|
|
|
|
} else if (content.contains(SmsTypeEnum.GET_OPERATE.value())) {
|
|
|
|
} else {
|
|
|
|
int mntnMode = UpdateSysConfigUtil.getMntnMode(context);
|
|
|
|
break;
|
|
|
|
sendmessage = SmsTypeEnum.GET_OPERATE.value() + "=" + mntnMode;
|
|
|
|
|
|
|
|
} else if (content.contains(SmsTypeEnum.SET_OPERATE_URL.value())) {
|
|
|
|
|
|
|
|
restartType = 2;
|
|
|
|
|
|
|
|
String[] split1 = StringUtils.splitString1(content);
|
|
|
|
|
|
|
|
if (split1 != null && split1.length > 1) {
|
|
|
|
|
|
|
|
String s = split1[1];
|
|
|
|
|
|
|
|
String[] split2 = StringUtils.splitString2(s);
|
|
|
|
|
|
|
|
if (split2 != null && split2.length >= 2) {
|
|
|
|
|
|
|
|
String ipAddress = split2[0];
|
|
|
|
|
|
|
|
String port = split2[1];
|
|
|
|
|
|
|
|
boolean b = RegexUtil.checkIpAddress(ipAddress);
|
|
|
|
|
|
|
|
if (b) {
|
|
|
|
|
|
|
|
Integer integer = StringUtils.convert2Int(port);
|
|
|
|
|
|
|
|
if (integer != null) {
|
|
|
|
|
|
|
|
ifmessageCorrect = true;
|
|
|
|
|
|
|
|
UpdateSysConfigUtil.setMntnServer(context, ipAddress, integer);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
sendmessage = getSendString(content, ifmessageCorrect);
|
|
|
|
|
|
|
|
} else if (content.contains(SmsTypeEnum.GET_OPERATE_URL.value())) {
|
|
|
|
|
|
|
|
String mntnServer = UpdateSysConfigUtil.getMntnServer(context);
|
|
|
|
|
|
|
|
sendmessage = SmsTypeEnum.GET_OPERATE_URL.value() + "=" + mntnServer;
|
|
|
|
|
|
|
|
} else if (content.contains(SmsTypeEnum.UPDATE.value())) {
|
|
|
|
|
|
|
|
String[] split1 = StringUtils.splitString1(content);
|
|
|
|
|
|
|
|
if (split1 != null && split1.length == 2) {
|
|
|
|
|
|
|
|
ifmessageCorrect = true;
|
|
|
|
|
|
|
|
String s = split1[1];
|
|
|
|
|
|
|
|
DownloadUtils downloadUtils = new DownloadUtils(context.getApplicationContext(), s, "test.app");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
sendmessage = getSendString(content, ifmessageCorrect);
|
|
|
|
|
|
|
|
} else if (content.contains(SmsTypeEnum.SET_CMDID.value())) {
|
|
|
|
|
|
|
|
restartType = 1;
|
|
|
|
|
|
|
|
String[] split1 = StringUtils.splitString1(content);
|
|
|
|
|
|
|
|
if (split1 != null && split1.length > 1) {
|
|
|
|
|
|
|
|
ifmessageCorrect = true;
|
|
|
|
|
|
|
|
String cmdid = split1[1];
|
|
|
|
|
|
|
|
UpdateSysConfigUtil.setCmdid(context, cmdid);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
sendmessage = getSendString(content, ifmessageCorrect);
|
|
|
|
|
|
|
|
} else if (content.contains(SmsTypeEnum.GET_CMDID.value())) {
|
|
|
|
|
|
|
|
String cmdid = UpdateSysConfigUtil.getCmdid(context);
|
|
|
|
|
|
|
|
String serialNo = UpdateSysConfigUtil.getSerialNo();
|
|
|
|
|
|
|
|
sendmessage = SmsTypeEnum.GET_CMDID.value() + "=" + serialNo + "," + cmdid;
|
|
|
|
|
|
|
|
} else if (content.contains(SmsTypeEnum.SET_IP.value())) {
|
|
|
|
|
|
|
|
restartType = 1;
|
|
|
|
|
|
|
|
String[] split1 = StringUtils.splitString1(content);
|
|
|
|
|
|
|
|
if (split1 != null && split1.length > 1) {
|
|
|
|
|
|
|
|
String s = split1[1];
|
|
|
|
|
|
|
|
String[] split2 = StringUtils.splitString2(s);
|
|
|
|
|
|
|
|
if (split2 != null && (split2.length == 2 || split2.length == 4)) {
|
|
|
|
|
|
|
|
String server;
|
|
|
|
|
|
|
|
Integer integer;
|
|
|
|
|
|
|
|
server = split2[0];
|
|
|
|
|
|
|
|
String port = split2[1];
|
|
|
|
|
|
|
|
integer = StringUtils.convert2Int(port);
|
|
|
|
|
|
|
|
Integer utcp = -1;
|
|
|
|
|
|
|
|
Integer encrypto = -1;
|
|
|
|
|
|
|
|
if (integer != null) {
|
|
|
|
|
|
|
|
ifmessageCorrect = true;
|
|
|
|
|
|
|
|
if (split2.length == 4) {
|
|
|
|
|
|
|
|
String s1 = split2[2];
|
|
|
|
|
|
|
|
utcp = StringUtils.convert2Int(s1);
|
|
|
|
|
|
|
|
utcp = getUtcp(utcp);
|
|
|
|
|
|
|
|
String s2 = split2[3];
|
|
|
|
|
|
|
|
encrypto = StringUtils.convert2Int(s2);
|
|
|
|
|
|
|
|
encrypto = getEncrypto(encrypto);
|
|
|
|
|
|
|
|
if (utcp == -1 || encrypto == -1) {
|
|
|
|
|
|
|
|
ifmessageCorrect = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ifmessageCorrect) {
|
|
|
|
|
|
|
|
UpdateSysConfigUtil.setIP(context, server, integer, utcp, encrypto);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
sendmessage = getSendString(content, ifmessageCorrect);
|
|
|
|
|
|
|
|
} else if (content.contains(SmsTypeEnum.GET_IP.value())) {
|
|
|
|
|
|
|
|
String ip = UpdateSysConfigUtil.getIP(context);
|
|
|
|
|
|
|
|
sendmessage = SmsTypeEnum.GET_IP.value() + "=" + ip;
|
|
|
|
|
|
|
|
} else if (content.contains(SmsTypeEnum.SET_OSD.value())) {
|
|
|
|
|
|
|
|
restartType = 1;
|
|
|
|
|
|
|
|
String[] split1 = StringUtils.splitString1(content);
|
|
|
|
|
|
|
|
sendmessage = getSendString(content, ifmessageCorrect);
|
|
|
|
|
|
|
|
if (split1 != null && split1.length == 2) {
|
|
|
|
|
|
|
|
ifmessageCorrect = true;
|
|
|
|
|
|
|
|
JSONObject osdmap = new JSONObject();
|
|
|
|
|
|
|
|
String s = split1[1];
|
|
|
|
|
|
|
|
String[] split2 = StringUtils.splitString2(s);
|
|
|
|
|
|
|
|
int spilt2len = split2.length;
|
|
|
|
|
|
|
|
if (split2 != null && spilt2len > 1 && spilt2len % 2 == 1) {
|
|
|
|
|
|
|
|
String num = split2[0];
|
|
|
|
|
|
|
|
Integer integer = StringUtils.convert2Int(num);
|
|
|
|
|
|
|
|
if (integer != null) {
|
|
|
|
|
|
|
|
for (int i = 0; i < spilt2len; i++) {
|
|
|
|
|
|
|
|
if (i == 0) {
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i % 2 == 1) {
|
|
|
|
|
|
|
|
if ((i + 1) <= spilt2len) {
|
|
|
|
|
|
|
|
String s1 = split2[i];
|
|
|
|
|
|
|
|
Integer position = StringUtils.convert2Int(s1);
|
|
|
|
|
|
|
|
if (position != null) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
if (position == 1) {
|
|
|
|
|
|
|
|
osdmap.put(UpdateSysConfigUtil.leftTop, split2[i + 1]);
|
|
|
|
|
|
|
|
} else if (position == 2) {
|
|
|
|
|
|
|
|
osdmap.put(UpdateSysConfigUtil.rightTop, split2[i + 1]);
|
|
|
|
|
|
|
|
} else if (position == 3) {
|
|
|
|
|
|
|
|
osdmap.put(UpdateSysConfigUtil.leftBottom, split2[i + 1]);
|
|
|
|
|
|
|
|
} else if (position == 4) {
|
|
|
|
|
|
|
|
osdmap.put(UpdateSysConfigUtil.rightBottom, split2[i + 1]);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
ifmessageCorrect = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (JSONException e) {
|
|
|
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
ifmessageCorrect = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
ifmessageCorrect = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (cmd.toLowerCase().contains(SmsTypeEnum.CFG.value().toLowerCase())) {
|
|
|
|
if (integer == 0) {//所有通道
|
|
|
|
if (value.toLowerCase().contains(SmsTypeEnum.MASTER.value().toLowerCase()) || value.toLowerCase().contains(SmsTypeEnum.APP.value().toLowerCase())) {
|
|
|
|
ifmessageCorrect = true;
|
|
|
|
HashMap<Object, Object> hashMap = new HashMap<>();
|
|
|
|
MicroPhotoContext.AppConfig mpAppConfig = MicroPhotoContext.getMpAppConfig(context);
|
|
|
|
hashMap.put(SmsTypeEnum.CFGFILE.value(), value);
|
|
|
|
int channelnum = mpAppConfig.channels;
|
|
|
|
list.add(hashMap);
|
|
|
|
if (channelnum != 0) {
|
|
|
|
|
|
|
|
if (ifmessageCorrect) {
|
|
|
|
|
|
|
|
for (int i = 1; i <= channelnum; i++) {
|
|
|
|
|
|
|
|
UpdateSysConfigUtil.setChannelOSD(i, osdmap);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
break;
|
|
|
|
if (ifmessageCorrect) {
|
|
|
|
|
|
|
|
UpdateSysConfigUtil.setChannelOSD(integer, osdmap);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if (content.contains(SmsTypeEnum.GET_OSD.value())) {
|
|
|
|
|
|
|
|
String[] split = StringUtils.splitString1(content);
|
|
|
|
|
|
|
|
if (split != null && split.length == 2) {
|
|
|
|
|
|
|
|
sendmessage = SmsTypeEnum.GET_OSD.value() + "=";
|
|
|
|
|
|
|
|
ifmessageCorrect = true;
|
|
|
|
|
|
|
|
Integer channel = StringUtils.convert2Int(split[1]);
|
|
|
|
|
|
|
|
if (channel != null) {
|
|
|
|
|
|
|
|
if (channel == 0) {
|
|
|
|
|
|
|
|
MicroPhotoContext.AppConfig mpAppConfig = MicroPhotoContext.getMpAppConfig(context);
|
|
|
|
|
|
|
|
int channelnum = mpAppConfig.channels;
|
|
|
|
|
|
|
|
if (channelnum != 0) {
|
|
|
|
|
|
|
|
if (ifmessageCorrect) {
|
|
|
|
|
|
|
|
for (int i = 1; i <= channelnum; i++) {
|
|
|
|
|
|
|
|
sendmessage += channel + ":{";
|
|
|
|
|
|
|
|
JSONObject channelOSD = UpdateSysConfigUtil.getChannelOSD(channel);
|
|
|
|
|
|
|
|
if (channelOSD != null) {
|
|
|
|
|
|
|
|
String leftTop = channelOSD.optString(UpdateSysConfigUtil.leftTop);
|
|
|
|
|
|
|
|
String rightTop = channelOSD.optString(UpdateSysConfigUtil.rightTop);
|
|
|
|
|
|
|
|
String leftBottom = channelOSD.optString(UpdateSysConfigUtil.leftBottom);
|
|
|
|
|
|
|
|
String rightBottom = channelOSD.optString(UpdateSysConfigUtil.rightBottom);
|
|
|
|
|
|
|
|
if (leftTop != null && StringUtils.isNotEmpty(leftTop)) {
|
|
|
|
|
|
|
|
sendmessage += "左上:" + leftTop;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rightTop != null && StringUtils.isNotEmpty(rightTop)) {
|
|
|
|
|
|
|
|
sendmessage += ",右上:" + rightTop;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (leftBottom != null && StringUtils.isNotEmpty(leftBottom)) {
|
|
|
|
|
|
|
|
sendmessage += ",左下:" + leftBottom;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rightBottom != null && StringUtils.isNotEmpty(rightBottom)) {
|
|
|
|
|
|
|
|
sendmessage += ",右下:" + rightBottom;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
sendmessage += "无水印";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i == channelnum) {
|
|
|
|
|
|
|
|
sendmessage += channel + "}";
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
sendmessage += channel + "},";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (cmd.toLowerCase().contains(SmsTypeEnum.RESTART.value().toLowerCase())) {
|
|
|
|
|
|
|
|
restartType = value;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if (list.size() > 0) {
|
|
|
|
JSONObject channelOSD = UpdateSysConfigUtil.getChannelOSD(channel);
|
|
|
|
HashMap hashMap = list.get(list.size() - 1);
|
|
|
|
if (channelOSD != null) {
|
|
|
|
hashMap.put(key, value);
|
|
|
|
String leftTop = channelOSD.optString(UpdateSysConfigUtil.leftTop);
|
|
|
|
|
|
|
|
String rightTop = channelOSD.optString(UpdateSysConfigUtil.rightTop);
|
|
|
|
|
|
|
|
String leftBottom = channelOSD.optString(UpdateSysConfigUtil.leftBottom);
|
|
|
|
|
|
|
|
String rightBottom = channelOSD.optString(UpdateSysConfigUtil.rightBottom);
|
|
|
|
|
|
|
|
if (leftTop != null && StringUtils.isNotEmpty(leftTop)) {
|
|
|
|
|
|
|
|
sendmessage += "左上:" + leftTop;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rightTop != null && StringUtils.isNotEmpty(rightTop)) {
|
|
|
|
|
|
|
|
sendmessage += ",右上:" + rightTop;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (leftBottom != null && StringUtils.isNotEmpty(leftBottom)) {
|
|
|
|
|
|
|
|
sendmessage += ",左下:" + leftBottom;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rightBottom != null && StringUtils.isNotEmpty(rightBottom)) {
|
|
|
|
|
|
|
|
sendmessage += ",右下:" + rightBottom;
|
|
|
|
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
break;
|
|
|
|
sendmessage += "无水印";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
ifmessageCorrect = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if (content.contains(SmsTypeEnum.SET_PHOTO_SCHEDULE_LIST.value())) {
|
|
|
|
|
|
|
|
restartType = 1;
|
|
|
|
|
|
|
|
String[] split1 = StringUtils.splitString1(content);
|
|
|
|
|
|
|
|
if (split1 != null && split1.length > 1) {
|
|
|
|
|
|
|
|
String s = split1[1];
|
|
|
|
|
|
|
|
String[] split2 = StringUtils.splitString2(s);
|
|
|
|
|
|
|
|
if (split2 != null && split2.length == 2) {
|
|
|
|
|
|
|
|
Integer channel = StringUtils.convert2Int(split2[0]);
|
|
|
|
|
|
|
|
if (channel != null) {
|
|
|
|
|
|
|
|
ifmessageCorrect = true;
|
|
|
|
|
|
|
|
String msg = split2[1];
|
|
|
|
|
|
|
|
UpdateSysConfigUtil.setPhotoSchedules(channel, msg);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
UpdateSysConfigUtil.setCommon(context, actType, list, restartType);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sendmessage = getSendString(content, ifmessageCorrect);
|
|
|
|
|
|
|
|
} else if (content.contains(SmsTypeEnum.GET_PHOTO_SCHEDULE_LIST.value())) {
|
|
|
|
|
|
|
|
String[] split1 = StringUtils.splitString1(content);
|
|
|
|
|
|
|
|
if (split1 != null && split1.length == 2) {
|
|
|
|
|
|
|
|
Integer channel = StringUtils.convert2Int(split1[1]);
|
|
|
|
|
|
|
|
String photoSchedules = UpdateSysConfigUtil.getPhotoSchedules(channel);
|
|
|
|
|
|
|
|
sendmessage = SmsTypeEnum.GET_PHOTO_SCHEDULE_LIST.value() + "=" + photoSchedules;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if (content.contains(SmsTypeEnum.SET_RESOLUTION.value())) {
|
|
|
|
|
|
|
|
restartType = 1;
|
|
|
|
|
|
|
|
String[] split1 = StringUtils.splitString1(content);
|
|
|
|
|
|
|
|
if (split1 != null && split1.length > 1) {
|
|
|
|
|
|
|
|
String s = split1[1];
|
|
|
|
|
|
|
|
String[] split2 = StringUtils.splitString1(s);
|
|
|
|
|
|
|
|
if (split2 != null && split2.length == 5) {
|
|
|
|
|
|
|
|
Integer channel = StringUtils.convert2Int(split2[0]);
|
|
|
|
|
|
|
|
Integer resolutionCX = StringUtils.convert2Int(split2[1]);
|
|
|
|
|
|
|
|
Integer resolutionCY = StringUtils.convert2Int(split2[2]);
|
|
|
|
|
|
|
|
Integer videoCX = StringUtils.convert2Int(split2[3]);
|
|
|
|
|
|
|
|
Integer videoCY = StringUtils.convert2Int(split2[4]);
|
|
|
|
|
|
|
|
if (channel != null && resolutionCX != null && resolutionCY != null && videoCX != null && videoCY != null) {
|
|
|
|
|
|
|
|
ifmessageCorrect = true;
|
|
|
|
|
|
|
|
UpdateSysConfigUtil.setChannelResolution(channel, resolutionCX, resolutionCY, videoCX, videoCY);
|
|
|
|
|
|
|
|
UpdateSysConfigUtil.restartApp(context);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
sendmessage = getSendString(content, ifmessageCorrect);
|
|
|
|
|
|
|
|
} else if (content.contains(SmsTypeEnum.GET_RESOLUTION.value())) {
|
|
|
|
|
|
|
|
String[] split = StringUtils.splitString1(content);
|
|
|
|
|
|
|
|
Integer channel = StringUtils.convert2Int(split[0]);
|
|
|
|
|
|
|
|
HashMap<String, Integer> hashMap = UpdateSysConfigUtil.getChannelResolution(channel);
|
|
|
|
|
|
|
|
Integer resolutionCX = hashMap.get("resolutionCX");
|
|
|
|
|
|
|
|
Integer resolutionCY = hashMap.get("resolutionCY");
|
|
|
|
|
|
|
|
Integer videoCX = hashMap.get("videoCX");
|
|
|
|
|
|
|
|
Integer videoCY = hashMap.get("videoCY");
|
|
|
|
|
|
|
|
sendmessage = SmsTypeEnum.GET_RESOLUTION.value() + "=" + resolutionCX + "," + resolutionCY + "," + videoCX + "," + videoCY;
|
|
|
|
|
|
|
|
} else if (content.contains(SmsTypeEnum.TAKE_PHOTO.value())) {
|
|
|
|
|
|
|
|
String[] split = StringUtils.splitString1(content);
|
|
|
|
|
|
|
|
if (split != null && split.length == 3) {
|
|
|
|
|
|
|
|
ifmessageCorrect = true;
|
|
|
|
|
|
|
|
Integer channel = StringUtils.convert2Int(split[0]);
|
|
|
|
|
|
|
|
Integer preset = StringUtils.convert2Int(split[1]);
|
|
|
|
|
|
|
|
Integer type = StringUtils.convert2Int(split[2]);
|
|
|
|
|
|
|
|
if (channel != null) {
|
|
|
|
|
|
|
|
boolean photoOrVideo;
|
|
|
|
|
|
|
|
if (type == 0) {
|
|
|
|
|
|
|
|
photoOrVideo = true;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
photoOrVideo = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
UpdateSysConfigUtil.takePhotoOrVideo(context, channel, preset, photoOrVideo);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
sendmessage = getSendString(content, ifmessageCorrect);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if (content.contains(SmsTypeEnum.SET_HEART.value())) {
|
|
|
|
|
|
|
|
restartType = 1;
|
|
|
|
|
|
|
|
String[] split1 = StringUtils.splitString1(content);
|
|
|
|
|
|
|
|
if (split1 != null && split1.length == 2) {
|
|
|
|
|
|
|
|
ifmessageCorrect = true;
|
|
|
|
|
|
|
|
String s = split1[1];
|
|
|
|
|
|
|
|
Integer integer = StringUtils.convert2Int(s);
|
|
|
|
|
|
|
|
UpdateSysConfigUtil.setHB(context, integer);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
sendmessage = getSendString(content, ifmessageCorrect);
|
|
|
|
|
|
|
|
} else if (content.contains(SmsTypeEnum.GET_HEART.value())) {
|
|
|
|
|
|
|
|
int hb = UpdateSysConfigUtil.getHB(context);
|
|
|
|
|
|
|
|
sendmessage = SmsTypeEnum.GET_HEART.value() + "=" + hb;
|
|
|
|
|
|
|
|
} else if (content.contains(SmsTypeEnum.SIMCARD.value())) {
|
|
|
|
|
|
|
|
sendmessage = getSimcardInfo(context);
|
|
|
|
|
|
|
|
} else if (content.contains(SmsTypeEnum.SET_AUTO_TIME.value())) {
|
|
|
|
|
|
|
|
restartType = 1;
|
|
|
|
|
|
|
|
sendmessage = setAutoTime(context, content);
|
|
|
|
|
|
|
|
} else if (content.contains(SmsTypeEnum.SET_TP.value())) {
|
|
|
|
|
|
|
|
restartType = 1;
|
|
|
|
|
|
|
|
String[] split1 = StringUtils.splitString1(content);
|
|
|
|
|
|
|
|
if (split1 != null && split1.length == 2) {
|
|
|
|
|
|
|
|
ifmessageCorrect = true;
|
|
|
|
|
|
|
|
String s = split1[1];
|
|
|
|
|
|
|
|
Integer integer = StringUtils.convert2Int(s);
|
|
|
|
|
|
|
|
UpdateSysConfigUtil.setTB(context, integer);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
sendmessage = getSendString(content, ifmessageCorrect);
|
|
|
|
|
|
|
|
} else if (content.contains(SmsTypeEnum.GET_TP.value())) {
|
|
|
|
|
|
|
|
int tb = UpdateSysConfigUtil.getTB(context);
|
|
|
|
|
|
|
|
sendmessage = SmsTypeEnum.GET_TP.value() + "=" + tb;
|
|
|
|
|
|
|
|
} else if (content.contains(SmsTypeEnum.SET_PACKAGE.value())) {
|
|
|
|
|
|
|
|
restartType = 1;
|
|
|
|
|
|
|
|
String[] split1 = StringUtils.splitString1(content);
|
|
|
|
|
|
|
|
if (split1 != null && split1.length == 2) {
|
|
|
|
|
|
|
|
ifmessageCorrect = true;
|
|
|
|
|
|
|
|
String s = split1[1];
|
|
|
|
|
|
|
|
Integer integer = StringUtils.convert2Int(s);
|
|
|
|
|
|
|
|
UpdateSysConfigUtil.setPackage(context, integer);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
sendmessage = getSendString(content, ifmessageCorrect);
|
|
|
|
|
|
|
|
} else if (content.contains(SmsTypeEnum.GET_PACKAGE.value())) {
|
|
|
|
|
|
|
|
int aPackage = UpdateSysConfigUtil.getPackage(context);
|
|
|
|
|
|
|
|
sendmessage = SmsTypeEnum.GET_PACKAGE.value() + "=" + aPackage;
|
|
|
|
|
|
|
|
} else if (content.contains(SmsTypeEnum.CLEAR_PHOTO.value())) {
|
|
|
|
|
|
|
|
ifmessageCorrect = true;
|
|
|
|
|
|
|
|
UpdateSysConfigUtil.clearHistoryPic(context);
|
|
|
|
|
|
|
|
sendmessage = getSendString(content, ifmessageCorrect);
|
|
|
|
|
|
|
|
} else if (content.contains(SmsTypeEnum.CLEAR_LOG.value())) {
|
|
|
|
|
|
|
|
ifmessageCorrect = true;
|
|
|
|
|
|
|
|
UpdateSysConfigUtil.clearHistoryLogs(context);
|
|
|
|
|
|
|
|
sendmessage = getSendString(content, ifmessageCorrect);
|
|
|
|
|
|
|
|
} else if (content.contains(SmsTypeEnum.CLEAR_ALL.value())) {
|
|
|
|
|
|
|
|
ifmessageCorrect = true;
|
|
|
|
|
|
|
|
UpdateSysConfigUtil.clearHistoryPic(context);
|
|
|
|
|
|
|
|
UpdateSysConfigUtil.clearHistoryLogs(context);
|
|
|
|
|
|
|
|
sendmessage = getSendString(content, ifmessageCorrect);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sendSms(context, slot, sender, sendmessage, restartType);
|
|
|
|
|
|
|
|
|
|
|
|
// if (content.contains(SmsTypeEnum.REBOOT1.value())) {
|
|
|
|
|
|
|
|
// ifmessageCorrect = true;
|
|
|
|
|
|
|
|
// sendtype = SmsTypeEnum.REBOOT1.value();
|
|
|
|
|
|
|
|
// sendmessage = getSendString(content, ifmessageCorrect);
|
|
|
|
|
|
|
|
// } else if (content.contains(SmsTypeEnum.REBOOT2.value()) || content.contains(SmsTypeEnum.REBOOT3.value())) {
|
|
|
|
|
|
|
|
// ifmessageCorrect = true;
|
|
|
|
|
|
|
|
// sendtype = SmsTypeEnum.REBOOT2.value();
|
|
|
|
|
|
|
|
// sendmessage = getSendString(content, ifmessageCorrect);
|
|
|
|
|
|
|
|
// } else if (content.contains(SmsTypeEnum.RESTART_MP.value()) || content.contains(SmsTypeEnum.RESTART_MP2.value())) {
|
|
|
|
|
|
|
|
// ifmessageCorrect = true;
|
|
|
|
|
|
|
|
// sendtype = SmsTypeEnum.RESTART_MP.value();
|
|
|
|
|
|
|
|
// sendmessage = getSendString(content, ifmessageCorrect);
|
|
|
|
|
|
|
|
// } else if (content.contains(SmsTypeEnum.RESTART_MPMST.value()) || content.contains(SmsTypeEnum.RESTART_MPMST2.value())) {
|
|
|
|
|
|
|
|
// ifmessageCorrect = true;
|
|
|
|
|
|
|
|
// sendtype = SmsTypeEnum.RESTART_MPMST.value();
|
|
|
|
|
|
|
|
// sendmessage = getSendString(content, ifmessageCorrect);
|
|
|
|
|
|
|
|
// } else if (content.contains(SmsTypeEnum.RESTART_BOTH_APPS.value()) || content.contains(SmsTypeEnum.RESTART_BOTH_APPS2.value())) {
|
|
|
|
|
|
|
|
// ifmessageCorrect = true;
|
|
|
|
|
|
|
|
// sendtype = SmsTypeEnum.RESTART_BOTH_APPS.value();
|
|
|
|
|
|
|
|
// sendmessage = getSendString(content, ifmessageCorrect);
|
|
|
|
|
|
|
|
// } else if (content.contains(SmsTypeEnum.SET_YW_SCHEDULE.value())) {
|
|
|
|
|
|
|
|
// ifmessageCorrect = true;
|
|
|
|
|
|
|
|
// String[] split1 = StringUtils.splitString1(content);
|
|
|
|
|
|
|
|
// if (split1 != null && split1.length == 2) {
|
|
|
|
|
|
|
|
// String s = split1[1];
|
|
|
|
|
|
|
|
// String[] split2 = StringUtils.splitString2(s);
|
|
|
|
|
|
|
|
// int spilt2len = split2.length;
|
|
|
|
|
|
|
|
// if (split2 != null && spilt2len > 1 && spilt2len % 2 == 1) {
|
|
|
|
|
|
|
|
// String num = split2[0];
|
|
|
|
|
|
|
|
// Integer integer = StringUtils.convert2Int(num);
|
|
|
|
|
|
|
|
// if (integer != null) {
|
|
|
|
|
|
|
|
// if (integer == 0) {//删除所有运维
|
|
|
|
|
|
|
|
// ifmessageCorrect = true;
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// if (spilt2len == integer * 2 + 1) {
|
|
|
|
|
|
|
|
// int times = 0;
|
|
|
|
|
|
|
|
// for (int i = 0; i < spilt2len; i++) {
|
|
|
|
|
|
|
|
// if (i == 0) {
|
|
|
|
|
|
|
|
// continue;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// String ts = split2[i];
|
|
|
|
|
|
|
|
// Integer time = StringUtils.convert2Int(ts);
|
|
|
|
|
|
|
|
// if (i % 2 == 1) {
|
|
|
|
|
|
|
|
// if (time > 23) {
|
|
|
|
|
|
|
|
// ifmessageCorrect = false;
|
|
|
|
|
|
|
|
// break;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// times = time * 3600;
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// if (time > 59) {
|
|
|
|
|
|
|
|
// ifmessageCorrect = false;
|
|
|
|
|
|
|
|
// break;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// times += time * 60;
|
|
|
|
|
|
|
|
// abslist.add(times);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if (ifmessageCorrect) {
|
|
|
|
|
|
|
|
// UpdateSysConfigUtil.setAbsHeartbeats(context, abslist);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// sendtype = SmsTypeEnum.SET_YW_SCHEDULE.value();
|
|
|
|
|
|
|
|
// sendmessage = getSendString(content, ifmessageCorrect);
|
|
|
|
|
|
|
|
// } else if (content.contains(SmsTypeEnum.GET_YW_SCHEDULE.value())) {
|
|
|
|
|
|
|
|
// ifmessageCorrect = true;
|
|
|
|
|
|
|
|
// List<Integer> absHeartbeats = UpdateSysConfigUtil.getAbsHeartbeats(context);
|
|
|
|
|
|
|
|
// if (absHeartbeats == null || absHeartbeats.size() == 0) {
|
|
|
|
|
|
|
|
// sendmessage = SmsTypeEnum.GET_YW_SCHEDULE.value() + "=0";
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// int length = absHeartbeats.size();
|
|
|
|
|
|
|
|
// sendmessage = SmsTypeEnum.GET_YW_SCHEDULE.value() + "=" + length;
|
|
|
|
|
|
|
|
// for (int i = 0; i < length; i++) {
|
|
|
|
|
|
|
|
// int mAbsHeartbeatTime = 0;
|
|
|
|
|
|
|
|
// mAbsHeartbeatTime = absHeartbeats.get(i);
|
|
|
|
|
|
|
|
// int hour = mAbsHeartbeatTime / 3600;
|
|
|
|
|
|
|
|
// int minute = (mAbsHeartbeatTime % 3600) / 60;
|
|
|
|
|
|
|
|
// sendmessage += "," + hour + "," + minute;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// } else if (content.contains(SmsTypeEnum.SET_OPERATE.value())) {
|
|
|
|
|
|
|
|
// sendtype = SmsTypeEnum.SET_OPERATE.value();
|
|
|
|
|
|
|
|
// String[] split1 = StringUtils.splitString1(content);
|
|
|
|
|
|
|
|
// if (split1 != null && split1.length > 1) {
|
|
|
|
|
|
|
|
// String s = split1[1];
|
|
|
|
|
|
|
|
// Integer integer = StringUtils.convert2Int(s);
|
|
|
|
|
|
|
|
// if (integer != null) {
|
|
|
|
|
|
|
|
// if (integer == 0 || integer == 1) {
|
|
|
|
|
|
|
|
// ifmessageCorrect = true;
|
|
|
|
|
|
|
|
// UpdateSysConfigUtil.setMntnMode(context, integer);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// sendmessage = getSendString(content, ifmessageCorrect);
|
|
|
|
|
|
|
|
// } else if (content.contains(SmsTypeEnum.GET_OPERATE.value())) {
|
|
|
|
|
|
|
|
// sendtype = SmsTypeEnum.GET_OPERATE.value();
|
|
|
|
|
|
|
|
// ifmessageCorrect = true;
|
|
|
|
|
|
|
|
// int mntnMode = UpdateSysConfigUtil.getMntnMode(context);
|
|
|
|
|
|
|
|
// sendmessage = SmsTypeEnum.GET_OPERATE.value() + "=" + mntnMode;
|
|
|
|
|
|
|
|
// } else if (content.contains(SmsTypeEnum.SET_OPERATE_URL.value())) {
|
|
|
|
|
|
|
|
// sendtype = SmsTypeEnum.SET_OPERATE_URL.value();
|
|
|
|
|
|
|
|
// String[] split1 = StringUtils.splitString1(content);
|
|
|
|
|
|
|
|
// if (split1 != null && split1.length > 1) {
|
|
|
|
|
|
|
|
// String s = split1[1];
|
|
|
|
|
|
|
|
// String[] split2 = StringUtils.splitString2(s);
|
|
|
|
|
|
|
|
// if (split2 != null && split2.length >= 2) {
|
|
|
|
|
|
|
|
// String ipAddress = split2[0];
|
|
|
|
|
|
|
|
// String port = split2[1];
|
|
|
|
|
|
|
|
// boolean b = RegexUtil.checkIpAddress(ipAddress);
|
|
|
|
|
|
|
|
// if (b) {
|
|
|
|
|
|
|
|
// Integer integer = StringUtils.convert2Int(port);
|
|
|
|
|
|
|
|
// if (integer != null) {
|
|
|
|
|
|
|
|
// ifmessageCorrect = true;
|
|
|
|
|
|
|
|
// UpdateSysConfigUtil.setMntnServer(context, ipAddress, integer);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// sendmessage = getSendString(content, ifmessageCorrect);
|
|
|
|
|
|
|
|
// } else if (content.contains(SmsTypeEnum.GET_OPERATE_URL.value())) {
|
|
|
|
|
|
|
|
// sendtype = SmsTypeEnum.GET_OPERATE_URL.value();
|
|
|
|
|
|
|
|
// ifmessageCorrect = true;
|
|
|
|
|
|
|
|
// String mntnServer = UpdateSysConfigUtil.getMntnServer(context);
|
|
|
|
|
|
|
|
// sendmessage = SmsTypeEnum.GET_OPERATE_URL.value() + "=" + mntnServer;
|
|
|
|
|
|
|
|
// } else if (content.contains(SmsTypeEnum.UPDATE.value())) {
|
|
|
|
|
|
|
|
// sendtype = SmsTypeEnum.UPDATE.value();
|
|
|
|
|
|
|
|
// String[] split1 = StringUtils.splitString1(content);
|
|
|
|
|
|
|
|
// if (split1 != null && split1.length == 2) {
|
|
|
|
|
|
|
|
// ifmessageCorrect = true;
|
|
|
|
|
|
|
|
// String s = split1[1];
|
|
|
|
|
|
|
|
// DownloadUtils downloadUtils = new DownloadUtils(context.getApplicationContext(), s, "test.app");
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// sendmessage = getSendString(content, ifmessageCorrect);
|
|
|
|
|
|
|
|
// } else if (content.contains(SmsTypeEnum.SET_CMDID.value())) {
|
|
|
|
|
|
|
|
// sendtype = SmsTypeEnum.SET_CMDID.value();
|
|
|
|
|
|
|
|
// String[] split1 = StringUtils.splitString1(content);
|
|
|
|
|
|
|
|
// if (split1 != null && split1.length > 1) {
|
|
|
|
|
|
|
|
// ifmessageCorrect = true;
|
|
|
|
|
|
|
|
// String cmdid = split1[1];
|
|
|
|
|
|
|
|
// UpdateSysConfigUtil.setCmdid(context, cmdid);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// sendmessage = getSendString(content, ifmessageCorrect);
|
|
|
|
|
|
|
|
// } else if (content.contains(SmsTypeEnum.GET_CMDID.value())) {
|
|
|
|
|
|
|
|
// sendtype = SmsTypeEnum.GET_CMDID.value();
|
|
|
|
|
|
|
|
// ifmessageCorrect = true;
|
|
|
|
|
|
|
|
// String cmdid = UpdateSysConfigUtil.getCmdid(context);
|
|
|
|
|
|
|
|
// String serialNo = UpdateSysConfigUtil.getSerialNo();
|
|
|
|
|
|
|
|
// sendmessage = SmsTypeEnum.GET_CMDID.value() + "=" + serialNo + "," + cmdid;
|
|
|
|
|
|
|
|
// } else if (content.contains(SmsTypeEnum.SET_IP.value())) {
|
|
|
|
|
|
|
|
// sendtype = SmsTypeEnum.SET_IP.value();
|
|
|
|
|
|
|
|
// String[] split1 = StringUtils.splitString1(content);
|
|
|
|
|
|
|
|
// if (split1 != null && split1.length > 1) {
|
|
|
|
|
|
|
|
// String s = split1[1];
|
|
|
|
|
|
|
|
// String[] split2 = StringUtils.splitString2(s);
|
|
|
|
|
|
|
|
// if (split2 != null && (split2.length == 2 || split2.length == 4)) {
|
|
|
|
|
|
|
|
// String server;
|
|
|
|
|
|
|
|
// Integer integer;
|
|
|
|
|
|
|
|
// server = split2[0];
|
|
|
|
|
|
|
|
// String port = split2[1];
|
|
|
|
|
|
|
|
// integer = StringUtils.convert2Int(port);
|
|
|
|
|
|
|
|
// Integer utcp = -1;
|
|
|
|
|
|
|
|
// Integer encrypto = -1;
|
|
|
|
|
|
|
|
// if (integer != null) {
|
|
|
|
|
|
|
|
// ifmessageCorrect = true;
|
|
|
|
|
|
|
|
// if (split2.length == 4) {
|
|
|
|
|
|
|
|
// String s1 = split2[2];
|
|
|
|
|
|
|
|
// utcp = StringUtils.convert2Int(s1);
|
|
|
|
|
|
|
|
// utcp = getUtcp(utcp);
|
|
|
|
|
|
|
|
// String s2 = split2[3];
|
|
|
|
|
|
|
|
// encrypto = StringUtils.convert2Int(s2);
|
|
|
|
|
|
|
|
// encrypto = getEncrypto(encrypto);
|
|
|
|
|
|
|
|
// if (utcp == -1 || encrypto == -1) {
|
|
|
|
|
|
|
|
// ifmessageCorrect = false;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if (ifmessageCorrect) {
|
|
|
|
|
|
|
|
// UpdateSysConfigUtil.setIP(context, server, integer, utcp, encrypto);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// sendmessage = getSendString(content, ifmessageCorrect);
|
|
|
|
|
|
|
|
// } else if (content.contains(SmsTypeEnum.GET_IP.value())) {
|
|
|
|
|
|
|
|
// sendtype = SmsTypeEnum.GET_IP.value();
|
|
|
|
|
|
|
|
// ifmessageCorrect = true;
|
|
|
|
|
|
|
|
// String ip = UpdateSysConfigUtil.getIP(context);
|
|
|
|
|
|
|
|
// sendmessage = SmsTypeEnum.GET_IP.value() + "=" + ip;
|
|
|
|
|
|
|
|
// } else if (content.contains(SmsTypeEnum.SET_OSD.value())) {
|
|
|
|
|
|
|
|
// sendtype = SmsTypeEnum.SET_OSD.value();
|
|
|
|
|
|
|
|
// String[] split1 = StringUtils.splitString1(content);
|
|
|
|
|
|
|
|
// sendmessage = getSendString(content, ifmessageCorrect);
|
|
|
|
|
|
|
|
// if (split1 != null && split1.length == 2) {
|
|
|
|
|
|
|
|
// ifmessageCorrect = true;
|
|
|
|
|
|
|
|
// JSONObject osdmap = new JSONObject();
|
|
|
|
|
|
|
|
// String s = split1[1];
|
|
|
|
|
|
|
|
// String[] split2 = StringUtils.splitString2(s);
|
|
|
|
|
|
|
|
// int spilt2len = split2.length;
|
|
|
|
|
|
|
|
// if (split2 != null && spilt2len > 1 && spilt2len % 2 == 1) {
|
|
|
|
|
|
|
|
// String num = split2[0];
|
|
|
|
|
|
|
|
// Integer integer = StringUtils.convert2Int(num);
|
|
|
|
|
|
|
|
// if (integer != null) {
|
|
|
|
|
|
|
|
// for (int i = 0; i < spilt2len; i++) {
|
|
|
|
|
|
|
|
// if (i == 0) {
|
|
|
|
|
|
|
|
// continue;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if (i % 2 == 1) {
|
|
|
|
|
|
|
|
// if ((i + 1) <= spilt2len) {
|
|
|
|
|
|
|
|
// String s1 = split2[i];
|
|
|
|
|
|
|
|
// Integer position = StringUtils.convert2Int(s1);
|
|
|
|
|
|
|
|
// if (position != null) {
|
|
|
|
|
|
|
|
// try {
|
|
|
|
|
|
|
|
// if (position == 1) {
|
|
|
|
|
|
|
|
// osdmap.put(UpdateSysConfigUtil.leftTop, split2[i + 1]);
|
|
|
|
|
|
|
|
// } else if (position == 2) {
|
|
|
|
|
|
|
|
// osdmap.put(UpdateSysConfigUtil.rightTop, split2[i + 1]);
|
|
|
|
|
|
|
|
// } else if (position == 3) {
|
|
|
|
|
|
|
|
// osdmap.put(UpdateSysConfigUtil.leftBottom, split2[i + 1]);
|
|
|
|
|
|
|
|
// } else if (position == 4) {
|
|
|
|
|
|
|
|
// osdmap.put(UpdateSysConfigUtil.rightBottom, split2[i + 1]);
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// ifmessageCorrect = false;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// } catch (JSONException e) {
|
|
|
|
|
|
|
|
// throw new RuntimeException(e);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// ifmessageCorrect = false;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// ifmessageCorrect = false;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if (integer == 0) {//所有通道
|
|
|
|
|
|
|
|
// ifmessageCorrect = true;
|
|
|
|
|
|
|
|
// MicroPhotoContext.AppConfig mpAppConfig = MicroPhotoContext.getMpAppConfig(context);
|
|
|
|
|
|
|
|
// int channelnum = mpAppConfig.channels;
|
|
|
|
|
|
|
|
// if (channelnum != 0) {
|
|
|
|
|
|
|
|
// if (ifmessageCorrect) {
|
|
|
|
|
|
|
|
// for (int i = 1; i <= channelnum; i++) {
|
|
|
|
|
|
|
|
// UpdateSysConfigUtil.setChannelOSD(i, osdmap);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// if (ifmessageCorrect) {
|
|
|
|
|
|
|
|
// UpdateSysConfigUtil.setChannelOSD(integer, osdmap);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// } else if (content.contains(SmsTypeEnum.GET_OSD.value())) {
|
|
|
|
|
|
|
|
// sendtype = SmsTypeEnum.GET_OSD.value();
|
|
|
|
|
|
|
|
// String[] split = StringUtils.splitString1(content);
|
|
|
|
|
|
|
|
// if (split != null && split.length == 2) {
|
|
|
|
|
|
|
|
// sendmessage = SmsTypeEnum.GET_OSD.value() + "=";
|
|
|
|
|
|
|
|
// ifmessageCorrect = true;
|
|
|
|
|
|
|
|
// Integer channel = StringUtils.convert2Int(split[1]);
|
|
|
|
|
|
|
|
// if (channel != null) {
|
|
|
|
|
|
|
|
// if (channel == 0) {
|
|
|
|
|
|
|
|
// MicroPhotoContext.AppConfig mpAppConfig = MicroPhotoContext.getMpAppConfig(context);
|
|
|
|
|
|
|
|
// int channelnum = mpAppConfig.channels;
|
|
|
|
|
|
|
|
// if (channelnum != 0) {
|
|
|
|
|
|
|
|
// if (ifmessageCorrect) {
|
|
|
|
|
|
|
|
// for (int i = 1; i <= channelnum; i++) {
|
|
|
|
|
|
|
|
// sendmessage += channel + ":{";
|
|
|
|
|
|
|
|
// JSONObject channelOSD = UpdateSysConfigUtil.getChannelOSD(channel);
|
|
|
|
|
|
|
|
// if (channelOSD != null) {
|
|
|
|
|
|
|
|
// String leftTop = channelOSD.optString(UpdateSysConfigUtil.leftTop);
|
|
|
|
|
|
|
|
// String rightTop = channelOSD.optString(UpdateSysConfigUtil.rightTop);
|
|
|
|
|
|
|
|
// String leftBottom = channelOSD.optString(UpdateSysConfigUtil.leftBottom);
|
|
|
|
|
|
|
|
// String rightBottom = channelOSD.optString(UpdateSysConfigUtil.rightBottom);
|
|
|
|
|
|
|
|
// if (leftTop != null && StringUtils.isNotEmpty(leftTop)) {
|
|
|
|
|
|
|
|
// sendmessage += "左上:" + leftTop;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if (rightTop != null && StringUtils.isNotEmpty(rightTop)) {
|
|
|
|
|
|
|
|
// sendmessage += ",右上:" + rightTop;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if (leftBottom != null && StringUtils.isNotEmpty(leftBottom)) {
|
|
|
|
|
|
|
|
// sendmessage += ",左下:" + leftBottom;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if (rightBottom != null && StringUtils.isNotEmpty(rightBottom)) {
|
|
|
|
|
|
|
|
// sendmessage += ",右下:" + rightBottom;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// sendmessage += "无水印";
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if (i == channelnum) {
|
|
|
|
|
|
|
|
// sendmessage += channel + "}";
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// sendmessage += channel + "},";
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// JSONObject channelOSD = UpdateSysConfigUtil.getChannelOSD(channel);
|
|
|
|
|
|
|
|
// if (channelOSD != null) {
|
|
|
|
|
|
|
|
// String leftTop = channelOSD.optString(UpdateSysConfigUtil.leftTop);
|
|
|
|
|
|
|
|
// String rightTop = channelOSD.optString(UpdateSysConfigUtil.rightTop);
|
|
|
|
|
|
|
|
// String leftBottom = channelOSD.optString(UpdateSysConfigUtil.leftBottom);
|
|
|
|
|
|
|
|
// String rightBottom = channelOSD.optString(UpdateSysConfigUtil.rightBottom);
|
|
|
|
|
|
|
|
// if (leftTop != null && StringUtils.isNotEmpty(leftTop)) {
|
|
|
|
|
|
|
|
// sendmessage += "左上:" + leftTop;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if (rightTop != null && StringUtils.isNotEmpty(rightTop)) {
|
|
|
|
|
|
|
|
// sendmessage += ",右上:" + rightTop;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if (leftBottom != null && StringUtils.isNotEmpty(leftBottom)) {
|
|
|
|
|
|
|
|
// sendmessage += ",左下:" + leftBottom;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if (rightBottom != null && StringUtils.isNotEmpty(rightBottom)) {
|
|
|
|
|
|
|
|
// sendmessage += ",右下:" + rightBottom;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// sendmessage += "无水印";
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// ifmessageCorrect = false;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// } else if (content.contains(SmsTypeEnum.SET_PHOTO_SCHEDULE_LIST.value())) {
|
|
|
|
|
|
|
|
// sendtype = SmsTypeEnum.SET_PHOTO_SCHEDULE_LIST.value();
|
|
|
|
|
|
|
|
// String[] split1 = StringUtils.splitString1(content);
|
|
|
|
|
|
|
|
// if (split1 != null && split1.length > 1) {
|
|
|
|
|
|
|
|
// String s = split1[1];
|
|
|
|
|
|
|
|
// String[] split2 = StringUtils.splitString2(s);
|
|
|
|
|
|
|
|
// if (split2 != null && split2.length == 2) {
|
|
|
|
|
|
|
|
// Integer channel = StringUtils.convert2Int(split2[0]);
|
|
|
|
|
|
|
|
// if (channel != null) {
|
|
|
|
|
|
|
|
// ifmessageCorrect = true;
|
|
|
|
|
|
|
|
// String msg = split2[1];
|
|
|
|
|
|
|
|
// UpdateSysConfigUtil.setPhotoSchedules(channel, msg);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// sendmessage = getSendString(content, ifmessageCorrect);
|
|
|
|
|
|
|
|
// } else if (content.contains(SmsTypeEnum.GET_PHOTO_SCHEDULE_LIST.value())) {
|
|
|
|
|
|
|
|
// sendtype = SmsTypeEnum.GET_PHOTO_SCHEDULE_LIST.value();
|
|
|
|
|
|
|
|
// ifmessageCorrect = true;
|
|
|
|
|
|
|
|
// String[] split1 = StringUtils.splitString1(content);
|
|
|
|
|
|
|
|
// if (split1 != null && split1.length == 2) {
|
|
|
|
|
|
|
|
// Integer channel = StringUtils.convert2Int(split1[1]);
|
|
|
|
|
|
|
|
// String photoSchedules = UpdateSysConfigUtil.getPhotoSchedules(channel);
|
|
|
|
|
|
|
|
// sendmessage = SmsTypeEnum.GET_PHOTO_SCHEDULE_LIST.value() + "=" + photoSchedules;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// } else if (content.contains(SmsTypeEnum.SET_RESOLUTION.value())) {
|
|
|
|
|
|
|
|
// sendtype = SmsTypeEnum.SET_RESOLUTION.value();
|
|
|
|
|
|
|
|
// String[] split1 = StringUtils.splitString1(content);
|
|
|
|
|
|
|
|
// if (split1 != null && split1.length > 1) {
|
|
|
|
|
|
|
|
// String s = split1[1];
|
|
|
|
|
|
|
|
// String[] split2 = StringUtils.splitString1(s);
|
|
|
|
|
|
|
|
// if (split2 != null && split2.length == 5) {
|
|
|
|
|
|
|
|
// Integer channel = StringUtils.convert2Int(split2[0]);
|
|
|
|
|
|
|
|
// Integer resolutionCX = StringUtils.convert2Int(split2[1]);
|
|
|
|
|
|
|
|
// Integer resolutionCY = StringUtils.convert2Int(split2[2]);
|
|
|
|
|
|
|
|
// Integer videoCX = StringUtils.convert2Int(split2[3]);
|
|
|
|
|
|
|
|
// Integer videoCY = StringUtils.convert2Int(split2[4]);
|
|
|
|
|
|
|
|
// if (channel != null && resolutionCX != null && resolutionCY != null && videoCX != null && videoCY != null) {
|
|
|
|
|
|
|
|
// ifmessageCorrect = true;
|
|
|
|
|
|
|
|
// UpdateSysConfigUtil.setChannelResolution(channel, resolutionCX, resolutionCY, videoCX, videoCY);
|
|
|
|
|
|
|
|
// UpdateSysConfigUtil.restartApp(context);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// sendmessage = getSendString(content, ifmessageCorrect);
|
|
|
|
|
|
|
|
// } else if (content.contains(SmsTypeEnum.GET_RESOLUTION.value())) {
|
|
|
|
|
|
|
|
// sendtype = SmsTypeEnum.GET_RESOLUTION.value();
|
|
|
|
|
|
|
|
// ifmessageCorrect = true;
|
|
|
|
|
|
|
|
// String[] split = StringUtils.splitString1(content);
|
|
|
|
|
|
|
|
// Integer channel = StringUtils.convert2Int(split[0]);
|
|
|
|
|
|
|
|
// HashMap<String, Integer> hashMap = UpdateSysConfigUtil.getChannelResolution(channel);
|
|
|
|
|
|
|
|
// Integer resolutionCX = hashMap.get("resolutionCX");
|
|
|
|
|
|
|
|
// Integer resolutionCY = hashMap.get("resolutionCY");
|
|
|
|
|
|
|
|
// Integer videoCX = hashMap.get("videoCX");
|
|
|
|
|
|
|
|
// Integer videoCY = hashMap.get("videoCY");
|
|
|
|
|
|
|
|
// sendmessage = SmsTypeEnum.GET_RESOLUTION.value() + "=" + resolutionCX + "," + resolutionCY + "," + videoCX + "," + videoCY;
|
|
|
|
|
|
|
|
// } else if (content.contains(SmsTypeEnum.TAKE_PHOTO.value())) {
|
|
|
|
|
|
|
|
// sendtype = SmsTypeEnum.TAKE_PHOTO.value();
|
|
|
|
|
|
|
|
// ifmessageCorrect = true;
|
|
|
|
|
|
|
|
// String[] split = StringUtils.splitString1(content);
|
|
|
|
|
|
|
|
// if (split != null && split.length == 3) {
|
|
|
|
|
|
|
|
// ifmessageCorrect = true;
|
|
|
|
|
|
|
|
// Integer channel = StringUtils.convert2Int(split[0]);
|
|
|
|
|
|
|
|
// Integer preset = StringUtils.convert2Int(split[1]);
|
|
|
|
|
|
|
|
// Integer type = StringUtils.convert2Int(split[2]);
|
|
|
|
|
|
|
|
// if (channel != null) {
|
|
|
|
|
|
|
|
// boolean photoOrVideo;
|
|
|
|
|
|
|
|
// if (type == 0) {
|
|
|
|
|
|
|
|
// photoOrVideo = true;
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// photoOrVideo = false;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// UpdateSysConfigUtil.takePhotoOrVideo(context, channel, preset, photoOrVideo);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// sendmessage = getSendString(content, ifmessageCorrect);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// } else if (content.contains(SmsTypeEnum.SET_HEART.value())) {
|
|
|
|
|
|
|
|
// sendtype = SmsTypeEnum.SET_HEART.value();
|
|
|
|
|
|
|
|
// String[] split1 = StringUtils.splitString1(content);
|
|
|
|
|
|
|
|
// if (split1 != null && split1.length == 2) {
|
|
|
|
|
|
|
|
// ifmessageCorrect = true;
|
|
|
|
|
|
|
|
// String s = split1[1];
|
|
|
|
|
|
|
|
// Integer integer = StringUtils.convert2Int(s);
|
|
|
|
|
|
|
|
// UpdateSysConfigUtil.setHB(context, integer);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// sendmessage = getSendString(content, ifmessageCorrect);
|
|
|
|
|
|
|
|
// } else if (content.contains(SmsTypeEnum.GET_HEART.value())) {
|
|
|
|
|
|
|
|
// sendtype = SmsTypeEnum.GET_HEART.value();
|
|
|
|
|
|
|
|
// ifmessageCorrect = true;
|
|
|
|
|
|
|
|
// int hb = UpdateSysConfigUtil.getHB(context);
|
|
|
|
|
|
|
|
// sendmessage = SmsTypeEnum.GET_HEART.value() + "=" + hb;
|
|
|
|
|
|
|
|
// } else if (content.contains(SmsTypeEnum.SIMCARD.value())) {
|
|
|
|
|
|
|
|
// sendtype = SmsTypeEnum.SIMCARD.value();
|
|
|
|
|
|
|
|
// ifmessageCorrect = true;
|
|
|
|
|
|
|
|
// sendmessage = getSimcardInfo(context);
|
|
|
|
|
|
|
|
// } else if (content.contains(SmsTypeEnum.SET_AUTO_TIME.value())) {
|
|
|
|
|
|
|
|
// sendtype = SmsTypeEnum.SET_AUTO_TIME.value();
|
|
|
|
|
|
|
|
// ifmessageCorrect = true;
|
|
|
|
|
|
|
|
// sendmessage = setAutoTime(context, content);
|
|
|
|
|
|
|
|
// } else if (content.contains(SmsTypeEnum.UPD_CFG_FILE.value())) {
|
|
|
|
|
|
|
|
// sendtype = SmsTypeEnum.UPD_CFG_FILE.value();
|
|
|
|
|
|
|
|
// ifmessageCorrect = true;
|
|
|
|
|
|
|
|
// sendmessage = " OK";
|
|
|
|
|
|
|
|
// updateConfigFile(context, content);
|
|
|
|
|
|
|
|
// } else if (content.contains(SmsTypeEnum.GET_CFG_FILE.value())) {
|
|
|
|
|
|
|
|
// sendtype = SmsTypeEnum.GET_CFG_FILE.value();
|
|
|
|
|
|
|
|
// ifmessageCorrect = true;
|
|
|
|
|
|
|
|
// sendmessage = queryConfigFile(context, content);
|
|
|
|
|
|
|
|
// } else if (content.contains(SmsTypeEnum.SET_TP.value())) {
|
|
|
|
|
|
|
|
// sendtype = SmsTypeEnum.SET_TP.value();
|
|
|
|
|
|
|
|
// String[] split1 = StringUtils.splitString1(content);
|
|
|
|
|
|
|
|
// if (split1 != null && split1.length == 2) {
|
|
|
|
|
|
|
|
// ifmessageCorrect = true;
|
|
|
|
|
|
|
|
// String s = split1[1];
|
|
|
|
|
|
|
|
// Integer integer = StringUtils.convert2Int(s);
|
|
|
|
|
|
|
|
// UpdateSysConfigUtil.setTB(context, integer);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// sendmessage = getSendString(content, ifmessageCorrect);
|
|
|
|
|
|
|
|
// } else if (content.contains(SmsTypeEnum.GET_TP.value())) {
|
|
|
|
|
|
|
|
// sendtype = SmsTypeEnum.GET_TP.value();
|
|
|
|
|
|
|
|
// ifmessageCorrect = true;
|
|
|
|
|
|
|
|
// int tb = UpdateSysConfigUtil.getTB(context);
|
|
|
|
|
|
|
|
// sendmessage = SmsTypeEnum.GET_TP.value() + "=" + tb;
|
|
|
|
|
|
|
|
// } else if (content.contains(SmsTypeEnum.SET_PACKAGE.value())) {
|
|
|
|
|
|
|
|
// sendtype = SmsTypeEnum.SET_PACKAGE.value();
|
|
|
|
|
|
|
|
// String[] split1 = StringUtils.splitString1(content);
|
|
|
|
|
|
|
|
// if (split1 != null && split1.length == 2) {
|
|
|
|
|
|
|
|
// ifmessageCorrect = true;
|
|
|
|
|
|
|
|
// String s = split1[1];
|
|
|
|
|
|
|
|
// Integer integer = StringUtils.convert2Int(s);
|
|
|
|
|
|
|
|
// UpdateSysConfigUtil.setPackage(context, integer);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// sendmessage = getSendString(content, ifmessageCorrect);
|
|
|
|
|
|
|
|
// } else if (content.contains(SmsTypeEnum.GET_PACKAGE.value())) {
|
|
|
|
|
|
|
|
// sendtype = SmsTypeEnum.GET_PACKAGE.value();
|
|
|
|
|
|
|
|
// ifmessageCorrect = true;
|
|
|
|
|
|
|
|
// int aPackage = UpdateSysConfigUtil.getPackage(context);
|
|
|
|
|
|
|
|
// sendmessage = SmsTypeEnum.GET_PACKAGE.value() + "=" + aPackage;
|
|
|
|
|
|
|
|
// } else if (content.contains(SmsTypeEnum.CLEAR_PHOTO.value())) {
|
|
|
|
|
|
|
|
// sendtype = SmsTypeEnum.CLEAR_PHOTO.value();
|
|
|
|
|
|
|
|
// ifmessageCorrect = true;
|
|
|
|
|
|
|
|
// UpdateSysConfigUtil.clearHistoryPic(context);
|
|
|
|
|
|
|
|
// sendmessage = getSendString(content, ifmessageCorrect);
|
|
|
|
|
|
|
|
// } else if (content.contains(SmsTypeEnum.CLEAR_LOG.value())) {
|
|
|
|
|
|
|
|
// sendtype = SmsTypeEnum.CLEAR_LOG.value();
|
|
|
|
|
|
|
|
// ifmessageCorrect = true;
|
|
|
|
|
|
|
|
// UpdateSysConfigUtil.clearHistoryLogs(context);
|
|
|
|
|
|
|
|
// sendmessage = getSendString(content, ifmessageCorrect);
|
|
|
|
|
|
|
|
// } else if (content.contains(SmsTypeEnum.CLEAR_ALL.value())) {
|
|
|
|
|
|
|
|
// sendtype = SmsTypeEnum.CLEAR_ALL.value();
|
|
|
|
|
|
|
|
// ifmessageCorrect = true;
|
|
|
|
|
|
|
|
// UpdateSysConfigUtil.clearHistoryPic(context);
|
|
|
|
|
|
|
|
// UpdateSysConfigUtil.clearHistoryLogs(context);
|
|
|
|
|
|
|
|
// sendmessage = getSendString(content, ifmessageCorrect);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if (ifmessageCorrect) {
|
|
|
|
|
|
|
|
// sendSms(context, slot, sender, sendmessage, sendtype, ifmessageCorrect);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|