当前位置: 首页>>代码示例>>C#>>正文


C# Frame.Write方法代码示例

本文整理汇总了C#中Frame.Write方法的典型用法代码示例。如果您正苦于以下问题:C# Frame.Write方法的具体用法?C# Frame.Write怎么用?C# Frame.Write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Frame的用法示例。


在下文中一共展示了Frame.Write方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WriteToFrameHeader

            /// <summary>
            /// Encode message into frame header
            /// </summary>
            /// <param name="frame">Frame to add message</param>
            /// <returns>True on success</returns>
            public bool WriteToFrameHeader(Frame frame)
            {
                if (frame == null || frame.LengthHeaderAvail < cLengthMax)
                    return false;

                byte b = (byte)((int)Dispatch.Mesh << 6);
                b |= 32; // originator is short addr
                b |= 16; // target is short addr

                if (HopsLeft < 15)
                {
                    frame.AllocFront(cLengthMin);
                    b |= HopsLeft;
                    frame.Write(0, b);
                    frame.WriteCanonical(1, originatorAddress);
                    frame.WriteCanonical(3, finalAddress);
                }
                else
                {
                    frame.AllocFront(cLengthMax);
                    b |= 15;
                    frame.Write(0, b);
                    frame.Write(1, HopsLeft);
                    frame.WriteCanonical(2, originatorAddress);
                    frame.WriteCanonical(4, finalAddress);
                }

                return true;
            }
开发者ID:koson,项目名称:.NETMF_for_LPC17xx,代码行数:34,代码来源:Messages_6LoWPAN.cs

示例2: WriteToFrame

 /// <summary>
 /// Encode message into frame
 /// </summary>
 /// <param name="frame">Frame to add message</param>
 /// <returns>True on success</returns>
 public bool WriteToFrame(Frame frame)
 {
     if (frame == null || frame.LengthDataAvail < cLength)
         return false;
     frame.AllocBack(cLength);
     byte Header = (Byte)((int)Type.AddressRequest << 2);
     frame.Write(0, Header);
     frame.Write(1, HopsLeft);
     frame.WriteCanonical(2, BrokerAddr);
     frame.WriteCanonical(4, DeviceAddr);
     return true;
 }
开发者ID:aura1213,项目名称:netmf-interpreter,代码行数:17,代码来源:Messages_custom.cs

示例3: Main

        static void Main(string[] args)
        {
            float[] frame1origin = new float[] { 0, 0, 0 };
             float[] frame1XDirection = new float[] { 1, 0, 0 };
             float[] frame1YDirection = new float[] { 0, 1, 0 };
             Console.WriteLine(frame1YDirection[0] + " " + frame1YDirection[1] + " " + frame1YDirection[2]);
             float[] frame1ZDirection = new float[] { 0, 0, 1 };
             Frame frame1 = new Frame(frame1origin, frame1XDirection, frame1YDirection, frame1ZDirection);
             Console.WriteLine("\nWriting frame1.vtp...");
             // adjust path
             frame1.Write(@"c:\vtk\vtkdata-5.8.0\Data\frame1.vtp");

             float[] frame2origin = new float[] { 0, 0, 0 };
             float[] frame2XDirection = new float[] { .707f, .707f, 0 };
             float[] frame2YDirection = new float[] { -.707f, .707f, 0 };
             float[] frame2ZDirection = new float[] { 0, 0, 1 };
             Frame frame2 = new Frame(frame2origin, frame2XDirection, frame2YDirection, frame2ZDirection);
             Console.WriteLine("\nWriting frame2.vtp...");
             // adjust path
             frame2.Write(@"c:\vtk\vtkdata-5.8.0\Data\frame2.vtp");

             vtkTransform transform = vtkTransform.New();
             AlignFrames(frame2, frame1, ref transform); // Brings frame2 to frame1

             Console.WriteLine("\nWriting transformed.vtp...");
             // adjust path
             frame2.ApplyTransform(ref transform, @"c:\vtk\vtkdata-5.8.0\Data\transformed.vtp");

             Console.WriteLine("\nPress any key to continue...");
             Console.ReadKey();
        }
开发者ID:philgreenyouilabs,项目名称:VTKWikiExamples,代码行数:31,代码来源:AlignFrames.cs

示例4: PhyDataIndication

        /// <summary>
        /// process frame from Phy layer. FCS has been removed already.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="frame"></param>
        /// <param name="linkQuality"></param>
        public void PhyDataIndication(
            IPhyDataSap sender,
            ref Frame frame,
            Byte linkQuality)
        {
            Frames.Type type;
            bool ok = Header.GetType(frame, out type);

            if (ok && type == Frames.Type.Data)
            {
                frame.AllocBack(1);
                frame.Write(frame.LengthDataUsed - 1, linkQuality);
                lock (_rxFrameQueue)
                {
                    _rxFrameQueue.AddFrame(ref frame);
                }

                _rxEvent.Set();
                Frame.Release(ref frame);
                return;
            }

            Header hdr = new Header();
            if (hdr.ReadFromFrameHeader(frame, true))
            {
                switch (hdr.fcs.Type)
                {
                    case Microsoft.SPOT.Wireless.IEEE_802_15_4.Mac.Frames.Type.Beacon:
                        ReceiveBeacon(hdr, ref frame, linkQuality);
                        break;
                    case Microsoft.SPOT.Wireless.IEEE_802_15_4.Mac.Frames.Type.Cmd:
                        ReceiveCommand(hdr, ref frame, linkQuality);
                        break;
                    default:
                        // drop, data and ack frames are handled before
                        break;
                }
            }
        }
开发者ID:koson,项目名称:.NETMF_for_LPC17xx,代码行数:45,代码来源:MacReceive.cs

示例5: WriteToFrameHeader

 /// <summary>
 /// Encode message into frame header
 /// </summary>
 /// <param name="frame">Frame to add message</param>
 /// <returns>True on success</returns>
 public bool WriteToFrameHeader(Frame frame)
 {
     if (frame == null || frame.LengthDataAvail < cLength)
         return false;
     frame.AllocFront(cLength);
     byte Header = (Byte)((int)Type.Data << 2);
     frame.Write(0, Header);
     return true;
 }
开发者ID:aura1213,项目名称:netmf-interpreter,代码行数:14,代码来源:Messages_custom.cs


注:本文中的Frame.Write方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。