Roboid Control for Python
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
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 Participant:
ParticipantUDP

Public Member Functions

None __init__ (self, str ip_address, int port)
 Create a new participant with the given communcation info.
 
Optional[ThingGet (self, int thing_id)
 Get the thing with the given properties.
 
 Add (self, Thing thing, bool check_id=True)
 Add a new thing for this participant.
 
None Remove (self, Thing thing)
 Remove a thing for this participant.
 
None Update (self, int currentTimeMs=0)
 Update all things for this participant.
 
'ParticipantAddParticipant (Union[str, 'Participant'] arg1, Optional[int] port=None)
 Add a participant.
 

Static Public Member Functions

Optional[ 'Participant'] GetParticipant (Union[str, int] arg1, Optional[int] port=None)
 Retrieve a participant.
 

Public Attributes

 things
 

Static Public Attributes

set participants = set()
 

Constructor & Destructor Documentation

◆ __init__()

None __init__ (   self,
str  ip_address,
int  port 
)

Create a new participant with the given communcation info.

Parameters
ip_addressThe IP address of the participant
portThe UDP port of the participant

Reimplemented in ParticipantUDP.

Member Function Documentation

◆ Get()

Optional[Thing] Get (   self,
int  thing_id 
)

Get the thing with the given properties.

Parameters
thing_idThe ID of the thing
Returns
The thing if found, None in other cases

◆ Add()

Add (   self,
Thing  thing,
bool   check_id = True 
)

Add a new thing for this participant.

Parameters
thingThe thing to add
check_idIf true, the thing.id is regenerated if it is zero

◆ Remove()

None Remove (   self,
Thing  thing 
)

Remove a thing for this participant.

Parameters
thingThe thing to remove

◆ Update()

None Update (   self,
int   currentTimeMs = 0 
)

Update all things for this participant.

Parameters
Thecurrent time in milliseconds (optional)

Reimplemented in ParticipantUDP.

◆ GetParticipant()

Optional['Participant'] GetParticipant ( Union[str, int]  arg1,
Optional[int]   port = None 
)
static

Retrieve a participant.

Parameters
arg1Either:
  • str: The IP address of the participant
  • int: The network ID of the participant
portThe port number of the participant

◆ AddParticipant()

'Participant' AddParticipant ( Union[str, 'Participant']  arg1,
Optional[int]   port = None 
)

Add a participant.

Parameters
arg1Either:
  • str: The IP address of the participant
  • Participant: The participant to add
portThe port number of the participant

The documentation for this class was generated from the following file: