![]() |
Roboid Control for C#
|
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.
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< Thing > | things = new() |
The things managed by this participant. | |
Static Public Attributes | |
static readonly List< Participant > | participants = new() |
The collection of known participants. | |
RoboidControl.Participant.Participant | ( | string | ipAddress, |
int | port | ||
) |
Create a new participant with the given communcation info.
ipAddress | The IP address of the participant |
port | The UDP port of the participant |
Thing RoboidControl.Participant.Get | ( | byte | thingId | ) |
Get the thing with the given properties.
thingId | The ID of the thing |
void RoboidControl.Participant.Add | ( | Thing | thing, |
bool | checkId = true |
||
) |
Add a new thing for this participant.
thing | The thing to add |
checkId | If true, the thing.id is regenerated if it is zero |
void RoboidControl.Participant.Remove | ( | Thing | thing | ) |
Remove a thing for this participant.
thing | The thing to remove |
|
virtual |
Update all things for this participant.
currentTimeMS | The current time in milliseconds (optional) |
Reimplemented in RoboidControl.ParticipantUDP.
|
static |
Retrieve a participant using ip address and port number.
ipAddress | The ip address of the participant |
port | The port number used to send messages to the participant |
|
static |
Retrieve a participant using a network ID.
networkId | The network ID of the participant |
|
static |
Add a new participant to the collection of participants.
ipAddress | The IP address of the participant |
port | The port used to send messages to this participant |
|
static |
Add a new participant to the collection of participants.
participant | The participant to add |
<note>This function only adds the participant if it is not yet in the collection</note>