3#include "Messages/BinaryMsg.h"
4#include "Messages/DestroyMsg.h"
5#include "Messages/InvestigateMsg.h"
6#include "Messages/ModelUrlMsg.h"
7#include "Messages/NameMsg.h"
8#include "Messages/ParticipantMsg.h"
9#include "Messages/PoseMsg.h"
10#include "Messages/NetworkIdMsg.h"
11#include "Messages/ThingMsg.h"
12#include "Participant.h"
20#if defined(_WIN32) || defined(_WIN64)
22#elif defined(__unix__) || defined(__APPLE__)
24#include <netinet/in.h>
25#include <sys/socket.h>
29namespace RoboidControl {
31constexpr int MAX_SENDER_COUNT = 256;
82 const char*
name =
"ParticipantUDP";
88#if defined(__unix__) || defined(__APPLE__)
90#elif defined(_WIN32) || defined(_WIN64)
91 sockaddr_in remote_addr;
92 sockaddr_in server_addr;
93 sockaddr_in broadcast_addr;
98 bool connected =
false;
103 virtual void Update(
unsigned long currentTimeMs = 0)
override;
106 unsigned long nextPublishMe = 0;
108 virtual void UpdateMyThings(
unsigned long currentTimeMs);
109 virtual void UpdateOtherThings(
unsigned long currentTimeMs);
111#pragma endregion Update
116 void PublishThingInfo(
Thing* thing);
121#pragma endregion Send
123#pragma region Receive
126 void ReceiveData(
unsigned char bufferSize,
127 char* senderIpAddress,
128 unsigned int senderPort);
129 void ReceiveData(
unsigned char bufferSize,
Participant* remoteParticipant);
131 void SetupUDP(
int localPort,
const char* remoteIpAddress,
int remotePort);
144#pragma endregion Receive
A message containing binary data for custom communication.
Definition BinaryMsg.h:9
Root structure for all communcation messages.
Definition IMessage.h:6
Message to request details for a Thing.
Definition InvestigateMsg.h:9
Message for communicating the URL for a model of the thing.
Definition ModelUrlMsg.h:9
Message for communicating the name of a thing.
Definition NameMsg.h:9
A message communicating the network ID for that participant.
Definition NetworkIdMsg.h:8
A participant is a device which manages things. It can communicate with other participant to synchron...
Definition Participant.h:52
unsigned int port
The port number for UDP communication with the participant.
Definition Participant.h:57
const char * ipAddress
The Ip Address of a participant.
Definition Participant.h:55
A participant messages notifies other participants of its presence When received by another participa...
Definition ParticipantMsg.h:10
A participant using UDP communication A local participant is the local device which can communicate w...
Definition ParticipantUDP.h:45
const char * name
The name of the participant.
Definition ParticipantUDP.h:82
Participant * remoteSite
The remote site when this participant is connected to a site.
Definition ParticipantUDP.h:75
bool isIsolated
True if the participant is running isolated. Isolated participants do not communicate with other part...
Definition ParticipantUDP.h:73
long publishInterval
Definition ParticipantUDP.h:79
static ParticipantUDP * Isolated()
Isolated participant is used when the application is run without networking.
Definition ParticipantUDP.cpp:32
virtual void Update(unsigned long currentTimeMs=0) override
Update all things for this participant.
Definition ParticipantUDP.cpp:69
Message to communicate the pose of the thing The pose is in local space relative to the parent....
Definition PoseMsg.h:10
A thing is the primitive building block.
Definition Thing.h:20
Message providing generic details about a Thing.
Definition ThingMsg.h:7