/* 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.
 *
 *****************************************************************************/

/*------------------------------------------------------------------------------
 * Copyright (c) 2010, Mediatek Inc.
 * All rights reserved.
 *
 * Unauthorized use, practice, perform, copy, distribution, reproduction,
 * or disclosure of this information in whole or in part is prohibited.
 *----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------*/
/*! @file u_ginga.h
 *  $File: //DTV/PROD_BR/DTV_X_IDTV1501/apollo/middleware/public/ginga/u_ginga.h $
 *  $Revision: #1 $
 *  $Date: 2015/05/29 $
 *  $Author: brianpc.huang $
 *  
 *  @par Description:
 *    
 */
/*----------------------------------------------------------------------------*/
#ifndef  _U_GINGA_H_
#define  _U_GINGA_H_
/*----------------------------------------------------------------------------*/
/*! @defgroup   groupMW_GINGA
 *  @ingroup    groupMW
 *  @brief      
 *  @{
 */
/*----------------------------------------------------------------------------*/

/*-----------------------------------------------------------------------------
                    include files
-----------------------------------------------------------------------------*/
#include "u_common.h"
#include "u_iom.h"
/*-----------------------------------------------------------------------------
                    macros, defines, typedefs, enums
-----------------------------------------------------------------------------*/
/* Return code status from API */
#define GINGAR_OK                   ((INT32)    0)    /**<OK        */
#define GINGAR_INV_ARG              ((INT32) -  1)    /**<Invalid arguments        */
#define GINGAR_INV_HANDLE           ((INT32) -  2)    /**<Invalid handle        */
#define GINGAR_OUT_OF_MEMORY        ((INT32) -  3)    /**<Out of memory        */
#define GINGAR_OUT_OF_HANDLE        ((INT32) -  4)    /**<Out of handle        */
#define GINGAR_INTERNAL_ERROR       ((INT32) -  5)    /**<Internal error        */
#define GINGAR_NOT_INIT             ((INT32) -  6)    /**<Not initialized       */
#define GINGAR_ALREADY_INIT         ((INT32) -  7)    /**<Already initialized        */
#define GINGAR_INIT_FAIL            ((INT32) -  8)    /**<Failed to initialized        */
#define GINGAR_INV_STATE            ((INT32) -  9)    /**<Invalid state        */
#define GINGAR_TIMEOUT              ((INT32) - 10)    /**<Operation timeout        */
#define GINGAR_NOT_ATTACHED         ((INT32) - 11)    /**<Key code not attached        */


#define GINGA_APP_MAX_ID_LEN        (16)        /**< Size of the string buffer for the APP ID. */
#define GINGA_APP_MAX_NAME_LEN      (256)       /**< Size of the string buffer for the APP name. */

#define GINGA_MAX_RESERVED_KEY_NUM  (21)        /*number keys + color keys + navigator keys + ENTER/BACK/RETURN */

/* Ginga callbak type */
/*------------------------------------------------------------------*/
/*! @brief  Enumeration for Ginga callbak type
 *  @code
 *  typedef  enum
 *  {
 *      GINGA_CB_TYPE_APP_LIST_NFY,  
 *      GINGA_CB_TYPE_APP_STAT_NFY,       
 *      GINGA_CB_TYPE_RC_KEY_NFY,
 *      GINGA_CB_TYPE_AUDIO_SETTING_NFY,
 *      GINGA_CB_TYPE_LAST_VALID_ENTRY
 *  } GINGA_CB_TYPE_T;
 *  @endcode
 *  @li@c  GINGA_CB_TYPE_APP_LIST_NFY           - When APP list is changed.
 *  @li@c  GINGA_CB_TYPE_APP_STAT_NFY           - When APP state is changed.
 *  @li@c  GINGA_CB_TYPE_RC_KEY_NFY              - When RC key  is sent.
 *  @li@c  GINGA_CB_TYPE_AUDIO_SETTING_NFY - When audio setting need to be changed.
 *  @li@c  GINGA_CB_TYPE_NW_SVC_SELECT_NFY - When service need to be selected.
 *  @li@c  GINGA_CB_TYPE_LAST_VALID_ENTRY       - Used for counting purpose.
 */
/*------------------------------------------------------------------*/
typedef enum {
    GINGA_CB_TYPE_APP_LIST_NFY,
    GINGA_CB_TYPE_APP_STAT_NFY,
    GINGA_CB_TYPE_RC_KEY_NFY,
    GINGA_CB_TYPE_AUDIO_SETTING_NFY,
    GINGA_CB_TYPE_NW_SVC_SELECT_NFY,
    GINGA_CB_TYPE_TV_VID_RESIZE_NFY,
    GINGA_CB_TYPE_LAST_VALID_ENTRY,
    GINGA_CB_TYPE_SEND_NW_EVENT_REQ
}   GINGA_CB_TYPE_T;

/*------------------------------------------------------------------*/
/*! @brief  Enumeration for Ginga audio setting type
 *  @code
 *  typedef enum {
 *      GINGA_AV_AUD_CFG_TYPE_VOLUME,
 *      GINGA_AV_AUD_CFG_TYPE_BALANCE,
 *      GINGA_AV_AUD_CFG_TYPE_BASS,
 *      GINGA_AV_AUD_CFG_TYPE_TREBLE,
 *      GINGA_AV_AUD_CFG_TYPE_MUTE
 *  }   GINGA_AV_AUD_CFG_TYPE_T;
 *  @endcode
 *  @li@c  GINGA_AV_AUD_CFG_TYPE_VOLUME      - Set or recieve audio volume
 *  @li@c  GINGA_AV_AUD_CFG_TYPE_BALANCE     - Set or recieve audio balance
 *  @li@c  GINGA_AV_AUD_CFG_TYPE_BASS        - Set or recieve audio bass
 *  @li@c  GINGA_AV_AUD_CFG_TYPE_TREBLE      - Set or recieve audio treble
 *  @li@c  GINGA_AV_AUD_CFG_TYPE_MUTE        - Set audio mute or recieve audio mute status
 */
/*------------------------------------------------------------------*/
typedef enum {
    GINGA_AV_AUD_CFG_TYPE_VOLUME,
    GINGA_AV_AUD_CFG_TYPE_BALANCE,
    GINGA_AV_AUD_CFG_TYPE_BASS,
    GINGA_AV_AUD_CFG_TYPE_TREBLE,
    GINGA_AV_AUD_CFG_TYPE_SHOW_MUTE_OSD,
    GINGA_AV_AUD_CFG_TYPE_SHOW_UNMUTE_OSD,
    GINGA_AV_AUD_CFG_TYPE_SHOW_VOLUME_OSD,
    GINGA_AV_AUD_CFG_TYPE_RESTORE,
    GINGA_AV_AUD_CFG_TYPE_MUTE,
}   GINGA_AV_AUD_CFG_TYPE_T;

/*------------------------------------------------------------------*/
/*! @brief  Ginga audio setting structure
 *  @code
 *  typedef struct {
 *      GINGA_AV_AUD_CFG_TYPE_T     t_cfg_type;
 *      UINT8                       ui1_value;
 *  }   GINGA_AV_AUD_CFG_T;
 *  @endcode
 *  @li@c  t_cfg_type               - Audio setting type.
 *  @li@c  ui1_value                - Audio setting value, range: 0~100
 */
/*------------------------------------------------------------------*/
typedef struct {
    GINGA_AV_AUD_CFG_TYPE_T         t_cfg_type;
    INT8							i1_value;  /*range: 0~100*/
}   GINGA_AV_AUD_CFG_T;


/*------------------------------------------------------------------*/
/*! @brief  Ginga network service select structure
 *  @code
 *  typedef struct {
 *      UINT16          ui2_svl_id;
 *      UINT16          ui2_svl_rec_id;
 *  }   GINGA_NW_SVC_SELECT_T;
 *  @endcode
 *  @li@c  ui2_svl_id               - Svl id of new service .
 *  @li@c  ui2_svl_rec_id           - Svl record id of new service .
 */
