digi.xbee.packets.socket module¶
-
class
digi.xbee.packets.socket.SocketCreatePacket(frame_id, protocol)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacketThis class represents a Socket Create packet. Packet is built using the parameters of the constructor.
Use this frame to create a new socket with the following protocols: TCP, UDP, or TLS.
See also
Class constructor. Instantiates a new
SocketCreatePacketobject with the provided parameters.- Parameters
frame_id (Integer) – the frame ID of the packet.
protocol (
IPProtocol) – the protocol used to create the socket.
See also
- Raises
ValueError – if
frame_idis less than 0 or greater than 255.
-
static
create_packet(raw, operating_mode)[source]¶ Override method.
- Returns
- Raises
InvalidPacketException – if the bytearray length is less than 7. (start delim. + length (2 bytes) + frame type + frame id + protocol + checksum = 7 bytes).
InvalidPacketException – if the length field of ‘raw’ is different than its real length. (length field: bytes 2 and 3)
InvalidPacketException – if the first byte of ‘raw’ is not the header byte. See
SpecialByte.InvalidPacketException – if the calculated checksum is different than the checksum field value (last byte).
InvalidPacketException – if the frame type is not
ApiFrameType.SOCKET_CREATE.InvalidOperatingModeException – if
operating_modeis not supported.
See also
XBeeAPIPacket._check_api_packet()
-
property
protocol¶ IPProtocol. Communication protocol.
-
property
frame_id¶ Returns the frame ID of the packet.
- Returns
the frame ID of the packet.
- Return type
Integer
-
get_checksum()¶ Returns the checksum value of this XBeePacket.
The checksum is the last 8 bits of the sum of the bytes between the length field and the checksum field.
- Returns
checksum value of this XBeePacket.
- Return type
Integer
See also
-
get_frame_spec_data()¶ Override method.
See also
-
get_frame_type()¶ Returns the frame type of this packet.
- Returns
the frame type of this packet.
- Return type
See also
-
get_frame_type_value()¶ Returns the frame type integer value of this packet.
- Returns
the frame type integer value of this packet.
- Return type
Integer
See also
-
is_broadcast()¶ Returns whether this packet is broadcast or not.
- Returns
Trueif this packet is broadcast,Falseotherwise.- Return type
Boolean
-
output(escaped=False)¶ Returns the raw bytearray of this XBeePacket, ready to be send by the serial port.
- Parameters
escaped (Boolean) – indicates if the raw bytearray will be escaped or not.
- Returns
raw bytearray of the XBeePacket.
- Return type
Bytearray
-
to_dict()¶ Returns a dictionary with all information of the XBeePacket fields.
- Returns
dictionary with all information of the XBeePacket fields.
- Return type
Dictionary
-
static
unescape_data(data)¶ Un-escapes the provided bytearray data.
- Parameters
data (Bytearray) – the bytearray to unescape.
- Returns
dataunescaped.- Return type
Bytearray
-
class
digi.xbee.packets.socket.SocketCreateResponsePacket(frame_id, socket_id, status)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacketThis class represents a Socket Create Response packet. Packet is built using the parameters of the constructor.
The device sends this frame in response to a Socket Create (0x40) frame. It contains a socket ID that should be used for future transactions with the socket and a status field.
If the status field is non-zero, which indicates an error, the socket ID will be set to 0xFF and the socket will not be opened.
See also
Class constructor. Instantiates a new
SocketCreateResponsePacketobject with the provided parameters.- Parameters
frame_id (Integer) – the frame ID of the packet.
socket_id (Integer) – the unique socket ID to address the socket.
status (
SocketStatus) – the socket create status.
See also
- Raises
ValueError – if
frame_idis less than 0 or greater than 255.ValueError – if
socket_idis less than 0 or greater than 255.
-
static
create_packet(raw, operating_mode)[source]¶ Override method.
- Returns
- Raises
InvalidPacketException – if the bytearray length is less than 8. (start delim. + length (2 bytes) + frame type + frame id + socket id + status + checksum = 8 bytes).
InvalidPacketException – if the length field of ‘raw’ is different than its real length. (length field: bytes 2 and 3)
InvalidPacketException – if the first byte of ‘raw’ is not the header byte. See
SpecialByte.InvalidPacketException – if the calculated checksum is different than the checksum field value (last byte).
InvalidPacketException – if the frame type is not
ApiFrameType.SOCKET_CREATE_RESPONSE.InvalidOperatingModeException – if
operating_modeis not supported.
See also
XBeeAPIPacket._check_api_packet()
-
property
socket_id¶ Integer. Socket ID.
-
property
status¶ SocketStatus. Socket create status.
-
property
frame_id¶ Returns the frame ID of the packet.
- Returns
the frame ID of the packet.
- Return type
Integer
-
get_checksum()¶ Returns the checksum value of this XBeePacket.
The checksum is the last 8 bits of the sum of the bytes between the length field and the checksum field.
- Returns
checksum value of this XBeePacket.
- Return type
Integer
See also
-
get_frame_spec_data()¶ Override method.
See also
-
get_frame_type()¶ Returns the frame type of this packet.
- Returns
the frame type of this packet.
- Return type
See also
-
get_frame_type_value()¶ Returns the frame type integer value of this packet.
- Returns
the frame type integer value of this packet.
- Return type
Integer
See also
-
is_broadcast()¶ Returns whether this packet is broadcast or not.
- Returns
Trueif this packet is broadcast,Falseotherwise.- Return type
Boolean
-
output(escaped=False)¶ Returns the raw bytearray of this XBeePacket, ready to be send by the serial port.
- Parameters
escaped (Boolean) – indicates if the raw bytearray will be escaped or not.
- Returns
raw bytearray of the XBeePacket.
- Return type
Bytearray
-
to_dict()¶ Returns a dictionary with all information of the XBeePacket fields.
- Returns
dictionary with all information of the XBeePacket fields.
- Return type
Dictionary
-
static
unescape_data(data)¶ Un-escapes the provided bytearray data.
- Parameters
data (Bytearray) – the bytearray to unescape.
- Returns
dataunescaped.- Return type
Bytearray
-
class
digi.xbee.packets.socket.SocketOptionRequestPacket(frame_id, socket_id, option, option_data=None)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacketThis class represents a Socket Option Request packet. Packet is built using the parameters of the constructor.
Use this frame to modify the behavior of sockets to be different from the normal default behavior.
If the Option Data field is zero-length, the Socket Option Response Packet (0xC1) reports the current effective value.
See also
Class constructor. Instantiates a new
SocketOptionRequestPacketobject with the provided parameters.- Parameters
frame_id (Integer) – the frame ID of the packet.
socket_id (Integer) – the socket ID to modify.
option (
SocketOption) – the socket option of the parameter to change.option_data (Bytearray, optional) – the option data. Optional.
See also
- Raises
ValueError – if
frame_idis less than 0 or greater than 255.ValueError – if
socket_idis less than 0 or greater than 255.
-
static
create_packet(raw, operating_mode)[source]¶ Override method.
- Returns
- Raises
InvalidPacketException – if the bytearray length is less than 8. (start delim. + length (2 bytes) + frame type + frame id + socket id + option + checksum = 8 bytes).
InvalidPacketException – if the length field of ‘raw’ is different than its real length. (length field: bytes 2 and 3)
InvalidPacketException – if the first byte of ‘raw’ is not the header byte. See
SpecialByte.InvalidPacketException – if the calculated checksum is different than the checksum field value (last byte).
InvalidPacketException – if the frame type is not
ApiFrameType.SOCKET_OPTION_REQUEST.InvalidOperatingModeException – if
operating_modeis not supported.
See also
XBeeAPIPacket._check_api_packet()
-
property
socket_id¶ Integer. Socket ID.
-
property
option¶ SocketOption. Socket option.
-
property
option_data¶ Bytearray. Socket option data.
-
property
frame_id¶ Returns the frame ID of the packet.
- Returns
the frame ID of the packet.
- Return type
Integer
-
get_checksum()¶ Returns the checksum value of this XBeePacket.
The checksum is the last 8 bits of the sum of the bytes between the length field and the checksum field.
- Returns
checksum value of this XBeePacket.
- Return type
Integer
See also
-
get_frame_spec_data()¶ Override method.
See also
-
get_frame_type()¶ Returns the frame type of this packet.
- Returns
the frame type of this packet.
- Return type
See also
-
get_frame_type_value()¶ Returns the frame type integer value of this packet.
- Returns
the frame type integer value of this packet.
- Return type
Integer
See also
-
is_broadcast()¶ Returns whether this packet is broadcast or not.
- Returns
Trueif this packet is broadcast,Falseotherwise.- Return type
Boolean
-
output(escaped=False)¶ Returns the raw bytearray of this XBeePacket, ready to be send by the serial port.
- Parameters
escaped (Boolean) – indicates if the raw bytearray will be escaped or not.
- Returns
raw bytearray of the XBeePacket.
- Return type
Bytearray
-
to_dict()¶ Returns a dictionary with all information of the XBeePacket fields.
- Returns
dictionary with all information of the XBeePacket fields.
- Return type
Dictionary
-
static
unescape_data(data)¶ Un-escapes the provided bytearray data.
- Parameters
data (Bytearray) – the bytearray to unescape.
- Returns
dataunescaped.- Return type
Bytearray
-
class
digi.xbee.packets.socket.SocketOptionResponsePacket(frame_id, socket_id, option, status, option_data=None)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacketThis class represents a Socket Option Response packet. Packet is built using the parameters of the constructor.
Reports the status of requests made with the Socket Option Request (0x41) packet.
See also
Class constructor. Instantiates a new
SocketOptionResponsePacketobject with the provided parameters.- Parameters
frame_id (Integer) – the frame ID of the packet.
socket_id (Integer) – the socket ID for which modification was requested.
option (
SocketOption) – the socket option of the parameter requested.status (
SocketStatus) – the socket option status of the parameter requested.option_data (Bytearray, optional) – the option data. Optional.
See also
- Raises
ValueError – if
frame_idis less than 0 or greater than 255.ValueError – if
socket_idis less than 0 or greater than 255.
-
static
create_packet(raw, operating_mode)[source]¶ Override method.
- Returns
- Raises
InvalidPacketException – if the bytearray length is less than 9. (start delim. + length (2 bytes) + frame type + frame id + socket id + option + status + checksum = 9 bytes).
InvalidPacketException – if the length field of ‘raw’ is different than its real length. (length field: bytes 2 and 3)
InvalidPacketException – if the first byte of ‘raw’ is not the header byte. See
SpecialByte.InvalidPacketException – if the calculated checksum is different than the checksum field value (last byte).
InvalidPacketException – if the frame type is not
ApiFrameType.SOCKET_OPTION_RESPONSE.InvalidOperatingModeException – if
operating_modeis not supported.
See also
XBeeAPIPacket._check_api_packet()
-
property
socket_id¶ Integer. Socket ID.
-
property
option¶ SocketOption. Socket option.
-
property
status¶ SocketStatus. Socket option status
-
property
option_data¶ Bytearray. Socket option data.
-
property
frame_id¶ Returns the frame ID of the packet.
- Returns
the frame ID of the packet.
- Return type
Integer
-
get_checksum()¶ Returns the checksum value of this XBeePacket.
The checksum is the last 8 bits of the sum of the bytes between the length field and the checksum field.
- Returns
checksum value of this XBeePacket.
- Return type
Integer
See also
-
get_frame_spec_data()¶ Override method.
See also
-
get_frame_type()¶ Returns the frame type of this packet.
- Returns
the frame type of this packet.
- Return type
See also
-
get_frame_type_value()¶ Returns the frame type integer value of this packet.
- Returns
the frame type integer value of this packet.
- Return type
Integer
See also
-
is_broadcast()¶ Returns whether this packet is broadcast or not.
- Returns
Trueif this packet is broadcast,Falseotherwise.- Return type
Boolean
-
output(escaped=False)¶ Returns the raw bytearray of this XBeePacket, ready to be send by the serial port.
- Parameters
escaped (Boolean) – indicates if the raw bytearray will be escaped or not.
- Returns
raw bytearray of the XBeePacket.
- Return type
Bytearray
-
to_dict()¶ Returns a dictionary with all information of the XBeePacket fields.
- Returns
dictionary with all information of the XBeePacket fields.
- Return type
Dictionary
-
static
unescape_data(data)¶ Un-escapes the provided bytearray data.
- Parameters
data (Bytearray) – the bytearray to unescape.
- Returns
dataunescaped.- Return type
Bytearray
-
class
digi.xbee.packets.socket.SocketConnectPacket(frame_id, socket_id, dest_port, dest_address_type, dest_address)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacketThis class represents a Socket Connect packet. Packet is built using the parameters of the constructor.
Use this frame to create a socket connect message that causes the device to connect a socket to the given address and port.
For a UDP socket, this filters out any received responses that are not from the specified remote address and port.
Two frames occur in response:
Socket Connect Response frame (
SocketConnectResponsePacket): Arrives immediately and confirms the request.Socket Status frame (
SocketStatePacket): Indicates if the connection was successful.
Class constructor. Instantiates a new
SocketConnectPacketobject with the provided parameters.- Parameters
frame_id (Integer) – the frame ID of the packet.
socket_id (Integer) – the ID of the socket to connect.
dest_port (Integer) – the destination port number.
dest_address_type (Integer) – the destination address type. One of
SocketConnectPacket.DEST_ADDRESS_BINARYorSocketConnectPacket.DEST_ADDRESS_STRING.dest_address (Bytearray or String) – the destination address.
See also
- Raises
ValueError – if
frame_idis less than 0 or greater than 255.ValueError – if
socket_idis less than 0 or greater than 255.ValueError – if
dest_portis less than 0 or greater than 65535.ValueError – if
dest_address_typeis different thanSocketConnectPacket.DEST_ADDRESS_BINARYandSocketConnectPacket.DEST_ADDRESS_STRING.ValueError – if
dest_addressisNoneor does not follow the format specified in the configured type.
-
DEST_ADDRESS_BINARY= 0¶ Indicates the destination address field is a binary IPv4 address in network byte order.
-
DEST_ADDRESS_STRING= 1¶ Indicates the destination address field is a string containing either a dotted quad value or a domain name to be resolved.
-
static
create_packet(raw, operating_mode)[source]¶ Override method.
- Returns
- Raises
InvalidPacketException – if the bytearray length is less than 11. (start delim. + length (2 bytes) + frame type + frame id + socket id + dest port (2 bytes) + dest address type + dest_address + checksum = 11 bytes).
InvalidPacketException – if the length field of ‘raw’ is different than its real length. (length field: bytes 2 and 3)
InvalidPacketException – if the first byte of ‘raw’ is not the header byte. See
SpecialByte.InvalidPacketException – if the calculated checksum is different than the checksum field value (last byte).
InvalidPacketException – if the frame type is not
ApiFrameType.SOCKET_CONNECT.InvalidOperatingModeException – if
operating_modeis not supported.
See also
XBeeAPIPacket._check_api_packet()
-
property
socket_id¶ Integer. Socket ID.
-
property
dest_port¶ Integer. Destination port.
-
property
dest_address_type¶ Integer. Destination address type.
-
property
dest_address¶ Bytearray. Destination address.
-
property
frame_id¶ Returns the frame ID of the packet.
- Returns
the frame ID of the packet.
- Return type
Integer
-
get_checksum()¶ Returns the checksum value of this XBeePacket.
The checksum is the last 8 bits of the sum of the bytes between the length field and the checksum field.
- Returns
checksum value of this XBeePacket.
- Return type
Integer
See also
-
get_frame_spec_data()¶ Override method.
See also
-
get_frame_type()¶ Returns the frame type of this packet.
- Returns
the frame type of this packet.
- Return type
See also
-
get_frame_type_value()¶ Returns the frame type integer value of this packet.
- Returns
the frame type integer value of this packet.
- Return type
Integer
See also
-
is_broadcast()¶ Returns whether this packet is broadcast or not.
- Returns
Trueif this packet is broadcast,Falseotherwise.- Return type
Boolean
-
output(escaped=False)¶ Returns the raw bytearray of this XBeePacket, ready to be send by the serial port.
- Parameters
escaped (Boolean) – indicates if the raw bytearray will be escaped or not.
- Returns
raw bytearray of the XBeePacket.
- Return type
Bytearray
-
to_dict()¶ Returns a dictionary with all information of the XBeePacket fields.
- Returns
dictionary with all information of the XBeePacket fields.
- Return type
Dictionary
-
static
unescape_data(data)¶ Un-escapes the provided bytearray data.
- Parameters
data (Bytearray) – the bytearray to unescape.
- Returns
dataunescaped.- Return type
Bytearray
-
class
digi.xbee.packets.socket.SocketConnectResponsePacket(frame_id, socket_id, status)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacketThis class represents a Socket Connect Response packet. Packet is built using the parameters of the constructor.
The device sends this frame in response to a Socket Connect (0x42) frame. The frame contains a status regarding the initiation of the connect.
See also
Class constructor. Instantiates a new
SocketConnectPacketobject with the provided parameters.- Parameters
frame_id (Integer) – the frame ID of the packet.
socket_id (Integer) – the ID of the socket to connect.
status (
SocketStatus) – the socket connect status.
See also
- Raises
ValueError – if
frame_idis less than 0 or greater than 255.ValueError – if
socket_idis less than 0 or greater than 255.
-
static
create_packet(raw, operating_mode)[source]¶ Override method.
- Returns
- Raises
InvalidPacketException – if the bytearray length is less than 8. (start delim. + length (2 bytes) + frame type + frame id + socket id + status + checksum = 8 bytes).
InvalidPacketException – if the length field of ‘raw’ is different than its real length. (length field: bytes 2 and 3)
InvalidPacketException – if the first byte of ‘raw’ is not the header byte. See
SpecialByte.InvalidPacketException – if the calculated checksum is different than the checksum field value (last byte).
InvalidPacketException – if the frame type is not
ApiFrameType.SOCKET_CONNECT_RESPONSE.InvalidOperatingModeException – if
operating_modeis not supported.
See also
XBeeAPIPacket._check_api_packet()
-
property
socket_id¶ Integer. Socket ID.
-
property
status¶ SocketStatus. Socket connect status.
-
property
frame_id¶ Returns the frame ID of the packet.
- Returns
the frame ID of the packet.
- Return type
Integer
-
get_checksum()¶ Returns the checksum value of this XBeePacket.
The checksum is the last 8 bits of the sum of the bytes between the length field and the checksum field.
- Returns
checksum value of this XBeePacket.
- Return type
Integer
See also
-
get_frame_spec_data()¶ Override method.
See also
-
get_frame_type()¶ Returns the frame type of this packet.
- Returns
the frame type of this packet.
- Return type
See also
-
get_frame_type_value()¶ Returns the frame type integer value of this packet.
- Returns
the frame type integer value of this packet.
- Return type
Integer
See also
-
is_broadcast()¶ Returns whether this packet is broadcast or not.
- Returns
Trueif this packet is broadcast,Falseotherwise.- Return type
Boolean
-
output(escaped=False)¶ Returns the raw bytearray of this XBeePacket, ready to be send by the serial port.
- Parameters
escaped (Boolean) – indicates if the raw bytearray will be escaped or not.
- Returns
raw bytearray of the XBeePacket.
- Return type
Bytearray
-
to_dict()¶ Returns a dictionary with all information of the XBeePacket fields.
- Returns
dictionary with all information of the XBeePacket fields.
- Return type
Dictionary
-
static
unescape_data(data)¶ Un-escapes the provided bytearray data.
- Parameters
data (Bytearray) – the bytearray to unescape.
- Returns
dataunescaped.- Return type
Bytearray
-
class
digi.xbee.packets.socket.SocketClosePacket(frame_id, socket_id)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacketThis class represents a Socket Close packet. Packet is built using the parameters of the constructor.
Use this frame to close a socket when given an identifier.
See also
Class constructor. Instantiates a new
SocketClosePacketobject with the provided parameters.- Parameters
frame_id (Integer) – the frame ID of the packet.
socket_id (Integer) – the ID of the socket to close.
See also
- Raises
ValueError – if
frame_idis less than 0 or greater than 255.ValueError – if
socket_idis less than 0 or greater than 255.
-
static
create_packet(raw, operating_mode)[source]¶ Override method.
- Returns
- Raises
InvalidPacketException – if the bytearray length is less than 7. (start delim. + length (2 bytes) + frame type + frame id + socket id + checksum = 7 bytes).
InvalidPacketException – if the length field of ‘raw’ is different than its real length. (length field: bytes 2 and 3)
InvalidPacketException – if the first byte of ‘raw’ is not the header byte. See
SpecialByte.InvalidPacketException – if the calculated checksum is different than the checksum field value (last byte).
InvalidPacketException – if the frame type is not
ApiFrameType.SOCKET_CLOSE.InvalidOperatingModeException – if
operating_modeis not supported.
See also
XBeeAPIPacket._check_api_packet()
-
property
socket_id¶ Integer. Socket ID.
-
property
frame_id¶ Returns the frame ID of the packet.
- Returns
the frame ID of the packet.
- Return type
Integer
-
get_checksum()¶ Returns the checksum value of this XBeePacket.
The checksum is the last 8 bits of the sum of the bytes between the length field and the checksum field.
- Returns
checksum value of this XBeePacket.
- Return type
Integer
See also
-
get_frame_spec_data()¶ Override method.
See also
-
get_frame_type()¶ Returns the frame type of this packet.
- Returns
the frame type of this packet.
- Return type
See also
-
get_frame_type_value()¶ Returns the frame type integer value of this packet.
- Returns
the frame type integer value of this packet.
- Return type
Integer
See also
-
is_broadcast()¶ Returns whether this packet is broadcast or not.
- Returns
Trueif this packet is broadcast,Falseotherwise.- Return type
Boolean
-
output(escaped=False)¶ Returns the raw bytearray of this XBeePacket, ready to be send by the serial port.
- Parameters
escaped (Boolean) – indicates if the raw bytearray will be escaped or not.
- Returns
raw bytearray of the XBeePacket.
- Return type
Bytearray
-
to_dict()¶ Returns a dictionary with all information of the XBeePacket fields.
- Returns
dictionary with all information of the XBeePacket fields.
- Return type
Dictionary
-
static
unescape_data(data)¶ Un-escapes the provided bytearray data.
- Parameters
data (Bytearray) – the bytearray to unescape.
- Returns
dataunescaped.- Return type
Bytearray
-
class
digi.xbee.packets.socket.SocketCloseResponsePacket(frame_id, socket_id, status)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacketThis class represents a Socket Close Response packet. Packet is built using the parameters of the constructor.
The device sends this frame in response to a Socket Close (0x43) frame. Since a close will always succeed for a socket that exists, the status can be only one of two values:
Success.
Bad socket ID.
See also
Class constructor. Instantiates a new
SocketCloseResponsePacketobject with the provided parameters.- Parameters
frame_id (Integer) – the frame ID of the packet.
socket_id (Integer) – the ID of the socket to close.
status (
SocketStatus) – the socket close status.
See also
- Raises
ValueError – if
frame_idis less than 0 or greater than 255.ValueError – if
socket_idis less than 0 or greater than 255.
-
static
create_packet(raw, operating_mode)[source]¶ Override method.
- Returns
- Raises
InvalidPacketException – if the bytearray length is less than 8. (start delim. + length (2 bytes) + frame type + frame id + socket id + status + checksum = 8 bytes).
InvalidPacketException – if the length field of ‘raw’ is different than its real length. (length field: bytes 2 and 3)
InvalidPacketException – if the first byte of ‘raw’ is not the header byte. See
SpecialByte.InvalidPacketException – if the calculated checksum is different than the checksum field value (last byte).
InvalidPacketException – if the frame type is not
ApiFrameType.SOCKET_CLOSE_RESPONSE.InvalidOperatingModeException – if
operating_modeis not supported.
See also
XBeeAPIPacket._check_api_packet()
-
property
socket_id¶ Integer. Socket ID.
-
property
status¶ SocketStatus. Socket close status.
-
property
frame_id¶ Returns the frame ID of the packet.
- Returns
the frame ID of the packet.
- Return type
Integer
-
get_checksum()¶ Returns the checksum value of this XBeePacket.
The checksum is the last 8 bits of the sum of the bytes between the length field and the checksum field.
- Returns
checksum value of this XBeePacket.
- Return type
Integer
See also
-
get_frame_spec_data()¶ Override method.
See also
-
get_frame_type()¶ Returns the frame type of this packet.
- Returns
the frame type of this packet.
- Return type
See also
-
get_frame_type_value()¶ Returns the frame type integer value of this packet.
- Returns
the frame type integer value of this packet.
- Return type
Integer
See also
-
is_broadcast()¶ Returns whether this packet is broadcast or not.
- Returns
Trueif this packet is broadcast,Falseotherwise.- Return type
Boolean
-
output(escaped=False)¶ Returns the raw bytearray of this XBeePacket, ready to be send by the serial port.
- Parameters
escaped (Boolean) – indicates if the raw bytearray will be escaped or not.
- Returns
raw bytearray of the XBeePacket.
- Return type
Bytearray
-
to_dict()¶ Returns a dictionary with all information of the XBeePacket fields.
- Returns
dictionary with all information of the XBeePacket fields.
- Return type
Dictionary
-
static
unescape_data(data)¶ Un-escapes the provided bytearray data.
- Parameters
data (Bytearray) – the bytearray to unescape.
- Returns
dataunescaped.- Return type
Bytearray
-
class
digi.xbee.packets.socket.SocketSendPacket(frame_id, socket_id, payload=None)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacketThis class represents a Socket Send packet. Packet is built using the parameters of the constructor.
A Socket Send message causes the device to transmit data using the current connection. For a nonzero frame ID, this will elicit a Transmit (TX) Status - 0x89 frame (
TransmitStatusPacket).This frame requires a successful Socket Connect - 0x42 frame first (
SocketConnectPacket). For a socket that is not connected, the device responds with a Transmit (TX) Status - 0x89 frame with an error.See also
Class constructor. Instantiates a new
SocketSendPacketobject with the provided parameters.- Parameters
frame_id (Integer) – the frame ID of the packet.
socket_id (Integer) – the socket identifier.
payload (Bytearray, optional) – data that is sent.
- Raises
ValueError – if
frame_idis less than 0 or greater than 255.ValueError – if
socket_idis less than 0 or greater than 255.
See also
-
static
create_packet(raw, operating_mode)[source]¶ Override method.
- Returns
- Raises
InvalidPacketException – if the bytearray length is less than 7. (start delim. + length (2 bytes) + frame type + frame id + socket ID + checksum = 7 bytes).
InvalidPacketException – if the length field of ‘raw’ is different than its real length. (length field: bytes 2 and 3)
InvalidPacketException – if the first byte of ‘raw’ is not the header byte. See
SpecialByte.InvalidPacketException – if the calculated checksum is different than the checksum field value (last byte).
InvalidPacketException – if the frame type is not
ApiFrameType.SOCKET_SEND.InvalidOperatingModeException – if
operating_modeis not supported.
See also
XBeeAPIPacket._check_api_packet()
-
property
socket_id¶ Integer. Socket ID.
-
property
payload¶ Bytearray. Payload to send.
-
property
frame_id¶ Returns the frame ID of the packet.
- Returns
the frame ID of the packet.
- Return type
Integer
-
get_checksum()¶ Returns the checksum value of this XBeePacket.
The checksum is the last 8 bits of the sum of the bytes between the length field and the checksum field.
- Returns
checksum value of this XBeePacket.
- Return type
Integer
See also
-
get_frame_spec_data()¶ Override method.
See also
-
get_frame_type()¶ Returns the frame type of this packet.
- Returns
the frame type of this packet.
- Return type
See also
-
get_frame_type_value()¶ Returns the frame type integer value of this packet.
- Returns
the frame type integer value of this packet.
- Return type
Integer
See also
-
is_broadcast()¶ Returns whether this packet is broadcast or not.
- Returns
Trueif this packet is broadcast,Falseotherwise.- Return type
Boolean
-
output(escaped=False)¶ Returns the raw bytearray of this XBeePacket, ready to be send by the serial port.
- Parameters
escaped (Boolean) – indicates if the raw bytearray will be escaped or not.
- Returns
raw bytearray of the XBeePacket.
- Return type
Bytearray
-
to_dict()¶ Returns a dictionary with all information of the XBeePacket fields.
- Returns
dictionary with all information of the XBeePacket fields.
- Return type
Dictionary
-
static
unescape_data(data)¶ Un-escapes the provided bytearray data.
- Parameters
data (Bytearray) – the bytearray to unescape.
- Returns
dataunescaped.- Return type
Bytearray
-
class
digi.xbee.packets.socket.SocketSendToPacket(frame_id, socket_id, dest_address, dest_port, payload=None)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacketThis class represents a Socket Send packet. Packet is built using the parameters of the constructor.
A Socket SendTo (Transmit Explicit Data) message causes the device to transmit data using an IPv4 address and port. For a non-zero frame ID, this will elicit a Transmit (TX) Status - 0x89 frame (
TransmitStatusPacket).If this frame is used with a TCP, SSL, or a connected UDP socket, the address and port fields are ignored.
See also
Class constructor. Instantiates a new
SocketSendToPacketobject with the provided parameters.- Parameters
frame_id (Integer) – the frame ID of the packet.
socket_id (Integer) – the socket identifier.
dest_address (
IPv4Address) – IPv4 address of the destination device.dest_port (Integer) – destination port number.
payload (Bytearray, optional) – data that is sent.
- Raises
ValueError – if
frame_idis less than 0 or greater than 255.ValueError – if
socket_idis less than 0 or greater than 255.ValueError – if
dest_portis less than 0 or greater than 65535.
See also
-
static
create_packet(raw, operating_mode)[source]¶ Override method.
- Returns
- Raises
InvalidPacketException – if the bytearray length is less than 14. (start delim. + length (2 bytes) + frame type + frame id + socket ID + dest address (4 bytes) + dest port (2 bytes) + transmit options + checksum = 14 bytes).
InvalidPacketException – if the length field of ‘raw’ is different than its real length. (length field: bytes 2 and 3)
InvalidPacketException – if the first byte of ‘raw’ is not the header byte. See
SpecialByte.InvalidPacketException – if the calculated checksum is different than the checksum field value (last byte).
InvalidPacketException – if the frame type is not
ApiFrameType.SOCKET_SENDTO.InvalidOperatingModeException – if
operating_modeis not supported.
See also
XBeeAPIPacket._check_api_packet()
-
property
socket_id¶ Integer. Socket ID.
-
property
dest_address¶ ipaddress.IPv4Address. IPv4 address of the destination device.
-
property
dest_port¶ Integer. Destination port.
-
property
payload¶ Bytearray. Payload to send.
-
property
frame_id¶ Returns the frame ID of the packet.
- Returns
the frame ID of the packet.
- Return type
Integer
-
get_checksum()¶ Returns the checksum value of this XBeePacket.
The checksum is the last 8 bits of the sum of the bytes between the length field and the checksum field.
- Returns
checksum value of this XBeePacket.
- Return type
Integer
See also
-
get_frame_spec_data()¶ Override method.
See also
-
get_frame_type()¶ Returns the frame type of this packet.
- Returns
the frame type of this packet.
- Return type
See also
-
get_frame_type_value()¶ Returns the frame type integer value of this packet.
- Returns
the frame type integer value of this packet.
- Return type
Integer
See also
-
is_broadcast()¶ Returns whether this packet is broadcast or not.
- Returns
Trueif this packet is broadcast,Falseotherwise.- Return type
Boolean
-
output(escaped=False)¶ Returns the raw bytearray of this XBeePacket, ready to be send by the serial port.
- Parameters
escaped (Boolean) – indicates if the raw bytearray will be escaped or not.
- Returns
raw bytearray of the XBeePacket.
- Return type
Bytearray
-
to_dict()¶ Returns a dictionary with all information of the XBeePacket fields.
- Returns
dictionary with all information of the XBeePacket fields.
- Return type
Dictionary
-
static
unescape_data(data)¶ Un-escapes the provided bytearray data.
- Parameters
data (Bytearray) – the bytearray to unescape.
- Returns
dataunescaped.- Return type
Bytearray
-
class
digi.xbee.packets.socket.SocketBindListenPacket(frame_id, socket_id, source_port)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacketThis class represents a Socket Bind/Listen packet. Packet is built using the parameters of the constructor.
Opens a listener socket that listens for incoming connections.
When there is an incoming connection on the listener socket, a Socket New IPv4 Client - 0xCC frame (
SocketNewIPv4ClientPacket) is sent, indicating the socket ID for the new connection along with the remote address information.For a UDP socket, this frame binds the socket to a given port. A bound UDP socket can receive data with a Socket Receive From: IPv4 - 0xCE frame (
SocketReceiveFromIPv4Packet).See also
Class constructor. Instantiates a new
SocketBindListenPacketobject with the provided parameters.- Parameters
frame_id (Integer) – the frame ID of the packet.
socket_id (Integer) – socket ID to listen on.
source_port (Integer) – the port to listen on.
- Raises
ValueError – if
frame_idis less than 0 or greater than 255.ValueError – if
socket_idis less than 0 or greater than 255.ValueError – if
source_portis less than 0 or greater than 65535.
See also
-
static
create_packet(raw, operating_mode)[source]¶ Override method.
- Returns
- Raises
InvalidPacketException – if the bytearray length is less than 9. (start delim. + length (2 bytes) + frame type + frame id + socket ID + source port (2 bytes) + checksum = 9 bytes).
InvalidPacketException – if the length field of ‘raw’ is different than its real length. (length field: bytes 2 and 3)
InvalidPacketException – if the first byte of ‘raw’ is not the header byte. See
SpecialByte.InvalidPacketException – if the calculated checksum is different than the checksum field value (last byte).
InvalidPacketException – if the frame type is not
ApiFrameType.SOCKET_BIND.InvalidOperatingModeException – if
operating_modeis not supported.
See also
XBeeAPIPacket._check_api_packet()
-
property
socket_id¶ Integer. Socket ID.
-
property
source_port¶ Integer. Source port.
-
property
frame_id¶ Returns the frame ID of the packet.
- Returns
the frame ID of the packet.
- Return type
Integer
-
get_checksum()¶ Returns the checksum value of this XBeePacket.
The checksum is the last 8 bits of the sum of the bytes between the length field and the checksum field.
- Returns
checksum value of this XBeePacket.
- Return type
Integer
See also
-
get_frame_spec_data()¶ Override method.
See also
-
get_frame_type()¶ Returns the frame type of this packet.
- Returns
the frame type of this packet.
- Return type
See also
-
get_frame_type_value()¶ Returns the frame type integer value of this packet.
- Returns
the frame type integer value of this packet.
- Return type
Integer
See also
-
is_broadcast()¶ Returns whether this packet is broadcast or not.
- Returns
Trueif this packet is broadcast,Falseotherwise.- Return type
Boolean
-
output(escaped=False)¶ Returns the raw bytearray of this XBeePacket, ready to be send by the serial port.
- Parameters
escaped (Boolean) – indicates if the raw bytearray will be escaped or not.
- Returns
raw bytearray of the XBeePacket.
- Return type
Bytearray
-
to_dict()¶ Returns a dictionary with all information of the XBeePacket fields.
- Returns
dictionary with all information of the XBeePacket fields.
- Return type
Dictionary
-
static
unescape_data(data)¶ Un-escapes the provided bytearray data.
- Parameters
data (Bytearray) – the bytearray to unescape.
- Returns
dataunescaped.- Return type
Bytearray
-
class
digi.xbee.packets.socket.SocketListenResponsePacket(frame_id, socket_id, status)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacketThis class represents a Socket Listen Response packet. Packet is built using the parameters of the constructor.
The device sends this frame in response to a Socket Bind/Listen (0x46) frame (
SocketBindListenPacket).See also
Class constructor. Instantiates a new
SocketListenResponsePacketobject with the provided parameters.- Parameters
frame_id (Integer) – the frame ID of the packet.
socket_id (Integer) – socket ID.
status (
SocketStatus) – socket listen status.
- Raises
ValueError – if
frame_idis less than 0 or greater than 255.ValueError – if
socket_idis less than 0 or greater than 255.
See also
-
static
create_packet(raw, operating_mode)[source]¶ Override method.
- Returns
- Raises
InvalidPacketException – if the bytearray length is less than 8. (start delim. + length (2 bytes) + frame type + frame id + socket ID + status + checksum = 8 bytes).
InvalidPacketException – if the length field of ‘raw’ is different than its real length. (length field: bytes 2 and 3)
InvalidPacketException – if the first byte of ‘raw’ is not the header byte. See
SpecialByte.InvalidPacketException – if the calculated checksum is different than the checksum field value (last byte).
InvalidPacketException – if the frame type is not
ApiFrameType.SOCKET_LISTEN_RESPONSE.InvalidOperatingModeException – if
operating_modeis not supported.
See also
XBeeAPIPacket._check_api_packet()
-
property
socket_id¶ Integer. Socket ID.
-
property
status¶ SocketStatus. Socket listen status.
-
property
frame_id¶ Returns the frame ID of the packet.
- Returns
the frame ID of the packet.
- Return type
Integer
-
get_checksum()¶ Returns the checksum value of this XBeePacket.
The checksum is the last 8 bits of the sum of the bytes between the length field and the checksum field.
- Returns
checksum value of this XBeePacket.
- Return type
Integer
See also
-
get_frame_spec_data()¶ Override method.
See also
-
get_frame_type()¶ Returns the frame type of this packet.
- Returns
the frame type of this packet.
- Return type
See also
-
get_frame_type_value()¶ Returns the frame type integer value of this packet.
- Returns
the frame type integer value of this packet.
- Return type
Integer
See also
-
is_broadcast()¶ Returns whether this packet is broadcast or not.
- Returns
Trueif this packet is broadcast,Falseotherwise.- Return type
Boolean
-
output(escaped=False)¶ Returns the raw bytearray of this XBeePacket, ready to be send by the serial port.
- Parameters
escaped (Boolean) – indicates if the raw bytearray will be escaped or not.
- Returns
raw bytearray of the XBeePacket.
- Return type
Bytearray
-
to_dict()¶ Returns a dictionary with all information of the XBeePacket fields.
- Returns
dictionary with all information of the XBeePacket fields.
- Return type
Dictionary
-
static
unescape_data(data)¶ Un-escapes the provided bytearray data.
- Parameters
data (Bytearray) – the bytearray to unescape.
- Returns
dataunescaped.- Return type
Bytearray
-
class
digi.xbee.packets.socket.SocketNewIPv4ClientPacket(socket_id, client_socket_id, remote_address, remote_port)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacketThis class represents a Socket New IPv4 Client packet. Packet is built using the parameters of the constructor.
XBee Cellular modem uses this frame when an incoming connection is accepted on a listener socket.
This frame contains the original listener’s socket ID and a new socket ID of the incoming connection, along with the connection’s remote address information.
See also
Class constructor. Instantiates a new
SocketNewIPv4ClientPacketobject with the provided parameters.- Parameters
socket_id (Integer) – the socket ID of the listener socket.
client_socket_id (Integer) – the socket ID of the new connection.
remote_address (
IPv4Address) – the remote IPv4 address.remote_port (Integer) – the remote port number.
- Raises
ValueError – if
socket_idis less than 0 or greater than 255.ValueError – if
client_socket_idis less than 0 or greater than 255.ValueError – if
remote_portis less than 0 or greater than 65535.
See also
-
static
create_packet(raw, operating_mode)[source]¶ Override method.
- Returns
- Raises
InvalidPacketException – if the bytearray length is less than 13. (start delim. + length (2 bytes) + frame type + socket ID + client socket ID + remote address (4 bytes) + remote port (2 bytes) + checksum = 13 bytes).
InvalidPacketException – if the length field of ‘raw’ is different than its real length. (length field: bytes 2 and 3)
InvalidPacketException – if the first byte of ‘raw’ is not the header byte. See
SpecialByte.InvalidPacketException – if the calculated checksum is different than the checksum field value (last byte).
InvalidPacketException – if the frame type is not
ApiFrameType.SOCKET_NEW_IPV4_CLIENT.InvalidOperatingModeException – if
operating_modeis not supported.
See also
XBeeAPIPacket._check_api_packet()
-
property
socket_id¶ Integer. Socket ID.
-
property
client_socket_id¶ Integer. Client socket ID.
-
property
remote_address¶ ipaddress.IPv4Address. Remote IPv4 address.
-
property
remote_port¶ Integer. Remote port.
-
property
frame_id¶ Returns the frame ID of the packet.
- Returns
the frame ID of the packet.
- Return type
Integer
-
get_checksum()¶ Returns the checksum value of this XBeePacket.
The checksum is the last 8 bits of the sum of the bytes between the length field and the checksum field.
- Returns
checksum value of this XBeePacket.
- Return type
Integer
See also
-
get_frame_spec_data()¶ Override method.
See also
-
get_frame_type()¶ Returns the frame type of this packet.
- Returns
the frame type of this packet.
- Return type
See also
-
get_frame_type_value()¶ Returns the frame type integer value of this packet.
- Returns
the frame type integer value of this packet.
- Return type
Integer
See also
-
is_broadcast()¶ Returns whether this packet is broadcast or not.
- Returns
Trueif this packet is broadcast,Falseotherwise.- Return type
Boolean
-
output(escaped=False)¶ Returns the raw bytearray of this XBeePacket, ready to be send by the serial port.
- Parameters
escaped (Boolean) – indicates if the raw bytearray will be escaped or not.
- Returns
raw bytearray of the XBeePacket.
- Return type
Bytearray
-
to_dict()¶ Returns a dictionary with all information of the XBeePacket fields.
- Returns
dictionary with all information of the XBeePacket fields.
- Return type
Dictionary
-
static
unescape_data(data)¶ Un-escapes the provided bytearray data.
- Parameters
data (Bytearray) – the bytearray to unescape.
- Returns
dataunescaped.- Return type
Bytearray
-
class
digi.xbee.packets.socket.SocketReceivePacket(frame_id, socket_id, payload=None)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacketThis class represents a Socket Receive packet. Packet is built using the parameters of the constructor.
XBee Cellular modem uses this frame when it receives RF data on the specified socket.
See also
Class constructor. Instantiates a new
SocketReceivePacketobject with the provided parameters.- Parameters
frame_id (Integer) – the frame ID of the packet.
socket_id (Integer) – the ID of the socket the data has been received on.
payload (Bytearray, optional) – data that is received.
- Raises
ValueError – if
frame_idis less than 0 or greater than 255.ValueError – if
socket_idis less than 0 or greater than 255.
See also
-
static
create_packet(raw, operating_mode)[source]¶ Override method.
- Returns
- Raises
InvalidPacketException – if the bytearray length is less than 7. (start delim. + length (2 bytes) + frame type + frame id + socket ID + checksum = 7 bytes).
InvalidPacketException – if the length field of ‘raw’ is different than its real length. (length field: bytes 2 and 3)
InvalidPacketException – if the first byte of ‘raw’ is not the header byte. See
SpecialByte.InvalidPacketException – if the calculated checksum is different than the checksum field value (last byte).
InvalidPacketException – if the frame type is not
ApiFrameType.SOCKET_RECEIVE.InvalidOperatingModeException – if
operating_modeis not supported.
See also
XBeeAPIPacket._check_api_packet()
-
property
socket_id¶ Integer. Socket ID.
-
property
payload¶ Bytearray. Payload that was received.
-
property
frame_id¶ Returns the frame ID of the packet.
- Returns
the frame ID of the packet.
- Return type
Integer
-
get_checksum()¶ Returns the checksum value of this XBeePacket.
The checksum is the last 8 bits of the sum of the bytes between the length field and the checksum field.
- Returns
checksum value of this XBeePacket.
- Return type
Integer
See also
-
get_frame_spec_data()¶ Override method.
See also
-
get_frame_type()¶ Returns the frame type of this packet.
- Returns
the frame type of this packet.
- Return type
See also
-
get_frame_type_value()¶ Returns the frame type integer value of this packet.
- Returns
the frame type integer value of this packet.
- Return type
Integer
See also
-
is_broadcast()¶ Returns whether this packet is broadcast or not.
- Returns
Trueif this packet is broadcast,Falseotherwise.- Return type
Boolean
-
output(escaped=False)¶ Returns the raw bytearray of this XBeePacket, ready to be send by the serial port.
- Parameters
escaped (Boolean) – indicates if the raw bytearray will be escaped or not.
- Returns
raw bytearray of the XBeePacket.
- Return type
Bytearray
-
to_dict()¶ Returns a dictionary with all information of the XBeePacket fields.
- Returns
dictionary with all information of the XBeePacket fields.
- Return type
Dictionary
-
static
unescape_data(data)¶ Un-escapes the provided bytearray data.
- Parameters
data (Bytearray) – the bytearray to unescape.
- Returns
dataunescaped.- Return type
Bytearray
-
class
digi.xbee.packets.socket.SocketReceiveFromPacket(frame_id, socket_id, source_address, source_port, payload=None)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacketThis class represents a Socket Receive From packet. Packet is built using the parameters of the constructor.
XBee Cellular modem uses this frame when it receives RF data on the specified socket. The frame also contains addressing information about the source.
See also
Class constructor. Instantiates a new
SocketReceiveFromPacketobject with the provided parameters.- Parameters
frame_id (Integer) – the frame ID of the packet.
socket_id (Integer) – the ID of the socket the data has been received on.
source_address (
IPv4Address) – IPv4 address of the source device.source_port (Integer) – source port number.
payload (Bytearray, optional) – data that is received.
- Raises
ValueError – if
frame_idis less than 0 or greater than 255.ValueError – if
socket_idis less than 0 or greater than 255.ValueError – if
source_portis less than 0 or greater than 65535.
See also
-
property
frame_id¶ Returns the frame ID of the packet.
- Returns
the frame ID of the packet.
- Return type
Integer
-
get_checksum()¶ Returns the checksum value of this XBeePacket.
The checksum is the last 8 bits of the sum of the bytes between the length field and the checksum field.
- Returns
checksum value of this XBeePacket.
- Return type
Integer
See also
-
get_frame_spec_data()¶ Override method.
See also
-
get_frame_type()¶ Returns the frame type of this packet.
- Returns
the frame type of this packet.
- Return type
See also
-
get_frame_type_value()¶ Returns the frame type integer value of this packet.
- Returns
the frame type integer value of this packet.
- Return type
Integer
See also
-
is_broadcast()¶ Returns whether this packet is broadcast or not.
- Returns
Trueif this packet is broadcast,Falseotherwise.- Return type
Boolean
-
output(escaped=False)¶ Returns the raw bytearray of this XBeePacket, ready to be send by the serial port.
- Parameters
escaped (Boolean) – indicates if the raw bytearray will be escaped or not.
- Returns
raw bytearray of the XBeePacket.
- Return type
Bytearray
-
to_dict()¶ Returns a dictionary with all information of the XBeePacket fields.
- Returns
dictionary with all information of the XBeePacket fields.
- Return type
Dictionary
-
static
unescape_data(data)¶ Un-escapes the provided bytearray data.
- Parameters
data (Bytearray) – the bytearray to unescape.
- Returns
dataunescaped.- Return type
Bytearray
-
static
create_packet(raw, operating_mode)[source]¶ Override method.
- Returns
- Raises
InvalidPacketException – if the bytearray length is less than 13. (start delim. + length (2 bytes) + frame type + frame id + socket ID + source address (4 bytes) + source port (2 bytes) + status + checksum = 14 bytes).
InvalidPacketException – if the length field of ‘raw’ is different than its real length. (length field: bytes 2 and 3)
InvalidPacketException – if the first byte of ‘raw’ is not the header byte. See
SpecialByte.InvalidPacketException – if the calculated checksum is different than the checksum field value (last byte).
InvalidPacketException – if the frame type is not
ApiFrameType.SOCKET_RECEIVE_FROM.InvalidOperatingModeException – if
operating_modeis not supported.
See also
XBeeAPIPacket._check_api_packet()
-
property
socket_id¶ Integer. Socket ID.
-
property
source_address¶ ipaddress.IPv4Address. IPv4 address of the source device.
-
property
source_port¶ Integer. Source port.
-
property
payload¶ Bytearray. Payload that has been received.
-
class
digi.xbee.packets.socket.SocketStatePacket(socket_id, state)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacketThis class represents a Socket State packet. Packet is built using the parameters of the constructor.
This frame is sent out the device’s serial port to indicate the state related to the socket.
See also
Class constructor. Instantiates a new
SocketStatePacketobject with the provided parameters.- Parameters
socket_id (Integer) – the socket identifier.
state (
SocketState) – socket status.
- Raises
ValueError – if
socket_idis less than 0 or greater than 255.
See also
SockeState-
property
frame_id¶ Returns the frame ID of the packet.
- Returns
the frame ID of the packet.
- Return type
Integer
-
get_checksum()¶ Returns the checksum value of this XBeePacket.
The checksum is the last 8 bits of the sum of the bytes between the length field and the checksum field.
- Returns
checksum value of this XBeePacket.
- Return type
Integer
See also
-
get_frame_spec_data()¶ Override method.
See also
-
get_frame_type()¶ Returns the frame type of this packet.
- Returns
the frame type of this packet.
- Return type
See also
-
get_frame_type_value()¶ Returns the frame type integer value of this packet.
- Returns
the frame type integer value of this packet.
- Return type
Integer
See also
-
is_broadcast()¶ Returns whether this packet is broadcast or not.
- Returns
Trueif this packet is broadcast,Falseotherwise.- Return type
Boolean
-
output(escaped=False)¶ Returns the raw bytearray of this XBeePacket, ready to be send by the serial port.
- Parameters
escaped (Boolean) – indicates if the raw bytearray will be escaped or not.
- Returns
raw bytearray of the XBeePacket.
- Return type
Bytearray
-
to_dict()¶ Returns a dictionary with all information of the XBeePacket fields.
- Returns
dictionary with all information of the XBeePacket fields.
- Return type
Dictionary
-
static
unescape_data(data)¶ Un-escapes the provided bytearray data.
- Parameters
data (Bytearray) – the bytearray to unescape.
- Returns
dataunescaped.- Return type
Bytearray
-
static
create_packet(raw, operating_mode)[source]¶ Override method.
- Returns
- Raises
InvalidPacketException – if the bytearray length is less than 7. (start delim. + length (2 bytes) + frame type + socket ID + state + checksum = 7 bytes).
InvalidPacketException – if the length field of ‘raw’ is different than its real length. (length field: bytes 2 and 3)
InvalidPacketException – if the first byte of ‘raw’ is not the header byte. See
SpecialByte.InvalidPacketException – if the calculated checksum is different than the checksum field value (last byte).
InvalidPacketException – if the frame type is not
ApiFrameType.SOCKET_STATUS.InvalidOperatingModeException – if
operating_modeis not supported.
See also
XBeeAPIPacket._check_api_packet()
-
property
socket_id¶ Integer. Socket ID.
-
property
state¶ SocketState. Socket state.