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.

  • Hi endnode you rock men :]

    It is working pretty awesome

    I use 0x0000 for the conn_handle because my requeriment are one device per time. The only concern I have about this method is it still BLE compliant doing it? and some times I am getting 2 times the same ATT_WRITE_COMMAND to the peripheral: ACK OK, ACK Retry, Unexp. NESN, Unexp. SN from my peripheral to central?? when the central is sending the payload to the peripheral

Reply
  • Hi endnode you rock men :]

    It is working pretty awesome

    I use 0x0000 for the conn_handle because my requeriment are one device per time. The only concern I have about this method is it still BLE compliant doing it? and some times I am getting 2 times the same ATT_WRITE_COMMAND to the peripheral: ACK OK, ACK Retry, Unexp. NESN, Unexp. SN from my peripheral to central?? when the central is sending the payload to the peripheral

Children
No Data
Related