/*------------------------------------------------------------------*/
typedef struct {
    UINT16                          ui2_svl_id;
    UINT16                          ui2_svl_rec_id;
}   GINGA_NW_SVC_SELECT_T;


/* Ginga middleware states */
/*------------------------------------------------------------------*/
/*!  @brief  Enumeration for Ginga middleware states
 *  @code
 *  typedef  enum
 *  {
 *      GINGA_MW_STATE_UNLOADED     = 0,
 *      GINGA_MW_STATE_LOADED        = 1, 
 *      GINGA_MW_STATE_UNINITIALIZED = 1,
 *      GINGA_MW_STATE_INITIALIZED   = 2,
 *      GINGA_MW_STATE_VISIBLE       = 2,
 *      GINGA_MW_STATE_HIDDEN        = 3
 *  } GINGA_MW_STATE_T;
 *  @endcode
 *  @li@c  GINGA_MW_STATE_UNLOADED      - The Ginga middleware was not loaded yet.
 *  @li@c  GINGA_MW_STATE_LOADED        - The Ginga middleware is loaded and in stand-by mode.
 *  @li@c  GINGA_MW_STATE_UNINITIALIZED - Same as GINGA_MW_STATE_LOADED.
 *  @li@c  GINGA_MW_STATE_INITIALIZED   - The Ginga middleware is initialized and in ready mode.
 *  @li@c  GINGA_MW_STATE_VISIBLE       - Same as GINGA_MW_STATE_INITIALIZED .
 *  @li@c  GINGA_MW_STATE_HIDDEN        - The Ginga middleware is hidden and lost the UI focus.
 */
/*------------------------------------------------------------------*/
typedef enum {
    GINGA_MW_STATE_UNLOADED      = 0,
    GINGA_MW_STATE_LOADED        = 1, /* Same as  GINGA_MW_STATE_UNINITIALIZED */
    GINGA_MW_STATE_UNINITIALIZED = 1,
    GINGA_MW_STATE_INITIALIZED   = 2, /* Same as  GINGA_MW_STATE_VISIBLE */
    GINGA_MW_STATE_VISIBLE       = 2,
    GINGA_MW_STATE_HIDDEN        = 3
}   GINGA_MW_STATE_T;


/* Ginga APP list nitification states*/
/*------------------------------------------------------------------*/
/*!  @brief  Enumeration for Ginga APP list states
 *  @code
 *  typedef  enum
 *  {
 *      GINGA_APP_LIST_NOT_READY,  
 *      GINGA_APP_LIST_READY,    
 *  } GINGA_APP_LIST_STATE_T;
 *  @endcode
 *  @li@c  GINGA_APP_LIST_NOT_READY     - The Ginga APP list is not ready.
 *  @li@c  GINGA_APP_LIST_READY         - The Ginga APP list is ready.
 */
/*------------------------------------------------------------------*/
typedef enum {
    GINGA_APP_LIST_NOT_READY,
    GINGA_APP_LIST_READY
}   GINGA_APP_LIST_STATE_T;


/* Ginga APP states */
/*------------------------------------------------------------------*/
/*!  @brief  Enumeration for Ginga APP states
 *  @code
 *  typedef  enum
 *  {
 *      GINGA_APP_UNINIT = 1,  
 *      GINGA_APP_READY,       
 *      GINGA_APP_STARTED        
 *  } GINGA_APP_STATE_T;
 *  @endcode
 *  @li@c  GINGA_APP_UNINIT             - The Ginga APP was not initialized yet.
 *  @li@c  GINGA_APP_READY              - The Ginga APP is ready to start.
 *  @li@c  GINGA_APP_STARTED            - The Ginga APP has been started .
 */
/*------------------------------------------------------------------*/
typedef enum {
    GINGA_APP_UNINIT = 1,
    GINGA_APP_READY,
    GINGA_APP_STARTED,
    GINGA_APP_DESTROYED
}   GINGA_APP_STATE_T;


/* Ginga APP control code */
/*------------------------------------------------------------------*/
/*!  @brief  Enumeration for broadcaster control code of Ginga APP
 *  @code
 *  typedef  enum
 *  {
 *      GINGA_APP_CC_AUTOSTART = 1,  
 *      GINGA_APP_CC_PRESENT,       
 *      GINGA_APP_CC_DESTROY,
 *      GINGA_APP_CC_KILL,
 *      GINGA_APP_CC_REMOTE,
 *      GINGA_APP_CC_UNBOUND
 *  } GINGA_APP_CTRL_CODE_T;
 *  @endcode
 *  @li@c  GINGA_APP_CC_AUTOSTART   - Set Ginga application auto start.
 *  @li@c  GINGA_APP_CC_PRESENT     - Show the Ginga application.
 *  @li@c  GINGA_APP_CC_DESTROY     - Destroy the Ginga application.
 *  @li@c  GINGA_APP_CC_KILL        - Kill the Ginga application.
 *  @li@c  GINGA_APP_CC_REMOTE      - Reserved for future use.
 *  @li@c  GINGA_APP_CC_UNBOUND     - Reserved for future use.
 */
/*------------------------------------------------------------------*/
typedef enum {
    GINGA_APP_CC_UNKNOWN = 0,
    GINGA_APP_CC_AUTOSTART = 1,
    GINGA_APP_CC_PRESENT,
    GINGA_APP_CC_DESTROY,
    GINGA_APP_CC_KILL,
    GINGA_APP_CC_REMOTE,
    GINGA_APP_CC_UNBOUND
}   GINGA_APP_CTRL_CODE_T;


/*------------------------------------------------------------------*/
/*! @brief  Structure for Ginga APP info.
 *  @code
 *  typedef struct _GINGA_APP_INFO_T{
 *      CHAR                        s_id[GINGA_APP_MAX_ID_LEN+1];      
 *      CHAR                        s_name[GINGA_APP_MAX_NAME_LEN+1];    
 *      UTF16_T                     w2s_name[GINGA_APP_MAX_NAME_LEN+1];
 *      GINGA_APP_CTRL_CODE_T       e_ctrl_code;
 *      BOOL                        b_svc_bounded;
 *  } GINGA_APP_INFO_T;
 *  @endcode
 *  @li@c  s_id                     - Ginga APP ID.
 *  @li@c  s_name                   - Ginga APP name.
 *  @li@c  w2s_name                 - Ginga APP name in UTF-16.
 *  @li@c  e_ctrl_code              - Ginga APP broadcaster control code.
 *  @li@c  b_svc_bounded            - Whether Ginga APP is serviced bounded.
 */
/*------------------------------------------------------------------*/
typedef struct _GINGA_APP_INFO_T {
    CHAR                            s_id[GINGA_APP_MAX_ID_LEN+1];
    CHAR                            s_name[GINGA_APP_MAX_NAME_LEN+1];
    UTF16_T                         w2s_name[GINGA_APP_MAX_NAME_LEN+1];
    GINGA_APP_CTRL_CODE_T           e_ctrl_code;
    BOOL                            b_svc_bounded;
    BOOL                            b_user_visible;
}   GINGA_APP_INFO_T;



//typedef UINT32 GINGA_EVENT_CODE_T; /**< Typedef for the Ginga event code */

/*Ginga network event code*/
/*------------------------------------------------------------------*/
/*! @brief  Enumeration for Ginga event code
 *  @code
 *  typedef enum {
 *      GINGA_NW_EVT_TS_SELECTED                    = 1,            
 *      GINGA_NW_EVT_TS_UNSELECTED                  = 2,            
 *      GINGA_NW_EVT_TS_SELECTION_ERROR             = 3,            
 *      GINGA_NW_EVT_TS_LIST_CHANGED                = 4,            
 *      GINGA_NW_EVT_SERVICE_SELECTED               = 5,            
 *      GINGA_NW_EVT_SERVICE_UNSELECTED             = 6,           
 *      GINGA_NW_EVT_SERVICE_COMPONENT_SELECTED     = 7,
 *      GINGA_NW_EVT_SERVICE_COMPONENT_UNSELECTED   = 8,
 *      GINGA_NW_EVT_SCANNING_STATUS                = 9,
 *  }   GINGA_EVENT_CODE_T;
 *  @endcode
 *  @li@c  GINGA_NW_EVT_TS_SELECTED                 - TS has been selected
 *  @li@c  GINGA_NW_EVT_TS_UNSELECTED               - TS has been unselected
 *  @li@c  GINGA_NW_EVT_TS_SELECTION_ERROR          - Select TS error
 *  @li@c  GINGA_NW_EVT_TS_LIST_CHANGED             - TS list changed
 *  @li@c  GINGA_NW_EVT_SERVICE_SELECTED            - Service has been selected
 *  @li@c  GINGA_NW_EVT_SERVICE_UNSELECTED          - Service has been unselected
 *  @li@c  GINGA_NW_EVT_SERVICE_COMPONENT_SELECTED  - Component has been selected
 *  @li@c  GINGA_NW_EVT_SERVICE_COMPONENT_UNSELECTED- Component has been unselected
 *  @li@c  GINGA_NW_EVT_SCANNING_STATUS             - TV doing the channel scan now
 */
/*------------------------------------------------------------------*/
typedef enum {
    GINGA_NW_EVT_TS_SELECTED                    = 1,            
    GINGA_NW_EVT_TS_UNSELECTED                  = 2,            
    GINGA_NW_EVT_TS_SELECTION_ERROR             = 3,            
    GINGA_NW_EVT_TS_LIST_CHANGED                = 4,            
    GINGA_NW_EVT_SERVICE_SELECTED               = 5,            
    GINGA_NW_EVT_SERVICE_UNSELECTED             = 6,           
    GINGA_NW_EVT_SERVICE_COMPONENT_SELECTED     = 7,
    GINGA_NW_EVT_SERVICE_COMPONENT_UNSELECTED   = 8,
    GINGA_NW_EVT_SCANNING_STATUS                = 9,
}   GINGA_EVENT_CODE_T;

/*------------------------------------------------------------------*/
/*! @brief  Enumeration for Ginga Key Code
 *  @code
 *  typedef enum {
 *      GINGA_KEY_ANY        = -2,
 *      GINGA_KEY_UNKNOWN,
 *      GINGA_KEY_0, 
 *      GINGA_KEY_1, 
 *      GINGA_KEY_2, 
 *      GINGA_KEY_3, 
 *      GINGA_KEY_4,
 *      GINGA_KEY_5,    
 *      GINGA_KEY_6,    
 *      GINGA_KEY_7,    
 *      GINGA_KEY_8,    
 *      GINGA_KEY_9,
 *  
 *      // NAVIGATION KEYS (CURSOR)
 *      GINGA_KEY_DOWN, 
 *      GINGA_KEY_LEFT, 
 *      GINGA_KEY_RIGHT, 
 *      GINGA_KEY_UP, 
 *  
 *      // NAVIGATION KEYS (STATE)
 *      GINGA_KEY_ENTER,    
 *      GINGA_KEY_BACK, 
 *      GINGA_KEY_EXIT,
 *  
 *      // COLOR KEYS
 *      GINGA_KEY_RED, 
 *      GINGA_KEY_GREEN, 
 *      GINGA_KEY_YELLOW, 
 *      GINGA_KEY_BLUE,
 *  
 *      // PHONE KEYS
 *      GINGA_KEY_ASTERISK, 
 *      GINGA_KEY_SHARP,
 *  
 *      // ZAPPER KEYS
 *      GINGA_KEY_MENU, 
 *      GINGA_KEY_INFO, 
 *      GINGA_KEY_GUIDE,
 *      GINGA_KEY_VOLUME_DOWN, 
 *      GINGA_KEY_VOLUME_UP,
 *      GINGA_KEY_CHANNEL_DOWN, 
 *      GINGA_KEY_CHANNEL_UP,
 *  
 *      // PVR KEYS
 *      GINGA_KEY_REWIND, 
 *      GINGA_KEY_STOP, 
 *      GINGA_KEY_EJECT,
 *      GINGA_KEY_PLAY, 
 *      GINGA_KEY_RECORD,   
 *      GINGA_KEY_PAUSE,
 *  
 *      // POWER KEY
 *      GINGA_KEY_POWER,
 *      // "SC" KEY - extra functionality that may exist on some receivers 
 *  
 *      GINGA_KEY_SC,
 *      // ENUMERATION END
 *      GINGA_KEY_LAST_INDEX,
 *      GINGA_KEY_SCAN
 *  } GINGA_KEY_CODE_T ;
 *  @endcode
 *  @li@c  GINGA_KEY_ANY            - Any key. 
 *  @li@c  GINGA_KEY_UNKNOWN        - Unkonwn key
 *  @li@c  GINGA_KEY_0              - Numberic key 0
 *  @li@c  GINGA_KEY_1              - Numberic key 1
 *  @li@c  GINGA_KEY_2              - Numberic key 2
 *  @li@c  GINGA_KEY_3              - Numberic key 3
 *  @li@c  GINGA_KEY_4              - Numberic key 4
 *  @li@c  GINGA_KEY_5              - Numberic key 5
 *  @li@c  GINGA_KEY_6              - Numberic key 6
 *  @li@c  GINGA_KEY_7              - Numberic key 7
 *  @li@c  GINGA_KEY_8              - Numberic key 8
 *  @li@c  GINGA_KEY_9              - Numberic key 9
 *  @li@c  GINGA_KEY_DOWN           - Navigation cursor key down
 *  @li@c  GINGA_KEY_LEFT           - Navigation cursor key left
 *  @li@c  GINGA_KEY_RIGHT          - Navigation cursor key right
 *  @li@c  GINGA_KEY_UP             - Navigation cursor key up
 *  @li@c  GINGA_KEY_ENTER          - Navigation state key enter
 *  @li@c  GINGA_KEY_BACK           - Navigation state key back
 *  @li@c  GINGA_KEY_EXIT           - Navigation state key exit
 *  @li@c  GINGA_KEY_RED            - Color key red
 *  @li@c  GINGA_KEY_GREEN          - Color key green
 *  @li@c  GINGA_KEY_YELLOW         - Color key yello
 *  @li@c  GINGA_KEY_BLUE           - Color key blue
 *  @li@c  GINGA_KEY_ASTERISK       - Phone key asterisk
 *  @li@c  GINGA_KEY_SHARP          - Phone key sharp
 *  @li@c  GINGA_KEY_MENU           - Zapper key menu
 *  @li@c  GINGA_KEY_INFO           - Zapper key info
 *  @li@c  GINGA_KEY_GUIDE          - Zapper key EPG/Guide
 *  @li@c  GINGA_KEY_VOL_DOWN       - Zapper key volume down
 *  @li@c  GINGA_KEY_VOL_UP         - Zapper key volume up
 *  @li@c  GINGA_KEY_CH_DOWN        - Zapper key channel down
 *  @li@c  GINGA_KEY_CH_UP          - Zapper key channel up
 *  @li@c  GINGA_KEY_REWIND         - PVR key rewind
 *  @li@c  GINGA_KEY_STOP           - PVR key stop
 *  @li@c  GINGA_KEY_EJECT          - PVR key eject
 *  @li@c  GINGA_KEY_PLAY           - PVR key play
 *  @li@c  GINGA_KEY_RECORD         - PVR key record
 *  @li@c  GINGA_KEY_PAUSE          - PVR key pause
 *  @li@c  GINGA_KEY_POWER          - Power key
 *  @li@c  GINGA_KEY_SC             - Sticker Center Key
 *  @li@c  GINGA_KEY_SCAN           - Scan Key
 *  @li@c  GINGA_KEY_LAST_INDEX     - Last Key index
 */
