This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

OpenThread whitelist

Hi,

I'm trying to get the RSSI of incoming 802.15.4 packets using otLinkRawGetRssi(), but I need only RSSI from one specific device. I tried to use whitelist (otLinkSetWhitelistEnabled(), otLinkAddWhitelist()) and I checked in CLI that whitelist is enabled with correct address. Despite that I'm still getting the RSSI of all devices near, not only that one. Maybe there's a better way for getting the RSSI of packets incoming from specific 802.15.4/Thread device?

  • Hello,

    Currently OpenThread does provide information about the RSSI of the last recevied packet to the application through several mechanisms:

    1. Whenever you receive UDP or CoAP application message there is otMessageInfo parameter provided.

    Inside this structure you can find pointer to the link information called mLinkInfo.

    Unfortunately OpenThread does not provide in its API the structure declaration of mLinkInfo, but you can try to copy it from C++ core in following way:

    struct LinkInfo
    {
        uint16_t mPanId;         ///< Source PAN ID
        uint8_t  mChannel;       ///< 802.15.4 Channel
        int8_t   mRss;           ///< Received Signal Strength in dBm.
        uint8_t  mLqi;           ///< Link Quality Indicator for a received message.
        bool     mLinkSecurity;  ///< Indicates whether or not link security is enabled.
    };
    

    Then you can cast your mLinkInfo variable to the LinkInfo structure and obtain the RSSI value.

    Example:

    void udpPacketReceived(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo)
    {
    	LinkInfo *p_link_info = (LinkInfo *)aMessageInfo->mLinkInfo;
    	
    	// Read RSSI value of the packet
    	int8_t rssi = p_link_info->mRss;
    }
    

    We will try to provide this structure declaration to the official API in the future.

    1. Function otLinkRawGetRssi() gives you RSSI value of the last received packet on the Radio independent of the whitelist settings.

    You can try to call this function right inside application callback when UDP/CoAP packet is received from intended Thread device.

    1. Use special functions to iterate through all neighbors or children. Both otNeighborInfo and otChildInfo structures contain information of last RSSI (mRssi).

      otThreadGetNextNeighborInfo(otInstance *aInstance, otNeighborInfoIterator *aIterator, otNeighborInfo *aInfo);

      otThreadGetChildInfoById(otInstance *aInstance, uint16_t aChildId, otChildInfo *aChildInfo);

    2. Set up two boards, one which acts as a parent and the second that acts as a child.

    Then on the child node you can use following function to obtain RSSI of the last received packet from the parent.

    otThreadGetParentLastRssi(otInstance *aInstance, int8_t *aLastRssi);
    
  • Thanks for the answer ;) I used the first way, I had to change it a bit using typedef, but it works perfectly ;)

  • Great to hear that!

    As you said making a typedef should be the preferred way. I will add this type to the OpenThread official API soon.

Related