добавил все для наземной станции
This commit is contained in:
37
ground/udp-driver.h
Normal file
37
ground/udp-driver.h
Normal file
@@ -0,0 +1,37 @@
|
||||
#ifndef SDRPI_FPV_CONTROL_GROUND_UDP_DRIVER_H
|
||||
#define SDRPI_FPV_CONTROL_GROUND_UDP_DRIVER_H
|
||||
|
||||
#include <string>
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
#pragma comment(lib, "ws2_32.lib")
|
||||
#else
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
class UDPSocket {
|
||||
public:
|
||||
UDPSocket(const std::string& ip, uint16_t port);
|
||||
~UDPSocket();
|
||||
bool sendFrame(const std::vector<uint16_t>& data);
|
||||
|
||||
private:
|
||||
#ifdef _WIN32
|
||||
SOCKET sockfd;
|
||||
WSADATA wsaData;
|
||||
#else
|
||||
int sockfd;
|
||||
#endif
|
||||
sockaddr_in dest_addr;
|
||||
|
||||
bool initialize();
|
||||
};
|
||||
|
||||
#endif //SDRPI_FPV_CONTROL_GROUND_UDP_DRIVER_H
|
||||
Reference in New Issue
Block a user