digi.xbee.packets.digimesh module¶
-
class
digi.xbee.packets.digimesh.RouteInformationPacket(src_event, timestamp, ack_timeout_count, tx_block_count, dst_addr, src_addr, responder_addr, successor_addr, additional_data=None, op_mode=<OperatingMode.API_MODE: (1, 'API mode')>)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacketThis class represents a DigiMesh Route Information packet. Packet is built using the parameters of the constructor or providing a valid API payload.
A Route Information Packet can be output for DigiMesh unicast transmissions on which the NACK enable or the Trace Route enable TX option is enabled.
See also
Class constructor. Instantiates a new
RouteInformationPacketobject with the provided parameters.Parameters: - src_event (Integer) – Source event identifier. 0x11=NACK, 0x12=Trace route
- timestamp (Integer) – System timer value on the node generating the this packet. The timestamp is in microseconds.
- ack_timeout_count (Integer) – The number of MAC ACK timeouts.
- tx_block_count (Integer) – The number of times the transmission was blocked due to reception in progress.
- dst_addr (
XBee64BitAddress) – The 64-bit address of the final destination node of this network-level transmission. - src_addr (
XBee64BitAddress) – The 64-bit address of the source node of this network-level transmission. - responder_addr (
XBee64BitAddress) – The 64-bit address of the node that generates this packet after it sends (or attempts to send) the packet to the next hop (successor node). - successor_addr (
XBee64BitAddress) – The 64-bit address of the next node after the responder in the route towards the destination, whether or not the packet arrived successfully at the successor node. - additional_data (Bytearray, optional, default=`None`) – Additional data of the packet.
- op_mode (
OperatingMode, optional, default=`OperatingMode.API_MODE`) – The mode in which the frame was captured.
Raises: ValueError– if src_event is not 0x11 or 0x12.ValueError– if timestamp is not between 0 and 0xFFFFFFFF.ValueError– if ack_timeout_count or tx_block_count are not between 0 and 255.
See also
-
static
create_packet(raw, operating_mode)[source]¶ Override method.
Returns: Raises: InvalidPacketException– If the bytearray length is less than 46. (start delim. + length (2 bytes) + frame type + src_event + length + timestamp (4 bytes) + ack timeout count + tx blocked count + reserved + dest addr (8 bytes) + src addr (8 bytes) + responder addr (8 bytes) + successor addr (8 bytes) + checksum = 46 bytes).InvalidPacketException– If the length field of raw is different from its real length. (length field: bytes 1 and 3)InvalidPacketException– If the first byte of ‘raw’ is not the header byte. SeeSpecialByte.InvalidPacketException– If the calculated checksum is different from the checksum field value (last byte).InvalidPacketException– If the frame type is notApiFrameType.DIGIMESH_ROUTE_INFORMATION.InvalidPacketException– If the internal length byte of the rest of the frame (without the checksum) is different from its real length.InvalidOperatingModeException– If operating_mode is not supported.
See also
XBeeAPIPacket._check_api_packet()
-
src_event¶ Returns the source event.
Returns: The source event. Return type: Integer
-
length¶ Returns the number of bytes that follow, excluding the checksum.
Returns: Data length. Return type: Integer
-
timestamp¶ Returns the system timer value on the node generating this package. The timestamp is in microseconds.
Returns: The system timer value in microseconds. Return type: Integer
-
ack_timeout_count¶ Returns the number of MAC ACK timeouts that occur.
Returns: The number of MAC ACK timeouts that occur. Return type: Integer
-
tx_block_count¶ Returns the number of times the transmission was blocked due to reception in progress.
Returns: - The number of times the transmission was blocked due to
- reception in progress.
Return type: Integer
-
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: ApiFrameTypeSee 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: True if this packet is broadcast, False otherwise. Return type: Boolean
-
op_mode¶ Retrieves the operating mode in which this packet was read.
Returns: The operating mode. Return type: OperatingMode
-
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 must be escaped. 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 info 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: data unescaped. Return type: Bytearray
-
dst_addr¶ Returns the 64-bit source address.
Returns: - The 64-bit address of the final
- destination node.
Return type: XBee64BitAddressSee also
-
src_addr¶ Returns the 64-bit address of the source node of this network-level transmission.
Returns: The 64-bit address of the source node. Return type: XBee64BitAddressSee also
-
responder_addr¶ Returns the 64-bit address of the node that generates this packet after it sends (or attempts to send) the packet to the next hop (successor node).
Returns: The 64-bit address of the responder node. Return type: XBee64BitAddressSee also
-
successor_addr¶ Returns the 64-bit address of the next node after the responder in the route towards the destination, whether or not the packet arrived successfully at the successor node.
Returns: The 64-bit address of the successor node. Return type: XBee64BitAddressSee also