Roboid Control for C#
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
RoboidControl.LocalParticipant Class Reference

Detailed Description

A participant is used for communcation between things.

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

Public Member Functions

 LocalParticipant ()
 Create a porticiapnt.
 
 LocalParticipant (int port)
 Create a participant with the give UDP port.
 
 LocalParticipant (string ipAddress="0.0.0.0", int port=7681)
 Create a new participant for a site at the given address and port.
 
 LocalParticipant (UdpClient udpClient, int port)
 Create a participant using the given udp client.
 
Participant GetParticipant (string ipAddress, int port)
 
Participant AddParticipant (string ipAddress, int port)
 
delegate Thing ThingConstructor (Participant sender, byte networkId, byte thingId)
 
void Register (byte thingType, ThingConstructor constr)
 
void Register< ThingClass > (Thing.Type thingType)
 
void Register< ThingClass > (byte thingType)
 
virtual void Update (ulong currentTimeMS=0)
 
virtual void Publish ()
 
void SendThingInfo (Participant remoteParticipant, Thing thing)
 
bool Send (Participant remoteParticipant, IMessage msg)
 
void PublishThingInfo (Thing thing)
 
bool Publish (IMessage msg)
 
void ReceiveData (byte[] data, Participant remoteParticipant)
 
Thing Get (byte networkId, byte thingId)
 Get a thing with the given ids.
 
void Add (Thing thing, bool invokeEvent=true)
 Add a new thing for this participant.
 

Static Public Member Functions

static LocalParticipant Isolated ()
 

Public Attributes

byte[] buffer = new byte[1024]
 
ulong publishInterval = 3000
 
string name = "Participant"
 
IPEndPoint endPoint = null
 
UdpClient udpClient = null
 
string broadcastIpAddress = "255.255.255.255"
 
readonly ConcurrentQueue< IMessagemessageQueue = new ConcurrentQueue<IMessage>()
 
List< Participantowners = new List<Participant>()
 
string ipAddress = "0.0.0.0"
 The internet address of the participant.
 
int port = 0
 The UDP port on which the participant can be reached.
 
byte networkId
 The network ID of the participant.
 

Protected Member Functions

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 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 temsgxt)
 
virtual void Process (Participant sender, DestroyMsg msg)
 

Protected Attributes

readonly Dictionary< byte, Func< Participant, byte, byte, Thing > > thingMsgProcessors = new()
 
ulong nextPublishMe = 0
 
readonly List< Thingthings = new List<Thing>()
 The things reported by this participant.
 

Constructor & Destructor Documentation

◆ LocalParticipant() [1/3]

RoboidControl.LocalParticipant.LocalParticipant ( int  port)

Create a participant with the give UDP port.

Parameters
portThe port number on which to communicate

◆ LocalParticipant() [2/3]

RoboidControl.LocalParticipant.LocalParticipant ( string  ipAddress = "0.0.0.0",
int  port = 7681 
)

Create a new participant for a site at the given address and port.

Parameters
ipAddressThe ip address of the site server
portThe port number of the site server

◆ LocalParticipant() [3/3]

RoboidControl.LocalParticipant.LocalParticipant ( UdpClient  udpClient,
int  port 
)

Create a participant using the given udp client.

Parameters
udpClientUDP client to use for communication
portThe port number on which to communicate

Member Function Documentation

◆ Register< ThingClass >() [1/2]

void RoboidControl.LocalParticipant.Register< ThingClass > ( Thing::Type  thingType)
Type Constraints
ThingClass :Thing 

◆ Register< ThingClass >() [2/2]

void RoboidControl.LocalParticipant.Register< ThingClass > ( byte  thingType)
Type Constraints
ThingClass :Thing 

◆ Get()

Thing RoboidControl.Participant.Get ( byte  networkId,
byte  thingId 
)
inherited

Get a thing with the given ids.

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

◆ Add()

void RoboidControl.Participant.Add ( Thing  thing,
bool  invokeEvent = true 
)
inherited

Add a new thing for this participant.

Parameters
thingThe thing to add
invokeEventInvoke an notification event when the thing has been added