示例#1
0
        public void IsProtocolSample()
        {
            byte[] data = Tools.HexStrToByteArr("68 06 05 04 03 02 01 68 11 05 37 36 35 34 DD AE 16");
            bool   b    = Frame645_07.IsProtocol(data);

            Assert.AreEqual(true, b);
        }
示例#2
0
        public void Frame645()
        {
            Frame645_07 frame = new Frame645_07();

            byte[] data = Tools.HexStrToByteArr("68 06 05 04 03 02 01 68 11 05 37 36 35 34 DD AE 16");
            frame.SetData(data);
        }
示例#3
0
        public void ExtractFrameSample()
        {
            byte[] data  = Tools.HexStrToByteArr("FE FE FE FE 68 06 05 04 03 02 01 68 11 05 37 36 35 34 DD AE 16 00 00");
            byte[] frame = Frame645_07.ExtractFrame(data);
            bool   b     = Frame645_07.IsProtocol(frame);

            Assert.AreEqual(0x68, frame[0]);
        }
示例#4
0
        public void SetBytesSample()
        {
            byte[]      data  = Tools.HexStrToByteArr("68 06 05 04 03 02 01 68 11 05 37 36 35 34 DD AE 16");
            Frame645_07 frame = new Frame645_07();

            frame.SetData(data);

            byte[] data1 = Tools.HexStrToByteArr("68 06 05 04 03 02 01 68 19 08 37 66 55 44 10 FF EE DD 16 16");
            frame.SetData(data1);
        }
示例#5
0
        public void GetDataSample1()
        {
            Frame645_07 frame = new Frame645_07();

            frame.FAddress.Value = new byte[] { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 };
            frame.FControl.Value = 0x19;
            C19_DataField df = new C19_DataField();

            df.FPassword.PA.Value  = 0x04;
            df.FPassword.PW.Value  = new byte[] { 0x11, 0x22, 0x33 };
            df.FOperatorCode.Value = new byte[] { 0xaa, 0xbb, 0xcc, 0xdd };
            frame.FDataField       = df;

            byte[] data = frame.GetData();
            string str  = String.Join(" ", data.Select(o => o.ToString("X2")));
        }
示例#6
0
        public void GetDataSample()
        {
            Frame645_07 frame = new Frame645_07();

            frame.FAddress.Value = new byte[] { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 };
            frame.FControl.Value = 0x11;


            //C11_DataField dataFiled = new C11_DataField();
            //dataFiled.FDataIdentifer.Value = new byte[] { 0x01, 0x02, 0x03, 0x04 };
            //dataFiled.FData.Value = new byte[] { 0xAA };
            //frame.FDataField = dataFiled;

            // 下面两行 和 上面注释的内容 起到一样的效果
            OtherDataField odf = new OtherDataField();

            odf.FData.Value  = new byte[] { 0x04, 0x03, 0x02, 0x01, 0xAA };
            frame.FDataField = odf;

            byte[] data = frame.GetData();
        }