📄 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.
$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"
/* SPR#1428 - SH - New Editor changes */
#ifndef NEW_EDITOR
#include "mfw_edt.h"
#endif
#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"
/* SPR#1428 - SH - New Editor changes */
#ifdef NEW_EDITOR
#include "ATBCommon.h"
#include "ATBDisplay.h"
#include "ATBEditor.h"
#include "AUIEditor.h"
#include "AUIPinEditor.h"
#else
#include "MmiEditor.h"
#endif
#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 "MmiPins.h"
#include "MmiCphs.h"
#include "cus_aci.h"
#include "p_sim.h"
#include "pcm.h"
#include "mmiColours.h"
#include "Mmismsidle.h" //GW SPR#1035 - For smsidle_unset_ready_state(void) definition.
//#define CLEAR_PIN_EDIT_AREA dspl_Clear(0,30,LCD_X,LCD_Y);
/* PROTOTYPS */
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);
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 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);
/* SPR#1428 - SH - New Editor changes */
#ifdef NEW_EDITOR
void pins_loadEditDefault (T_AUI_EDITOR_DATA *editor_data, USHORT TitleId, USHORT Idenfitier);
#else /* NEW_EDITOR */
void pins_loadEditDefault (T_EDITOR_DATA *editor_data);
#endif /* NEW_EDITOR */
/* SPR#1746 - SH - Add identifier parameter */
void show_confirmation (T_MFW_HND win, USHORT Identifier);
static int show_confirmation_cb(T_MFW_HND win, USHORT identifier, UBYTE reason);
void pin_skClear( void );
void pin_rectClear( MfwRect *win );
// the coordinate of the TxtId
//moved info text defines to mmiresources.h
#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;
#ifdef NEW_EDITOR /* SPR#1428 - SH - New Editor changes */
T_ED_DATA * editor;
#else /* NEW_EDITOR */
T_MFW_HND editor_handle;
#endif /* NEW_EDITOR */
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];
#ifdef NEW_EDITOR /* SPR#1428 - SH - New Editor changes */
T_ED_ATTR editorPinAttr;
#else /* NEW_EDITOR */
MfwEdtAttr editpinAttr;
#endif /* NEW_EDITOR */
}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_editor_window;
static T_MFW_HND pin_mess_windows;
static T_MFW_HND set_pin_windows;
static T_MFW_HND sim_rem_handle;
//API define for a flag for PIN Emergency Entry
UBYTE pin_emergency_call;
char pin_emerg_call[MIN_PIN];
/*******************************************************************************
$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_editor_window)
{
#ifdef NEW_EDITOR
AUI_pin_Destroy(pin_editor_window);
#else
editor_destroy(pin_editor_window);
#endif
pin_editor_window = NULL;
}
if (pin_edit_windows)
pin_edt_destroy(pin_edit_windows);
if(pin_windows)
{
TRACE_FUNCTION("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);
pin_windows = data->pin_win;
pin_edit_windows = NULL;
pin_editor_window = NULL;
pin_mess_windows = NULL;
TRACE_FUNCTION("MmiPins:pin_create");
if (data->pin_win EQ 0)
return 0;
/*
* Create window handler
*/
data->mmi_control.dialog = (T_DIALOG_FUNC)pin_main;/* dialog main function */
data->mmi_control.data = data;
data->parent_win = parent_window;
win = ((T_MFW_HDR *)data->pin_win)->data;
win->user = (void *) data;
/*
* Create any other handler
*/
data->sim_handle = sim_create(data->pin_win,E_SIM_ALL_SERVICES,(MfwCb)sim_event_cb_main);
/*
* return window handle
*/
mfwSetSignallingMethod(1);//mfw focus handling
winShow(data->pin_win);
return data->pin_win;
}
/*******************************************************************************
$Function: pin_destroy
$Description: Destroy the pin dialog.
$Returns: None
$Arguments: window
*******************************************************************************/
void pin_destroy (T_MFW_HND own_window)
{
T_pin * data;
T_MFW_WIN * win;
TRACE_FUNCTION("MmiPins:pin_destroy");
if (own_window)
{
win = ((T_MFW_HDR *)own_window)->data;
data = (T_pin *)win->user;
if(data)
{
/*
* Exit SIM and Delete SIM Handler
*/
sim_delete (data->sim_handle);
/*
* Delete WIN Handler
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -