📄 mmipins.c
字号:
/*******************************************************************************
CONDAT (UK)
********************************************************************************
This software product is the property of Condat (UK) Ltd and may not be
disclosed to any third party without the express permission of the owner.
********************************************************************************
$Project name: Basic MMI
$Project code: BMI (6349)
$Module: MMI
$File: MmiPins.c
$Revision: 1.0
$Author: Condat(UK)
$Date: 25/10/00
********************************************************************************
Description:
MMI PIN / PUK entry handling
********************************************************************************
$History: MmiPins.c
25/10/00 Original Condat(UK) BMI version.
19/08/02 version 0.101 xusufang modified
29/08/02 version 0.102 xusufang modified
04/09/02 version 0.103 ganchunhui change ss_check_ss_string ss_check_ss_string_pin
05/09/02 version 0.104 ganchunhui add patch to make power off available while no sim card or input pins
$End
*******************************************************************************/
/*******************************************************************************
Include Files
*******************************************************************************/
#define ENTITY_MFW
#undef _PINAUTOINPUT_
/* 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 "MmiCphs.h"
#include "cus_aci.h"
#include "p_sim.h"
#include "pcm.h"
#include "mfw_ffs.h" //xsf add 2002.08.05 2 lines
#include "Mmihost.h"
#include "Mmitoolkit_timer.h" //xsf add for display drawSolidRectangle() 12.28
#include "Gamedisplay.h"
#include "mmicharging.h" //hxl add 2002-9-25 for charger icon
#include "pwr.h"
#include "Mmismsidle.h" //GW SPR#1035 - For smsidle_unset_ready_state(void) definition.
#include "fieldtest.h"
#include "mmiutilapi.h"
#define CLEAR_PIN_EDIT_AREA dspl_Clear(0,30,120,91);
extern UBYTE HUPKeyOrigin; // xsf - set to 1 if POWER_KEY is pressed in input pin1/puk1 screen when switch on the mobile
extern UBYTE animation_complete;
static unsigned char IsFirstPinReq=1;
/* PROTOTYPES */
static int pin_win_cb (T_MFW_EVENT event, T_MFW_WIN * win);
static int pin_edt_win_cb (T_MFW_EVENT event, T_MFW_WIN * win);
static int pin_edt_kbd_cb (T_MFW_EVENT event, T_MFW_KBD * kc);
static void check_pins (T_MFW_HND win,void * edt_pin);
static void gsm_sec_execute(T_MFW_HND win,void *string);
static void pin_edt_tim_out_cb (T_MFW_EVENT event,T_MFW_TIM * t);
static int pin_mess_win_cb (T_MFW_EVENT event, T_MFW_WIN * win);
//static void pin_icons(void);//2003/12/20,talcon comment
static void clear_edit_array (void * parameter);
static void emerg_pin(void * string);
static int sim_rem_win_cb (T_MFW_EVENT event, T_MFW_WIN * win);
static void pin_main(T_MFW_HND win, USHORT event, SHORT value, void * parameter);
static int gsm_test(T_MFW_HND win,void * edt_pin);
static void pin_editor(T_MFW_HND win, USHORT event, SHORT value, void * parameter);
static void sim_rem_main(T_MFW_HND win, USHORT event, SHORT value, void * parameter);
static int pin_edt_kbd_long_cb (T_MFW_EVENT event,T_MFW_KBD * kc);
static void main_call_edit(T_MFW_HND win, USHORT event);
static void main_call_mess(T_MFW_HND win,USHORT event);
static int setting_pin_win_cb (T_MFW_EVENT event, T_MFW_WIN * win);
static int set_pin_mess_win_cb (T_MFW_EVENT event, T_MFW_WIN * win);
static void sett_pin_mess(T_MFW_HND win,USHORT event);
static void check_set_pins (T_MFW_HND win,void * edt_pin);
static int set_pin_kbd_cb (T_MFW_EVENT event,T_MFW_KBD * kc);
static void set_pin_editor(T_MFW_HND win, USHORT event, SHORT value, void * parameter);
static int set_pin_win_cb (T_MFW_EVENT event,T_MFW_WIN * win);
static void sett_pin_edit(T_MFW_HND win,USHORT event);
static int gsm_set_test(T_MFW_HND win,void * edt_pin);
static void set_mode_fdn_adn(T_MFW_HND win,void * string);
static void check_plock_to_clock(T_MFW_HND win,USHORT event);
static void check_nlock_to_clock(T_MFW_HND win,USHORT event);
static void check_splock_to_clock(T_MFW_HND win,USHORT event);
static void check_nslock_to_clock(T_MFW_HND win,USHORT event);
static void check_sim_clock(T_MFW_HND win,USHORT event);
static void pin_ch_end_or_abort (T_MFW_HND win);
static void pin_verif_or_check2_end(T_MFW_HND win);
static void pin1_en_dis_verify(T_MFW_HND win);
static int set_pin_edt_win_cb (T_MFW_EVENT event,T_MFW_WIN * win);
static void reset_edt_attr(U16 winPx,U16 winPy,U16 winSx,U16 winSy,U8 fgColor,U8 font,U8 mode,
U8 *controls, char *text,U16 size,MfwEdtAttr* attr);
static int set_pin_edt_kbd_long_cb (T_MFW_EVENT event,T_MFW_KBD * kc);
static void gsm_sec_execute_set(T_MFW_HND win,void *string);
void pin2_not_available_screen();
static void not_avail_cb(T_MFW_HND win, UBYTE identifier, UBYTE reason);
static void pins_editor_cb (T_MFW_HND win, USHORT Identifier, SHORT reason);
void pin1_not_enabled_screen();
static void pins_editor_cb (T_MFW_HND win, USHORT Identifier, SHORT reason);
void pins_loadEditDefault (T_EDITOR_DATA *editor_data);
void show_confirmation (T_MFW_HND win);
static int show_confirmation_cb(T_MFW_HND win, USHORT identifier, UBYTE reason);
//hxl add for charger 2002-9-25---------------------------------
extern UBYTE BlinkBatPicnum;
extern UBYTE CurrentBatPicNum;
static UBYTE pinsentpoweroff=0;
static MfwHnd gtimeBlink=0;
static UBYTE IsBlinktimerRun=0;
static void batEvent(void);
static int pin_charger_tim_cb (MfwEvt e, MfwTim *t);
//end of hxl add-----------------------------------------------------
/* EDITOR DEFINITION */
/*
static char one_attempts[] =
{
"1 try left "
};
static char two_attempts[] =
{
"2 tries left "
};
*/
#define MAX_DIG 12 //xsf change 30 to 9 12.28 /* maximum number of digits */
#define MAX_PIN 8 /* maximum number of PIN/PUK */
#define MIN_PIN 4
#define TIMERESULT 500 /* time for results(later to change!!*/
#define TIMEOUT 30000 /* time for entering */
// the coordinate of the TxtId
#if (MAIN_LCD_SIZE==3)
#define INFO_TEXT_X 14 //xsf change 0 to 10 2002.08.21
#define INFO_TEXT_Y 30 //xsf change from 6 to 30 2002.08.16
#elif ( MAIN_LCD_SIZE==4 )
#define INFO_TEXT_X 14 //xsf change 0 to 10 2002.08.21
#define INFO_TEXT_Y 30 //xsf change from 6 to 30 2002.08.16
#elif ( MAIN_LCD_SIZE==2 )
#define INFO_TEXT_X 10
#define INFO_TEXT_Y SECOND_LINE
#endif
#define PIN_ENTRY_MAX 3
#define STAR 0x2a
#define HASH 0x23
#define FIRST_DIGIT 1
#define NUM_OF_PLOCK 6
#define IDENT_GSM_1 5
#define IDENT_GSM_2 6
#define TIM_LOCK 0x01
#define TIM_LOCK_JUMP 1000
typedef struct
{
T_MMI_CONTROL mmi_control;
T_MFW_HND parent_win;
T_MFW_HND pin_win;
T_MFW_HND sim_handle;
int pin_retries; /* number of pin attempts */
UBYTE puk_request;
USHORT display_id1;
USHORT display_id2;
UBYTE gsm_state; /* status gsm in security */
SET_CASE set_state; /* setting state */
UBYTE pin[MAX_DIG+1]; /* number string pin */
UBYTE puk[MAX_PIN+1]; /* number string puk */
UBYTE new_pin[MAX_PIN+1]; /* store new pin */
UBYTE old_pin[MAX_PIN+1]; /* store old pin */
PIN_CASE pin_case; /* editor state */
char edtbuf[MAX_DIG];
} T_pin;
typedef struct
{
T_MMI_CONTROL mmi_control;
T_MFW_HND parent_win;
T_MFW_HND pin_mess_win;
USHORT display_id1;
USHORT display_id2;
PIN_CASE pin_case;
}T_pin_mess;
typedef struct
{
T_MMI_CONTROL mmi_control;
T_MFW_HND parent_win;
T_MFW_HND pin_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 pin[MAX_PIN+1]; /* number string pin */
UBYTE puk[MAX_PIN+1]; /* number string puk */
UBYTE new_pin[MAX_PIN+1]; /* store new pin */
UBYTE old_pin[MAX_PIN+1]; /* store old pin */
UBYTE editor_index;
PIN_CASE pin_case_edit;
UBYTE gsm_state; /* status gsm in security */
UBYTE emergency_call;
char edtbuf[MAX_DIG];
MfwEdtAttr editpinAttr;
char pin_dspl[MAX_PIN+1];
}T_pin_edt;
typedef struct
{
T_MMI_CONTROL mmi_control;
T_MFW_HND parent_win;
T_MFW_HND sim_rem_win;
T_MFW_HND sim_handle;
PIN_CASE pin_case;
USHORT display_id1;
} T_sim_rem;
LOCAL T_sim_rem sim_rem_data;
static T_MFW_HND pin_windows;
static T_MFW_HND pin_edit_windows;
static T_MFW_HND pin_mess_windows;
static T_MFW_HND set_pin_windows;
static T_MFW_HND sim_rem_handle;
/*******************************************************************************
$Function: pin_init
$Description: This is the start-up time initialisation routine.
call from init routine in the idle
$Returns: None
$Arguments: parent window
*******************************************************************************/
void pin_init (T_MFW_HND parent_window)
{
pin_create (parent_window);
}
/*******************************************************************************
$Function: pin_exit
$Description: power down in security screen
$Returns: None
$Arguments: None
*******************************************************************************/
void pin_exit (void)
{
if ( pin_mess_windows )
pin_mess_destroy(pin_mess_windows);
if ( pin_edit_windows )
pin_edt_destroy(pin_edit_windows);
if ( pin_windows )
{
TRACE_EVENT("pin_destroy 1");
pin_destroy (pin_windows);
}
}
/*******************************************************************************
$Function: pin_create
$Description: Creation of an instance for the PIN dialog (sim activation)
Type of dialog : SINGLE_DYNAMIC
$Returns: Window
$Arguments: Parent window
*******************************************************************************/
T_MFW_HND pin_create (T_MFW_HND parent_window)
{
T_MFW_WIN * win;
T_pin * data = (T_pin *)ALLOC_MEMORY (sizeof (T_pin));
data->pin_win = win_create (parent_window, 0, MfwWinVisible, (T_MFW_CB)pin_win_cb);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -