Roboid Control for C++ 0.4
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
RoboidControl::SiteServer Class Reference

Detailed Description

A participant is device which can communicate with other participants.

#include <SiteServer.h>

Inheritance diagram for RoboidControl::SiteServer:
RoboidControl::ParticipantUDP RoboidControl::Participant

Public Member Functions

 SiteServer (int port=7681)
 Create a new site server.
 
virtual void UpdateMyThings () override
 
void begin ()
 
virtual void Update () override
 Update all things for this participant.
 
ThingGet (unsigned char thingId)
 Find a thing managed by this participant.
 
void Add (Thing *thing, bool checkId=true)
 Add a new thing for this participant.
 
void Remove (Thing *thing)
 Remove a thing for this participant.
 

Static Public Member Functions

static void ReplaceLocalParticipant (Participant &newParticipant)
 Replace the local participant.
 

Public Attributes

bool isIsolated = false
 True if the participant is running isolated. Isolated participants do not communicate with other participants.
 
ParticipantremoteSite = nullptr
 The remote site when this participant is connected to a site.
 
long publishInterval = 3000
 
bool connected = false
 
const char * name = "Participant"
 The name of the participant.
 
const char * ipAddress = "0.0.0.0"
 The Ip Address of a participant.
 
unsigned int port = 0
 The port number for UDP communication with the participant.
 
unsigned char networkId = 0
 The network Id to identify the participant.
 
Thingroot = nullptr
 The root thing for this participant.
 
unsigned char thingCount = 0
 
Thingthings [MAX_THING_COUNT]
 
std::list< Thing * > things
 The things managed by this participant.
 
char buffer [1024]
 

Static Public Attributes

static ParticipantLocalParticipant = new Participant()
 The local participant for this application.
 
static ParticipantRegistry registry
 

Protected Member Functions

virtual void Process (Participant *sender, ParticipantMsg *msg) override
 
virtual void Process (Participant *sender, NetworkIdMsg *msg) override
 
virtual void Process (Participant *sender, ThingMsg *msg) override
 
virtual void PrepMyThings ()
 Prepare the local things for the next update.
 
virtual void UpdateOtherThings ()
 
void SendThingInfo (Participant *remoteParticipant, Thing *thing)
 
void PublishThingInfo (Thing *thing)
 
virtual bool Send (IMessage *msg) override
 
bool Publish (IMessage *msg)
 
void ReceiveData (unsigned char bufferSize, char *senderIpAddress, unsigned int senderPort)
 
void ReceiveData (unsigned char bufferSize, Participant *remoteParticipant)
 
void SetupUDP (int localPort, const char *remoteIpAddress, int remotePort)
 
void ReceiveUDP ()
 
virtual void Process (Participant *sender, InvestigateMsg *msg)
 
virtual void Process (Participant *sender, NameMsg *msg)
 
virtual void Process (Participant *sender, ModelUrlMsg *msg)
 
virtual void Process (Participant *sender, PoseMsg *msg)
 
virtual void Process (Participant *sender, BinaryMsg *msg)
 
virtual void Process (Participant *sender, TextMsg *msg)
 
virtual void Process (Participant *sender, DestroyMsg *msg)
 

Protected Attributes

unsigned long nextPublishMe = 0
 
int sock
 
sockaddr_in remote_addr
 
sockaddr_in server_addr
 
sockaddr_in broadcast_addr
 

Constructor & Destructor Documentation

◆ SiteServer()

RoboidControl::SiteServer::SiteServer ( int  port = 7681)

Create a new site server.

Parameters
portThe port of which to receive the messages

Member Function Documentation

◆ UpdateMyThings()

virtual void RoboidControl::SiteServer::UpdateMyThings ( )
overridevirtual

Reimplemented from RoboidControl::ParticipantUDP.

◆ Process() [1/3]

virtual void RoboidControl::SiteServer::Process ( Participant sender,
ParticipantMsg msg 
)
overrideprotectedvirtual

Reimplemented from RoboidControl::ParticipantUDP.

◆ Process() [2/3]

virtual void RoboidControl::SiteServer::Process ( Participant sender,
NetworkIdMsg msg 
)
overrideprotectedvirtual

Reimplemented from RoboidControl::ParticipantUDP.

◆ Process() [3/3]

virtual void RoboidControl::SiteServer::Process ( Participant sender,
ThingMsg msg 
)
overrideprotectedvirtual

Reimplemented from RoboidControl::ParticipantUDP.

◆ Update()

virtual void RoboidControl::ParticipantUDP::Update ( )
overridevirtualinherited

Update all things for this participant.

Reimplemented from RoboidControl::Participant.

◆ Send()

virtual bool RoboidControl::ParticipantUDP::Send ( IMessage msg)
overrideprotectedvirtualinherited

Reimplemented from RoboidControl::Participant.

◆ ReplaceLocalParticipant()

void RoboidControl::Participant::ReplaceLocalParticipant ( Participant newParticipant)
staticinherited

Replace the local participant.

Parameters
newParticipantThe new local Participant

◆ Get()

Thing * RoboidControl::Participant::Get ( unsigned char  thingId)
inherited

Find a thing managed by this participant.

Parameters
thingIdThe ID of the thing
Returns
The thing if found, nullptr when no thing has been found

◆ Add()

void RoboidControl::Participant::Add ( Thing thing,
bool  checkId = true 
)
inherited

Add a new thing for this participant.

Parameters
thingThe thing to add
checkIdIf true, the thing.id is regenerated if it is zero

◆ Remove()

void RoboidControl::Participant::Remove ( Thing thing)
inherited

Remove a thing for this participant.

Parameters
thingThe thing to remove

Member Data Documentation

◆ publishInterval

long RoboidControl::ParticipantUDP::publishInterval = 3000
inherited

The interval in milliseconds for publishing (broadcasting) data on the local network

◆ ipAddress

const char* RoboidControl::Participant::ipAddress = "0.0.0.0"
inherited

The Ip Address of a participant.

Remarks
This does not belong here, it should move to ParticipantUDP or something like that in the future

◆ port

unsigned int RoboidControl::Participant::port = 0
inherited

The port number for UDP communication with the participant.

Remarks
This does not belong here, it should move to ParticipantUDP or something like that in the future