Network
- class ingenialink.eoe.network.EoENetwork(ifname: str, connection_timeout: float = 1)[source]
Network for EoE (Ethernet over EtherCAT) communication.
- Parameters:
ifname – Network interface name.
connection_timeout – Time in seconds of the connection timeout to the EoE service.
- static close_socket(sock: socket) None
Closes the established network socket.
- connect_to_slave(slave_id: int, ip_address: str, dictionary: str, port: int = 1061, connection_timeout: float = 1, servo_status_listener: bool = False, net_status_listener: bool = False) EthernetServo [source]
Connects to a slave through the given network settings.
- Parameters:
slave_id – EtherCAT slave ID.
ip_address – IP address to be assigned to the slave.
dictionary – Path to the target dictionary file.
port – Port to connect to the slave.
connection_timeout – Time in seconds of the connection timeout.
servo_status_listener – Toggle the listener of the servo for its status, errors, faults, etc.
net_status_listener – Toggle the listener of the network status, connection and disconnection.
- Raises:
- Returns:
Instance of the servo connected.
- Return type:
EthernetServo
- disconnect_from_slave(servo: EthernetServo) None [source]
Disconnects the slave from the network.
- Parameters:
servo – Instance of the servo connected.
- get_servo_state(servo_id: int | str) NET_STATE
Get the state of a servo that’s a part of network. The state indicates if the servo is connected or disconnected.
- Parameters:
servo_id – The servo’s IP address.
- Returns:
The servo’s state.
- scan_slaves() List[int] [source]
Scan slaves connected to the network adapter.
- Returns:
List containing the ids of the connected slaves.
- Raises:
ILError – If the EoE service fails to perform a scan.
- start_status_listener() None
Start monitoring network events (CONNECTION/DISCONNECTION).
- stop_status_listener() None
Stops the NetStatusListener from listening to the drive.
- subscribe_to_status(ip: str, callback: Callable[[NET_DEV_EVT], Any]) None
Subscribe to network state changes.
- Parameters:
ip – IP of the drive to subscribe.
callback – Callback function.
- unsubscribe_from_status(ip: str, callback: Callable[[NET_DEV_EVT], Any]) None
Unsubscribe from network state changes.
- Parameters:
ip – IP of the drive to unsubscribe.
callback – Callback function.
- servos: List[Any]
List of the connected servos in the network.