|
|
@ -68,6 +68,8 @@ public class SimUtil {
|
|
|
|
|
|
|
|
|
|
|
|
//短信解析
|
|
|
|
//短信解析
|
|
|
|
public static void analysisSMSInfo(final Context context, final Intent intent, final SmsMessage smsMessage) {
|
|
|
|
public static void analysisSMSInfo(final Context context, final Intent intent, final SmsMessage smsMessage) {
|
|
|
|
|
|
|
|
sendmessage = null;
|
|
|
|
|
|
|
|
restartType = -1;
|
|
|
|
SmsMessageModel smsInfo = getSMSInfo(intent, smsMessage);
|
|
|
|
SmsMessageModel smsInfo = getSMSInfo(intent, smsMessage);
|
|
|
|
if (smsInfo != null) {
|
|
|
|
if (smsInfo != null) {
|
|
|
|
String content = smsInfo.getContent();
|
|
|
|
String content = smsInfo.getContent();
|
|
|
@ -82,13 +84,13 @@ public class SimUtil {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (content.toLowerCase().contains(SmsTypeEnum.UPD_CFG_FILE.value().toLowerCase())) { //修改配置文件中参数
|
|
|
|
if (content.toLowerCase().contains(SmsTypeEnum.UPD_CFG_FILE.value().toLowerCase())) { //修改配置文件中参数
|
|
|
|
updateConfig(context, content);
|
|
|
|
updateConfig(content);
|
|
|
|
} else if (content.toLowerCase().contains(SmsTypeEnum.GET_CFG_FILE.value().toLowerCase())) {//获取配置文件中参数
|
|
|
|
} else if (content.toLowerCase().contains(SmsTypeEnum.GET_CFG_FILE.value().toLowerCase())) {//获取配置文件中参数
|
|
|
|
queryConfig(context, content);
|
|
|
|
queryConfig(content);
|
|
|
|
} else if (content.toLowerCase().contains(SmsTypeEnum.UPD_FILE.value().toLowerCase())) {//替换配置文件
|
|
|
|
} else if (content.toLowerCase().contains(SmsTypeEnum.UPD_FILE.value().toLowerCase())) {//替换配置文件
|
|
|
|
updateFile(context, content);
|
|
|
|
updateFile(content);
|
|
|
|
} else if (content.toLowerCase().contains(SmsTypeEnum.GET_FILE.value().toLowerCase())) {//获取整个配置文件
|
|
|
|
} else if (content.toLowerCase().contains(SmsTypeEnum.GET_FILE.value().toLowerCase())) {//获取整个配置文件
|
|
|
|
queryFile(context, content);
|
|
|
|
queryFile(content);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sendSms(context, slot, sender, sendmessage, restartType);
|
|
|
|
sendSms(context, slot, sender, sendmessage, restartType);
|
|
|
|
|
|
|
|
|
|
|
@ -807,7 +809,7 @@ public class SimUtil {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//修改配置文件中参数
|
|
|
|
//修改配置文件中参数
|
|
|
|
private static void updateConfig(Context context, String content) {
|
|
|
|
private static void updateConfig(String content) {
|
|
|
|
boolean ifmessageCorrect = true;
|
|
|
|
boolean ifmessageCorrect = true;
|
|
|
|
Map<String, String> fields = new HashMap<>();
|
|
|
|
Map<String, String> fields = new HashMap<>();
|
|
|
|
try {
|
|
|
|
try {
|
|
|
@ -840,7 +842,7 @@ public class SimUtil {
|
|
|
|
fields.put(key, value);
|
|
|
|
fields.put(key, value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
HashMap<String, String> hashMap = ValueTypeUtil.checkFilePathAndName(context, fileType);
|
|
|
|
HashMap<String, String> hashMap = ValueTypeUtil.checkFilePathAndName(fileType);
|
|
|
|
filePath = hashMap.get(UpdateSysConfigUtil.FILEPATH);
|
|
|
|
filePath = hashMap.get(UpdateSysConfigUtil.FILEPATH);
|
|
|
|
fileName = hashMap.get(UpdateSysConfigUtil.FILENAME);
|
|
|
|
fileName = hashMap.get(UpdateSysConfigUtil.FILENAME);
|
|
|
|
if (!TextUtils.isEmpty(filePath) && !TextUtils.isEmpty(fileName) && numberOfFields > 0) {
|
|
|
|
if (!TextUtils.isEmpty(filePath) && !TextUtils.isEmpty(fileName) && numberOfFields > 0) {
|
|
|
@ -892,7 +894,7 @@ public class SimUtil {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//替换配置文件
|
|
|
|
//替换配置文件
|
|
|
|
private static void updateFile(Context context, String content) {
|
|
|
|
private static void updateFile(String content) {
|
|
|
|
boolean ifmessageCorrect = true;
|
|
|
|
boolean ifmessageCorrect = true;
|
|
|
|
Map<String, String> fields = new HashMap<>();
|
|
|
|
Map<String, String> fields = new HashMap<>();
|
|
|
|
try {
|
|
|
|
try {
|
|
|
@ -925,7 +927,7 @@ public class SimUtil {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (StringUtils.isNotEmpty(fileStr)) {
|
|
|
|
if (StringUtils.isNotEmpty(fileStr)) {
|
|
|
|
if (StringUtils.isEmpty(filePath)) {
|
|
|
|
if (StringUtils.isEmpty(filePath)) {
|
|
|
|
HashMap<String, String> hashMap = ValueTypeUtil.checkFilePathAndName(context, fileType);
|
|
|
|
HashMap<String, String> hashMap = ValueTypeUtil.checkFilePathAndName(fileType);
|
|
|
|
filePath = hashMap.get(UpdateSysConfigUtil.FILEPATH);
|
|
|
|
filePath = hashMap.get(UpdateSysConfigUtil.FILEPATH);
|
|
|
|
fileName = hashMap.get(UpdateSysConfigUtil.FILENAME);
|
|
|
|
fileName = hashMap.get(UpdateSysConfigUtil.FILENAME);
|
|
|
|
if (StringUtils.isEmpty(filePath) || StringUtils.isEmpty(fileName)) {
|
|
|
|
if (StringUtils.isEmpty(filePath) || StringUtils.isEmpty(fileName)) {
|
|
|
@ -957,7 +959,7 @@ public class SimUtil {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//获取配置文件
|
|
|
|
//获取配置文件
|
|
|
|
private static void queryFile(Context context, String content) {
|
|
|
|
private static void queryFile(String content) {
|
|
|
|
boolean ifmessageCorrect = true;
|
|
|
|
boolean ifmessageCorrect = true;
|
|
|
|
String result = null;
|
|
|
|
String result = null;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
@ -985,7 +987,7 @@ public class SimUtil {
|
|
|
|
filePath = value;
|
|
|
|
filePath = value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
HashMap<String, String> hashMap = ValueTypeUtil.checkFilePathAndName(context, fileType);
|
|
|
|
HashMap<String, String> hashMap = ValueTypeUtil.checkFilePathAndName(fileType);
|
|
|
|
filePath = hashMap.get(UpdateSysConfigUtil.FILEPATH);
|
|
|
|
filePath = hashMap.get(UpdateSysConfigUtil.FILEPATH);
|
|
|
|
fileName = hashMap.get(UpdateSysConfigUtil.FILENAME);
|
|
|
|
fileName = hashMap.get(UpdateSysConfigUtil.FILENAME);
|
|
|
|
if (!TextUtils.isEmpty(filePath + fileName)) {
|
|
|
|
if (!TextUtils.isEmpty(filePath + fileName)) {
|
|
|
@ -1017,7 +1019,7 @@ public class SimUtil {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//获取配置文件参数
|
|
|
|
//获取配置文件参数
|
|
|
|
private static void queryConfig(Context context, String content) {
|
|
|
|
private static void queryConfig(String content) {
|
|
|
|
boolean ifmessageCorrect = true;
|
|
|
|
boolean ifmessageCorrect = true;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
String[] parts = StringUtils.splitStringByDh(content.substring(SmsTypeEnum.GET_CFG_FILE.value().length()));
|
|
|
|
String[] parts = StringUtils.splitStringByDh(content.substring(SmsTypeEnum.GET_CFG_FILE.value().length()));
|
|
|
@ -1049,7 +1051,7 @@ public class SimUtil {
|
|
|
|
fields.put(key, value);
|
|
|
|
fields.put(key, value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
HashMap<String, String> hashMap = ValueTypeUtil.checkFilePathAndName(context, fileType);
|
|
|
|
HashMap<String, String> hashMap = ValueTypeUtil.checkFilePathAndName(fileType);
|
|
|
|
filePath = hashMap.get(UpdateSysConfigUtil.FILEPATH);
|
|
|
|
filePath = hashMap.get(UpdateSysConfigUtil.FILEPATH);
|
|
|
|
fileName = hashMap.get(UpdateSysConfigUtil.FILENAME);
|
|
|
|
fileName = hashMap.get(UpdateSysConfigUtil.FILENAME);
|
|
|
|
|
|
|
|
|
|
|
|