This is the multi-page printable view of this section. Click here to print...

Return to the regular view of this page

As of 2025-07-24

packet_rx

Received Packet
    This class is a wrapper for the 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.

    Methods

    get_payload()

    smplbuf_u8_attach& get_payload()

    Retrieves the data payload of the packet.

    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).

    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.

    ValueDescription
    The serial number is used as the destination.Specifies the serial number as the destination.
    0x00-0xFFAn 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.

    ValueDescription
    mwx::NETWORK::LAYEREDPacket from <NWK_LAYERED>
    mwx::NETWORK::SIMPLEPacket from <NWK_SIMPLE>
    mwx::NETWORK::NONEPacket not transmitted via a network (e.g., App_Twelite)
    OtherError or unidentified packet