/**
 * @file hv_app_OsdMenu.c
 * @brief osd app menu c file.
 * @details This file provides the following functions: \n
 *          (1) Osd menu operation functions \n
 *          (2) Osd event operation functions \n
 *
 * @author HiView SoC Software Team
 * @version 1.0.0
 * @date 2022-09-01
 * @copyright Copyright(c),2022-8, Hiview Software. All rights reserved.
 * @par History:
 * <table>
 * <tr><th>Author       <th>Date            <th>Change Description
 * <tr><td>shanpeng     <td>2022-09-01      <td>create
 * </table>
 */

#include "hv_mw_OsdComm.h"
#include "hv_mw_OsdLog.h"
#include "hv_comm_DataBase.h"
#include "hv_mw_AppInterface.h"
#include "hv_mw_Channel_Manager.h"
#include "hv_res_OsdMenuOperation.h"
#include "hv_app_OsdDynamicUpdate.h"
#include "hv_mw_Factory.h"
#include "hv_app_OsdMenu.h"
#include "hv_app_Osd.h"
#include "hv_app_OsdDialog.h"
#include "hv_app_OsdFactory.h"
#include "hv_mw_OsdOperation.h"
#ifdef CONFIG_USER_USB_OTA_ON
#include "hv_mw_UsbTask.h"
#endif
#include "hv_mw_OsdDraw.h"
#if (HV_PROJECT_CONFIG_OSD_ANIMITION_SUPPORT == HV_CONFIG_ON)
#include "hv_mw_OsdAnimation.h"
#endif

static BOOL s_bQuickEnter = HV_FALSE;
static BOOL s_bIsAdjusting = HV_FALSE;
static BOOL s_bAdjustingNoNeedRedraw = HV_FALSE;
static INT32 s_iTimeTotal = 0;
static USHORT16 s_usKeyBackup;
static USHORT16 s_usItemBackup;
static BOOL s_bPowerTipsShowen = HV_FALSE;
static SHORT16 s_sUserdataBackupValue;
static SHORT16 s_usLastFocusMainItem = ITEM_GAME_SCENE_MAIN;

#if 0
/* Info Begin */
/* Item与解释性话语中的stringId对照表 */
static const OsdInfoMap astOsdInfoMap[] =
{
    {ITEM_BRI_CON_SCENE_MAIN, EN_OSD_BRIGHTNESS_CONTRASTLANG},
    {ITEM_PICTURE_SCENE_MAIN, EN_OSD_PICTUREADJUSTLANG},
    {ITEM_COLOR_TEMP_SCENE_MAIN, EN_OSD_COLOR_TEMPLANG},
    {ITEM_OSD_SCENE_MAIN, EN_OSD_OSDSETLANG},
    {ITEM_RESET_SCENE_MAIN, EN_OSD_RESETLANG},
    {ITEM_OTHER_SCENE_MAIN, EN_OSD_OTHERLANG},
};

static USHORT16 Hv_App_OsdItemGetInfoId(USHORT16 usItemId)
{
    for (USHORT16 usId = 0; usId < ARRAY_SIZE(astOsdInfoMap); usId++)
    {
        if (astOsdInfoMap[usId].usItemId == usItemId)
        {
            return astOsdInfoMap[usId].usInfoStringId;
        }
    }
    return INVALID_PARAM_USHORT16;
}

static VOID Hv_App_OsdItemUpdateShowInfo(USHORT16 usItemId)
{
    USHORT16 usInfoId = Hv_App_OsdItemGetInfoId(usItemId);
    OsdText *pstText = NULL;

    if (usInfoId != INVALID_PARAM_USHORT16)
    {
        OSD_LOG_DEBUG("Show Item-%d's info-%d", usItemId, usInfoId);
        Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_INFO_SCENE_MAIN_NORMAL));
        pstText = (OsdText *)Hv_Mw_OsdComponentGetDynamicProp(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_INFO_SCENE_MAIN_NORMAL));
        HV_ASSERT_VALID_PTR_VOID(pstText);
        pstText->usStringId = usInfoId;
    }
    else
    {
        OSD_LOG_DEBUG("Item-%d has no info", usItemId);
        Hv_Mw_OsdComponentHide(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_INFO_SCENE_MAIN_NORMAL));
    }
}

static VOID Hv_App_OsdItemHideInfo(VOID)
{
    OSD_LOG_DEBUG("Hide item info");
    Hv_Mw_OsdComponentHide(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_INFO_SCENE_MAIN_NORMAL));
}
/* Info End */
#endif

#if 0
VOID Hv_App_OsdFuncitonTipsEnter(VOID)
{
    USHORT16 usItem = OSD_GET_FOCUSING();
    s_usKeyBackup = Hv_Mw_OsdGetKeyValue();
    s_usItemBackup = usItem;

    Hv_Mw_OsdSceneInit(SCENE_FUNCTION_TIPS);
    Hv_Mw_OsdSceneShow(SCENE_FUNCTION_TIPS);

    Hv_Mw_OsdItemFocus(ITEM_NO_SCENE_FUNCTION_TIPS);
    Hv_Mw_OsdItemShowList(ITEM_NO_SCENE_FUNCTION_TIPS);

    switch (usItem)
    {
        case ITEM_FREESYNC_ADJUST_SCENE_MAIN:
        {
            if ((UD_VIDEOSOURCE_V_DP == Hv_App_GetOsdDataValue(E_USERDATA_VIDEOSOURCE)) ||
                (UD_VIDEOSOURCE_V_USB_C == Hv_App_GetOsdDataValue(E_USERDATA_VIDEOSOURCE)))
            {
                Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_ADJ_ADAPTIVESYNC_SCENE_FUNCTION_TIPS_NORMAL));
            }
            else
            {
                Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_ADJ_FREESYNC_SCENE_FUNCTION_TIPS_NORMAL));
            }
            Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_OFF_MPRT_SCENE_FUNCTION_TIPS_NORMAL));
            break;
        }
        case ITEM_MAGNIFYGLASS_ADJUST_SCENE_MAIN:
        {
            Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_ADJ_MAGNIFY_SCENE_FUNCTION_TIPS_NORMAL));
            Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_OFF_PXPMODE_SCENE_FUNCTION_TIPS_NORMAL));
            break;
        }
        case ITEM_PXP_MODE_ADJUST_SCENE_MAIN:
        {
            Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_ADJ_PXPMODE_SCENE_FUNCTION_TIPS_NORMAL));
            Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_OFF_MAGNIFY_SCENE_FUNCTION_TIPS_NORMAL));
            break;
        }
        default:
        {
            break;
        }
    }

    Hv_Mw_OsdSceneHide(ITEM_GET_SCENEID(usItem));
}

VOID Hv_App_OsdFuncitonTipsExit(VOID)
{
    Hv_Mw_OsdSceneShow(ITEM_GET_SCENEID(s_usItemBackup));
    Hv_Mw_OsdItemFocus(s_usItemBackup);
    Hv_Mw_OsdSceneHide(SCENE_FUNCTION_TIPS);
    Hv_Mw_OsdSceneClear(SCENE_FUNCTION_TIPS);
}

VOID Hv_App_OsdPowerTipsEnter(VOID)
{
    USHORT16 usItem = OSD_GET_FOCUSING();
    s_usKeyBackup = Hv_Mw_OsdGetKeyValue();
    s_usItemBackup = usItem;

    Hv_Mw_OsdSceneInit(SCENE_POWER_TIPS);
    Hv_Mw_OsdSceneShow(SCENE_POWER_TIPS);

    Hv_Mw_OsdItemFocus(ITEM_NO_SCENE_POWER_TIPS);
    Hv_Mw_OsdItemShowList(ITEM_NO_SCENE_POWER_TIPS);

    switch (usItem)
    {
        case ITEM_BRIGHTNESS_ADJUST_SCENE_MAIN:
        {
            Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_BRIGHTNESS_SCENE_POWER_TIPS_NORMAL));
            break;
        }
        case ITEM_BRIGHTNESS_SCENE_BRIGHTNESS:
        {
            Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_BRIGHTNESS_SCENE_POWER_TIPS_NORMAL));
            break;
        }
        default:
        {
            break;
        }
    }
    Hv_Mw_OsdSceneHide(ITEM_GET_SCENEID(usItem));
}

VOID Hv_App_OsdPowerTipsExit(VOID)
{
    Hv_Mw_OsdSceneShow(ITEM_GET_SCENEID(s_usItemBackup));
    Hv_Mw_OsdItemFocus(s_usItemBackup);
    Hv_Mw_OsdSceneHide(SCENE_POWER_TIPS);
    Hv_Mw_OsdSceneClear(SCENE_POWER_TIPS);
}
#endif

#if (HV_PROJECT_CONFIG_OSD_ANIMITION_SUPPORT == HV_CONFIG_ON)
VOID Hv_App_OsdBrightnessAdjustMenuExitAnimFinish(VOID);
VOID Hv_App_OsdVolumeAdjustMenuExitAnimFinish(VOID);
VOID Hv_App_OsdModeMenuExitAnimFinish(VOID);
VOID Hv_App_OsdCrosshairAdjustMenuExitAnimFinish(VOID);
VOID Hv_App_OsdInputMenuExitAnimFinish(VOID);

/* Position animition function */
static VOID Hv_App_SceneEnterPosAnimCreate(UCHAR8 ucSceneId)
{
    HV_ASSERT_TRUE_VOID(ucSceneId < SCENE_ID_MAX);

    USHORT16 usWidth = 0;
    USHORT16 usHeight = 0;
    OsdAnimition *pstAnimNode = NULL;
    OsdAnimitionParam stAnimParam = {0};

    /* 恢复菜单实际位置 */
    Hv_Mw_SetFromOsdUserdata(E_USERDATA_MENUX);
    Hv_Mw_SetFromOsdUserdata(E_USERDATA_MENUY);
    Hv_Mw_OsdGetDisplaySize(&usWidth, &usHeight);
    OsdScene *pstScene = OSD_GET_SCENE(ucSceneId);
    HV_ASSERT_VALID_PTR_VOID(pstScene);

    /* 创建动画 */
    stAnimParam.usDelayTime = 0;
    stAnimParam.usDurationTime = 72;
    stAnimParam.usId = ucSceneId;
    stAnimParam.ucOperateType = ANIM_POS_Y;
    stAnimParam.usStart = usHeight;
    stAnimParam.usEnd = pstScene->usY;
    stAnimParam.enCurveType = ANIM_CURVE_EASE_OUT;
    stAnimParam.ExecuteCbFn = Hv_Mw_OsdAnimUpdateScenePos;

    pstAnimNode = Hv_Mw_OsdAnimCreate(&stAnimParam);
    HV_ASSERT_VALID_PTR_VOID(pstAnimNode);
    OSD_LOG_INFO("Scene-%d pos animition create.", ucSceneId);

    /* 更改当前位置为第一次更新位置 */
    Hv_Mw_OsdAnimUpdateScenePos(pstAnimNode);
}

static VOID Hv_App_SceneExitPosAnimFinish(OsdAnimitionParam *pstAnimParam)
{
    switch (pstAnimParam->usId)
    {
        case SCENE_BRIGHTNESS:
        {
            Hv_App_OsdBrightnessAdjustMenuExitAnimFinish();
            break;
        }
        case SCENE_VOLUME:
        {
            Hv_App_OsdVolumeAdjustMenuExitAnimFinish();
            break;
        }
        case SCENE_MODE:
        {
            Hv_App_OsdModeMenuExitAnimFinish();
            break;
        }
        case SCENE_CROSSHAIR_ADJUST:
        {
            Hv_App_OsdCrosshairAdjustMenuExitAnimFinish();
            break;
        }
        case SCENE_INPUT:
        {
            Hv_App_OsdInputMenuExitAnimFinish();
            break;
        }
        default:
        {
            break;
        }
    }
}

static VOID Hv_App_SceneExitPosAnimCreate(UCHAR8 ucSceneId)
{
    HV_ASSERT_TRUE_VOID(ucSceneId < SCENE_ID_MAX);

    USHORT16 usWidth = 0;
    USHORT16 usHeight = 0;
    OsdAnimition *pstAnimNode = NULL;
    OsdAnimitionParam stAnimParam = {0};

    Hv_Mw_OsdGetDisplaySize(&usWidth, &usHeight);
    OsdScene *pstScene = OSD_GET_SCENE(ucSceneId);
    HV_ASSERT_VALID_PTR_VOID(pstScene);

    /* creat animition */
    stAnimParam.usId = ucSceneId;
    stAnimParam.ucOperateType = ANIM_POS_Y;
    stAnimParam.usStart = pstScene->usY;
    stAnimParam.usEnd = usHeight;
    stAnimParam.usDelayTime = 0;
    stAnimParam.usDurationTime = 72;
    stAnimParam.enCurveType = ANIM_CURVE_EASE_IN;
    stAnimParam.UserParam = NULL;
    stAnimParam.ExecuteCbFn = Hv_Mw_OsdAnimUpdateScenePos;
    stAnimParam.FinishCbFn = Hv_App_SceneExitPosAnimFinish;

    pstAnimNode = Hv_Mw_OsdAnimCreate(&stAnimParam);
    HV_ASSERT_VALID_PTR_VOID(pstAnimNode);
    OSD_LOG_INFO("Scene-%d pos animition create.", ucSceneId);

    Hv_Mw_OsdAnimUpdateScenePos(pstAnimNode);
}

/* Alpha animition function */
static VOID Hv_App_SceneEnterAlphaAnimCreate(UCHAR8 ucSceneId)
{
    HV_ASSERT_TRUE_VOID(ucSceneId < SCENE_ID_MAX);

    OsdAnimition *pstAnimNode = NULL;
    OsdAnimitionParam stAnimParam = {0};

    /* creat animition */
    stAnimParam.usDelayTime = 0;
    stAnimParam.usDurationTime = 72;
    stAnimParam.usStart = 0;
    stAnimParam.usEnd = 255;
    stAnimParam.usId = ucSceneId;
    stAnimParam.ucOperateType = OSD_UNIVERSAL_ALPHA_TYPE_ALL;
    stAnimParam.ExecuteCbFn = Hv_Mw_OsdAnimUpdateSceneAlpha;
    pstAnimNode = Hv_Mw_OsdAnimCreate(&stAnimParam);
    HV_ASSERT_VALID_PTR_VOID(pstAnimNode);
    OSD_LOG_INFO("Scene-%d alpha animition create.", ucSceneId);

    Hv_Mw_OsdAnimUpdateSceneAlpha(pstAnimNode);
}

/* Color animition function */
static VOID Hv_App_SceneEnterColorAnimFinish(OsdAnimitionParam *pstAnimParam)
{
    if (NULL != pstAnimParam->UserParam)
    {
        OSD_LOG_INFO("Free user param.");
        AnimColorParam *pstUserParam = (AnimColorParam *)pstAnimParam->UserParam;
        HV_FREE_OBJECT(pstUserParam);
        pstAnimParam->UserParam = NULL;
    }
}

static VOID Hv_App_SceneEnterColorAnimCreate(UCHAR8 ucSceneId)
{
    HV_ASSERT_TRUE_VOID(ucSceneId < SCENE_ID_MAX);

    OsdAnimition *pstAnimNode = NULL;
    OsdAnimitionParam stAnimParam = {0};

    OsdComponent stCp = {OSD_CP_TYPE_ICON, IMAGE_4_SCENE_MODE_NORMAL};
    /* creat animition */
    AnimColorParam *pstUserParam = HV_MALLOC_OBJECT(AnimColorParam);
    HV_ASSERT_VALID_PTR_VOID(pstUserParam);
    pstUserParam->uiStart = 0x382018;
    pstUserParam->uiEnd = Hv_Mw_OsdAnimGetSingleColor(Hv_Mw_OsdAnimGetCompPaletteOffset(stCp)); //0xc8d408;
    pstUserParam->usOriginalPalette = Hv_Mw_OsdAnimGetCompPaletteOffset(stCp);
    pstUserParam->usNewPalette = 32;
    pstUserParam->ucPaletteType = ANIM_PALETTE_INDEPENDENT;
    OSD_LOG_DEBUG("Color uiStart = 0x%6x, uiEnd = 0x%6x, usOriginalPalette  = %d, usNewPalette  = %d.",
                   pstUserParam->uiStart, pstUserParam->uiEnd, pstUserParam->usOriginalPalette, pstUserParam->usNewPalette);

    stAnimParam.usDelayTime = 0;
    stAnimParam.usDurationTime = 72;
    stAnimParam.usId = stCp.usIndex;
    stAnimParam.ucElementType = stCp.enType;
    stAnimParam.UserParam = pstUserParam;
    stAnimParam.ExecuteCbFn = Hv_Mw_OsdAnimUpdateCompColor;
    stAnimParam.FinishCbFn = Hv_App_SceneEnterColorAnimFinish;
    pstAnimNode = Hv_Mw_OsdAnimCreate(&stAnimParam);
    HV_ASSERT_VALID_PTR_VOID(pstAnimNode);
    OSD_LOG_INFO("Scene-%d animition1 create.", ucSceneId);

    Hv_Mw_OsdAnimUpdateCompColor(pstAnimNode);
}

#endif

VOID Hv_App_OsdCrosshairAdjustMenuEnter(VOID)
{
    Hv_App_OsdHideAll();

    Hv_Mw_OsdSceneInit(SCENE_CROSSHAIR_ADJUST);
    Hv_Mw_OsdSceneShow(SCENE_CROSSHAIR_ADJUST);
    Hv_Mw_OsdItemFocus(ITEM_CROSSHAIR_ADJUST_SCENE_CROSSHAIR_ADJUST);
    Hv_Mw_OsdItemShowList(ITEM_CROSSHAIR_ADJUST_SCENE_CROSSHAIR_ADJUST);

    Hv_Mw_OsdSetKeyRepeatPeriod(OSD_DEFAULT_KEY_REPEAT_PERIOD_MS);
    Hv_Mw_OsdSetKeyState(OSDEVT_KEY_UP, KEY_STATE_REPEATABLE, HV_TRUE);
    Hv_Mw_OsdSetKeyState(OSDEVT_KEY_DOWN, KEY_STATE_REPEATABLE, HV_TRUE);
    OSD_LOG_INFO("Show crosshair adjust quick menu");

#if (HV_PROJECT_CONFIG_OSD_ANIMITION_SUPPORT == HV_CONFIG_ON)
    Hv_App_SceneEnterPosAnimCreate(SCENE_CROSSHAIR_ADJUST);
#endif
}

