public static IEnumerable <BlynkMessageParser> GetBlynkMessages(byte[] incomingBuffer, int readLength) { try { BlynkLogManager.LogMethodBegin(nameof(GetBlynkMessages)); var byteProtocolBuffer = new ByteProtocolBuffer(incomingBuffer); var result = new List <BlynkMessageParser>(); while (byteProtocolBuffer.Position < readLength) { result.Add(new BlynkMessageParser(byteProtocolBuffer)); } return(result); } finally { BlynkLogManager.LogMethodEnd(nameof(GetBlynkMessages)); } }
public ByteProtocolBuffer(ByteProtocolBuffer that, int length) { this.memory = that.memory.Slice(that.memoryOffset, length); this.releasableArray = null; this.Clear(); }
public IByteProtocolBuffer Extract(out IByteProtocolBuffer protocolBuffer, int length) { protocolBuffer = new ByteProtocolBuffer(this, length); this.memoryOffset += length; return(this); }