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

read device name

Hi, I try to access Generic Access to get device name. So, I modified "ble_bas_c.c - ble_bas_c_init()" like this.

bas_uuid.type                = BLE_UUID_GAP_CHARACTERISTIC_DEVICE_NAME;
bas_uuid.uuid                = BLE_UUID_TYPE_BLE;

mp_ble_bas_c                 = p_ble_bas_c;

mp_ble_bas_c->conn_handle    = BLE_CONN_HANDLE_INVALID;
mp_ble_bas_c->bl_cccd_handle = BLE_GATT_HANDLE_INVALID;
mp_ble_bas_c->bl_handle      = BLE_GATT_HANDLE_INVALID;
mp_ble_bas_c->evt_handler    = p_ble_bas_c_init->evt_handler;

return ble_db_discovery_evt_register(&bas_uuid,
                                     db_discovery_evt_handler);

But, it's not pairing. I want to access device name. When i use "sd_ble_gap_device_name_get()", Device name value print "nrf51822".

How to access "Generic Access - Device Name"

Parents
  • FormerMember
    0 FormerMember

    The device name should be set using sd_ble_gap_device_name_set(..). After setting the device name with that function, you can retrieve the device name using sd_ble_gap_device_name_get(..).

    In our SDK examples, the device name is set in gap_params_init().

    Update 30.03.16: In order to get the device name, appearance, etc when in a connection, you will need to implement a client module that takes care of the handles for the device name characteristic, appearance characteristic, etc. The attached example shows how to extract the device name when in a connection. The example is based on ble_app_uart_c, and will request the device name after receiving "name" over UART (and data_array does only contain "name"). In the example, ble_gap_c.c/h implements a limited GAP client module that finds and takes care of the device name characteristic handle.

    Note 1: that the example has not been tested extensively.

    Note 2: the example is based on SDK 11, and should be used with S130/S132 v 2.0.0

    ble_app_uart_c_extract_peer_gap_params.zip

  • FormerMember
    0 FormerMember in reply to FormerMember

    I have updated the answer to answer your question.

Reply Children
No Data
Related