2 Commits dddb42a59b ... 7419d6f470

Author SHA1 Message Date
  jochu 7419d6f470 修改报错 5 years ago
  jochu 98a61146bc 添加下载程序的部分 5 years ago
1 changed files with 14 additions and 3 deletions
  1. 14 3
      NB_IOT_UDP_HP_SCOKET/WWKJUtil/ProtocolAnalysisTools.cs

+ 14 - 3
NB_IOT_UDP_HP_SCOKET/WWKJUtil/ProtocolAnalysisTools.cs

@@ -1148,7 +1148,7 @@ namespace NB_IOT_UDP_HP_SCOKET.WWKJUtil
         /// </summary>
         /// <param name="cmdType">命令类型</param>
         /// <param name="mAddr">水表表地址</param>
-        /// <param name="arr">要传进的参数 参数的顺序按照 文档的字段 顺序</param>
+        /// <param name="arr">要传进的参数 参数的顺序按照 文档的字段 顺序(从14字节开始)</param>
         /// <returns></returns>
         public static string PackToStr(CmdType cmdType, string mAddr,params object[] arr)
         {
@@ -1160,7 +1160,8 @@ namespace NB_IOT_UDP_HP_SCOKET.WWKJUtil
             info.CmdType = cmdType;
             byte[] data = null,tempArr = null,timeArr = null;
             string newAddress = null;
-
+            // 下载程序 
+            int totalLen = 0, totalNum = 0, numLen = 0, passwd = 0;//总长度 
             #endregion
 
             try
@@ -1279,6 +1280,7 @@ namespace NB_IOT_UDP_HP_SCOKET.WWKJUtil
                         if(arr.Length == 1)
                         {
                             info.BSendArr = IsIntOrDecimalToByteArray(arr[0].ToString());
+                            data = Pack(info);
                         }
                         break;
                     case CmdType.WriteAllParam:
@@ -1298,7 +1300,16 @@ namespace NB_IOT_UDP_HP_SCOKET.WWKJUtil
                         break;
                     case CmdType.ClearHistory:
                         break;
-                    case CmdType.Send_Update:
+                    case CmdType.Send_Update: // 启动下载程序功能
+                        if (arr.Length == 4)
+                        {
+                            totalLen = Convert.ToInt32(arr[0]);
+                            totalNum = Convert.ToInt32(arr[1]);
+                            numLen = Convert.ToInt32(arr[2]);
+                            passwd = Convert.ToInt32(arr[3]);
+                            info.BSendArr = IsIntOrDecimalToByteArray(arr[0].ToString());
+                            data = Pack(info);
+                        }
                         break;
                     case CmdType.Send_Update_date:
                         break;