From: TrillGates Date: Fri, 6 Aug 2021 13:17:20 +0000 (+0800) Subject: fixed some feild change error. X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=7724d81a3a986208353c2be6a84a297e0acbdff4;p=icsupport.git fixed some feild change error. --- diff --git a/app/src/main/java/com/ic/protocols/protocol_s123.java b/app/src/main/java/com/ic/protocols/protocol_s123.java index a1dc000f..3a49cd5a 100644 --- a/app/src/main/java/com/ic/protocols/protocol_s123.java +++ b/app/src/main/java/com/ic/protocols/protocol_s123.java @@ -1094,13 +1094,13 @@ public class protocol_s123 { } public void handleBP31(Connection connection, String cmd) { - - // IWBP31,867155030001063,161723 + //IWBP31,353456789012345,080835# + //IWBP31,867155030001063,161723 String[] cmdlist = cmd.split(CMDSPLIT); if (cmdlist.length == 3) { - connection.send(AP31(cmdlist[2])); - + } else { + ICLogger.d("parse error..."); } } @@ -1471,22 +1471,23 @@ public class protocol_s123 { //IWAP33,080835,1# //080835:指令流水号 //1:设置信息,供服务器同步 - return genStringMessage("AP33", new StringBuffer(CMDHEADER).append(cmdMap.get(CMD_TYPE.AP33)) - .append(CMDSPLIT).append(cmdindex) - .append(CMDSPLIT).append(workMode) - .append(CMDEND).toString()); + return genStringMessage("AP33", + new StringBuffer(CMDHEADER) + .append(cmdMap.get(CMD_TYPE.AP33)) + .append(CMDSPLIT).append(cmdindex) + .append(CMDSPLIT).append(workMode) + .append(CMDSPLIT).append() + .append(CMDEND).toString()); } //设置工作模式 public void handleBP33(Connection connection, Runtime runtime, String cmd) { - -// IWBP33,867155030001063,560555,1 -// IW:标识符 -// BP33 : 命令字符 -// 353456789012345:IMEI号,设备唯一ID -// 080835:指令流水号 -// 1:设备工作模式,1:正常模式,2:省电模式,3:紧急模式 - + //IWBP33,867155030001063,560555,1 + //IW:标识符 + //BP33 : 命令字符 + //353456789012345:IMEI号,设备唯一ID + //080835:指令流水号 + //1:设备工作模式,1:正常模式,2:省电模式,3:紧急模式 String[] cmdlist = cmd.split(","); if (cmdlist.length == 4) { log("com.ic.work mode " + cmdlist[3]); @@ -1506,7 +1507,6 @@ public class protocol_s123 { break; } - StringMessage msg = AP33(cmdlist[2], mod); //设定当前工作模式及循环频率 connection.send(msg); @@ -1791,9 +1791,10 @@ public class protocol_s123 { public static StringMessage AP15(String index) { //IWAP15, 080835# //080835:指令流水号 - return genStringMessage("AP15", new StringBuffer(CMDHEADER).append(cmdMap.get(CMD_TYPE.AP15)) - .append(CMDSPLIT).append(index) - .append(CMDEND).toString()); + return genStringMessage("AP15", + new StringBuffer(CMDHEADER).append(cmdMap.get(CMD_TYPE.AP15)) + .append(CMDSPLIT).append(index) + .append(CMDEND).toString()); } //设置定位周期 @@ -1804,13 +1805,11 @@ public class protocol_s123 { // 30: 表示频率为30分钟 String[] list = cmd.split(CMDSPLIT); - if (list.length == 4) { String index = list[2]; String time = list[3]; connection.send(AP15(index)); ICLogger.i("BP15 , 定位周期=" + time + "秒"); - try { Config.setLocationMode(runtime.getContextProxy().context, ICLocation.CUSTOM_MOD8_GPS); Config.setLocationCycle(runtime.getContextProxy().context, Integer.parseInt(time)); @@ -1940,10 +1939,11 @@ public class protocol_s123 { //设备响应: IWAP80,080835,1# //080835:指令流水号 //1:表示设备执行成功,0 表示设备执行失败 - return genStringMessage("AP84", new StringBuffer(CMDHEADER).append(cmdMap.get(CMD_TYPE.AP84)) - .append(CMDSPLIT).append(index) - .append(CMDSPLIT).append(success) - .append(CMDEND).toString()); + return genStringMessage("AP84", + new StringBuffer(CMDHEADER).append(cmdMap.get(CMD_TYPE.AP84)) + .append(CMDSPLIT).append(index) + .append(CMDSPLIT).append(success) + .append(CMDEND).toString()); } public void handleBP84(String cmd, Connection connection) { @@ -1956,21 +1956,17 @@ public class protocol_s123 { //080835 :指令流水号 //1: 表示白名单开,0 表示白名单关 String[] list = cmd.split(CMDSPLIT); - if (list.length == 4) { String index = list[2]; String whitelist_switch = list[3]; connection.send(AP84(index, 1)); - if (whitelist_switch.equals("1")) { Util.setSystemProperties("persist.sys.whitelist.enable", "true"); } else { Util.setSystemProperties("persist.sys.whitelist.enable", "false"); } ICLogger.i("收到服务器指令:白名单" + (whitelist_switch.equals("1") ? "开" : "关")); - } else { - ICLogger.i("BP84 format error!"); } @@ -2220,14 +2216,13 @@ public class protocol_s123 { //体温间隔测量 (后台测试体温)(下行协议号:BPTE,响应:APTE) - public static StringMessage APTE(String index, int freq) { + public static StringMessage APTE(String index) { //设备响应: IWAPTE,080835,60# //080835:指令流水号 //1:表示设备接受数据成功,0表示设备接受数据失败 return genStringMessage("APTE", new StringBuffer(CMDHEADER).append(cmdMap.get(CMD_TYPE.APTE)) .append(CMDSPLIT).append(index) - .append(CMDSPLIT).append(freq) .append(CMDEND).toString()); } @@ -2524,9 +2519,10 @@ public class protocol_s123 { } public static StringMessage APDG(String id) { - return genStringMessage("APDG", new StringBuffer(CMDHEADER).append(cmdMap.get(CMD_TYPE.APDG)) - .append(CMDSPLIT).append(id) - .append(CMDEND).toString()); + return genStringMessage("APDG", + new StringBuffer(CMDHEADER).append(cmdMap.get(CMD_TYPE.APDG)) + .append(CMDSPLIT).append(id) + .append(CMDEND).toString()); } public void handleBPDG(Connection connection, String cmd, Runtime runtime) { @@ -2544,13 +2540,16 @@ public class protocol_s123 { * #:结尾标识符 * */ String[] list = cmd.split(CMDSPLIT); - if (list.length == 6) { - + if (list.length == 8) { try { String index = list[2]; String switch_on = list[3]; String min_temp = list[4]; String max_temp = list[5]; + String minWorkTemp = list[6]; + String maxWorkTemp = list[7]; + ICLogger.d("minWorkTemp ==> " + minWorkTemp); + ICLogger.d("maxWorkTemp ==> " + maxWorkTemp); connection.send(APDG(index)); if (Integer.parseInt(switch_on) == 1) { ICLogger.i("Handle BPDG index " + index + ", 体温报警阈值开 min="