/* 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 c_hbbtv.h
 *  $RCSfile: $
 *  $Revision: #2 $
 *  $Date: 2015/12/05 $
 *  $Author: chenglu.xu $
 *
 *  @par Description: This header file declares HBBTV exported APIs.
 */
/*----------------------------------------------------------------------------*/
#ifndef _C_OPERA_HBBTV_DVB_H_
#define _C_OPERA_HBBTV_DVB_H_

/*-----------------------------------------------------------------------------
                    include files
-----------------------------------------------------------------------------*/
#include "u_common.h"
#include "u_handle.h"
#include "u_opera_hbbtv.h"
#include "u_opera_hbbtv_dvb.h"
#include "u_opera_hbbtv_common.h"
#include "u_svl.h"
#include "u_tsl.h"
#include "u_edb.h"

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

/*-----------------------------------------------------------------------------
                    functions declarations
-----------------------------------------------------------------------------*/

/*-----------------------------------------------------------------------------
 * Name: c_opera_hbbtv_dvb_get_program_rating
 *
 * Description: This function will get the program rating
 *
 * Inputs: --
 *
 * Outputs: --
 *
 * Returns:
 *        OPERA_HBBTVR_OK            The routine is successful.
 *        OPERA_HBBTVR_FAIL          The routine is fail.
 *        OPERA_HBBTVR_INV_ARG   Indicates at least one argument is invalid
 * ----------------------------------------------------------------------------*/
extern INT32 c_opera_hbbtv_dvb_get_program_rating(
            HANDLE_T    h_dvb_ctx,
            UINT16      ui2_on_id,
            UINT16      ui2_ts_id,
            UINT16      ui2_svc_id,
            UINT16      ui2_event_id,
            UINT16*     pui2_channel_rating);

/*-----------------------------------------------------------------------------
 * Name: c_opera_hbbtv_set_video_region
 *
 * Description: This function will set video source region (for opera)
 *
 * Inputs: --
 *
 * Outputs: --
 *
 * Returns:
 *        OPERA_HBBTVR_OK            The routine is successful.
 *        OPERA_HBBTVR_FAIL          The routine is fail.
 *        OPERA_HBBTVR_INV_ARG   Indicates at least one argument is invalid
 * ----------------------------------------------------------------------------*/
extern INT32 c_opera_hbbtv_set_video_region (
                HANDLE_T                     h_dvb_ctx,
                OPERA_HBBTV_VIDEO_REGION_T*  pt_src_reg,
                OPERA_HBBTV_VIDEO_REGION_T*  pt_dsp_reg);

/*-----------------------------------------------------------------------------
 * Name: c_opera_hbbtv_tune_svc_req
 *
 * Description: This function will tune to designated service (for opera)
 *
 * Inputs: --
 *
 * Outputs: --
 *
 * Returns:
 *        OPERA_HBBTVR_OK            The routine is successful.
 *        OPERA_HBBTVR_FAIL          The routine is fail.
 *        OPERA_HBBTVR_INV_ARG   Indicates at least one argument is invalid
 * ----------------------------------------------------------------------------*/
extern INT32 c_opera_hbbtv_tune_svc_req(
                HANDLE_T                     h_dvb_ctx,
                OPERA_HBBTV_TUNE_SVC_INFO_T* pt_tune_req);

extern INT32 c_opera_hbbtv_create_dsd_channel(
                                    HANDLE_T     h_dvb_ctx,
                                    UINT8 * pc_delivery_sytem_descriptor,
                                    UINT32 ui4_dsd_length,
                                    INT32 i4_svid,
                                    UINT32 *pui4_ch_id
                                    );

/*-----------------------------------------------------------------------------
 * Name: c_opera_hbbtv_dvb_get_curr_channel
 *
 * Description: This function get the current played service infomation (for opera)
 *
 * Inputs: --
 *
 * Outputs: --
 *
 * Returns:
 *        OPERA_HBBTVR_OK            The routine is successful.
 *        OPERA_HBBTVR_FAIL          The routine is fail.
 *        OPERA_HBBTVR_INV_ARG   Indicates at least one argument is invalid
 * ----------------------------------------------------------------------------*/

