Roboid Control for Python 0.4
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 SiteServer

Public Member Functions

None __init__ (self, str ip_address=None, int port=None, 'Participant' local_participant=None)
 Create a new participant with the given communcation info.
 
 GetLocalParticipant ()
 
 ReplaceLocalParticipant ('Participant' newParticipant)
 
Optional[ 'Thing'] Get (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.
 
 Update (self)
 Update all things for this participant.
 
bool Send (self, msg)
 
'ParticipantAddParticipant (Union[str, 'Participant'] arg1, Optional[int] port=None, 'Participant' local_participant=None)
 Add a participant.
 

Static Public Member Functions

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

Public Attributes

 udp_socket
 
 things
 
 ip_address
 
 port
 

Static Public Attributes

str local_participant = None
 
set participants = set()
 
 local_participant
 

Constructor & Destructor Documentation

◆ __init__()

None __init__ (   self,
str   ip_address = None,
int   port = None,
'Participant'   local_participant = None 
)

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 SiteServer, and 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() [1/2]

None Update (   self,
int   currentTimeMs = 0 
)

Update all things for this participant.

Parameters
Thecurrent time in milliseconds (optional)

Reimplemented in ParticipantUDP.

◆ Update() [2/2]

Update (   self)

Update all things for this participant.

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,
'Participant'   local_participant = 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: