tsRxDataApp structure from the TWENET library.This class object can be obtained via a behavior callback function or the on_rx_packets() method.
In packet_rx, the packet data payload is handled via the smplbuf container, and utility functions like expand_bytes() simplify the interpretation of the payload.
<NWK_SIMPLE>.Methods
get_payload()
smplbuf_u8_attach& get_payload()
Retrieves the data payload of the packet.
<NWK_SIMPLE>, the payload begins with a header specific to <NWK_SIMPLE>. The container returned is a subarray excluding this header. If you wish to access the header as well, refer to the tsRxDataApp structure using get_psRxDataApp().get_psRxDataApp()
const tsRxDataApp* get_psRxDataApp()
Retrieves the receive structure from the TWENET C library.
get_length()
uint8_t get_length()
Returns the length of the payload. Equivalent to .get_payload().size().
get_lqi()
uint8_t get_lqi()
Retrieves the LQI (Link Quality Indicator).
LQI indicates the quality of wireless communication. It is expressed as a number from 0 to 255.
As a rough guideline, the values can be interpreted as follows: below 50 (poor, below -80 dBm), 50–100 (fair), 100–150 (good), and above 150 (very close to the antenna). These are merely rough indicators.
get_addr_src_long(), get_addr_src_lid()
uint32_t get_addr_src_long()
uint8_t get_addr_src_lid()
Retrieves the source address.
get_addr_src_long() returns the source serial number. The MSB (bit 31) is always set to 1.
get_addr_src_lid() returns the source logical ID, which ranges from 0x00 to 0xFE (used in <NWK_SIMPLE>).
get_addr_dst()
uint32_t get_addr_dst()
Retrieves the destination address.
The destination address is set by the sender, and its value range depends on the address type.
| Value | Description |
|---|---|
| The serial number is used as the destination. | Specifies the serial number as the destination. |
0x00-0xFF | An 8-bit logical ID is used as the destination. |
is_secure_pkt()
bool is_secure_pkt()
Returns true if the packet is encrypted; otherwise returns false.
get_network_type()
uint8_t get_network_type()
Returns the network type of the packet as identified by the network behavior.
| Value | Description |
|---|---|
mwx::NETWORK::LAYERED | Packet from <NWK_LAYERED> |
mwx::NETWORK::SIMPLE | Packet from <NWK_SIMPLE> |
mwx::NETWORK::NONE | Packet not transmitted via a network (e.g., App_Twelite) |
| Other | Error or unidentified packet |