MWX Library
latest_en
latest_en
  • The MWX Library
  • revision history
  • About the MWX library
    • License
    • Terms
    • The design policy
  • Install and Build
    • Environment (OS, etc.)
    • Installing the TWELITE SDK
    • Building ACT
    • Creating a new project
    • Installing VSCode
    • Build definition Makefile
    • Other platforms
  • Sample ACTs
    • act0 .. 4
    • Scratch
    • Slp_Wk_and_Tx
    • Parent_MONOSTICK
    • PingPong
    • BRD_APPTWELITE
    • BRD_I2C_TEMPHUMID
    • PAL_AMB
    • PAL_AMB-usenap
    • PAL_AMB-bhv
    • PAL_MAG
    • PAL_MOT-single
    • PAL_MOT-fifo
    • PulseCounter
    • WirelessUART
    • Rcv_Univsl
    • Unit_???
  • API
    • Definition.
    • class object
      • the_twelite
      • Analogue
      • Buttons
      • EEPROM
      • PulseCounter
      • Serial
      • SerialParser
      • SPI
        • SPI (using member functions)
        • SPI (using helper class)
      • TickTimer
      • Timer0 .. 4
      • Wire
        • Wire (using member functions))
        • Wire (using helper class)
    • Classes
      • MWX_APIRET
      • alloc
      • axis_xyzt
      • packet_rx
      • packet_tx
      • serparser
      • pktparser
        • E_PKT
        • idenify_packet_type()
        • TwePacket
          • TwePacketTwelite
          • TwePacketIO
          • TwePacketUART
          • TwePacketPAL
      • smplbuf
        • .get_stream_helper()
        • smplbuf_strm_u8
      • smplque
      • mwx::stream
        • format (mwx::mwx_format)
        • mwx::bigendian
        • mwx::crlf
        • mwx::flush
        • stream_helper
      • SM_SIMPLE state machine
    • Call back functions
      • setup()
      • begin()
      • loop()
      • wakeup()
      • init_coldboot()
      • init_warmboot()
      • on_rx_packet()
      • on_tx_comp()
    • BEHAVIOR
      • PAL_AMB-behavior
    • Functions
      • System Functions
        • millis()
        • delay()
        • delayMicroseconds()
        • random()
      • DIO General purpose IO
        • pinMode()
        • digitalWrite()
        • digitalRead()
        • attachIntDio()
        • detachIntDio()
        • digitalReadBitmap()
      • Utility Functions
        • Printf utils
        • pack_bits()
        • collect_bits()
        • Byte array utils
        • pack_bytes()
        • expand_bytes()
        • CRC8, XOR, LRC
        • div100()
        • Scale utils
        • pnew
    • External Libraries
      • EASTL
  • Board (BRD)
    • <BRD_APPTWELITE>
    • <MONOSTICK>
    • PAL
      • <PAL_AMB>
      • <PAL_MAG>
      • <PAL_MOT>
      • <PAL_NOTICE>
    • <CUE>
  • Sensor Devices (SNS)
    • SHTC3 - Temp/Humd sensor
    • SHT3x - Temp/Humd sensor
    • LTR-308ALS - Luminance Sensor
    • MC3630 - Accel sensor
    • BMx280 - Temp/Humd/Pressure Sensor
    • PCA9632 - LED Driver
  • Network (NWK)
    • Simple Relay Net <NWK_SIMPLE>
    • Layered Tree Net <NWK_LAYERED>
  • Settings (STG) - Interactive settings mode
    • <STG_STD>
GitBook提供
このページ内
  • Methods
  • get_payload()
  • get_psRxDataApp()
  • get_length()
  • get_lqi()
  • get_addr_src_long(), get_addr_src_lid()
  • get_addr_dst()
  • is_secure_pkt()
  • get_network_type()
PDFとしてエクスポート
  1. API
  2. Classes

packet_rx

前へaxis_xyzt次へpacket_tx

最終更新 2 年前

This class is a wrapper class for TWENET's tsRxDataApp structure.

This class object is a wrapper class for callback function or by .

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

smplbuf_u8_attach& 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()

const tsRxDataApp* get_psRxDataApp() 

Obtain the receiving structure of the TWENET C library.

get_length()

uint8_t get_length()

Returns the data length of the payload. The value is the same as .get_payload().size().

get_lqi()

uint8_t 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()

uint32_t get_addr_src_long()
uint8_t 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()

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

0x00-0xFF

Logical ID (8bit) is specified as the destination.

0x00-0xFF

is_secure_pkt()

bool is_secure_pkt()

Returns true for encrypted packets and false for plaintext.

get_network_type()

uint8_t get_network_type() 

Returns network type of the packet identified by Network BEHAVIOR.

Value
Explanation

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

behavior
on_rx_packets()