public void SendCommandWithResponse(SerialCommand command)
        {
            if (!serialPort.IsOpen)
            {
                throw new InvalidOperationException("Serial port is not open");
            }

            var bytesToWrite = command.GetAllBytes();

            var responseBuffer = WriteBytesAndGetResponse(bytesToWrite);

            command.ApplyResponseAndVerify(responseBuffer);
        }
        public void SendCommandWithAck(SerialCommand command)
        {
            if (!serialPort.IsOpen)
            {
                throw new InvalidOperationException("Serial port is not open");
            }

            var bytesToWrite = command.GetAllBytes();

            var response = WriteBytesAndGetResponse(bytesToWrite);

            if (response[0] != 0x07 || response[1] != 0xF3)
            {
                throw new InvalidOperationException("Expected ACK response, got something else");
            }
        }