digi.xbee.models.info module

class digi.xbee.models.info.SocketInfo(socket_id, state, protocol, local_port, remote_port, remote_address)[source]

Bases: object

This class represents the information of an XBee socket:

  • Socket ID.

  • State.

  • Protocol.

  • Local port.

  • Remote port.

  • Remote address.

Class constructor. Instantiates a SocketInfo object with the given parameters.

Parameters:
  • socket_id (Integer) – The ID of the socket.

  • state (SocketInfoState) – The state of the socket.

  • protocol (IPProtocol) – The protocol of the socket.

  • local_port (Integer) – The local port of the socket.

  • remote_port (Integer) – The remote port of the socket.

  • remote_address (String) – The remote IPv4 address of the socket.

static create_socket_info(raw)[source]

Parses the given bytearray data and returns a SocketInfo object.

Parameters:

raw (Bytearray) – received data from the SI command with a socket ID as argument.

Returns:

The socket information, or None if the

provided data is invalid.

Return type:

SocketInfo

static parse_socket_list(raw)[source]

Parses the given bytearray data and returns a list with the active socket IDs.

Parameters:

raw (Bytearray) – received data from the SI command.

Returns:

list with the IDs of all active (open) sockets, or empty list

if there is not any active socket.

Return type:

List

property socket_id

Returns the ID of the socket.

Returns:

the ID of the socket.

Return type:

Integer

property state

Returns the state of the socket.

Returns:

the state of the socket.

Return type:

SocketInfoState

property protocol

Returns the protocol of the socket.

Returns:

the protocol of the socket.

Return type:

IPProtocol

property local_port

Returns the local port of the socket. This is 0 unless the socket is explicitly bound to a port.

Returns:

the local port of the socket.

Return type:

Integer

property remote_port

Returns the remote port of the socket.

Returns:

the remote port of the socket.

Return type:

Integer

property remote_address

Returns the remote IPv4 address of the socket. This is 0.0.0.0 for an unconnected socket.

Returns:

the remote IPv4 address of the socket.

Return type:

String