功能描述:
IP dial功能是说在通话设置中,我们可以指定一些IP号码,然后在phonebook中选择某个联系人,选择IP Dial,这样,手机就会自动将激活的IP号码加到联系人号码的前面,比如1795113433355546。
在一些运营商网络下,经常会指定一些长途号码,在要拨打的电话号码前面添加这些号码,可以让长途话费更便宜。而IP dial这个功能就可以让用户不用在每次拨打长途号码前面都输入这些特定的号码,而可以在电话本中直接通过菜单方式选择IP拨号,从而方便用户的使用。
目前,在COSMOS版本上并没有实做IP dial这个功能,而只是在call setting保留了部分IP dial界面的入口。
实现原理及效果:
实现的主要思路是补充APP部分的代码,完成UI的显示。APP最终调用Service部分的IP dial相关的接口去实现该功能。
这个功能主要是需要改动到2个模块:Call Setting和Phonebook。
1、在Call Setting这边主要是完成IP number的设置。操作主要包括号码编辑、激活、关闭以及删除。实现效果图如下:
首先,进入Call Setting->IP dial;
选择某个IP number,会弹出菜单让用户去选择执行不同的操作。
2、在Phonebook主要是构造IP Dial的入口。效果图如下:
首先,进入某个联系人,点击detail;
选择图中红色的按钮,进入More菜单,点击IP dial。
[SOLUTION]
? PHB这边的修改:
1. 在More中添加IP Dial选项;
i. 在Vapp_phb_info.h中,添加More action的enum;
enum vapp_phb_viewer_more_action_enum
{
VAPP_PHB_PROFILE_EDIT_BEFORE_CALL,
VAPP_PHB_PROFILE_VIDEO_CALL,
VAPP_PHB_PROFILE_BLOCK_NUMBER,
VAPP_PHB_PROFILE_CALL = 10,
VAPP_PHB_PROFILE_IP_DIAL,
VAPP_PHB_PROFILE_ACTION_TOTAL = 0xff
};
ii. 在Vapp_phb_info.cpp中,添加More action的option;
void VappPhbViewerProfilePage::moreAction(VfxObject *obj, VfxId id)
{
option->addItem(VAPP_PHB_PROFILE_IP_DIAL,
VFX_WSTR("IP Dial"),
VCP_POPUP_BUTTON_TYPE_NORMAL);
}
iii. 在Vapp_phb_info.cpp中,添加More action对应的click事件;
void VappPhbViewerProfilePage::onMoreActionClick(VfxObject *obj, VfxId id)
{
else if(id == VAPP_PHB_PROFILE_IP_DIAL)
{
VappContactNumber number = m_contact->getNumberById(m_tempId);
VappPhbActionObj::makeIpDial(m_id,number,
m_contact->getPrioritySIM());
}
}
2. 实现IP Dial:
i. 在Vapp_phb_app.h中的VappPhbActionObj类中,添加makeIpDial函数声明:
static void VappPhbActionObj::makeIpDial(mmi_phb_contact_id id, VappContactNumber& number, phb_storage_enum prioritySIM);
ii. 在Vapp_phb_app.cpp中实现makeIpDial函数:
void VappPhbActionObj::makeIpDial(mmi_phb_contact_id id, VappContactNumber& number, phb_storage_enum prioritySIM)
{
mmi_ucm_make_call_para_struct make_call_para;
void *cm_user_data;
mmi_ucm_init_call_para(&make_call_para);
cm_user_data = srv_phb_create_cm_user_data_by_sub_id(NULL, number.getId(), id);
// select sim to make call
if (prioritySIM == PHB_STORAGE_SIM)
{
make_call_para.dial_type = SRV_UCM_VOICE_CALL_TYPE;
}
else if (prioritySIM == PHB_STORAGE_SIM2)
{
make_call_para.dial_type = SRV_UCM_VOICE_CALL_TYPE_SIM2;
}
else
{
make_call_para.dial_type = (srv_ucm_call_type_enum)(make_call_para.dial_type & (~SRV_UCM_VOIP_CALL_TYPE));
}
make_call_para.adv_para.after_callback_user_data = cm_user_data;
make_call_para.adv_para.phb_data = cm_user_data;
make_call_para.adv_para.after_make_call_callback = VappPhbActionObj::makeCallCb;
make_call_para.ucs2_num_uri = (U16*)number.getBuf();
make_call_para.adv_para.is_ip_dial = MMI_TRUE; // IP DIAL
mmi_ucm_call_launch(0, &make_call_para);
}
Call Setting修改:
1. 将void VappCallSetPageMain::onInit()原有IP拨号的部分代码打开:
//#if 0
#ifdef __IP_NUMBER__
VFX_OBJ_CREATE(launch, VcpFormItemLauncherCell, form);
launch->setMainText(VFX_WSTR("IP dial"));
launch->setHintText(VFX_WSTR("Set IP dial number"));
launch->setAccessory(VCPFORM_NEXT_ITEM_ICON);
launch->m_signalTap.connect(this, &VappCallSetPageMain::onItemTap);
form->addItem(launch, 4);
#endif /* __IP_NUMBER__ */
//#endif
2. 在VappCallSetPageIpNum类中添加成员:
class VappCallSetPageIpNum : public VfxPage, public IVcpListMenuContentProvider
virtual void onEnter(VfxBool isBackward);//protected成员;用来进入IP dial page时调用;
void onOpListClicked(VcpMenuPopup* sender, VcpMenuPopupEventEnum evtEnum, VcpMenuPopupItem* item);//option菜单对应的处理函数;
VfxU32 m_index;//记录点击的ip号码的index;
VcpListMenu *m_menu;//ip number list的menu菜单;
3. 实现VappCallSetPageIpNum::onEnter函数:
void VappCallSetPageIpNum::onEnter(VfxBool isBackward)
{
VfxPage::onEnter(isBackward);
if(isBackward)
{
m_menu->resetAllItems(VFX_TRUE);
}
}
4. 修改VappCallSetPageIpNum::onTapped函数:
void VappCallSetPageIpNum::onTapped(
VcpListMenu* menu,
VfxU32 index)
{
VcpMenuPopup *option;
VFX_OBJ_CREATE(option,VcpMenuPopup,this);
option->setTitle(VFX_WSTR("IP Number"));
option->addItem(0, VFX_WSTR("EDIT"));
/*you can define the STR_ID of these menus*/
option->addItem(1, VFX_WSTR("Activate for SIM1"));
option->addItem(3, VFX_WSTR("Deactivate for SIM1"));
option->addItem(2, VFX_WSTR("Activate for SIM2"));
option->addItem(4, VFX_WSTR("Deactivate for SIM2"));
option->m_signalMenuCallback.connect(this, &VappCallSetPageIpNum::onOpListClicked);
option->show(VFX_TRUE);
m_index = index;
}
5. 实现VappCallSetPageIpNum::onOpListClicked函数:
void VappCallSetPageIpNum::onOpListClicked(VcpMenuPopup* sender, VcpMenuPopupEventEnum evtEnum, VcpMenuPopupItem* item)
{
srv_callset_result_enum result;
mmi_sim_enum sim;
srv_callset_ip_number_item_struct ip_item;
if(evtEnum == VCP_MENU_POPUP_EVENT_ITEM_SELECTED)
{
if(item->getId() == 1 || item->getId() == 3)
{
sim = MMI_SIM1;
}else
{
sim = MMI_SIM2;
}
switch(item->getId())
{
case 0:
VappCallSetPageIPNumEdit *pageIPEdit;
VFX_OBJ_CREATE(pageIPEdit, VappCallSetPageIPNumEdit, getMainScr());
pageIPEdit->setIndex(this->m_index);
getMainScr()->pushPage(VFX_ID_NULL, pageIPEdit);
break;
case 1:
case 2:
result = srv_callset_ip_number_activate(sim,this->m_index);
if (result != SRV_CALLSET_RESULT_OK)
{
VAPP_CALLSET_FAIL_POPUP(this,
VFX_WSTR_RES(srv_callset_get_result_string_id(result)));
}
else
{
getMainScr()->popPage();
}
break;
case 3:
case 4:
result = srv_callset_ip_number_deactivate(sim,this->m_index);
if (result != SRV_CALLSET_RESULT_OK)
{
VAPP_CALLSET_FAIL_POPUP(this,
VFX_WSTR_RES(srv_callset_get_result_string_id(result)));
}
else
{
getMainScr()->popPage();
}
break;
}
}
}
6. 定义IP Number编辑类:
class VappCallSetPageIPNumEdit : public VappCallSetPageCommonInput
{
VFX_DECLARE_CLASS(VappCallSetPageIPNumEdit);
// Override
public:
void setIndex(VfxU32 index);
protected:
virtual void onInit();
virtual void onFuncBtnClicked(VfxObject* sender, VfxId id);
private:
VfxU32 m_index;
};
7. 实现IP Number编辑类:
VFX_IMPLEMENT_CLASS("VappCallSetPageIPNumEdit", VappCallSetPageIPNumEdit, VappCallSetPageCommonInput);
void VappCallSetPageIPNumEdit::setIndex(VfxU32 index)
{
this->m_index = index;
}
void VappCallSetPageIPNumEdit::onInit()
{
VappCallSetPageCommonInput::onInit(); // call base class
m_titleBar->setTitle(VFX_WSTR_RES(STR_ID_CALLSET_INPUT_NUMBER));
/*you can define the STR_ID of input IP number*/
m_mainText->setString(VFX_WSTR("Input IP Number"));
m_textInput->setIME(IMM_INPUT_TYPE_PHONE_NUMBER, IME_PLUS_CHAR_HANDLING);
setInputBuf(SRV_UCM_MAX_NUM_URI_LEN - 1, VFX_WSTR_EMPTY);
m_funcBar->m_signalButtonTap.connect(this, &VappCallSetPageIPNumEdit::onFuncBtnClicked);
m_toolBar->m_signalButtonTap.connect(this, &VappCallSetPageIPNumEdit::onFuncBtnClicked);
}
void VappCallSetPageIPNumEdit::onFuncBtnClicked(VfxObject* sender, VfxId id)
{
switch (id)
{
case VAPP_CALLSET_FUNC_OK:
{
srv_callset_result_enum result;
result = srv_callset_ip_number_set_number(
this->m_index,
(U8)mmi_ucs2strlen((PS8)m_textInput->getText())
, (WCHAR*)m_textInput->getText());
if (result != SRV_CALLSET_RESULT_OK)
{
VAPP_CALLSET_FAIL_POPUP(this,
VFX_WSTR_RES(srv_callset_get_result_string_id(result)));
}
else
{
getMainScr()->popPage();
}
break;
}
default:
return VappCallSetPageCommonInput::onFuncBtnClicked(sender, id);
}
}
标签:DIAL,para,IP,void,call,VFX,COSMOS,id From: https://blog.51cto.com/u_15170706/6127715