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 "Messages/TextMsg.h"
13#include "Participant.h"
21#if defined(_WIN32) || defined(_WIN64)
23#elif defined(__unix__) || defined(__APPLE__)
25#include <netinet/in.h>
26#include <sys/socket.h>
30namespace RoboidControl {
32constexpr int MAX_SENDER_COUNT = 256;
65#pragma region Properties
82#if defined(__unix__) || defined(__APPLE__)
84#elif defined(_WIN32) || defined(_WIN64)
85 sockaddr_in remote_addr;
86 sockaddr_in server_addr;
87 sockaddr_in broadcast_addr;
92 bool connected =
false;
94#pragma endregion Properties
102 unsigned long nextPublishMe = 0;
106 virtual void UpdateMyThings();
107 virtual void UpdateOtherThings();
109#pragma endregion Update
114 void PublishThingInfo(
Thing* thing);
116 virtual bool Send(
IMessage* msg)
override;
119#pragma endregion Send
121#pragma region Receive
124 void ReceiveData(
unsigned char bufferSize,
125 char* senderIpAddress,
126 unsigned int senderPort);
127 void ReceiveData(
unsigned char bufferSize,
Participant* remoteParticipant);
129 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
A Message notifiying that a Thing no longer exists.
Definition DestroyMsg.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:62
unsigned int port
The port number for UDP communication with the participant.
Definition Participant.h:98
const char * ipAddress
The Ip Address of a participant.
Definition Participant.h:94
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:46
ParticipantUDP(int port=7681)
Create a participant without connecting to a site.
virtual void PrepMyThings()
Prepare the local things for the next update.
virtual void Update() override
Update all things for this participant.
Participant * remoteSite
The remote site when this participant is connected to a site.
Definition ParticipantUDP.h:73
ParticipantUDP(const char *ipAddress, int port=7681, int localPort=7681)
Create a participant which will try to connect to a site.
bool isIsolated
True if the participant is running isolated. Isolated participants do not communicate with other part...
Definition ParticipantUDP.h:70
long publishInterval
Definition ParticipantUDP.h:77
Message to communicate the pose of the thing The pose is in local space relative to the parent....
Definition PoseMsg.h:10
Message for sending generic text.
Definition TextMsg.h:6
A thing is the primitive building block.
Definition Thing.h:20
Message providing generic details about a Thing.
Definition ThingMsg.h:7