/* SPDX-License-Identifier: LGPL-2.1-only OR BSD-3-Clause */
/******************************************************************************
 *
 * This file is provided under a dual license.  When you use or
 * distribute this software, you may choose to be licensed under
 * version 2.1 of the GNU Lesser General Public License
 * ("LGPLv2.1 License") or BSD License.
 *
 * LGPLv2.1 License
 *
 * Copyright(C) 2019 MediaTek Inc.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of version 2.1 of the GNU Lesser General Public
 * License as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html for more
 * details.
 *
 * BSD LICENSE
 *
 * Copyright(C) 2019 MediaTek Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 *  * Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *  * Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *  * Neither the name of the copyright holder nor the names of its
 *    contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 *****************************************************************************/

/*----------------------------------------------------------------------------*/
/*! @file u_rrctx_eng.h 
 *  $RCSfile: $
 *  $Revision: #1 $
 *  $Date: 2015/11/10 $
 *  $Author: dtvbm11 $
 *  
 *  @par Description:
 *         This contains Rating Region Context library macros, definitons, 
 *         structures, and API's, which are shared with other modules, and 
 *         customized engines.
 *          
 */
/*----------------------------------------------------------------------------*/

#ifndef _U_RRCTX_ENG_H_
#define _U_RRCTX_ENG_H_

/*-----------------------------------------------------------------------------
                    include files
 ----------------------------------------------------------------------------*/
#include "u_rrctx.h"

/*----------------------------------------------------------------------------*/
/*! @addtogroup groupMW_RRCTX
 *  @{ 
 */
/*----------------------------------------------------------------------------*/


/*-----------------------------------------------------------------------------
                    macros, defines, typedefs, enums
 ----------------------------------------------------------------------------*/

/*------------------------------------------------------------------*/
/*! @fn			INT32 (*x_rrctx_open_rating_obj_fct) (
 *   					HANDLE_T            	h_rating,
 *   					VOID*               	pv_param,
 *   					VOID**              	ppv_rating_obj_data)
 *
 *  @brief			Function type to load data of a specific rating based on the given rating type
 *
 *  @param [in]	h_rating            -Contains the handle of RRCTX object.
 *          			pv_param         -Contains tuner name used for opening RRT.
 *								  
 *  @param [out]	ppv_rating_obj_data		-NULL. In design of RRT engine, no object data.
 *
 *  @note			
 *  @see
 *  @return		Return the error code
 *
 *  @retval		RRCTXR_OK               			The routine was successful.
 *         			RRCTXR_INV_ARG          		Invalid arguments.
 */
/*------------------------------------------------------------------*/

typedef INT32 (*x_rrctx_open_rating_obj_fct) (
    HANDLE_T            h_rating,
    VOID*               pv_param,
    VOID**              ppv_rating_obj_data);

/*------------------------------------------------------------------*/
/*! @fn			INT32 (*x_rrctx_close_rating_obj_fct) (VOID*               pv_rating_obj_data)
 *
 *  @brief			Function type to delete a loaded rating object.
 *
 *  @param [in]	pv_rating_obj_data   	-NULL. In design of RRT engine, no object data.
 *								  
 *  @param [out]	-
 *
 *  @note			
 *  @see
 *  @return		Return the error code
 *
 *  @retval		RRCTXR_OK               			The routine was successful.
 */
/*------------------------------------------------------------------*/

typedef INT32 (*x_rrctx_close_rating_obj_fct) (
    VOID*               pv_rating_obj_data);


/*------------------------------------------------------------------*/
/*! @fn			INT32 (*x_rrctx_get_rating_obj_info_len_fct) (
 *   					HANDLE_T            		h_rating,
 *   					RRCTX_KEY_TYPE_T    	e_key_type,
 *   					VOID*               		pv_key_param,
 *   					SIZE_T*             		pz_rating_info_len)
 *
 *  @brief			Function type to get the length of the requested rating information
 *
 *  @param [in]	h_rating            	-Contains the handle of RRCTX object.
 *          			e_key_type	       -Contains specific information type to be retrieved.
 *				pv_key_param	-Contains the auxiliary data to get the requested rating info. 
 *								  This argument could be NULL, depending on the value of the
 *								  argument e_key_type.
 *								  
 *  @param [out]	pz_rating_info_len		-Contains the length of the requested raring information
 *									  if the routine was successfully returned.
 *
 *  @note			
 *  @see
 *  @return		Return the error code
 *
 *  @retval		RRCTXR_OK               			The routine was successful.
 *         			RRCTXR_INV_ARG          		Invalid arguments.
 *	`			RRCTXR_INFO_NOT_FOUND         The requested event information is not present.
 */
/*------------------------------------------------------------------*/

typedef INT32 (*x_rrctx_get_rating_obj_info_len_fct) (
    HANDLE_T            h_rating,
    RRCTX_KEY_TYPE_T    e_key_type,
    VOID*               pv_key_param,
    SIZE_T*             pz_rating_info_len);


