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

Device name set but appears as "n/a" in Android MCP

The device name is set in the usual way at the start of gap_params_init():

BLE_GAP_CONN_SEC_MODE_SET_OPEN(&sec_mode);
err_code = sd_ble_gap_device_name_set(&sec_mode,
                                      (const uint8_t *)DEVICE_NAME,
                                      strlen(DEVICE_NAME));
APP_ERROR_CHECK(err_code);

For some reason the device name appears as "n/a" when the device is scanned in Android MCP. I am fairly certain the name is getting set. I've added this to on_ble_evt():

case BLE_GAP_EVT_CONNECTED:
        /* Debug device name problem... */
        m_device_name_length = sizeof(m_device_name);
        err_code = sd_ble_gap_device_name_get(m_device_name, &m_device_name_length);
        APP_ERROR_CHECK(err_code);

When I break in the debugger after connecting, m_device_name[] contains the correct device name and m_device_name length contains the number of bytes in the name.

What I have changed recently is the addition of OTA DFU support with the v2.0.1 310 SoftDevice and v7.1.0 SDK. Application OTA DFU seems to be working correctly, the disappearing device name at the central is the only problem I'm seeing. In the course of debugging this I've backed out DFU support in the main() function but still include the various SDK files and include paths in the build, and the device name continues to appear as "n/a".

I'm hoping someone may have run into this problem or has enough insight into SoftDevice and stack internal operation to know what is probably going on here.

Can anyone explain why the device name no longer appears in the Android MCP?

Thanks and Regards, Matt

Related