本文整理汇总了C#中Gurux.DLMS.GXDLMSSettings.ReceiverReady方法的典型用法代码示例。如果您正苦于以下问题:C# GXDLMSSettings.ReceiverReady方法的具体用法?C# GXDLMSSettings.ReceiverReady怎么用?C# GXDLMSSettings.ReceiverReady使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gurux.DLMS.GXDLMSSettings
的用法示例。
在下文中一共展示了GXDLMSSettings.ReceiverReady方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReceiverReady
///<summary>
///Generates an acknowledgment message, with which the server is informed to send next packets.
///</summary>
///<param name="type">
/// Frame type.
/// </param>
///<returns>
///Acknowledgment message as byte array.
///</returns>
internal static byte[] ReceiverReady(GXDLMSSettings settings, RequestTypes type)
{
if (type == RequestTypes.None)
{
throw new ArgumentException("Invalid receiverReady RequestTypes parameter.");
}
// Get next frame.
if ((type & RequestTypes.Frame) != 0)
{
byte id = settings.ReceiverReady();
return GetHdlcFrame(settings, id, null);
}
Command cmd;
if (settings.UseLogicalNameReferencing)
{
if (settings.IsServer)
{
cmd = Command.GetResponse;
}
else
{
cmd = Command.GetRequest;
}
}
else
{
if (settings.IsServer)
{
cmd = Command.ReadResponse;
}
else
{
cmd = Command.ReadRequest;
}
}
// Get next block.
GXByteBuffer bb = new GXByteBuffer(6);
if (settings.UseLogicalNameReferencing)
{
bb.SetUInt32(settings.BlockIndex);
}
else
{
bb.SetUInt16((UInt16)settings.BlockIndex);
}
settings.IncreaseBlockIndex();
byte[][] reply;
if (settings.UseLogicalNameReferencing)
{
GXDLMSLNParameters p = new GXDLMSLNParameters(settings, cmd, (byte)GetCommandType.NextDataBlock, bb, null, 0xff);
reply = GXDLMS.GetLnMessages(p);
}
else
{
GXDLMSSNParameters p = new GXDLMSSNParameters(settings, cmd, 1, (byte)VariableAccessSpecification.BlockNumberAccess, bb, null);
reply = GXDLMS.GetSnMessages(p);
}
return reply[0];
}