/*------------------------------------------------------------------*/
/*! @fn			INT32 (*x_rrctx_get_rating_obj_info_fct) (
 *   					HANDLE_T            		h_rating,
 *   					RRCTX_KEY_TYPE_T    	e_key_type,
 *   					VOID*               		pv_key_param,
 *   					SIZE_T*             		pz_rating_info_len,
 *					VOID*				 pv_rating_info)
 *
 *  @brief			Function type to get the requested rating information
 *
 *  @param [in]	h_rating            		-Contains the handle of RRCTX object.
 *          			e_key_type	       	-Contains specific information type to be retrieved.
 *				pv_key_param		-Contains the auxiliary data to get the requested rating info. 
 *									  This argument could be NULL, depending on the value of the
 *								  	  argument e_key_type.								  
 *  				pz_rating_info_len		-Contains the length of the requested raring information
 *									  if the routine was successfully returned.
 *  @param [out]	pv_rating_info      		-Contains the requested rating information if the routine 
 *									  was successfully returned.
 *
 *  @note			
 *  @see
 *  @return		Return the error code
 *
 *  @retval		RRCTXR_OK               			The routine was successful.
 *         			RRCTXR_INV_ARG          		Invalid arguments.
 *	`			RRCTXR_INFO_NOT_FOUND         The requested event information is not present.
 */
/*------------------------------------------------------------------*/
typedef INT32 (*x_rrctx_get_rating_obj_info_fct) (
    HANDLE_T            h_rating,
    RRCTX_KEY_TYPE_T    e_key_type,
    VOID*               pv_key_param,
    SIZE_T*             pz_rating_info_len,
    VOID*               pv_rating_info);


/*------------------------------------------------------------------*/
/*! @fn			INT32 (*x_rrctx_storage_rating_obj_fct) (
 *  					HANDLE_T            	h_rating,
 *   					BOOL                	b_store)
 *
 *  @brief			Function type to store or clear the data of the given rating.
 *
 *  @param [in]	h_rating		-Contains the handle of RRCTX object.
 *				b_store		-Contains to store or not
 *								  
 *  @param [out]	-
 *
 *  @note			
 *  @see
 *  @return		Return the error code
 *
 *  @retval		RRCTXR_OK               			The routine was successful.
 *          			RRCTXR_INV_ARG          		Invalid arguments.
 *				RRCTXR_INTL_ERROR		 	Invalid rating handle. 
 *          			RRCTXR_NOT_INIT         		The RRCTX component is not inited.
 */
/*------------------------------------------------------------------*/
typedef INT32 (*x_rrctx_storage_rating_obj_fct) (
    HANDLE_T            h_rating,
    BOOL                b_store);


/*------------------------------------------------------------------*/
/*! @fn			INT32 (*x_rrctx_engine_task_fct) ( VOID )
 *
 *  @brief			Function type of the task of the rating engine.
 *
 *  @param [in]	-
 *								  
 *  @param [out]	-
 *
 *  @note			
 *  @see
 *  @return		Return the error code
 *
 *  @retval		RRCTXR_OK               			The routine was successful.
 *				RRCTXR_INTL_ERROR		 	Invalid rating handle. 
 */
/*------------------------------------------------------------------*/

typedef INT32 (*x_rrctx_engine_task_fct) ( VOID );


/* Structure for the RRCTX engine function table*/
/*------------------------------------------------------------------*/
/*! @struct	RRCTX_ENG_FCT_TBL_T
 *  @brief		Function table of the rating engine
 *
 *  @code
 *  	typedef struct _RRCTX_ENG_FCT_TBL_T
 *	{
 *	    x_rrctx_open_rating_obj_fct          	pf_open_rating_obj;
 *	    x_rrctx_close_rating_obj_fct         	pf_close_rating_obj;
 *	    x_rrctx_get_rating_obj_info_len_fct  pf_get_rating_obj_info_len;
 *	    x_rrctx_get_rating_obj_info_fct      	pf_get_rating_obj_info;
 *	    x_rrctx_storage_rating_obj_fct       	pf_storage_rating_obj;
 *	    x_rrctx_engine_task_fct              	pf_engine_task;
 *	} RRCTX_ENG_FCT_TBL_T;
 *  @endcode
 *
 *  @li@c	pf_open_rating_obj				-Function type of openning the rating object
 *  @li@c	pf_close_rating_obj			-Function type of closing the rating object
 *  @li@c	pf_get_rating_obj_info_len		-Function type of getting the length of rating information
 *  @li@c	pf_get_rating_obj_info			-Function type of getting the rating information
 *  @li@c	pf_storage_rating_obj			-Function type of storing or cleaning the rating data.
 *  @li@c	pf_engine_task				-Function type of the task of the rating engine
 */
/*------------------------------------------------------------------*/
typedef struct _RRCTX_ENG_FCT_TBL_T
{
    x_rrctx_open_rating_obj_fct          pf_open_rating_obj;
    x_rrctx_close_rating_obj_fct         pf_close_rating_obj;
    x_rrctx_get_rating_obj_info_len_fct  pf_get_rating_obj_info_len;
    x_rrctx_get_rating_obj_info_fct      pf_get_rating_obj_info;
    x_rrctx_storage_rating_obj_fct       pf_storage_rating_obj;
    x_rrctx_engine_task_fct              pf_engine_task;
} RRCTX_ENG_FCT_TBL_T;


#endif /* _U_RRCTX_ENG_H_ */

/*----------------------------------------------------------------------------*/
/*! @} */                               /* end of groupMW_RRCTX_ENG                    */
/*----------------------------------------------------------------------------*/

