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

indication issue

Hi all,

someone can please explain to me how works the indication?

How can i read the value of cccd in the APP?My problem is understand if the APP is ready to receive the indication. i would like read the cccd value berfore to send my logs.

Thanks, Anna

  • if i understand correctly the sd_ble_gatts_value_get() allows me to understand if the app is available to receive the indication, but if i use it the value of ccd is always 0. Maybe, i wrong pass the parameter in the function. This is my code:

    void DataLog_SVC_SendEvent(uint8_t typeLog, uint8_t craving, uint32_t timestamp,uint8_t crc) {

    ble_data_log_service_user_log_t data; ble_gatts_value_t gatts_value; ble_data_log_service_evt_type_t evt_type;

    uint32_t err_code;

    data.flags=typeLog;

    data.craving = craving;

    data.time = timestamp;

    data.crc_8 = crc;

    err_code = sd_ble_gatts_value_get(m_datalog.conn_handle,m_datalog.user_log_handles.cccd_handle,&gatts_value);

    // ble_srv_is_indication_enabled(m_datalog.user_log_handles.cccd_handle);

    err_code = ble_data_log_service_user_log_send(&m_datalog,&data);

    // APP_ERROR_CHECK(err_code); }

  • Looks like you are using it correctly. Are you sure you are using the correct connection handle and attribute handle? Are you checking the returned error code of sd_ble_gatts_value_get()? Is it 0x00000000, NRF_SUCCESS? Are you sure that CCCD value is not 0x0000? What is the len of the returned value? Is gatts_value.len 2?

Related