extern INT32 c_opera_hbbtv_dvb_get_curr_channel(
            HANDLE_T                     h_dvb_ctx,
            OPERA_HBBTV_DVB_SVC_INFO_T*  pt_svc_info);


/*-----------------------------------------------------------------------------
 * Name: c_opera_hbbtv_set_visibility
 *
 * Description: This function set the broadcast video visibility(for opera)
 *
 * Inputs: --
 *
 * Outputs: --
 *
 * Returns:
 *        OPERA_HBBTVR_OK            The routine is successful.
 *        OPERA_HBBTVR_FAIL          The routine is fail.
 *        OPERA_HBBTVR_INV_ARG   Indicates at least one argument is invalid
 * ----------------------------------------------------------------------------*/

extern INT32 c_opera_hbbtv_set_visibility(
                HANDLE_T            h_dvb_ctx,
                BOOL                b_visible,
                BOOL                b_unloaded);
/*-----------------------------------------------------------------------------
 * Name: c_opera_hbbtv_aud_mute
 *
 * Description: This function set the broadcast audio mute(for opera)
 *
 * Inputs: --
 *
 * Outputs: --
 *
 * Returns:
 *        OPERA_HBBTVR_OK            The routine is successful.
 *        OPERA_HBBTVR_FAIL          The routine is fail.
 *        OPERA_HBBTVR_INV_ARG   Indicates at least one argument is invalid
 * ----------------------------------------------------------------------------*/

extern INT32 c_opera_hbbtv_aud_mute(
                HANDLE_T            h_dvb_ctx,
                BOOL                b_visible);


/*-----------------------------------------------------------------------------
 * Name: c_opera_hbbtv_set_volume
 *
 * Description: This function set the broadcast audio volume (for opera)
 *
 * Inputs: --
 *
 * Outputs: --
 *
 * Returns:
 *        OPERA_HBBTVR_OK            The routine is successful.
 *        OPERA_HBBTVR_FAIL          The routine is fail.
 *        OPERA_HBBTVR_INV_ARG   Indicates at least one argument is invalid
 * ----------------------------------------------------------------------------*/
extern INT32 c_opera_hbbtv_set_volume(
                HANDLE_T            h_dvb_ctx,
                UINT8               ui1_volume);

/*-----------------------------------------------------------------------------
 * Name: c_opera_hbbtv_get_volume
 *
 * Description: This function set the broadcast audio volume (for opera)
 *
 * Inputs: --
 *
 * Outputs: --
 *
 * Returns:
 *        OPERA_HBBTVR_OK            The routine is successful.
 *        OPERA_HBBTVR_FAIL          The routine is fail.
 *        OPERA_HBBTVR_INV_ARG   Indicates at least one argument is invalid
 * ----------------------------------------------------------------------------*/

extern INT32 c_opera_hbbtv_get_volume(
            HANDLE_T            h_dvb_ctx,
            UINT8              *pui1_volume);

/*-----------------------------------------------------------------------------
 * Name: c_opera_hbbtv_dvb_update_sbtl_status
 *
 * Description: This function will update subtitle select status (for Comp)
 *
 * Inputs: --
 *
 * Outputs: --
 *
 * Returns:
 *        OPERA_HBBTVR_OK            The routine is successful.
 *        OPERA_HBBTVR_FAIL          The routine is fail.
 *        OPERA_HBBTVR_INV_ARG   Indicates at least one argument is invalid
 * ----------------------------------------------------------------------------*/

extern INT32 c_opera_hbbtv_dvb_update_sbtl_status(
        HANDLE_T                     h_dvb_ctx,
        OPERA_HBBTV_COMP_INTO_T*     pt_sbtl_comp,
        OPERA_HBBTV_AV_COMP_EVENT_T  e_sbtl_status);

