symbian 下面调用电话拨号的方法
来源:互联网 发布:thinkphp5子域名 编辑:程序博客网 时间:2024/06/09 16:31
symbian 下面调用电话拨号的方法
开发电话本应用的时候,时常会需要直接拨打对方的电话号码。
那么,如何在symbian s60平台上通过代码让自己的手机拨号呢?
下面的代码可能会帮助你的:
加入头文件:
#include <etel.h> // for dial operatons
在mmp文件中需要加入:
LIBRARY etel.lib // for dial operations
TBool CMcAppUi::dialTel(TDesC & telNum) {
_LIT(KPHONE_DRV, "phonetsy.tsy") ;
//Create a connection to the tel server
RTelServer server;
CleanupClosePushL(server);
User::LeaveIfError(server.Connect());
//Load in the phone device driver
User::LeaveIfError(server.LoadPhoneModule(KPHONE_DRV));
//Find the number of phones available from the tel server
TInt numberPhones;
User::LeaveIfError(server.EnumeratePhones(numberPhones));
//Check there are available phones
if (numberPhones < 1) {
User::Leave(KErrNotFound);
}
//Get info about the first available phone
RTelServer::TPhoneInfo info;
User::LeaveIfError(server.GetPhoneInfo(0, info));
//Use this info to open a connection to the phone, the phone is identified by its name
RPhone phone;
CleanupClosePushL(phone);
User::LeaveIfError(phone.Open(server, info.iName));
//Get info about the first line from the phone
RPhone::TLineInfo lineInfo;
User::LeaveIfError(phone.GetLineInfo(0, lineInfo));
//Use this to open a line
RLine line;
CleanupClosePushL(line);
User::LeaveIfError(line.Open(phone, lineInfo.iName));
//Open a new call on this line
TBuf <100> newCallName;
RCall call;
CleanupClosePushL(call);
User::LeaveIfError(call.OpenNewCall(line, newCallName));
//newCallName will now contain the name of the call
User::LeaveIfError(call.Dial(telNum));
//Close the phone, line and call connections and remove them from the cleanup stack
//NOTE: This does not hang up the call
CleanupStack::PopAndDestroy(3);//phone, line, call
//Unload the phone device driver
User::LeaveIfError(server.UnloadPhoneModule(KPHONE_DRV));
//Close the connection to the tel server and remove it from the cleanup stack
CleanupStack::PopAndDestroy(&server);
return ETrue ;
}
这段代码很好用的,在多款s60真机上测试过
那么,如何在symbian s60平台上通过代码让自己的手机拨号呢?
下面的代码可能会帮助你的:
加入头文件:
#include <etel.h> // for dial operatons
在mmp文件中需要加入:
LIBRARY etel.lib // for dial operations
TBool CMcAppUi::dialTel(TDesC & telNum) {
_LIT(KPHONE_DRV, "phonetsy.tsy") ;
//Create a connection to the tel server
RTelServer server;
CleanupClosePushL(server);
User::LeaveIfError(server.Connect());
//Load in the phone device driver
User::LeaveIfError(server.LoadPhoneModule(KPHONE_DRV));
//Find the number of phones available from the tel server
TInt numberPhones;
User::LeaveIfError(server.EnumeratePhones(numberPhones));
//Check there are available phones
if (numberPhones < 1) {
User::Leave(KErrNotFound);
}
//Get info about the first available phone
RTelServer::TPhoneInfo info;
User::LeaveIfError(server.GetPhoneInfo(0, info));
//Use this info to open a connection to the phone, the phone is identified by its name
RPhone phone;
CleanupClosePushL(phone);
User::LeaveIfError(phone.Open(server, info.iName));
//Get info about the first line from the phone
RPhone::TLineInfo lineInfo;
User::LeaveIfError(phone.GetLineInfo(0, lineInfo));
//Use this to open a line
RLine line;
CleanupClosePushL(line);
User::LeaveIfError(line.Open(phone, lineInfo.iName));
//Open a new call on this line
TBuf <100> newCallName;
RCall call;
CleanupClosePushL(call);
User::LeaveIfError(call.OpenNewCall(line, newCallName));
//newCallName will now contain the name of the call
User::LeaveIfError(call.Dial(telNum));
//Close the phone, line and call connections and remove them from the cleanup stack
//NOTE: This does not hang up the call
CleanupStack::PopAndDestroy(3);//phone, line, call
//Unload the phone device driver
User::LeaveIfError(server.UnloadPhoneModule(KPHONE_DRV));
//Close the connection to the tel server and remove it from the cleanup stack
CleanupStack::PopAndDestroy(&server);
return ETrue ;
}
这段代码很好用的,在多款s60真机上测试过
- symbian 下面调用电话拨号的方法
- symbian 下面调用电话拨号的方法
- symbian 下面调用电话拨号的方法
- symbian下面浏览器的调用方法
- Android 调用系统的电话拨号器
- 如何调用symbian系统第五版上的拨号界面
- 调用电话拨号器监听的四种方式
- 下面的方法斯蒂芬电话电话号封
- 电话拨号器的实现
- 调用系统拨号键拨打电话
- Android调用拨号界面、拨打电话功能
- Android调用拨号界面、拨打电话功能
- Android调用拨号界面、拨打电话功能
- 电话拨号
- 电话拨号
- 电话拨号
- 电话拨号
- 同一包下面类方法的调用
- 八种酒吧里最时尚的喝酒法
- 世界最流行鸡尾酒25款
- 饮酒讲究的四个最佳
- 关于贪心算法!
- symbian下面浏览器的调用方法
- symbian 下面调用电话拨号的方法
- 如何指定最大和最小堆内存
- [全程建模]全程建模技术网站与推广考虑
- Oracle管理常用命令
- 电话簿与vCard的格式转换
- 手机撒谎软件之实现
- 有点迷茫……
- Symbian OS 之活动对象
- 程序拨号及检测何时挂断的解决方案