|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package com.xypower.mpmaster.sms;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import android.Manifest;
|
|
|
|
|
import android.app.Activity;
|
|
|
|
|
import android.app.PendingIntent;
|
|
|
|
@ -14,16 +15,11 @@ import android.telephony.SubscriptionInfo;
|
|
|
|
|
import android.telephony.SubscriptionManager;
|
|
|
|
|
import android.text.TextUtils;
|
|
|
|
|
|
|
|
|
|
import androidx.annotation.NonNull;
|
|
|
|
|
import androidx.core.app.ActivityCompat;
|
|
|
|
|
|
|
|
|
|
import com.dev.devapi.api.SysApi;
|
|
|
|
|
import com.xypower.common.RegexUtil;
|
|
|
|
|
|
|
|
|
|
import org.json.JSONArray;
|
|
|
|
|
import org.json.JSONException;
|
|
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.io.Serializable;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Date;
|
|
|
|
@ -43,8 +39,8 @@ public class SimUtil {
|
|
|
|
|
|
|
|
|
|
//自定义ACTION常数 作为广播的IntentFilter识别常数
|
|
|
|
|
public static String SMS_SEND_ACTION = "com.xypower.mpmaster.SMS_SEND_ACTION";
|
|
|
|
|
|
|
|
|
|
public static String SMSTYPE = "smstype";
|
|
|
|
|
public static String SMSDATA = "smsdata";
|
|
|
|
|
|
|
|
|
|
public static String SMSIFCORRECT = "smsifcorrect";
|
|
|
|
|
|
|
|
|
@ -195,7 +191,7 @@ public class SimUtil {
|
|
|
|
|
sendtype = SmsTypeEnum.GET_OPERATE_URL.value();
|
|
|
|
|
ifmessageCorrect = true;
|
|
|
|
|
String mntnServer = UpdateSysConfigUtil.getMntnServer(context);
|
|
|
|
|
sendmessage = SmsTypeEnum.GET_OPERATE_URL + "=" + mntnServer;
|
|
|
|
|
sendmessage = SmsTypeEnum.GET_OPERATE_URL.value() + "=" + mntnServer;
|
|
|
|
|
} else if (content.contains(SmsTypeEnum.UPDATE.value())) {
|
|
|
|
|
sendtype = SmsTypeEnum.UPDATE.value();
|
|
|
|
|
String[] split1 = StringUtils.splitString1(content);
|
|
|
|
@ -386,6 +382,7 @@ public class SimUtil {
|
|
|
|
|
if (channel != null && resolutionCX != null && resolutionCY != null && videoCX != null && videoCY != null) {
|
|
|
|
|
ifmessageCorrect = true;
|
|
|
|
|
UpdateSysConfigUtil.setChannelResolution(channel, resolutionCX, resolutionCY, videoCX, videoCY);
|
|
|
|
|
UpdateSysConfigUtil.restartApp(context);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -407,6 +404,12 @@ public class SimUtil {
|
|
|
|
|
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);
|
|
|
|
|
Integer channel = StringUtils.convert2Int(split[0]);
|
|
|
|
|
sendmessage = getSendString(content, ifmessageCorrect);
|
|
|
|
|
} else if (content.contains(SmsTypeEnum.SET_HEART.value())) {
|
|
|
|
|
sendtype = SmsTypeEnum.SET_HEART.value();
|
|
|
|
|
String[] split1 = StringUtils.splitString1(content);
|
|
|
|
@ -416,13 +419,7 @@ public class SimUtil {
|
|
|
|
|
Integer integer = StringUtils.convert2Int(s);
|
|
|
|
|
UpdateSysConfigUtil.setHB(context, integer);
|
|
|
|
|
}
|
|
|
|
|
String menssageBack = "";
|
|
|
|
|
if (ifmessageCorrect) {
|
|
|
|
|
menssageBack = " OK";
|
|
|
|
|
} else {
|
|
|
|
|
menssageBack = " ERROR";
|
|
|
|
|
}
|
|
|
|
|
sendmessage = content + menssageBack;
|
|
|
|
|
sendmessage = getSendString(content, ifmessageCorrect);
|
|
|
|
|
} else if (content.contains(SmsTypeEnum.GET_HEART.value())) {
|
|
|
|
|
sendtype = SmsTypeEnum.GET_HEART.value();
|
|
|
|
|
ifmessageCorrect = true;
|
|
|
|
@ -437,13 +434,7 @@ public class SimUtil {
|
|
|
|
|
Integer integer = StringUtils.convert2Int(s);
|
|
|
|
|
UpdateSysConfigUtil.setTB(context, integer);
|
|
|
|
|
}
|
|
|
|
|
String menssageBack = "";
|
|
|
|
|
if (ifmessageCorrect) {
|
|
|
|
|
menssageBack = " OK";
|
|
|
|
|
} else {
|
|
|
|
|
menssageBack = " ERROR";
|
|
|
|
|
}
|
|
|
|
|
sendmessage = content + menssageBack;
|
|
|
|
|
sendmessage = getSendString(content, ifmessageCorrect);
|
|
|
|
|
} else if (content.contains(SmsTypeEnum.GET_TP.value())) {
|
|
|
|
|
sendtype = SmsTypeEnum.GET_TP.value();
|
|
|
|
|
ifmessageCorrect = true;
|
|
|
|
@ -459,13 +450,7 @@ public class SimUtil {
|
|
|
|
|
Integer integer = StringUtils.convert2Int(s);
|
|
|
|
|
UpdateSysConfigUtil.setPackage(context, integer);
|
|
|
|
|
}
|
|
|
|
|
String menssageBack = "";
|
|
|
|
|
if (ifmessageCorrect) {
|
|
|
|
|
menssageBack = " OK";
|
|
|
|
|
} else {
|
|
|
|
|
menssageBack = " ERROR";
|
|
|
|
|
}
|
|
|
|
|
sendmessage = content + menssageBack;
|
|
|
|
|
sendmessage = getSendString(content, ifmessageCorrect);
|
|
|
|
|
} else if (content.contains(SmsTypeEnum.GET_PACKAGE.value())) {
|
|
|
|
|
sendtype = SmsTypeEnum.GET_PACKAGE.value();
|
|
|
|
|
ifmessageCorrect = true;
|
|
|
|
@ -511,6 +496,18 @@ public class SimUtil {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static String getSendString(String content, boolean ifmessageCorrect) {
|
|
|
|
|
String sendmessage;
|
|
|
|
|
String menssageBack = "";
|
|
|
|
|
if (ifmessageCorrect) {
|
|
|
|
|
menssageBack = " OK";
|
|
|
|
|
} else {
|
|
|
|
|
menssageBack = " ERROR";
|
|
|
|
|
}
|
|
|
|
|
sendmessage = content + menssageBack;
|
|
|
|
|
return sendmessage;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//短信解析
|
|
|
|
|
public static SmsMessageModel getSMSInfo(Intent intent) {
|
|
|
|
|
SmsMessageModel smsMessageModel = new SmsMessageModel();
|
|
|
|
|