/*-----------------------------------------------------------------------------
 * Name: c_opera_hbbtv_select_comp
 *
 * Description: This function select/unselect designated av comp (for opera)
 *
 * Inputs: --
 *
 * Outputs: --
 *
 * Returns:
 *        OPERA_HBBTVR_OK            The routine is successful.
 *        OPERA_HBBTVR_FAIL          The routine is fail.
 *        OPERA_HBBTVR_INV_ARG   Indicates at least one argument is invalid
 * ----------------------------------------------------------------------------*/

extern INT32 c_opera_hbbtv_select_comp(
                HANDLE_T                    h_dvb_ctx,
                OPERA_HBBTV_COMP_INTO_T*    pt_comp,
                BOOL                        b_select);
/*-----------------------------------------------------------------------------
 * Name: c_opera_hbbtv_dvb_svc_change_status
 *
 * Description: This function update service change status to MW HBBTV DVB (for comp)
 *
 * Inputs: --
 *
 * Outputs: --
 *
 * Returns:
 *        OPERA_HBBTVR_OK            The routine is successful.
 *        OPERA_HBBTVR_FAIL          The routine is fail.
 *        OPERA_HBBTVR_INV_ARG   Indicates at least one argument is invalid
 * ----------------------------------------------------------------------------*/

extern INT32 c_opera_hbbtv_dvb_svc_change_status(
                HANDLE_T                            h_dvb_ctx,
                OPERA_HBBTV_DVB_CHANGE_SVC_INFO_T*  pt_svc_change_info);

extern INT32 c_opera_hbbtv_delete_dsd_channel_from_svl(HANDLE_T h_dvb);
extern INT32 c_opera_hbbtv_dvb_update_av_comp_status(
                            HANDLE_T  h_dvb_ctx,
                            OPERA_HBBTV_COMP_INTO_T*     pt_comp,
                            OPERA_HBBTV_AV_COMP_EVENT_T  e_status);

/*-----------------------------------------------------------------------------
 * Name: c_opera_hbbtv_dvb_update_video_reg
 *
 * Description: This function will update video region (for Comp)
 *
 * Inputs: --
 *
 * Outputs: --
 *
 * Returns:
 *        OPERA_HBBTVR_OK            The routine is successful.
 *        OPERA_HBBTVR_FAIL          The routine is fail.
 *        OPERA_HBBTVR_INV_ARG   Indicates at least one argument is invalid
 * ----------------------------------------------------------------------------*/
extern INT32 c_opera_hbbtv_dvb_update_video_reg(HANDLE_T h_dvb_ctx);


/*-----------------------------------------------------------------------------
 * Name: c_opera_hbbtv_dvb_set_default_video_reg
 *
 * Description: This function will set video region to defalut value (for Comp)
 *
 * Inputs: --
 *
 * Outputs: --
 *
 * Returns:
 *        OPERA_HBBTVR_OK            The routine is successful.
 *        OPERA_HBBTVR_FAIL          The routine is fail.
 *        OPERA_HBBTVR_INV_ARG   Indicates at least one argument is invalid
 * ----------------------------------------------------------------------------*/

extern INT32 c_opera_hbbtv_dvb_set_default_video_reg(HANDLE_T h_dvb_ctx);

/*-----------------------------------------------------------------------------
 * Name: c_opera_hbbtv_dvb_open
 *
 * Description: This function open a dvb contex (for comp)
 *
 * Inputs: --
 *
 * Outputs: --
 *
 * Returns:
 *        OPERA_HBBTVR_OK            The routine is successful.
 *        OPERA_HBBTVR_FAIL          The routine is fail.
 *        OPERA_HBBTVR_INV_ARG   Indicates at least one argument is invalid
 * ----------------------------------------------------------------------------*/

extern INT32 c_opera_hbbtv_dvb_open(
                HANDLE_T*         ph_dvb_ctx,
                const CHAR*       ps_ctx_name,
                UINT16 ui2_svl_id);
extern INT32 c_opera_hbbtv_dvb_get_silent_channel_info(
                HANDLE_T        h_dvb_ctx,
                UINT16*         pui2_svl_rec_id,
                UINT32*         pui4_ch_id);

extern INT32 c_opera_hbbtv_send_msg_to_dvb(
                                   HANDLE_T   h_dvb_ctx,
                                   UINT16    ui2_msg_type,
                                   VOID*      data,
                                   UINT32     data_length
                                   );
/*-----------------------------------------------------------------------------
 * Name: c_opera_hbbtv_dvb_close
 *
 * Description: This function close dvb contex (for comp)
 *
 * Inputs: --
 *
 * Outputs: --
 *
 * Returns:
 *        OPERA_HBBTVR_OK            The routine is successful.
 *        OPERA_HBBTVR_FAIL          The routine is fail.
 *        OPERA_HBBTVR_INV_ARG   Indicates at least one argument is invalid
 * ----------------------------------------------------------------------------*/

extern INT32 c_opera_hbbtv_dvb_close(HANDLE_T  h_dvb_ctx);


/*-----------------------------------------------------------------------------
 * Name: c_opear_hbbtv_get_svc_num
 *
 * Description: This function get number of service in current svl list (for Opera)
 *
 * Inputs: --
 *
 * Outputs: --
 *
 * Returns:
 *        OPERA_HBBTVR_OK            The routine is successful.
 *        OPERA_HBBTVR_FAIL          The routine is fail.
 *        OPERA_HBBTVR_INV_ARG   Indicates at least one argument is invalid
 * ----------------------------------------------------------------------------*/
extern INT32 c_opera_hbbtv_get_svc_num(
                HANDLE_T    h_dvb_ctx,
                UINT16 *    pui2_num_svc);

/*-----------------------------------------------------------------------------
 * Name: c_opera_hbbtv_get_all_svc_info
 *
 * Description: This function get all service info in current svl list (for Opera)
 *
 * Inputs: --
 *
 * Outputs: --
 *
 * Returns:
 *        OPERA_HBBTVR_OK            The routine is successful.
 *        OPERA_HBBTVR_FAIL          The routine is fail.
 *        OPERA_HBBTVR_INV_ARG   Indicates at least one argument is invalid
 * ----------------------------------------------------------------------------*/

extern INT32 c_opera_hbbtv_get_all_svc_info(
            HANDLE_T                     h_dvb_ctx,
            OPERA_HBBTV_DVB_SVC_INFO_T*  pt_svc_head,
            UINT16                       ui2_svc_count);

/*-----------------------------------------------------------------------------
 * Name: c_opera_hbbtv_get_nw_num
 *
 * Description: This function get number of service in current svl list (for Opera)
 *
 * Inputs: --
 *
 * Outputs: --
 *
 * Returns:
 *        OPERA_HBBTVR_OK            The routine is successful.
 *        OPERA_HBBTVR_FAIL          The routine is fail.
 *        OPERA_HBBTVR_INV_ARG   Indicates at least one argument is invalid
 * ----------------------------------------------------------------------------*/

extern INT32 c_opera_hbbtv_get_nw_num(
            HANDLE_T    h_dvb_ctx,
            UINT16 *    pui2_nw_num);

/*-----------------------------------------------------------------------------
 * Name: c_opera_hbbtv_get_mds_auth_url
 *
 * Description: This function get all service info in current svl list (for Opera)
 *
 * Inputs: --
 *
 * Outputs: --
 *
 * Returns:
 *        OPERA_HBBTVR_OK            The routine is successful.
 *        OPERA_HBBTVR_FAIL          The routine is fail.
 *        OPERA_HBBTVR_INV_ARG   Indicates at least one argument is invalid
 * ----------------------------------------------------------------------------*/

extern INT32 c_opera_hbbtv_get_mds_auth_url(
                HANDLE_T                     h_dvb_ctx,
                UINT16                       ui2_auth_num,
                OPERA_HBBTV_DVB_AUTH_URL_T * pt_auth_head);


/*-----------------------------------------------------------------------------
 * Name: c_opera_hbbtv_get_svc_info_by_idx
 *
 * Description: This function get service info in current svl list with svc_idx (for Opera)
 *
 * Inputs: --
 *
 * Outputs: --
 *
 * Returns:
 *        OPERA_HBBTVR_OK            The routine is successful.
 *        OPERA_HBBTVR_FAIL          The routine is fail.
 *        OPERA_HBBTVR_INV_ARG   Indicates at least one argument is invalid
 * ----------------------------------------------------------------------------*/


extern INT32 c_opera_hbbtv_get_svc_info_by_idx (
                HANDLE_T                     h_dvb_ctx,
                UINT16                       ui2_idx,
                OPERA_HBBTV_DVB_SVC_INFO_T*  pt_svc_info);
/*-----------------------------------------------------------------------------
 * Name: c_opera_hbbtv_get_svc_info_by_rec_id
 *
 * Description: This function get service info in current svl list with svl_rec_id (for Opera)
 *
 * Inputs: --
 *
 * Outputs: --
 *
 * Returns:
 *        OPERA_HBBTVR_OK            The routine is successful.
 *        OPERA_HBBTVR_FAIL          The routine is fail.
 *        OPERA_HBBTVR_INV_ARG   Indicates at least one argument is invalid
 * ----------------------------------------------------------------------------*/
extern INT32 c_opera_hbbtv_get_svc_info_by_rec_id (
                HANDLE_T                     h_dvb_ctx,
                UINT16                       ui2_svl_rec_id,
                OPERA_HBBTV_DVB_SVC_INFO_T*  pt_svc_info);

/*-----------------------------------------------------------------------------
 * Name: c_opera_hbbtv_dvb_get_comp_count
 *
 * Description: This function stream component count (for Opera)
 *
 * Inputs: --
 *
 * Outputs: --
 *
 * Returns:
 *        OPERA_HBBTVR_OK            The routine is successful.
 *        OPERA_HBBTVR_FAIL          The routine is fail.
 *        OPERA_HBBTVR_INV_ARG   Indicates at least one argument is invalid
 * ----------------------------------------------------------------------------*/

extern INT32 c_opera_hbbtv_dvb_get_comp_count(
        HANDLE_T                    h_dvb_ctx,
        UINT32                      ui4_comp_mask,
        UINT16*                     pui2_comp_count);

/*-----------------------------------------------------------------------------
 * Name: c_opera_hbbtv_dvb_get_comp_list
 *
 * Description: This function get stream comp list (for Opera)
 *
 * Inputs: --
 *
 * Outputs: --
 *
 * Returns:
 *        OPERA_HBBTVR_OK            The routine is successful.
 *        OPERA_HBBTVR_FAIL          The routine is fail.
 *        OPERA_HBBTVR_INV_ARG   Indicates at least one argument is invalid
 * ----------------------------------------------------------------------------*/

extern INT32 c_opera_hbbtv_dvb_get_comp_list(
        HANDLE_T                    h_dvb_ctx,
        UINT32                      ui4_comp_mask,
        OPERA_HBBTV_COMP_INTO_T*    pt_comp_list,
        UINT16                      ui2_comp_count);


/*-----------------------------------------------------------------------------
 * Name: c_opera_hbbtv_set_resolution
 *
 * Description: This function get dvb_ctx handle (for Opera)
 *
 * Inputs: --
 *
 * Outputs: --
 *
 * Returns:
 *        OPERA_HBBTVR_OK            The routine is successful.
 *        OPERA_HBBTVR_FAIL          The routine is fail.
 *        OPERA_HBBTVR_INV_ARG   Indicates at least one argument is invalid
 * ----------------------------------------------------------------------------*/

extern INT32 c_opera_hbbtv_set_resolution(UINT32 ui4_width, UINT32 ui4_height);

