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

Bypass or skip the discovery service nRF52 SDK 12.2

Hi all,

I am trying to reduce the connection time between each connection to the minimal posible

Connect -->Transfer data -- Disconnect

I am facing two options:

  1. On the BLE_GAP_EVT_CONNECTED event avoid to call ble_db_discovery_start(), but it require in some way set BLE_LBS_C_EVT_DISCOVERY_COMPLETE with a valid event and how to assing the conn_handle to static handles on the GATT server

  2. From the BLE_GAP_EVT_CONNECTED event Set handles and enable a Notificiation to the peripheral.

Which is the most viable option? or Are there some example doing something similar?

Thanks

Parents
  • Hi,

    No problem with issuing (G)ATT Write once you know 16-bit handle number, here is paraphrase of nRF5 SDK v12.2.0 example:

    //...
    
    uint32_t                 err_code;
    ble_gattc_write_params_t write_params;
    uint8_t                  your_data_buffer[YOUR_DATA_MAX_LEN];
    
    //...
    your_data_buffer[0] = 0x41;
    your_data_buffer[1] = 0x42;
    //...
    
    write_params.write_op = BLE_GATT_OP_WRITE_REQ;
    write_params.handle   = your_write_handle_number;
    write_params.offset   = 0;
    write_params.len      = sizeof(your_data_buffer);
    write_params.p_value  = your_data_buffer;
    
    err_code = sd_ble_gattc_write(my_connection_handle, &write_params);
    APP_ERROR_CHECK(err_code);
    

    If you need GATT Client Service Discovery example (oriented to find specific UUID not all of them and so you can use much shorter algorithm to crawl through GATT handle tree) here are some hints.

  • awesome thanks :) that code should I put inside the my Connected event? and what are the differences between your_write_handle_number and my_connection_handle?

    I know my handle for example: 0x0010 for a writeable characteristic on the peripheral. Is it the same value than your_write_handle_number? and what is my_connection_handle value sorry I am a little confused

    regards

Reply
  • awesome thanks :) that code should I put inside the my Connected event? and what are the differences between your_write_handle_number and my_connection_handle?

    I know my handle for example: 0x0010 for a writeable characteristic on the peripheral. Is it the same value than your_write_handle_number? and what is my_connection_handle value sorry I am a little confused

    regards

Children
No Data
Related