/**
 * @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"
#include "hv_mw_OsdDraw.h"
#ifdef CONFIG_USER_USB_OTA_ON
#include "hv_mw_UsbTask.h"
#endif



static BOOL s_bQuickEnter = 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_bIsNeedConfirmAdjusting = HV_FALSE;

BOOL Hv_App_OsdGetNeedConfirmAdjusting(VOID)
{
    return s_bIsNeedConfirmAdjusting;
}

VOID Hv_App_OsdSetNeedConfirmAdjusting(BOOL bAdjusting)
{
    s_bIsNeedConfirmAdjusting = bAdjusting;
}

SHORT16 Hv_App_OsdGetNeedConfirmBackupValue(VOID)
{
    return s_sUserdataBackupValue;
}

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

VOID Hv_App_OsdInputMenuEnter(VOID)
{
    Hv_Mw_OsdSceneInit(SCENE_INPUT);
    Hv_Mw_OsdSceneShow(SCENE_INPUT);

    USHORT16 usItem = Hv_Mw_OsdItemUpdateSelectList(ITEM_HDMI1_SCENE_INPUT);
    Hv_Mw_OsdItemShowList(usItem);

    Hv_Mw_OsdItemFocus(usItem);

    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");
}

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);
    //Hv_App_OsdMainNaviBarExit();
}

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_SCENE_MODE))
    {
        OSD_LOG_INFO("Display mode disabled!");
        return;
    }

    Hv_Mw_OsdSceneInit(SCENE_MODE);
    Hv_Mw_OsdSceneShow(SCENE_MODE);

    USHORT16 usItem = ITEM_MODE_SCENE_MODE;
    Hv_Mw_OsdItemShow(usItem);

    Hv_Mw_OsdItemFocus(usItem);

    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");
}

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);
}

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.%03dHz", uiRefreshRate / 1000, uiRefreshRate % 1000);
    }
    else
    {
        usLen = HV_SNPRINTF(aucStringRefreshRate, OSD_ASCII_STRING_LENGTH_MAX, "%dHz", (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);
    Hv_Mw_OsdStartAutoRefreshTimer(SCENE_REFRESH_RATE, 100);
}

VOID Hv_App_OsdRefreshRateEnter(VOID)
{
    Hv_Mw_OsdSceneInit(SCENE_REFRESH_RATE);
    Hv_Mw_OsdSceneShow(SCENE_REFRESH_RATE);
    Hv_Mw_OsdOpsForceRedraw(HV_TRUE);
    Hv_App_OsdRefreshRateUpdate();
    //OSD_LOG_INFO("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));
        Hv_Mw_OsdComponentHide(COMPONENT(OSD_CP_TYPE_ICON, IMAGE_UNLOCK_SCENE_LOCK_NORMAL));
        OSD_LOG_INFO("Show lock");
    }
    else
    {
        Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_ICON, IMAGE_UNLOCK_SCENE_LOCK_NORMAL));
        Hv_Mw_OsdComponentHide(COMPONENT(OSD_CP_TYPE_ICON, IMAGE_LOCK_SCENE_LOCK_NORMAL));
        OSD_LOG_INFO("Show unlock");
    }

    Hv_Mw_OsdStartAutoCloseTimer(SCENE_LOCK, 1);
    return;
}

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

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

    Hv_Mw_OsdSceneHide(ITEM_GET_SCENEID(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;
        }
        case ITEM_HDR_ADJUST_SCENE_MAIN:
        {
            Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_ADJ_HDR_SCENE_FUNCTION_TIPS_NORMAL));
            Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_TEXT, TEXT_OFF_MPRT_SCENE_FUNCTION_TIPS_NORMAL));
            break;
        }
        default:
        {
            break;
        }
    }
}

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

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

    Hv_Mw_OsdSceneHide(ITEM_GET_SCENEID(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;
        }
    }
}

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

VOID Hv_App_OsdBrightnessAdjustMenuEnter(VOID)
{
    //Hv_App_OsdMainNaviBarUpdate(NAVIBAR_MENU_ADJUST_ONE);
    /* Check disable before focus, if item disabled */
#ifndef OSD_CHECK_DISABLE_BY_EACH_ITEM
    Hv_App_CheckItemDisableState();
#endif
    if (!Hv_Mw_OsdItemGetEnable(ITEM_BRIGHTNESS_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_SCENE_BRIGHTNESS);
    Hv_Mw_OsdItemShowList(ITEM_BRIGHTNESS_SCENE_BRIGHTNESS);

    Hv_Mw_OsdSetKeyRepeatPeriod(OSD_ADJUST_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 brightness adjust quick menu");
}

VOID Hv_App_OsdBrightnessAdjustMenuExit(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_BRIGHTNESS);
    Hv_Mw_OsdSceneClear(SCENE_BRIGHTNESS);
    //Hv_App_OsdMainNaviBarExit();
}

VOID Hv_App_OsdContrastAdjustMenuEnter(VOID)
{
    //Hv_App_OsdMainNaviBarUpdate(NAVIBAR_MENU_ADJUST_ONE);
#ifndef OSD_CHECK_DISABLE_BY_EACH_ITEM
    Hv_App_CheckItemDisableState();
#endif
    if (!Hv_Mw_OsdItemGetEnable(ITEM_CONTRAST_SCENE_CONTRAST))
    {
        OSD_LOG_INFO("Contrast disabled!");
        return;
    }
    Hv_App_OsdHideAll();

    Hv_Mw_OsdSceneInit(SCENE_CONTRAST);
    Hv_Mw_OsdSceneShow(SCENE_CONTRAST);
    Hv_Mw_OsdItemFocus(ITEM_CONTRAST_SCENE_CONTRAST);
    Hv_Mw_OsdItemShowList(ITEM_CONTRAST_SCENE_CONTRAST);

    Hv_Mw_OsdSetKeyRepeatPeriod(OSD_ADJUST_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 contrast adjust quick menu");
}

VOID Hv_App_OsdContrastAdjustMenuExit(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_CONTRAST);
    Hv_Mw_OsdSceneClear(SCENE_CONTRAST);
    //Hv_App_OsdMainNaviBarExit();
}