/*-----------------------------------------------------------------------------
 * Name: c_opera_hbbtv_create_avcomponent
 *
 * Description: This function get stream comp list (for Opera)
 *
 * Inputs: --
 *
 * Outputs: --
 *
 * Returns:
 *        OPERA_HBBTVR_OK            The routine is successful.
 *        OPERA_HBBTVR_FAIL          The routine is fail.
 *        OPERA_HBBTVR_INV_ARG   Indicates at least one argument is invalid
 * ----------------------------------------------------------------------------*/
extern INT32 c_opera_hbbtv_create_avcomponent(HANDLE_T                 h_dvb_ctx,
                                              BRDCST_SET_STREAM_INFO_T *pt_stream_info,
                                              OPERA_HBBTV_COMP_INTO_T  *pt_comp);

/*-----------------------------------------------------------------------------
 * Name: c_opera_hbbtv_get_dvb_ctx
 *
 * Description: This function get dvb_ctx handle (for Opera)
 *
 * Inputs: --
 *
 * Outputs: --
 *
 * Returns:
 *        OPERA_HBBTVR_OK            The routine is successful.
 *        OPERA_HBBTVR_FAIL          The routine is fail.
 *        OPERA_HBBTVR_INV_ARG   Indicates at least one argument is invalid
 * ----------------------------------------------------------------------------*/

extern INT32 c_opera_hbbtv_get_dvb_ctx(HANDLE_T * ph_dvb_ctx);

/*-----------------------------------------------------------------------------
 * Name: c_hbbtv_dvb_programme_get_generic
 *
 * Description: This function close dvb contex (for comp)
 *
 * Inputs: --
 *
 * Outputs: --
 *
 * Returns:
 *        OPERA_HBBTVR_OK            The routine is successful.
 *        OPERA_HBBTVR_FAIL          The routine is fail.
 *        OPERA_HBBTVR_INV_ARG   Indicates at least one argument is invalid
 * ----------------------------------------------------------------------------*/

extern INT32 c_hbbtv_dvb_programme_get_generic(
        UINT32 ui4_channel_id,UINT16 ui2_event_id,UINT8 ui1_tag,UINT8 ui1_tag_ext,CHAR* pc_eit_desc_bufferi,UINT32* pui4_buffer_len);

/*------------------------------------------------------------------*/
/*! @brief   init EDB function.
 *
 *  @param [IN] None
 *
 *  @param [out] None.
 *
 *  @note   this interface must be invoke before getting event info using EDB
 *  @see
 *
 *  @return Return the error code.

 *  @retval  EDBR_OK - The routine was successful.
             -1      -The routine was failed.
 */

extern INT32 a_edb_client_init(VOID);

/*------------------------------------------------------------------*/
/*! @brief   Set callback function to edb.when event is update, edb will notify caller.
 *
 *  @param [in]  pf_listener self_defined notify func.
             typedef VOID (*x_edb_nfy_fct) (
                        HANDLE_T                h_edb,
                        EDB_NFY_REASON_T        e_reason,
                        VOID*                   pv_nfy_tag,
                        UINT32                  ui4_data1,
                        UINT32                  ui4_data2);
 *  @param [in]  pv_nfy_tag notify tag, can be set NULL.
 *  @param [out] None.
 *
 *  @note
 *  @see
 *
 *  @return Return the error code.
 *  @retval  EDBR_OK - The routine was successful.
             -1      -The routine was failed.
 */
extern INT32 a_edb_set_listener(x_edb_nfy_fct pf_listener,void* pv_nfy_tag);

/*------------------------------------------------------------------*/
/*! @brief   Enable or dis-able the check input function.
 *
 *  @param [in]  pt_ch_id provide channel info to edb.
                 typedef struct _EDB_CH_ID_T
                {
                    BRDCST_TYPE_T           e_brdcst_type;
                    UINT16                  ui2_svl_id;
                    UINT32                  ui4_channel_id;
                } EDB_CH_ID_T;
 *
 *  @param [out] pz_len return the size of p/f event, so you
 *
 *  @note
 *  @see
 *
 *  @return Return the error code.
 *  @retval  DTR_OK - The routine was successful.
 */
