31 lines
683 B
C++
31 lines
683 B
C++
#pragma once
|
|
|
|
#include "Participants/ParticipantUDP.h"
|
|
|
|
#include "lwip/sockets.h"
|
|
|
|
namespace RoboidControl {
|
|
namespace EspIdf {
|
|
|
|
class ParticipantUDP : public RoboidControl::LocalParticipant {
|
|
public:
|
|
void Setup(int localPort, const char* remoteIpAddress, int remotePort);
|
|
void Receive();
|
|
bool Send(Participant* remoteParticipant, int bufferSize);
|
|
bool Publish(IMessage* msg);
|
|
|
|
protected:
|
|
// const char* remoteIpAddress = nullptr;
|
|
// unsigned short remotePort = 0;
|
|
char* broadcastIpAddress = nullptr;
|
|
|
|
int sockfd;
|
|
struct sockaddr_in dest_addr;
|
|
struct sockaddr_in src_addr;
|
|
|
|
void GetBroadcastAddress();
|
|
};
|
|
|
|
} // namespace EspIdf
|
|
} // namespace RoboidControl
|