![]() |
Roboid Control for C# 0.4
|
A participant using UDP communication.
A local participant is the local device which can communicate with other participants It manages all local things and communcation with other participants. Each application has a local participant which is usually explicit in the code. An participant can be isolated. In that case it is standalong and does not communicate with other participants.
It is possible to work with an hidden participant by creating things without specifying a participant in the constructor. In that case an hidden isolated participant is created which can be obtained using RoboidControl::IsolatedParticipant::Isolated().
Public Member Functions | |
ParticipantUDP (int port=0) | |
Create a participant without connecting to a site. | |
ParticipantUDP (string ipAddress, int port=7681, int localPort=7681) | |
Create a participant which will try to connect to a site. | |
ParticipantUDP (string ipAddress, int port, ParticipantUDP localParticipant) | |
override void | Update () |
Update all things for this participant. | |
override bool | Send (IMessage msg) |
void | PublishThingInfo (Thing thing) |
bool | Publish (IMessage msg) |
void | ReceiveData (byte[] data, Participant sender) |
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. | |
void | SendThingInfo (Thing thing) |
Static Public Member Functions | |
static ParticipantUDP | GetParticipant (string ipAddress, int port) |
Retrieve a participant using ip address and port number. | |
static ParticipantUDP | AddParticipant (string ipAddress, int port, ParticipantUDP localParticipant=null) |
Add a new participant to the collection of participants. | |
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 | |
string | name = "ParticipantUDP" |
The name of the participant. | |
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. | |
UdpClient | udpClient = null |
The udpClient for this participant. | |
bool | isIsolated = false |
True if the participant is running isolated. | |
Participant | remoteSite = null |
The remote site when this participant is connected to a site. | |
ulong | publishIntervalMS = 3000 |
The interval in milliseconds for publishing (broadcasting) data on the local network. | |
ulong | sendUpdateIntervalMS = 100 |
IPEndPoint | endPoint = null |
string | broadcastIpAddress = "255.255.255.255" |
readonly ConcurrentQueue< IMessage > | messageQueue = new ConcurrentQueue<IMessage>() |
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. | |
Protected Member Functions | |
void | GetBroadcastAddress (IPAddress ip, IPAddress subnetMask) |
virtual void | UpdateMyThings (ulong currentTimeMS) |
virtual void | UpdateOtherThings (ulong currentTimeMS) |
void | ReceiveUDP (IAsyncResult result) |
virtual void | Process (Participant sender, ParticipantMsg msg) |
virtual void | Process (Participant sender, NetworkIdMsg msg) |
virtual void | Process (Participant sender, InvestigateMsg msg) |
virtual void | Process (Participant sender, ThingMsg msg) |
virtual Thing | ProcessNewThing (Participant owner, ThingMsg msg, bool isRemote) |
virtual void | Process (Participant sender, NameMsg msg) |
virtual void | Process (Participant sender, ModelUrlMsg msg) |
virtual void | Process (Participant sender, PoseMsg msg) |
virtual void | Process (Participant sender, BinaryMsg msg) |
virtual void | Process (Participant sender, TextMsg msg) |
virtual void | Process (Participant sender, DestroyMsg msg) |
Protected Attributes | |
ulong | nextPublishMe = 0 |
ulong | nextSendUpdate = 0 |
RoboidControl.ParticipantUDP.ParticipantUDP | ( | int | port = 0 | ) |
Create a participant without connecting to a site.
port | The port number on which to communicate |
These participant typically broadcast Participant messages to let site servers on the local network know their presence. Alternatively they can broadcast information which can be used directly by other participants.
RoboidControl.ParticipantUDP.ParticipantUDP | ( | string | ipAddress, |
int | port = 7681 , |
||
int | localPort = 7681 |
||
) |
Create a participant which will try to connect to a site.
ipAddress | The ip address of the site server |
port | The port number of the site server |
localPort | The port used by the local participant |
|
virtual |
Update all things for this participant.
Reimplemented from RoboidControl.Participant.
Reimplemented in RoboidControl.SiteServer.
|
virtual |
Reimplemented from RoboidControl.Participant.
|
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 |
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 |
|
staticinherited |
Replace the local participant.
newParticipant | The new local participant |
|
inherited |
Get the thing with the given properties.
thingId | The ID of the thing |
|
inherited |
Add a new thing for this participant.
thing | The thing to add |
checkId | If true, the thing.id is regenerated if it is zero |
|
inherited |
Remove a thing for this participant.
thing | The thing to remove |
|
staticinherited |
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 |
|
staticinherited |
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>
string RoboidControl.ParticipantUDP.ipAddress = "0.0.0.0" |
The Ip Address of a participant. When the participant is local, this contains 0.0.0.0.
This does not belong here, it should move to ParticipantUDP or something like that in the future
int RoboidControl.ParticipantUDP.port = 0 |
The port number for UDP communication with the participant. This is 0 for isolated participants.
This does not belong here, it should move to ParticipantUDP or something like that in the future
UdpClient RoboidControl.ParticipantUDP.udpClient = null |
The udpClient for this participant.
This does not belong here, it should move to ParticipantUDP or something like that in the future
bool RoboidControl.ParticipantUDP.isIsolated = false |
True if the participant is running isolated.
Isolated participants do not communicate with other participants