运维时间表不返回修复
设置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.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);

@ -35,6 +35,7 @@ public class UpdateSysConfigUtil {
public static final String EXTRA_PARAM_TAKING_TIME = "TakingTime";
public static final String EXTRA_PARAM_TIME = "Time";
public static String osd = "osd";
public static String leftTop = "leftTop";
public static String rightTop = "rightTop";
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);
JSONObject jsonObject = JSONUtils.loadJson(path);
try {
jsonObject.put(UpdateSysConfigUtil.leftTop, hashMap.get(UpdateSysConfigUtil.leftTop));
jsonObject.put(UpdateSysConfigUtil.rightTop, hashMap.get(UpdateSysConfigUtil.rightTop));
jsonObject.put(UpdateSysConfigUtil.leftBottom, hashMap.get(UpdateSysConfigUtil.leftBottom));
jsonObject.put(UpdateSysConfigUtil.rightBottom, hashMap.get(UpdateSysConfigUtil.rightBottom));
jsonObject.put(UpdateSysConfigUtil.osd, osdjsonObject);
} catch (Exception ex) {
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<>();
JSONObject osdjsonObject = null;
String path = getChannelDir(channel);
JSONObject jsonObject = JSONUtils.loadJson(path);
try {
String leftTop = jsonObject.getString(UpdateSysConfigUtil.leftTop);
String rightTop = jsonObject.getString(UpdateSysConfigUtil.rightTop);
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);
if (jsonObject != null) {
osdjsonObject = jsonObject.getJSONObject(UpdateSysConfigUtil.osd);
}
} catch (Exception ex) {
ex.printStackTrace();
}
return hashMap;
return osdjsonObject;
}

Loading…
Cancel
Save