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.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) → ingenialink.ethernet.servo.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: ingenialink.ethernet.servo.EthernetServo) → None[source]¶ Disconnects the slave from the network.
- Parameters
servo – Instance of the servo connected.
-
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[[ingenialink.network.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[[ingenialink.network.NET_DEV_EVT], Any]) → None¶ Unsubscribe from network state changes.
- Parameters
ip – IP of the drive to unsubscribe.
callback – Callback function.
-
property
protocol
¶ Obtain network protocol.