/*------------------------------------------------------------------*/
typedef enum {
	GINGA_KEY_ANY        = -2,
	GINGA_KEY_UNKNOWN,
	GINGA_KEY_0,            // 0
	GINGA_KEY_1,            // 1
	GINGA_KEY_2,            // 2
	GINGA_KEY_3,            // 3
	GINGA_KEY_4,            // 4
	GINGA_KEY_5,	        // 5
	GINGA_KEY_6,	        // 6
	GINGA_KEY_7,	        // 7
	GINGA_KEY_8,	        // 8
	GINGA_KEY_9,            // 9

    // NAVIGATION KEYS (CURSOR)
	GINGA_KEY_DOWN,         // 10
	GINGA_KEY_LEFT,         // 11
	GINGA_KEY_RIGHT,        // 12
	GINGA_KEY_UP,           // 13

    // NAVIGATION KEYS (STATE)
	GINGA_KEY_ENTER,	    // 14
	GINGA_KEY_BACK,         // 15
	GINGA_KEY_EXIT,         // 16

    // COLOR KEYS
	GINGA_KEY_RED,          // 17
	GINGA_KEY_GREEN,        // 18
	GINGA_KEY_YELLOW,       // 19
	GINGA_KEY_BLUE,         // 20

    // PHONE KEYS
	GINGA_KEY_ASTERISK,     // 21
	GINGA_KEY_SHARP,        // 22
    // ZAPPER KEYS

	GINGA_KEY_MENU,         // 23
	GINGA_KEY_INFO,         // 24
	GINGA_KEY_GUIDE,        // 25
	GINGA_KEY_VOL_DOWN,     // 26
	GINGA_KEY_VOL_UP,       // 27
	GINGA_KEY_CH_DOWN,      // 28
	GINGA_KEY_CH_UP,        // 29

    // PVR KEYS
	GINGA_KEY_REWIND,       // 30
	GINGA_KEY_STOP,	        // 31
	GINGA_KEY_EJECT,        // 32
	GINGA_KEY_PLAY,         // 33
	GINGA_KEY_RECORD,	    // 34
	GINGA_KEY_PAUSE,        // 35

    // POWER KEY
	GINGA_KEY_POWER,        // 36
	// "SC" KEY - extra functionality that may exist on some receivers 
    GINGA_KEY_SC,           // 37
	// ENUMERATION END
	GINGA_KEY_LAST_INDEX,   // 38
    GINGA_KEY_SCAN          // 39
} GINGA_KEY_CODE_T ;


typedef enum {
    GINGA_SC_EVT_LOADED = 0,
    GINGA_SC_EVT_UNLOADED ,
    GINGA_SC_EVT_GINGA_APP_LAUNCH       //StickerCenter exit and launching Ginga application
}GINGA_SC_STATE_EVT_T;

typedef enum{
    GINGA_CNRY_BRZ = 0,
    GINGA_CNRY_AGR,
}GINGA_COUNTRY_CODE_T;

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

/*------------------------------------------------------------------*/
/*! @brief  This function is called by the Giaga APP list manager to notify the
 *          state changes of the Giaga APP list.
 *  @param  [in]  e_cond            - The Ginga APP list state.
 *  @param  [in]  ui4_app_num       - The number of APPs in APP list.
 *  @param  [in]  pt_app_list       - The infos of APPs in APP list.
 *  @param  [in]  pv_tag            - The private tag specified by the client
 *  @return None
 */
/*------------------------------------------------------------------*/
typedef VOID (*x_ginga_app_list_nfy_fct) (
        GINGA_APP_LIST_STATE_T      e_cond,
        UINT32                      ui4_app_num,
        GINGA_APP_INFO_T*           pt_app_list,
        VOID*                       pv_tag);

/*------------------------------------------------------------------*/
/*! @brief  This function is called by the Giaga APP list manager to notify the
 *          state changes of a Giaga APP.
 *  @param  [in]  s_app_id          - The Ginga APP name.
 *  @param  [in]  e_cond            - The Ginga APP state.
 *  @param  [in]  pv_tag            - The private tag specified by the client
 *  @return None
 */
/*------------------------------------------------------------------*/
typedef VOID (*x_ginga_app_stat_nfy_fct) (
        const CHAR*                 s_app_id,
        GINGA_APP_STATE_T           e_cond,
        VOID*                       pv_tag);

/*------------------------------------------------------------------*/
/*! @brief  This function is called by the ginga mw to tell the current state.
 *  @param  [in]  b_ok              - Indicates if the mw control is successful
 *  @param  [in]  e_cond            - The Ginga MW state.
 *  @param  [in]  pv_tag            - The private tag specified by the client
 *  @return None
 */
/*------------------------------------------------------------------*/
typedef VOID (*x_ginga_eng_stat_nfy_fct) (
        BOOL                        b_ok,
        GINGA_MW_STATE_T            e_cond,
        VOID*                       pv_tag);

/*------------------------------------------------------------------*/
/*! @brief  This function is called by the audio player to notify the audio 
 *      configuration change message.
 *  @param  [in]  pt_aud_cfg        - The audio config to be changed.
 *  @param  [in]  pv_tag            - The private tag specified by the client
 *  @return None
 */
/*------------------------------------------------------------------*/
typedef VOID (*x_ginga_av_aud_cfg_nfy_fct) (
        GINGA_AV_AUD_CFG_T*         pt_aud_cfg,
        VOID*                       pv_tag);

/*------------------------------------------------------------------*/
/*! @brief  This function is called by the network manager to notify the transport stream change.
 *  @param  [in]  pt_audio_setting  - The audio setting to be changed.
 *  @param  [in]  pv_tag            - The private tag specified by the client
 *  @return None
 */
/*------------------------------------------------------------------*/
typedef VOID (*x_ginga_svc_change_nfy_fct) (
        GINGA_NW_SVC_SELECT_T*      pt_nw_svc_select,
        VOID*                       pv_tag);

/*------------------------------------------------------------------*/
/*! @brief  This function is called by when tv video size is changed after ginga started.
 *  @param  [in]  pv_tag            - The private tag specified by the client
 *  @return None
 */
/*------------------------------------------------------------------*/
typedef VOID (*x_ginga_tv_vid_resize_nfy_fct) (VOID* pv_tag);


/*------------------------------------------------------------------*/
/*! @brief  This function is for StickerCenter, called after OTT stopped and  to resume main TV .
 *  @param  [in]  pv_tag            - The private tag specified by the client
 *  @return None
 */
/*------------------------------------------------------------------*/
typedef INT32 (*x_ginga_resume_main_tv_nfy_fct)(VOID* pv_tag);


/*------------------------------------------------------------------*/
/*! @brief  This function is for StickerCenter, called when OTT start and stop.
 *    @param  [in]  pv_tag            - The private tag specified by the client
 *    @return None
 */
/*------------------------------------------------------------------*/
typedef INT32 (*x_ginga_ott_status_nfy_fct)(BOOL b_start, VOID* pv_tag);


typedef INT32 (*x_ginga_sc_status_nfy_fct)(GINGA_SC_STATE_EVT_T e_state, VOID* pv_tag);


/*------------------------------------------------------------------*/
/* Ginga Engine function table                                      */
/*------------------------------------------------------------------*/

/*------------------------------------------------------------------*/
/*! @brief  This API is called by x_ginga_load to load the Ginga middleware
 *  @return Return the error code
 *  @retval GINGAR_OK               - Load the Ginga middleware successfully.
 *  @retval GINGAR_INTERNAL_ERROR   - Internal error occurs.
 */
/*------------------------------------------------------------------*/
typedef INT32 (*x_ginga_eng_load)(VOID);


/*------------------------------------------------------------------*/
/*! @brief  This API is called by x_ginga_init to initialize the Ginga middleware
 *  @return Return the error code
 *  @retval GINGAR_OK               - Initialize the Ginga middleware successfully.
 *  @retval GINGAR_INTERNAL_ERROR   - Internal error occurs.
 */
/*------------------------------------------------------------------*/
typedef INT32 (*x_ginga_eng_init)(VOID);