VOID Hv_App_OsdVolumeAdjustMenuEnter(VOID)
{
    //Hv_App_OsdMainNaviBarUpdate(NAVIBAR_MENU_ADJUST_ONE);
    Hv_App_OsdHideAll();

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

    Hv_Mw_OsdSetKeyRepeatPeriod(OSD_ADJUST_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 volume adjust quick menu");
}

VOID Hv_App_OsdVolumeAdjustMenuExit(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_VOLUME);
    Hv_Mw_OsdSceneClear(SCENE_VOLUME);
}

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_OsdMainMenuUpdate(VOID)
{
    if ((!Hv_Mw_OsdSceneIsShowing(SCENE_MAIN)) ||
        ((ITEM_RESET_SCENE_MAIN != OSD_GET_FOCUSING()) && (ITEM_SYSTEM_RESET_SCENE_MAIN != OSD_GET_FOCUSING())))
    {
        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_App_OsdSetTimingInfoString(aucString, pstTiming->usHActive, pstTiming->usVActive,
                                                   uiRefreshRate, HV_FALSE, pstTiming->bInterlacedMode);
    Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_ASCII_STRING, CUSTOMSTRING_RESOLUTION_SCENE_MAIN_NORMAL));
    Hv_Mw_OsdDynamicAsciiStringUpdate(CUSTOMSTRING_RESOLUTION_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);
}

VOID Hv_App_OsdMainMenuEnter(VOID)
{
    USHORT16 usFirstItem = ITEM_BRI_CON_SCENE_MAIN;
    USHORT16 usChild = ITEM_NONE_ID;
    USHORT16 usStringLength = 0;

    Hv_App_OsdHideAll();

    Hv_Mw_OsdSceneInit(SCENE_MAIN);
    Hv_Mw_OsdSceneShow(SCENE_MAIN);

    OsdTimingInfo *pstTiming = Hv_App_OsdGetCurrentTimingInfo();

    //if (pstTiming->bSignalSync)
    if (1)
    {
        Hv_Mw_OsdItemFocus(usFirstItem);

        Hv_Mw_OsdItemShowList(usFirstItem);

        usChild = CHILD_ITEM(usFirstItem);
        Hv_Mw_OsdItemShowListWithSingleValue(usChild);

        Hv_App_OsdItemUpdateShowInfo(usFirstItem);
    }
    else
    {

    }

    if (HV_COMMON_DATABASE_GET(SystemData, bFactoryMode))
    {
        Hv_Mw_OsdItemShow(ITEM_FACTORY_SCENE_MAIN);
    }

    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");
}

VOID Hv_App_OsdMainMenuExit(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_MAIN);
    Hv_Mw_OsdSceneClear(SCENE_MAIN);
}

VOID Hv_App_OsdUpdatePage(VOID)
{
    static BOOL bPageIconShowing = HV_FALSE;
    UCHAR8 ucCurPage = 1;
    UCHAR8 ucTotalPageNum = 1;

    Hv_Mw_OsdItemGetPage(OSD_GET_FOCUSING(), &ucCurPage, &ucTotalPageNum);
    if (ucTotalPageNum > 1)
    {
        if (ucCurPage == 1)
        {
            Hv_Mw_OsdComponentHide(COMPONENT(OSD_CP_TYPE_ICON, ICON_UP_SCENE_MAIN_NORMAL));
            Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_ICON, ICON_DOWN_SCENE_MAIN_NORMAL));
        }
        else if (ucCurPage == ucTotalPageNum)
        {
            Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_ICON, ICON_UP_SCENE_MAIN_NORMAL));
            Hv_Mw_OsdComponentHide(COMPONENT(OSD_CP_TYPE_ICON, ICON_DOWN_SCENE_MAIN_NORMAL));
        }
        else
        {
            Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_ICON, ICON_UP_SCENE_MAIN_NORMAL));
            Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_ICON, ICON_DOWN_SCENE_MAIN_NORMAL));
        }
        bPageIconShowing = HV_TRUE;
    }
    else if (bPageIconShowing)
    {
        Hv_Mw_OsdComponentHide(COMPONENT(OSD_CP_TYPE_ICON, ICON_UP_SCENE_MAIN_NORMAL));
        Hv_Mw_OsdComponentHide(COMPONENT(OSD_CP_TYPE_ICON, ICON_DOWN_SCENE_MAIN_NORMAL));
        bPageIconShowing = HV_FALSE;
    }
}

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

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

    s_bQuickEnter = HV_FALSE;

    if ((!pstTiming->bSignalSync) && (!pstTiming->bSubSignalSync))
    {
        //OSD_LOG_INFO("No signal, don't show user menu!");
        //return;
    }

    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        case OSDEVT_KEY_UP:
        case OSDEVT_KEY_DOWN:
        case OSDEVT_KEY_EXIT:
        case OSDEVT_KEY_LEFT:
        {
            Hv_App_OsdMainMenuEnter();
            break;
        }
        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_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_GetOsdDataValue(E_USERDATA_MENUTIMER);
    Hv_Mw_OsdStartAutoCloseTimer(SCENE_MAIN, usTimeOut);
}

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


    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_Mw_OsdSceneIsShowing(SCENE_FACTORY))
    {
        Hv_Mw_OsdStopAutoCloseTimer(SCENE_MAIN);
        return;
    }

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

    /* 显示并更新页码 */
    Hv_App_OsdUpdatePage();

    /* 检查并更新item置灰项 */
#ifndef OSD_CHECK_DISABLE_BY_EACH_ITEM
    Hv_App_CheckItemDisableState();
#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_OsdItemHideListWithSingleValue(usChild);

    USHORT16 usNewFocusItem = Hv_Mw_OsdItemFocusPrev();
    Hv_Mw_OsdItemGetPage(usItem, &ucCurPage0, &ucTotalPageNum);
    Hv_Mw_OsdItemGetPage(usNewFocusItem, &ucCurPage1, &ucTotalPageNum);
    /* 翻页处理 */
    if (ucCurPage0 != ucCurPage1)
    {
        Hv_Mw_OsdItemHideList(usItem);
        Hv_Mw_OsdItemShowList(usNewFocusItem);
    }

    usChild = CHILD_ITEM(usNewFocusItem);
    Hv_Mw_OsdItemShowListWithSingleValue(usChild);

    Hv_App_OsdItemUpdateShowInfo(usNewFocusItem);

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

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_OsdItemHideListWithSingleValue(usChild);

    USHORT16 usNewFocusItem = Hv_Mw_OsdItemFocusNext();
    Hv_Mw_OsdItemGetPage(usItem, &ucCurPage0, &ucTotalPageNum);
    Hv_Mw_OsdItemGetPage(usNewFocusItem, &ucCurPage1, &ucTotalPageNum);
    /* 翻页处理 */
    if (ucCurPage0 != ucCurPage1)
    {
        Hv_Mw_OsdItemHideList(usItem);
        Hv_Mw_OsdItemShowList(usNewFocusItem);
    }

    usChild = CHILD_ITEM(usNewFocusItem);
    Hv_Mw_OsdItemShowListWithSingleValue(usChild);

    Hv_App_OsdItemUpdateShowInfo(usNewFocusItem);

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

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

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

    Hv_Mw_OsdItemGetPage(usItem, &ucCurPage, &ucTotalPageNum);
    if (ucCurPage != 1)
    {
        /* 显示第一页的item list */
        Hv_Mw_OsdItemHideListWithSingleValue(usItem);
        Hv_Mw_OsdItemShowListWithSingleValue(CHILD_ITEM(usNewFocusItem));
    }
