修改了图片上传的指令内容.
authorTrillGates <williamtrillgates@gmail.com>
Thu, 17 Feb 2022 11:17:46 +0000 (19:17 +0800)
committerTrillGates <williamtrillgates@gmail.com>
Thu, 17 Feb 2022 11:17:46 +0000 (19:17 +0800)
app/release/ICSer_V951_2202171906_release.apk [moved from app/release/ICSer_V947_2201072010_release.apk with 77% similarity]
app/release/output.json
app/src/main/java/com/enqualcomm/support/service/Deliver.java
app/src/main/java/com/enqualcomm/support/utils/Util.java
app/src/main/java/com/ic/protocols/protocolAPIHelper.java
app/src/main/java/com/ic/protocols/protocol_beehome.java
app/src/main/java/com/ic/protocols/protocol_ic.java
app/version_code.properties

similarity index 77%
rename from app/release/ICSer_V947_2201072010_release.apk
rename to app/release/ICSer_V951_2202171906_release.apk
index e08b909..7f0461b 100644 (file)
Binary files a/app/release/ICSer_V947_2201072010_release.apk and b/app/release/ICSer_V951_2202171906_release.apk differ
index 465d093..1f73e6d 100644 (file)
@@ -1 +1 @@
-[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":947,"versionName":"2201072010","enabled":true,"outputFile":"ICSer_V947_2201072010_release.apk","fullName":"release","baseName":"release"},"path":"ICSer_V947_2201072010_release.apk","properties":{}}]
\ No newline at end of file
+[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":951,"versionName":"2202171906","enabled":true,"outputFile":"ICSer_V951_2202171906_release.apk","fullName":"release","baseName":"release"},"path":"ICSer_V951_2202171906_release.apk","properties":{}}]
\ No newline at end of file
index 9fdb160..d79a8d4 100644 (file)
@@ -417,6 +417,8 @@ public class Deliver extends AbstractConnectionService {
             //收到BP07 表示服务器收到一个voicePacket 分包成功,开始检查下一个包是否存在需要发送。
             //收到SentVoicePacket 表示 有一个VoiceMessage要发送,需要从第0个包开始发送语音分包。
             voicePacket voicepacket = voicePacket.getInstanceSent();
+            ICLogger.d("voicepacket.getPacketCount() ==> " + voicepacket.getPacketCount());
+            ICLogger.d("voicepacket.getCurrentIndexToSent() ==> " + voicepacket.getCurrentIndexToSent());
             if (voicepacket.getCurrentIndexToSent() < voicepacket.getPacketCount()) {
                 ICLogger.i("voicepacket " + voicepacket.getName()
                         + " filetype " + voicepacket.getFiletype()
@@ -472,7 +474,7 @@ public class Deliver extends AbstractConnectionService {
 
             //创建voiceConent并添加到数据
             final VoiceContent voiceContent = VoiceContent.placeHolderOut(CONTACT_CATEGORY_GROUP,
-                    "123", msgUrl, "0000", 2, 2);
+                    "123", "0000", msgUrl, 2, 2);
 
             // 把voiceContent拆解成1024的分包
             Util.parseToVoicePacketSent(voiceContent, 1024);
index 6ce2bfa..c509d69 100644 (file)
@@ -1104,10 +1104,10 @@ public class Util {
     public static boolean parseToVoicePacketSent(VoiceContent voiceContent, int packetSize) {
 
         long filesize;
+        ICLogger.d("voiceContent==> " + voiceContent);
         File voicefile = new File(voiceContent.content);
         if (voicefile.exists()) {
             filesize = voicefile.length();
-
             int count = (int) (filesize / packetSize);
             if ((filesize % packetSize) > 0)
                 count++;
index 1701074..b822d55 100644 (file)
@@ -710,7 +710,14 @@ public class protocolAPIHelper {
                 ret = protocol_jiai.AP07(packetTime, count, index, dataLen, amrData);
                 break;
             case Config.PROTOCOL_BEEHOME:
-                ret = protocol_beehome.AP07(packetTime, count, index, dataLen, amrData);
+                ICLogger.d("fileType ==> " + fileType);
+                ICLogger.d("dataType ==> " + dataType);
+                if (fileType == 1 && dataType == 3) {
+                    //对讲用的类型
+                    ret = protocol_beehome.AP07(packetTime, count, index, dataLen, amrData);
+                } else {
+                    ret = protocol_beehome.AP42(packetTime, count, index, dataLen, amrData);
+                }
                 break;
             case Config.PROTOCOL_IC:
                 /***
index c18f162..d3a100a 100644 (file)
@@ -67,6 +67,21 @@ public class protocol_beehome {
     private Handler mHandler = null;
 
 
+    public static byte[] AP42(String packetTime, int count, int index, int datalen, byte[] amrdata) {
+        String sb = new StringBuffer(CMDHEADER).append(cmdStrMap.get(CMD_TYPE.AP42))
+                .append(CMDSPLIT).append(packetTime)
+                .append(CMDSPLIT).append(count)
+                .append(CMDSPLIT).append(index)
+                .append(CMDSPLIT).append(datalen * 2)
+                .append(CMDSPLIT).toString();
+        byte[] sentbuf = new byte[sb.length() + datalen * 2 + 1];
+        byte[] amrdata2 = Util.bytesToHexString(amrdata).getBytes();
+        System.arraycopy(sb.getBytes(), 0, sentbuf, 0, sb.length());
+        System.arraycopy(amrdata2, 0, sentbuf, sb.length(), datalen * 2);
+        sentbuf[sb.length() + datalen * 2] = '#';
+        return sentbuf;
+    }
+
     /**
      * 解析测试指令
      *
@@ -205,6 +220,8 @@ public class protocol_beehome {
         AP75,//闹钟数据回复
         AP46,//立即拍照
         BP46,
+        AP42,//图片上传
+        BP42,
     }
 
     private static HashMap<CMD_TYPE, String> cmdStrMap = null;
@@ -308,6 +325,8 @@ public class protocol_beehome {
         cmdStrMap.put(CMD_TYPE.AP75, "AP75");
         cmdStrMap.put(CMD_TYPE.AP46, "AP46");
         cmdStrMap.put(CMD_TYPE.BP46, "BP46");
+        cmdStrMap.put(CMD_TYPE.AP42, "AP42");
+        cmdStrMap.put(CMD_TYPE.BP42, "BP42");
         //
         cmdMap = new HashMap<>();
         cmdMap.put("AP00", CMD_TYPE.AP00);
@@ -404,6 +423,8 @@ public class protocol_beehome {
         cmdMap.put("BP75", CMD_TYPE.BP75);
         cmdMap.put("BP46", CMD_TYPE.BP46);
         cmdMap.put("AP46", CMD_TYPE.AP46);
+        cmdMap.put("BP42", CMD_TYPE.BP42);
+        cmdMap.put("AP42", CMD_TYPE.AP42);
     }
 
 
@@ -529,6 +550,43 @@ public class protocol_beehome {
         return ret;
     }
 
+
+    public void handleBP42(String cmd, Connection connection) {
+        /***
+         * 平台响应
+         * IWBP42,20140818064408,6,1,1#
+         * IW:标识符
+         * BP42 : 命令字符
+         * 20220217174924:语音图片文字目标
+         * 11:内容总包数
+         * 1:当前包序号
+         */
+        String[] cmdlist = cmd.split(CMDSPLIT);
+        if (cmdlist.length == 5) {
+            try {
+                String time = cmdlist[1];
+                String count = cmdlist[2];
+                String index = cmdlist[3];
+                String success = cmdlist[4];
+                int packetCount = Integer.parseInt(count);
+                int packetIndex = Integer.parseInt(index);
+                ICLogger.d("是否成功===>" + success);
+                ICLogger.i("服务器在收到 index " + time + " " + packetIndex + "/" + packetCount);
+                //如果服务器接收 语音成功,则设置下一个要发送的语音包Index,当index == packetCount的时候表示所有包发送完毕,停止继续发送
+                if ("1".equals(success)) {
+                    voicePacket.getInstanceSent().setCurrentIndexToSent(packetIndex);
+                    //voicePacket.getInstanceSent().setFileType(ftype,dtype);
+                }
+                //发送消息,再次检查要发送的语音包,确认其发送完毕
+                connection.DeliverCMDMessageToSystem("SentVoicePacket", "SentBPFilePacket");
+            } catch (Exception e) {
+                ICLogger.e(e.getMessage(), e);
+            }
+        } else {
+            ICLogger.i(" BPTU Format error!");
+        }
+    }
+
     public int getBP28Amrlen(String cmd) {
 
         String Name;
@@ -2725,13 +2783,12 @@ public class protocol_beehome {
         } else {
             ICLogger.i(" BP46 Format error!");
         }
-
     }
 
 
     public static StringMessage AP46(String id, String cmd) {
         return genStringMessage(cmdStrMap.get(CMD_TYPE.AP46),
-                new StringBuffer(CMDHEADER).append(cmdMap.get(CMD_TYPE.AP46))
+                new StringBuffer(CMDHEADER).append(cmdStrMap.get(CMD_TYPE.AP46))
                         .append(CMDSPLIT).append(id)
                         .append(CMDSPLIT).append(cmd)
                         .append(CMDEND).toString());
@@ -2994,6 +3051,9 @@ public class protocol_beehome {
                 ICLogger.i("立即拍照!");
                 handleBP46(cmd, mConnection, mRuntime);
                 break;
+            case BP42:
+                handleBP42(cmd, mConnection);
+                break;
 
         }
         return ret;
index c4443bd..4804cfb 100644 (file)
@@ -2259,19 +2259,19 @@ public class protocol_ic {
 
 
     public void handleBPTU(String cmd, Connection connection) {
-/***
- * 平台响应
- * IWBPTU,6654111,080835,1,1,6,1,1#
- * IW:标识符
- * APCU : 命令字符
- * 6654111:语音图片文字目标
- * 080835 :流水号
- * 1:文件类型
- * 1:内容类型
- * 6:内容总包数
- * 1:当前包序号
- * 1:成功 (0:失败)
- */
+        /***
+         * 平台响应
+         * IWBPTU,6654111,080835,1,1,6,1,1#
+         * IW:标识符
+         * APCU : 命令字符
+         * 6654111:语音图片文字目标
+         * 080835 :流水号
+         * 1:文件类型
+         * 1:内容类型
+         * 6:内容总包数
+         * 1:当前包序号
+         * 1:成功 (0:失败)
+         */
         String[] cmdlist = cmd.split(CMDSPLIT);
         if (cmdlist.length == 8) {
             try {
index 50d9cd6..c9b1058 100644 (file)
@@ -1,2 +1,2 @@
-#Fri Jan 07 20:10:29 CST 2022\r
-VERSION_CODE=947\r
+#Thu Feb 17 19:06:03 CST 2022\r
+VERSION_CODE=951\r