Beispiel #1
0
        public string ShowFrameByte(bool IsSend)
        {
            string text = string.Empty;

            checked
            {
                for (int i = 0; i < this._framelists.Count; i++)
                {
                    if (IsSend)
                    {
                        if (this._framelists[i].IsSend)
                        {
                            text = text + "-> Send:" + DataConvert.AddSpace(this._framelists[i].FrameByte);
                        }
                    }
                    else
                    {
                        if (!this._framelists[i].IsSend)
                        {
                            text = text + "-> Receive:" + DataConvert.AddSpace(this._framelists[i].FrameByte) + "\r\n";
                        }
                    }
                }
                return(text);
            }
        }
Beispiel #2
0
        public static string Print_ShowFrameInfo(DLT698Message.FrameInfo gFrame, DLT698Message msg)
        {
            string text  = "起始字符:[68]\r\n";
            string text2 = text;

            text = string.Concat(new string[]
            {
                text2,
                "长度L:[",
                DLT698Message.GetDataLenSpace(gFrame.L1),
                "]-->",
                gFrame.L1,
                "\r\n"
            });
            text += "起始字符:[68]\r\n";
            string controlField = DLT698Message.GetControlField(byte.Parse(gFrame.DIR), byte.Parse(gFrame.PRM), byte.Parse(gFrame.FCB), byte.Parse(gFrame.FCV), byte.Parse(gFrame.CID));

            text += DlT698MessageLogHelper.Print_GetControlField(controlField);
            string addressField = DLT698Message.GetAddressField(gFrame.A1, gFrame.A2, gFrame.MSA, byte.Parse(gFrame.ArrFlag));

            text += DlT698MessageLogHelper.Print_GetAddressField(addressField);
            string appCode = DlT698MessageLogHelper.Print_GetAppCode(gFrame.AFN);

            text += appCode;
            string sEQ = DLT698Message.GetSEQ(byte.Parse(gFrame.TpV), byte.Parse(gFrame.FIR), byte.Parse(gFrame.FIN), byte.Parse(gFrame.CON), byte.Parse(gFrame.PSEQ));

            text += DlT698MessageLogHelper.Print_GetSEQ(sEQ);
            if (!string.IsNullOrEmpty(gFrame.FN) | !string.IsNullOrEmpty(gFrame.PN))
            {
                string dataCellMark = DLT698Message.GetDataCellMark(ushort.Parse(gFrame.FN), ushort.Parse(gFrame.PN));
                text += Print_GetDataCellMark(dataCellMark);
            }
            text += "数据部分:\r\n";
            if (!string.IsNullOrEmpty(gFrame.PW))
            {
                text2 = text;
                text  = string.Concat(new string[]
                {
                    text2,
                    "密码PW:[",
                    gFrame.PW,
                    "]-->",
                    gFrame.PW,
                    "\r\n"
                });
            }
            if (!string.IsNullOrEmpty(gFrame.EC1))
            {
                text2 = text;
                text  = string.Concat(new string[]
                {
                    text2,
                    "重要事件计数器EC1:[",
                    gFrame.EC1,
                    "]-->",
                    DataConvert.HexToInt(gFrame.EC1).ToString(),
                    "\r\n"
                });
            }
            if (!string.IsNullOrEmpty(gFrame.EC2))
            {
                text2 = text;
                text  = string.Concat(new string[]
                {
                    text2,
                    "重要事件计数器EC2:[",
                    gFrame.EC2,
                    "]-->",
                    DataConvert.HexToInt(gFrame.EC2).ToString(),
                    "\r\n"
                });
            }
            if (gFrame.TpV == "1")
            {
                text2 = text;
                text  = string.Concat(new string[]
                {
                    text2,
                    "启动帧帧序号计数器PFC:[",
                    int.Parse(gFrame.PFC).ToString("X2"),
                    "]-->",
                    gFrame.PFC,
                    "\r\n"
                });
                text2 = text;
                text  = string.Concat(new string[]
                {
                    text2,
                    "启动帧发送时标:[",
                    DataConvert.AddSpace(DataConvert.ReverseStr(gFrame.Time)),
                    "]-->",
                    gFrame.Time.Substring(0, 2),
                    "日",
                    gFrame.Time.Substring(2, 2),
                    "时",
                    gFrame.Time.Substring(4, 2),
                    "分",
                    gFrame.Time.Substring(6, 2),
                    "秒\r\n"
                });
                text2 = text;
                text  = string.Concat(new string[]
                {
                    text2,
                    "允许发送传输延时时间:[",
                    int.Parse(gFrame.Delay).ToString("X2"),
                    "]-->",
                    gFrame.Delay,
                    "\r\n"
                });
            }
            if (!string.IsNullOrEmpty(gFrame.Data))
            {
                text = text + "数据:[" + gFrame.Data + "]\r\n";
            }
            text = text + "校验:[" + gFrame.CS + "]\r\n";
            return(text + "结束符:[16]\r\n");
        }