ConsoleDevice.h 609 B

123456789101112131415161718192021222324
  1. #pragma once
  2. #include "SerialDevice.h"
  3. #include <AP_HAL/utility/Socket.h>
  4. class ConsoleDevice: public SerialDevice {
  5. public:
  6. ConsoleDevice();
  7. virtual ~ConsoleDevice();
  8. virtual bool open() override;
  9. virtual bool close() override;
  10. virtual ssize_t write(const uint8_t *buf, uint16_t n) override;
  11. virtual ssize_t read(uint8_t *buf, uint16_t n) override;
  12. virtual void set_blocking(bool blocking) override;
  13. virtual void set_speed(uint32_t speed) override;
  14. private:
  15. int _rd_fd = -1;
  16. int _wr_fd = -1;
  17. bool _closed = true;
  18. bool _set_signal_handlers(void) const;
  19. };