|
|
|
@ -35,6 +35,9 @@ import com.xypower.common.NetworkUtils;
|
|
|
|
|
import com.xypower.common.RegexUtil;
|
|
|
|
|
import com.xypower.mpmaster.MpMasterService;
|
|
|
|
|
|
|
|
|
|
import org.json.JSONException;
|
|
|
|
|
import org.json.JSONObject;
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
@ -129,13 +132,13 @@ public class SimUtil {
|
|
|
|
|
ifmessageCorrect = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
times = time * 60;
|
|
|
|
|
times = time * 3600;
|
|
|
|
|
} else {
|
|
|
|
|
if (time > 59) {
|
|
|
|
|
ifmessageCorrect = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
times += time;
|
|
|
|
|
times += time * 60;
|
|
|
|
|
abslist.add(times);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -160,8 +163,8 @@ public class SimUtil {
|
|
|
|
|
for (int i = 0; i < length; i++) {
|
|
|
|
|
int mAbsHeartbeatTime = 0;
|
|
|
|
|
mAbsHeartbeatTime = absHeartbeats.get(i);
|
|
|
|
|
int hour = mAbsHeartbeatTime / 60;
|
|
|
|
|
int minute = mAbsHeartbeatTime % 60;
|
|
|
|
|
int hour = mAbsHeartbeatTime / 3600;
|
|
|
|
|
int minute = (mAbsHeartbeatTime % 3600) / 60;
|
|
|
|
|
sendmessage += "," + hour + "," + minute;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -224,7 +227,7 @@ public class SimUtil {
|
|
|
|
|
if (split1 != null && split1.length > 1) {
|
|
|
|
|
ifmessageCorrect = true;
|
|
|
|
|
String cmdid = split1[1];
|
|
|
|
|
UpdateSysConfigUtil.setCmdid(context, cmdid); //
|
|
|
|
|
UpdateSysConfigUtil.setCmdid(context, cmdid);
|
|
|
|
|
}
|
|
|
|
|
sendmessage = getSendString(content, ifmessageCorrect);
|
|
|
|
|
} else if (content.contains(SmsTypeEnum.GET_CMDID.value())) {
|
|
|
|
@ -278,7 +281,7 @@ public class SimUtil {
|
|
|
|
|
sendmessage = getSendString(content, ifmessageCorrect);
|
|
|
|
|
if (split1 != null && split1.length == 2) {
|
|
|
|
|
ifmessageCorrect = true;
|
|
|
|
|
HashMap<String, String> osdmap = new HashMap<>();
|
|
|
|
|
JSONObject osdmap = new JSONObject();
|
|
|
|
|
String s = split1[1];
|
|
|
|
|
String[] split2 = StringUtils.splitString2(s);
|
|
|
|
|
int spilt2len = split2.length;
|
|
|
|
@ -295,6 +298,7 @@ public class SimUtil {
|
|
|
|
|
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) {
|
|
|
|
@ -306,6 +310,9 @@ public class SimUtil {
|
|
|
|
|
} else {
|
|
|
|
|
ifmessageCorrect = false;
|
|
|
|
|
}
|
|
|
|
|
} catch (JSONException e) {
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
ifmessageCorrect = false;
|
|
|
|
|
}
|
|
|
|
@ -340,23 +347,70 @@ public class SimUtil {
|
|
|
|
|
if (split != null && split.length == 2) {
|
|
|
|
|
sendmessage = SmsTypeEnum.GET_OSD.value() + "=";
|
|
|
|
|
ifmessageCorrect = true;
|
|
|
|
|
Integer channel = StringUtils.convert2Int(split[0]);
|
|
|
|
|
HashMap<String, String> channelOSD = UpdateSysConfigUtil.getChannelOSD(channel);
|
|
|
|
|
String leftTop = channelOSD.get(UpdateSysConfigUtil.leftTop);
|
|
|
|
|
String rightTop = channelOSD.get(UpdateSysConfigUtil.rightTop);
|
|
|
|
|
String leftBottom = channelOSD.get(UpdateSysConfigUtil.leftBottom);
|
|
|
|
|
String rightBottom = channelOSD.get(UpdateSysConfigUtil.rightBottom);
|
|
|
|
|
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 += "1," + leftTop;
|
|
|
|
|
sendmessage += "左上:" + leftTop;
|
|
|
|
|
}
|
|
|
|
|
if (rightTop != null && StringUtils.isNotEmpty(rightTop)) {
|
|
|
|
|
sendmessage += "2," + rightTop;
|
|
|
|
|
sendmessage += ",右上:" + rightTop;
|
|
|
|
|
}
|
|
|
|
|
if (leftBottom != null && StringUtils.isNotEmpty(leftBottom)) {
|
|
|
|
|
sendmessage += "3" + leftBottom;
|
|
|
|
|
sendmessage += ",左下:" + leftBottom;
|
|
|
|
|
}
|
|
|
|
|
if (rightBottom != null && StringUtils.isNotEmpty(rightBottom)) {
|
|
|
|
|
sendmessage += "4," + leftTop;
|
|
|
|
|
sendmessage += ",右下:" + rightBottom;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
sendmessage += "无水印";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
ifmessageCorrect = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if (content.contains(SmsTypeEnum.SET_PHOTO_SCHEDULE_LIST.value())) {
|
|
|
|
@ -661,8 +715,7 @@ public class SimUtil {
|
|
|
|
|
if (TextUtils.equals(value, "on")) {
|
|
|
|
|
onOff = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (TextUtils.equals(key, "type")) {
|
|
|
|
|
} else if (TextUtils.equals(key, "type")) {
|
|
|
|
|
if (TextUtils.equals(value, "net")) {
|
|
|
|
|
autoTimeType = 1;
|
|
|
|
|
} else if (TextUtils.equals(value, "gps")) {
|
|
|
|
@ -1008,7 +1061,7 @@ public class SimUtil {
|
|
|
|
|
Integer intVal = (Integer) value;
|
|
|
|
|
slot = intVal.intValue();
|
|
|
|
|
} else if (value instanceof String) {
|
|
|
|
|
String str = (String)value;
|
|
|
|
|
String str = (String) value;
|
|
|
|
|
if (str.equals("0") | str.equals("1") | str.equals("2")) {
|
|
|
|
|
// slot = bundle.getInt(key, -1);
|
|
|
|
|
slot = Integer.parseInt(str);
|
|
|
|
@ -1057,7 +1110,7 @@ public class SimUtil {
|
|
|
|
|
ArrayList<String> msgs = smsManager.divideMessage(message);
|
|
|
|
|
ArrayList<PendingIntent> sentIntents = new ArrayList<PendingIntent>();
|
|
|
|
|
|
|
|
|
|
for(int i = 0;i < msgs.size(); i++){
|
|
|
|
|
for (int i = 0; i < msgs.size(); i++) {
|
|
|
|
|
sentIntents.add(sendPI);
|
|
|
|
|
}
|
|
|
|
|
smsManager.sendMultipartTextMessage(sender, null, msgs, sentIntents, null);
|
|
|
|
|