/*
 * @file hv_app_OsdTest.h
 * @brief Header file of osd test.
 *
 * @verbatim
 * ==============================================================================
 *                        ##### How to use #####
 * ==============================================================================
 * (+) Use () to .
 *
 * @author HiView SoC Software Team
 * @version 1.0.0
 * @date 2024-07-09
 */

#ifndef _HV_APP_OSD_TEST_H
#define _HV_APP_OSD_TEST_H

#include "hv_mw_OsdEvent.h"

typedef struct _OsdTestStringProp
{
    UCHAR8 ucBlockID;
    USHORT16 usStringId;
} OsdTestStringProp;
extern const OsdTestStringProp g_astTestStringPropArray[];
extern const USHORT16 usTestStringMax;


#if (HV_OSD_CONFIG_AUTO_TEST == HV_CONFIG_ON)
#define TEST_DELAY_TIME             500             /* 设置界面切换的时间间隔 */
#define TEST_SCENE_OVER             0xFF
#define TEST_SELECTEED_EVT_KEY      OSDEVT_KEY_UP
#define TEST_SELECT_ENTER           HV_CONFIG_ON    /* 是否进入功能选择  menu,若上下移动时调功能接口，回退时不恢复则不能进入*/
#define TEST_SCENE_CROSSHAIR        HV_CONFIG_ON
#define TEST_TEXT_FONTSIZE_NUM      1               /* 菜单中用到的FontSize的种类个数  */

typedef enum _OsdTestNextAction
{
    OSDACT_ENTER,
    OSDACT_NEXT,
    OSDACT_BACK,
    OSDACT_NONE,
} OsdTestNextAction;

typedef enum _OsdEvtTestValue
{
    OSDEVT_TEST_SCENESHOW,
    OSDEVT_TEST_LANGUAGE,
    OSDEVT_TEST_POSITION,
    OSDEVT_TEST_ROTATION,
    OSDEVT_TEST_ALPHA,
    OSDEVT_TEST_CROSSHARE,
    OSDEVT_TEST_TEXT,
    OSDEVT_TEST_TEXT_SETPARAM,
    OSDEVT_TEST_OVER,
    OSDEVT_TEST_NONE,
    OSDEVT_TEST_MAX = OSDEVT_TEST_NONE,
} _OsdEvtTestValue;

#define OSD_RGB(r, g, b) ((UINT32)(((UCHAR8)(r)|((USHORT16)((UCHAR8)(g))<<8))|(((UINT32)(UCHAR8)(b))<<16)))
typedef enum _OsdColorType
{
    //OSD_BLACK = OSD_RGB(0x01, 0x01, 0x01),
    OSD_RED = OSD_RGB(0xFF, 0x00, 0x00),
    OSD_GREEN = OSD_RGB(0x00, 0xFF, 0x00),
    OSD_BLUE = OSD_RGB(0x00, 0x00, 0xFF),
    OSD_WHITE = OSD_RGB(0xFF, 0xFF, 0xFF),
    OSD_YELLOW = OSD_RGB(0xFF, 0xFF, 0x00),
#if 0
    OSD_GREY = OSD_RGB(0xBE, 0xBE, 0xBE),
    OSD_CYAN = OSD_RGB(0x00, 0xFF, 0xFF),
    OSD_MAGENTA = OSD_RGB(0xFF, 0x00, 0xFF),
    OSD_MIDNIGHTBLUE = OSD_RGB(0x70, 0x19, 0x19),
    OSD_NAVYBLUE = OSD_RGB(0x80, 0x00, 0x00),
    OSD_DARKGREEN = OSD_RGB(0x00, 0x64, 0x00),
    OSD_SEAGREEN = OSD_RGB(0x57, 0x8B, 0x2E),
    OSD_FORESTGREEN = OSD_RGB(0x22, 0x8B, 0x22),
    OSD_GOLD = OSD_RGB(0xD7, 0xFF, 0x00),
    OSD_CHOCOLATE = OSD_RGB(0x1E, 0x69, 0xD2),
    OSD_BROWN = OSD_RGB(0x5A, 0x2A, 0x2A),
    OSD_PINK = OSD_RGB(0xFF, 0xC0, 0xCB),
    OSD_LIGHTGREEN = OSD_RGB(0x90, 0xFF, 0x90),
    OSD_HIGHLIGHT = OSD_RGB(0x05, 0xD2, 0xDA),
    OSD_ENABLE_GREY = OSD_RGB(0xA9, 0xA9, 0xA9),
    OSD_DISABLE_GREY = OSD_RGB(0x46, 0x46, 0x46),
#endif
} OsdColorType;

typedef VOID(*OsdSceneEnterFn)(VOID);

typedef struct _OsdTestKeyList
{
    USHORT16 usKeyLevel1_2;
    USHORT16 usKeyLevel2_1;
    USHORT16 usKeyLevel1Next;

    USHORT16 usKeyLevel2_3;
    USHORT16 usKeyLevel3_2;
    USHORT16 usKeyLevel2Next;

    USHORT16 usKeyLevel3_4;
    USHORT16 usKeyLevel4_3;
    USHORT16 usKeyLevel3Next;

    USHORT16 usKeyLevel4_5;
    USHORT16 usKeyLevel5_4;
    USHORT16 usKeyLevel4Next;

    USHORT16 usKeyLevel5Next;
} OsdTestKeyList;

typedef struct _OsdTestScene
{
    UCHAR8 ucSceneId;
    OsdSceneEnterFn pfSceneEnterHandle;     /* SceneEnter函数句柄 */
    BOOL bIsAdjustable;                     /* 界面是否可调整，主菜单、快捷菜单 */
    USHORT16 usFirstItem;
    OsdTestKeyList  stKeyList;
} OsdTestScene;

typedef struct _OsdTestInfo
{
    BOOL bIsAutoTesting;
    UCHAR8  ucTestIndex;                   /* 测试项索引*/
    BOOL bTestInterrupt;
    BOOL bTestFirst;                       /* 首次进入当前Scene的一级菜单 */
    UCHAR8 ucTestNextAct;
    USHORT16 usLangIndex;
    UCHAR8  ucRotationIndex;
    UCHAR8  ucSceneIndex;
    UCHAR8  usCurrentSceneId;
    USHORT16 ucCurrentItemId;
    USHORT16 ucSelectedValue;              /* text_list/icon_list 选中项 */
    USHORT16 usLevel1TestedNum;
    USHORT16 usLevel2TestedNum;
    USHORT16 usLevel3TestedNum;
    USHORT16 usLevel4TestedNum;
    USHORT16 usLevel5TestedNum;
} OsdTestInfo;

typedef struct _OsdTestTextCfg
{
    USHORT16 usWinWidth;
    USHORT16 usWinHeight;
    USHORT16 usCurTextIndex;
    UCHAR8 ucColumns;
    UCHAR8 ucColorSel;
    UCHAR8 ucCurFontType;
    UCHAR8 ucCurPage;
    UCHAR8 ucLangStart;
} OsdTestTextCfg;

/**
 * @brief 自动化测试事件响应
 * @param[in] usValue1 事件响应参数
 */
VOID Hv_App_OsdAutoTestNextAct(USHORT16 usValue1);

/**
 * @brief 自动化测试事件入口函数
 * @param[in] usValue1 事件响应参数
 */
VOID Hv_App_OsdTestEnter(USHORT16 usValue1);

/**
 * @brief 设置自动化测试间隔时间
 * @param[in] uiTimeMs 间隔时间
 */
VOID Hv_App_OsdTestSetDelayTime(UINT32 uiTimeMs);

/**
 * @brief 是否正进行自动化测试
 */
BOOL Hv_Mw_OsdIsAutoTestRunning(VOID);

/**
 * @brief 遍历所有的Scene及菜单调整
 */
VOID Hv_App_OsdTestSceneAllStart(VOID);

/**
 * @brief 遍历所有的Scene
 */
VOID Hv_App_OsdTestSceneStart(VOID);

/**
 * @brief 多语言测试
 */
VOID Hv_App_OsdTestLanguage(VOID);

/**
 * @brief 测试暂停/继续
 */
VOID Hv_App_OsdTestPauseContinue(VOID);

/**
 * @brief 位置移动测试
 */
VOID Hv_App_OsdTestPosition(VOID);

/**
 * @brief 旋转测试
 */
VOID Hv_App_OsdTestRotation(VOID);

/**
 * @brief 透明度测试
 */
VOID Hv_App_OsdTestAlpha(VOID);

/**
 * @brief 准星检测
 */
VOID Hv_App_OsdTestCrosshair(VOID);

/**
 * @brief Text检测下一页
 */
VOID Hv_App_OsdTestTextNextPage(VOID);

/**
 * @brief 设置Text检测的Window的宽
 * @param[in] uiWinWidth Window宽
 */
VOID Hv_App_OsdTestTextSetWinWidth(UINT32 uiWinWidth);

/**
 * @brief 设置Text检测的Window的高
 * @param[in] uiWinWidth Window宽
 */
VOID Hv_App_OsdTestTextSetWinHeight(UINT32 uiWinHeight);

/**
 * @brief 设置Text检测显示的列数
 * @param[in] ucColumns 显示的列数
 */
VOID Hv_App_OsdTestTextSetColumns(UCHAR8 ucColumns);

/**
 * @brief 设置Text检测字体颜色
 * @param[in] ucColorSel 字体颜色索引
 */
VOID Hv_App_OsdTestTextSetColor(UCHAR8 ucColorSel);

/**
 * @brief 设置Text检测多语言索引
 * @param[in] ucLangStart 多语言索引
 */
VOID Hv_App_OsdTestTextSetSartLang(UCHAR8 ucLangStart);
#endif
#endif