/*------------------------------------------------------------------*/
/*! @brief  This API is called by x_ginga_activate to active the Ginga middleware
 *  @return Return the error code
 *  @retval GINGAR_OK               - Active the ginga middleware successfully.
 *  @retval GINGAR_INTERNAL_ERROR   - Internal error occurs.
 */
/*------------------------------------------------------------------*/
typedef INT32 (*x_ginga_eng_activate)(VOID);


/*------------------------------------------------------------------*/
/*! @brief  This API is called by x_ginga_deactivate to deactive the Ginga middleware
 *  @return Return the error code
 *  @retval GINGAR_OK               - Deactive the ginga middleware successfully.
 *  @retval GINGAR_INTERNAL_ERROR   - Internal error occurs.
 */
/*------------------------------------------------------------------*/
typedef INT32 (*x_ginga_eng_deactivate)(VOID);


/*------------------------------------------------------------------*/
/*! @brief  This API is called by x_ginga_uninit to uninitialize Ginga middleware
 *  @return Return the error code
 *  @retval GINGAR_OK               - Uninitialize the ginga middleware successfully.
 *  @retval GINGAR_INTERNAL_ERROR   - Internal error occurs.
 */
/*------------------------------------------------------------------*/
typedef INT32 (*x_ginga_eng_uninit)(VOID);


/*------------------------------------------------------------------*/
/*! @brief  This API is called by x_ginga_unload to unload Ginga middleware
 *  @return Return the error code
 *  @retval GINGAR_OK               - Unload the ginga middleware successfully.
 *  @retval GINGAR_INTERNAL_ERROR   - Internal error occurs.
 */
/*------------------------------------------------------------------*/
typedef INT32 (*x_ginga_eng_unload)(VOID);

typedef INT32 (*x_ginga_eng_enable_app)(VOID);

typedef INT32 (*x_ginga_eng_disble_app)(VOID);

typedef INT32 (*x_ginga_eng_sc_set_visible)(BOOL b_visible);

typedef INT32 (*x_ginga_eng_sc_reg_status_cb)(
            x_ginga_sc_status_nfy_fct  pf_nfy,
            VOID*                      pv_tag);






/*------------------------------------------------------------------*/
/*! @brief  This API is called by x_ginga_get_status to get the status of Ginga middleware
 *  @return Return the status of Ginga middleware
 *  @retval GINGA_STATE_NOT_INIT    - The Ginga middleware was not initialized yet.
 *  @retval GINGA_STATE_HIDDEN      - The Ginga middleware is in stand-by mode.
 *  @retval GINGA_STATE_VISIBLE     - The Ginga middleware is running and has the "focus"
 */
/*------------------------------------------------------------------*/
typedef GINGA_MW_STATE_T (*x_ginga_eng_get_state)(VOID);


/*------------------------------------------------------------------*/
/*! @brief  This API is called by x_ginga_get_app_list to get the Ginga APPs' info list.  
 *  @param  [out]  pui4_app_num     - Number of APPs in APP list .
 *  @param  [out]  ppt_app_list     - Ginga APPs' info list.
 *  @return Return the error code
 *  @retval GINGAR_OK               - Get APP list successfully.
 *  @retval GINGAR_INV_ARG          - Invalid argument.
 */
/*------------------------------------------------------------------*/
typedef INT32 (*x_ginga_eng_get_app_list)(
        UINT32*                         pui4_app_num,
        GINGA_APP_INFO_T**              ppt_app_list);


/*------------------------------------------------------------------*/
/*! @brief  This API is called by x_ginga_start_app to start a Ginga APP.  
 *  @param  [in]  s_app_id          - Specify the Ginga APP's ID .
 *  @param  [in]  b_sync            - Indicates if this is a synchronous operation.
 *  @return Return the error code
 *  @retval GINGAR_OK               - Start the Ginga APP successfully.
 *  @retval GINGAR_INV_ARG          - Invalidate argument.
 *  @retval GINGAR_INV_STATE        - Already started or already in starting state.
 *  @retval GINGAR_OUT_OF_MEMORY    - Out of memory.
 *  @retval GINGAR_TIMEOUT          - Time out when start in synchronized mode.
 *  @retval GINGAR_INTERNAL_ERROR   - Internal error. 
 */
/*------------------------------------------------------------------*/
typedef INT32 (*x_ginga_eng_start_app)(const CHAR* s_app_id, BOOL b_sync);


/*------------------------------------------------------------------*/
/*! @brief  This API is called by x_ginga_stop_app to stop a Ginga APP.  
 *  @param  [in]  s_app_id          - Specify the Ginga APP's ID .
 *  @param  [in]  b_sync            - Indicates if this is a synchronous operation.
 *  @return Return the error code
 *  @retval GINGAR_OK               - Stop the Ginga APP successfully.
 *  @retval GINGAR_INV_ARG          - Invalidate argument.
 *  @retval GINGAR_INV_STATE        - Already stopped or already in stopping state.
 *  @retval GINGAR_OUT_OF_MEMORY    - Out of memory.
 *  @retval GINGAR_TIMEOUT          - Time out when stop in synchronized mode.
 *  @retval GINGAR_INTERNAL_ERROR   - Internal error. 
 */
/*------------------------------------------------------------------*/
typedef INT32 (*x_ginga_eng_stop_app) (const CHAR* s_app_id, BOOL b_sync);


/*------------------------------------------------------------------*/
/*! @brief  This API is called by x_ginga_set_auto_start to enable / disable
 *          auto-starting application.
 *  @param  [in]  b_enable          - Indicates if auto-starting is allowed.
 *  @return Return the error code
 *  @retval GINGAR_OK               - Set auto start successfully.
 *  @retval GINGAR_NOT_INIT         - Ginga engine not initialized yet.
 *  @retval GINGAR_INTERNAL_ERROR   - Internal error. 
 */
/*------------------------------------------------------------------*/
typedef INT32 (*x_ginga_eng_ignore_brdcstr_ctrl)(BOOL b_ignore);

/*------------------------------------------------------------------*/
/*! @brief  This API is called by x_ginga_set_app_list_cb to registe a callback of Ginga APP list changes.  
 *  @param  [in]  pf_nfy            - Notification function provided by the caller,
 *                                    to notify that the Ginga APP list has been changed .
 *  @param  [in]  pv_tag            - Private tag provided by the caller.  
 *                                    This tag is passed to the caller's notification function..
 *  @return Return the error code
 *  @retval GINGAR_OK               - Register the callback successfully.
 *  @retval GINGAR_OUT_OF_MEMORY    - Out of memory.
 */
/*------------------------------------------------------------------*/
typedef INT32 (*x_ginga_eng_reg_app_list_cb)(
        x_ginga_app_list_nfy_fct    pf_nfy,
        VOID*                       pv_tag);


/*------------------------------------------------------------------*/
/*! @brief  This API called by x_ginga_set_app_stat_cb to registe a callback of a Ginga APP state changes.  
 *  @param  [in]  pf_nfy            - Notification function provided by the caller,
 *                                    to notify that a Ginga APP state has been changed .
 *  @param  [in]  pv_tag            - Private tag provided by the caller.  
 *                                    This tag is passed to the caller's notification function .
 *  @return Return the error code
 *  @retval GINGAR_OK               - Register the callback successfully.
 *  @retval GINGAR_OUT_OF_MEMORY    - Out of memory.
 */
/*------------------------------------------------------------------*/
typedef INT32 (*x_ginga_eng_reg_app_stat_cb)(
        x_ginga_app_stat_nfy_fct    pf_nfy,
        VOID*                       pv_tag);

/*------------------------------------------------------------------*/
/*! @brief  This API is called by x_ginga_push_key_event to send a key event to Ginga middleware.  
 *  @param  [in]  e_key             - The key event code to send .
 *  @param  [in]  ui4_key_code      - The key code(or symbol) get from DirectFB .
 *  @param  [in]  e_cond            - The key event condition , key up or key down.
 *  @return Return the error code
 *  @retval GINGAR_OK               - Push key event successfully.
 *  @retval GINGAR_NOT_ATTACHED     - The key code is not attached to Ginga middleware.
 *                                    It means that Ginga middleware no longer requires 
 *                                    to be notified about this key
 *  @retval GINGAR_INV_STATE        - The Ginga middleware is not in visible state.
 *  @retval GINGAR_INV_ARG          - Invalide argument.
 */
