Network¶
- class pyniryo_nate.components.Network(http_client: HttpClient, mqtt_client: MqttClient, correlation_id: str)[source]¶
Bases:
BaseAPIComponentNetwork component for inspecting and configuring the robot’s network interfaces.
Methods
closeClose the component and release any resources if needed.
Get the actual state of all network interfaces.
Get the configuration of a network interface.
Get the actual state of a network interface.
Set a callback to be called when the state of a network interface changes.
Reset network settings to their default values.
Update the configuration of a network interface.
- Parameters:
http_client (HttpClient)
mqtt_client (MqttClient)
correlation_id (str)
- get_all_interfaces() list[InterfaceState][source]¶
Get the actual state of all network interfaces.
- Returns:
The list of all network interfaces’ states.
- Return type:
list[InterfaceState]
- get_interface_state(interface_id: str) InterfaceState[source]¶
Get the actual state of a network interface.
- Parameters:
interface_id (str) – The ID of the network interface.
- Returns:
The current state of the network interface.
- Return type:
- get_interface_config(interface_id: str) InterfaceConfig[source]¶
Get the configuration of a network interface.
- Parameters:
interface_id (str) – The ID of the network interface.
- Returns:
The current configuration of the network interface.
- Return type:
- set_interface_config(interface_id: str, config: InterfaceConfig) InterfaceConfig[source]¶
Update the configuration of a network interface.
- Parameters:
interface_id (str) – The ID of the network interface.
config (InterfaceConfig) – The configuration to apply.
- Returns:
The updated configuration of the network interface.
- Return type:
- reset(interfaces: list[str] | None = None) None[source]¶
Reset network settings to their default values.
- Parameters:
interfaces (list[str] | None) – The IDs of the network interfaces to reset. If None, reset all the interfaces.
- Return type:
None
- on_interface_state(interface_id: str, callback: Callable[[InterfaceState], None]) Callable[[], None][source]¶
Set a callback to be called when the state of a network interface changes.
- Parameters:
interface_id (str) – The ID of the network interface to subscribe to.
callback (Callable[[InterfaceState], None]) – The callback function that takes an InterfaceState parameter.
- Return type:
Callable[[], None]