public void AddHeader(ref byte[] buffer) { // Add Function Code UsefulMethods.InsertElementArray(ref buffer, 0, FunctionCode); // Add Application Control UsefulMethods.InsertElementArray(ref buffer, 0, ApplicationControl); }
private static byte[] InsertBytes(byte[] buffer, ushort data) { byte lsb = (byte)(data & 0xFF); byte hsb = (byte)((data >> 8) & 0xFF); UsefulMethods.InsertElementArray(ref buffer, 0, hsb); UsefulMethods.InsertElementArray(ref buffer, 0, lsb); return(buffer); }
public void serialize(ref byte[] buffer) { // Add Header byte header = 0; header |= (byte)(FIN << 7); header |= (byte)(FIR << 6); header |= seq; UsefulMethods.InsertElementArray(ref buffer, 0, header); }
public void AddHeader(ref byte[] buffer) { // Add Crc UInt16 Crc = GetCRC(ref buffer); buffer = InsertBytes(buffer, Crc); // Add src and dest buffer = InsertBytes(buffer, source); buffer = InsertBytes(buffer, destination); // Add Control byte UsefulMethods.InsertElementArray(ref buffer, 0, controlByte); // Add Length length = (byte)(buffer.Count()); // yet to add the start bytes but remove the CRC bytes UsefulMethods.InsertElementArray(ref buffer, 0, length); // Add Start Bytes startBytes = 0x6405; buffer = InsertBytes(buffer, startBytes); }