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));
            }
        }
Beispiel #2
0
 public ByteProtocolBuffer(ByteProtocolBuffer that, int length)
 {
     this.memory          = that.memory.Slice(that.memoryOffset, length);
     this.releasableArray = null;
     this.Clear();
 }
Beispiel #3
0
 public IByteProtocolBuffer Extract(out IByteProtocolBuffer protocolBuffer, int length)
 {
     protocolBuffer     = new ByteProtocolBuffer(this, length);
     this.memoryOffset += length;
     return(this);
 }