예제 #1
0
        public static string Print_FnPnData(DLT698Message.FrameInfo gFrame)
        {
            string text = string.Empty;

            if (gFrame.AFN == "00")
            {
                if (gFrame.PN == "0000")
                {
                    if (gFrame.FN == "0001")
                    {
                        text += "全部确认";
                    }
                    if (gFrame.FN == "0002")
                    {
                        text += "全部否认";
                    }
                    if (gFrame.FN == "0003")
                    {
                        text = text + "部分确认:" + gFrame.Data;
                    }
                    if (gFrame.FN == "0008")
                    {
                        text += "否认:终端不存在";
                    }
                    if (gFrame.FN == "0009")
                    {
                        text += gFrame.Data;
                    }
                }
            }
            return(text);
        }
예제 #2
0
        public void DoParse(string val)
        {
            this.textBox1.Text = val;
            this.textBox2.Text = "";
            DLT698Message dLT = new DLT698Message();

            DLT698Message.FrameInfo gFrame = default(DLT698Message.FrameInfo);
            if (!string.IsNullOrEmpty(val))
            {
                byte[] array = this.HexStrToByte(val.Trim());
                if (dLT.Assert_Basic(array))
                {
                    dLT.ParseData(array, array.Length, ref gFrame);
                    this.textBox2.Text = "帧信息:\r\n";
                    TextBox expr_7E = this.textBox2;
                    expr_7E.Text += this.ByteToHexStr_16(array);
                    TextBox expr_9C = this.textBox2;
                    expr_9C.Text += "\r\n";
                    TextBox expr_B8 = this.textBox2;
                    expr_B8.Text += "-----------------------------------------------";
                    TextBox expr_D4 = this.textBox2;
                    expr_D4.Text += "\r\n\r\n";
                    TextBox expr_F0 = this.textBox2;
                    expr_F0.Text += DlT698MessageLogHelper.Print_ShowFrameInfo(gFrame, dLT);
                    if (gFrame.DIR == "1")
                    {
                        this.SetText(gFrame.AFN, gFrame.FN, gFrame.Data);
                    }
                }
                else
                {
                    MessageBox.Show("帧格式错误");
                }
            }
        }
예제 #3
0
        public void DoParse(string val)
        {
            DLT698Message dLT = new DLT698Message();

            DLT698Message.FrameInfo gFrame = default(DLT698Message.FrameInfo);
            if (!string.IsNullOrEmpty(val))
            {
                byte[] array = this.HexStrToByte(val.Trim());
                if (dLT.Assert_Basic(array))
                {
                    dLT.ParseData(array, array.Length, ref gFrame);
                    this.textbox.Text  = this.ByteToHexStr(array);
                    this.textbox2.Text = DlT698MessageLogHelper.Print_ShowFrameInfo(gFrame, dLT);
                }
                else
                {
                    MessageBox.Show("帧格式错误");
                }
            }
        }
예제 #4
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");
        }