HAL_SITL: implement a dummy buffered write
This commit is contained in:
parent
a59f505d25
commit
c035eef845
@ -59,5 +59,8 @@ size_t SITLConsoleDriver::write(uint8_t c)
|
||||
return _base_uart->write(c);
|
||||
}
|
||||
|
||||
size_t SITLConsoleDriver::write(const uint8_t *buffer, size_t size) {
|
||||
return _base_uart->write(buffer, size);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -24,6 +24,7 @@ public:
|
||||
|
||||
/* Implementations of Print virtual methods */
|
||||
size_t write(uint8_t c);
|
||||
size_t write(const uint8_t *buffer, size_t size);
|
||||
|
||||
private:
|
||||
AP_HAL::UARTDriver* _base_uart;
|
||||
|
@ -174,6 +174,15 @@ size_t SITLUARTDriver::write(uint8_t c)
|
||||
return send(_fd, &c, 1, flags);
|
||||
}
|
||||
|
||||
size_t SITLUARTDriver::write(const uint8_t *buffer, size_t size)
|
||||
{
|
||||
size_t n = 0;
|
||||
while (size--) {
|
||||
n += write(*buffer++);
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
/*
|
||||
start a TCP connection for the serial port. If wait_for_connection
|
||||
is true then block until a client connects
|
||||
|
@ -46,6 +46,7 @@ public:
|
||||
|
||||
/* Implementations of Print virtual methods */
|
||||
size_t write(uint8_t c);
|
||||
size_t write(const uint8_t *buffer, size_t size);
|
||||
|
||||
// file descriptor, exposed so SITL_State::loop_hook() can use it
|
||||
int _fd;
|
||||
|
Loading…
Reference in New Issue
Block a user