extern INT32 a_edb_get_pf_events_len( EDB_CH_ID_T* pt_ch_id,SIZE_T* pz_len);
/*------------------------------------------------------------------*/
/*! @brief   Enable or dis-able the check input function.
 *
 *  @param [in]  b_enable -  Flag to enable/disable checking of input time.
 *                                       TRUE  : Enable checking of input time.
 *                                       FALSE: Dis-able checking of input time. (Every time
 *                                                  value received are accepted.)
 *
 *  @param [out] None.
 *
 *  @note
 *  @see
 *
 *  @return Return the error code.
 *  @retval  DTR_OK - The routine was successful.
 */
extern INT32 a_edb_get_pf_events( EDB_CH_ID_T* pt_ch_id,VOID* pv_pf_events_info,SIZE_T z_len);

/*-----------------------------------------------------------------------------
 * Name: x_hbbtv_dvb_get_program_list
 *
 * Description: This function used to get specified channel programmes by start time
 *
 * Inputs: --
 *
 * Outputs: --
 *
 * Returns:
 *        OPERA_HBBTVR_OK            The routine is successful.
 *        OPERA_HBBTVR_FAIL          The routine is fail.
 *        OPERA_HBBTVR_INV_ARG   Indicates at least one argument is invalid
 * ----------------------------------------------------------------------------*/

extern INT32 c_hbbtv_dvb_get_program_list(
    UINT32                          ui4_channel_id,
    TIME_T                          t_start,
    TIME_T                          t_end,
    UINT32                          ui4_max_prog,
    UINT32 *                        ui4_num_prog,
    OPERA_HBBTV_PROGRAM_LIST_T *    t_list);

/*-----------------------------------------------------------------------------
 * Name: c_hbbtv_dvb_search_program_list
 *
 * Description: This function used to search programmes by QueryTree
 *
 * Inputs: --
 *
 * Outputs: --
 *
 * Returns:
 *        OPERA_HBBTVR_OK            The routine is successful.
 *        OPERA_HBBTVR_FAIL          The routine is fail.
 *        OPERA_HBBTVR_INV_ARG   Indicates at least one argument is invalid
 * ----------------------------------------------------------------------------*/


extern INT32 c_hbbtv_dvb_search_program_list(VOID* pui1_serial_buffer,UINT32 ui4_token);
/*-----------------------------------------------------------------------------
 * Name: c_hbbtv_dvb_programme_list_get_page
 *
 * Description: This function used to get specified page result.
 *
 * Inputs: --
 *
 * Outputs: --
 *
 * Returns:
 *        OPERA_HBBTVR_OK            The routine is successful.
 *        OPERA_HBBTVR_FAIL          The routine is fail.
 *        OPERA_HBBTVR_INV_ARG   Indicates at least one argument is invalid
 * ----------------------------------------------------------------------------*/
extern    INT32 c_opera_hbbtv_dvb_svl_update(
                                       HANDLE_T   h_dvb_ctx,
                                       VOID*      data,
                                       UINT32     data_length
                                       );


extern INT32 c_hbbtv_dvb_programme_list_get_page( UINT32                ui4_page_number,
                                           UINT32                ui4_page_size,
                                           OPERA_HBBTV_PROGRAM_LIST_T* pt_prog_list,
                                           MD_SEARCH_NOTIFY    pv_callback,
                                           VOID*               pv_tag,
                                           UINT32*             pui4_got_event_number);

/*-----------------------------------------------------------------------------
 * Name: c_hbbtv_dvb_programme_list_get_total_size
 *
 * Description: This function used to get total result size .
 *
 * Inputs: --
 *
 * Outputs: --
 *
 * Returns:
 *        OPERA_HBBTVR_OK            The routine is successful.
 *        OPERA_HBBTVR_FAIL          The routine is fail.
 *        OPERA_HBBTVR_INV_ARG   Indicates at least one argument is invalid
 * ----------------------------------------------------------------------------*/

extern INT32 c_hbbtv_dvb_programme_list_get_total_size(UINT32* pui4_total_size);


#endif




