Roboid Control for C++ 0.4
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public 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::ParticipantUDP RoboidControl::SiteServer

Public Member Functions

 Participant ()
 Create a generic participant.
 
 Participant (const char *ipAddress, int port)
 Create a new participant with the given communcation info.
 
 ~Participant ()
 Destructor for the 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.
 
virtual void Update ()
 Update all things for this participant.
 
virtual bool Send (IMessage *msg)
 

Static Public Member Functions

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

Public Attributes

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
 

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 UDP port of the participant
Remarks
This does not belong here, it should move to ParticipantUDP or something like that in the future

Member Function Documentation

◆ ReplaceLocalParticipant()

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

Replace the local participant.

Parameters
newParticipantThe new local Participant

◆ Get()

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

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 
)

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)

Remove a thing for this participant.

Parameters
thingThe thing to remove

◆ Update()

void RoboidControl::Participant::Update ( )
virtual

Update all things for this participant.

Reimplemented in RoboidControl::ParticipantUDP.

Member Data Documentation

◆ ipAddress

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

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

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