![]() |
Roboid Control for C# 0.4
|
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.
Classes | |
class | UpdateEvent |
Event for a participant. More... | |
Public Member Functions | |
Participant () | |
Create a generic participant. | |
Participant (string ipAddress, int port, Participant localParticipant=null) | |
Create a new participant with the given communcation info. | |
Thing | Get (byte networkId, 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 () |
Update all things for this participant. | |
virtual bool | Send (IMessage msg) |
void | SendThingInfo (Thing thing) |
Static Public Member Functions | |
static void | ReplaceLocalParticipant (Participant newParticipant) |
Replace the local participant. | |
static Participant | GetParticipant (int networkId) |
Retrieve a participant using ip address and port number. | |
static void | AddParticipant (Participant participant) |
Add a new participant to the collection of participants. | |
Public Attributes | |
byte | networkId = 0 |
The network Id to identify the participant. | |
bool | isRemote = false |
Thing | root = null |
The root thing for this participant. | |
readonly List< Thing > | things = new() |
The things managed by this participant. | |
Unity.Participant | component = null |
A reference to the representation of the thing in Unity. | |
ConcurrentQueue< UpdateEvent > | updateQueue = new() |
Queue containing events happened to this participant. | |
byte[] | buffer = new byte[1024] |
Static Public Attributes | |
static Participant | localParticipant = new() |
The local participant for this application. | |
static readonly List< Participant > | participants = new() |
The collection of known participants. | |
RoboidControl.Participant.Participant | ( | string | ipAddress, |
int | port, | ||
Participant | localParticipant = null |
||
) |
Create a new participant with the given communcation info.
ipAddress | The IP address of the participant |
port | The UDP port of the participant |
This does not belong here, it should move to ParticipantUDP or something like that in the future
|
static |
Replace the local participant.
newParticipant | The new local participant |
Thing RoboidControl.Participant.Get | ( | byte | networkId, |
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.
Reimplemented in RoboidControl.ParticipantUDP, and RoboidControl.SiteServer.
|
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 |
Retrieve a participant using a network ID
networkId | The network ID of the 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>