How to read advertising BLE devices' name?

I've google the heck out of this, but I feel like I'm missing something because there are zero results.

I am developing a BLE central device, and the program is supposed to scan for advertising BLE devices, and list their address and name. Since the program is based off the "BLE Central" example, I have no issue reading their addresses, however, I cannot figure out how to read device names (e.g. "Zephyr BLE Module").

I know the BLE devices are advertising their names because I can see their names when I use the nRF Connect bluetooth app, but I want to be able to see their names through my own program, and print it to the console.

If it matters, the peripheral device is using the "BLE Peripheral" example.

  • Hi, can you please upload your projects. I tested with the peripheral example and central example and I had no problems finding the peripheral device. 

    Regards

    Runar

  • I am working with a clean 'central' and clean 'peripheral' example, except the changes you suggested.

    I believe I found the cause of the issue, maybe you could explain why it's happening.

    In the 'central' sketch, in 'device_found()' there's a filter for proximity:

    if (rssi < -70) {
    		return;
    	}

    When I changed '-70' to '-50', this fixed the issue, however, I'm confused as to why, since the average RSSI for that device is -60, and often times around -40 to -50, but when the filter is set to -70, it NEVER reports the peripheral device name (even though it DOES find the MAC address).

    Even more confusing is why the signal strength is different for the 'peripheral' and 'peripheral_uart' examples when they're performed on the exact same device?

  • Hi, 

    Neither "peripheral" or "peripheral_uart" includes any code that changes the transmission gain rom what I can see, so they should be similar. 

    As for the code snippet

    if (rssi < -70) {
    		return;
    	}

    Its only for connecting to a device. The data from the advertisement package should be readable without connecting to the device. So the filter should not have any effect on the readout that happens before any connection. 

    When you say without any modifications: Did you remove the parsing of the advertisement data to extract the device name? 

    Regards

    Runar

  • I get the same problem when I want to get the  BLE devices' name

          the "BLE Central"  can only get  31-Bytes adv data in "device_found()" callback,   but the device-name need more than 31-Bytes

             in "nRF Connect"  I get the BLE-device like this:

                               

         but in the "BLE Central" example, can only get 31-Bytes adv data like this:

               

            How can i get more than 31-Bytes adv data in  "device_found()" callback?

  • in "device_found()" callback:  I can only get the type: 0x01 0x06  0xFF,  and the 0xFF 0x09 after this can't get 

Related