#if (HV_PROJECT_CONFIG_OSD_ANIMITION_SUPPORT == HV_CONFIG_ON)
VOID Hv_App_OsdCrosshairAdjustMenuExitAnimFinish(VOID)
{
    Hv_Mw_OsdSetKeyState(OSDEVT_KEY_UP, KEY_STATE_REPEATABLE, HV_FALSE);
    Hv_Mw_OsdSetKeyState(OSDEVT_KEY_DOWN, KEY_STATE_REPEATABLE, HV_FALSE);

    Hv_Mw_OsdItemFocusClear();
    Hv_Mw_OsdSceneHide(SCENE_CROSSHAIR_ADJUST);
    Hv_Mw_OsdSceneClear(SCENE_CROSSHAIR_ADJUST);
}

VOID Hv_App_OsdCrosshairAdjustMenuExit(VOID)
{
    Hv_App_SceneExitPosAnimCreate(SCENE_CROSSHAIR_ADJUST);
}
#else
VOID Hv_App_OsdCrosshairAdjustMenuExit(VOID)
{
    Hv_Mw_OsdSetKeyState(OSDEVT_KEY_UP, KEY_STATE_REPEATABLE, HV_FALSE);
    Hv_Mw_OsdSetKeyState(OSDEVT_KEY_DOWN, KEY_STATE_REPEATABLE, HV_FALSE);

    Hv_Mw_OsdItemFocusClear();
    Hv_Mw_OsdSceneHide(SCENE_CROSSHAIR_ADJUST);
    Hv_Mw_OsdSceneClear(SCENE_CROSSHAIR_ADJUST);
}
#endif

VOID Hv_App_OsdBrightnessAdjustMenuEnter(VOID)
{
    /* Check disable before focus, if item disabled */
#ifndef OSD_CHECK_DISABLE_BY_EACH_ITEM
    Hv_App_CheckItemDisableState();
#endif
    if (!Hv_Mw_OsdItemGetEnable(ITEM_BRIGHTNESS_ADJUST_SCENE_BRIGHTNESS))
    {
        OSD_LOG_INFO("Brightness disabled!");
        return;
    }

    Hv_App_OsdHideAll();

    Hv_Mw_OsdSceneInit(SCENE_BRIGHTNESS);
    Hv_Mw_OsdSceneShow(SCENE_BRIGHTNESS);
    Hv_Mw_OsdItemFocus(ITEM_BRIGHTNESS_ADJUST_SCENE_BRIGHTNESS);
    Hv_Mw_OsdItemShowList(ITEM_BRIGHTNESS_ADJUST_SCENE_BRIGHTNESS);

    s_bIsAdjusting = HV_TRUE;
    Hv_Mw_OsdSetKeyState(OSDEVT_KEY_UP, KEY_STATE_REPEATABLE, HV_TRUE);
    Hv_Mw_OsdSetKeyState(OSDEVT_KEY_DOWN, KEY_STATE_REPEATABLE, HV_TRUE);
    OSD_LOG_INFO("Show brightness adjust quick menu");

#if (HV_PROJECT_CONFIG_OSD_ANIMITION_SUPPORT == HV_CONFIG_ON)
    Hv_App_SceneEnterPosAnimCreate(SCENE_BRIGHTNESS);
#endif
}

#if (HV_PROJECT_CONFIG_OSD_ANIMITION_SUPPORT == HV_CONFIG_ON)
VOID Hv_App_OsdBrightnessAdjustMenuExitAnimFinish(VOID)
{
    s_bIsAdjusting = HV_FALSE;
    Hv_Mw_OsdSetKeyState(OSDEVT_KEY_UP, KEY_STATE_REPEATABLE, HV_FALSE);
    Hv_Mw_OsdSetKeyState(OSDEVT_KEY_DOWN, KEY_STATE_REPEATABLE, HV_FALSE);

    Hv_Mw_OsdItemFocusClear();
    Hv_Mw_OsdSceneHide(SCENE_BRIGHTNESS);
    Hv_Mw_OsdSceneClear(SCENE_BRIGHTNESS);
}

VOID Hv_App_OsdBrightnessAdjustMenuExit(VOID)
{
    Hv_App_SceneExitPosAnimCreate(SCENE_BRIGHTNESS);
}
#else
VOID Hv_App_OsdBrightnessAdjustMenuExit(VOID)
{
    s_bIsAdjusting = HV_FALSE;
    Hv_Mw_OsdSetKeyState(OSDEVT_KEY_UP, KEY_STATE_REPEATABLE, HV_FALSE);
    Hv_Mw_OsdSetKeyState(OSDEVT_KEY_DOWN, KEY_STATE_REPEATABLE, HV_FALSE);

    Hv_Mw_OsdItemFocusClear();
    Hv_Mw_OsdSceneHide(SCENE_BRIGHTNESS);
    Hv_Mw_OsdSceneClear(SCENE_BRIGHTNESS);
}
#endif

VOID Hv_App_OsdInputMenuEnter(VOID)
{
    /* Check disable before focus, if item disabled */
#ifndef OSD_CHECK_DISABLE_BY_EACH_ITEM
    Hv_App_CheckItemDisableState();
#endif
    if (!Hv_Mw_OsdItemGetEnable(ITEM_INPUT_ADJUST_SCENE_INPUT))
    {
        OSD_LOG_INFO("Input disabled!");
        return;
    }
    Hv_App_OsdHideAll();
    Hv_Mw_OsdSceneInit(SCENE_INPUT);
    Hv_Mw_OsdSceneShow(SCENE_INPUT);

    Hv_Mw_OsdItemFocus(ITEM_INPUT_ADJUST_SCENE_INPUT);
    Hv_Mw_OsdItemShowList(ITEM_INPUT_ADJUST_SCENE_INPUT);

    Hv_Mw_OsdSetKeyRepeatPeriod(OSD_DEFAULT_KEY_REPEAT_PERIOD_MS);
    Hv_Mw_OsdSetKeyState(OSDEVT_KEY_UP, KEY_STATE_REPEATABLE, HV_TRUE);
    Hv_Mw_OsdSetKeyState(OSDEVT_KEY_DOWN, KEY_STATE_REPEATABLE, HV_TRUE);
    OSD_LOG_INFO("Show input select quick menu");

#if (HV_PROJECT_CONFIG_OSD_ANIMITION_SUPPORT == HV_CONFIG_ON)
    Hv_App_SceneEnterPosAnimCreate(SCENE_INPUT);
#endif
}

#if (HV_PROJECT_CONFIG_OSD_ANIMITION_SUPPORT == HV_CONFIG_ON)
VOID Hv_App_OsdInputMenuExitAnimFinish(VOID)
{
    Hv_Mw_OsdSetKeyState(OSDEVT_KEY_UP, KEY_STATE_REPEATABLE, HV_FALSE);
    Hv_Mw_OsdSetKeyState(OSDEVT_KEY_DOWN, KEY_STATE_REPEATABLE, HV_FALSE);

    Hv_Mw_OsdItemFocusClear();
    Hv_Mw_OsdSceneHide(SCENE_INPUT);
    Hv_Mw_OsdSceneClear(SCENE_INPUT);
}

VOID Hv_App_OsdInputMenuExit(VOID)
{
    Hv_App_SceneExitPosAnimCreate(SCENE_INPUT);
}
#else
VOID Hv_App_OsdInputMenuExit(VOID)
{
    Hv_Mw_OsdSetKeyState(OSDEVT_KEY_UP, KEY_STATE_REPEATABLE, HV_FALSE);
    Hv_Mw_OsdSetKeyState(OSDEVT_KEY_DOWN, KEY_STATE_REPEATABLE, HV_FALSE);

    Hv_Mw_OsdItemFocusClear();
    Hv_Mw_OsdSceneHide(SCENE_INPUT);
    Hv_Mw_OsdSceneClear(SCENE_INPUT);
}
#endif

VOID Hv_App_OsdModeMenuEnter(VOID)
{
    /* Check disable before focus, if item disabled */
#ifndef OSD_CHECK_DISABLE_BY_EACH_ITEM
    Hv_App_CheckItemDisableState();
#endif
    if (!Hv_Mw_OsdItemGetEnable(ITEM_MODE_ADJUST_SCENE_MODE))
    {
        OSD_LOG_INFO("Display mode disabled!");
        return;
    }
    Hv_App_OsdHideAll();

    Hv_Mw_OsdSceneInit(SCENE_MODE);
    Hv_Mw_OsdSceneShow(SCENE_MODE);

    Hv_Mw_OsdItemFocus(ITEM_MODE_ADJUST_SCENE_MODE);
    Hv_Mw_OsdItemShowList(ITEM_MODE_ADJUST_SCENE_MODE);

    Hv_Mw_OsdSetKeyRepeatPeriod(OSD_DEFAULT_KEY_REPEAT_PERIOD_MS);
    Hv_Mw_OsdSetKeyState(OSDEVT_KEY_UP, KEY_STATE_REPEATABLE, HV_TRUE);
    Hv_Mw_OsdSetKeyState(OSDEVT_KEY_DOWN, KEY_STATE_REPEATABLE, HV_TRUE);
    OSD_LOG_INFO("Show display mode select quick menu");

#if (HV_PROJECT_CONFIG_OSD_ANIMITION_SUPPORT == HV_CONFIG_ON)
    Hv_App_SceneEnterPosAnimCreate(SCENE_MODE);
    //Hv_App_SceneEnterAlphaAnimCreate(SCENE_MODE);
    //Hv_App_SceneEnterColorAnimCreate(SCENE_MODE);
#endif
}

#if (HV_PROJECT_CONFIG_OSD_ANIMITION_SUPPORT == HV_CONFIG_ON)
VOID Hv_App_OsdModeMenuExitAnimFinish(VOID)
{
    Hv_Mw_OsdSetKeyState(OSDEVT_KEY_UP, KEY_STATE_REPEATABLE, HV_FALSE);
    Hv_Mw_OsdSetKeyState(OSDEVT_KEY_DOWN, KEY_STATE_REPEATABLE, HV_FALSE);

    Hv_Mw_OsdItemFocusClear();
    Hv_Mw_OsdSceneHide(SCENE_MODE);
    Hv_Mw_OsdSceneClear(SCENE_MODE);
}

VOID Hv_App_OsdModeMenuExit(VOID)
{
    Hv_App_SceneExitPosAnimCreate(SCENE_MODE);
}
#else
VOID Hv_App_OsdModeMenuExit(VOID)
{
    Hv_Mw_OsdSetKeyState(OSDEVT_KEY_UP, KEY_STATE_REPEATABLE, HV_FALSE);
    Hv_Mw_OsdSetKeyState(OSDEVT_KEY_DOWN, KEY_STATE_REPEATABLE, HV_FALSE);

    Hv_Mw_OsdItemFocusClear();
    Hv_Mw_OsdSceneHide(SCENE_MODE);
    Hv_Mw_OsdSceneClear(SCENE_MODE);
}
#endif

VOID Hv_App_OsdVolumeAdjustMenuEnter(VOID)
{
    Hv_App_OsdHideAll();

    Hv_Mw_OsdSceneInit(SCENE_VOLUME);
    Hv_Mw_OsdSceneShow(SCENE_VOLUME);
    Hv_Mw_OsdItemFocus(ITEM_VOLUME_ADJUST_SCENE_VOLUME);
    Hv_Mw_OsdItemShowList(ITEM_VOLUME_ADJUST_SCENE_VOLUME);

    s_bIsAdjusting = HV_TRUE;
    Hv_Mw_OsdSetKeyState(OSDEVT_KEY_UP, KEY_STATE_REPEATABLE, HV_TRUE);
    Hv_Mw_OsdSetKeyState(OSDEVT_KEY_DOWN, KEY_STATE_REPEATABLE, HV_TRUE);
    OSD_LOG_INFO("Show volume adjust quick menu");

#if (HV_PROJECT_CONFIG_OSD_ANIMITION_SUPPORT == HV_CONFIG_ON)
    Hv_App_SceneEnterPosAnimCreate(SCENE_VOLUME);
#endif
}

#if (HV_PROJECT_CONFIG_OSD_ANIMITION_SUPPORT == HV_CONFIG_ON)
VOID Hv_App_OsdVolumeAdjustMenuExitAnimFinish(VOID)
{
    s_bIsAdjusting = HV_FALSE;
    Hv_Mw_OsdSetKeyState(OSDEVT_KEY_UP, KEY_STATE_REPEATABLE, HV_FALSE);
    Hv_Mw_OsdSetKeyState(OSDEVT_KEY_DOWN, KEY_STATE_REPEATABLE, HV_FALSE);

    Hv_Mw_OsdItemFocusClear();
    Hv_Mw_OsdSceneHide(SCENE_VOLUME);
    Hv_Mw_OsdSceneClear(SCENE_VOLUME);
}

VOID Hv_App_OsdVolumeAdjustMenuExit(VOID)
{
    Hv_App_SceneExitPosAnimCreate(SCENE_VOLUME);
}
#else
VOID Hv_App_OsdVolumeAdjustMenuExit(VOID)
{
    s_bIsAdjusting = HV_FALSE;
    Hv_Mw_OsdSetKeyState(OSDEVT_KEY_UP, KEY_STATE_REPEATABLE, HV_FALSE);
    Hv_Mw_OsdSetKeyState(OSDEVT_KEY_DOWN, KEY_STATE_REPEATABLE, HV_FALSE);

    Hv_Mw_OsdItemFocusClear();
    Hv_Mw_OsdSceneHide(SCENE_VOLUME);
    Hv_Mw_OsdSceneClear(SCENE_VOLUME);
}
#endif

VOID Hv_App_OsdCrosshairUpdate(VOID)
{
    if (!Hv_Mw_OsdSceneIsShowing(SCENE_CROSSHAIR))
    {
        return;
    }

    USHORT16 usStyle = Hv_App_GetOsdDataValue(E_USERDATA_CROSSHAIR);
    switch (usStyle)
    {
        case UD_CROSSHAIR_V_STYLE1:
        {
            Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_ICON, IMAGE_CROSSHAIR1_SCENE_CROSSHAIR_NORMAL));
            break;
        }
        case UD_CROSSHAIR_V_STYLE2:
        {
            Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_ICON, IMAGE_CROSSHAIR2_SCENE_CROSSHAIR_NORMAL));
            break;
        }
        case UD_CROSSHAIR_V_STYLE3:
        {
            Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_ICON, IMAGE_CROSSHAIR3_SCENE_CROSSHAIR_NORMAL));
            break;
        }
        default:
        {
            Hv_Mw_OsdSceneHide(SCENE_CROSSHAIR);
            Hv_Mw_OsdSceneClear(SCENE_CROSSHAIR);
            return;
        }
    }
    Hv_Mw_OsdStartAutoRefreshTimer(SCENE_CROSSHAIR, 50);
}

VOID Hv_App_OsdCrosshairEnter(VOID)
{
    USHORT16 usStyle = Hv_App_GetOsdDataValue(E_USERDATA_CROSSHAIR);

    Hv_Mw_OsdOpsForceRedraw(HV_TRUE);

    switch (usStyle)
    {
        case UD_CROSSHAIR_V_STYLE1:
        {
            Hv_Mw_OsdSceneInit(SCENE_CROSSHAIR);
            Hv_Mw_OsdSceneShow(SCENE_CROSSHAIR);
            Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_ICON, IMAGE_CROSSHAIR1_SCENE_CROSSHAIR_NORMAL));
            Hv_Mw_OsdColorCapturePositionInit(COMPONENT(OSD_CP_TYPE_ICON, IMAGE_CROSSHAIR1_SCENE_CROSSHAIR_NORMAL));
            break;
        }
        case UD_CROSSHAIR_V_STYLE2:
        {
            Hv_Mw_OsdSceneInit(SCENE_CROSSHAIR);
            Hv_Mw_OsdSceneShow(SCENE_CROSSHAIR);
            Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_ICON, IMAGE_CROSSHAIR2_SCENE_CROSSHAIR_NORMAL));
            Hv_Mw_OsdColorCapturePositionInit(COMPONENT(OSD_CP_TYPE_ICON, IMAGE_CROSSHAIR2_SCENE_CROSSHAIR_NORMAL));
            break;
        }
        case UD_CROSSHAIR_V_STYLE3:
        {
            Hv_Mw_OsdSceneInit(SCENE_CROSSHAIR);
            Hv_Mw_OsdSceneShow(SCENE_CROSSHAIR);
            Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_ICON, IMAGE_CROSSHAIR3_SCENE_CROSSHAIR_NORMAL));
            Hv_Mw_OsdColorCapturePositionInit(COMPONENT(OSD_CP_TYPE_ICON, IMAGE_CROSSHAIR3_SCENE_CROSSHAIR_NORMAL));
            break;
        }
        default:
        {
            Hv_Mw_OsdSceneHide(SCENE_CROSSHAIR);
            Hv_Mw_OsdSceneClear(SCENE_CROSSHAIR);
            return;
        }
    }

    if (UD_DYN_CROSSHAIR_V_ON == Hv_App_GetOsdDataValue(E_USERDATA_DYN_CROSSHAIR))
    {
        OSD_LOG_INFO("Show dynamic crosshair start");
        Hv_App_OsdCrosshairUpdate();
    }
    else
    {
        OSD_LOG_INFO("Show crosshair start");
    }
}

VOID Hv_App_OsdCrosshairExit(VOID)
{
    Hv_Mw_OsdSceneHide(SCENE_CROSSHAIR);
    Hv_Mw_OsdSceneClear(SCENE_CROSSHAIR);
}

VOID Hv_App_OsdRefreshRateUpdate(VOID)
{
    if (!Hv_Mw_OsdSceneIsShowing(SCENE_REFRESH_RATE))
    {
        return;
    }

    LinkPortIndex enPortIndex = LINK_PORT_INDEX_INVALID;
    ChanelSignalState enChanelSignalState = ChanelSignalState_Invalid;
    UINT32 uiRefreshRate = 0;
    UCHAR8 aucStringRefreshRate[16] = {0};
    USHORT16 usLen = 0;
    Hv_Mw_Channel_GetSignalState(CHANNEL_TYPE_MAIN, &enPortIndex, &enChanelSignalState);
    uiRefreshRate = Hv_Mw_InputPort_GetCurrentFrameRate(enPortIndex);

    OsdTimingInfo *pstTiming = Hv_App_OsdGetCurrentTimingInfo();

    if (pstTiming->bInterlacedMode)
    {
        uiRefreshRate /= 2;
    }
    if (pstTiming->bIsVrr)
    {
        usLen = HV_SNPRINTF(aucStringRefreshRate, OSD_ASCII_STRING_LENGTH_MAX, "%d.%03d", uiRefreshRate / 1000, uiRefreshRate % 1000);
    }
    else
    {
        usLen = HV_SNPRINTF(aucStringRefreshRate, OSD_ASCII_STRING_LENGTH_MAX, "%d", (uiRefreshRate + 500) / 1000);
    }
    Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_ASCII_STRING, CUSTOMSTRING_REFRESHRATE_SCENE_REFRESH_RATE_NORMAL));
    Hv_Mw_OsdDynamicAsciiStringUpdate(CUSTOMSTRING_REFRESHRATE_SCENE_REFRESH_RATE_NORMAL, aucStringRefreshRate, usLen);

#if (HV_PROJECT_CONFIG_OSD_CPU_CANVAS_SUPPORT == HV_CONFIG_ON)
    Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_ICON, ICON_WAVE_SCENE_REFRESH_RATE_NORMAL));
#endif

    Hv_Mw_OsdStartAutoRefreshTimer(SCENE_REFRESH_RATE, 100);
}

VOID Hv_App_OsdRefreshRateEnter(VOID)
{
    Hv_Mw_OsdSceneInit(SCENE_REFRESH_RATE);
    Hv_Mw_OsdSceneShow(SCENE_REFRESH_RATE);

#if (HV_PROJECT_CONFIG_OSD_CPU_CANVAS_SUPPORT == HV_CONFIG_ON)
    Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_BMP, BMP_BG_SCENE_REFRESH_RATE_NORMAL));
    Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_LINEGRID, LINE_H_SCENE_REFRESH_RATE));
    Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_LINEGRID, LINE_V_SCENE_REFRESH_RATE));
    Hv_Mw_OsdCanvasWaveInit(COMPONENT(OSD_CP_TYPE_ICON, ICON_WAVE_SCENE_REFRESH_RATE_NORMAL), 2, 2, 2);
#endif
    Hv_App_OsdRefreshRateUpdate();
    Hv_Mw_OsdOpsForceRedraw(HV_TRUE);
    OSD_LOG_DEBUG("Show refresh rate start");
}

VOID Hv_App_OsdRefreshRateExit(VOID)
{
    Hv_Mw_OsdStopAutoRefreshTimer(SCENE_REFRESH_RATE);
    Hv_Mw_OsdSceneHide(SCENE_REFRESH_RATE);
    Hv_Mw_OsdSceneClear(SCENE_REFRESH_RATE);
}

VOID Hv_App_OsdTimeCounterSetTime(INT32 iTimeSecond)
{
    s_iTimeTotal = iTimeSecond;
}

VOID Hv_App_OsdTimeCounterUpdate(VOID)
{
    static BOOL bBlinkFlag = HV_FALSE;
    INT32 iTimeTotal = s_iTimeTotal;
    USHORT16 usMinus = iTimeTotal / 60;
    USHORT16 usSecond = iTimeTotal % 60;
    UCHAR8 aucStringTimer[16] = {0};
    USHORT16 usLen = 0;

    if (!Hv_Mw_OsdSceneIsShowing(SCENE_TIMER))
    {
        if (iTimeTotal >= 0)
        {
            OSD_LOG_DEBUG("TimerCount = %d", s_iTimeTotal);
            s_iTimeTotal--;
            Hv_Mw_OsdStartAutoRefreshTimer(SCENE_TIMER, 1000);
        }
        return;
    }

    if (iTimeTotal < 0)
    {
        if (bBlinkFlag)
        {
            Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_ASCII_STRING, CUSTOMSTRING_TIMER_SCENE_TIMER_NORMAL));
            bBlinkFlag = HV_FALSE;
        }
        else
        {
            Hv_Mw_OsdComponentHide(COMPONENT(OSD_CP_TYPE_ASCII_STRING, CUSTOMSTRING_TIMER_SCENE_TIMER_NORMAL));
            bBlinkFlag = HV_TRUE;
        }
    }
    else
    {
        usLen = HV_SNPRINTF(aucStringTimer, OSD_ASCII_STRING_LENGTH_MAX, "%02d:%02d", usMinus, usSecond);
        Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_ASCII_STRING, CUSTOMSTRING_TIMER_SCENE_TIMER_NORMAL));
        Hv_Mw_OsdDynamicAsciiStringUpdate(CUSTOMSTRING_TIMER_SCENE_TIMER_NORMAL, aucStringTimer, usLen);
        OSD_LOG_DEBUG("TimerCount = %d", s_iTimeTotal);
        s_iTimeTotal--;
    }

    Hv_Mw_OsdStartAutoRefreshTimer(SCENE_TIMER, 1000);
}

VOID Hv_App_OsdTimeCounterEnter(VOID)
{
    Hv_Mw_OsdSceneInit(SCENE_TIMER);
    Hv_Mw_OsdSceneShow(SCENE_TIMER);
    Hv_Mw_OsdOpsForceRedraw(HV_TRUE);
    Hv_App_OsdTimeCounterUpdate();
    OSD_LOG_INFO("Show timer start");
}

VOID Hv_App_OsdTimeCounterExit(VOID)
{
    if (s_iTimeTotal < 0)
    {
        Hv_Mw_OsdAdjustFunction(E_USERDATA_TIME_COUNTER, ACT_SET, UD_TIME_COUNTER_V_OFF, SET_ALL);
        Hv_Mw_OsdStopAutoRefreshTimer(SCENE_TIMER);
    }

    Hv_Mw_OsdSceneHide(SCENE_TIMER);
    Hv_Mw_OsdSceneClear(SCENE_TIMER);
}

VOID Hv_App_OsdLockEnter(BOOL bIsLock)
{
    Hv_App_OsdHideAll();
    Hv_Mw_OsdSceneInit(SCENE_LOCK);
    Hv_Mw_OsdSceneShow(SCENE_LOCK);

    if (bIsLock)
    {
        Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_ICON, IMAGE_LOCK_SCENE_LOCK_NORMAL));
        OSD_LOG_INFO("Show lock");
    }
    else
    {
        Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_ICON, IMAGE_UNLOCK_SCENE_LOCK_NORMAL));
        OSD_LOG_INFO("Show unlock");
    }

    Hv_Mw_OsdStartAutoCloseTimer(SCENE_LOCK, 1);
}

VOID Hv_App_OsdLockExit(VOID)
{
    Hv_Mw_OsdSceneHide(SCENE_LOCK);
    Hv_Mw_OsdSceneClear(SCENE_LOCK);
}

VOID Hv_App_OsdOtaEnter(VOID)
{
    Hv_App_OsdHideAll();
    Hv_Mw_OsdStopAutoCloseTimer(SCENE_MAIN);
    Hv_Mw_OsdSetAllKeyEnable(HV_FALSE);

    Hv_Mw_OsdSceneInit(SCENE_OTA);
    Hv_Mw_OsdSceneShow(SCENE_OTA);

    Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_PREPARE_SCENE_OTA_NORMAL));
    Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_PREPARE_POWER_SCENE_OTA_NORMAL));
}

VOID Hv_App_OsdOtaUpdate(USHORT16 usValue)
{
#ifdef CONFIG_USER_USB_OTA_ON
    USHORT16 usUsbState = usValue & 0x00FF;
    OSD_LOG_INFO("OTA State = %d", usUsbState);

    Hv_App_OsdHideAll();
    Hv_Mw_OsdSceneInit(SCENE_OTA);
    Hv_Mw_OsdSceneShow(SCENE_OTA);

    switch (usUsbState)
    {
        case USB_STATE_NO_UDISK_IN:
        {
            Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_DISCONNECT_SCENE_OTA_NORMAL));
            Hv_Mw_OsdStartAutoCloseTimer(SCENE_OTA, 5);
            break;
        }
        case USB_STATE_NO_OTA_FILE:
        {
            Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_FIND_FILE_FAIL_SCENE_OTA_NORMAL));
            Hv_Mw_OsdStartAutoCloseTimer(SCENE_OTA, 5);
            break;
        }
        case USB_STATE_FOUND_OTA_FILE:
        {
            Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_PROCEED_SCENE_OTA_NORMAL));
            Hv_Mw_OsdItemFocus(ITEM_NO_SCENE_OTA);
            Hv_Mw_OsdItemShowList(ITEM_NO_SCENE_OTA);
            Hv_Mw_OsdSetAllKeyEnable(HV_TRUE);
            break;
        }
        case USB_STATE_OTA_IN_PROCESSING:
        {
            Hv_Mw_OsdSetAllKeyEnable(HV_FALSE);
            Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_UPDATING_SCENE_OTA_NORMAL));
            Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_ASCII_STRING, CUSTOMSTRING_OTA_SCENE_OTA_NORMAL));
            UCHAR8 ucPercent = (usValue & 0xFF00) >> 8;
            UCHAR8 aucString[8] = {0};
            USHORT16 usLen = HV_SNPRINTF(aucString, OSD_ASCII_STRING_LENGTH_MAX, "%d%%", ucPercent);
            Hv_Mw_OsdDynamicAsciiStringUpdate(CUSTOMSTRING_OTA_SCENE_OTA_NORMAL, aucString, usLen);
            break;
        }
        case USB_STATE_OTA_SUCCESS:
        {
            Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_DONE_SCENE_OTA_NORMAL));
            Hv_Mw_OsdStartAutoCloseTimer(SCENE_OTA, 5);
            break;
        }
        case USB_STATE_OTA_FAIL:
        {
            Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_FAIL_SCENE_OTA_NORMAL));
            Hv_Mw_OsdStartAutoCloseTimer(SCENE_OTA, 5);
            break;
        }
        default:
        {
            Hv_App_OsdOtaExit();
            break;
        }
    }
#endif
}

VOID Hv_App_OsdOtaExit(VOID)
{
    Hv_Mw_OsdItemFocusClear();
    Hv_Mw_OsdSceneHide(SCENE_OTA);
    Hv_Mw_OsdSceneClear(SCENE_OTA);
    Hv_Mw_OsdSetAllKeyEnable(HV_TRUE);
}

VOID Hv_App_OsdUpdateNavi(BOOL bAdjust)
{
    USHORT16 usItem = OSD_GET_FOCUSING();
    USHORT16 usLevel = Hv_Mw_OsdItemGetLevel(usItem);

    if (1 == usLevel)
    {
        Hv_Mw_OsdComponentHide(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_NAVI_CONFIRM_SCENE_MAIN_NORMAL));
        Hv_Mw_OsdComponentHide(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_NAVI_NEXT_SCENE_MAIN_NORMAL));
        Hv_Mw_OsdComponentHide(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_NAVI_SWITCH_SCENE_MAIN_NORMAL));
        Hv_Mw_OsdComponentHide(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_NAVI_ENTER_SCENE_MAIN_NORMAL));
        Hv_Mw_OsdComponentHide(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_NAVI_ADJUST_SCENE_MAIN_NORMAL));
        Hv_Mw_OsdComponentHide(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_NAVI_QUIT_SCENE_MAIN_NORMAL));

        Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_NAVI_BACK_SCENE_MAIN_NORMAL));
        Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_NAVI_SELECT_SCENE_MAIN_NORMAL));
        if (ITEM_NONE_ID != CHILD_ITEM(usItem))
        {
            Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_NAVI_ENTER_SCENE_MAIN_NORMAL));
        }
        else
        {
            Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_NAVI_SWITCH_SCENE_MAIN_NORMAL));
        }
    }
    else if (2 == usLevel)
    {
        Hv_Mw_OsdComponentHide(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_NAVI_NEXT_SCENE_MAIN_NORMAL));
        Hv_Mw_OsdComponentHide(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_NAVI_SWITCH_SCENE_MAIN_NORMAL));
        Hv_Mw_OsdComponentHide(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_NAVI_ENTER_SCENE_MAIN_NORMAL));
        Hv_Mw_OsdComponentHide(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_NAVI_SELECT_SCENE_MAIN_NORMAL));
        Hv_Mw_OsdComponentHide(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_NAVI_ADJUST_SCENE_MAIN_NORMAL));
        Hv_Mw_OsdComponentHide(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_NAVI_QUIT_SCENE_MAIN_NORMAL));

        Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_NAVI_BACK_SCENE_MAIN_NORMAL));
        if (bAdjust)
        {
            Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_NAVI_ADJUST_SCENE_MAIN_NORMAL));
        }
        else
        {
            Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_NAVI_SELECT_SCENE_MAIN_NORMAL));
        }
        Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_NAVI_CONFIRM_SCENE_MAIN_NORMAL));
    }
    else if (3 == usLevel)
    {
        Hv_Mw_OsdComponentHide(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_NAVI_CONFIRM_SCENE_MAIN_NORMAL));
        Hv_Mw_OsdComponentHide(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_NAVI_SWITCH_SCENE_MAIN_NORMAL));
        Hv_Mw_OsdComponentHide(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_NAVI_ENTER_SCENE_MAIN_NORMAL));
        Hv_Mw_OsdComponentHide(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_NAVI_SELECT_SCENE_MAIN_NORMAL));
        Hv_Mw_OsdComponentHide(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_NAVI_QUIT_SCENE_MAIN_NORMAL));

        Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_NAVI_BACK_SCENE_MAIN_NORMAL));
        Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_NAVI_ADJUST_SCENE_MAIN_NORMAL));
        Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_NAVI_NEXT_SCENE_MAIN_NORMAL));
    }
    else
    {
        Hv_Mw_OsdComponentHide(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_NAVI_CONFIRM_SCENE_MAIN_NORMAL));
        Hv_Mw_OsdComponentHide(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_NAVI_NEXT_SCENE_MAIN_NORMAL));
        Hv_Mw_OsdComponentHide(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_NAVI_SWITCH_SCENE_MAIN_NORMAL));
        Hv_Mw_OsdComponentHide(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_NAVI_ADJUST_SCENE_MAIN_NORMAL));
        Hv_Mw_OsdComponentHide(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_NAVI_BACK_SCENE_MAIN_NORMAL));

        Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_NAVI_QUIT_SCENE_MAIN_NORMAL));
        Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_NAVI_SELECT_SCENE_MAIN_NORMAL));
        Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_NAVI_ENTER_SCENE_MAIN_NORMAL));
    }
}

VOID Hv_App_OsdMainMenuUpdate(VOID)
{
    if (!Hv_Mw_OsdSceneIsShowing(SCENE_MAIN))
    {
        return;
    }

    OsdTimingInfo *pstTiming = Hv_App_OsdGetCurrentTimingInfo();

    LinkPortIndex enPortIndex = Hv_App_GetOsdDataValue(E_USERDATA_VIDEOSOURCE);
    UINT32 uiRefreshRate = Hv_Mw_InputPort_GetCurrentFrameRate(enPortIndex);

    if (pstTiming->bInterlacedMode)
    {
        uiRefreshRate /= 2;
    }
    uiRefreshRate = (uiRefreshRate + 500) / 1000;

    UCHAR8 aucString[OSD_ASCII_STRING_LENGTH_MAX] = { 0 };
    USHORT16 usStringLength = HV_SNPRINTF(aucString, OSD_ASCII_STRING_LENGTH_MAX, "%dHZ", uiRefreshRate);
    Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_ASCII_STRING, CUSTOMSTRING_FRAMERATE_SCENE_MAIN_NORMAL));
    Hv_Mw_OsdDynamicAsciiStringUpdate(CUSTOMSTRING_FRAMERATE_SCENE_MAIN_NORMAL, aucString, usStringLength);

    OSD_LOG_DEBUG("Update timing info in main menu, port = %d, string: %s", enPortIndex, aucString);

    Hv_Mw_OsdStartAutoRefreshTimer(SCENE_MAIN, HV_PROJECT_CONFIG_OSD_DEFAULT_REFRESH_PERIOD_MS);
}

#if (HV_PROJECT_CONFIG_OSD_ANIMITION_SUPPORT == HV_CONFIG_ON)
static VOID Hv_App_OsdMainMenuEnterS3AnimFinish(OsdAnimitionParam *pstAnimParam)
{
    if (NULL != pstAnimParam->UserParam)
    {
        OSD_LOG_INFO("Free user param.");
        AnimRangeParam *pstUserParam = (AnimRangeParam *)pstAnimParam->UserParam;
        HV_FREE_OBJECT(pstUserParam);
        pstAnimParam->UserParam = NULL;
    }

    Hv_Mw_OsdSceneHide(SCENE_ANIM_RECT);
    Hv_Mw_OsdSceneClear(SCENE_ANIM_RECT);

    Hv_Mw_OsdSetKeyRepeatPeriod(OSD_DEFAULT_KEY_REPEAT_PERIOD_MS);
    Hv_Mw_OsdSetKeyState(OSDEVT_KEY_UP, KEY_STATE_REPEATABLE, HV_TRUE);
    Hv_Mw_OsdSetKeyState(OSDEVT_KEY_DOWN, KEY_STATE_REPEATABLE, HV_TRUE);

}

static VOID Hv_App_OsdMainMenuEnterS3AnimUpdate(OsdAnimitionParam *pstAnimParam)
{
    HV_ASSERT_VALID_PTR_VOID(pstAnimParam);

    AnimCurveMap stMapParam = {0};
    USHORT16 usCurXPos = 0;
    UCHAR8 ucIndex = RECT_LEVEL2_SCENE_ANIM_RECT_NORMAL;
    const OsdRect *pstRectProp = OSD_GET_RECT_PROP(ucIndex);
    HV_ASSERT_VALID_PTR_VOID(pstRectProp);

    Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_RECT, ucIndex));

    OsdRect *pstRectDynamic = (OsdRect *)Hv_Mw_OsdComponentGetDynamicProp(COMPONENT(OSD_CP_TYPE_RECT, ucIndex));
    HV_ASSERT_VALID_PTR_VOID(pstRectDynamic);

    stMapParam.usDurationTime = pstAnimParam->usDurationTime;
    stMapParam.usRemainTime = pstAnimParam->usRemainTime;
    stMapParam.usStart = 0;
    stMapParam.usEnd = pstRectProp->usWidth;
    usCurXPos = Hv_Mw_OsdAnimCurveMapping(ANIM_CURVE_LINEAR, &stMapParam);

    pstRectDynamic->usX = pstRectProp->usX + usCurXPos;
    pstRectDynamic->usWidth = pstRectProp->usWidth - usCurXPos;
    //OSD_LOG_INFO("usCurXPos=%d, rect: usX=%d, usWidth=%d,", usCurXPos, pstRectDynamic->usX, pstRectDynamic->usWidth);
}

