uint32_t ble_ancs_c_request_attrs(ble_ancs_c_t * p_ancs, const ble_ancs_c_evt_notif_t * p_notif) { uint32_t err_code; err_code = ble_ancs_verify_notification_format(p_notif); VERIFY_SUCCESS(err_code); err_code = ble_ancs_get_notif_attrs(p_ancs, p_notif->notif_uid); p_ancs->parse_state = COMMAND_ID_AND_NOTIF_UID; VERIFY_SUCCESS(err_code); return NRF_SUCCESS; }
/**@brief Function for receiving and validating notifications received from the Notification Provider. * * @param[in] p_ancs Pointer to an ANCS instance to which the event belongs. * @param[in] p_ble_evt Bluetooth stack event. * @param[in] p_data_src Pointer to data that was received from the Notification Provider. * @param[in] hvx_len Length of the data that was received by the Notification Provider. */ static void parse_notif(const ble_ancs_c_t * p_ancs, ble_ancs_c_evt_t * p_ancs_evt, const uint8_t * p_data_src, const uint16_t hvx_data_len) { uint32_t err_code; if (hvx_data_len != BLE_ANCS_NOTIFICATION_DATA_LENGTH) { m_ancs_evt.evt_type = BLE_ANCS_C_EVT_INVALID_NOTIF; p_ancs->evt_handler(&m_ancs_evt); } /*lint --e{415} --e{416} -save suppress Warning 415: possible access out of bond */ p_ancs_evt->notif.evt_id = (ble_ancs_c_evt_id_values_t) p_data_src[BLE_ANCS_NOTIF_EVT_ID_INDEX]; p_ancs_evt->notif.evt_flags.silent = (p_data_src[BLE_ANCS_NOTIF_FLAGS_INDEX] >> BLE_ANCS_EVENT_FLAG_SILENT) & 0x01; p_ancs_evt->notif.evt_flags.important = (p_data_src[BLE_ANCS_NOTIF_FLAGS_INDEX] >> BLE_ANCS_EVENT_FLAG_IMPORTANT) & 0x01; p_ancs_evt->notif.evt_flags.pre_existing = (p_data_src[BLE_ANCS_NOTIF_FLAGS_INDEX] >> BLE_ANCS_EVENT_FLAG_PREEXISTING) & 0x01; p_ancs_evt->notif.evt_flags.positive_action = (p_data_src[BLE_ANCS_NOTIF_FLAGS_INDEX] >> BLE_ANCS_EVENT_FLAG_POSITIVE_ACTION) & 0x01; p_ancs_evt->notif.evt_flags.negative_action = (p_data_src[BLE_ANCS_NOTIF_FLAGS_INDEX] >> BLE_ANCS_EVENT_FLAG_NEGATIVE_ACTION) & 0x01; p_ancs_evt->notif.category_id = (ble_ancs_c_category_id_values_t) p_data_src[BLE_ANCS_NOTIF_CATEGORY_ID_INDEX]; p_ancs_evt->notif.category_count = p_data_src[BLE_ANCS_NOTIF_CATEGORY_CNT_INDEX]; p_ancs_evt->notif.notif_uid = uint32_decode(&p_data_src[BLE_ANCS_NOTIF_NOTIF_UID]); /*lint -restore*/ err_code = ble_ancs_verify_notification_format(&m_ancs_evt.notif); if (err_code == NRF_SUCCESS) { m_ancs_evt.evt_type = BLE_ANCS_C_EVT_NOTIF; } else { m_ancs_evt.evt_type = BLE_ANCS_C_EVT_INVALID_NOTIF; } p_ancs->evt_handler(&m_ancs_evt); }
uint32_t ble_ancs_c_request_attrs(const ble_ancs_c_evt_notif_t * notif) { uint32_t err_code; err_code = ble_ancs_verify_notification_format(notif); if (err_code != NRF_SUCCESS) { return err_code; } err_code = ble_ancs_get_notif_attrs(mp_ble_ancs, notif->notif_uid); m_parse_state = COMMAND_ID_AND_NOTIF_UID; if (err_code != NRF_SUCCESS) { return err_code; } return NRF_SUCCESS; }