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

SERVICE HANDLE OF NUS

I am trying to determine the service handle of the nus example, to be able to verify that the central has turned on notifications.

I am using the sd_ble_gatts_value_get(m_conn_handle,  , &pval); function to read the attribute value and then test if for notifications enabled, but for the life of me cannot determine what it is?

I have found the characteristic add and found the p_nus->service_handle, but the reference is not valid, how do I access this handle to be able to do this test?

Herb

Parents
  • No one responded to this, but I found the handle, really obscure documentation and beyond sketchy examples.

    Now that I found this, and got it to compile, it does not return a value, what am I doing wrong here:

    if ( Device_Connected && filter_pointer == FILTER_LENGTH)
    {
    uint16_t length = 7u;
    uint8_t p_bull = NULL;
    ble_gatts_value_t pval;
    *pval.p_value = p_bull;

    err_code = sd_ble_gatts_value_get(m_conn_handle, m_nus.tx_handles.cccd_handle, &pval);
    uint8_t p_temp = *pval.p_value;
    if ( p_temp&0x01 )
    {
    do{
    err_code = ble_nus_data_send(&m_nus, ble_buffer, &length, m_conn_handle);
    if ((err_code != NRF_ERROR_INVALID_STATE) && (err_code != NRF_ERROR_NOT_FOUND))
    {
    APP_ERROR_CHECK(err_code);
    }
    } while (err_code == NRF_ERROR_RESOURCES);
    }
    }
    if(filter_pointer == FILTER_LENGTH){filter_pointer = false;}
    }

Reply
  • No one responded to this, but I found the handle, really obscure documentation and beyond sketchy examples.

    Now that I found this, and got it to compile, it does not return a value, what am I doing wrong here:

    if ( Device_Connected && filter_pointer == FILTER_LENGTH)
    {
    uint16_t length = 7u;
    uint8_t p_bull = NULL;
    ble_gatts_value_t pval;
    *pval.p_value = p_bull;

    err_code = sd_ble_gatts_value_get(m_conn_handle, m_nus.tx_handles.cccd_handle, &pval);
    uint8_t p_temp = *pval.p_value;
    if ( p_temp&0x01 )
    {
    do{
    err_code = ble_nus_data_send(&m_nus, ble_buffer, &length, m_conn_handle);
    if ((err_code != NRF_ERROR_INVALID_STATE) && (err_code != NRF_ERROR_NOT_FOUND))
    {
    APP_ERROR_CHECK(err_code);
    }
    } while (err_code == NRF_ERROR_RESOURCES);
    }
    }
    if(filter_pointer == FILTER_LENGTH){filter_pointer = false;}
    }

Children
No Data
Related