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


C# Frame.ReadByte方法代码示例

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


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

示例1: ReadFromFrame

 /// <summary>
 /// Decode message from frame
 /// </summary>
 /// <param name="frame">Frame containing message</param>
 /// <returns>True on success</returns>
 public bool ReadFromFrame(Frame frame)
 {
     if (frame == null || frame.LengthDataUsed != cLength)
         return false;
     byte Header = frame.ReadByte(0);
     if ((Type)(Header >> 2) != Type.AddressRequest)
         return false;
     HopsLeft = frame.ReadByte(1);
     BrokerAddr = frame.ReadUInt16Canonical(2);
     DeviceAddr = frame.ReadUInt64Canonical(4);
     return true;
 }
开发者ID:aura1213,项目名称:netmf-interpreter,代码行数:17,代码来源:Messages_custom.cs

示例2: GetType

 /// <summary>
 /// ReadFromFrame message type from frame.
 /// </summary>
 /// <param name="sdu"></param>
 /// <param name="type"></param>
 /// <returns>Returns true on success</returns>
 public static bool GetType(Frame sdu, out Dispatch type)
 {
     type = Dispatch.NonLowPan; // set out type
     if (sdu == null || sdu.LengthDataUsed < 1)
         return false;
     byte b = (byte)(sdu.ReadByte(0) >> 6);
     type = (Dispatch)b;
     return true;
 }
开发者ID:koson,项目名称:.NETMF_for_LPC17xx,代码行数:15,代码来源:Messages_6LoWPAN.cs

示例3: GetType

 /// <summary>
 /// Decode message type from frame.
 /// </summary>
 /// <param name="sdu"></param>
 /// <param name="type"></param>
 /// <returns>Returns true on success</returns>
 public static bool GetType(Frame sdu, out Type type)
 {
     type = Type.Reserved;
     if (sdu == null || sdu.LengthDataUsed < 1)
         return false;
     byte b = (byte)(sdu.ReadByte(0) >> 2);
     if (b > 8)
         return false;
     type = (Message.Type)b;
     return true;
 }
开发者ID:aura1213,项目名称:netmf-interpreter,代码行数:17,代码来源:Messages_custom.cs

示例4: ReadFromFrameHeader

 /// <summary>
 /// Decode message from frame header
 /// </summary>
 /// <param name="frame">Frame containing message</param>
 /// <returns>True on success</returns>
 public bool ReadFromFrameHeader(Frame frame)
 {
     if (frame == null || frame.LengthDataUsed < cLength)
         return false;
     byte Header = frame.ReadByte(0);
     if ((Type)(Header >> 2) != Type.Data)
         return false;
     frame.DeleteFromFront(1);
     return true;
 }
开发者ID:aura1213,项目名称:netmf-interpreter,代码行数:15,代码来源:Messages_custom.cs

示例5: PhyDataIndicationHandler

        /// <summary>
        /// handler for data from Phy
        /// </summary>
        private void PhyDataIndicationHandler(
            IPhyDataSap sender,
            Frame frame,
            Byte linkQuality)
        {
            if (frame == null)
                return;

            if (frame.LengthDataUsed >= 3)
            { // min frame size
                // inspect frame type, light-weight decoding
                Frames.Type type;
                bool ok = Header.GetType(frame, out type);

                if (ok)
                {
                    switch (type)
                    {
                        case Frames.Type.Ack:
                            if (_ackPending)
                            {
                                // All other subfields than fcs.pending shall be set to zero and ignored on reception
                                byte seqNo = frame.ReadByte(2); // ack frame is FCF+seqNo
                                if (seqNo == _ackSeqNo)
                                    _ackReceived.Set();
                            }
                            break;
                        case Frames.Type.Beacon:
                        case Frames.Type.Data:
                        case Frames.Type.Cmd:
                            lock (_state)
                            { // keep state consistent while processing frame
                                if (_filterEnabled)
                                {
                                    // FIXME: SW filter is not implemented
                                }
                                else
                                {
                                    _mac.PhyDataIndication(sender, ref frame, linkQuality);
                                }
                            }
                            break;
                        default:
                            break;
                    }
                }
            }

            Frame.Release(ref frame);
        }
开发者ID:koson,项目名称:.NETMF_for_LPC17xx,代码行数:53,代码来源:PhySendReceive.cs

示例6: phy_DataIndicationDump

        void phy_DataIndicationDump(IPhyDataSap sender, Frame frame, byte linkQuality)
        {
            leds.color = Leds.Color.Green;
            string s = "recv: ";
            for (int i = 0; i < frame.LengthDataUsed; i++)
            {
                byte b = frame.ReadByte(i);
                s += HexConverter.ConvertUintToHex(b, 2) + " ";
            }

            Debug.Print(s);
            Frame.Release(ref frame);
            leds.color = Leds.Color.Off;
        }
开发者ID:prabby,项目名称:miniclr,代码行数:14,代码来源:Program.cs

示例7: ReadFromFrameHeader

            /// <summary>
            /// Decode message from frame header
            /// </summary>
            /// <param name="frame">Frame containing message</param>
            /// <returns>True on success</returns>
            public bool ReadFromFrameHeader(Frame frame)
            {
                if (frame == null || frame.LengthDataUsed < cLengthMin)
                    return false;

                byte b = frame.ReadByte(0);
                if ((b >> 6) != (byte)Dispatch.Mesh ||
                    (b & 32) == 0 ||
                    (b & 16) == 0)
                    return false;
                HopsLeft = (byte)(b & 15);
                if (HopsLeft < 15)
                {
                    originatorAddress = frame.ReadUInt16Canonical(1);
                    finalAddress = frame.ReadUInt16Canonical(3);
                    frame.DeleteFromFront(cLengthMin);
                }
                else
                {
                    if (frame.LengthDataUsed < cLengthMax)
                        return false;
                    HopsLeft = frame.ReadByte(1);
                    originatorAddress = frame.ReadUInt16Canonical(2);
                    finalAddress = frame.ReadUInt16Canonical(4);
                    frame.DeleteFromFront(cLengthMax);
                }

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


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