#if (HV_PROJECT_CONFIG_OSD_ROTATION == HV_CONFIG_ON)
    if (UD_ROTATION_V_OFF != Hv_App_GetOsdDataValue(E_USERDATA_ROTATION))
    {
        Hv_Mw_OsdOpsForceRedraw(HV_TRUE);
    }
#endif
}

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_OsdItemGetPage(usNewFocusItem, &ucCurPage1, &ucTotalPageNum);

    /* 翻页处理 */
    if (ucCurPage0 != ucCurPage1)
    {
        Hv_Mw_OsdItemHideListWithSingleValue(usItem);
        Hv_Mw_OsdItemShowListWithSingleValue(usNewFocusItem);
    }
#if (HV_PROJECT_CONFIG_OSD_ROTATION == HV_CONFIG_ON)
    if (UD_ROTATION_V_OFF != Hv_App_GetOsdDataValue(E_USERDATA_ROTATION))
    {
        Hv_Mw_OsdOpsForceRedraw(HV_TRUE);
    }
#endif
}

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_OsdItemGetPage(usNewFocusItem, &ucCurPage1, &ucTotalPageNum);

    /* 翻页处理 */
    if (ucCurPage0 != ucCurPage1)
    {
        Hv_Mw_OsdItemHideListWithSingleValue(usItem);
        Hv_Mw_OsdItemShowListWithSingleValue(usNewFocusItem);
    }
#if (HV_PROJECT_CONFIG_OSD_ROTATION == HV_CONFIG_ON)
    if (UD_ROTATION_V_OFF != Hv_App_GetOsdDataValue(E_USERDATA_ROTATION))
    {
        Hv_Mw_OsdOpsForceRedraw(HV_TRUE);
    }
#endif
}

static VOID Hv_App_OsdOpsLevel2FocusAdjustValue(VOID)
{
    Hv_Mw_OsdItemFocusValue();
    Hv_Mw_OsdSetKeyRepeatPeriod(OSD_ADJUST_KEY_REPEAT_PERIOD_MS);
}

static VOID Hv_App_OsdOpsLevel2FocusListValue(VOID)
{
    Hv_Mw_OsdItemFocusValue();
}

static VOID Hv_App_OsdOpsLevel2FocusListValueNeedConfirm(VOID)
{
    USHORT16 usItem = Hv_Mw_OsdItemFocusValue();
    /* 备份对应userdata的值 */
    s_sUserdataBackupValue = Hv_App_GetOsdDataValue(OSD_GET_USERDATA(usItem));
    s_bIsNeedConfirmAdjusting = HV_TRUE;
}

static VOID Hv_App_OsdOpsLevel3AdjustFocusParent(VOID)
{
    Hv_Mw_OsdItemFocusParent();
    Hv_Mw_OsdSetKeyRepeatPeriod(OSD_DEFAULT_KEY_REPEAT_PERIOD_MS);
}

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);
}

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);
}

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

static VOID Hv_App_OsdItemLevel3ListIncrease(VOID)
{
    USHORT16 usItem = OSD_GET_FOCUSING();
    /* 更新对应userdata */
    Hv_Mw_OsdAdjustFunction(OSD_GET_USERDATA(usItem), ACT_INCREASE, 1, SET_ALL);
    /* 更新显示当前聚焦item */
    Hv_Mw_OsdItemShowList(usItem);
    /* 更新显示当前聚焦item的父菜单list */
    Hv_Mw_OsdItemShowList(PARENT_ITEM(usItem));
}

static VOID Hv_App_OsdItemLevel3ListDecrease(VOID)
{
    USHORT16 usItem = OSD_GET_FOCUSING();
    /* 更新对应userdata */
    Hv_Mw_OsdAdjustFunction(OSD_GET_USERDATA(usItem), ACT_DECREASE, 1, SET_ALL);
    /* 更新显示当前聚焦item */
    Hv_Mw_OsdItemShowList(usItem);
    /* 更新显示当前聚焦item的父菜单list */
    Hv_Mw_OsdItemShowList(PARENT_ITEM(usItem));
}

static VOID Hv_App_OsdItemLevel3ListIncreaseNeedConfirm(VOID)
{
    USHORT16 usItem = OSD_GET_FOCUSING();
    /* 更新对应userdata */
    Hv_Mw_OsdAdjustFunction(OSD_GET_USERDATA(usItem), ACT_INCREASE, 1, SET_OSDDATA);
    /* 更新显示当前聚焦item */
    Hv_Mw_OsdItemShowList(usItem);
}

static VOID Hv_App_OsdItemLevel3ListDecreaseNeedConfirm(VOID)
{
    USHORT16 usItem = OSD_GET_FOCUSING();
    /* 更新对应userdata */
    Hv_Mw_OsdAdjustFunction(OSD_GET_USERDATA(usItem), ACT_DECREASE, 1, SET_OSDDATA);
    /* 更新显示当前聚焦item */
    Hv_Mw_OsdItemShowList(usItem);
}

static VOID Hv_App_OsdOpsLevel3ListFocusParentRecover(VOID)
{
    USHORT16 usItem = OSD_GET_FOCUSING();
    /* 还原对应userdata的值 */
    Hv_Mw_OsdAdjustFunction(OSD_GET_USERDATA(usItem), ACT_SET, s_sUserdataBackupValue, SET_OSDDATA);

    Hv_Mw_OsdItemFocusParent();
    s_bIsNeedConfirmAdjusting = HV_FALSE;
}

static VOID Hv_App_OsdOpsLevel3ListFocusParentConfirm(VOID)
{
    USHORT16 usItem = OSD_GET_FOCUSING();
    /* 确认设置对应userdata的值 */
    SHORT16 sValue = Hv_App_GetOsdDataValue(OSD_GET_USERDATA(usItem));
    if (s_sUserdataBackupValue != sValue)
    {
        Hv_Mw_OsdAdjustFunction(OSD_GET_USERDATA(usItem), ACT_SET, sValue, SET_RELATED | SET_INTERFACE);
    }

    Hv_Mw_OsdItemFocusParent();
    s_bIsNeedConfirmAdjusting = HV_FALSE;
}

static VOID Hv_App_OsdOpsLevel1(VOID)
{
    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        {
            Hv_App_OsdOpsLevel1FocusChild();
            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_OsdOpsLevel2Adjust(VOID)
{
    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        {
            Hv_App_OsdOpsLevel2FocusAdjustValue();
            break;
        }
        case OSDEVT_KEY_UP:
        {
            Hv_App_OsdOpsLevel2FocusPrev();
            break;
        }
        case OSDEVT_KEY_DOWN:
        {
            Hv_App_OsdOpsLevel2FocusNext();
            break;
        }
        case OSDEVT_KEY_EXIT:
        case OSDEVT_KEY_LEFT:
        {
            Hv_App_OsdOpsLevel2FocusParent();
            break;
        }
        default:
        {
            break;
        }
    }
}

static VOID Hv_App_OsdOpsLevel2List(VOID)
{
    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        {
            Hv_App_OsdOpsLevel2FocusListValue();
            break;
        }
        case OSDEVT_KEY_UP:
        {
            Hv_App_OsdOpsLevel2FocusPrev();
            break;
        }
        case OSDEVT_KEY_DOWN:
        {
            Hv_App_OsdOpsLevel2FocusNext();
            break;
        }
        case OSDEVT_KEY_EXIT:
        case OSDEVT_KEY_LEFT:
        {
            Hv_App_OsdOpsLevel2FocusParent();
            break;
        }
        default:
        {
            break;
        }
    }
}

static VOID Hv_App_OsdOpsLevel2ListNeedConfirm(VOID)
{
    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        {
            Hv_App_OsdOpsLevel2FocusListValueNeedConfirm();
            break;
        }
        case OSDEVT_KEY_UP:
        {
            Hv_App_OsdOpsLevel2FocusPrev();
            break;
        }
        case OSDEVT_KEY_DOWN:
        {
            Hv_App_OsdOpsLevel2FocusNext();
            break;
        }
        case OSDEVT_KEY_EXIT:
        case OSDEVT_KEY_LEFT:
        {
            Hv_App_OsdOpsLevel2FocusParent();
            break;
        }
        default:
        {
            break;
        }
    }
}

static VOID Hv_App_OsdOpsLevel3Adjust(VOID)
{
    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        {
            Hv_App_OsdOpsLevel3AdjustFocusParent();
            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();
            break;
        }
        default:
        {
            break;
        }
    }
}

static VOID Hv_App_OsdOpsLevel3List(VOID)
{
    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        {
            Hv_App_OsdOpsLevel3ListFocusParent();
            break;
        }
        case OSDEVT_KEY_UP:
        {
            Hv_App_OsdItemLevel3ListIncrease();
            break;
        }
        case OSDEVT_KEY_DOWN:
        {
            Hv_App_OsdItemLevel3ListDecrease();
            break;
        }
        case OSDEVT_KEY_EXIT:
        case OSDEVT_KEY_LEFT:
        {
            Hv_App_OsdOpsLevel3ListFocusParent();
            break;
        }
        default:
        {
            break;
        }
    }
}

static VOID Hv_App_OsdOpsLevel3NeedConfirm(VOID)
{
    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        {
            Hv_App_OsdOpsLevel3ListFocusParentConfirm();
            break;
        }
        case OSDEVT_KEY_UP:
        {
            Hv_App_OsdItemLevel3ListIncreaseNeedConfirm();
            break;
        }
        case OSDEVT_KEY_DOWN:
        {
            Hv_App_OsdItemLevel3ListDecreaseNeedConfirm();
            break;
        }
        case OSDEVT_KEY_EXIT:
        case OSDEVT_KEY_LEFT:
        {
            Hv_App_OsdOpsLevel3ListFocusParentRecover();
            break;
        }
        default:
        {
            break;
        }
    }
}

VOID Hv_App_OsdUpdateSystemInfo(VOID)
{
    UCHAR8 aucStringModel[] = HV_PROJECT_CONFIG_FACTORY_MONITOR_MODE;
    Hv_Mw_OsdDynamicAsciiStringUpdate(CUSTOMSTRING_MODEL_SCENE_MAIN_NORMAL, aucStringModel, strlen(aucStringModel));
    
    UCHAR8 ucLen = strlen(Hv_Common_Db_GetFactoryDataDBRegionPtr()->acProductSn);
    Hv_Mw_OsdDynamicAsciiStringUpdate(CUSTOMSTRING_SN_SCENE_MAIN_NORMAL, Hv_Common_Db_GetFactoryDataDBRegionPtr()->acProductSn, ucLen);

    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);
    
    OsdTimingInfo *pstTiming = Hv_App_OsdGetCurrentTimingInfo();

    UCHAR8 aucString[OSD_ASCII_STRING_LENGTH_MAX] = { 0 };
    usStringLength = Hv_App_OsdSetTimingInfoString(aucString, pstTiming->usHActive, pstTiming->usVActive,
                                                   pstTiming->usFrameRate, HV_FALSE, pstTiming->bInterlacedMode);
    Hv_Mw_OsdDynamicAsciiStringUpdate(CUSTOMSTRING_RESOLUTION_SCENE_MAIN_NORMAL, aucString, usStringLength);
}

/* Common Menu Function Defination End */

/* Menu Operation Handle Defination Begin */

VOID Hv_App_OsdItemBrightness_MenuBrightness_SceneBrightness(VOID)
{
    if (!s_bPowerTipsShowen)
    {
        if (OSDEVT_KEY_UP == Hv_Mw_OsdGetKeyValue())
        {
            if (80 == Hv_App_GetOsdDataValue(E_USERDATA_BRIGHTNESS))
            {
                /* show tips */
                Hv_App_OsdPowerTipsEnter();
                return;
            }
        }
    }

    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(E_USERDATA_BRIGHTNESS, ACT_INCREASE,
                                       1, SET_ALL);
            Hv_Mw_OsdItemShow(OSD_GET_FOCUSING());
            break;
        }
        case OSDEVT_KEY_DOWN:
        {
            Hv_Mw_OsdAdjustFunction(E_USERDATA_BRIGHTNESS, ACT_DECREASE,
                                       1, SET_ALL);
            Hv_Mw_OsdItemShow(OSD_GET_FOCUSING());
            break;
        }
        default:
        {
            break;
        }
    }
}

VOID Hv_App_OsdItemContrast_MenuContrast_SceneContrast(VOID)
{
    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        case OSDEVT_KEY_EXIT:
        case OSDEVT_KEY_LEFT:
        {
            Hv_App_OsdContrastAdjustMenuExit();
            break;
        }
        case OSDEVT_KEY_UP:
        {
            Hv_Mw_OsdAdjustFunction(E_USERDATA_CONTRAST, ACT_INCREASE,
                                       1, SET_ALL);
            Hv_Mw_OsdItemShow(OSD_GET_FOCUSING());
            break;
        }
        case OSDEVT_KEY_DOWN:
        {
            Hv_Mw_OsdAdjustFunction(E_USERDATA_CONTRAST, ACT_DECREASE,
                                       1, SET_ALL);
            Hv_Mw_OsdItemShow(OSD_GET_FOCUSING());
            break;
        }
        default:
        {
            break;
        }
    }
}

