⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 phonelibrary.html

📁 qtopiaphone英文帮助,用于初学者和开发人员,初学者可以用来学习,开发人员可以用来资料查询.
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><!-- /home/edba/dist/qtopia/main-Sunday/qtopia/doc/phonelibrary.doc:1 --><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Qtopia Phone Library</title><style type="text/css"><!--h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }a:link { color: #004faf; text-decoration: none }a:visited { color: #672967; text-decoration: none }body { background: #ffffff; color: black; }--></style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td width="200" align="left" valign="top"><a href="index.html"><img height="27" width="472" src="dochead.png" border="0"></a><br><font face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular" align="center" size=32>Qtopia</font>   <a href="index.html">Home</a> - <a href="qtopiaclasses.html">Classes</a> - <a href="qtopiaannotated.html">Annotated</a> - <a href="qtopiafunctions.html">Functions</a> - <a href="qtindex.html">Qt Embedded</a></td><td align="right" valign="top">  <table border="0" cellpadding="0" cellspacing="0" width="137">  <tr>  <td><a href="http://www.trolltech.com/company/about/trolls.html"><img height="100" width="100" src="face.png" border="0"></a></td>  <td><img height="100" width="100" src="qtlogo.png" align="top" border="0"></td>  </tr>  </table></td></tr></table><h1 align=center>Qtopia Phone Library</h1><p> <p> Contents<!-- toc --><ul><li><a href="#1"> Introduction</a><li><a href="#2"> Basic architecture</a><li><a href="#3"> Dialing a number</a><li><a href="#4"> Receiving an incoming SMS message</a><li><a href="#5"> Adding a new handler</a><li><a href="#6"> AT control commands used by Qtopia Phone Edition</a><ul><li><a href="#6-1"> General commands (GSM 07.07, section 5)</a><li><a href="#6-2"> Call control commands (GSM 07.07, section 6)</a><li><a href="#6-3"> Network service related commands (GSM 07.07, section 7)</a><li><a href="#6-4"> Mobile equipment control and status commands (GSM 07.07, section 8)</a><li><a href="#6-5"> SMS commands (GSM 07.05)</a><li><a href="#6-6"> Other commands</a><li><a href="#6-7"> Phone-specific commands</a></ul></ul><!-- endtoc --><p> <h2> Introduction</h2><a name="1"></a><p> This document describes the architecture of the "qtopiaphone" library,which is used to access the phone hardware to make and receive calls,send SMS messages, access the SIM card, and so on.<p> <h2> Basic architecture</h2><a name="2"></a><p> The basic architecture is demonstrated in the following diagram:<p> <center><img src="phonelibrary.png" width="276" height="310"></center> <p> An application, such as the dialer, uses C++ APIs to access informationabout a phone line, the phone book in the SIM card, or the SMS messagesystem.<p> Requests are transmitted to the phone server, which co-ordinates accessto the phone functionality from multiple applications.  This allows thedialer and the SMS messaging client to both access the phone hardwareat the same time.<p> The phone server then passes the requests on to the device handler,which communicates with the hardware device to effect the requests.Responses and status messages are passed back in the reverse direction.<p> Currently, we have implemented a device handler based on "AT" commands.The actual device itself is accessed via a serial port.  This is therecommended way to interface phone functionality with Qtopia Phone.<p> If "AT" commands are not available, the backend handler can be replacedwith code that effects the requests in some other manner.<p> In the remainder of this document, we will demonstrate how requests andresponses flow through the system with two examples: dialing a number, andreceiving an incoming SMS message.<p> <h2> Dialing a number</h2><a name="3"></a><p> When the application wishes to dial a phone number, it performs the followingactions:<p> <ul><li> Create an instance of the "<a href="phoneline.html">PhoneLine</a>" class.<li> Call the "<tt>PhoneLine::createCall</tt>" method to get aninstance of the "<a href="phonecall.html">PhoneCall</a>" class that representsthe call.<li> Call the "<tt>PhoneCall::dial</tt>" method to dial the number.<li> "<tt>PhoneCall::dial</tt>" then transmits the request to thephone server.</ul><p> There will normally be only one instance of the "<a href="phoneline.html">PhoneLine</a>"class per application.  There may be multiple instances of"<a href="phonecall.html">PhoneCall</a>" if there are calls on hold or a multi-partyconference call is in progress.<p> The phone library will transmit the dial request to the phone server using<a href="http://doc.trolltech.com/qtopia1.6/html/qcop.html">QCop</a>.  Thephone server will then take the following actions:<p> <ul><li> Obtain an instance of "<a href="phonelineat.html">PhoneLineAt</a>", which representsthe AT command handler for the phone line.<li> Call the "<tt>PhoneLineAt::createCall</tt>" method to createan instance of the "<a href="phonecallat.html">PhoneCallAt</a>" class.<li> Call the "<tt>PhoneCallAt::dial</tt>" method to dial thenumber.<li> "<tt>PhoneCallAt::dial</tt>" will then send the "<tt>ATD</tt>"command to the phone device to effect the dial request.</ul><p> As can be seen, the sequence of operations directly mirrors the sequencein the application.  The only difference is the final step: the applicationside sends the request to the phone server, and the handler side performs thelow-level device operations directly.<p> If your device does not support AT commands, you would write new handlerclasses, modelled on the structure of "<a href="phonelineat.html">PhoneLineAt</a>" and"<a href="phonecallat.html">PhoneCallAt</a>".  The exact details of how your device effectsthe dial command is beyond the scope of this document.<p> <h2> Receiving an incoming SMS message</h2><a name="4"></a><p> When the AT command handler starts up, it registers for new messageindications using the "<tt>AT+CNMI</tt>" command.  This causes thephone device to send "<tt>+CMTI</tt>" indications whenever a newmessage arrives at the device.<p> In the code, "<tt>+CMTI</tt>" is detected by"<tt>SMSRequestAt::notification</tt>", and causes the AT commandhandler to initiate a message count check ("<tt>SMSRequestAt::check</tt>").Once the check completes, the number of messages is transmitted to theapplication via the "<tt>SMSRequestPrivate::messageCount</tt>" signal.<p> An alternative device handler would similarly need to arrange for the"<tt>SMSRequestPrivate::messageCount</tt>" signal to be emittedwhen new messages arrive.<p> This signal is broadcast on the "<tt>QPE/Phone</tt>" QCop channel.Applications can listen on this channel to receive notification ofnew messages.  More than one application can listen for new messagenotifications, but only one (usually the mail client) should subsequentlyretrieve the message contents.<p> When the mail client receives the signal, it calls the"<tt>SMSRequest::firstMessage</tt>" and"<tt>SMSRequest::nextMessage</tt>" methods to retrieve theSMS message contents from the incoming queue.  Each message is returned tothe application via the "<tt>SMSRequestPrivate::fetched</tt>"signal.<p> Finally, once the application has received the message, it will deleteit from the incoming queue using "<tt>SMSRequest::deleteMessage</tt>".The application (usually the mail client) will save the message inanother location so that the message is never permanently lost(the message store in the device is treated as a temporary bufferin our system).<p> Note: we always use signals to pass messages and status reports back tothe application rather than function returns.  This is because the entirephone system is asynchronous: the information may not be availablewhen the request is made and so must be transmitted later.<p> <h2> Adding a new handler</h2><a name="5"></a><p> If you wish to add a new phone device handler, you should inherit theclass "<tt>PhoneLinePrivate</tt>" and override all of the functionalitythat is specified therein.  The "<a href="phonelineat.html">PhoneLineAt</a>" class can beused as a guide to the necessary structure.<p> You will also need to modify the "<tt>PhoneLinePrivate::create</tt>"method to return an instance of your class instead of"<a href="phonelineat.html">PhoneLineAt</a>".<p> <h2> AT control commands used by Qtopia Phone Edition</h2><a name="6"></a><p> This following sections list the "AT" control commands that we expect thedevice to support.  Most of them are from the <a href="gsm.html">GSM</a> specifications.<p> The device may support more commands than are listed here.  Forexample, some phones support both "<tt>AT+CGMI</tt>" and "<tt>AT+GMI</tt>" to getthe manufacturer name.  We only require "<tt>AT+CGMI</tt>" but there isno harm in the device supporting both.<p> In the future, we may need to additional commands from the GSMspecifications 07.05 and 07.07, so we recommend that all devicemanufacturers fully comply with those specifications.<p> <h3> General commands (GSM 07.07, section 5)</h3><a name="6-1"></a><p> <center><table cellpadding="4" cellspacing="2" border="0"><tr bgcolor="#a2c511"> <th valign="top">Command <th valign="top">Description<tr bgcolor="#f0f0f0"><td valign="top"><tt>AT+CGMI</tt><td valign="top">Identify manufacturer<tr bgcolor="#d0d0d0"><td valign="top"><tt>AT+CGMM</tt>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -