本文整理汇总了C#中Frame.AllocFront方法的典型用法代码示例。如果您正苦于以下问题:C# Frame.AllocFront方法的具体用法?C# Frame.AllocFront怎么用?C# Frame.AllocFront使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Frame
的用法示例。
在下文中一共展示了Frame.AllocFront方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: 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;
}