1. [话机设置]中的[速拨]设置
资源加载:
populateSettingMenu()
PopulatePhoneSetupResData()
ADD_APPLICATION_MENUITEM((MENU_SETTING_SPEED_DIAL, MENU9102_INITIAL_SETUP, 2,
MENU_SETTING_SPEED_STATUS,
MITEM113_PBOOK_SPEED_DIAL,
SHOW, (MOVEABLEACROSSPARENT | SHORTCUTABLE), DISP_LIST, STR_MENU_SETTING_SPEED_DIAL, 0));
ADD_APPLICATION_MENUITEM((MENU_SETTING_SPEED_STATUS, MENU_SETTING_SPEED_DIAL, 0,
SHOW, NONMOVEABLE, DISP_LIST, STR_SETTING_SPEED_STATUS, 0));
ADD_APPLICATION_MENUITEM((MITEM113_PBOOK_SPEED_DIAL, MENU_SETTING_SPEED_DIAL, 0,
SHOW, NONMOVEABLE, DISP_LIST, STR_SCR_SPEED_DIAL_MAIN_CAPTION, IMG_GLOBAL_L2));
/* Speed Dial - Operation */
ADD_APPLICATION_MENUITEM((MENU_ID_SPEED_DIAL_OPERATION, 0, 2,
MENU_ID_SPEED_DIAL_OP_EDIT,
MENU_ID_SPEED_DIAL_OP_DEL, SHOW, NONMOVEABLE, DISP_LIST, STR_MENU_SETTING_SPEED_DIAL, 0));
ADD_APPLICATION_MENUITEM((MENU_ID_SPEED_DIAL_OP_EDIT, MENU_ID_SPEED_DIAL_OPERATION, 0,
SHOW, NONMOVEABLE, DISP_LIST, STR_GLOBAL_EDIT, 0));
ADD_APPLICATION_MENUITEM((MENU_ID_SPEED_DIAL_OP_DEL, MENU_ID_SPEED_DIAL_OPERATION, 0,
SHOW, NONMOVEABLE, DISP_LIST, STR_GLOBAL_DELETE, IMG_GLOBAL_L2));
2.初始化过程:
InitAllApplications()
mmi_phb_init()
void PhbInitSpeedDial(void)
{
SetHiliteHandler(MENU_SETTING_SPEED_DIAL, HighlightPhbSpeedDial);
SetHiliteHandler(MITEM113_PBOOK_SPEED_DIAL, HighlightPhbSpeedDialSetNum);
SetHiliteHandler(MENU_SETTING_SPEED_STATUS, HighlightPhbSpeedDialStatus);
SetHintHandler(MENU_SETTING_SPEED_DIAL, HintPhbSpeedDial);
SetHintHandler(MENU_SETTING_SPEED_STATUS, HintPhbSpeedDial); /* SetHintHandler(MENU_SETTING_SPEED_STATUS,HintSpeedDialOn); */
SetHiliteHandler(MENU_ID_SPEED_DIAL_OP_EDIT, HighlightPhbSpeedDialSetNumOptionEdit);
SetHiliteHandler(MENU_ID_SPEED_DIAL_OP_DEL, HighlightPhbSpeedDialSetNumOptionDel);
}
相关的变量:
CurrentSpeedType-------------速拨功能是否开启
CurrentSpeedTypeChange-----在函数ExitPhbSpeedDial()中判断,以重写NVRAM中的值。NVRAM_SETTING_SPEED_DIAL
SpeedDialInfo speedDialTable[MAX_SPEED_DIAL_NUMBER]; ----------------速拨的信息(电话号码),
数据结构SpeedDialInfo为:
type;
storage;
record_index;
number[]
name[]
currentKeyIndex------------在速拨清单中,当前高亮的MENU索引
速拨号码的初始化:
开机之后,mmi_phb_get_entry_by_index_req(),发送消息PRT_PHB_GET_ENTRY_BY_INDEX_REQ到L4。
并设置:
SetProtocolEventHandler(mmi_phb_get_entry_by_index_rsp, PRT_PHB_GET_ENTRY_BY_INDEX_RSP);
在CBack函数中,
mmi_phb_get_entry_by_index_rsp()
PhbGetSpeedDialInfo( )
PhbReadSpeedDialNVRAM()
ReadRecord(NVRAM_EF_PHONEBOOK_SPEEDDIAL_LID, 1, speedDialTable, NVRAM_SPEEDDIAL_RECORD_SIZE, &error);
(1)[速拨]入口函数:
EntryPhbSpeedDial()
ShowCategory52Screen()
(2)改变速拨状态
EntryPhbSpeedDialStatus()
(3)速拨清单
EntryPhbSpeedDialSetNum()
ShowCategory53Screen( )
删除一个速拨号码时,操作是:
memset(&speedDialTable[currentKeyIndex], 0, sizeof(SpeedDialInfo));
WriteRecord(NVRAM_EF_PHONEBOOK_SPEEDDIAL_LID, 1, speedDialTable, NVRAM_SPEEDDIAL_RECORD_SIZE, &error);
仅仅把speedDialTable[currentKeyIndex]里的号码清空,然后写入NVRAM中。
编辑一个速拨号码,操作是:
mmi_phb_speed_dial_enter_phb()
phbListView = MMI_PHB_LIST_FOR_SPEED_DIAL;
mmi_phb_list_pre_entry_for_numbers();
mmi_phb_list_pre_entry_for_numbers_ext()
设置左软件响应:mmi_phb_entry_choose_numbers()
//显示电话簿列表
mmi_phb_entry_list(EntryCount, /*Total Entry*/
STR_SCR_PBOOK_VIEW_CAPTION, /*Title String*/
IMG_SCR_PBOOK_CAPTION, /*Title Image*/
STR_GLOBAL_OK, /*LSK*/
IMG_GLOBAL_OK, /*LSK*/
mmi_phb_get_index_second_level, /*Highlight Callback*/
LSKEntryPtr, /*LSK Callback*/
NULL, /*SEND Key Callback*/
mmi_phb_list_get_item, /*List Callback*/
mmi_phb_list_get_hint, /*Hint Callback*/
mmi_phb_list_pre_entry_for_numbers, /*Re-Entry Callback*/
TRUE, /*Alpha Index*/
TRUE); /*Right Arrow Key*/
在电话簿列表中,按下左软件,进入:
mmi_phb_entry_choose_numbers()
mmi_phb_send_data(pbName, (S8*)g_phb_cntx.number_to_dial[0]); 这个函数是把电话簿里的内容(姓名和号码)送到不同的应用
PhbSetSpeedDialFormListEx( (PU8)name, (PU8)number, g_phb_name_index[g_phb_cntx.active_index_second] );
//把信息写入到结构speedDialTable中。
speedDialTable[currentKeyIndex].storage = storage;
speedDialTable[currentKeyIndex].type = MMI_PHB_PHONEBOOK;
speedDialTable[currentKeyIndex].record_index = record_index;
pfnUnicodeStrcpy((PS8)speedDialTable[currentKeyIndex].name,(PS8)name );
pfnUnicodeStrcpy((S8*)speedDialTable[currentKeyIndex].number,(PS8)number);
WriteRecord(NVRAM_EF_PHONEBOOK_SPEEDDIAL_LID, 1, speedDialTable, NVRAM_SPEEDDIAL_RECORD_SIZE, &error);
至此,就完成了速拨号码的编辑。
在Idle界面,速拨。(eg: 在Idle Screen长按数字键2)
按键响应:IdleCallSpeedDialOnLongPress()
S8 *tempbuffer = NULL;
tempbuffer = PhbGetSpeedDialNum(Keycode); //获取号码。Keycode必须是2—9
直接返回speedDialTable[keyId - 2].number。
if (tempbuffer != NULL)
{
pfnUnicodeStrcpy(g_idle_context.DialPadCallBuffer, tempbuffer); 拷贝号码到拨号缓冲中
IdleDialPadCall(); 拨号
}
else
{
IdleShowScrNoSpeedDialNumSaved(); 号码为空,提示错误信息
}