VOID Hv_App_OsdItemYes_MenuFunctionTips_SceneFunctionTips(VOID)
{
    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        {
            Hv_App_OsdFuncitonTipsExit();
            if (OSDEVT_KEY_UP == s_usKeyBackup)
            {
                Hv_App_OsdItemLevel3ListIncrease();
            }
            else if (OSDEVT_KEY_DOWN == s_usKeyBackup)
            {
                Hv_App_OsdItemLevel3ListDecrease();
            }
            else if ((OSDEVT_KEY_ENTER == s_usKeyBackup) || (OSDEVT_KEY_RIGHT == s_usKeyBackup))
            {
                Hv_App_OsdOpsLevel3ListFocusParentConfirm();
            }
            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_OsdFuncitonTipsExit();
            break;
        }
        default:
        {
            break;
        }
    }
}

VOID Hv_App_OsdItemNo_MenuFunctionTips_SceneFunctionTips(VOID)
{
    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        case OSDEVT_KEY_EXIT:
        case OSDEVT_KEY_LEFT:
        {
            Hv_App_OsdFuncitonTipsExit();
            break;
        }
        case OSDEVT_KEY_UP:
        {
            Hv_Mw_OsdItemFocusPrev();
            break;
        }
        case OSDEVT_KEY_DOWN:
        {
            Hv_Mw_OsdItemFocusNext();
            break;
        }
        default:
        {
            break;
        }
    }
}

VOID Hv_App_OsdItemHdmi1_MenuInputList_SceneInput(VOID)
{
    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        {
            USHORT16 usItem = OSD_GET_FOCUSING();
            USHORT16 usBias = Hv_Mw_OsdItemGetBias(usItem);
            Hv_Mw_OsdAdjustFunction(OSD_GET_USERDATA(usItem), ACT_SET,
                                       usBias, SET_ALL);
            Hv_App_OsdInputMenuExit();
            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_OsdInputMenuExit();
            break;
        }
        default:
        {
            break;
        }
    }
}

VOID Hv_App_OsdItemHdmi2_MenuInputList_SceneInput(VOID)
{
    Hv_App_OsdItemHdmi1_MenuInputList_SceneInput();
}

VOID Hv_App_OsdItemUsbC_MenuInputList_SceneInput(VOID)
{
    Hv_App_OsdItemHdmi1_MenuInputList_SceneInput();
}

VOID Hv_App_OsdItemDp_MenuInputList_SceneInput(VOID)
{
    Hv_App_OsdItemHdmi1_MenuInputList_SceneInput();
}

VOID Hv_App_OsdItemBriCon_MenuMain_SceneMain(VOID)
{
    if ((OSDEVT_KEY_UP == Hv_Mw_OsdGetKeyValue()) && (Hv_Mw_OsdItemGetEnable(ITEM_FACTORY_SCENE_MAIN)))
    {
        Hv_Mw_OsdItemHideListWithSingleValue(CHILD_ITEM(OSD_GET_FOCUSING()));
        Hv_Mw_OsdItemFocus(ITEM_FACTORY_SCENE_MAIN);
    }
    else
    {
        Hv_App_OsdOpsLevel1();
    }
}

VOID Hv_App_OsdItemPicture_MenuMain_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel1();
}

VOID Hv_App_OsdItemColorTemp_MenuMain_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel1();
}

VOID Hv_App_OsdItemOsd_MenuMain_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel1();
    if (OSDEVT_KEY_DOWN == Hv_Mw_OsdGetKeyValue())
    {
        Hv_App_OsdUpdateSystemInfo();
    }
}

VOID Hv_App_OsdItemReset_MenuMain_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel1();
}

VOID Hv_App_OsdItemOther_MenuMain_SceneMain(VOID)
{
    if ((OSDEVT_KEY_DOWN == Hv_Mw_OsdGetKeyValue()) && (Hv_Mw_OsdItemGetEnable(ITEM_FACTORY_SCENE_MAIN)))
    {
        Hv_Mw_OsdItemHideListWithSingleValue(CHILD_ITEM(OSD_GET_FOCUSING()));
        Hv_Mw_OsdItemFocus(ITEM_FACTORY_SCENE_MAIN);
    }
    else
    {
        Hv_App_OsdOpsLevel1();
        if (OSDEVT_KEY_UP == Hv_Mw_OsdGetKeyValue())
        {
            Hv_App_OsdUpdateSystemInfo();
        }
    }
}

VOID Hv_App_OsdItemFactory_MenuFactory_SceneMain(VOID)
{
    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        {
            Hv_App_OsdFactoryMenuEnter();
            break;
        }
        case OSDEVT_KEY_UP:
        {
            Hv_Mw_OsdItemFocus(ITEM_BRI_CON_SCENE_MAIN);
            Hv_App_OsdOpsLevel1FocusPrev();
            break;
        }
        case OSDEVT_KEY_DOWN:
        {
            Hv_Mw_OsdItemFocus(ITEM_OTHER_SCENE_MAIN);
            Hv_App_OsdOpsLevel1FocusNext();
            break;
        }
        case OSDEVT_KEY_EXIT:
        case OSDEVT_KEY_LEFT:
        {
            Hv_App_OsdMainMenuExit();
            break;
        }
        default:
        {
            break;
        }
    }
}

VOID Hv_App_OsdItemBrightness_MenuBriCon_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2Adjust();
}

VOID Hv_App_OsdItemContrast_MenuBriCon_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2Adjust();
}

VOID Hv_App_OsdItemDcr_MenuBriCon_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2List();
}

VOID Hv_App_OsdItemMode_MenuBriCon_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2List();
}

VOID Hv_App_OsdItemDark_MenuBriCon_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2List();
}

VOID Hv_App_OsdItemHdr_MenuBriCon_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2List();
}

VOID Hv_App_OsdItemSaturation_MenuPicture1_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2Adjust();
}

VOID Hv_App_OsdItemHue_MenuPicture1_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2Adjust();
}

VOID Hv_App_OsdItemGamma_MenuPicture1_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2List();
}

VOID Hv_App_OsdItemSharpness_MenuPicture1_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2Adjust();
}

VOID Hv_App_OsdItemDisplaySize_MenuPicture1_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2ListNeedConfirm();
}

VOID Hv_App_OsdItemRotate_MenuPicture1_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2ListNeedConfirm();
}

VOID Hv_App_OsdItemLdg_MenuPicture2_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2List();
}

VOID Hv_App_OsdItemColorFilter_MenuPicture2_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2List();
}

VOID Hv_App_OsdItemColorSpace_MenuPicture2_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2List();
}

