ports.Port

class ports.Port

Class to group port access methods.

static assigned(port: int) bool

Returns whether a controllable is assigned to port port.

from ports import Port, PortReference

if Port.assigned(0):
    print("Port 0: " + PortReference(0).name())
else:
    print("Port 0 is unassigned")
static port_type(port: int) Optional[type]

Returns the reference type of the controllable assigned to port port if one exists; otherwise returns None.

from ports import Port

controllable_class = Port.port_type(0)
if controllable_class != None:
    print("Port 0: " + str(controllable_class))
else:
    print("Port 0 is unassigned")
static ports() list[int]

Returns a list of ports that are occupied.

from ports import Port

for port in Port.ports():
    print("Port #" + str(port) + ": is assigned")