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

Is it possible to use ble_gattc with S110?

Hi,

I have an nRF51822-based peripheral with S110 softdevice, and it would be handy if I could nose around central's capabilities when it connects my device (I'd like to read out GAP device name, for starters).

The API to make GATTC stuff is present in S110, though when I call functions like sd_ble_gattc_primary_services_discover() I receive BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP with evt->evt.gattc_evt.params.prim_srvc_disc_rsp.count == 0 even though I am quite positive there is at least GAP service exposed in the central.

So, is it possible to read central characteristics with S110, or do I need at least S130 (peripheral+central SD) to do GATTC things?

Thank you.

Parents
  • Hi, during the weekend I've done some additional testing and it seems to me only Windows 10 as a central works for GATTC discovery with S110.

    I've tested following API calls:

    • sd_ble_gattc_primary_services_discover(conn_handle, 0, NULL)
    • sd_ble_gattc_char_value_by_uuid_read(conn_handle, &uuid, &range) with GAP device name UUID
    • sd_ble_gattc_characteristics_discover(conn_handle, &range)

    against following centrals:

    • Android 4.4.2 LG D160 phone, both with and without "nRF Master control panel" application runned, with started GATT server containing heart rate service and standard 1800/1801 - empty data received for all 3 calls
    • Mac mini (late 2012) with OSX ElCapitan- empty data received
    • Lenovo laptop with Linux and latest BlueZ (with -E flag) - empty data received
    • the same laptop with Windows 10 - primary services 1800 and 1801 were present as expected, device name char readout by UUID worked

    Notes:

    • discovery has been made always after bonding
    • in all cases I received correct reply events on each request (BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP, BLE_GATTC_EVT_CHAR_DISC_RSP and BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP), just having no data (except on Win10 where discovery worked as I expected)
    • when I connected LG Android phone (central) to linux laptop (as a peripheral), services 1800/1801 of laptop were visible in nRF Master control panel and laptop's device name characteristic was readable
  • Success! You were absolutely right about the 1-based indexing. Both sd_ble_gattc_primary_services_discover(conn_handle, 1, NULL) and ble_gattc_handle_range_t range = { 1, 0xffff } used in sd_ble_gattc_char_value_by_uuid_read() and sd_ble_gattc_characteristics_discover() must start with index 1 instead of zero. Weird thing that Windows10 are so tolerant about starting index, that it actually worked with zeroes. Anyway, thank you very much!

Reply
  • Success! You were absolutely right about the 1-based indexing. Both sd_ble_gattc_primary_services_discover(conn_handle, 1, NULL) and ble_gattc_handle_range_t range = { 1, 0xffff } used in sd_ble_gattc_char_value_by_uuid_read() and sd_ble_gattc_characteristics_discover() must start with index 1 instead of zero. Weird thing that Windows10 are so tolerant about starting index, that it actually worked with zeroes. Anyway, thank you very much!

Children
No Data
Related