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

Avoid service discovery

I am using S130, SDK13 and NRF52832 both on my central and peripheral - custom boards.

I am trying to avoid service discovery on my peripheral. 

I have set the service_changed to 0 when configuring the softdevice.

On my central I do not run service-discovery, but my peripheral does not get a handle to the service even though I run this code when I connect:

void ble_lbs_status_update (ble_alarm_service_t* p_our_service, uint8_t *p_lock_state, uint16_t len) {

    uint32_t err_code = NRF_SUCCESS;

    ble_gatts_value_t gatts_value;

    // Initialize value struct.

    memset(&gatts_value, 0, sizeof(gatts_value));

    gatts_value.len     = sizeof(uint8_t)*len;

    gatts_value.offset  = 0;

    gatts_value.p_value = p_lock_state;

    // new

    // Update database.

    err_code = sd_ble_gatts_value_set (p_our_service->conn_handle, p_our_service->status_char_handles.value_handle, &gatts_value);

    if (err_code != NRF_SUCCESS)

    {

       return err_code;

    }

    //new

if (p_our_service->conn_handle != BLE_CONN_HANDLE_INVALID)

{

uint16_t               len = 5;

ble_gatts_hvx_params_t hvx_params;

memset(&hvx_params, 0, sizeof(hvx_params));

hvx_params.handle = p_our_service->status_char_handles.value_handle;

        hvx_params.type   = BLE_GATT_HVX_NOTIFICATION;

        hvx_params.offset = gatts_value.offset;

        hvx_params.p_len  = &gatts_value.len;

        hvx_params.p_data = gatts_value.p_value;

sd_ble_gatts_hvx(p_our_service->conn_handle, &hvx_params);

}

}

Do you have a check-list of how to avoid service discovery on a peripheral?

Regards
Jens

Parents Reply Children
Related