RoboidControl-python/Participant.py
2025-03-09 15:00:34 +01:00

23 lines
676 B
Python

class Participant:
def __init__(self, ip_address, port):
self.ip_addres = ip_address
self.port = port
self.things = set({ None })
def Add(self, thing):
thing.id = len(self.things)
self.things.add(thing)
def Get(self, network_id, thing_id):
for thing in self.things:
if thing is not None:
if thing.network_id == network_id and thing.id == thing_id:
return thing
return None
## Update all things
def Update(self, currentTimeMs):
for thing in list(self.things):
if thing is not None:
thing.update(currentTimeMs)