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

Can't SoftDevice recognize cccd?

I coded following

BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(&cccd_md.read_perm);

BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(&cccd_md.write_perm);

char_md.char_props.notify = 1;

char_md.p_cccd_md = &cccd;

and deleted everything that check m_nus.is_notification_enabled.

Then notification operation works well.

Is the cccd just one of attributes?

Is enabling or disabling notification done manually by checking m_nus.is_notification_enabled(reflected cccd value)?

Parents
  • FormerMember
    0 FormerMember

    The purpose of the code knowing if the notifications are enabled or not, is for the application to know its current state. If trying to transmit a notification when notifications aren't enabled, sd_ble_gatts_hvx(..) will return NRF_ERROR_INVALID_STATE. The example ble_app_hrs is an example that doesn't know its current state: As long as there is a connection, it will try to update the heart rate measurement values.

Reply
  • FormerMember
    0 FormerMember

    The purpose of the code knowing if the notifications are enabled or not, is for the application to know its current state. If trying to transmit a notification when notifications aren't enabled, sd_ble_gatts_hvx(..) will return NRF_ERROR_INVALID_STATE. The example ble_app_hrs is an example that doesn't know its current state: As long as there is a connection, it will try to update the heart rate measurement values.

Children
Related