ardupilot/libraries/AP_HAL_Linux/TCPServerDevice.h
murata c808ee2f49 Global: To nullptr from NULL.
RC_Channel: To nullptr from NULL.

AC_Fence: To nullptr from NULL.

AC_Avoidance: To nullptr from NULL.

AC_PrecLand: To nullptr from NULL.

DataFlash: To nullptr from NULL.

SITL: To nullptr from NULL.

GCS_MAVLink: To nullptr from NULL.

DataFlash: To nullptr from NULL.

AP_Compass: To nullptr from NULL.

Global: To nullptr from NULL.

Global: To nullptr from NULL.
2016-11-02 16:04:47 -02:00

27 lines
728 B
C++

#pragma once
#include "SerialDevice.h"
#include <AP_HAL/utility/Socket.h>
class TCPServerDevice: public SerialDevice {
public:
TCPServerDevice(const char *ip, uint16_t port, bool wait);
virtual ~TCPServerDevice();
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;
private:
SocketAPM listener{false};
SocketAPM *sock = nullptr;
const char *_ip;
uint16_t _port;
bool _wait;
bool _blocking = false;
uint32_t _last_bind_warning = 0;
};