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: unable to get scanned device names (getting only MAC address )

Part Number: CC2340R5

Tool/software:

HI team,

Working on cc2340r5  SDK 8.1 and IDE 12.5

Trying to get the advisement report with the name by Using Basic_ble example( observer ).

scanning the non-connectable devices, Im getting the MAC address But unable to get the device names.

Referred the below link but unable to find the solution ,Please help us to get out of this.

Thanks and Regards
chandra shekar
  • Greetings,

    The API you are calling "SimpleCentral_getDeviceName" does not exist on Basic_BLE. You would need to make your own function that read the data at the pData pointer for dataLen number of bytes, and convert that to your device name. If you set a breakpoint in the BLEAPPUTIL_ADV_REPORT and check the variables view to look at the pScanRpt variable, you should be able to see that the pData and dataLen are populated correctly for your chosen advertiser. Then you would need to convert the bytes into chars, and extract the dev name from the data.

    Best,
    Achyut Ray

  • Hi Ray,

    we have created own function as below for getting the advt names,

    /**
    * Function to find the device name from advertising data.
    */
    bool FindDeviceName(uint8_t *pAdvData, uint8_t advDataLen, char *deviceName, size_t maxLen)
    {
    uint8_t index = 0;
    while (index < advDataLen)
    {
    uint8_t len = pAdvData[index];
    if (len == 0 || (index + len >= advDataLen))
    {
    break; // Malformed data
    }

    uint8_t type = pAdvData[index + 1];
    if (type == 0x09 || type == 0x08) // Complete Local Name or Shortened Local Name
    {
    uint8_t nameLen = len - 1; // Length excludes the type
    if (nameLen >= maxLen)
    {
    nameLen = maxLen - 1; // Truncate if name is too long
    }
    memcpy(deviceName, &pAdvData[index + 2], nameLen);
    deviceName[nameLen] = '\0'; // Null-terminate the string
    return true;
    }

    index += (len + 1);
    }

    return false; // Device name not found
    }

    We are not getting any name in pAdvData ,can you help us .

  • Greetings Abinesh,

    Apologies for the lack of response here. Due to vacation season, it has taken us longer to get back to you. Could you please show me what the output looks when you call your function? I also want to understand how you are testing. Is the advertising device another CC23xx device, or is it a phone/another peripheral? Looking forward to hearing from you.

    Best,
    Achyut Ray