public void MacFrameGetDataSample1() { MacFrame frame = new MacFrame(); frame.Ctrl.FrameType = EmMacFrameType.Data; frame.Ctrl.HasExtension = true; frame.Ctrl.TargetAddrMode = EmAddrLen.Six; frame.Ctrl.SourceAddrMode = EmAddrLen.Six; frame.Seq.Value = 110; frame.PanID = 0x6771; frame.TargetAddr.Value = new byte[] { 0x11, 0x11, 0x11, 0x11, 0x11, 0x22 }; frame.SourceAddr.Value = new byte[] { 0x88, 0x88, 0x88, 0x88, 0x88, 0x88 }; frame.Extension = new MacExtension(); frame.Extension.ExtLength = 10; frame.Extension.ExtContent.Value = Tools.HexStrToByteArr("46 43 20 00 07 00 F4 03 4D B9", ' '); NetFrame nf = new NetFrame(); nf.Ctrl.FrameType = EmNetFrameType.Data; nf.Ctrl.RoutingInstruction = 1; nf.Ctrl.TargetAddrMode = EmAddrLen.Six; nf.Ctrl.SourceAddrMode = EmAddrLen.Six; nf.TargetAddr.Value = new byte[] { 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 }; nf.SourceAddr.Value = new byte[] { 0x88, 0x88, 0x88, 0x88, 0x88, 0x88 }; nf.Seq.Value = 13; nf.Radius = 2; nf.RouteInfo.Add(new NetAddr() { AddrMode = EmAddrLen.Six, Value = new byte[] { 0x11, 0x11, 0x11, 0x11, 0x11, 0x22 } }); frame.Du = nf; ApsFrame af = new ApsFrame(); af.Fcd.Ftd = EmApsFcdFtd.Forward; af.Fcd.Oei = 0; af.Seq.Value = 2; af.Dui = (byte)EmApsFcdFtdDti.Auto; af.Du.Value = Tools.HexStrToByteArr("FE FE FE FE 68 11 11 11 11 11 11 68 11 04 34 34 33 37 1D 16", ' '); nf.Du = af; byte[] data = frame.GetData(); }
public void ApsFrameSetDataSample() { Type type = typeof(ByteFormat); dynamic d = type; ApsFrame frame = new ApsFrame(); byte[] data = Tools.HexStrToByteArr("02 00 00 FE FE FE FE 68 11 11 11 11 11 11 68 11 04 34 34 33 37 1D 16", ' '); frame.SetData(data); string a = frame.ToString(); ByteFormat bf = ByteFormat.GetInstance(); bf.Suffix = "0x"; Assert.AreEqual(EmApsFcdFtd.Forward, frame.Fcd.Ftd); data = Tools.HexStrToByteArr("AA 3E 00 1C 41 CD 05 FF FF AF AF AF AF AF AF 01 32 10 42 01 01 3C AF AF AF AF AF AF 01 32 10 42 01 01 31 01 03 04 91 31 09 10 14 00 03 00 00 00 00 00 00 53 00 21 00 00 00 60 00 00 00 05 00 00 EE 01 17"); ApsFrame frame1 = new ApsFrame(); frame1.SetData(data); }
public void ApsFrameGetDataSample() { ApsFrame frame = new ApsFrame(); frame.Fcd.Ftd = EmApsFcdFtd.Forward; frame.Fcd.Oei = 0; frame.Seq++; frame.Dui = (byte)EmApsFcdFtdDti.Auto; frame.Du.Value = Tools.HexStrToByteArr("FE FE FE FE 68 11 11 11 11 11 11 68 11 04 34 34 33 37 1D 16", ' '); byte[] data = frame.GetData(); Assert.AreEqual(0x02, data[0]); frame.Seq.Value = 0xFF; frame.Seq++; frame.Fcd.Oei = 1; frame.Oed.DataArea.Value = new byte[] { 1, 2, 3 }; frame.Oed.DataAreaLength = 3; frame.Oed.ManufacturerID.Value = new byte[] { 00, 01 }; data = frame.GetData(); }