packet_rx
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>
.
Methods
get_payload()
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()
.
get_psRxDataApp()
Obtain the receiving structure of the TWENET C library.
get_length()
Returns the data length of the payload. The value is the same as .get_payload().size()
.
get_lqi()
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_addr_src_long(), get_addr_src_lid()
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>
).
get_addr_dst()
Gets the destination address.
The destination address is specified by the source, and the range of values varies depending on the type of destination.
Value | Explanation |
---|---|
MSB (bit31) is set. |
|
Logical ID (8bit) is specified as the destination. |
|
is_secure_pkt()
Returns true
for encrypted packets and false
for plaintext.
get_network_type()
Returns network type of the packet identified by Network BEHAVIOR.
Value | Explanation |
---|---|
| packets from |
| packets from |
| neworkless packets |
others | error or unknow packet type |
最終更新