CYBT-343026 : How can I get BLE Scan device name?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
NeDh_4602711
Level 5
Level 5
5 solutions authored First solution authored 50 replies posted

Hello,

I am able to scan all nearby devices with RSSI but I want to fetch their local name of BLE. How can I get the local name?

Below is my code:

void scanResult(wiced_bt_ble_scan_results_t *p_scan_result, uint8_t *p_adv_data)

{

//   uint8_t mfgLen;

   // uint8_t* mfgData = wiced_bt_ble_check_advertising_data( p_adv_data,0xFF,&mfgLen);

    WICED_BT_TRACE("Found device %d ",p_scan_result->rssi);

    if(p_scan_result->rssi>-80){

    uint8_t index=0;

    int fieldLength=p_adv_data[index];

    do {

        for(int i=0;i<=fieldLength;i++)

            WICED_BT_TRACE("%02X ",p_adv_data[index+i]);

        index = index + fieldLength + 1;

        fieldLength = p_adv_data[index];

    } while(fieldLength);

    }

    WICED_BT_TRACE("\n");

}

Thanks in advance.

Regards,

Neeraj

0 Likes
1 Solution
Owen_Zhang123
Moderator
Moderator
Moderator
5 questions asked 500 solutions authored 250 sign-ins

You can get the BLE device name only if it is contained in the advertising packet or scan response packet.

If the slave doesn't broadcast the name in them, the master can't get it.

View solution in original post

0 Likes
3 Replies
Owen_Zhang123
Moderator
Moderator
Moderator
5 questions asked 500 solutions authored 250 sign-ins

You can get the BLE device name only if it is contained in the advertising packet or scan response packet.

If the slave doesn't broadcast the name in them, the master can't get it.

0 Likes

I have confirmed on the nRF Connect app. I can see a name on the nRF connect.

May I know which API function is available to fetch the scanned device local name.

Thanks and regards,

Neeraj

0 Likes

Could you check if the name is contained in the adv or scan response packet of the peripheral device? We can't get the name if they don't contain it.

0 Likes