Skip to content
Zentetsu edited this page Nov 5, 2024 · 2 revisions

Module Object

class Module()

Module class focused on communicate data with other modules.

Constructor

def __init__(name: str = None, file: str = None, silent: bool = False) -> None

Class constructor.

Arguments:

  • name str, optional - desired name for the module. Defaults to None.
  • file str, optional - path to load JSON file and construct module following is content. Defaults to None.
  • silent bool, optional - True -> will not print any error, False -> will print error. Defaults to False.

Raises:

  • IRONMultiInputError - raise an error when value and path are both at None or initilalized

dumpJSON

def dumpJSON(file: str) -> None

Save the module structure into a JSON file.

Arguments:

  • file str - path to the JSON file

addListener

def addListener(name: str) -> None

Add a Shared Memory Server.

Arguments:

  • name str - Shared Memory Name

delListener

def delListener(name: str) -> None

Remove a Shared Memory Server.

Arguments:

  • name [type] - Shared Memory name

addSender

def addSender(name: str, value: any = None, path: str = None) -> None

Add a Shared Memory Client.

Arguments:

  • name str - Shared Memory name
  • value [type], optional - value to share with the other module. Defaults to None.
  • path str, optional - path to load JSON file and share the data inside. Defaults to None.

delSender

def delSender(name: str) -> None

Remove a Shared Memory Client.

Arguments:

  • name str - Shared Memory name

getLSName

def getLSName(listener: bool = True, sender: bool = True) -> list

Return a list that contains name of sender and listener.

Arguments:

  • listener bool, optional - True -> will add listener names to the list. Defaults to True.
  • sender bool, optional - True -> will ad sender names to the list. Defaults to True.

Returns:

[list, list]: list of sender and listener names

getValue

def getValue(name: str) -> any

Get value from a sender or a listener.

Arguments:

  • name str - name of the sender or listener

Returns:

  • [type] - return data

setValue

def setValue(name: str, value: any) -> None

Update data.

Arguments:

  • name str - name of the sender or listener
  • value [type] - new value to assign

getLSAvailability

def getLSAvailability(listener: bool = False, sender: bool = False) -> list

Get the availability of each sender and listener.

Arguments:

  • listener bool, optional - True -> will add listener availability. Defaults to None.
  • sender bool, optional - True -> will add sender availability. Defaults to None.

Returns:

[list, list]: list of the sender and listener availability

startModule

def startModule(name: str = None) -> None

Start senders and listeners.

Arguments:

  • name str, optional - if setted will launch only this one. Defaults to None.

stopModule

def stopModule(name: str = None) -> None

Stop senders and listeners.

Arguments:

  • name str, optional - if setted will stop only this one. Defaults to None.

startRemote

def startRemote(sender: bool, name: str = "") -> None

Start remote communication.

Arguments:

  • sender bool - True -> will start remote sender, False -> will start remote listener
  • name str, optional - name of the listener. Defaults to "".

stopRemote

def stopRemote(sender: bool, name: str = "") -> None

Stop remote communication.

Arguments:

  • sender bool - True -> will stop remote sender, False -> will stop remote listener
  • name str, optional - name of the listener. Defaults to "".

restartModule

def restartModule(name: str = None) -> None

Restart senders and listeners.

Arguments:

  • name str, optional - if setted will restart only this one. Defaults to None.

Clone this wiki locally