static VOID Hv_App_OsdMainMenuEnterS3AnimCreate(UCHAR8 ucSceneId)
{
    HV_ASSERT_TRUE_VOID(ucSceneId < SCENE_ID_MAX);

    OsdAnimition *pstAnimNode = NULL;
    OsdAnimitionParam stAnimParam = {0};

    /* creat animition1 */
    AnimRangeParam stRangeParam = {0};
    OsdComponent sCpCursor = {OSD_CP_TYPE_RECT, RECT_1_SCENE_MAIN_FOCUSING};
    Hv_Mw_OsdAnimGetCompRange(sCpCursor, &stRangeParam);

    AnimRangeParam *pstUserParam = HV_MALLOC_OBJECT(AnimRangeParam);
    HV_ASSERT_VALID_PTR_VOID(pstUserParam);
    pstUserParam->usX = stRangeParam.usX;
    pstUserParam->usY = stRangeParam.usY;
    pstUserParam->usWidth = stRangeParam.usWidth;
    pstUserParam->usHeight = stRangeParam.usHeight;

    stAnimParam.usDelayTime = 0;
    stAnimParam.usDurationTime = 36;
    stAnimParam.usStart = 0;
    stAnimParam.usEnd = stRangeParam.usWidth;
    stAnimParam.ucElementType = sCpCursor.enType;
    stAnimParam.usId = sCpCursor.usIndex;
    stAnimParam.ucOperateType = ANIM_SIZE_LR_EXPAND;
    stAnimParam.UserParam = pstUserParam;
    stAnimParam.ExecuteCbFn = Hv_Mw_OsdAnimUpdateCompSize;
    stAnimParam.FinishCbFn = Hv_App_OsdMainMenuEnterS3AnimFinish;
    pstAnimNode = Hv_Mw_OsdAnimCreate(&stAnimParam);
    HV_ASSERT_VALID_PTR_VOID(pstAnimNode);
    OSD_LOG_INFO("Scene-%d animition3 create1.width=%d.", ucSceneId, pstAnimNode->usEnd);

    Hv_Mw_OsdAnimUpdateCompSize(pstAnimNode);

    /* creat animition2 */
    OsdComponent sCp = {OSD_CP_TYPE_RECT, RECT_LEVEL2_SCENE_ANIM_RECT_NORMAL};
    Hv_Mw_OsdAnimGetCompRange(sCp, &stRangeParam);
    AnimRangeParam *pstUserParam2 = HV_MALLOC_OBJECT(AnimRangeParam);
    HV_ASSERT_VALID_PTR_VOID(pstUserParam2);
    pstUserParam2->usX = stRangeParam.usX;
    pstUserParam2->usY = stRangeParam.usY;
    pstUserParam2->usWidth = stRangeParam.usWidth;
    pstUserParam2->usHeight = stRangeParam.usHeight;

    stAnimParam.usDelayTime = 36;
    stAnimParam.usDurationTime = 72;
    stAnimParam.usStart = stRangeParam.usWidth;
    stAnimParam.usEnd = 0;
    stAnimParam.ucElementType = sCp.enType;
    stAnimParam.usId = sCp.usIndex;
    stAnimParam.ucOperateType = ANIM_SIZE_LR_COLLAPSE;
    stAnimParam.UserParam = pstUserParam2;
    stAnimParam.ExecuteCbFn = Hv_Mw_OsdAnimUpdateCompSize;
    stAnimParam.FinishCbFn = Hv_App_OsdMainMenuEnterS3AnimFinish;
    pstAnimNode = Hv_Mw_OsdAnimCreate(&stAnimParam);
    HV_ASSERT_VALID_PTR_VOID(pstAnimNode);
    OSD_LOG_INFO("Scene-%d animition3 create2.width=%d.", ucSceneId, pstAnimNode->usEnd);

    Hv_Mw_OsdAnimUpdateCompSize(pstAnimNode);
}

VOID Hv_App_OsdMainMenuEnterS3AnimPrepare(VOID)
{
    USHORT16 usFirstItem = s_usLastFocusMainItem;
    USHORT16 usChild = ITEM_NONE_ID;

    OsdTimingInfo *pstTiming = Hv_App_OsdGetCurrentTimingInfo();
    HV_ASSERT_VALID_PTR_VOID(pstTiming);
    if ((!pstTiming->bSignalSync) && (!pstTiming->bSubSignalSync))
    {
        usFirstItem = ITEM_SOURCE_SCENE_MAIN;
    }

    //Hv_Mw_OsdItemSetState(Hv_Mw_OsdItemGetFocusing(), OSD_ITEM_FOCUS);
    Hv_Mw_OsdItemSetState(usFirstItem, OSD_ITEM_FOCUS);

    usChild = CHILD_ITEM(usFirstItem);
    Hv_Mw_OsdSetItemNumInPage(0);
    Hv_Mw_OsdItemShowList(usChild);
    Hv_App_OsdUpdateNavi(HV_FALSE);

    OSD_LOG_INFO("Show user menu step3");

    Hv_Mw_OsdSceneInit(SCENE_ANIM_RECT);
    Hv_Mw_OsdSceneShow(SCENE_ANIM_RECT);
}

static VOID Hv_App_OsdMainMenuEnterS2AnimFinish(OsdAnimitionParam *pstAnimParam)
{
    Hv_App_OsdMainMenuEnterS3AnimPrepare();
    Hv_App_OsdMainMenuEnterS3AnimCreate(SCENE_MAIN);
}

static VOID Hv_App_OsdMainMenuEnterS2AnimCreate(UCHAR8 ucSceneId)
{
    HV_ASSERT_TRUE_VOID(ucSceneId < SCENE_ID_MAX);

    USHORT16 usFirstItem = s_usLastFocusMainItem;
    USHORT16 usChild = ITEM_NONE_ID;
    OsdTimingInfo *pstTiming = Hv_App_OsdGetCurrentTimingInfo();
    HV_ASSERT_VALID_PTR_VOID(pstTiming);
    if ((!pstTiming->bSignalSync) && (!pstTiming->bSubSignalSync))
    {
        usFirstItem = ITEM_SOURCE_SCENE_MAIN;
    }

    OsdAnimition *pstAnimNode = NULL;
    OsdAnimitionParam stAnimParam = {0};

    /* creat animition */
    stAnimParam.usDelayTime = 0;
    stAnimParam.usDurationTime = 36;
    stAnimParam.usStart = Hv_Mw_OsdItemGetStartIdInPage(usFirstItem);
    stAnimParam.usEnd = Hv_Mw_OsdItemGetEndIdInPage(usFirstItem);
    stAnimParam.ExecuteCbFn = Hv_Mw_OsdAnimUpdateItemSequence;
    stAnimParam.FinishCbFn = Hv_App_OsdMainMenuEnterS2AnimFinish;
    pstAnimNode = Hv_Mw_OsdAnimCreate(&stAnimParam);
    HV_ASSERT_VALID_PTR_VOID(pstAnimNode);
    OSD_LOG_DEBUG("Scene-%d animition2 create.", ucSceneId);

    Hv_Mw_OsdAnimUpdateItemSequence(pstAnimNode);
}

VOID Hv_App_OsdMainMenuEnterS2AnimPrepare(VOID)
{
    USHORT16 usFirstItem = 0;
    OsdTimingInfo *pstTiming = Hv_App_OsdGetCurrentTimingInfo();
    HV_ASSERT_VALID_PTR_VOID(pstTiming);
    if (pstTiming->bSignalSync || pstTiming->bSubSignalSync)
    {
        usFirstItem = s_usLastFocusMainItem;
    }
    else
    {
        usFirstItem = ITEM_SOURCE_SCENE_MAIN;
    }

    Hv_Mw_OsdItemFocus(usFirstItem);
    Hv_Mw_OsdItemSetState(usFirstItem, OSD_ITEM_NORMAL);

    Hv_Mw_OsdSetItemNumInPage(5);
    //Hv_Mw_OsdItemShowList(usFirstItem);

    //usChild = CHILD_ITEM(usFirstItem);
    //Hv_Mw_OsdSetItemNumInPage(0);
    //Hv_Mw_OsdItemShowList(usChild);
}

static VOID Hv_App_OsdMainMenuEnterS1AnimFinish(OsdAnimitionParam *pstAnimParam)
{
    if (NULL != pstAnimParam->UserParam)
    {
        OSD_LOG_INFO("Free user param.");
        AnimColorParam *pstUserParam = (AnimColorParam *)pstAnimParam->UserParam;
        HV_FREE_OBJECT(pstUserParam);
        pstAnimParam->UserParam = NULL;
    }

    Hv_App_OsdMainMenuEnterS2AnimPrepare();
    OSD_LOG_INFO("Show user menu step2");
    Hv_App_OsdMainMenuEnterS2AnimCreate(SCENE_MAIN);
}

static VOID Hv_App_OsdMainMenuEnterS1AnimCreate(UCHAR8 ucSceneId)
{
    HV_ASSERT_TRUE_VOID(ucSceneId < SCENE_ID_MAX);

    OsdAnimition *pstAnimNode = NULL;
    OsdAnimitionParam stAnimParam = {0};

#if 0
    OsdComponent stCp = {OSD_CP_TYPE_BMP, BMP_BACKGROUND_SCENE_MAIN_NORMAL};

    /* creat color animition */
    AnimColorParam *pstUserParam = HV_MALLOC_OBJECT(AnimColorParam);
    HV_ASSERT_VALID_PTR_VOID(pstUserParam);
    pstUserParam->uiStart = 0x382018;
    pstUserParam->uiEnd = INVALID_PARAM_UINT32;
    pstUserParam->ucPaletteLen = Hv_Mw_OsdAnimGetCompResourceSize(stCp); //16;
    pstUserParam->usOriginalPalette = Hv_Mw_OsdAnimGetCompPaletteOffset(stCp);
    pstUserParam->usNewPalette = 32;
    pstUserParam->ucPaletteType = ANIM_PALETTE_SHARED;
    OSD_LOG_DEBUG("Color uiStart = 0x%6x, uiEnd = 0x%6x, usOriginalPalette  = %d, usNewPalette  = %d, ucPaletteLen  = %d.",
                   pstUserParam->uiStart, pstUserParam->uiEnd, pstUserParam->usOriginalPalette, pstUserParam->usNewPalette, pstUserParam->ucPaletteLen);

    stAnimParam.usDelayTime = 0;
    stAnimParam.usDurationTime = 36;
    stAnimParam.usId = stCp.usIndex;
    stAnimParam.ucElementType = stCp.enType;
    stAnimParam.UserParam = pstUserParam;
    stAnimParam.ExecuteCbFn = Hv_Mw_OsdAnimUpdateBmpColor;
    stAnimParam.FinishCbFn = Hv_App_OsdMainMenuEnterS1AnimFinish;
    pstAnimNode = Hv_Mw_OsdAnimCreate(&stAnimParam);
    HV_ASSERT_VALID_PTR_VOID(pstAnimNode);
    OSD_LOG_INFO("Scene-%d animition1 create.", ucSceneId);

    Hv_Mw_OsdAnimUpdateBmpColor(pstAnimNode);
#else
    /* creat alpha animition */
    USHORT16 usUserTrans = Hv_App_GetOsdDataValue(E_USERDATA_MENUTRANSPARENCY);
    stAnimParam.usDelayTime = 0;
    stAnimParam.usDurationTime = 36;
    stAnimParam.usStart = 0;
    stAnimParam.usEnd = Hv_Mw_OsdAnimGetTransparency(usUserTrans, USERDATA_MENUTRANSPARENCY_MAX, 50);
    stAnimParam.usId = ucSceneId;
    stAnimParam.ucOperateType = OSD_UNIVERSAL_ALPHA_TYPE_ALL;
    stAnimParam.ExecuteCbFn = Hv_Mw_OsdAnimUpdateSceneAlpha;
    stAnimParam.FinishCbFn = Hv_App_OsdMainMenuEnterS1AnimFinish;
    pstAnimNode = Hv_Mw_OsdAnimCreate(&stAnimParam);
    HV_ASSERT_VALID_PTR_VOID(pstAnimNode);
    OSD_LOG_INFO("Scene-%d alpha animition create.stAnimParam.usEnd=%d", ucSceneId, stAnimParam.usEnd);

    Hv_Mw_OsdAnimUpdateSceneAlpha(pstAnimNode);
#endif
}

static VOID Hv_App_OsdMainMenuEnterS1AnimPrepare(VOID)
{
    USHORT16 usH = 0;
    USHORT16 usV = 0;
    USHORT16 usFrameRate = 0;
    UCHAR8 astTimingString[OSD_ASCII_STRING_LENGTH_MAX] = { 0 };
    UCHAR8 astFrameString[OSD_ASCII_STRING_LENGTH_MAX] = { 0 };
    USHORT16 usStringLength = 0;

    Hv_App_OsdHideAll();

    Hv_Mw_OsdSceneInit(SCENE_MAIN);
    Hv_Mw_OsdSceneShow(SCENE_MAIN);

#ifndef OSD_CHECK_DISABLE_BY_EACH_ITEM
    /* 检查并更新item置灰项 */
    Hv_App_CheckItemDisableState(); /* after scene init must update checking */
#endif

    Hv_Mw_OsdItemShow(ITEM_INPUT_VALUE_SCENE_MAIN);

    OsdTimingInfo *pstTiming = Hv_App_OsdGetCurrentTimingInfo();
    HV_ASSERT_VALID_PTR_VOID(pstTiming);
    if (pstTiming->bSignalSync || pstTiming->bSubSignalSync)
    {
        Hv_Mw_OsdItemShow(ITEM_MODE_VALUE_SCENE_MAIN);
        Hv_Mw_OsdItemShow(ITEM_HDR_SYNC_VALUE_SCENE_MAIN);
        Hv_Mw_OsdItemShow(ITEM_TIMING_SCENE_MAIN);
        if (pstTiming->bSignalSync)
        {
            usH = pstTiming->usHActive;
            usV = pstTiming->usVActive;
            usFrameRate = pstTiming->usFrameRate;
        }
        else
        {
            usH = pstTiming->usSubHActive;
            usV = pstTiming->usSubVActive;
            usFrameRate = pstTiming->usSubFrameRate;
        }
        if (pstTiming->bInterlacedMode)
        {
            usStringLength = HV_SNPRINTF(astTimingString, OSD_ASCII_STRING_LENGTH_MAX, "%dx%dI", usH, usV);
        }
        else
        {
            usStringLength = HV_SNPRINTF(astTimingString, OSD_ASCII_STRING_LENGTH_MAX, "%dx%d", usH, usV);
        }
        Hv_Mw_OsdDynamicAsciiStringUpdate(CUSTOMSTRING_TIMING_SCENE_MAIN_NORMAL, astTimingString, usStringLength);
        usStringLength = HV_SNPRINTF(astFrameString, OSD_ASCII_STRING_LENGTH_MAX, "%dHZ", usFrameRate);
        Hv_Mw_OsdDynamicAsciiStringUpdate(CUSTOMSTRING_FRAMERATE_SCENE_MAIN_NORMAL, astFrameString, usStringLength);

        if (pstTiming->bIsVrr)
        {
            /* 开始实时更新VRR下的刷新率显示 */
            Hv_Mw_OsdStartAutoRefreshTimer(SCENE_MAIN, HV_PROJECT_CONFIG_OSD_DEFAULT_REFRESH_PERIOD_MS);
        }
    }

    //Hv_App_OsdUpdateNavi(HV_FALSE);

}


/* Navi animition */
static VOID Hv_App_OsdNaviAnimFinish(OsdAnimitionParam *pstAnimParam)
{
    Hv_Mw_OsdSceneHide(SCENE_ANIM_NAVI);
    Hv_Mw_OsdSceneClear(SCENE_ANIM_NAVI);

    Hv_App_OsdMainMenuEnterS1AnimPrepare();
    OSD_LOG_INFO("Show user menu step1");
    Hv_App_OsdMainMenuEnterS1AnimCreate(SCENE_MAIN);
}

static VOID Hv_App_OsdNaviAnimCreate(UCHAR8 ucSceneId)
{
    HV_ASSERT_TRUE_VOID(ucSceneId < SCENE_ID_MAX);

    OsdAnimition *pstAnimNode = NULL;
    OsdAnimitionParam stAnimParam = {0};

    /* creat animition */
    stAnimParam.usDelayTime = 0;
    stAnimParam.usDurationTime = 36;
    stAnimParam.usStart = 0;
    stAnimParam.usEnd = Hv_Mw_OsdAnimGetCompNums(COMPONENT(OSD_CP_TYPE_BMP_LIST, IMAGELIST_1_SCENE_ANIM_NAVI_NORMAL)) - 1;
    stAnimParam.usId = IMAGELIST_1_SCENE_ANIM_NAVI_NORMAL;
    stAnimParam.ucElementType = OSD_CP_TYPE_BMP_LIST;
    stAnimParam.UserParam = NULL;
    stAnimParam.ExecuteCbFn = Hv_Mw_OsdAnimUpdateCompList;
    stAnimParam.FinishCbFn = Hv_App_OsdNaviAnimFinish;
    pstAnimNode = Hv_Mw_OsdAnimCreate(&stAnimParam);
    HV_ASSERT_VALID_PTR_VOID(pstAnimNode);
    OSD_LOG_INFO("Scene-%d animition create.", ucSceneId);

    Hv_Mw_OsdAnimUpdateCompList(pstAnimNode);
}

VOID Hv_App_OsdMainMenuEnter(VOID)
{
    Hv_App_OsdHideAll();
    Hv_Mw_OsdSceneInit(SCENE_ANIM_NAVI);
    Hv_Mw_OsdSceneShow(SCENE_ANIM_NAVI);

    OSD_LOG_INFO("Show navi menu");
    Hv_App_OsdNaviAnimCreate(SCENE_ANIM_NAVI);
}

#else

#if (HV_CONFIG_ON == HV_PROJECT_CONFIG_OSD_MARQUEE)
const static USHORT16 ausItemTextMap[] =
{
    TEXT_1_SCENE_MAIN_NORMAL,
    TEXT_2_SCENE_MAIN_NORMAL,
    TEXT_3_SCENE_MAIN_NORMAL,
    TEXT_4_SCENE_MAIN_NORMAL,
    TEXT_5_SCENE_MAIN_NORMAL,
    TEXT_15_SCENE_MAIN_NORMAL,
    TEXT_17_SCENE_MAIN_NORMAL,
    TEXT_19_SCENE_MAIN_NORMAL,
    TEXT_21_SCENE_MAIN_NORMAL,
};
static OsdAnimition *s_pstItemFocusingMarqueeAnim = NULL;