/*------------------------------------------------------------------*/
typedef INT32 (*x_ginga_eng_send_key) (GINGA_KEY_CODE_T e_key, UINT32 ui4_key_code ,IOM_NFY_COND_T e_cond);

typedef INT32 (*x_ginga_eng_get_reserved_key) (UINT32* pui4_reserved_key, UINT8* pui1_key_num);

typedef INT32 (*x_ginga_attached_key_nfy_fct)(VOID* pv_tag);

/*------------------------------------------------------------------*/
/*! @brief  This API is called by x_ginga_push_network_event to send networt event to Ginga middleware.  
 *  @param  [in]  e_code            - The network event code to send .
 *  @return Return the error code
 *  @retval GINGAR_OK               - Push network event successfully.
 */
/*------------------------------------------------------------------*/
typedef INT32 (*x_ginga_eng_send_nw_evt) (GINGA_EVENT_CODE_T e_code);


/*------------------------------------------------------------------*/
/*! @brief  This API is called by x_ginga_send_network_event_ex to send networt event to Ginga middleware.  
 *  @param  [in]  e_code            - The network event code to send .
 *  @param  [in]  ui2_on_id         - The original network Id.
 *  @param  [in]  ui2_ts_id         - The transpond stream ID.
 *  @param  [in]  ui2_rc_key_id     - The remote control key ID.
 *  @param  [in]  ui2_svc_id        - The service ID.
 *  @param  [in]  ui4_comp_tag      - The component tag.
 *  @return Return the error code
 *  @retval GINGAR_OK               - Push network event successfully.
 */
/*------------------------------------------------------------------*/
typedef INT32 (*x_ginga_eng_send_nw_evt_ex)(
        GINGA_EVENT_CODE_T              e_code,
        UINT16                          ui2_on_id,
        UINT16                          ui2_ts_id,
        UINT16                          ui2_rc_key_id,
        UINT16                          ui2_svc_id,
        UINT32                          ui4_comp_tag);


/*------------------------------------------------------------------*/
/*! @brief  This API is used to notify Ginga events .  
 *  @param  [in]  e_cb_type         - Ginga callback .
 *  @param  [in]  aui1_cb_arg_data  - Callback data.
 *  @param  [in]  z_data_len        - Callback data length.
 *  @return Return the error code
 *  @retval GINGAR_OK               - OK.
 */
/*------------------------------------------------------------------*/
typedef INT32 (*x_ginga_eng_cb_proc)(
        GINGA_CB_TYPE_T                 e_cb_type,
        UINT8                           aui1_cb_arg_data[],
        SIZE_T                          z_data_len);


/*------------------------------------------------------------------*/
/*! @brief  This API is called by x_ginga_ptm_add_property to add a property to Ginga middleware.  
 *  @param  [in]  s_name            - The property name .
 *  @param  [in]  aui1_buf_def_val  - The property value.
 *  @param  [in]  z_buf_def_val_len - The property value buffer length.
 *  @param  [in]  b_const_4_astrotv - If this property is unmutable for astrotv. 
 *  @param  [in]  b_const_4_astrotv - If this property is unmutable for native app
 *                                    If it is true , this property can not be modified by set_property.
 *  @return Return the error code
 *  @retval GINGAR_OK               - Add a new property successfully.
 *  @retval GINGAR_NOT_INIT         - Ginga engine not initialized yet.
 */
/*------------------------------------------------------------------*/
typedef INT32 (*x_ginga_eng_add_property)(const CHAR* s_name, 
                                        UINT8 aui1_buf_def_val[], 
                                        SIZE_T z_buf_def_val_len,
                                        BOOL b_const_4_astrotv,
                                        BOOL b_const_4_native);


/*------------------------------------------------------------------*/
/*! @brief  This API is called by x_ginga_ptm_del_property to delete a property of Ginga middleware.  
 *  @param  [in]  s_name            - Name of property to delete .
 *  @return Return the error code
 *  @retval GINGAR_OK               - Delete the property successfully.
 *  @retval GINGAR_NOT_INIT         - Ginga engine not initialized yet.
 */
/*------------------------------------------------------------------*/
typedef INT32 (*x_ginga_eng_del_property)(const CHAR* s_name);

/*------------------------------------------------------------------*/
/*! @brief  This API is called by x_ginga_ptm_set_property to modifies a property value of Ginga middleware.  
 * It works only when this property already added with b_const_4_native = false.
 *  @param  [in]  s_name            - The property name to modify .
 *  @param  [in]  aui1_buf_val      - The new value to set.
 *  @param  [in]  z_buf_len         - The length of new value .
 *  @return Return the error code
 *  @retval GINGAR_OK               - Set new value successfully.
 *  @retval GINGAR_NOT_INIT         - Ginga engine not initialized yet.
 */
/*------------------------------------------------------------------*/
typedef INT32 (*x_ginga_eng_set_property)(const CHAR* s_name, 
                                        UINT8 aui1_buf_val[], 
                                        SIZE_T z_buf_len);

/*------------------------------------------------------------------*/
/*! @brief  This API is called by x_ginga_ptm_get_property to get a property value of Ginga middleware.  
 * It works only when this property already added.
 *  @param  [in]  s_name            - The property name to modify .
 *  @param  [in]  aui1_buf_val      - The buffer for storing the property value.
 *  @param  [in]  z_buf_len         - The buffer length .
 *  @param  [in/out] pui4_remain    - when the buffer is not enough to hold
 *                                    the entire property value, this variable
 *                                    will indicate how many bytes remain to
 *                                    be stored. First time it will be 0. 
 *                                    On sucessive calls the same value returned
 *                                    previously will be passed and must be used
 *                                    to calculate the offset from where the value
 *                                    must be copied.
 *  @return Return the error code
 *  @retval GINGAR_OK               - Set new value successfully.
 *  @retval GINGAR_NOT_INIT         - Ginga engine not initialized yet.
 */
/*------------------------------------------------------------------*/
typedef INT32 (*x_ginga_eng_get_property)(const CHAR* s_name, 
                                        UINT8 aui1_buf_val[], 
                                        SIZE_T z_buf_len,
                                         UINT32 * pui4_remain);

/*------------------------------------------------------------------*/
/*! @brief  This API is called by x_ginga_ptm_reset_property to reset a property  
*       value to the default value of add_property.  
 *  @param  [in]  s_name            - The property to reset .
 *  @return Return the error code
 *  @retval GINGAR_OK               - Reset successfully.
 *  @retval GINGAR_NOT_INIT         - Ginga engine not initialized yet.
 */
/*------------------------------------------------------------------*/
typedef INT32 (*x_ginga_eng_reset_property)(const CHAR* s_name);


/*------------------------------------------------------------------*/
/*! @brief  This API redraw the screen
 *  @return Return the error code
 *  @retval GINGAR_OK               - Operation is successful.
 *  @retval GINGAR_INTERNAL_ERROR   - Internal error occurs.
 */
/*------------------------------------------------------------------*/
typedef INT32 (*x_ginga_eng_redraw_screen)(VOID);

/*------------------------------------------------------------------*/
/*! @brief  This API enable the on screen display
 *  @param  [in]  b_enable          - TRUE: Enable, FALSE: disable
 *  @return Return the error code
 *  @retval GINGAR_OK               - Operation is successful.
 *  @retval GINGAR_INTERNAL_ERROR   - Internal error occurs.
 */
/*------------------------------------------------------------------*/
typedef INT32 (*x_ginga_eng_enable_screen)(BOOL b_enable);

