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

gatt service inquiry

Hi,

In addition to listening the advertiser's and beacon data we also need to offer the master application - which is connected to BLE-module via UART - the possibility to connect to peripheral and get information of available GATT-services. For this we need to be able to inquire service uuids from the connected peripheral.

I've been browsing through the examples but not been able to find out the solution for this. There are samples for listening the defined services, but not one for getting the information of all the available services.

Could anyone please guide me to the correct example, or give me some step-by-step information for building such an application.

Devkit used is nRF52840-DK, SDK revision is nRF5_SDK_16.0.0_98a08e2

Regards, Jukka

Parents
  • Hi Jukka

    It seems like you're looking for a way to discover services. Have you checked out our database discovery module which handles service discovery on GATT servers? The ble_app_blinky_c example for one is an example using this to discover the services available in the peripheral it connects to. 

    Alternatively, you can run discovery algorithms yourself by using sd_ble_gattc_XX functions, but I personally think the module is the easiest to use.

    Best regards,

    Simon

  • Thänx for the response, Simon

    So it is the callback function db_disc_handler() handling - or routing - the database discovery events. I have one beacon box which looks like the following in the Nordic android tool:

    showing some services available, of which the Battery service seems to be the only standardized.

    However our software shows the following output when connecting to the same device :

    Advertising type=0x0B, device WGX_iBeacon, addrtype=1, addr=7571823740D8  rssi=-76, phy=1, sphy=255 
    Match found, connecting...
    Connecting, started 30s connection timer
    scan_evt_handler: Connecting to target 7571823740d8
    ble_evt_handler: BLE_GAP_EVT_CONNECTED
    gatt_evt_handler: MTU exchange completed, Ble NUS max data length set to 20 bytes
    ble_evt_handler: BLE_GATTC_EVT_EXCHANGE_MTU_RSP: 23 bytes
    gatt_evt_handler: NRF_BLE_GATT_EVT_DATA_LENGTH_UPDATED
    ble_evt_handler: BLE_GAP_OPT_AUTH_PAYLOAD_TIMEOUT
    db_disc_handler: BLE_DB_DISCOVERY_SRV_NOT_FOUND
    db_disc_handler: BLE_DB_DISCOVERY_AVAILABLE
    ble_evt_handler: BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP
    ble_evt_handler: BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST
    ble_evt_handler: BLE_GAP_EVT_CONN_PARAM_UPDATE
    ble_evt_handler: BLE_GAP_EVT_DISCONNECTED

    So it seems that the same services are not found with our own application, which is based on the ble_app_uart_c example.

    Rgrds, Jukka

Reply
  • Thänx for the response, Simon

    So it is the callback function db_disc_handler() handling - or routing - the database discovery events. I have one beacon box which looks like the following in the Nordic android tool:

    showing some services available, of which the Battery service seems to be the only standardized.

    However our software shows the following output when connecting to the same device :

    Advertising type=0x0B, device WGX_iBeacon, addrtype=1, addr=7571823740D8  rssi=-76, phy=1, sphy=255 
    Match found, connecting...
    Connecting, started 30s connection timer
    scan_evt_handler: Connecting to target 7571823740d8
    ble_evt_handler: BLE_GAP_EVT_CONNECTED
    gatt_evt_handler: MTU exchange completed, Ble NUS max data length set to 20 bytes
    ble_evt_handler: BLE_GATTC_EVT_EXCHANGE_MTU_RSP: 23 bytes
    gatt_evt_handler: NRF_BLE_GATT_EVT_DATA_LENGTH_UPDATED
    ble_evt_handler: BLE_GAP_OPT_AUTH_PAYLOAD_TIMEOUT
    db_disc_handler: BLE_DB_DISCOVERY_SRV_NOT_FOUND
    db_disc_handler: BLE_DB_DISCOVERY_AVAILABLE
    ble_evt_handler: BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP
    ble_evt_handler: BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST
    ble_evt_handler: BLE_GAP_EVT_CONN_PARAM_UPDATE
    ble_evt_handler: BLE_GAP_EVT_DISCONNECTED

    So it seems that the same services are not found with our own application, which is based on the ble_app_uart_c example.

    Rgrds, Jukka

Children
No Data
Related