Call the dialing method under Symbian

Source: Internet
Author: User
Call the dialing method under Symbian

When developing a phone book application, you often need to call the recipient's phone number directly.
So, how can I use code to dial my mobile phone on the Symbian s60 platform?
The following code may help you:

Add the header file:
# Include <Etel. h> // For dial operatons
To add the following content to the MPs file:
Library Etel. Lib // For dial operations
Tbool cmcappui: dialtel (tdesc & telnum ){
_ Partition (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;
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;
}
This code is very useful and has been tested on multiple s60 real machines.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.