运维时间表不返回修复
设置CMD_ID不应答修复
设置主站IP端口返回的网络方式和加密方式不一致修复
水印查询和修改修复
设置心跳及连接协议修复
ndkvideo
liuguijing 4 months ago
parent a8c97d93e2
commit 650765e87d

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

@ -35,6 +35,7 @@ public class UpdateSysConfigUtil {
public static final String EXTRA_PARAM_TAKING_TIME = "TakingTime"; public static final String EXTRA_PARAM_TAKING_TIME = "TakingTime";
public static final String EXTRA_PARAM_TIME = "Time"; public static final String EXTRA_PARAM_TIME = "Time";
public static String osd = "osd";
public static String leftTop = "leftTop"; public static String leftTop = "leftTop";
public static String rightTop = "rightTop"; public static String rightTop = "rightTop";
public static String leftBottom = "leftBottom"; public static String leftBottom = "leftBottom";
@ -262,14 +263,11 @@ public class UpdateSysConfigUtil {
} }
//设置通道水印 //设置通道水印
public static boolean setChannelOSD(int channel, HashMap<String, String> hashMap) { public static boolean setChannelOSD(int channel, JSONObject osdjsonObject) {
String path = getChannelDir(channel); String path = getChannelDir(channel);
JSONObject jsonObject = JSONUtils.loadJson(path); JSONObject jsonObject = JSONUtils.loadJson(path);
try { try {
jsonObject.put(UpdateSysConfigUtil.leftTop, hashMap.get(UpdateSysConfigUtil.leftTop)); jsonObject.put(UpdateSysConfigUtil.osd, osdjsonObject);
jsonObject.put(UpdateSysConfigUtil.rightTop, hashMap.get(UpdateSysConfigUtil.rightTop));
jsonObject.put(UpdateSysConfigUtil.leftBottom, hashMap.get(UpdateSysConfigUtil.leftBottom));
jsonObject.put(UpdateSysConfigUtil.rightBottom, hashMap.get(UpdateSysConfigUtil.rightBottom));
} catch (Exception ex) { } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
} }
@ -277,23 +275,19 @@ public class UpdateSysConfigUtil {
} }
//查询通道分辨率 //查询通道分辨率
public static HashMap<String, String> getChannelOSD(int channel) { public static JSONObject getChannelOSD(int channel) {
HashMap<String, String> hashMap = new HashMap<>(); HashMap<String, String> hashMap = new HashMap<>();
JSONObject osdjsonObject = null;
String path = getChannelDir(channel); String path = getChannelDir(channel);
JSONObject jsonObject = JSONUtils.loadJson(path); JSONObject jsonObject = JSONUtils.loadJson(path);
try { try {
String leftTop = jsonObject.getString(UpdateSysConfigUtil.leftTop); if (jsonObject != null) {
String rightTop = jsonObject.getString(UpdateSysConfigUtil.rightTop); osdjsonObject = jsonObject.getJSONObject(UpdateSysConfigUtil.osd);
String leftBottom = jsonObject.getString(UpdateSysConfigUtil.leftBottom); }
String rightBottom = jsonObject.getString(UpdateSysConfigUtil.rightBottom);
hashMap.put(UpdateSysConfigUtil.leftTop, leftTop);
hashMap.put(UpdateSysConfigUtil.rightTop, rightTop);
hashMap.put(UpdateSysConfigUtil.leftBottom, leftBottom);
hashMap.put(UpdateSysConfigUtil.rightBottom, rightBottom);
} catch (Exception ex) { } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
} }
return hashMap; return osdjsonObject;
} }

Loading…
Cancel
Save