Network

class ingenialink.ethernet.network.EthernetNetwork[source]

Network for all Ethernet communications.

close_socket()

Closes the established network socket.

connect_to_slave(target, dictionary=None, port=1061, communication_protocol=<NET_TRANS_PROT.UDP: 2>, reconnection_retries=7, reconnection_timeout=200, servo_status_listener=True, net_status_listener=True)[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.

  • port (int) – Port to connect to the slave.

  • communication_protocol (NET_TRANS_PROT) – Communication protocol, UPD or TCP.

  • reconnection_retries (int) – Number of reconnection retried before declaring

  • connected or disconnected stated. (a) –

  • reconnection_timeout (int) – Time in ms of the reconnection timeout.

  • servo_status_listener (bool) – Toggle the listener of the servo for

  • status (its) –

  • errors

  • faults

  • etc.

  • net_status_listener (bool) – Toggle the listener of the network

  • status

  • and disconnection. (connection) –

Returns

Instance of the servo connected.

Return type

EthernetServo

destroy_network()

Destroy network instance.

disconnect_from_slave(servo)[source]

Disconnects the slave from the network.

Parameters

servo (EthernetServo) – Instance of the servo connected.

static load_firmware(fw_file, target='192.168.2.22', ftp_user='', ftp_pwd='')[source]

Loads a given firmware file to the target slave.

Warning

It is needed to disconnect the drive(disconnect_from_slave()) after loading the firmware since the Servo object’s data will become obsolete.

Parameters
  • fw_file (str) – Path to the firmware file to be loaded.

  • target (str) – IP of the target slave.

  • ftp_user (str) – FTP user to connect with.

  • ftp_pwd (str) – FTP password for the given user.

Raises

ILError – If the loading firmware process fails.

static load_firmware_moco(node, subnode, ip, port, moco_file)[source]

Update MOCO firmware through UDP protocol.

Parameters
  • node – Network node.

  • subnode – Drive subnode.

  • ip – Drive address IP.

  • port – Drive port.

  • moco_file – Path to the firmware file.

Returns

Result code.

Return type

int

Raises
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

  • raised. (is) –

unsubscribe_from_status(callback)

Unsubscribe from state changes.

Parameters

callback (function) – Callback function.

property protocol

Obtain network protocol.

Type

NET_PROT

servos

List of the connected servos in the network.

Type

list

property status

Obtain network status

Type

NET_STATE