public GSIP_Message(string _header, GSIP_OPERATION _operation, byte _size, object _payload, byte _crc7) { this.Header = _header; this.Operation = _operation; this.Size = _size; this.Payload = _payload; this.Crc7 = _crc7; }
public GSIP_Message(GSIP_OPERATION _operation, byte _size, object _payload) { this.Header = "#S"; this.Operation = _operation; this.Size = _size; this.Payload = _payload; byte[] buffer = new byte[this.Size + 2]; buffer[0] = (byte)this.Operation; buffer[1] = (byte)this.Size; if (this.Size > 0) { byte[] payloadBuffer = this.getPayloadBuffer(); payloadBuffer.CopyTo(buffer, 2); } this.Crc7 = GSIPService.calcCrc7(buffer, this.Size + 2); }