VOID Hv_App_CheckItemFontNeedMarquee(VOID)
{
    if (NULL != s_pstItemFocusingMarqueeAnim)
    {
        OSD_LOG_INFO("manual terminal");
        Hv_Mw_OsdAnimForceTerminal(s_pstItemFocusingMarqueeAnim);
        s_pstItemFocusingMarqueeAnim = NULL;
    }

    USHORT16 usItem = OSD_GET_FOCUSING();
    if ((usItem - ITEM_GAME_SCENE_MAIN) > 8)
    {
        return;
    }
    OsdComponent stCp = {OSD_CP_TYPE_TEXT, ausItemTextMap[usItem - ITEM_GAME_SCENE_MAIN]};
    Hv_Mw_OsdComponentInitMarquee(stCp);

    OsdAnimitionParam stAnimParam = {0};
    /* 创建动画 */
    stAnimParam.usDelayTime = 0;
    stAnimParam.usDurationTime = INVALID_PARAM_USHORT16;
    stAnimParam.ucElementType = OSD_CP_TYPE_TEXT;
    stAnimParam.usId = ausItemTextMap[usItem - ITEM_GAME_SCENE_MAIN];
    stAnimParam.ucOperateType = ANIM_MARQUEE;
    stAnimParam.ExecuteCbFn = Hv_Mw_OsdAnimUpdateMarquee;
    stAnimParam.FinishCbFn = Hv_Mw_OsdAnimFinishMarquee;

    s_pstItemFocusingMarqueeAnim = Hv_Mw_OsdAnimCreate(&stAnimParam);
    HV_ASSERT_VALID_PTR_VOID(s_pstItemFocusingMarqueeAnim);
}
#endif

VOID Hv_App_OsdMainMenuEnter(VOID)
{
    USHORT16 usFirstItem = s_usLastFocusMainItem;
    USHORT16 usChild = ITEM_NONE_ID;
    USHORT16 usH = 0;
    USHORT16 usV = 0;
    USHORT16 usFrameRate = 0;
    UCHAR8 astTimingString[OSD_ASCII_STRING_LENGTH_MAX] = { 0 };
    UCHAR8 astFrameString[OSD_ASCII_STRING_LENGTH_MAX] = { 0 };
    USHORT16 usStringLength = 0;

    Hv_App_OsdHideAll();

    Hv_Mw_OsdSceneInit(SCENE_MAIN);
    Hv_Mw_OsdSceneShow(SCENE_MAIN);

    Hv_Mw_OsdItemShow(ITEM_INPUT_VALUE_SCENE_MAIN);

    OsdTimingInfo *pstTiming = Hv_App_OsdGetCurrentTimingInfo();
    HV_ASSERT_VALID_PTR_VOID(pstTiming);

    if (pstTiming->bSignalSync || pstTiming->bSubSignalSync)
    {
        Hv_Mw_OsdItemFocus(usFirstItem);

        Hv_Mw_OsdSetItemNumInPage(5);
        Hv_Mw_OsdItemShowListAlign(usFirstItem);

        usChild = CHILD_ITEM(usFirstItem);
        Hv_Mw_OsdSetItemNumInPage(0);
        Hv_Mw_OsdItemShowList(usChild);

        Hv_Mw_OsdItemShow(ITEM_MODE_VALUE_SCENE_MAIN);
        Hv_Mw_OsdItemShow(ITEM_HDR_SYNC_VALUE_SCENE_MAIN);
        Hv_Mw_OsdItemShow(ITEM_TIMING_SCENE_MAIN);
        if (pstTiming->bSignalSync)
        {
            usH = pstTiming->usHActive;
            usV = pstTiming->usVActive;
            usFrameRate = pstTiming->usFrameRate;
        }
        else
        {
            usH = pstTiming->usSubHActive;
            usV = pstTiming->usSubVActive;
            usFrameRate = pstTiming->usSubFrameRate;
        }
        if (pstTiming->bInterlacedMode)
        {
            usStringLength = HV_SNPRINTF(astTimingString, OSD_ASCII_STRING_LENGTH_MAX, "%dx%dI", usH, usV);
        }
        else
        {
            usStringLength = HV_SNPRINTF(astTimingString, OSD_ASCII_STRING_LENGTH_MAX, "%dx%d", usH, usV);
        }
        Hv_Mw_OsdDynamicAsciiStringUpdate(CUSTOMSTRING_TIMING_SCENE_MAIN_NORMAL, astTimingString, usStringLength);
        usStringLength = HV_SNPRINTF(astFrameString, OSD_ASCII_STRING_LENGTH_MAX, "%dHZ", usFrameRate);
        Hv_Mw_OsdDynamicAsciiStringUpdate(CUSTOMSTRING_FRAMERATE_SCENE_MAIN_NORMAL, astFrameString, usStringLength);

        if (pstTiming->bIsVrr)
        {
            /* 开始实时更新VRR下的刷新率显示 */
            Hv_Mw_OsdStartAutoRefreshTimer(SCENE_MAIN, HV_PROJECT_CONFIG_OSD_DEFAULT_REFRESH_PERIOD_MS);
        }
    }
    else
    {
        usFirstItem = ITEM_SOURCE_SCENE_MAIN;
        Hv_Mw_OsdItemFocus(usFirstItem);

        Hv_Mw_OsdSetItemNumInPage(5);
        Hv_Mw_OsdItemShowListAlign(usFirstItem);

        usChild = CHILD_ITEM(usFirstItem);
        Hv_Mw_OsdSetItemNumInPage(0);
        Hv_Mw_OsdItemShowList(usChild);
    }

    Hv_App_OsdUpdateNavi(HV_FALSE);

    Hv_Mw_OsdSetKeyRepeatPeriod(OSD_DEFAULT_KEY_REPEAT_PERIOD_MS);
    Hv_Mw_OsdSetKeyState(OSDEVT_KEY_UP, KEY_STATE_REPEATABLE, HV_TRUE);
    Hv_Mw_OsdSetKeyState(OSDEVT_KEY_DOWN, KEY_STATE_REPEATABLE, HV_TRUE);

    OSD_LOG_INFO("Show user menu");
}
#endif

VOID Hv_App_OsdMainMenuExit(VOID)
{
    Hv_Mw_OsdStopAutoRefreshTimer(SCENE_MAIN);

    Hv_Mw_OsdSetKeyState(OSDEVT_KEY_UP, KEY_STATE_REPEATABLE, HV_FALSE);
    Hv_Mw_OsdSetKeyState(OSDEVT_KEY_DOWN, KEY_STATE_REPEATABLE, HV_FALSE);

    Hv_Mw_OsdItemFocusClear();
    Hv_Mw_OsdSceneHide(SCENE_MAIN);
    Hv_Mw_OsdSceneClear(SCENE_MAIN);
}

VOID Hv_App_OsdUpdatePage(VOID)
{
    static USHORT16 usPageIconShowing = INVALID_PARAM_USHORT16;
    USHORT16 usItem = OSD_GET_FOCUSING();
    if (ITEM_NONE_ID == usItem)
    {
        usPageIconShowing = INVALID_PARAM_USHORT16;
        return;
    }
    USHORT16 usLevel = Hv_Mw_OsdItemGetLevel(usItem);
    UCHAR8 ucCurPage = 1;
    UCHAR8 ucTotalPageNum = 1;

    if (0 == usPageIconShowing)
    {
        Hv_Mw_OsdComponentHide(COMPONENT(OSD_CP_TYPE_ICON, ICON_PAGE_UP_0_SCENE_MAIN_NORMAL));
        Hv_Mw_OsdComponentHide(COMPONENT(OSD_CP_TYPE_ICON, ICON_PAGE_DOWN_0_SCENE_MAIN_NORMAL));
    }
    else if (1 == usPageIconShowing)
    {
        Hv_Mw_OsdComponentHide(COMPONENT(OSD_CP_TYPE_ICON, ICON_PAGE_UP_1_SCENE_MAIN_NORMAL));
        Hv_Mw_OsdComponentHide(COMPONENT(OSD_CP_TYPE_ICON, ICON_PAGE_DOWN_1_SCENE_MAIN_NORMAL));
    }
    else if (INVALID_PARAM_USHORT16 != usPageIconShowing)
    {
        Hv_Mw_OsdComponentHide(COMPONENT(OSD_CP_TYPE_ICON, ICON_PAGE_UP_2_SCENE_MAIN_NORMAL));
        Hv_Mw_OsdComponentHide(COMPONENT(OSD_CP_TYPE_ICON, ICON_PAGE_DOWN_2_SCENE_MAIN_NORMAL));
    }

    if (0 == usLevel)
    {
        Hv_Mw_OsdSetItemNumInPage(5);
        Hv_Mw_OsdItemGetPageAlign(usItem, &ucCurPage, &ucTotalPageNum);
        Hv_Mw_OsdSetItemNumInPage(0);
        if (ucTotalPageNum > 1)
        {
            if (ucCurPage == 1)
            {
                Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_ICON, ICON_PAGE_DOWN_0_SCENE_MAIN_NORMAL));
            }
            else if (ucCurPage == ucTotalPageNum)
            {
                Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_ICON, ICON_PAGE_UP_0_SCENE_MAIN_NORMAL));
            }
            else
            {
                Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_ICON, ICON_PAGE_UP_0_SCENE_MAIN_NORMAL));
                Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_ICON, ICON_PAGE_DOWN_0_SCENE_MAIN_NORMAL));
            }
        }
    }
    else if (1 == usLevel)
    {
        Hv_Mw_OsdSetItemNumInPage(0);
        Hv_Mw_OsdItemGetPage(usItem, &ucCurPage, &ucTotalPageNum);
        if (ucTotalPageNum > 1)
        {
            if (ucCurPage == 1)
            {
                Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_ICON, ICON_PAGE_DOWN_1_SCENE_MAIN_NORMAL));
            }
            else if (ucCurPage == ucTotalPageNum)
            {
                Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_ICON, ICON_PAGE_UP_1_SCENE_MAIN_NORMAL));
            }
            else
            {
                Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_ICON, ICON_PAGE_UP_1_SCENE_MAIN_NORMAL));
                Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_ICON, ICON_PAGE_DOWN_1_SCENE_MAIN_NORMAL));
            }
        }
    }
    else
    {
        Hv_Mw_OsdSetItemNumInPage(0);
        Hv_Mw_OsdItemGetPage(usItem, &ucCurPage, &ucTotalPageNum);
        if (ucTotalPageNum > 1)
        {
            if (ucCurPage == 1)
            {
                Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_ICON, ICON_PAGE_DOWN_2_SCENE_MAIN_NORMAL));
            }
            else if (ucCurPage == ucTotalPageNum)
            {
                Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_ICON, ICON_PAGE_UP_2_SCENE_MAIN_NORMAL));
            }
            else
            {
                Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_ICON, ICON_PAGE_UP_2_SCENE_MAIN_NORMAL));
                Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_ICON, ICON_PAGE_DOWN_2_SCENE_MAIN_NORMAL));
            }
        }
    }
    usPageIconShowing = usLevel;
}

static const VOID (*apfCustomKeyFunctionMap[])(VOID) =
{
    Hv_App_OsdInputMenuEnter,
    Hv_App_OsdModeMenuEnter,
    Hv_App_OsdBrightnessAdjustMenuEnter,
    Hv_App_OsdCrosshairAdjustMenuEnter,
    Hv_App_OsdVolumeAdjustMenuEnter,
};

static VOID Hv_App_OsdMenuNone(VOID)
{
    OsdTimingInfo *pstTiming = Hv_App_OsdGetCurrentTimingInfo();

    s_bQuickEnter = HV_FALSE;
    s_bIsAdjusting = HV_FALSE;

    if ((!pstTiming->bSignalSync) && (!pstTiming->bSubSignalSync))
    {
        OSD_LOG_INFO("No signal, just show input menu");
        Hv_App_OsdInputMenuEnter();
        return;
    }

    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        case OSDEVT_KEY_EXIT:
        case OSDEVT_KEY_LEFT:
        {
            Hv_App_OsdMainMenuEnter();
            break;
        }
        case OSDEVT_KEY_UP:
        case OSDEVT_KEY_HOTKEY1:
        {
            USHORT16 usKey = Hv_App_GetOsdDataValue(E_USERDATA_CUSTOM_KEY1);
            HV_ASSERT_TRUE_VOID(usKey < ARRAY_SIZE(apfCustomKeyFunctionMap));
            s_bQuickEnter = HV_TRUE;
            apfCustomKeyFunctionMap[usKey]();
            break;
        }
        case OSDEVT_KEY_DOWN:
        case OSDEVT_KEY_HOTKEY2:
        {
            USHORT16 usKey = Hv_App_GetOsdDataValue(E_USERDATA_CUSTOM_KEY2);
            HV_ASSERT_TRUE_VOID(usKey < ARRAY_SIZE(apfCustomKeyFunctionMap));
            s_bQuickEnter = HV_TRUE;
            apfCustomKeyFunctionMap[usKey]();
            break;
        }
        default:
        {
            break;
        }
    }
}

VOID Hv_App_OsdMenuResetAutoCloseTimer(VOID)
{
    USHORT16 usTimeOut = Hv_App_OsdGetMenuTime();
    if (0 == usTimeOut)
    {
        Hv_Mw_OsdStopAutoCloseTimer(SCENE_MAIN);
    }
    else
    {
        Hv_Mw_OsdStartAutoCloseTimer(SCENE_MAIN, usTimeOut);
    }
}

VOID Hv_App_OsdUpdateSystemInfo(VOID)
{
    UCHAR8 aucStringModel[] = HV_PROJECT_CONFIG_FACTORY_SCALER_MODE;
    Hv_Mw_OsdDynamicAsciiStringUpdate(CUSTOMSTRING_MODEL_SCENE_MAIN_NORMAL, aucStringModel, strlen(aucStringModel));
    OSD_LOG_DEBUG("Model = %s", aucStringModel);

    UCHAR8 ucLen = strlen(Hv_Common_Db_GetFactoryDataDBRegionPtr()->acProductSn);
    Hv_Mw_OsdDynamicAsciiStringUpdate(CUSTOMSTRING_SN_SCENE_MAIN_NORMAL, Hv_Common_Db_GetFactoryDataDBRegionPtr()->acProductSn, ucLen);
    OSD_LOG_DEBUG("SN = %s", Hv_Common_Db_GetFactoryDataDBRegionPtr()->acProductSn);

    UCHAR8 aucStringVersion[OSD_ASCII_STRING_LENGTH_MAX] = { 0 };
    USHORT16 usStringLength = 0;
    usStringLength = Hv_App_OsdSetFirmwareVersionString(aucStringVersion);   //HV_PROJECT_CONFIG_FACTORY_FW_VERSION
    Hv_Mw_OsdDynamicAsciiStringUpdate(CUSTOMSTRING_VERSION_SCENE_MAIN_NORMAL, aucStringVersion, usStringLength);
    OSD_LOG_DEBUG("Version = %s", aucStringVersion);

    UCHAR8 aucStringCheckSum[OSD_ASCII_STRING_LENGTH_MAX] = { 0 };
    UINT32 uiCheckSum = Hv_Comm_GetCodeVersion();
    usStringLength = HV_SNPRINTF(aucStringCheckSum, OSD_ASCII_STRING_LENGTH_MAX, "0x%x", uiCheckSum);
    Hv_Mw_OsdDynamicAsciiStringUpdate(CUSTOMSTRING_CHECKSUM_SCENE_MAIN_NORMAL, aucStringCheckSum, usStringLength);
    OSD_LOG_DEBUG("CheckSum = %s", aucStringCheckSum);
}

VOID Hv_App_OsdMenuOperation(USHORT16 usValue)
{
    const OsdItemProp* pstItemProp = OSD_GET_ITEM_PROP(OSD_GET_FOCUSING());
    OsdTimingInfo *pstTiming = Hv_App_OsdGetCurrentTimingInfo();
    s_bAdjustingNoNeedRedraw = HV_FALSE;

    if (UD_MENULOCK_V_ON == Hv_App_GetOsdDataValue(E_USERDATA_MENULOCK))
    {
        Hv_App_OsdLockEnter(HV_TRUE);
        return;
    }

    if (NULL == pstItemProp)
    {
        Hv_App_OsdMenuNone();
    }
    else if (pstItemProp->pfMenuOpsHandle)
    {
        OSD_LOG_DEBUG("Call MenuOperationFunction-%d", pstItemProp->usItemId);
        pstItemProp->pfMenuOpsHandle();
    }
    else
    {
        OSD_LOG_WARN("Item-%d has no MenuOperationHandle", pstItemProp->usItemId);
        return;
    }

    if ((!pstTiming->bSignalSync) && (!pstTiming->bSubSignalSync))
    {
        /* Notify ChannelManager to reset standby timer */
        Hv_Mw_Channel_SetOSDActive(HV_TRUE);
    }

#if (HV_PROJECT_CONFIG_OSD_ROTATION == HV_CONFIG_ON)
    if (UD_ROTATION_V_OFF != Hv_App_GetOsdDataValue(E_USERDATA_ROTATION))
    {
        if (!s_bAdjustingNoNeedRedraw)
        {
            Hv_Mw_OsdOpsForceRedraw(HV_TRUE);
        }
    }
#endif

    if (Hv_Mw_OsdSceneIsShowing(SCENE_FACTORY))
    {
        Hv_Mw_OsdStopAutoCloseTimer(SCENE_MAIN);
        return;
    }

    if (!s_bIsAdjusting)
    {
        if (Hv_Mw_OsdSceneIsShowing(SCENE_MAIN))
        {
            /* 显示并更新页码 */
            Hv_App_OsdUpdatePage();
        }
        Hv_Mw_OsdSetKeyRepeatPeriod(OSD_DEFAULT_KEY_REPEAT_PERIOD_MS);
    }
    else
    {
        Hv_Mw_OsdSetKeyRepeatPeriod(OSD_ADJUST_KEY_REPEAT_PERIOD_MS);
    }

    if (ITEM_SYSTEM_SCENE_MAIN == OSD_GET_FOCUSING())
    {
        Hv_App_OsdUpdateSystemInfo();
    }

#ifndef OSD_CHECK_DISABLE_BY_EACH_ITEM
    /* 检查并更新item置灰项 */
    Hv_App_CheckItemDisableState();
#endif

#if (HV_CONFIG_ON == HV_PROJECT_CONFIG_OSD_MARQUEE)
    //Hv_App_CheckItemFontNeedMarquee();
#endif

    Hv_App_OsdMenuResetAutoCloseTimer();
}

