

#ifndef RBA_DEMOBDBASIC_H
#define RBA_DEMOBDBASIC_H

#include "rba_DemObdBasic_Types.h"

#if (DEM_CFG_CHECKAPICONSISTENCY != FALSE)
#if DEM_CFG_OBD_IUMPR
/**
 * \defgroup DEM_OBD    OBD
 * Functions for OBD-relevant ECUs
 * @{
 */
/** @AR @RTE
 *
 * Dem314: Service is used to lock a denominator of a specific monitor.
 *
 * @param[in]    RatioID Ratio Identifier reporting that specific denominator is locked (for physical reasons - e.g. temperature conditions or minimum activity)
 * @return       E_OK = report of IUMPR denominator status was successfully reported.\n
 *               E_NOT_OK = Report of IUMPR denominator status was not successfully reported.\n
 */
Std_ReturnType Dem_RepIUMPRDenLock(Dem_RatioIdType RatioID);

/** @AR @RTE
 *
 * Dem315: Service is used to release a denominator of a specific monitor.
 *
 * @param[in]    RatioID Ratio Identifier reporting that specific denominator is released (for physical reasons - e.g. temperature conditions or minimum activity)
 * @return       E_OK = report of IUMPR denominator status was successfully reported.\n
 *               E_NOT_OK = Report of IUMPR denominator status was not successfully reported.\n
 */
Std_ReturnType Dem_RepIUMPRDenRelease(Dem_RatioIdType RatioID);


/** @AR @RTE
 *
 * Dem313: Service for reporting that faults are possibly found because all conditions are fullfilled.
 *
 * @param[in]    RatioID Ratio Identifier reporting that a respective monitor could have found a fault - only used when interface option "API" is selected.
 * @return       E_OK = Report of IUMPR result was successfully reported\n
 *               E_NOT_OK = Report of IUMPR result was not successfully reported\n
 */
Std_ReturnType Dem_RepIUMPRFaultDetect(Dem_RatioIdType RatioID);

/**
 * @ingroup DEM_H
 *
 * In order to communicate the status of the (additional) denominator conditions among the OBD relevant ECUs,
 * the API is used to forward the condition status to a Dem of a particular ECU.\n
 * API is needed in OBD-relevant ECUs only\n
 * \n
 * @param[in] ConditionId Identification of a IUMPR denominator condition ID (General Denominator, Cold start, EVAP, 500mi).
 *            ConditionStatus Status of the IUMPR denominator condition (Not-reached, reached, not reachable / inhibited)
 * @return E_OK: set of IUMPR denominator condition was successful\n
 *         E_NOT_OK: set of IUMPR denominator condition failed or could not be accepted.
 */

Std_ReturnType Dem_SetIUMPRDenCondition (Dem_IumprDenomCondIdType ConditionId, Dem_IumprDenomCondStatusType ConditionStatus);
#endif


/** @AR @RTE
 *
 * Dem312: Reports the event as disabled for the PID $41 computation.
 *
 * @note For the computation of PID $41, the monitor has to report its event as disabled, if the test cannot be carried out
 *       anymore until the end of this driving cycle.
 * @param[in]    EventId            Identification of an event by assigned EventId.
 * @return       E_OK = Setting of event to disabled was successful.\n
 *               E_NOT_OK = Setting of event to disabled failed.\n
 */
Std_ReturnType Dem_SetEventDisabled(Dem_EventIdType EventId);

/**
 * @ingroup DEM_H
 *
 * Dem739: Marks the current OBD driving cycle as having met the criteria for the PFC cycle.
 * API is needed in OBD-relevant ECUs only.
 *
 * @return  Always E_OK is returned, as E_NOT_OK will never appear.
 */
Std_ReturnType Dem_SetPfcCycleQualified (void);

/**
 * @ingroup DEM_H
 *
 * Dem740: Returns TRUE if the criteria for the PFC cycle have been met during the current OBD driving cycle. API is
 * needed in OBD-relevant ECUs only.
 *
 * @param [out] isqualified TRUE - During the current OBD driving cycle, the criteria for the PFC cycle have been met.
 *                          FALSE - During the current OBD driving cycle, the criteria for the PFC cycle have not been met.
 *
 * @return  Always E_OK is returned, as E_NOT_OK will never appear.
 */
Std_ReturnType Dem_GetPfcCycleQualified(boolean *isqualified);

/**@}*//* End of Doxygen subgroup DEM_OBD */
#endif /* DEM_CFG_CHECKAPICONSISTENCY */

#if DEM_CFG_OBD_IUMPR
/**
 * @ingroup DEM_H
 *
 * This service is used to read the numerator and denominator values of individual ratios, along with the Dem event that
 * is assigned to the ratio within the configuration.
 *
 * @param  [in]  RatioID     - Ratio Identifier about which the details are needed.
 * @param  [out] Numerator   - Pointer to the buffer where the numerator value will be written.
 * @param  [out] Denominator - Pointer to the buffer where the denominator value will be written.
 * @param  [out] EventID     - Pointer to the buffer where the mapped eventID will be written.
 * @param  [out] Group       - Pointer to the buffer where the mapped IUMPR group name will be written.
 *
 * @return       E_OK     - All information about the requested ratio is available in the output buffers. \n
 *               E_NOT_OK - Either the queried ratio does not exist or it is mapped to an event that is suppressed.
 */
Std_ReturnType Dem_GetIUMPRRatioData(Dem_RatioIdType RatioID, uint16* Numerator, uint16* Denominator, Dem_EventIdType* EventID, uint8* Group);
#endif

#endif
