This class is a wrapper class for TWENET's tsRxDataApp
structure.
This class object is a wrapper class for behavior callback function or by on_rx_packets()
.
In packet_rx
, in particular, the data payload of the packet can be handled by the smplbuf
container, and utility functions such as expand_bytes()
simplify the payload interpretation description.
At this time, we have implemented methods and other interfaces, mainly those required for the simple relay network <NWK_SIMPLE>
.
Get the data payload of the packet.
If <NWK_SIMPLE>
is used, there is header data for <NWK_SIMPLE>
at the beginning. The container referred to in the return will be a sub-array excluding the header. If you want to refer to the header part, refer to the tsRxDataApp
structure by get_psRxDataApp()
.
Obtain the receiving structure of the TWENET C library.
Returns the data length of the payload. The value is the same as .get_payload().size()
.
Obtain the LQI value (Link Quality Indicator).
LQI is a value that indicates the quality of radio communication, expressed as a number from 0 to 255.
Incidentally, if you want to evaluate it in several levels, you can classify it as follows: less than 50 (bad - less than 80 dbm), 50 to 100 (somewhat bad), 100 to 150 (good), 150 or more (near the antenna), and so on. Please note that these are only guidelines.
Get the address of the sender.
get_addr_src_long()
is the serial number of the sender and MSB(bit31) is always 1.
get_addr_src_lid()
is the logical ID of the sender and takes values from 0x00
-0xFE
(the logical ID specified by <NWK_SIMPLE>
).
Gets the destination address.
The destination address is specified by the source, and the range of values varies depending on the type of destination.
Returns true
for encrypted packets and false
for plaintext.
Returns network type of the packet identified by Network BEHAVIOR.
Value | Explanation |
---|---|
Value | Explanation |
---|---|
MSB (bit31) is set.
0x00
-0xFF
Logical ID (8bit) is specified as the destination.
0x00
-0xFF
mwx::NETWORK::LAYERED
packets from <NWK_LAYERED>
mwx::NETWORK::SIMPLE
packets from <NWK_SIMPLE>
mwx::NETWORK::NONE
neworkless packets
others
error or unknow packet type