Program dialing code implemented in C ++

Source: Internet
Author: User

 

The following is a dial-up section.Code(From the Nokia example), although there are not many codes, it is worth learning in many places, such as the use and cleaning of R classes, server/client mechanism, parameter transfer mechanism, and encoding style; comment style and so on.

Before reading the code, familiarize yourself with the Etel structure in Symbian OS C ++ and its core classes rtelserver, rphone, rline, and rcall.

The following is the code:

Void dialnumberl (const tdesc & aphonenumber)

{

// 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 (ktsyname ));
 
// 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 (aphonenumber ));

// 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 (ktsyname ));

// Close the connection to the Tel server and remove it from the cleanup Stack
Cleanupstack: popanddestroy (& server );
}//

Related Article

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.