/* Common Menu Function Defination Begin */
static VOID Hv_App_OsdOpsLevel1FocusPrev(VOID)
{
    UCHAR8 ucCurPage0 = 0;
    UCHAR8 ucCurPage1 = 0;
    UCHAR8 ucTotalPageNum = 1;
    USHORT16 usItem = OSD_GET_FOCUSING();
    USHORT16 usChild = CHILD_ITEM(usItem);

    Hv_Mw_OsdItemHideList(usChild);

    USHORT16 usNewFocusItem = Hv_Mw_OsdItemFocusPrev();
    Hv_Mw_OsdSetItemNumInPage(5);
    Hv_Mw_OsdItemGetPageAlign(usItem, &ucCurPage0, &ucTotalPageNum);
    Hv_Mw_OsdItemGetPageAlign(usNewFocusItem, &ucCurPage1, &ucTotalPageNum);
    /* 翻页处理 */
    if (ucCurPage0 != ucCurPage1)
    {
        Hv_Mw_OsdItemHideListAlign(usItem);
        Hv_Mw_OsdItemShowListAlign(usNewFocusItem);
    }

    Hv_Mw_OsdSetItemNumInPage(0);
    usChild = CHILD_ITEM(usNewFocusItem);
    Hv_Mw_OsdItemShowList(usChild);

    Hv_Mw_OsdOpsForceRedraw(HV_TRUE);
    s_usLastFocusMainItem = OSD_GET_FOCUSING();
}

static VOID Hv_App_OsdOpsLevel1FocusNext(VOID)
{
    UCHAR8 ucCurPage0 = 0;
    UCHAR8 ucCurPage1 = 0;
    UCHAR8 ucTotalPageNum = 1;
    USHORT16 usItem = OSD_GET_FOCUSING();
    USHORT16 usChild = CHILD_ITEM(usItem);

    Hv_Mw_OsdItemHideList(usChild);

    USHORT16 usNewFocusItem = Hv_Mw_OsdItemFocusNext();
    Hv_Mw_OsdSetItemNumInPage(5);
    Hv_Mw_OsdItemGetPageAlign(usItem, &ucCurPage0, &ucTotalPageNum);
    Hv_Mw_OsdItemGetPageAlign(usNewFocusItem, &ucCurPage1, &ucTotalPageNum);
    /* 翻页处理 */
    if (ucCurPage0 != ucCurPage1)
    {
        Hv_Mw_OsdItemHideListAlign(usItem);
        Hv_Mw_OsdItemShowListAlign(usNewFocusItem);
    }

    Hv_Mw_OsdSetItemNumInPage(0);
    usChild = CHILD_ITEM(usNewFocusItem);
    Hv_Mw_OsdItemShowList(usChild);

    Hv_Mw_OsdOpsForceRedraw(HV_TRUE);
    s_usLastFocusMainItem = OSD_GET_FOCUSING();
}

static VOID Hv_App_OsdOpsLevel1FocusChild(VOID)
{
    USHORT16 usItemLevel1 = OSD_GET_FOCUSING();
    USHORT16 usItem = Hv_Mw_OsdItemFocusChild();
    USHORT16 usChild = CHILD_ITEM(usItem);

    /* 新focus的item不在当前显示的页（第一页全部disabled） */
    if (usItem >= CHILD_ITEM(usItemLevel1) +  Hv_Mw_OsdGetItemNumInPage())
    {
        Hv_Mw_OsdItemHideList(CHILD_ITEM(usItemLevel1));
        Hv_Mw_OsdItemShowList(usItem);
    }
    Hv_Mw_OsdItemShowSelectedList(usChild);

    /* 有多个Child，即：select list */
    if (NEXT_ITEM(usChild) != usChild)
    {
        if (ITEM_SYSTEM_RESET_SCENE_MAIN != usItem)
        {
            usChild = Hv_Mw_OsdItemUpdateSelectList(usChild);
        }
    }
    Hv_Mw_OsdItemShowList(usChild);
}

static VOID Hv_App_OsdOpsLevel2FocusParent(VOID)
{
    UCHAR8 ucCurPage = 0;
    UCHAR8 ucTotalPageNum = 1;
    USHORT16 usItem = OSD_GET_FOCUSING();
    USHORT16 usChild = CHILD_ITEM(usItem);
    USHORT16 usNewFocusItem = Hv_Mw_OsdItemFocusParent();

    Hv_Mw_OsdItemHideSelectedList(usChild);

    Hv_Mw_OsdItemGetPage(usItem, &ucCurPage, &ucTotalPageNum);
    if (ucCurPage != 1)
    {
        /* 显示第一页的item list */
        Hv_Mw_OsdItemHideList(usItem);
        Hv_Mw_OsdItemShowList(CHILD_ITEM(usNewFocusItem));
    }
}

static VOID Hv_App_OsdOpsLevel2FocusPrev(VOID)
{
    UCHAR8 ucCurPage0 = 0;
    UCHAR8 ucCurPage1 = 0;
    UCHAR8 ucTotalPageNum = 1;

    USHORT16 usItem = OSD_GET_FOCUSING();
    Hv_Mw_OsdItemGetPage(usItem, &ucCurPage0, &ucTotalPageNum);

    /* 聚焦到上一个item */
    USHORT16 usNewFocusItem = Hv_Mw_OsdItemFocusPrev();
    Hv_Mw_OsdItemHideSelectedList(CHILD_ITEM(usItem));
    Hv_Mw_OsdItemShowSelectedList(CHILD_ITEM(usNewFocusItem));
    /* 有多个Child，即：select list */
    if (NEXT_ITEM(CHILD_ITEM(usNewFocusItem)) != CHILD_ITEM(usNewFocusItem))
    {
        if (ITEM_SYSTEM_RESET_SCENE_MAIN != usNewFocusItem)
        {
            Hv_Mw_OsdItemUpdateSelectList(CHILD_ITEM(usNewFocusItem));
        }
    }

    /* 翻页处理 */
    Hv_Mw_OsdItemGetPage(usNewFocusItem, &ucCurPage1, &ucTotalPageNum);

    if (ucCurPage0 != ucCurPage1)
    {
        Hv_Mw_OsdItemHideList(usItem);
        Hv_Mw_OsdItemShowList(usNewFocusItem);
    }
}

static VOID Hv_App_OsdOpsLevel2FocusNext(VOID)
{
    UCHAR8 ucCurPage0 = 0;
    UCHAR8 ucCurPage1 = 0;
    UCHAR8 ucTotalPageNum = 1;

    USHORT16 usItem = OSD_GET_FOCUSING();
    Hv_Mw_OsdItemGetPage(usItem, &ucCurPage0, &ucTotalPageNum);

    /* 聚焦到下一个item */
    USHORT16 usNewFocusItem = Hv_Mw_OsdItemFocusNext();
    Hv_Mw_OsdItemHideSelectedList(CHILD_ITEM(usItem));
    Hv_Mw_OsdItemShowSelectedList(CHILD_ITEM(usNewFocusItem));
    /* 有多个Child，即：select list */
    if (NEXT_ITEM(CHILD_ITEM(usNewFocusItem)) != CHILD_ITEM(usNewFocusItem))
    {
        if (ITEM_SYSTEM_RESET_SCENE_MAIN != usNewFocusItem)
        {
            Hv_Mw_OsdItemUpdateSelectList(CHILD_ITEM(usNewFocusItem));
        }
    }

    /* 翻页处理 */
    Hv_Mw_OsdItemGetPage(usNewFocusItem, &ucCurPage1, &ucTotalPageNum);

    if (ucCurPage0 != ucCurPage1)
    {
        Hv_Mw_OsdItemHideList(usItem);
        Hv_Mw_OsdItemShowList(usNewFocusItem);
    }
}

static VOID Hv_App_OsdOpsLevel2FocusChild(VOID)
{
    Hv_Mw_OsdItemFocusChild();
}

static VOID Hv_App_OsdOpsLevel2FocusChildSelect(VOID)
{
    Hv_Mw_OsdItemFocusChildSelect();
}

static VOID Hv_App_OsdOpsLevel2SetSwitch(VOID)
{
    USHORT16 usItem = OSD_GET_FOCUSING();

    Hv_Mw_OsdAdjustFunction(OSD_GET_USERDATA(usItem), ACT_INCREASE, 1, SET_ALL);
    Hv_Mw_OsdItemShowList(usItem);
}

static VOID Hv_App_OsdOpsLevel3AdjustFocusParent(VOID)
{
    USHORT16 usItem = Hv_Mw_OsdItemFocusParent();
    Hv_Mw_OsdItemShowList(usItem);
}

static VOID Hv_App_OsdItemLevel3AdjustIncrease(VOID)
{
    USHORT16 usItem = OSD_GET_FOCUSING();
    /* 更新对应userdata */
    Hv_Mw_OsdAdjustFunction(OSD_GET_USERDATA(usItem), ACT_INCREASE, 1, SET_ALL);
    /* 更新显示当前聚焦item */
    Hv_Mw_OsdItemShow(usItem);
    s_bAdjustingNoNeedRedraw = HV_TRUE;
}

static VOID Hv_App_OsdItemLevel3AdjustDecrease(VOID)
{
    USHORT16 usItem = OSD_GET_FOCUSING();
    /* 更新对应userdata */
    Hv_Mw_OsdAdjustFunction(OSD_GET_USERDATA(usItem), ACT_DECREASE, 1, SET_ALL);
    /* 更新显示当前聚焦item */
    Hv_Mw_OsdItemShow(usItem);
    s_bAdjustingNoNeedRedraw = HV_TRUE;
}

static VOID Hv_App_OsdOpsLevel3ListFocusParent(VOID)
{
    Hv_Mw_OsdItemFocusParent();
}

static VOID Hv_App_OsdOpsLevel3ListFocusPrev(VOID)
{
    UCHAR8 ucCurPage0 = 0;
    UCHAR8 ucCurPage1 = 0;
    UCHAR8 ucTotalPageNum = 1;

    USHORT16 usItem = OSD_GET_FOCUSING();
    Hv_Mw_OsdItemGetPage(usItem, &ucCurPage0, &ucTotalPageNum);

    /* 聚焦到下一个item */
    USHORT16 usNewFocusItem = Hv_Mw_OsdItemFocusPrev();

    /* 翻页处理 */
    Hv_Mw_OsdItemGetPage(usNewFocusItem, &ucCurPage1, &ucTotalPageNum);

    if (ucCurPage0 != ucCurPage1)
    {
        Hv_Mw_OsdItemHideList(usItem);
        Hv_Mw_OsdItemShowList(usNewFocusItem);
        Hv_Mw_OsdItemUpdateSelectList(usNewFocusItem);
    }
}

static VOID Hv_App_OsdOpsLevel3ListFocusNext(VOID)
{
    UCHAR8 ucCurPage0 = 0;
    UCHAR8 ucCurPage1 = 0;
    UCHAR8 ucTotalPageNum = 1;

    USHORT16 usItem = OSD_GET_FOCUSING();
    Hv_Mw_OsdItemGetPage(usItem, &ucCurPage0, &ucTotalPageNum);

    /* 聚焦到下一个item */
    USHORT16 usNewFocusItem = Hv_Mw_OsdItemFocusNext();

    /* 翻页处理 */
    Hv_Mw_OsdItemGetPage(usNewFocusItem, &ucCurPage1, &ucTotalPageNum);

    if (ucCurPage0 != ucCurPage1)
    {
        Hv_Mw_OsdItemHideList(usItem);
        Hv_Mw_OsdItemShowList(usNewFocusItem);
        Hv_Mw_OsdItemUpdateSelectList(usNewFocusItem);
    }
}

static VOID Hv_App_OsdOpsLevel3Select(VOID)
{
    USHORT16 usItem = OSD_GET_FOCUSING();
    SHORT16 sValue = Hv_Mw_OsdItemSelect(usItem);
    Hv_Mw_OsdAdjustFunction(OSD_GET_USERDATA(usItem), ACT_SET, sValue, SET_ALL);
    Hv_Mw_OsdItemShowList(PARENT_ITEM(usItem));
}

static VOID Hv_App_OsdOpsLevel3ListFocusParentRecover(VOID)
{
    USHORT16 usItem = OSD_GET_FOCUSING();

    Hv_Mw_SetFromOsdUserdata(OSD_GET_USERDATA(usItem));

    Hv_App_OsdOpsLevel3ListFocusParent();
}

static VOID Hv_App_OsdOpsLevel3ListFocusPrevPreview(VOID)
{
    Hv_App_OsdOpsLevel3ListFocusPrev();

    USHORT16 usItem = OSD_GET_FOCUSING();

    /* 获取item在select list中的偏移，作为userdata的值 */
    USHORT16 usValue = Hv_Mw_OsdItemGetBias(usItem);

    /* 更新userdata */
    Hv_Mw_OsdAdjustFunction(OSD_GET_USERDATA(usItem), ACT_SET, usValue, SET_INTERFACE);
}

static VOID Hv_App_OsdOpsLevel3ListFocusNextPreview(VOID)
{
    Hv_App_OsdOpsLevel3ListFocusNext();

    USHORT16 usItem = OSD_GET_FOCUSING();

    /* 获取item在select list中的偏移，作为userdata的值 */
    USHORT16 usValue = Hv_Mw_OsdItemGetBias(usItem);

    /* 更新userdata */
    Hv_Mw_OsdAdjustFunction(OSD_GET_USERDATA(usItem), ACT_SET, usValue, SET_INTERFACE);
}

static VOID Hv_App_OsdOpsLevel4ListFocusParent(VOID)
{
    USHORT16 usItem = OSD_GET_FOCUSING();
    Hv_Mw_OsdItemHideList(usItem);
    usItem = Hv_Mw_OsdItemFocusParent();
    Hv_Mw_OsdItemShowList(usItem);
    Hv_Mw_OsdItemUpdateSelectList(usItem);
}

static VOID Hv_App_OsdItemLevel4AdjustIncrease(VOID)
{
    Hv_App_OsdItemLevel3AdjustIncrease();
}

static VOID Hv_App_OsdItemLevel4AdjustDecrease(VOID)
{
    Hv_App_OsdItemLevel3AdjustDecrease();
}

static VOID Hv_App_OsdOpsLevel1(VOID)
{
    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        {
            Hv_App_OsdOpsLevel1FocusChild();
            Hv_App_OsdUpdateNavi(HV_FALSE);
            break;
        }
        case OSDEVT_KEY_UP:
        {
            Hv_App_OsdOpsLevel1FocusPrev();
            break;
        }
        case OSDEVT_KEY_DOWN:
        {
            Hv_App_OsdOpsLevel1FocusNext();
            break;
        }
        case OSDEVT_KEY_EXIT:
        case OSDEVT_KEY_LEFT:
        {
            Hv_App_OsdMainMenuExit();
            break;
        }
        default:
        {
            break;
        }
    }
}

static VOID Hv_App_OsdOpsLevel2ToAdjust(VOID)
{
    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        {
            Hv_App_OsdOpsLevel2FocusChild();
            s_bIsAdjusting = HV_TRUE;
            Hv_App_OsdUpdateNavi(HV_TRUE);
            break;
        }
        case OSDEVT_KEY_UP:
        {
            Hv_App_OsdOpsLevel2FocusPrev();
            Hv_App_OsdUpdateNavi(HV_FALSE);
            break;
        }
        case OSDEVT_KEY_DOWN:
        {
            Hv_App_OsdOpsLevel2FocusNext();
            Hv_App_OsdUpdateNavi(HV_FALSE);
            break;
        }
        case OSDEVT_KEY_EXIT:
        case OSDEVT_KEY_LEFT:
        {
            Hv_App_OsdOpsLevel2FocusParent();
            Hv_App_OsdUpdateNavi(HV_FALSE);
            break;
        }
        default:
        {
            break;
        }
    }
}

static VOID Hv_App_OsdOpsLevel2ToList(VOID)
{
    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        {
            Hv_App_OsdOpsLevel2FocusChildSelect();
            Hv_App_OsdUpdateNavi(HV_FALSE);
            break;
        }
        case OSDEVT_KEY_UP:
        {
            Hv_App_OsdOpsLevel2FocusPrev();
            Hv_App_OsdUpdateNavi(HV_FALSE);
            break;
        }
        case OSDEVT_KEY_DOWN:
        {
            Hv_App_OsdOpsLevel2FocusNext();
            Hv_App_OsdUpdateNavi(HV_FALSE);
            break;
        }
        case OSDEVT_KEY_EXIT:
        case OSDEVT_KEY_LEFT:
        {
            Hv_App_OsdOpsLevel2FocusParent();
            Hv_App_OsdUpdateNavi(HV_FALSE);
            break;
        }
        default:
        {
            break;
        }
    }
}

static VOID Hv_App_OsdOpsLevel2Switch(VOID)
{
    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        {
            Hv_App_OsdOpsLevel2SetSwitch();
            break;
        }
        case OSDEVT_KEY_UP:
        {
            Hv_App_OsdOpsLevel2FocusPrev();
            Hv_App_OsdUpdateNavi(HV_FALSE);
            break;
        }
        case OSDEVT_KEY_DOWN:
        {
            Hv_App_OsdOpsLevel2FocusNext();
            Hv_App_OsdUpdateNavi(HV_FALSE);
            break;
        }
        case OSDEVT_KEY_EXIT:
        case OSDEVT_KEY_LEFT:
        {
            Hv_App_OsdOpsLevel2FocusParent();
            Hv_App_OsdUpdateNavi(HV_FALSE);
            break;
        }
        default:
        {
            break;
        }
    }
}

static VOID Hv_App_OsdOpsLevel3Adjust(VOID)
{
    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        {
            Hv_App_OsdOpsLevel3AdjustFocusParent();
            s_bIsAdjusting = HV_FALSE;
            Hv_App_OsdUpdateNavi(HV_FALSE);
            break;
        }
        case OSDEVT_KEY_UP:
        {
            Hv_App_OsdItemLevel3AdjustIncrease();
            break;
        }
        case OSDEVT_KEY_DOWN:
        {
            Hv_App_OsdItemLevel3AdjustDecrease();
            break;
        }
        case OSDEVT_KEY_EXIT:
        case OSDEVT_KEY_LEFT:
        {
            Hv_App_OsdOpsLevel3AdjustFocusParent();
            s_bIsAdjusting = HV_FALSE;
            Hv_App_OsdUpdateNavi(HV_FALSE);
            break;
        }
        default:
        {
            break;
        }
    }
}

static VOID Hv_App_OsdOpsLevel3List(VOID)
{
    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        {
            Hv_App_OsdOpsLevel3Select();
            break;
        }
        case OSDEVT_KEY_UP:
        {
            Hv_App_OsdOpsLevel3ListFocusPrev();
            break;
        }
        case OSDEVT_KEY_DOWN:
        {
            Hv_App_OsdOpsLevel3ListFocusNext();
            break;
        }
        case OSDEVT_KEY_EXIT:
        case OSDEVT_KEY_LEFT:
        {
            Hv_App_OsdOpsLevel3ListFocusParent();
            Hv_App_OsdUpdateNavi(HV_FALSE);
            break;
        }
        default:
        {
            break;
        }
    }
}

