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

Detailed Description

A participant is a device which manages things. It can communicate with other participant to synchronise the state of things. This class is used to register the things the participant is managing. It also maintains the communcation information to contact the participant. It is used as a basis for the local participant, but also as a reference to remote participants.

#include <Participant.h>

Inheritance diagram for RoboidControl::Participant:
RoboidControl::LocalParticipant RoboidControl::SiteServer

Public Member Functions

 Participant ()
 Default constructor.
 
 Participant (const char *ipAddress, int port)
 Create a new participant with the given communcation info.
 
 ~Participant ()
 Destructor for the participant.
 
ThingGet (unsigned char networkId, 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.
 

Public Attributes

const char * ipAddress = "0.0.0.0"
 The Ip Address of a participant. When the participant is local, this contains 0.0.0.0.
 
int port = 0
 The port number for UDP communication with the participant. This is 0 for isolated participants.
 
unsigned char networkId = 0
 The network Id to identify the participant.
 

Protected Attributes

unsigned char thingCount = 0
 
Thingthings [MAX_THING_COUNT]
 
std::list< Thing * > things
 The list of things managed by this participant.
 

Constructor & Destructor Documentation

◆ Participant()

RoboidControl::Participant::Participant ( const char *  ipAddress,
int  port 
)

Create a new participant with the given communcation info.

Parameters
ipAddressThe IP address of the participant
portThe port of the participant

Member Function Documentation

◆ Get()

Thing * RoboidControl::Participant::Get ( unsigned char  networkId,
unsigned char  thingId 
)

Find a thing managed by this participant.

Parameters
networkIdThe network ID for the thing
thingIdThe ID of the thing
Returns
The thing if found or nullptr when no thing has been found
Note
The use of the network ID is likely to disappear in future versions.

◆ Add()

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

Add a new thing for this participant.

Parameters
thingThe thing to add
checkIdChecks the thing ID of the thing. If it is 0, a new thing Id will be assigned.

◆ Remove()

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

Remove a thing for this participant.

Parameters
thingThe thing to remove

Member Data Documentation

◆ networkId

unsigned char RoboidControl::Participant::networkId = 0

The network Id to identify the participant.

Note
This field is likely to disappear in future versions