You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
658 B
50 lines
658 B
#include <AP_HAL.h> |
|
|
|
#if CONFIG_HAL_BOARD == HAL_BOARD_LINUX |
|
|
|
#include <stdio.h> |
|
|
|
#include "UDPDevice.h" |
|
|
|
UDPDevice::UDPDevice(const char *ip, uint16_t port): |
|
_ip(ip), |
|
_port(port) |
|
{ |
|
} |
|
|
|
UDPDevice::~UDPDevice() |
|
{ |
|
|
|
} |
|
|
|
ssize_t UDPDevice::write(const uint8_t *buf, uint16_t n) |
|
{ |
|
return socket.sendto(buf, n, _ip, _port, 0); |
|
} |
|
|
|
ssize_t UDPDevice::read(uint8_t *buf, uint16_t n) |
|
{ |
|
return socket.recvfrom(buf, n, 0); |
|
} |
|
|
|
bool UDPDevice::open() |
|
{ |
|
return true; |
|
} |
|
|
|
bool UDPDevice::close() |
|
{ |
|
return true; |
|
} |
|
|
|
void UDPDevice::set_blocking(bool blocking) |
|
{ |
|
socket.set_blocking(blocking); |
|
} |
|
|
|
void UDPDevice::set_speed(uint32_t speed) |
|
{ |
|
|
|
} |
|
|
|
#endif
|
|
|