Network
- class ingenialink.serial.network.SerialNetwork(timeout_rd=0.5, timeout_wr=0.5)[source]
Network for all Serial communications.
- Parameters
timeout_rd (int) – Timeout for read commands.
timeout_wr (int) – Timeout for write commands.
- close_socket()
Closes the established network socket.
- connect_to_slave(target, dictionary='')[source]
Connects to a slave through the given network settings.
- Parameters
target (str) – IP of the target slave.
dictionary (str) – Path to the target dictionary file.
- Returns
Instance of the servo connected.
- Return type
SerialServo
- destroy_network()
Destroy network instance.
- disconnect_from_slave(servo)[source]
Disconnects the slave from the network.
- Parameters
servo (SerialServo) – Instance of the servo connected.
- scan_slaves()[source]
Obtain a list of network devices.
- Returns
List of network devices.
- Return type
list
- Raises
TypeError – If the protocol type is invalid.
- set_reconnection_retries(retries)
Set the number of reconnection retries in our application.
- Parameters
retries (int) – Number of reconnection retries.
- set_recv_timeout(timeout)
Set receive communications timeout.
- Parameters
timeout (int) – Timeout in ms.
- Returns
Result code.
- Return type
int
- start_status_listener()
Start monitoring network events (CONNECTION/DISCONNECTION).
- stop_status_listener()
Stop monitoring network events (CONNECTION/DISCONNECTION).
- subscribe_to_status(callback)
Calls given function everytime a connection/disconnection event is raised.
- Parameters
callback (function) – Function that will be called every time an event is raised.
- unsubscribe_from_status(callback)
Unsubscribe from state changes.
- Parameters
callback (function) – Callback function.
- servos
List of the connected servos in the network.
- Type
list