static VOID Hv_App_OsdOpsLevel3ListPreview(VOID)
{
    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        {
            Hv_App_OsdOpsLevel3Select();
            break;
        }
        case OSDEVT_KEY_UP:
        {
            Hv_App_OsdOpsLevel3ListFocusPrevPreview();
            break;
        }
        case OSDEVT_KEY_DOWN:
        {
            Hv_App_OsdOpsLevel3ListFocusNextPreview();
            break;
        }
        case OSDEVT_KEY_EXIT:
        case OSDEVT_KEY_LEFT:
        {
            Hv_App_OsdOpsLevel3ListFocusParentRecover();
            Hv_App_OsdUpdateNavi(HV_FALSE);
            break;
        }
        default:
        {
            break;
        }
    }
}

static VOID Hv_App_OsdOpsLevel4Adjust(VOID)
{
    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        {
            Hv_Mw_OsdItemFocusNext();
            break;
        }
        case OSDEVT_KEY_UP:
        {
            Hv_App_OsdItemLevel4AdjustIncrease();
            break;
        }
        case OSDEVT_KEY_DOWN:
        {
            Hv_App_OsdItemLevel4AdjustDecrease();
            break;
        }
        case OSDEVT_KEY_EXIT:
        case OSDEVT_KEY_LEFT:
        {
            Hv_App_OsdOpsLevel4ListFocusParent();
            s_bIsAdjusting = HV_FALSE;
            Hv_App_OsdUpdateNavi(HV_FALSE);
            break;
        }
        default:
        {
            break;
        }
    }
}

/* Common Menu Function Defination End */

/* Menu Operation Handle Defination Begin */

VOID Hv_App_OsdItemBrightnessAdjust_MenuBrightness_SceneBrightness(VOID)
{
    USHORT16 usItem = OSD_GET_FOCUSING();

    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        case OSDEVT_KEY_EXIT:
        case OSDEVT_KEY_LEFT:
        {
            Hv_App_OsdBrightnessAdjustMenuExit();
            break;
        }
        case OSDEVT_KEY_UP:
        {
            Hv_Mw_OsdAdjustFunction(OSD_GET_USERDATA(usItem), ACT_INCREASE,
                                       1, SET_ALL);
            Hv_Mw_OsdItemShow(usItem);
            s_bAdjustingNoNeedRedraw = HV_TRUE;
            break;
        }
        case OSDEVT_KEY_DOWN:
        {
            Hv_Mw_OsdAdjustFunction(OSD_GET_USERDATA(usItem), ACT_DECREASE,
                                       1, SET_ALL);
            Hv_Mw_OsdItemShow(usItem);
            s_bAdjustingNoNeedRedraw = HV_TRUE;
            break;
        }
        default:
        {
            break;
        }
    }
}

VOID Hv_App_OsdItemCrosshairAdjust_MenuCrosshair_SceneCrosshairAdjust(VOID)
{
    USHORT16 usItem = OSD_GET_FOCUSING();

    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        case OSDEVT_KEY_EXIT:
        case OSDEVT_KEY_LEFT:
        {
            Hv_App_OsdCrosshairAdjustMenuExit();
            break;
        }
        case OSDEVT_KEY_UP:
        {
            Hv_Mw_OsdAdjustFunction(OSD_GET_USERDATA(usItem), ACT_INCREASE,
                                       1, SET_ALL);
            Hv_Mw_OsdItemShow(usItem);
            break;
        }
        case OSDEVT_KEY_DOWN:
        {
            Hv_Mw_OsdAdjustFunction(OSD_GET_USERDATA(usItem), ACT_DECREASE,
                                       1, SET_ALL);
            Hv_Mw_OsdItemShow(usItem);
            break;
        }
        default:
        {
            break;
        }
    }
}

VOID Hv_App_OsdItemVolumeAdjust_MenuVolume_SceneVolume(VOID)
{
    USHORT16 usItem = OSD_GET_FOCUSING();

    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        case OSDEVT_KEY_EXIT:
        case OSDEVT_KEY_LEFT:
        {
            Hv_App_OsdVolumeAdjustMenuExit();
            break;
        }
        case OSDEVT_KEY_UP:
        {
            Hv_Mw_OsdAdjustFunction(OSD_GET_USERDATA(usItem), ACT_INCREASE,
                                       1, SET_ALL);
            Hv_Mw_OsdItemShow(usItem);
            s_bAdjustingNoNeedRedraw = HV_TRUE;
            break;
        }
        case OSDEVT_KEY_DOWN:
        {
            Hv_Mw_OsdAdjustFunction(OSD_GET_USERDATA(usItem), ACT_DECREASE,
                                       1, SET_ALL);
            Hv_Mw_OsdItemShow(usItem);
            s_bAdjustingNoNeedRedraw = HV_TRUE;
            break;
        }
        default:
        {
            break;
        }
    }
}

VOID Hv_App_OsdItemModeAdjust_MenuMode_SceneMode(VOID)
{
    USHORT16 usItem = OSD_GET_FOCUSING();

    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        case OSDEVT_KEY_EXIT:
        case OSDEVT_KEY_LEFT:
        {
            Hv_App_OsdModeMenuExit();
            break;
        }
        case OSDEVT_KEY_UP:
        {
            Hv_Mw_OsdAdjustFunction(OSD_GET_USERDATA(usItem), ACT_INCREASE,
                                       1, SET_ALL);
            Hv_Mw_OsdItemShow(usItem);
            break;
        }
        case OSDEVT_KEY_DOWN:
        {
            Hv_Mw_OsdAdjustFunction(OSD_GET_USERDATA(usItem), ACT_DECREASE,
                                       1, SET_ALL);
            Hv_Mw_OsdItemShow(usItem);
            break;
        }
        default:
        {
            break;
        }
    }
}

VOID Hv_App_OsdItemInputAdjust_MenuInput_SceneInput(VOID)
{
    USHORT16 usItem = OSD_GET_FOCUSING();
    USHORT16 usUserdata = OSD_GET_USERDATA(usItem);

    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        {
            Hv_Mw_SetFromOsdUserdata(usUserdata);
            Hv_App_OsdInputMenuExit();
            break;
        }
        case OSDEVT_KEY_UP:
        {
            Hv_Mw_OsdAdjustFunction(usUserdata, ACT_INCREASE, 1, SET_OSDDATA);
            Hv_Mw_OsdItemShow(usItem);
            break;
        }
        case OSDEVT_KEY_DOWN:
        {
            Hv_Mw_OsdAdjustFunction(usUserdata, ACT_DECREASE, 1, SET_OSDDATA);
            Hv_Mw_OsdItemShow(usItem);
            break;
        }
        case OSDEVT_KEY_EXIT:
        case OSDEVT_KEY_LEFT:
        {
            Hv_Mw_OsdUserdataUpdate(usUserdata);
            Hv_App_OsdInputMenuExit();
            break;
        }
        default:
        {
            break;
        }
    }
}

VOID Hv_App_OsdItemGame_MenuMain_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel1();
}

VOID Hv_App_OsdItemPicture_MenuMain_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel1();
}

VOID Hv_App_OsdItemColor_MenuMain_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel1();
}

VOID Hv_App_OsdItemSource_MenuMain_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel1();
}

VOID Hv_App_OsdItemAudio_MenuMain_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel1();
}

VOID Hv_App_OsdItemPxp_MenuMain_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel1();
}

VOID Hv_App_OsdItemOsd_MenuMain_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel1();
}

VOID Hv_App_OsdItemSystem_MenuMain_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel1();
}

VOID Hv_App_OsdItemAmbiLight_MenuMain_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel1();
}

VOID Hv_App_OsdItemPictureBoost_MenuMain_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel1();
}

VOID Hv_App_OsdItemDarkgain_MenuGame_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2ToAdjust();
}

VOID Hv_App_OsdItemResponseTime_MenuGame_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2ToList();
}

VOID Hv_App_OsdItemMprt_MenuGame_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2Switch();
}

VOID Hv_App_OsdItemFreesync_MenuGame_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2Switch();
}

VOID Hv_App_OsdItemCrosshair_MenuGame_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2ToList();
}

VOID Hv_App_OsdItemDynCrosshair_MenuGame_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2Switch();
}

VOID Hv_App_OsdItemScope_MenuGame_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2ToList();
}

VOID Hv_App_OsdItemRefreshRate_MenuGame_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2Switch();
}

VOID Hv_App_OsdItemTimeCounter_MenuGame_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2ToList();
}

VOID Hv_App_OsdItemVrrGamma_MenuGame_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2Switch();
}

VOID Hv_App_OsdItemMode_MenuPicture_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2ToList();
}

VOID Hv_App_OsdItemBrightness_MenuPicture_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2ToAdjust();
}

VOID Hv_App_OsdItemContrast_MenuPicture_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2ToAdjust();
}

VOID Hv_App_OsdItemDcr_MenuPicture_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2Switch();
}

VOID Hv_App_OsdItemDynBacklight_MenuPicture_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2Switch();
}

VOID Hv_App_OsdItemSharpness_MenuPicture_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2ToAdjust();
}

VOID Hv_App_OsdItemDisplaySize_MenuPicture_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2ToList();
}

VOID Hv_App_OsdItemLdr_MenuPicture_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2ToList();
}

VOID Hv_App_OsdItemHdr_MenuPicture_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2ToList();
}

VOID Hv_App_OsdItemGamma_MenuPicture_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2ToList();
}

VOID Hv_App_OsdItemLocaldimming_MenuPicture_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2ToList();
}

VOID Hv_App_OsdItemHue_MenuColor_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2ToAdjust();
}

VOID Hv_App_OsdItemSaturation_MenuColor_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2ToAdjust();
}

VOID Hv_App_OsdItemColorTemp_MenuColor_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2ToList();
}

VOID Hv_App_OsdItemColorSpace_MenuColor_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2ToList();
}

VOID Hv_App_OsdItemColorFilter_MenuColor_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2ToList();
}

VOID Hv_App_OsdItemLowBlueLight_MenuColor_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2ToList();
}

VOID Hv_App_OsdItemInputSource_MenuSource_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2ToList();
}

VOID Hv_App_OsdItemAutoSelect_MenuSource_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2Switch();
}

VOID Hv_App_OsdItemHdmiFormat_MenuSource_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2ToList();
}

VOID Hv_App_OsdItemAllm_MenuSource_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2Switch();
}

VOID Hv_App_OsdItemQms_MenuSource_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2Switch();
}

VOID Hv_App_OsdItemDpVersion_MenuSource_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2ToList();
}

VOID Hv_App_OsdItemMute_MenuAudio_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2Switch();
}

VOID Hv_App_OsdItemVolume_MenuAudio_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2ToAdjust();
}

VOID Hv_App_OsdItemAudioTimeDelay_MenuAudio_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2ToAdjust();
}

VOID Hv_App_OsdItemPxpMode_MenuPxp_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2ToList();
}

VOID Hv_App_OsdItemPxpSwitch_MenuPxp_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2Switch();
}

VOID Hv_App_OsdItemSubSource_MenuPxp_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2ToList();
}

VOID Hv_App_OsdItemAudioSource_MenuPxp_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2ToList();
}

VOID Hv_App_OsdItemPipSize_MenuPxp_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2ToList();
}

VOID Hv_App_OsdItemPipPosition_MenuPxp_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2ToList();
}

VOID Hv_App_OsdItemLanguage_MenuOsd_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2ToList();
}

VOID Hv_App_OsdItemHPosition_MenuOsd_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2ToAdjust();
}

VOID Hv_App_OsdItemVPosition_MenuOsd_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2ToAdjust();
}

VOID Hv_App_OsdItemOsdTime_MenuOsd_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2ToList();
}

VOID Hv_App_OsdItemTransparency_MenuOsd_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2ToAdjust();
}

VOID Hv_App_OsdItemRotation_MenuOsd_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2ToList();
}

VOID Hv_App_OsdItemMenuLock_MenuOsd_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2Switch();

    if ((OSDEVT_KEY_ENTER == Hv_Mw_OsdGetKeyValue()) || (OSDEVT_KEY_RIGHT == Hv_Mw_OsdGetKeyValue()))
    {
        Hv_App_OsdMainMenuExit();
        Hv_App_OsdLockEnter(HV_TRUE);
        Hv_Mw_OsdAdjustFunction(E_USERDATA_MENULOCK, ACT_SET, UD_MENULOCK_V_ON, SET_ALL);
    }
}

VOID Hv_App_OsdItemKey1_MenuOsd_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2ToList();
}

VOID Hv_App_OsdItemKey2_MenuOsd_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2ToList();
}

VOID Hv_App_OsdItemLightMode_MenuAmbiLight_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2ToList();
}

VOID Hv_App_OsdItemLightColor_MenuAmbiLight_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2ToList();
}

VOID Hv_App_OsdItemSystemReset_MenuSystem_SceneMain(VOID)
{
    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        {
            Hv_App_OsdOpsLevel2FocusChild();
            Hv_App_OsdUpdateNavi(HV_FALSE);
            break;
        }
        default:
        {
            Hv_App_OsdOpsLevel2ToList();
            break;
        }
    }
}

VOID Hv_App_OsdItemPowerLed_MenuSystem_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2Switch();
}

VOID Hv_App_OsdItemOta_MenuSystem_SceneMain(VOID)
{
    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        {
            Hv_App_OsdOtaEnter();
#ifdef CONFIG_USER_USB_OTA_ON
            OSD_LOG_INFO("OTA update begin");
            Hv_Mw_SendEvtToUsb(USB_EVENT_NORMAL_UPGRADE, 0);
#endif
            break;
        }
        default:
        {
            Hv_App_OsdOpsLevel2ToList();
            break;
        }
    }
}

VOID Hv_App_OsdItemFactory_MenuSystem_SceneMain(VOID)
{
    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        {
            Hv_App_OsdFactoryMenuEnter();
            break;
        }
        default:
        {
            Hv_App_OsdOpsLevel2ToList();
            break;
        }
    }
}

VOID Hv_App_OsdItemBrightFrame_MenuPictureBoost_SceneMain(VOID)
{
    if ((OSDEVT_KEY_ENTER == Hv_Mw_OsdGetKeyValue()) || (OSDEVT_KEY_RIGHT == Hv_Mw_OsdGetKeyValue()))
    {
        Hv_App_OsdSetBypassDialog();
    }
    Hv_App_OsdOpsLevel2Switch();
#if 0
    if ((OSDEVT_KEY_ENTER == Hv_Mw_OsdGetKeyValue()) || (OSDEVT_KEY_RIGHT == Hv_Mw_OsdGetKeyValue()))
    {
        Hv_Mw_OsdItemShowList(OSD_GET_FOCUSING());
        if (UD_BRIGHT_FRAME_V_ON == Hv_App_GetOsdDataValue(E_USERDATA_BRIGHT_FRAME))
        {
            Hv_App_OsdBrightFrameWinEnter();
        }
        else
        {
            Hv_App_OsdBrightFrameWinExit();
        }
    }
#endif
}
VOID Hv_App_OsdItemFrameSize_MenuPictureBoost_SceneMain(VOID)
{
    if ((OSDEVT_KEY_ENTER == Hv_Mw_OsdGetKeyValue()) || (OSDEVT_KEY_RIGHT == Hv_Mw_OsdGetKeyValue()))
    {
        /* keep key repeat time 200ms once */
        Hv_App_OsdOpsLevel2FocusChild();
        Hv_App_OsdUpdateNavi(HV_TRUE);
    }
    else
    {
        Hv_App_OsdOpsLevel2ToAdjust();
    }
}
VOID Hv_App_OsdItemBfBrightness_MenuPictureBoost_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2ToAdjust();
}
VOID Hv_App_OsdItemBfContrast_MenuPictureBoost_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2ToAdjust();
}
VOID Hv_App_OsdItemBfHpos_MenuPictureBoost_SceneMain(VOID)
{
    if ((OSDEVT_KEY_ENTER == Hv_Mw_OsdGetKeyValue()) || (OSDEVT_KEY_RIGHT == Hv_Mw_OsdGetKeyValue()))
    {
        /* keep key repeat time 200ms once */
        Hv_App_OsdOpsLevel2FocusChild();
        Hv_App_OsdUpdateNavi(HV_TRUE);
    }
    else
    {
        Hv_App_OsdOpsLevel2ToAdjust();
    }
}
VOID Hv_App_OsdItemBfVpos_MenuPictureBoost_SceneMain(VOID)
{
    if ((OSDEVT_KEY_ENTER == Hv_Mw_OsdGetKeyValue()) || (OSDEVT_KEY_RIGHT == Hv_Mw_OsdGetKeyValue()))
    {
        /* keep key repeat time 200ms once */
        Hv_App_OsdOpsLevel2FocusChild();
        Hv_App_OsdUpdateNavi(HV_TRUE);
    }
    else
    {
        Hv_App_OsdOpsLevel2ToAdjust();
    }
}

VOID Hv_App_OsdItemResponseTimeNormal_MenuResponseTime_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemResponseTimeFast_MenuResponseTime_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemResponseTimeVeryfast_MenuResponseTime_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemDarkgainAdjust_MenuDarkgain_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3Adjust();
}

VOID Hv_App_OsdItemBrightnessAdjust_MenuBrightness_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3Adjust();
}

VOID Hv_App_OsdItemContrastAdjust_MenuContrast_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3Adjust();
}

VOID Hv_App_OsdItemSharpnessAdjust_MenuSharpness_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3Adjust();
}

VOID Hv_App_OsdItemHueAdjust_MenuHue_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3Adjust();
}

VOID Hv_App_OsdItemSaturationAdjust_MenuSaturation_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3Adjust();
}

VOID Hv_App_OsdItemVolumeAdjust_MenuVolume_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3Adjust();
}

VOID Hv_App_OsdItemAudioTimeDelayAdjust_MenuAudioTimeDelay_SceneMain(VOID)
{
    USHORT16 usItem = OSD_GET_FOCUSING();

    if (OSDEVT_KEY_UP == Hv_Mw_OsdGetKeyValue())
    {
        Hv_Mw_OsdAdjustFunction(OSD_GET_USERDATA(usItem), ACT_INCREASE, 50, SET_ALL);
        Hv_Mw_OsdItemShow(usItem);
        s_bAdjustingNoNeedRedraw = HV_TRUE;
    }
    else if (OSDEVT_KEY_DOWN == Hv_Mw_OsdGetKeyValue())
    {
        Hv_Mw_OsdAdjustFunction(OSD_GET_USERDATA(usItem), ACT_DECREASE, 50, SET_ALL);
        Hv_Mw_OsdItemShow(usItem);
        s_bAdjustingNoNeedRedraw = HV_TRUE;
    }
    else
    {
        Hv_App_OsdOpsLevel3Adjust();
    }
}

