ardupilot/libraries/AP_HAL_Linux/TCPServerDevice.h

29 lines
772 B
C
Raw Normal View History

2015-06-19 10:58:40 -03:00
#ifndef __AP_HAL_LINUX_TCPCLIENTDEVICE_H__
#define __AP_HAL_LINUX_TCPCLIENTDEVICE_H__
#include "SerialDevice.h"
#include "../AP_HAL/utility/Socket.h"
2015-07-08 14:27:21 -03:00
class TCPServerDevice: public SerialDevice {
2015-06-19 10:58:40 -03:00
public:
TCPServerDevice(const char *ip, uint16_t port, bool wait);
2015-07-08 14:27:21 -03:00
virtual ~TCPServerDevice();
2015-06-19 10:58:40 -03:00
virtual bool open() override;
virtual bool close() override;
virtual void set_blocking(bool blocking) override;
virtual void set_speed(uint32_t speed) override;
virtual ssize_t write(const uint8_t *buf, uint16_t n) override;
virtual ssize_t read(uint8_t *buf, uint16_t n) override;
2015-06-19 10:58:40 -03:00
private:
SocketAPM listener{false};
SocketAPM *sock = NULL;
2015-06-19 10:58:40 -03:00
const char *_ip;
uint16_t _port;
bool _wait;
bool _blocking = false;
2015-06-19 10:58:40 -03:00
};
#endif