VOID Hv_App_OsdItemTempreture_MenuColorTemp_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2List();
}

VOID Hv_App_OsdItemRed_MenuColorTemp_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2Adjust();
}

VOID Hv_App_OsdItemGreen_MenuColorTemp_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2Adjust();
}

VOID Hv_App_OsdItemBlue_MenuColorTemp_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2Adjust();
}

VOID Hv_App_OsdItemLowBlueLight_MenuColorTemp_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2List();
}

VOID Hv_App_OsdItemLanguage_MenuOsd_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2List();
}

VOID Hv_App_OsdItemHPos_MenuOsd_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2Adjust();
}

VOID Hv_App_OsdItemVPos_MenuOsd_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2Adjust();
}

VOID Hv_App_OsdItemOsdTime_MenuOsd_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2List();
}

VOID Hv_App_OsdItemTransparency_MenuOsd_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2List();
}

VOID Hv_App_OsdItemLock_MenuOsd_SceneMain(VOID)
{
    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);
    }
    else
    {
        Hv_App_OsdOpsLevel2List();
    }
}

VOID Hv_App_OsdItemSystemReset_MenuReset_SceneMain(VOID)
{
    if ((OSDEVT_KEY_ENTER == Hv_Mw_OsdGetKeyValue()) || (OSDEVT_KEY_RIGHT == Hv_Mw_OsdGetKeyValue()))
    {
        Hv_Mw_OsdSceneHide(SCENE_MAIN);
        Hv_Mw_OsdSceneInit(SCENE_RESET_ALL);
        Hv_Mw_OsdSceneShow(SCENE_RESET_ALL);

        Hv_Mw_OsdItemFocus(ITEM_NO_SCENE_RESET_ALL);
        Hv_Mw_OsdItemShowList(ITEM_NO_SCENE_RESET_ALL);
    }
    else
    {
        Hv_App_OsdOpsLevel2List();
    }
}

VOID Hv_App_OsdItemModel_MenuReset_SceneMain(VOID)
{
    /* DO NOTHING */
}

VOID Hv_App_OsdItemSn_MenuReset_SceneMain(VOID)
{
    /* DO NOTHING */
}

VOID Hv_App_OsdItemVersion_MenuReset_SceneMain(VOID)
{
    /* DO NOTHING */
}

VOID Hv_App_OsdItemSource_MenuReset_SceneMain(VOID)
{
    /* DO NOTHING */
}

VOID Hv_App_OsdItemResolution_MenuReset_SceneMain(VOID)
{
    /* DO NOTHING */
}

VOID Hv_App_OsdItemInput_MenuOther1_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2ListNeedConfirm();
}

VOID Hv_App_OsdItemAutoSelect_MenuOther1_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2List();
}

VOID Hv_App_OsdItemResponseTime_MenuOther1_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2List();
}

VOID Hv_App_OsdItemMute_MenuOther1_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2List();
}

VOID Hv_App_OsdItemVolume_MenuOther1_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2Adjust();
}

VOID Hv_App_OsdItemTimeDelay_MenuOther1_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2List();

    if (OSDEVT_KEY_DOWN == Hv_Mw_OsdGetKeyValue())
    {
        /* check input source for showing FreeSync or AdaptiveSync */
        Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_TEXT_LIST, TEXTLIST_FREESYNC_SCENE_MAIN_NORMAL));
    }
}

VOID Hv_App_OsdItemMprt_MenuOther2_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2List();
}

VOID Hv_App_OsdItemFreesync_MenuOther2_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2List();
}

VOID Hv_App_OsdItemCrosshair_MenuOther2_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2List();
}

VOID Hv_App_OsdItemDynCrosshair_MenuOther2_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2List();
}

VOID Hv_App_OsdItemRefreshRate_MenuOther2_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2List();
}

VOID Hv_App_OsdItemTimeCount_MenuOther2_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2List();
}

VOID Hv_App_OsdItemMagnifyglass_MenuOther3_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2List();

    if (OSDEVT_KEY_UP == Hv_Mw_OsdGetKeyValue())
    {
        /* check input source for showing FreeSync or AdaptiveSync */
        Hv_Mw_OsdComponentShow(COMPONENT(OSD_CP_TYPE_TEXT_LIST, TEXTLIST_FREESYNC_SCENE_MAIN_NORMAL));
    }
}

VOID Hv_App_OsdItemPowerIndicator_MenuOther3_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2List();
}

VOID Hv_App_OsdItemHdmiFormat_MenuOther3_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2List();
}

VOID Hv_App_OsdItemKey1_MenuOther3_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2List();
}

VOID Hv_App_OsdItemKey2_MenuOther3_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2List();
}

VOID Hv_App_OsdItemKey3_MenuOther3_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2List();
}

VOID Hv_App_OsdItemPxpMode_MenuOther4_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2ListNeedConfirm();
}

VOID Hv_App_OsdItemSubInput_MenuOther4_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2ListNeedConfirm();
}

VOID Hv_App_OsdItemInputSwap_MenuOther4_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2List();
}

VOID Hv_App_OsdItemAudioSource_MenuOther4_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2List();
}

VOID Hv_App_OsdItemPipSize_MenuOther4_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2List();
}

VOID Hv_App_OsdItemPipPosition_MenuOther4_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel2List();
}

VOID Hv_App_OsdItemOta_MenuOther5_SceneMain(VOID)
{
    if ((OSDEVT_KEY_ENTER == Hv_Mw_OsdGetKeyValue()) || (OSDEVT_KEY_RIGHT == Hv_Mw_OsdGetKeyValue()))
    {
        Hv_App_OsdOtaEnter();
#ifdef CONFIG_USER_USB_OTA_ON
        OSD_LOG_INFO("OTA update begin");
        Hv_Mw_SendEvtToUsb(USB_EVENT_NORMAL_UPGRADE, 0);
#endif
    }
    else
    {
        Hv_App_OsdOpsLevel2List();
    }
}

VOID Hv_App_OsdItemBrightnessAdjust_MenuBriConValue_SceneMain(VOID)
{
    if (!s_bPowerTipsShowen)
    {
        if (OSDEVT_KEY_UP == Hv_Mw_OsdGetKeyValue())
        {
            if (80 == Hv_App_GetOsdDataValue(E_USERDATA_BRIGHTNESS))
            {
                /* show tips */
                Hv_App_OsdPowerTipsEnter();
                return;
            }
        }
    }

    Hv_App_OsdOpsLevel3Adjust();
}

VOID Hv_App_OsdItemContrastAdjust_MenuBriConValue_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3Adjust();
}

VOID Hv_App_OsdItemDcrAdjust_MenuBriConValue_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemModeAdjust_MenuBriConValue_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemDarkAdjust_MenuBriConValue_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3Adjust();
}

