Example #1
0
 /// <summary>
 /// 获取头部信息
 /// </summary>
 /// <param name="data"></param>
 /// <returns></returns>
 public string GetHeader(byte[] data)
 {
     reportID   = Convert.ToInt32(data[0]);
     packetInfo = Convert.ToInt32(data[1]);
     dataLength = Convert.ToInt32(data[2]);
     return(GlobalClass.ByteToHex(data));
 }
Example #2
0
 /// <summary>
 /// 获取NPDU
 /// </summary>
 /// <param name="data"></param>
 /// <returns></returns>
 public string GetNPDU(byte[] data)
 {
     length = Convert.ToInt32(data[0]);
     apci   = GlobalClass.BitToInt(GlobalClass.IntToBit(Convert.ToInt32(data[1]), 8).Substring(6, 2)
                                   + GlobalClass.IntToBit(Convert.ToInt32(data[2]), 8).Substring(0, 2));
     apciData  = GlobalClass.BitToInt(GlobalClass.IntToBit(Convert.ToInt32(data[2]), 8).Substring(2, 6));
     this.data = GlobalClass.ByteToHex(data, 3, length - 1);
     return(GlobalClass.ByteToHex(data));
 }
Example #3
0
 /// <summary>
 /// 获取ReportHeader
 /// </summary>
 /// <param name="data"></param>
 /// <returns></returns>
 public string GetReportHeader(byte[] data)
 {
     version    = Convert.ToInt32(data[0]);
     headLength = Convert.ToInt32(data[1]);
     bodyLength = GlobalClass.ByteToInt32(data, 2, 2);
     protocolID = Convert.ToInt32(data[4]);
     emiID      = Convert.ToInt32(data[5]);
     manuCode   = GlobalClass.ByteToInt32(data, 6, 2);
     return(GlobalClass.ByteToHex(data));
 }
Example #4
0
 /// <summary>
 /// 获取CEMI
 /// </summary>
 /// <param name="data"></param>
 /// <returns></returns>
 public string GetCEMI(byte[] data)
 {
     mc         = Convert.ToInt32(data[0]);
     addLength  = Convert.ToInt32(data[1]);
     addInfo    = GlobalClass.ByteToHex(data, 2, addLength);
     ctrl1      = Convert.ToInt32(data[2 + addLength]);
     ctrl2      = Convert.ToInt32(data[3 + addLength]);
     srcAddress = GlobalClass.ByteToInt32(data, 4 + addLength, 2);
     desAddress = GlobalClass.ByteToInt32(data, 6 + addLength, 2);
     return(GlobalClass.ByteToHex(data));
 }