RoboidControl-cpp/EspIdf/EspIdfParticipant.h

30 lines
712 B
C++

#pragma once
#include "Participants/ParticipantUDP.h"
#include "lwip/sockets.h"
namespace RoboidControl {
namespace EspIdf {
class ParticipantUDP : public RoboidControl::ParticipantUDP {
public:
void Setup(int localPort, const char* remoteIpAddress, int remotePort);
void Receive();
bool Send(Participant* remoteParticipant, int bufferSize);
bool Publish(IMessage* msg);
protected:
char broadcastIpAddress[INET_ADDRSTRLEN]; // IPv4 address can have a max of 15 characters
// + null terminator
int sockfd;
struct sockaddr_in dest_addr;
//struct sockaddr_in src_addr;
void GetBroadcastAddress();
};
} // namespace EspIdf
} // namespace RoboidControl