This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2340R5: How do I get RSSI and ADV data in central mode.

Expert 1085 points
Part Number: CC2340R5

Hi Ti Experts.

We are developing an application for the central role of our customers. We use Central_addScanRes in app_central.c to obtain rssi. Both adv data and data_len are displayed as 0.

Only the address has data.

How do we obtain rssi, adv data and data_len?

void Central_addScanRes(GapScan_Evt_AdvRpt_t *pScanRpt)
{
    if(centralScanIndex < APP_MAX_NUM_OF_ADV_REPORTS)
    {
        if(gFlash_Global.gLog==1)
        {
            PRINT_DATA("Central_addScanRes rssi:%d,data len:%d",pScanRpt->rssi,pScanRpt->dataLen);
            //Central_addScanRes rssi:0,data len:0
        }
        centralScanRes[centralScanIndex].addressType = pScanRpt->addrType;
        centralScanRes[centralScanIndex].rssi = pScanRpt->rssi;//0
        memcpy(centralScanRes[centralScanIndex].address, pScanRpt->addr, B_ADDR_LEN);//has data
        memcpy(centralScanRes[centralScanIndex].adv_data, pScanRpt->pData, pScanRpt->dataLen);//no data
        centralScanRes[centralScanIndex].dataLen = pScanRpt->dataLen;//0

        centralScanIndex++;
    }
}


could you give me some suggestions?

Thanks.

  • Hello Weli,

    Thanks for reaching out.

    I would suggest taking a look at our SimpleLink Academy training material here. Make sure to enable the BLEAPPUTIL_ADV_REPORT flag and read the report values at that gap event inside the Central_ScanEventHandler() function. The section about "Scanning Task 2 – Print Scanning Results" provides a good example of how to do this. You also have the User Guide here to review this as well.

    BR,

    David.

  • Hi David,

    thanks.

    I can already get the scan report,
    I'm asking an additional question,
    If I want to get the device name from the scan report,
    Do I need to parse the adv data myself? Or is there an API I can call?

  • Hello Weli,

    Do you mean the Manufacturer Specific Data? or the Shorten or Complete local name?

    You can look for either of them inside the report: GAP_ADTYPE_LOCAL_NAME_SHORT or GAP_ADTYPE_MANUFACTURER_SPECIFIC.

    BR,

    David.