Roboid Control for C#
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.

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

Public Member Functions

 Participant (string ipAddress, int port)
 Create a new participant with the given communcation info.
 
Thing Get (byte thingId)
 Get the thing with the given properties.
 
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 (ulong currentTimeMS=0)
 Update all things for this participant.
 

Static Public Member Functions

static Participant GetParticipant (string ipAddress, int port)
 Retrieve a participant using ip address and port number.
 
static Participant GetParticipant (int networkId)
 Retrieve a participant using a network ID.
 
static Participant AddParticipant (string ipAddress, int port)
 Add a new participant to the collection of participants.
 
static void AddParticipant (Participant participant)
 Add a new participant to the collection of participants.
 

Public Attributes

string 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.
 
byte networkId = 0
 he network Id to identify the participant
 
readonly List< Thingthings = new()
 The things managed by this participant.
 

Static Public Attributes

static readonly List< Participantparticipants = new()
 The collection of known participants.
 

Constructor & Destructor Documentation

◆ Participant()

RoboidControl.Participant.Participant ( string  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

Member Function Documentation

◆ Get()

Thing RoboidControl.Participant.Get ( byte  thingId)

Get the thing with the given properties.

Parameters
thingIdThe ID of the thing
Returns
The thing when it is found, null in other cases.

◆ 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()

virtual void RoboidControl.Participant.Update ( ulong  currentTimeMS = 0)
virtual

Update all things for this participant.

Parameters
currentTimeMSThe current time in milliseconds (optional)

Reimplemented in RoboidControl.ParticipantUDP.

◆ GetParticipant() [1/2]

static Participant RoboidControl.Participant.GetParticipant ( string  ipAddress,
int  port 
)
static

Retrieve a participant using ip address and port number.

Parameters
ipAddressThe ip address of the participant
portThe port number used to send messages to the participant
Returns
The participant or null if it is not found.

◆ GetParticipant() [2/2]

static Participant RoboidControl.Participant.GetParticipant ( int  networkId)
static

Retrieve a participant using a network ID.

Parameters
networkIdThe network ID of the participant
Returns
The participant or null if it is not found.

◆ AddParticipant() [1/2]

static Participant RoboidControl.Participant.AddParticipant ( string  ipAddress,
int  port 
)
static

Add a new participant to the collection of participants.

Parameters
ipAddressThe IP address of the participant
portThe port used to send messages to this participant
Returns
The added participant

◆ AddParticipant() [2/2]

static void RoboidControl.Participant.AddParticipant ( Participant  participant)
static

Add a new participant to the collection of participants.

Parameters
participantThe participant to add

<note>This function only adds the participant if it is not yet in the collection</note>