public bool FindNextFrame(GXByteBuffer data, GXByteBuffer pdu)
{
GXDLMSSettings settings = new GXDLMSSettings(true);
GXReplyData reply = new GXReplyData();
reply.Xml = new GXDLMSTranslatorStructure(OutputType, Hex, ShowStringAsHex, null);
int pos;
while (data.Position != data.Size)
{
if (data.GetUInt8(data.Position) == 0x7e)
{
pos = data.Position;
settings.InterfaceType = Enums.InterfaceType.HDLC;
GXDLMS.GetData(settings, data, reply);
data.Position = pos;
break;
}
else if (data.Position + 2 < data.Size && data.GetUInt16(data.Position) == 0x1)
{
pos = data.Position;
settings.InterfaceType = Enums.InterfaceType.WRAPPER;
GXDLMS.GetData(settings, data, reply);
data.Position = pos;
break;
}
++data.Position;
}
if (pdu != null)
{
pdu.Clear();
pdu.Set(reply.Data.Data, 0, reply.Data.Size);
}
return data.Position != data.Size;
}