⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 o_password_prompt.c

📁 Zoran V966 DVD 解码 Soc芯片的源程序
💻 C
📖 第 1 页 / 共 2 页
字号:
/* **************************************************************************************
*  Copyright (c) 2004 ZORAN Corporation, All Rights Reserved
*  THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF ZORAN CORPORATION
*
*  File: $Workfile: o_password_prompt.c $
*
* Description:
* ============
* Project definition of the MSO_PASSWORD_PROMPT
*
****************************************************************************************/
#include "Config.h"				// Global Configuration - do not remove!
#include "Include\SysDefs.h"	// Global definition - do not remove!

#ifdef DEBUG_UI_TRACE
#undef IFTRACE
#define IFTRACE if (gTraceUI)
#include "Debug\DbgMain.h"
#endif //DEBUG_UI_TRACE

/***************************************************************************************
* Include files
****************************************************************************************/
#include <stdio.h>
#include <string.h>
#include "Kernel\eventdef.h"
#include "Playcore\Coremain\Coremain.h"
#include "Playcore\Coremain\CoreGDef.h"
#include "Playcore\Ps\Ps.h"

//Include API Files
#include "CoreAPI\CoreAPI.h"

// Included string related files
#include "Library\Container_Misc.h"

// Included UI MENU SYSTEM files
#include "GUI\Menu_system\ms_menu.h"
#include "GUI\Menu_system\ms_object.h"
#include "GUI\menu_system\ms_navigation.h"
#include "GUI\menu_system\osd_rendering.h"
#include "GUI\menu_system\ms_display.h"
#include "GUI\Menu_system\ms_screen.h"
#include "GUI\Menu_system\ms_component.h"
#include "GUI\Menu_system\ms_send_op.h"

#include "GUI\Object_class\Text\mso_text.h"
#include "GUI\Object_class\Edit\mso_edit.h"
#include "GUI\Object_class\Button\mso_button.h"

// Included CUSTOMER files
#include "Components\Password\o_password_prompt.h"
#include "Resource\Bitmap\bitmap.h"
#include "Menu\menu_operation_def.h"
#include "Menu_config\menu_config_common.h"

#ifndef DEBUG_UI_TRACE
#undef dbg_printf(sMsg)
#define dbg_printf(sMsg)
#undef	dbgm_printf(sMsg, mode)
#define dbgm_printf(sMsg, mode)
#endif

// Include the module header file
#include "Components\Password\o_password_prompt.h"
// Include custom header file: customer specific definitions, over-writing common ones.
#include "Components\Password\o_password_prompt_config.h"
// Include configuration header file: named constants, macros and typedefs.
#include "Components\Custom\Password\o_password_prompt_custom.h"


/***************************************************************************************
* 	Utility functions
****************************************************************************************/
static BOOL _RetryInputPassword(MSO_OBJECT __NEAR* pPasswordWnd);
static void _GetFormUniStr_ConfirmationMessage(FORMATED_UNICODE_STRING __NEAR *pFormattedString, UINT32 wParam);
static void _HidePasswordEdit(MSO_OBJECT __NEAR* pPasswordWnd, BOOL bHide);
static void _SetPasswordStatus(MSO_OBJECT __NEAR* pObjectPassword, PASSWORD_STATUS tStatus);
static PASSWORD_STATUS _GetPasswordStatus(MSO_OBJECT __NEAR* pObjectPassword);
static  BOOL _CheckPassword(MSO_OBJECT __NEAR* pObjectPassword, UINT16 wPassword);


/***************************************************************************************
* 	Operation functions
****************************************************************************************/
static MS_OP _PasswordEditOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
static MS_OP _PasswordPromptOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);

/***************************************************************************************
* 	Display functions
****************************************************************************************/
static BOOL _PasswordEditFillOSDSeg(MSO_OBJECT __NEAR* pEditObject, MS_AREA __NEAR* pAbsArea);

/***************************************************************************************
* 	Include customization file.
****************************************************************************************/

// Include custom code file: customer specific code, over-writing common one.
#include "Components\Custom\Password\o_password_prompt_custom.c"
// Include configuration file: constants.
#include "Components\Password\o_password_prompt_config.c"


// TODO: Move to setup menu object or global file in UI
PASSWORD_STATUS gtPasswordStatusSetup;
PASSWORD_STATUS gtPasswordStatusDVDA;
/***************************************************************************************
* 	Utility functions
****************************************************************************************/

/***************************************************************************************
*	Function	: 	_RetryInputPassword
*
*	In		: 	pThis 	= 	point to password prompt.
*
*	Out		: 	None.
*
*	Return	:	TRUE  	=	need try to input password again.
*
*				FALSE	=	no need input again.
*
*	Desc 	:	this for user input password up to serial times if it is not correct when at 
*				beginning playback DVD
****************************************************************************************/
static BOOL _RetryInputPassword(MSO_OBJECT __NEAR* pPasswordWnd)
{
	if(MS_IS_PASSWORD_FOR_DVD(pPasswordWnd))
	{
		if(((MSO_PASSWORD_PROMPT __NEAR*)pPasswordWnd)->moParam.mwRetryTimes-- >1)
			return TRUE;
	}
	return FALSE;
}

/***************************************************************************************
*	Function	: 	_GetFormUniStr_ConfirmationMessage
*
*	In		: 	pFormattedString	=	Formatted UNICODE string.
*
*				wParam			=	
*
*	Out		: 	None.
*
*	Return	:	None.
*
*	Desc 	:	
****************************************************************************************/
static void _GetFormUniStr_ConfirmationMessage(FORMATED_UNICODE_STRING __NEAR *pFormattedString, UINT32 wParam)
{
	if((S_INCORRECT_PASSWORD != wParam) && (S_CORRECT_PASSWORD != wParam))
		OSDR_GetFormUniStr_OsdMessage(pFormattedString, S_NULL);
	
	else OSDR_GetFormUniStr_OsdMessage(pFormattedString, wParam);
}

/***************************************************************************************
*	Function	: 	_HidePasswordEdit
*
*	In		: 	pPasswordWnd	=	Pointer to the Password component.
*
*				bHide			=	TRUE if the password edit object needs to be hidden.
*
*	Out		: 	None.
*
*	Return	:	None.
*
*	Desc 	:	Hides the password edit and password set/prompt labels.
****************************************************************************************/
// TODO: re-implement, avoid displaying every time
static void _HidePasswordEdit(MSO_OBJECT __NEAR* pPasswordWnd, BOOL bHide)
{
	if(NULL != pPasswordWnd)
	{
		MSO_OBJECT __NEAR* pObject = MS_FindDescendant(pPasswordWnd, &oPasswordEditDescriptor);

		if(NULL != pObject)
		{
			if(TRUE == bHide)
				MS_SetInvisible(pObject);
			else
				MS_ClearInvisible(pObject);
		}

		pObject = MS_FindDescendant(pPasswordWnd, &oPasswordSetLabelDescriptor);
		
		if(NULL != pObject)
		{
			if(TRUE == bHide)
				MS_SetInvisible(pObject);
			else
				MS_ClearInvisible(pObject);
		}

		pObject = MS_FindDescendant(pPasswordWnd, &oPasswordLabelDescriptor);

		if(NULL != pObject)
		{
			if(TRUE == bHide)
				MS_SetInvisible(pObject);
			else
				MS_ClearInvisible(pObject);
		}

		pObject = MS_FindDescendant(pPasswordWnd, &oDescriptorPasswordCheck);
		if(NULL != pObject)
		{
			if(TRUE != bHide)
				MS_SetInvisible(pObject);
			else
				MS_ClearInvisible(pObject);
		}
	}

	MS_DisplayAddObject(pPasswordWnd);
}

/***************************************************************************************
* 	Operation functions
****************************************************************************************/

/***************************************************************************************
*	Function 	: 	_PasswordPromptOperation
*
*	In		:
*
*	Out		:
*
*	Desc 	:	user operation function.
****************************************************************************************/
static MS_OP _PasswordPromptOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam)
{
	MSO_PASSWORD_PROMPT __NEAR* pPasswd = (MSO_PASSWORD_PROMPT __NEAR*)pThis;

	switch(MsOp)
	{
	case MS_OP_INIT:
		{
			if(!MS_IsSetPasswordPrompt(pThis))
				pPasswd->moParam.mwRetryTimes = PASSWORD_RETRY_TIMES;
			
			pPasswd->moParam.mwTimeout = 0;
			gtPasswordStatusDVDA = PASSWORD_IN_PROGRESS;
			MS_ComponentInitFocus((MSO_COMPONENT __NEAR*)pThis);
		}
		break;
		
	case MS_OP_TICK: //if time out core will set password  state as ok or fail , so here check the stat and close it
		{
			if(pPasswd->moParam.mwTimeout)
				pPasswd->moParam.mwTimeout--;
			else
			{
				if (PASSWORD_IN_PROGRESS == _GetPasswordStatus(pThis))
					_HidePasswordEdit(pThis, FALSE);
				else
					MsOp = MS_OP_CLOSE_PARENT;
			}
		}
	        break;
		
	case MS_OP_EJECT:
		MS_SendOperation(pThis, MS_OP_CLOSE_PARENT, 0);
		break;

	default:
		break;
	}
	return MS_ComponentBasicOperation(pThis, MsOp, lParam);
}


/***************************************************************************************
*	Function 	: 	_PasswordEditOperation
*
*	In		:
*
*	Out		:
*
*	Desc 	:	The Operation function for the Password Prompt.
****************************************************************************************/
static MS_OP _PasswordEditOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam)
{
	switch(MsOp)
	{
	case MS_OP_0: // Fall Through !!!
	case MS_OP_1: // Fall Through !!!
	case MS_OP_2: // Fall Through !!!
	case MS_OP_3: // Fall Through !!!
	case MS_OP_4: // Fall Through !!!
	case MS_OP_5: // Fall Through !!!
	case MS_OP_6: // Fall Through !!!
	case MS_OP_7: // Fall Through !!!
	case MS_OP_8: // Fall Through !!!
	case MS_OP_9: // Fall Through !!!
	case MS_OP_ENTER:
		{
			MSO_EDIT __NEAR *pEditObject = (MSO_EDIT __NEAR*)pThis;
			FORMATED_UNICODE_STRING sFormattedString;
				
			OSDR_GetFormUniStr_ScFormatted((FORMATED_UNICODE_STRING __NEAR*)&sFormattedString, 	(UINT32)pEditObject->moParam.ScPtr);
			
			if((sFormattedString.mcStrLength >= PASSWORD_CHARS) && (MS_OP_ENTER != MsOp))
			{
				PROHIBIT(MSG_PROHIBIT_NOT_ALLOWED_NOW);
				return MS_OP_NONE;
			}
			
			if(MS_OP_ENTER == MsOp)
			{
				if(PASSWORD_CHARS == sFormattedString.mcStrLength)
				{
					UINT8 cIndex;
					UINT8 cFactor;
					MSO_OBJECT __NEAR* pPasswordPrompt = MS_FindAncestor(pThis, &oPasswordPromptDescriptor);
					MS_ASSERT(NULL != pPasswordPrompt);

					
					// lParam is not being used at this point - use it to hold the numeric value of the password

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -