APM:Libraries
UDPDevice.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "SerialDevice.h"
5 
6 class UDPDevice: public SerialDevice {
7 public:
8  UDPDevice(const char *ip, uint16_t port, bool bcast, bool input);
9  virtual ~UDPDevice();
10 
11  virtual bool open() override;
12  virtual bool close() override;
13  virtual void set_blocking(bool blocking) override;
14  virtual void set_speed(uint32_t speed) override;
15  virtual ssize_t write(const uint8_t *buf, uint16_t n) override;
16  virtual ssize_t read(uint8_t *buf, uint16_t n) override;
17 private:
18  SocketAPM socket{true};
19  const char *_ip;
20  uint16_t _port;
21  bool _bcast;
22  bool _input;
23  bool _connected = false;
24 };
bool _bcast
Definition: UDPDevice.h:21
virtual bool close() override
Definition: UDPDevice.cpp:63
bool _connected
Definition: UDPDevice.h:23
SocketAPM socket
Definition: UDPDevice.h:18
virtual ssize_t write(const uint8_t *buf, uint16_t n) override
Definition: UDPDevice.cpp:21
UDPDevice(const char *ip, uint16_t port, bool bcast, bool input)
Definition: UDPDevice.cpp:9
virtual void set_blocking(bool blocking) override
Definition: UDPDevice.cpp:68
virtual bool open() override
Definition: UDPDevice.cpp:48
virtual void set_speed(uint32_t speed) override
Definition: UDPDevice.cpp:73
bool _input
Definition: UDPDevice.h:22
virtual ssize_t read(uint8_t *buf, uint16_t n) override
Definition: UDPDevice.cpp:36
uint16_t _port
Definition: UDPDevice.h:20
const char * _ip
Definition: UDPDevice.h:19
virtual ~UDPDevice()
Definition: UDPDevice.cpp:17