VOID Hv_App_OsdItemHPositionAdjust_MenuHPosition_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3Adjust();
}

VOID Hv_App_OsdItemVPositionAdjust_MenuVPosition_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3Adjust();
}

VOID Hv_App_OsdItemTransparencyAdjust_MenuTransparency_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3Adjust();
}

VOID Hv_App_OsdItemCrosshairNone_MenuCrosshair_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemCrosshairStyle1_MenuCrosshair_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemCrosshairStyle2_MenuCrosshair_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemCrosshairStyle3_MenuCrosshair_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemTimeCounterOff_MenuTimeCounter_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();

    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        {
            Hv_Mw_OsdAdjustFunction(E_USERDATA_TIME_COUNTER, ACT_SET, UD_TIME_COUNTER_V_OFF, SET_ALL);
            Hv_Mw_OsdStopAutoRefreshTimer(SCENE_TIMER);
            Hv_App_OsdTimeCounterExit();
            break;
        }
        default:
        {
            break;
        }
    }
}

VOID Hv_App_OsdItemTimeCounter_10_MenuTimeCounter_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();

    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        {
            Hv_Mw_OsdStopAutoRefreshTimer(SCENE_TIMER);
            Hv_App_OsdTimeCounterSetTime(10 * 60);
            break;
        }
        default:
        {
            break;
        }
    }
}

VOID Hv_App_OsdItemTimeCounter_30_MenuTimeCounter_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();

    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        {
            Hv_Mw_OsdStopAutoRefreshTimer(SCENE_TIMER);
            Hv_App_OsdTimeCounterSetTime(30 * 60);
            break;
        }
        default:
        {
            break;
        }
    }
}

VOID Hv_App_OsdItemTimeCounter_60_MenuTimeCounter_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();

    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        {
            Hv_Mw_OsdStopAutoRefreshTimer(SCENE_TIMER);
            Hv_App_OsdTimeCounterSetTime(60 * 60);
            break;
        }
        default:
        {
            break;
        }
    }
}

VOID Hv_App_OsdItemTimeCounter_90_MenuTimeCounter_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();

    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        {
            Hv_Mw_OsdStopAutoRefreshTimer(SCENE_TIMER);
            Hv_App_OsdTimeCounterSetTime(90 * 60);
            break;
        }
        default:
        {
            break;
        }
    }
}

VOID Hv_App_OsdItemModeStandard_MenuMode_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3ListPreview();

    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        {
            Hv_Mw_OsdItemShow(ITEM_MODE_VALUE_SCENE_MAIN);
            break;
        }
        default:
        {
            break;
        }
    }
}

VOID Hv_App_OsdItemModeGame_MenuMode_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3ListPreview();

    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        {
            Hv_Mw_OsdItemShow(ITEM_MODE_VALUE_SCENE_MAIN);
            break;
        }
        default:
        {
            break;
        }
    }
}

VOID Hv_App_OsdItemModeMovie_MenuMode_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3ListPreview();

    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        {
            Hv_Mw_OsdItemShow(ITEM_MODE_VALUE_SCENE_MAIN);
            break;
        }
        default:
        {
            break;
        }
    }
}

VOID Hv_App_OsdItemModeOffice_MenuMode_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3ListPreview();

    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        {
            Hv_Mw_OsdItemShow(ITEM_MODE_VALUE_SCENE_MAIN);
            break;
        }
        default:
        {
            break;
        }
    }
}

VOID Hv_App_OsdItemModeCustom_MenuMode_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3ListPreview();

    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        {
            Hv_Mw_OsdItemShow(ITEM_MODE_VALUE_SCENE_MAIN);
            break;
        }
        default:
        {
            break;
        }
    }
}

VOID Hv_App_OsdItemDisplaySizeAuto_MenuDisplaySize_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemDisplaySize_16x9_MenuDisplaySize_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemDisplaySize_4x3_MenuDisplaySize_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemLdrAuto_MenuLdr_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3ListPreview();
}

VOID Hv_App_OsdItemLdrLimit_MenuLdr_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3ListPreview();
}

VOID Hv_App_OsdItemLdrFull_MenuLdr_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3ListPreview();
}

VOID Hv_App_OsdItemHdrOff_MenuHdr_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemHdrAuto_MenuHdr_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemGamma_1_6_MenuGamma_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3ListPreview();
}

VOID Hv_App_OsdItemGamma_1_8_MenuGamma_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3ListPreview();
}

VOID Hv_App_OsdItemGamma_2_0_MenuGamma_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3ListPreview();
}

VOID Hv_App_OsdItemGamma_2_2_MenuGamma_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3ListPreview();
}

VOID Hv_App_OsdItemGamma_2_4_MenuGamma_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3ListPreview();
}

VOID Hv_App_OsdItemGamma_2_6_MenuGamma_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3ListPreview();
}

VOID Hv_App_OsdItemColorTempCool_MenuColorTemp_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3ListPreview();
}

VOID Hv_App_OsdItemColorTempStandard_MenuColorTemp_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3ListPreview();
}

VOID Hv_App_OsdItemColorTempWarm_MenuColorTemp_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3ListPreview();
}

VOID Hv_App_OsdItemColorTempCustom_MenuColorTemp_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3ListPreview();

    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        {
            USHORT16 usItem = OSD_GET_FOCUSING();
            Hv_Mw_OsdItemHideList(usItem);
            Hv_Mw_OsdItemShowList(CHILD_ITEM(usItem));
            Hv_Mw_OsdItemFocusChild();
            Hv_App_OsdUpdateNavi(HV_TRUE);
            s_bIsAdjusting = HV_TRUE;
            break;
        }
        default:
        {
            break;
        }
    }
}

VOID Hv_App_OsdItemColorSpaceNative_MenuColorSpace_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3ListPreview();
}

VOID Hv_App_OsdItemColorSpaceSrgb_MenuColorSpace_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3ListPreview();
}

VOID Hv_App_OsdItemColorSpaceBt709_MenuColorSpace_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3ListPreview();
}

VOID Hv_App_OsdItemColorSpaceDcip3_MenuColorSpace_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3ListPreview();
}

VOID Hv_App_OsdItemColorSpaceAdobergb_MenuColorSpace_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3ListPreview();
}

VOID Hv_App_OsdItemColorFilterOff_MenuColorFilter_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemColorFilterInvert_MenuColorFilter_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemColorFilterGray_MenuColorFilter_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemColorFilterProtanopia_MenuColorFilter_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemColorFilterDeuteranopia_MenuColorFilter_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemColorFilterTrianopia_MenuColorFilter_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemLowBlueLightOff_MenuLowBlueLight_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3ListPreview();
}

VOID Hv_App_OsdItemLowBlueLightLevel1_MenuLowBlueLight_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3ListPreview();
}

VOID Hv_App_OsdItemLowBlueLightLevel2_MenuLowBlueLight_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3ListPreview();
}

VOID Hv_App_OsdItemLowBlueLightLevel3_MenuLowBlueLight_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3ListPreview();
}

VOID Hv_App_OsdItemLowBlueLightLevel4_MenuLowBlueLight_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3ListPreview();
}

VOID Hv_App_OsdItemInputSourceHdmi1_MenuInputSource_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();

    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        {
            Hv_Mw_OsdItemShow(ITEM_INPUT_VALUE_SCENE_MAIN);
            break;
        }
        default:
        {
            break;
        }
    }
}

VOID Hv_App_OsdItemInputSourceHdmi2_MenuInputSource_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();

    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        {
            Hv_Mw_OsdItemShow(ITEM_INPUT_VALUE_SCENE_MAIN);
            break;
        }
        default:
        {
            break;
        }
    }
}

VOID Hv_App_OsdItemInputSourceUsbc_MenuInputSource_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();

    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        {
            Hv_Mw_OsdItemShow(ITEM_INPUT_VALUE_SCENE_MAIN);
            break;
        }
        default:
        {
            break;
        }
    }
}

VOID Hv_App_OsdItemInputSourceDp_MenuInputSource_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();

    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        {
            Hv_Mw_OsdItemShow(ITEM_INPUT_VALUE_SCENE_MAIN);
            break;
        }
        default:
        {
            break;
        }
    }
}

VOID Hv_App_OsdItemHdmiFormatStandard_MenuHdmiFormat_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemHdmiFormatEnhance_MenuHdmiFormat_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemPxpModeOff_MenuPxpMode_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemPxpModePip_MenuPxpMode_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemPxpModePbp_MenuPxpMode_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemSubSourceHdmi1_MenuSubSource_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemSubSourceHdmi2_MenuSubSource_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemSubSourceUsbc_MenuSubSource_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemSubSourceDp_MenuSubSource_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemAudioSourceMain_MenuAudioSource_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemAudioSourceSub_MenuAudioSource_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemPipSizeSmall_MenuPipSize_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemPipSizeBig_MenuPipSize_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemPipPositionLefttop_MenuPipPosition_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemPipPositionLeftbottom_MenuPipPosition_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemPipPositionRighttop_MenuPipPosition_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemPipPositionRightbottom_MenuPipPosition_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemLanguageCn_MenuLanguage_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemLanguageEn_MenuLanguage_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemRotationOff_MenuRotation_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemRotation_90_MenuRotation_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemRotation_180_MenuRotation_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemRotation_270_MenuRotation_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemKey1Input_MenuKey1_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemKey1Mode_MenuKey1_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemKey1Brightness_MenuKey1_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemKey1Crosshair_MenuKey1_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemKey1Volume_MenuKey1_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemKey2Input_MenuKey2_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemKey2Mode_MenuKey2_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemKey2Brightness_MenuKey2_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemKey2Crosshair_MenuKey2_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemKey2Volume_MenuKey2_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemRed_MenuColorTempRgb_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel4Adjust();
}

VOID Hv_App_OsdItemGreen_MenuColorTempRgb_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel4Adjust();
}

VOID Hv_App_OsdItemBlue_MenuColorTempRgb_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel4Adjust();
}

VOID Hv_App_OsdItemSystemResetNo_MenuSystemReset_SceneMain(VOID)
{
    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        case OSDEVT_KEY_EXIT:
        case OSDEVT_KEY_LEFT:
        {
            Hv_App_OsdOpsLevel3ListFocusParent();
            break;
        }
        case OSDEVT_KEY_UP:
        {
            Hv_App_OsdOpsLevel3ListFocusPrev();
            break;
        }
        case OSDEVT_KEY_DOWN:
        {
            Hv_App_OsdOpsLevel3ListFocusNext();
            break;
        }
        default:
        {
            break;
        }
    }
}

VOID Hv_App_OsdItemSystemResetYes_MenuSystemReset_SceneMain(VOID)
{
    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        {
            Hv_App_ResetToFactorySetting();
            Hv_App_OsdHideAll();
            s_usLastFocusMainItem = ITEM_GAME_SCENE_MAIN;
            break;
        }
        case OSDEVT_KEY_UP:
        {
            Hv_App_OsdOpsLevel3ListFocusPrev();
            break;
        }
        case OSDEVT_KEY_DOWN:
        {
            Hv_App_OsdOpsLevel3ListFocusNext();
            break;
        }
        case OSDEVT_KEY_EXIT:
        case OSDEVT_KEY_LEFT:
        {
            Hv_App_OsdOpsLevel3ListFocusParent();
            break;
        }
        default:
        {
            break;
        }
    }
}

VOID Hv_App_OsdItemOsdTime_5_MenuOsdTime_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemOsdTime_10_MenuOsdTime_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemOsdTime_20_MenuOsdTime_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemOsdTime_30_MenuOsdTime_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemOsdTime_60_MenuOsdTime_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemOsdTimePersist_MenuOsdTime_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemLightOff_MenuLightMode_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemFollowVideo_MenuLightMode_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemFollowAudio_MenuLightMode_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemMonoLight_MenuLightMode_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemMarquee_MenuLightMode_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemAutoLight_MenuLightMode_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemLightColorRed_MenuLightColor_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemLightColorOrange_MenuLightColor_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemLightColorYellow_MenuLightColor_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemLightColorGreen_MenuLightColor_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemLightColorCyan_MenuLightColor_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemLightColorBlue_MenuLightColor_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemLightColorPurple_MenuLightColor_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemScopeOff_MenuScope_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemScope_1_2x_MenuScope_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemScope_1_5x_MenuScope_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemScope_2_0x_MenuScope_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemDp1_1_MenuDpVersion_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemDp1_2_MenuDpVersion_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemDp1_4_MenuDpVersion_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemLocaldimmingOff_MenuLocalDimming_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemLocaldimmingLow_MenuLocalDimming_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemLocaldimmingMiddle_MenuLocalDimming_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemLocaldimmingHigh_MenuLocalDimming_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemFrameSizeAdjust_MenuBfFramesize_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3Adjust();
#if (HV_CONFIG_ON == HV_PROJECT_CONFIG_OSD_BRIGHT_FRAME)
    if ((OSDEVT_KEY_UP == Hv_Mw_OsdGetKeyValue()) || (OSDEVT_KEY_DOWN == Hv_Mw_OsdGetKeyValue()))
    {
        Hv_Mw_OsdAdjustFunction(E_USERDATA_BF_HPOS, ACT_SET, 0, SET_ALL);
        Hv_Mw_OsdAdjustFunction(E_USERDATA_BF_VPOS, ACT_SET, 0, SET_ALL);
    }
#endif
}
VOID Hv_App_OsdItemBfBrightnessAdjust_MenuBfBrightness_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3Adjust();
}
VOID Hv_App_OsdItemBfContrastAdjust_MenuBfContrast_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3Adjust();
}
VOID Hv_App_OsdItemBfHposAdjust_MenuBfHpos_SceneMain(VOID)
{
#if (HV_CONFIG_ON == HV_PROJECT_CONFIG_OSD_BRIGHT_FRAME)
        if (OSDEVT_KEY_UP == Hv_Mw_OsdGetKeyValue())
        {
            USHORT16 usOsdValue = Hv_App_GetOsdDataValue(E_USERDATA_BF_HPOS);
            USHORT16 usOsdValueMax = GET_OSD_MAP_VALUE(E_USERDATA_BF_HPOS, Hv_App_OsdGetBFHPosMaxLimited());
            if ((usOsdValue + 1) > usOsdValueMax)
            {
                return;
            }
            else
            {
                Hv_App_OsdItemLevel3AdjustIncrease();
            }
        }
        else
#endif
        {
            Hv_App_OsdOpsLevel3Adjust();
        }
}
VOID Hv_App_OsdItemBfVposAdjust_MenuBfVpos_SceneMain(VOID)
{
#if (HV_CONFIG_ON == HV_PROJECT_CONFIG_OSD_BRIGHT_FRAME)
    if (OSDEVT_KEY_UP == Hv_Mw_OsdGetKeyValue())
    {
        USHORT16 usOsdValue = Hv_App_GetOsdDataValue(E_USERDATA_BF_VPOS);
        USHORT16 usOsdValueMax = GET_OSD_MAP_VALUE(E_USERDATA_BF_VPOS, Hv_App_OsdGetBFVPosMaxLimited());
        if ((usOsdValue + 1) > usOsdValueMax)
        {
            return;
        }
        else
        {
            Hv_App_OsdItemLevel3AdjustIncrease();
        }
    }
    else
#endif
    {
        Hv_App_OsdOpsLevel3Adjust();
    }
}

VOID Hv_App_OsdItemYes_ItemlistProceed_SceneOta(VOID)
{
    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        {
#ifdef CONFIG_USER_USB_OTA_ON
            Hv_Mw_SendEvtToUsb(USB_EVENT_UPGRADE_CONFIRM, 0);
            Hv_App_OsdOtaEnter();
#endif
            break;
        }
        case OSDEVT_KEY_UP:
        {
            Hv_Mw_OsdItemFocusPrev();
            break;
        }
        case OSDEVT_KEY_DOWN:
        {
            Hv_Mw_OsdItemFocusNext();
            break;
        }
        case OSDEVT_KEY_EXIT:
        case OSDEVT_KEY_LEFT:
        {
            Hv_App_OsdOtaExit();
#ifdef CONFIG_USER_USB_OTA_ON
            Hv_Mw_SendEvtToUsb(USB_EVENT_UPGRADE_CANCEL, 0);
#endif
            break;
        }
        default:
        {
            break;
        }
    }
}

VOID Hv_App_OsdItemNo_ItemlistProceed_SceneOta(VOID)
{
    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        case OSDEVT_KEY_EXIT:
        case OSDEVT_KEY_LEFT:
        {
            Hv_App_OsdOtaExit();
#ifdef CONFIG_USER_USB_OTA_ON
            Hv_Mw_SendEvtToUsb(USB_EVENT_UPGRADE_CANCEL, 0);
#endif
            break;
        }
        case OSDEVT_KEY_UP:
        {
            Hv_Mw_OsdItemFocusPrev();
            break;
        }
        case OSDEVT_KEY_DOWN:
        {
            Hv_Mw_OsdItemFocusNext();
            break;
        }
        default:
        {
            break;
        }
    }
}

/* DO NOTHING */
VOID Hv_App_OsdItemNoSignal_MenuSource_SceneNosignal(VOID) {}
VOID Hv_App_OsdItemNoSignalSub_MenuSource_SceneNosignalSub(VOID) {}
VOID Hv_App_OsdItemUnsupport_MenuSource_SceneSignalUnsupport(VOID) {}
VOID Hv_App_OsdItemInputTiming_MenuSource_SceneInputSource(VOID) {}
VOID Hv_App_OsdItemInputTiming_MenuSource_SceneInputSourceSub(VOID) {}
VOID Hv_App_OsdItemModel_MenuSystem_SceneMain(VOID) {}
VOID Hv_App_OsdItemSn_MenuSystem_SceneMain(VOID) {}
VOID Hv_App_OsdItemVersion_MenuSystem_SceneMain(VOID) {}
VOID Hv_App_OsdItemChecksum_MenuSystem_SceneMain(VOID) {}
VOID Hv_App_OsdItemTiming_MenuTopInfo_SceneMain(VOID) {}
VOID Hv_App_OsdItemHdrSyncValue_MenuTopInfo_SceneMain(VOID) {}
VOID Hv_App_OsdItemModeValue_MenuTopInfo_SceneMain(VOID) {}
VOID Hv_App_OsdItemInputValue_MenuTopInfo_SceneMain(VOID) {}

/* Menu Operation Handle Defination End */