typedef INT32 (*x_ginga_eng_screen_setResolution)(UINT32 width, UINT32 height);
/*------------------------------------------------------------------*/
/*! @brief  This API is called by x_ginga_av_enable to enable / disable
 *          Ginga's control to TV audio / video.
 *  @param  [in]  b_enable          - TRUE: Enable, FALSE: disable
 *  @return Return the error code
 *  @retval GINGAR_OK               - Operation is successful.
 *  @retval GINGAR_INTERNAL_ERROR   - Internal error occurs.
 */
/*------------------------------------------------------------------*/
typedef INT32 (*x_ginga_eng_av_enable)(BOOL b_enable);

typedef INT32 (*x_ginga_eng_profileb_enable)(BOOL b_enable);

typedef INT32 (*x_ginga_eng_factory_reset)();


/*------------------------------------------------------------------*/
/*! @brief  This API is called by x_ginga_av_mute to mute / unmute audio
 *          / video.
 *  @param  [in]  ui1_main_sub      - The main / sub window to mute /
 *                                    unmute. 0: main, 1: sub.
 *  @param  [in]  e_strm_type       - The stream type to mute / unmute.
 *                                    ST_AUDIO: audio, ST_VIDEO: video.
 *  @param  [in]  b_mute            - To mute(TRUE) or unmute(FALSE).
 *  @return Return the error code
 *  @retval GINGAR_OK               - Operation is successful.
 *  @retval GINGAR_INTERNAL_ERROR   - Internal error occurs.
 */
/*------------------------------------------------------------------*/
typedef INT32 (*x_ginga_eng_av_mute)(
        UINT8                       ui1_main_sub,
        STREAM_TYPE_T               e_strm_type,
        BOOL                        b_mute);


/*------------------------------------------------------------------*/
/*! @brief  This API is called by x_ginga_av_freeze to freeze / unfreeze
 *          video.
 *  @param  [in]  ui1_main_sub      - The main / sub window to freeze /
 *                                    unfreeze. 0: main, 1: sub.
 *  @param  [in]  b_freeze          - To freeze(TRUE) or unfreeze(FALSE).
 *  @return Return the error code
 *  @retval GINGAR_OK               - Operation is successful.
 *  @retval GINGAR_INTERNAL_ERROR   - Internal error occurs.
 */
/*------------------------------------------------------------------*/
typedef INT32 (*x_ginga_eng_av_freeze)(
        UINT8                       ui1_main_sub,
        BOOL                        b_freeze);

/*------------------------------------------------------------------*/
/*! @brief  This API is called by x_ginga_av_reg_aud_cfg_cb to register 
 *      a callback of audio setting changes.  
 *  @param  [in]  pf_nfy            - Notification function provided by the caller,
 *                                    to notify that the audio setting need to be changed .
 *  @param  [in]  pv_tag            - Private tag provided by the caller.  
 *                                    This tag is passed to the caller's notification function..
 *  @return Return the error code
 *  @retval GINGAR_OK               - Register the callback successfully.
 *  @retval GINGAR_OUT_OF_MEMORY    - Out of memory.
 */
/*------------------------------------------------------------------*/
typedef INT32 (*x_ginga_eng_reg_aud_cfg_cb)(
        x_ginga_av_aud_cfg_nfy_fct  pf_nfy,
        VOID*                       pv_tag);


/*------------------------------------------------------------------*/
/*! @brief  This API sends a audio configuaration to Ginga middleware.   
 *  @param  [in]  i2_cfg_value_per  - the percentage of audio configuaration value
 *  @param  [in]  e_cfg_type        - audio configuaration type.  
 *  @return Return the error code
 *  @retval GINGAR_OK               - Register the callback successfully.
 *  @retval GINGAR_NOT_INIT         - Ginga not initialized yet.
 *  @retval GINGAR_OUT_OF_MEMORY    - Out of memory.
 */
/*------------------------------------------------------------------*/
typedef INT32 (*x_ginga_eng_send_aud_cfg)(
        INT16            i2_cfg_value_per, 
        GINGA_AV_AUD_CFG_TYPE_T              e_cfg_type);

/*------------------------------------------------------------------*/
/*! @brief  This API is called by x_ginga_set_nw_svc_select_cb to registe a callback of audio setting changes.  
 *  @param  [in]  pf_nfy            - Notification function provided by the caller,
 *                                    to notify that the service need to be changed .
 *  @param  [in]  pv_tag            - Private tag provided by the caller.  
 *                                    This tag is passed to the caller's notification function..
 *  @return Return the error code
 *  @retval GINGAR_OK               - Register the callback successfully.
 *  @retval GINGAR_OUT_OF_MEMORY    - Out of memory.
 */
/*------------------------------------------------------------------*/
typedef INT32 (*x_ginga_eng_reg_svc_change_cb)(
        x_ginga_svc_change_nfy_fct      pf_nfy,
        VOID*                           pv_tag);


/*------------------------------------------------------------------*/
/*! @brief  This API is called by x_ginga_set_svc_change_result to set service change result.  
 *  @param  [in]  i4_result - the result of service selection
 *  @return Return the error code
 *  @retval GINGAR_OK               - Register the callback successfully.
 *  @retval GINGAR_OUT_OF_MEMORY    - Out of memory.
 */
/*------------------------------------------------------------------*/
typedef INT32 (*x_ginga_eng_set_nw_svc_select_result)(INT32 i4_result);

/*------------------------------------------------------------------*/
/*! @brief  This API is called by x_ginga_reg_tv_vid_resize_cb to registe a callback of audio setting changes.  
 *  @param  [in]  pf_nfy            - Notification function provided by the caller,
 *                                    to notify that the service need to be changed .
 *  @param  [in]  pv_tag            - Private tag provided by the caller.  
 *                                    This tag is passed to the caller's notification function..
 *  @return Return the error code
 *  @retval GINGAR_OK               - Register the callback successfully.
 *  @retval GINGAR_OUT_OF_MEMORY    - Out of memory.
 */
/*------------------------------------------------------------------*/
typedef INT32 (*x_ginga_eng_reg_tv_vid_resize_cb)(
        x_ginga_tv_vid_resize_nfy_fct      pf_nfy,
        VOID*                           pv_tag);


typedef INT32 (*x_ginga_eng_reg_resume_main_tv_cb)(
		x_ginga_resume_main_tv_nfy_fct	pf_nfy,
		VOID*							pv_tag);

typedef INT32 (*x_ginga_eng_reg_ott_status_cb)(
		x_ginga_ott_status_nfy_fct	pf_nfy,
		VOID*							pv_tag);

typedef INT32 (*x_ginga_eng_reg_attached_key_cb)(
        x_ginga_attached_key_nfy_fct    pf_nfy,
        VOID*                           pv_tag);

typedef INT32 (*x_ginga_eng_set_country)(GINGA_COUNTRY_CODE_T e_country);

