private UInt16 GetInts(ref byte[] buffer) { if (buffer == null || buffer.Length == 0) { return(0); } byte lsb = UsefulMethods.RemoveHeader(ref buffer, 0); byte hsb = UsefulMethods.RemoveHeader(ref buffer, 0); var merged = (UInt16)((hsb << 8) + lsb); return(merged); }
public void deserialize(ref byte[] buffer) { if (buffer == null || buffer.Length == 0) { return; } // Extract Header ApplicationControl = UsefulMethods.RemoveHeader(ref buffer, 0); FunctionCode = UsefulMethods.RemoveHeader(ref buffer, 0); // Set the data ApplicationData = buffer; }
public void deserialize(ref byte[] buffer) { if (buffer == null || buffer.Length == 0) { return; } // Extract Header var transHeader = UsefulMethods.RemoveHeader(ref buffer, 0); seq = (byte)(transHeader & 0x3F); FIR = (byte)((transHeader >> 6) & 0x01); FIN = (byte)((transHeader >> 7) & 0x01); TransportData = buffer; }
public void deserialize(ref byte[] buffer) { // Extract Start bytes startBytes = GetInts(ref buffer); // Extract length length = UsefulMethods.RemoveHeader(ref buffer, 0); // Extract Control byte controlByte = UsefulMethods.RemoveHeader(ref buffer, 0); // Process Control byte ProcessControlByte(controlByte); // Extract destination destination = GetInts(ref buffer); //Extract Source source = GetInts(ref buffer); // Extract crc crc = GetInts(ref buffer); // Verify crc bool verify = ValidateCRC(ref buffer, crc); if (verify) { Console.WriteLine("verified data"); } else { return; } }