From: TrillGates Date: Tue, 27 Apr 2021 06:51:51 +0000 (+0800) Subject: completed alarm parse. X-Git-Url: http://git.snicker.com.cn/Users/apple/Desktop/static/gitweb.css?a=commitdiff_plain;h=282947d509906228251bbb4bd24c2ceb34fee18a;p=protocol_srv.git completed alarm parse. --- diff --git a/app/src/main/java/com/ic/protocols/protocol_anan.java b/app/src/main/java/com/ic/protocols/protocol_anan.java index 1675fdfd..97fdafa9 100644 --- a/app/src/main/java/com/ic/protocols/protocol_anan.java +++ b/app/src/main/java/com/ic/protocols/protocol_anan.java @@ -39,6 +39,7 @@ import java.util.Locale; import static com.enqualcomm.support.Constants.FROM_SERVER; import static com.enqualcomm.support.bean.Contact.GROUP_ALL; import static com.ic.protocols.protocol_anan.CMD_TYPE.AP32; +import static com.ic.protocols.protocol_anan.CMD_TYPE.BP75; import static com.ic.protocols.protocol_anan.CMD_TYPE.BPSW; import static java.lang.Math.abs; @@ -162,6 +163,7 @@ public class protocol_anan { BP31/*关机*/, BP32/*打电话*/, BP75/*设置闹钟*/, + AP75/*闹钟设置响应*/, BP14/* 下发电话本*/, BP44/* 休眠时间段*/, BP45/* 静音开关*/, @@ -218,6 +220,7 @@ public class protocol_anan { cmdMap.put(CMD_TYPE.AP16, "AP16"); cmdMap.put(CMD_TYPE.BP14, "BP14"); cmdMap.put(CMD_TYPE.BP07, "BP07"); + cmdMap.put(CMD_TYPE.AP75, "AP75"); cmdMap.put(CMD_TYPE.BP44, "BP44"); cmdMap.put(CMD_TYPE.BP45, "BP45"); cmdMap.put(CMD_TYPE.BP26, "BP26"); @@ -619,6 +622,62 @@ public class protocol_anan { ICLogger.d("收到定位开关.." + cmd); handleBPSW(cmd, mConnection); break; + case BP75: + ICLogger.d("收到闹钟设置指令..." + cmd); + handleBP75(cmd, mConnection); + break; + } + } + + private void handleBP75(String cmd, Connection mConnection) { + ICLogger.d("闹钟设置指令-===> " + cmd); + //闹钟设置指令-===> IWBP75,870314001009689,8861,0,6, + // 5403836f,0000,1234567, + // 1@5403836f,0000,1234567, + // 0@5403836f,0000,1234567, + // 0@559d6c34,0000,1234567, + // 0@559d6c34,0000,1234567, + // 0@559d6c34,0000,1234567,0 + + //对于以上数据,逆转来解析 + //每3个为一组,但是下一级从前一组的最后一个开始,包含最后一个 + String[] split = cmd.split(CMD_SPLIT); + try { + String imeiCode = split[1]; + String responseCode = split[2]; + String totalTrigger = split[3]; + String count = split[4]; + ICLogger.d("responseCode == > " + responseCode); + ICLogger.d("totalTrigger == > " + totalTrigger); + ICLogger.d("count == > " + count); + //闹钟数据解析 + int startIndex = split.length - 1; + int countValue = Integer.parseInt(count); + for (int i = 0; i < countValue; i++) { + //开关 + String sourceTrigger = split[startIndex].substring(0, 1); + //周期 + String cycle = split[startIndex - 1]; + String time = split[startIndex - 2]; + //标签unicode + String textCode = split[startIndex - 3]; + if (i != countValue - 1) { + textCode = textCode.substring(2); + } + ICLogger.d("sourceTrigger == > " + + sourceTrigger + " time == > " + + time + " cycle === > " + + cycle + " textCode => " + textCode); + startIndex -= 3; + } + //todo:闹钟入库 + mConnection.send( + genStringMessage(cmdMap.get(CMD_TYPE.AP75), + cmd.replace(cmdMap.get(BP75), cmdMap.get(CMD_TYPE.AP75)).replace(imeiCode + ",", "") + CMDEND) + ); + } catch (Exception e) { + e.printStackTrace(); + ICLogger.d("闹钟指令解析出错..."); } }