Gurux.DLMS.GXDLMSTranslator.FindNextFrame C# (CSharp) Method

FindNextFrame() public method

Find next frame from the string.
Position of data is set to the begin of new frame. If Pdu is null it is not updated.
public FindNextFrame ( GXByteBuffer data, GXByteBuffer pdu ) : bool
data GXByteBuffer Data where frame is search.
pdu GXByteBuffer Pdu of received frame is set here.
return bool
        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;
        }

Same methods

GXDLMSTranslator::FindNextFrame ( GXByteBuffer data, GXByteBuffer pdu, InterfaceType type ) : bool