digi.xbee.models.info module

class digi.xbee.models.info.XBeeLocation(latitude, longitude)[source]

Bases: object

Stores the GPS location of an XBee device as reported by its LX/LY AT parameters. Both latitude and longitude are kept as strings to preserve the original precision.

Parameters:
  • latitude (String) – Latitude value (decimal degrees).

  • longitude (String) – Longitude value (decimal degrees).

classmethod from_raw(lx_raw, ly_raw)[source]

Class constructor. Instantiates a new XBeeLocation from raw AT-command response bytes for the LX and LY parameters.

Returns None if either value is missing, empty, or cannot be interpreted as a decimal number. Commas are normalized to dots before validation so that locale-specific separators (e.g. "-2,437977") are accepted and stored as "-2.437977".

Parameters:
  • lx_raw (Bytearray) – Raw response for the LX (latitude) parameter.

  • ly_raw (Bytearray) – Raw response for the LY (longitude) parameter.

Returns:

Location instance, or None.

Return type:

XBeeLocation

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