VOID Hv_App_OsdItemHdrAdjust_MenuBriConValue_SceneMain(VOID)
{
    if ((OSDEVT_KEY_UP == Hv_Mw_OsdGetKeyValue()) || (OSDEVT_KEY_DOWN == Hv_Mw_OsdGetKeyValue()))
    {
        if ((UD_MPRT_V_ON == Hv_App_GetOsdDataValue(E_USERDATA_MPRT)) &&
            (UD_HDR_V_OFF == Hv_App_GetOsdDataValue(E_USERDATA_HDR)))
        {
            /* show tips */
            Hv_App_OsdFuncitonTipsEnter();
            return;
        }
    }

    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemSaturationAdjust_MenuPicture1Value_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3Adjust();
}

VOID Hv_App_OsdItemHueAdjust_MenuPicture1Value_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3Adjust();
}

VOID Hv_App_OsdItemGammaAdjust_MenuPicture1Value_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemSharpnessAdjust_MenuPicture1Value_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3Adjust();
}

VOID Hv_App_OsdItemDisplaySizeAdjust_MenuPicture1Value_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3NeedConfirm();
}

VOID Hv_App_OsdItemRotateAdjust_MenuPicture1Value_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3NeedConfirm();
}

VOID Hv_App_OsdItemLdgAdjust_MenuPicture2Value_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemColorFilterAdjust_MenuPicture2Value_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemColorSpaceAdjust_MenuPicture2Value_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemTempretureAdjust_MenuColorTempValue_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemRedAdjust_MenuColorTempValue_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3Adjust();
}

VOID Hv_App_OsdItemGreenAdjust_MenuColorTempValue_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3Adjust();
}

VOID Hv_App_OsdItemBlueAdjust_MenuColorTempValue_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3Adjust();
}

VOID Hv_App_OsdItemLowBlueLightAdjust_MenuColorTempValue_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemLanguageAdjust_MenuOsdValue_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemHPosAdjust_MenuOsdValue_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3Adjust();
}

VOID Hv_App_OsdItemVPosAdjust_MenuOsdValue_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3Adjust();
}

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

    if (OSDEVT_KEY_UP == Hv_Mw_OsdGetKeyValue())
    {
        Hv_Mw_OsdAdjustFunction(OSD_GET_USERDATA(usItem), ACT_INCREASE, 5, SET_ALL);
        Hv_Mw_OsdItemShow(usItem);
    }
    else if (OSDEVT_KEY_DOWN == Hv_Mw_OsdGetKeyValue())
    {
        Hv_Mw_OsdAdjustFunction(OSD_GET_USERDATA(usItem), ACT_DECREASE, 5, SET_ALL);
        Hv_Mw_OsdItemShow(usItem);
    }
    else
    {
        Hv_App_OsdOpsLevel3List();
    }
}

VOID Hv_App_OsdItemTransparencyAdjust_MenuOsdValue_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemInputAdjust_MenuOther1Value_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3NeedConfirm();
}

VOID Hv_App_OsdItemAutoSelectAdjust_MenuOther1Value_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemResponseTimeAdjust_MenuOther1Value_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemMuteAdjust_MenuOther1Value_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemVolumeAdjust_MenuOther1Value_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3Adjust();
    if ((OSDEVT_KEY_UP == Hv_Mw_OsdGetKeyValue()) || (OSDEVT_KEY_DOWN == Hv_Mw_OsdGetKeyValue()))
    {
        Hv_Mw_OsdItemShow(ITEM_MUTE_ADJUST_SCENE_MAIN);
    }
}

VOID Hv_App_OsdItemTimeDelayAdjust_MenuOther1Value_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);
    }
    else if (OSDEVT_KEY_DOWN == Hv_Mw_OsdGetKeyValue())
    {
        Hv_Mw_OsdAdjustFunction(OSD_GET_USERDATA(usItem), ACT_DECREASE, 50, SET_ALL);
        Hv_Mw_OsdItemShow(usItem);
    }
    else
    {
        Hv_App_OsdOpsLevel3List();
    }
}

VOID Hv_App_OsdItemMprtAdjust_MenuOther2Value_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemFreesyncAdjust_MenuOther2Value_SceneMain(VOID)
{
    if ((OSDEVT_KEY_UP == Hv_Mw_OsdGetKeyValue()) || (OSDEVT_KEY_DOWN == Hv_Mw_OsdGetKeyValue()))
    {
        if ((UD_MPRT_V_ON == Hv_App_GetOsdDataValue(E_USERDATA_MPRT)) &&
            (UD_FREESYNC_V_OFF == Hv_App_GetOsdDataValue(E_USERDATA_FREESYNC)))
        {
            /* show tips */
            Hv_App_OsdFuncitonTipsEnter();
            return;
        }
    }

    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemCrosshairAdjust_MenuOther2Value_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemDynCrosshairAdjust_MenuOther2Value_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemRefreshRateAdjust_MenuOther2Value_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemTimeCountAdjust_MenuOther2Value_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
    if ((OSDEVT_KEY_UP == Hv_Mw_OsdGetKeyValue()) || (OSDEVT_KEY_DOWN == Hv_Mw_OsdGetKeyValue()))
    {
        Hv_Mw_OsdStopAutoRefreshTimer(SCENE_TIMER);

        USHORT16 usTimeMinus = 0;
        switch(Hv_App_GetOsdDataValue(E_USERDATA_TIME_COUNTER))
        {
            case UD_TIME_COUNTER_V_OFF:
            {
                Hv_App_OsdTimeCounterExit();
                return;
            }
            case UD_TIME_COUNTER_V_10:
            {
                usTimeMinus = 10;
                break;
            }
            case UD_TIME_COUNTER_V_30:
            {
                usTimeMinus = 30;
                break;
            }
            case UD_TIME_COUNTER_V_60:
            {
                usTimeMinus = 60;
                break;
            }
            case UD_TIME_COUNTER_V_90:
            {
                usTimeMinus = 90;
                break;
            }
            default:
            {
                break;
            }
        }
        Hv_App_OsdTimeCounterSetTime(usTimeMinus * 60);
    }
}

VOID Hv_App_OsdItemMagnifyglassAdjust_MenuOther3Value_SceneMain(VOID)
{
    if ((OSDEVT_KEY_UP == Hv_Mw_OsdGetKeyValue()) || (OSDEVT_KEY_DOWN == Hv_Mw_OsdGetKeyValue()))
    {
        if ((UD_MAGNIFY_GLASS_V_OFF == Hv_App_GetOsdDataValue(E_USERDATA_MAGNIFY_GLASS)) &&
            (UD_PXPMODE_V_OFF != Hv_App_GetOsdDataValue(E_USERDATA_PXPMODE)))
        {
            /* show tips */
            Hv_App_OsdFuncitonTipsEnter();
            return;
        }
    }

    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemPowerIndicatorAdjust_MenuOther3Value_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemHdmiFormatAdjust_MenuOther3Value_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemKey1Adjust_MenuOther3Value_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemKey2Adjust_MenuOther3Value_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemKey3Adjust_MenuOther3Value_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemPxpModeAdjust_MenuOther4Value_SceneMain(VOID)
{
    if ((OSDEVT_KEY_ENTER == Hv_Mw_OsdGetKeyValue()) || (OSDEVT_KEY_RIGHT == Hv_Mw_OsdGetKeyValue()))
    {
        if ((UD_MAGNIFY_GLASS_V_ON == Hv_App_GetOsdDataValue(E_USERDATA_MAGNIFY_GLASS)) &&
            (UD_PXPMODE_V_OFF != Hv_App_GetOsdDataValue(E_USERDATA_PXPMODE)))
        {
            /* show tips */
            Hv_App_OsdFuncitonTipsEnter();
            return;
        }
    }
    Hv_App_OsdOpsLevel3NeedConfirm();
}

VOID Hv_App_OsdItemSubInputAdjust_MenuOther4Value_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3NeedConfirm();
}

VOID Hv_App_OsdItemInputSwapAdjust_MenuOther4Value_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemAudioSourceAdjust_MenuOther4Value_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemPipSizeAdjust_MenuOther4Value_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemPipPositionAdjust_MenuOther4Value_SceneMain(VOID)
{
    Hv_App_OsdOpsLevel3List();
}

VOID Hv_App_OsdItemModelValue_MenuResetValue_SceneMain(VOID)
{
    /* DO NOTHING */
}

VOID Hv_App_OsdItemSnValue_MenuResetValue_SceneMain(VOID)
{
    /* DO NOTHING */
}

VOID Hv_App_OsdItemVersionValue_MenuResetValue_SceneMain(VOID)
{
    /* DO NOTHING */
}

VOID Hv_App_OsdItemSourceValue_MenuResetValue_SceneMain(VOID)
{
    /* DO NOTHING */
}

VOID Hv_App_OsdItemResolutionValue_MenuResetValue_SceneMain(VOID)
{
    /* DO NOTHING */
}

VOID Hv_App_OsdItemMode_MenuMode_SceneMode(VOID)
{
    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(E_USERDATA_DISPLAY_MODE, ACT_INCREASE,
                                       1, SET_ALL);
            Hv_Mw_OsdItemShow(OSD_GET_FOCUSING());
            break;
        }
        case OSDEVT_KEY_DOWN:
        {
            Hv_Mw_OsdAdjustFunction(E_USERDATA_DISPLAY_MODE, ACT_DECREASE,
                                       1, SET_ALL);
            Hv_Mw_OsdItemShow(OSD_GET_FOCUSING());
            break;
        }
        default:
        {
            break;
        }
    }
}

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;
        }
    }
}

VOID Hv_App_OsdItemYes_MenuPowerTips_ScenePowerTips(VOID)
{
    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        {
            s_bPowerTipsShowen = HV_TRUE;
            Hv_App_OsdPowerTipsExit();
            if (OSDEVT_KEY_UP == s_usKeyBackup)
            {
                Hv_App_OsdItemLevel3ListIncrease();
            }
            else
            {
                Hv_App_OsdItemLevel3ListDecrease();
            }
            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_OsdPowerTipsExit();
            break;
        }
        default:
        {
            break;
        }
    }
}

VOID Hv_App_OsdItemNo_MenuPowerTips_ScenePowerTips(VOID)
{
    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        case OSDEVT_KEY_EXIT:
        case OSDEVT_KEY_LEFT:
        {
            Hv_App_OsdPowerTipsExit();
            break;
        }
        case OSDEVT_KEY_UP:
        {
            Hv_Mw_OsdItemFocusPrev();
            break;
        }
        case OSDEVT_KEY_DOWN:
        {
            Hv_Mw_OsdItemFocusNext();
            break;
        }
        default:
        {
            break;
        }
    }
}

VOID Hv_App_OsdItemYes_MenuReset_SceneResetAll(VOID)
{
    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        {
            Hv_Mw_OsdItemFocusClear();
            Hv_Mw_OsdSceneHide(SCENE_RESET_ALL);
            Hv_Mw_OsdSceneClear(SCENE_RESET_ALL);
            Hv_Mw_OsdSceneClear(SCENE_MAIN);
            s_bPowerTipsShowen = HV_FALSE;
            Hv_App_ResetToFactorySetting();
            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_Mw_OsdSceneHide(SCENE_RESET_ALL);
            Hv_Mw_OsdSceneClear(SCENE_RESET_ALL);
            Hv_Mw_OsdSceneShow(SCENE_MAIN);
            Hv_Mw_OsdItemFocus(ITEM_SYSTEM_RESET_SCENE_MAIN);
            break;
        }
        default:
        {
            break;
        }
    }
}

VOID Hv_App_OsdItemNo_MenuReset_SceneResetAll(VOID)
{
    switch (Hv_Mw_OsdGetKeyValue())
    {
        case OSDEVT_KEY_UP:
        {
            Hv_Mw_OsdItemFocusPrev();
            break;
        }
        case OSDEVT_KEY_DOWN:
        {
            Hv_Mw_OsdItemFocusNext();
            break;
        }
        case OSDEVT_KEY_ENTER:
        case OSDEVT_KEY_RIGHT:
        case OSDEVT_KEY_EXIT:
        case OSDEVT_KEY_LEFT:
        {
            Hv_Mw_OsdSceneHide(SCENE_RESET_ALL);
            Hv_Mw_OsdSceneClear(SCENE_RESET_ALL);
            Hv_Mw_OsdSceneShow(SCENE_MAIN);
            Hv_Mw_OsdItemFocus(ITEM_SYSTEM_RESET_SCENE_MAIN);
            break;
        }
        default:
        {
            break;
        }
    }
}

VOID Hv_App_OsdItemVolume_MenuVolume_SceneVolume(VOID)
{
    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(E_USERDATA_VOLUME, ACT_INCREASE,
                                       1, SET_ALL);
            Hv_Mw_OsdItemShow(OSD_GET_FOCUSING());
            break;
        }
        case OSDEVT_KEY_DOWN:
        {
            Hv_Mw_OsdAdjustFunction(E_USERDATA_VOLUME, ACT_DECREASE,
                                       1, SET_ALL);
            Hv_Mw_OsdItemShow(OSD_GET_FOCUSING());
            break;
        }
        default:
        {
            break;
        }
    }
}
/* Menu Operation Handle Defination End */