/*------------------------------------------------------------------*/
/*! @brief  This structure holds a Ginga engine function table.
 *  @code
 *  typedef struct {
 *      x_ginga_eng_load                      pf_eng_load;
 *      x_ginga_eng_init                      pf_eng_init;
 *      x_ginga_eng_activate                  pf_eng_activate;
 *      x_ginga_eng_deactivate                pf_eng_deactivate;
 *      x_ginga_eng_uninit                    pf_eng_uninit;
 *      x_ginga_eng_unload                    pf_eng_unload;
 *      x_ginga_eng_get_state                 pf_eng_get_state;
 *      x_ginga_eng_get_app_list              pf_eng_get_app_list;
 *      x_ginga_eng_start_app                 pf_eng_start_app;
 *      x_ginga_eng_stop_app                  pf_eng_stop_app;
 *      x_ginga_eng_reg_app_list_cb           pf_eng_reg_app_list_cb;
 *      x_ginga_eng_reg_app_stat_cb           pf_eng_reg_app_stat_cb;
 *      x_ginga_eng_send_key                  pf_eng_send_key;
 *      x_ginga_eng_send_nw_evt               pf_eng_send_nw_evt;
 *      x_ginga_eng_cb_proc                   pf_eng_def_cb_handler;
 *      x_ginga_eng_add_property              pf_eng_add_property;
 *      x_ginga_eng_del_property              pf_eng_del_property;
 *      x_ginga_eng_set_property              pf_eng_set_property;
 *      x_ginga_eng_get_property              pf_eng_get_property;
 *      x_ginga_eng_reset_property            pf_eng_reset_property;
 *      x_ginga_eng_redraw_screen             pf_eng_redraw_screen;
 *      x_ginga_eng_av_mute                   pf_eng_mute_av;
 *      x_ginga_eng_av_freeze                 pf_eng_freeze_vid;
 *      x_ginga_eng_av_enable                 pf_eng_set_av_ctrl
 *      x_ginga_eng_reg_aud_cfg_cb            pf_eng_set_audio_setting_cb;
 *      x_ginga_eng_reg_svc_change_cb         pf_eng_reg_svc_change_cb;
 *      x_ginga_eng_set_nw_svc_select_result  pf_eng_set_svc_change_result; 
 *  }   GINGA_ENGINE_FCT_TBL_T;
 *  @endcode
 *  @li@c  pf_eng_load                  - Reference to the (*x_ginga_eng_load) function.
 *  @li@c  pf_eng_activate              - Reference to the (*x_ginga_eng_activate) function.
 *  @li@c  pf_eng_deactivate            - Reference to the (*x_ginga_eng_deactivate) function.
 *  @li@c  pf_eng_unload                - Reference to the (*x_ginga_eng_unload) function.
 *  @li@c  pf_eng_get_state             - Reference to the (*x_ginga_eng_get_state) function.
 *  @li@c  pf_eng_get_app_list          - Reference to the (*x_ginga_eng_get_app_list) function.
 *  @li@c  pf_eng_start_app             - Reference to the (*x_ginga_eng_start_app) function.
 *  @li@c  pf_eng_stop_app              - Reference to the (*x_ginga_eng_stop_app) function.
 *  @li@c  pf_eng_reg_app_list_cb       - Reference to the (*x_ginga_eng_reg_app_list_cb) function.
 *  @li@c  pf_eng_reg_app_stat_cb       - Reference to the (*x_ginga_eng_reg_app_stat_cb) function.
 *  @li@c  pf_eng_send_key              - Reference to the (*x_ginga_eng_send_key) function.
 *  @li@c  pf_eng_send_nw_evt           - Reference to the (*x_ginga_eng_send_nw_evt) function.
 *  @li@c  pf_eng_def_cb_handler        - Reference to the (*x_ginga_eng_cb_proc) function.
 *  @li@c  pf_eng_add_property          - Reference to the (*x_ginga_eng_add_property) function.
 *  @li@c  pf_eng_del_property          - Reference to the (*x_ginga_eng_del_property) function.
 *  @li@c  pf_eng_set_property          - Reference to the (*x_ginga_eng_set_property) function.
 *  @li@c  pf_eng_get_property          - Reference to the (*x_ginga_eng_get_property) function.
 *  @li@c  pf_eng_reset_property        - Reference to the (*x_ginga_eng_reset_property) function.  
 *  @li@c  pf_eng_redraw_screen         - Reference to the (*x_ginga_eng_redraw_screen) function.   
 *  @li@c  pf_eng_enable_screen         - Reference to the (*x_ginga_eng_enable_screen) function.   
 *  @li@c  pf_eng_mute_av               - Reference to the (*x_ginga_eng_av_mute) function.    
 *  @li@c  pf_eng_freeze_vid            - Reference to the (*x_ginga_eng_av_freeze) function.    
 *  @li@c  pf_eng_set_av_ctrl           - Reference to the (*x_ginga_eng_av_enable) function.    
 *  @li@c  pf_eng_set_audio_setting_cb  - Reference to the (*x_ginga_eng_reg_aud_cfg_cb) function.
 *  @li@c  pf_eng_set_nw_svc_select_cb  - Reference to the (*x_ginga_eng_set_nw_svc_select_cb) function.
 *  @li@c  pf_eng_set_svc_change_result - Reference to the (*x_ginga_eng_set_nw_svc_select_result) function.
 */
/*------------------------------------------------------------------*/
typedef struct {
    x_ginga_eng_load                        pf_eng_load;
    x_ginga_eng_init                        pf_eng_init;
    x_ginga_eng_activate                    pf_eng_activate;
    x_ginga_eng_deactivate                  pf_eng_deactivate;
    x_ginga_eng_uninit                      pf_eng_uninit;
    x_ginga_eng_unload                      pf_eng_unload;
    x_ginga_eng_get_state                   pf_eng_get_state;
    x_ginga_eng_get_app_list                pf_eng_get_app_list;
    x_ginga_eng_start_app                   pf_eng_start_app;
    x_ginga_eng_stop_app                    pf_eng_stop_app;
    x_ginga_eng_ignore_brdcstr_ctrl         pf_eng_ignore_brdcstr_ctrl;
    x_ginga_eng_reg_app_list_cb             pf_eng_reg_app_list_cb;
    x_ginga_eng_reg_app_stat_cb             pf_eng_reg_app_stat_cb;
    x_ginga_eng_send_key                    pf_eng_send_key;
    x_ginga_eng_get_reserved_key            pf_eng_get_reserved_key;
    x_ginga_eng_send_nw_evt                 pf_eng_send_nw_evt;
    x_ginga_eng_send_nw_evt_ex              pf_eng_send_nw_evt_ex;
    x_ginga_eng_cb_proc                     pf_eng_def_cb_handler;
    x_ginga_eng_add_property                pf_eng_add_property;
    x_ginga_eng_del_property                pf_eng_del_property;
    x_ginga_eng_set_property                pf_eng_set_property;
    x_ginga_eng_get_property                pf_eng_get_property;
    x_ginga_eng_reset_property              pf_eng_reset_property;
    x_ginga_eng_redraw_screen               pf_eng_redraw_screen;
    x_ginga_eng_enable_screen               pf_eng_enable_screen;
    x_ginga_eng_screen_setResolution        pf_eng_screen_setResolution;
    x_ginga_eng_av_enable                   pf_eng_av_enable;
    x_ginga_eng_av_mute                     pf_eng_av_mute;
    x_ginga_eng_av_freeze                   pf_eng_av_freeze;
    x_ginga_eng_send_aud_cfg                pf_eng_send_aud_cfg;
    x_ginga_eng_reg_aud_cfg_cb              pf_eng_reg_aud_cfg_cb;
    x_ginga_eng_reg_svc_change_cb           pf_eng_reg_svc_change_cb;
    x_ginga_eng_set_nw_svc_select_result    pf_eng_set_svc_change_result;
    x_ginga_eng_reg_tv_vid_resize_cb        pf_eng_reg_tv_vid_resize_cb;
    x_ginga_eng_profileb_enable             pf_eng_profileb_enable;
    x_ginga_eng_factory_reset               pf_eng_factory_reset;
	x_ginga_eng_reg_resume_main_tv_cb		pf_eng_reg_resume_main_tv_cb;
    x_ginga_eng_reg_ott_status_cb           pf_eng_reg_ott_status_cb;
    x_ginga_eng_enable_app                  pf_eng_enable_app;
    x_ginga_eng_disble_app                  pf_eng_disble_app;
    x_ginga_eng_sc_set_visible              pf_eng_sc_set_visible;
    x_ginga_eng_sc_reg_status_cb            pf_eng_sc_reg_status_cb;
  	x_ginga_eng_set_country                 pf_eng_set_country;
    x_ginga_eng_reg_attached_key_cb         pf_eng_reg_attached_key_cb;
    
} GINGA_ENGINE_FCT_TBL_T;


/*-----------------------------------------------------------------------------
                    data declarations
-----------------------------------------------------------------------------*/

/*----------------------------------------------------------------------------*/
/*! @} */
/*----------------------------------------------------------------------------*/
#endif /* _U_GINGA_H_ */

