EntryScrnSimErrorScreen()
EntryScrnSimBlockRsp()
中,都设置:mmi_frm_kbd_reg_pre_key_hdlr(IdleScreenEmergencyCallCheckNKeypadLock);就是设置:frm_p->kbd_pre_func = IdleScreenEmergencyCallCheckNKeypadLock;
就是在键盘锁的情况下,判断用户按键是否是紧急号码。

U8 IdleScreenEmergencyCallCheckNKeypadLock(KEYBRD_MESSAGE *eventKey)
{
if (g_keylock_context.gKeyPadLockFlag)
{
EmergencyCallCheck(eventKey->nKeyCode, eventKey->nMsgType);
}
}

emgNumberArr【】数组用来接收用户的输入。
void EmergencyCallCheck(S16 keyCode, S16 keyType)
{
if ((keyCode >= 0) && (keyCode <= 9))
{
emgNumberArr[EmergengyNoArrIndex] = *aTemp;

//对输入的号码从第一个开始,逐个匹配
for (i = 0; (EmergengyNoArrIndex > 0) || emgNumberArr != NULL; i++)
{
AnsValidateEmgNo = ValidateEmergencyNo(emgNumberArr);
对数组emgNumberArr 【】中的号码与紧急号码进行匹配。
返回值:0—与紧急号码不匹配
1—与紧急号码部分匹配
2—与紧急号码完全匹配

switch (AnsValidateEmgNo)
{
case 0: //从第二个数字开始继续匹配
memcpy(
emgNumberArr,
emgNumberArr + ENCODING_LENGTH,
(EMERGENCY_NUMBER_LENGTH* CODING_LENGTH));

if(已经是最后一个数字了) //清空emgNumberArr,退出循环
{
memset(emgNumberArr, 0, (EMERGENCY_NUMBER_LENGTH + 1) * ENCODING_LENGTH);
EmergengyNoArrIndex = 0;
break;
}
EmergengyNoArrIndex=EmergengyNoArrIndex- NCODING_LENGTH;
continue; //继续匹配

case 1: //部分匹配
break; //继续接收用户输入的号码
case 2: //完全匹配
isEmergencyCallDropped = 0;
EntryNewScreen(EMERENCY_CALL_SCR_DISPLAY_ID, ExitEmergencyCallScr, NULL, NULL);
EmergengyNoArrIndex = 0;
gEmerencyNoDialed = 1;

//显示这个紧急号码
ShowCategory16Screen(0, 0,
STR_GLOBAL_BACK, IMG_GLOBAL_BACK,
(U8*) emgNumberArr, 4, NULL);
ClearInputEventHandler(MMI_DEVICE_ALL);

//开始设置按键响应
SetGroupKeyHandler(DropEmergencyCall,
(PU16) PresentAllKeys,
TOTAL_KEYS,
KEY_EVENT_UP);
StartTimer(
EMERGENCY_NO_DIALED_TRANSIANT_SCR_TIMER,
EMERGENCY_NO_DIALED_TRANSIANT_SCR_TIMEOUT,
DropEmergencyCall);
ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
SetRightSoftkeyFunction(DropEmergencyCall,
KEY_EVENT_DOWN);
SetKeyHandler(MakeEmergencyCall, KEY_SEND,
KEY_EVENT_UP);
SetKeyHandler(DropEmergencyCall,KEY_END, EY_EVENT_DOWN);
TurnOnBacklight(1);
break;
default:
memset(emgNumberArr, 0, (EMERGENCY_NUMBER_LENGTH
+ 1) * ENCODING_LENGTH);
EmergengyNoArrIndex = 0;
break;
}
}
}
else
{ //如果输入的不是数字,就全部清空emgNumberArr【】。
memset(mgNumberArr, 0,
RGENCY_NUMBER_LENGTH + 1) * ENCODING_LENGTH);
EmergengyNoArrIndex = 0;
}
}

放弃紧急拨号:
void DropEmergencyCall(void)
{
isEmergencyCallDropped = 1;
StopTimer(EMERGENCY_NO_DIALED_TRANSIANT_SCR_TIMER);
memset(emgNumberArr, 0, (EMERGENCY_NUMBER_LENGTH + 1) *
ENCODING_LENGTH);
DisplayIdleScreen();
{
ExecuteRootMainHistoryScreen()
{
EntryIdleScreen(); 在匹配紧急号码过程中,标志键盘锁的变量:
g_keylock_context.gKeyPadLockFlag一直为1,因此再次进入
EntryIdleScreen()时,键盘仍然是锁定的。
}
}
}

按下SEND键,拨紧急号码:
void MakeEmergencyCall(void)
{
StopTimer(EMERGENCY_NO_DIALED_TRANSIANT_SCR_TIMER);
MakeCall(emgNumberArr);
memset(emgNumberArr, 0,
(EMERGENCY_NUMBER_LENGTH + 1) * ENCODING_LENGTH);
}