📄 mmihost.c
字号:
/*
+--------------------------------------------------------------------+
| PROJECT: MMI-Framework (8417) $Workfile:: Mmihost.c $|
| $Author: jhxu $Revision: 1.7 $|
| CREATED: 15.05.02 $Modtime:: |
| STATE : code |
+--------------------------------------------------------------------+
MODULE :
PURPOSE :
EXPORT :
TO DO :
********************************************************************************
$History: Mmihost.c
Date .................. Modification ......................................
25/05/02 xsf created Original Mobile Innovation BMI version.
16/08/02 version 0.101 xsf modified for list menu icons of hostkey protect options
19/08/02 version 0.102 xusufang modified
29/08/02 version 0.103 xsf modified
18/09/02 version 0.104 xsf modified for hostkey protect PRO_DELALLPBK etc.
$End
*******************************************************************************/
/*******************************************************************************
Include Files
*******************************************************************************/
#define ENTITY_MFW
/* includes */
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#if defined (NEW_FRAME)
#include "typedefs.h"
#include "vsi.h"
#include "pei.h"
#include "custom.h"
#include "gsm.h"
#else
#include "stddefs.h"
#include "custom.h"
#include "gsm.h"
#include "vsi.h"
#endif
#include "mfw_sys.h"
#include "p_sim.h"
#include "mfw_mfw.h"
#include "mfw_win.h"
#include "mfw_kbd.h"
#include "mfw_edt.h"
#include "mfw_lng.h"
#include "mfw_cm.h"
#include "mfw_icn.h"
#include "mfw_phb.h"
#include "ksd.h"
#include "psa.h"
#include "mfw_ss.h"
#include "mfw_sim.h"
#include "mfw_nm.h"
#include "mfw_sat.h"
#include "mfw_tim.h"
#include "mfw_mnu.h"
#include "mfw_sms.h"
#include "dspl.h"
#include "MmiMmi.h"
#include "MmiDummy.h"
#include "MmiDialogs.h"
#include "MmiLists.h"
// #include "MmiLang.h"
#include "MmiMain.h"
#include "MmiStart.h"
#include "MmiMenu.h"
#include "MmiSoftkeys.h"
#include "MmiIdle.h"
#include "mmiCall.h"
#include "MmiNetwork.h"
#include "MmiSounds.h"
#include "MmiSettings.h"
//#include "MmiServices.h"
#include "MmiIcons.h"
#include "MmiDialogs.h"
#include "MmiEditor.h"
#include "MmiPins.h"
#include "cus_aci.h"
#include "p_sim.h"
#include "pcm.h"
#include "Mmieditor.h"
#include "MmiBookUtils.h"
#include "Mmibookshared.h" //02.05.28
#include "Mmihost.h"
#include "Mfw_ffs.h"
#include "Psa_sim.h"
#include "Mmibooksearchwindow.h" //xsf 11.08
#include "Mmismsmenu.h" //xsf add 11.27 for PRO_MSGBOX
#include "Mmitoolkit_timer.h" //xsf add for display drawSolidRectangle() 12.28
#include "Gamedisplay.h"
#define CLEAR_PIN_EDIT_AREA dspl_Clear(0,30,LCD_X,LCD_Y);
void hostkey_loadEditDefault (T_EDITOR_DATA * editor_data);
static void hostkey_editor_cb (T_MFW_HND win, USHORT Identifier, SHORT reason);
int hostkey_change (struct MfwMnuTag * m, struct MfwMnuItemTag * i);
void hostkey_messages(T_MFW_HND win, USHORT event, SHORT value, void * parameter);
static int hostkey_mess_win_cb (T_MFW_EVENT event, T_MFW_WIN * win);
void hostkey_mess_destroy (T_MFW_HND own_window);
T_MFW_HND hostkey_mess_create (T_MFW_HND parent_window);
static void hostkey_call_mess(T_MFW_HND win, USHORT event);
static void hostkey_main(T_MFW_HND win, USHORT event, SHORT value, void * parameter);
static int hostkey_win_cb (T_MFW_EVENT event, T_MFW_WIN * win);
void hostkey_destroy (T_MFW_HND own_window);
T_MFW_HND hostkey_create (T_MFW_HND parent_window);
void hostkey_info_cb(T_MFW_HND win, USHORT identifier, UBYTE reasons);
void setting_hostkey_init (T_MFW_HND parent_window);
T_MFW_HND setting_hostkey_create (T_MFW_HND parent_window);
void hostkey_mess_destroy (T_MFW_HND own_window);
static int setting_hostkey_win_cb (T_MFW_EVENT event, T_MFW_WIN * win);
void setting_hostkey_main(T_MFW_HND win, USHORT event, SHORT value, void * parameter);
static void sett_hostkey_edit(T_MFW_HND win, USHORT event);
T_MFW_HND set_hostkey_edt_create (T_MFW_HND parent_window);
void set_hostkey_edt_destroy (T_MFW_HND own_window);
static int set_hostkey_edt_win_cb (T_MFW_EVENT event,T_MFW_WIN * win);
static void set_hostkey_editor(T_MFW_HND win, USHORT event, SHORT value, void * parameter);
static int set_hostkey_kbd_cb (T_MFW_EVENT event,T_MFW_KBD * kc);
static int set_hostkey_edt_kbd_long_cb (T_MFW_EVENT event,T_MFW_KBD * kc);
static void check_set_hostkey (T_MFW_HND win,void * edt_hostkey);
static void clear_edit_array (void * parameter);
int JudgeHostKey(char* L_Key);
void hostconfirms(T_MFW_HND win, USHORT event, SHORT value, void * parameter);
void hostconfirm_dialog_cb(T_MFW_HND win, UBYTE identifier, UBYTE reason);
static void hostconfirm_dialog(void);
static int hostconfirm_win_cb (T_MFW_EVENT event, T_MFW_WIN * win);
void hostconfirm_destroy (T_MFW_HND own_window);
T_MFW_HND hostconfirm_create (T_MFW_HND parent_window);
void hostconfirm_Exit (T_MFW_HND own_window);
T_MFW_HND hostconfirm_Init (T_MFW_HND parent_window);
T_MFW_HND hostkey_menu_start(MfwMnuAttr* menuAttr,T_VOID_FUNC func_cb);
void hostkey_menu (T_MFW_HND win, USHORT event, SHORT value, void * parameter);
static int hostkey_menu_win_cb (MfwEvt e, MfwWin *w);
static int hostkey_menu_kbd_cb (MfwEvt e, MfwKbd *k);
static int hostkey_menu_kbd_long_cb (MfwEvt e, MfwKbd *k);
static int hostkey_menu_mnu_cb (MfwEvt e, MfwMnu *m);
void hostkey_menu_end_cb(T_MFW_HND win);
void ReadSimIMSI(void) ;
/* defines */
#define MAX_DIG 30
#define MAX_HOST 9 /* maximum number of digits */
#define TIMER_OUT 30000 //time for entering
#define MAX_PIN 8
#define MIN_PIN 4
// the coordinate of the TxtId
#define INFO_TEXT_X 6
#define INFO_TEXT_Y 14 /* 2004/03/25 sunsj modify */
#define STAR 0x2a
#define HASH 0x23
#define SHOW_CONFIRM 3
#define ACTIVATE_CONFIRM 4
#define DEACTIVATE_CONFIRM 5
typedef struct
{
T_MMI_CONTROL mmi_control;
T_MFW_HND confirm_win; // MFW win handler
UBYTE local_status;
} T_hostconfirm;
T_hostconfirm hostconfirm;
typedef struct
{
T_MMI_CONTROL mmi_control;
T_MFW_HND parent_win;
T_MFW_HND hostkey_win;
//T_MFW_HND win_menu; //menu
USHORT display_id1;
USHORT display_id2;
UBYTE hostkey[MAX_PIN+1]; /* number string host key */
UBYTE new_hostkey[MAX_PIN+1]; /* store new hostkey */
UBYTE old_hostkey[MAX_PIN+1]; /* store old hostkey */
HOST_CASE hostkey_case; /* editor state */
char edtbuf[MAX_DIG];
UBYTE protect_opt; //xsf add for hostkey protect options
} T_hostkey;
typedef struct
{
T_MMI_CONTROL mmi_control;
T_MFW_HND parent_win;
T_MFW_HND hostkey_mess_win;
USHORT display_id1;
USHORT display_id2;
HOST_CASE hostkey_case;
}T_hostkey_mess;
typedef struct
{
T_MMI_CONTROL mmi_control;
T_MFW_HND parent_win;
T_MFW_HND hostkey_edt_win;
T_MFW_HND kbd_handle;
T_MFW_HND kbd_long_handle;
T_MFW_HND editor_handle;
T_MFW_HND tim_out_handle;
UBYTE hostkey[MAX_PIN+1]; /* number string host key */
UBYTE new_hostkey[MAX_PIN+1]; /* store new host key */
UBYTE old_hostkey[MAX_PIN+1]; /* store old host key */
UBYTE editor_index;
HOST_CASE hostkey_case_edit;
char edtbuf[MAX_DIG];
MfwEdtAttr edithostkeyAttr;
char hostkey_dspl[MAX_PIN+1];
}T_hostkey_edt;
typedef struct
{
T_MMI_CONTROL mmi_control;
T_MFW_HND parent_win;
T_MFW_HND win;
T_MFW_HND kbd;
T_MFW_HND kbd_long;
T_MFW_HND menu;
T_VOID_FUNC func_cb;
/*
* internal data
*/
} T_hostkey_menu;
static T_MFW_HND hostkey_windows;
static T_MFW_HND hostkey_edit_windows;
static T_MFW_HND hostkey_mess_windows;
static T_MFW_HND set_hostkey_windows;
//xsf 2002.07.17
static UBYTE l_data[MAX_SIM_CMD];
char SimLock1=0;
char ProOnLock=0;//hostkey protect switchon flag
extern UBYTE animation_complete;
static T_MFW_HND pro_options_win; //xsf 11.08
/*******************************************************************************
$Function: hostkey_menu_check
$Description: If the inputed hostkey is not correct hostkey menu
will not appear in the menulist
$Returns:
$Arguments:
*******************************************************************************/
//USHORT hostkey_menu_check (struct MfwMnuTag *m, struct MfwMnuAttrTag *ma, struct MfwMnuItemTag *mi)
int hostkey_menu_check(struct MfwMnuTag * m, struct MfwMnuItemTag * i)
{
T_MFW_HND idle_win = idle_get_window();
T_MFW_HND win = hostkey_create(idle_win);
T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
T_hostkey * hostkey_data = (T_hostkey *)win_data->user;
TRACE_EVENT("Mmihost.c:hostkey_menu_check()");
if( FlashHostkeyData.HostLock_flag )
SEND_EVENT(hostkey_data->hostkey_win,HOSTKEY_ASK_MENU,0,hostkey_data);
else //xsf changed for can't change hostkey protect options without hostkey_open 2002/10/16
{
hostkey_destroy(hostkey_data->hostkey_win);// finish main pin dialog
hostconfirm_Init(idle_win);
hostconfirm.local_status = ACTIVATE_CONFIRM;
SEND_EVENT (hostconfirm.confirm_win, SHOW_CONFIRM, 0, 0);
}
//else
//SEND_EVENT(hostkey_data->hostkey_win,HOSTKEY_MENU_END,0,hostkey_data);
return 1;
}
/*******************************************************************************
$Function: hostkey_init
$Description: This is the start-up time initialisation routine.
call from init routine in the idle
$Returns: None
$Arguments: parent window
*******************************************************************************/
void hostkey_init (T_MFW_HND parent_window)
{
T_MFW_HND idle_win = idle_get_window();
T_MFW_HND win = hostkey_create(idle_win);
T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
T_hostkey * hostkey_data = (T_hostkey *)win_data->user;
TRACE_EVENT("Mmihost.c:hostkey_init()");
//2002.07.16
//if(CheckPassWord(PRO_ON))
SEND_EVENT(hostkey_data->hostkey_win,HOSTKEY_ASK,0,hostkey_data);
//else
//SEND_EVENT(hostkey_data->hostkey_win,HOSTKEY_OK_END,0,hostkey_data);
// hostkey_create (parent_window);
}
/*******************************************************************************
$Function: hostkey_create
$Description: Creation of an instance for the HOSTKEY dialog
Type of dialog : SINGLE_DYNAMIC
$Returns: Window
$Arguments: Parent window
*******************************************************************************/
T_MFW_HND hostkey_create (T_MFW_HND parent_window)
{
T_MFW_WIN * win;
T_hostkey * data = (T_hostkey*)ALLOC_MEMORY (sizeof (T_hostkey));
data->hostkey_win = win_create (parent_window, 0, MfwWinVisible, (T_MFW_CB)hostkey_win_cb);
hostkey_windows = data->hostkey_win;
hostkey_edit_windows = NULL;
hostkey_mess_windows = NULL;
TRACE_EVENT("Mmihost.c:hostkey_create");
if( data->hostkey_win EQ 0 )
return 0;
/*
* Create window handler
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -