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

📄 cservice.html

📁 开源的手机短信开发包!包括例子程序和比较详细的文档
💻 HTML
📖 第 1 页 / 共 5 页
字号:
                <br><br>                Notes:                <ul>                        <li>Use one of the standard values for baud. Most GSM devices work well                                        at 9600 or 19200. Some may handle speeds up to 115200 (like Nokia                                        mobile phone model 6210 does). The connection speed is not that                                        important to the speed at which jSMSEngine processes messages.                                        Personally, I work at 9200 to avoid pushing the mobile. Dedicated GSM                                        modems may handle higher speeds better than mobile phones do.</li>                </ul></DL>
</DL>

<!-- ============ METHOD DETAIL ========== -->

<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>

<A NAME="getInitialized()"><!-- --></A><H3>
getInitialized</H3>
<PRE>
public boolean <B>getInitialized</B>()</PRE>
<DL>
<DD>Returns TRUE if the service has already been initialized.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>TRUE if the service has already been initialized.</DL>
</DD>
</DL>
<HR>

<A NAME="getConnected()"><!-- --></A><H3>
getConnected</H3>
<PRE>
public boolean <B>getConnected</B>()</PRE>
<DL>
<DD>Returns TRUE if the service is connected with the GSM device.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>TRUE if the service is connected with the GSM device.</DL>
</DD>
</DL>
<HR>

<A NAME="getDeviceInfo()"><!-- --></A><H3>
getDeviceInfo</H3>
<PRE>
public <A HREF="../../org/jsmsengine/CDeviceInfo.html" title="class in org.jsmsengine">CDeviceInfo</A> <B>getDeviceInfo</B>()</PRE>
<DL>
<DD>Returns a CDeviceInfo object that holds information about the GSM                device in use.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>a CDeviceInfo object.<DT><B>See Also:</B><DD><A HREF="../../org/jsmsengine/CDeviceInfo.html" title="class in org.jsmsengine"><CODE>CDeviceInfo</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="setCacheDir(java.lang.String)"><!-- --></A><H3>
setCacheDir</H3>
<PRE>
public int <B>setCacheDir</B>(java.lang.String&nbsp;dir)</PRE>
<DL>
<DD>Sets the cache directory for messages.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>dir</CODE> - The directory which will act like a cache.
<DT><B>Returns:</B><DD>One of ERR_* values.</DL>
</DD>
</DL>
<HR>

<A NAME="setSmscNumber(java.lang.String)"><!-- --></A><H3>
setSmscNumber</H3>
<PRE>
public void <B>setSmscNumber</B>(java.lang.String&nbsp;smscNumber)</PRE>
<DL>
<DD>Sets the Short Message Service Center (SMSC) number. Please use international format.                If you don't want to set the SMSC and use the one defined in your GSM device, use an                empty string parameter. Another way to do the same, is to pass a null parameter. Some                phones may prefer one way or the other - please test your phone.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>smscNumber</CODE> - the SMSC number.</DL>
</DD>
</DL>
<HR>

<A NAME="getSmscNumber()"><!-- --></A><H3>
getSmscNumber</H3>
<PRE>
public java.lang.String <B>getSmscNumber</B>()</PRE>
<DL>
<DD>Returns the Short Message Service Center (SMSC) number you have previously                defined with setSmscNumber().
<P>
<DD><DL>

<DT><B>Returns:</B><DD>the SMSC number.</DL>
</DD>
</DL>
<HR>

<A NAME="setSimPin(java.lang.String)"><!-- --></A><H3>
setSimPin</H3>
<PRE>
public void <B>setSimPin</B>(java.lang.String&nbsp;simPin)</PRE>
<DL>
<DD>Sets the SIM pin number. This is used if and when the GSM device asks for it. If you set it to                null, then the API does not give any PIN to the device (in order to avoid locking it up), and                returns ERR_SIM_PIN_ERROR.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>simPin</CODE> - the SIM pin number.</DL>
</DD>
</DL>
<HR>

<A NAME="getSimPin()"><!-- --></A><H3>
getSimPin</H3>
<PRE>
public java.lang.String <B>getSimPin</B>()</PRE>
<DL>
<DD>Returns the SIM pin number.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>the SIM pin number.</DL>
</DD>
</DL>
<HR>

<A NAME="setOperationMode(int)"><!-- --></A><H3>
setOperationMode</H3>
<PRE>
public boolean <B>setOperationMode</B>(int&nbsp;mode)</PRE>
<DL>
<DD>Sets the operation mode of the GSM device
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>mode</CODE> - the mode of operation (one of values MODE_ASCII, MODE_PDU).
<DT><B>Returns:</B><DD>TRUE if the change of mode succeded.<DT><B>See Also:</B><DD><A HREF="../../org/jsmsengine/CService.html#getOperationMode()"><CODE>getOperationMode()</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="getOperationMode()"><!-- --></A><H3>
getOperationMode</H3>
<PRE>
public int <B>getOperationMode</B>()</PRE>
<DL>
<DD>Returns the operation mode of the GSM device, i.e. one of the values                MODE_ASCII, MODE_PDU.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>the operation mode.<DT><B>See Also:</B><DD><A HREF="../../org/jsmsengine/CService.html#setOperationMode(int)"><CODE>setOperationMode(int)</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="setReceiveMode(int)"><!-- --></A><H3>
setReceiveMode</H3>
<PRE>
public void <B>setReceiveMode</B>(int&nbsp;receiveMode)</PRE>
<DL>
<DD>Sets the reception mode.                There are two reception modes, the synchronous and the asynchronous.                In synchronous mode, you should call readMessages() function on demand,                where you want to check for new messages. In asynchronous mode, the engine                automatically calls the received() method (which you <strong>should</strong>                override) for every received message.                <br>By default, the reception mode is the synchronous one.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>receiveMode</CODE> - the reception mode (one of values RECEIVE_MODE_ASYNC, RECEIVE_MODE_SYNC).<DT><B>See Also:</B><DD><A HREF="../../org/jsmsengine/CService.html#getReceiveMode()"><CODE>getReceiveMode()</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="getReceiveMode()"><!-- --></A><H3>
getReceiveMode</H3>
<PRE>
public int <B>getReceiveMode</B>()</PRE>
<DL>
<DD>Returns the reception mode.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>the reception mode (one of values RECEIVE_MODE_ASYNC, RECEIVE_MODE_SYNC).<DT><B>See Also:</B><DD><A HREF="../../org/jsmsengine/CService.html#setReceiveMode(int)"><CODE>setReceiveMode(int)</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="getCacheDir()"><!-- --></A><H3>
getCacheDir</H3>
<PRE>
public java.lang.String <B>getCacheDir</B>()</PRE>
<DL>
<DD>Returns the cache directory for messages.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>the caching directory.<DT><B>See Also:</B><DD><A HREF="../../org/jsmsengine/CService.html#setCacheDir(java.lang.String)"><CODE>setCacheDir(String)</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="initialize()"><!-- --></A><H3>
initialize</H3>
<PRE>
public int <B>initialize</B>()</PRE>
<DL>
<DD>Initializes the service. This should be the first method call.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>ERR_OK (for this version).<DT><B>See Also:</B><DD><A HREF="../../org/jsmsengine/CService.html#connect()"><CODE>connect()</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="connect()"><!-- --></A><H3>
connect</H3>
<PRE>
public int <B>connect</B>()</PRE>
<DL>
<DD>Connects to the GSM device. Opens the serial port, and sends the appropriate                AT commands to initialize the operation mode of the GSM device. Retrieves                information about the GSM device. This method should be called after                initialize() has been called.                <br>                By default, jSMSEngine API sets your GSM device to PDU mode. If you want to                switch to ASCII mode (I don't see any reason why, but anyway...), use the                setOperationMode() method.                <br><br>                Notes:                <br>                <ul>                        <li>The GSM device specific information (read by the call to refreshDeviceInfo()                                        function is called once from this method. Since some information changes                                        with time (such as battery or signal level), its your responsibility to                                        call refreshDeviceInfo() periodically in order to have the latest information.                                        Otherwise, you will get the information snapshot taken at the time                                        of the initial connection.                        </li>                </ul>
<P>
<DD><DL>

<DT><B>Returns:</B><DD>One of ERR_* values.<DT><B>See Also:</B><DD><A HREF="../../org/jsmsengine/CDeviceInfo.html" title="class in org.jsmsengine"><CODE>CDeviceInfo</CODE></A>, 
<A HREF="../../org/jsmsengine/CService.html#refreshDeviceInfo()"><CODE>refreshDeviceInfo()</CODE></A>, 
<A HREF="../../org/jsmsengine/CService.html#disconnect()"><CODE>disconnect()</CODE></A>, 
<A HREF="../../org/jsmsengine/CService.html#initialize()"><CODE>initialize()</CODE></A>, 
<A HREF="../../org/jsmsengine/CService.html#setOperationMode(int)"><CODE>setOperationMode(int)</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="disconnect()"><!-- --></A><H3>
disconnect</H3>
<PRE>
public int <B>disconnect</B>()</PRE>
<DL>
<DD>Disconnects to the GSM device. Closes the serial port.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>ERR_OK value.<DT><B>See Also:</B><DD><A HREF="../../org/jsmsengine/CService.html#connect()"><CODE>connect()</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="setPhoneBook(java.lang.String)"><!-- --></A><H3>
setPhoneBook</H3>
<PRE>
public int <B>setPhoneBook</B>(java.lang.String&nbsp;phoneBookFile)</PRE>
<DL>
<DD>Loads the phonebook. The phonebook is an XML file containing associations of name                and phone numbers.                <br><br>                <strong>The phonebook is optional.</strong>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>phoneBookFile</CODE> - The XML full-path name which keeps the phonebook.
<DT><B>Returns:</B><DD>One of ERR_* values.<DT><B>See Also:</B><DD><A HREF="../../org/jsmsengine/CPhoneBook.html" title="class in org.jsmsengine"><CODE>CPhoneBook</CODE></A>, 
<A HREF="../../org/jsmsengine/CService.html#sendMessage(org.jsmsengine.COutgoingMessage)"><CODE>sendMessage(COutgoingMessage)</CODE></A>, 
<A HREF="../../org/jsmsengine/CService.html#sendMessage(java.util.LinkedList)"><CODE>sendMessage(LinkedList)</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="refreshDeviceInfo()"><!-- --></A><H3>
refreshDeviceInfo</H3>
<PRE>
public int <B>refreshDeviceInfo</B>()</PRE>
<DL>
<DD>Refreshes the GSM device specific information. This method is called once during                connection. Its up to the developer to call it periodically in order to get the latest                information.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>One of ERR_* values.<DT><B>See Also:</B><DD><A HREF="../../org/jsmsengine/CDeviceInfo.html" title="class in org.jsmsengine"><CODE>CDeviceInfo</CODE></A>, 
<A HREF="../../org/jsmsengine/CService.html#connect()"><CODE>connect()</CODE></A>, 
<A HREF="../../org/jsmsengine/CService.html#getDeviceInfo()"><CODE>getDeviceInfo()</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="readMessages(java.util.LinkedList, int)"><!-- --></A><H3>
readMessages</H3>
<PRE>
public int <B>readMessages</B>(java.util.LinkedList&nbsp;messageList,
                        int&nbsp;messageClass)</PRE>
<DL>
<DD>Reads SMS from the GSM device's memory. You should call this method when                you want to read messages from the device. In the MessageList object you                pass, the method will add objects of type CIncomingMessage, as many of them                as the messages pending to be read. The class defines which types of messages                should be read.                <br><br>                <strong>Notes:</strong>                <ul>                        <li>The method <strong>does not delete</strong> the messages it reads                                from the GSM device. It's your responsibility to delete them, if you                                don't want them. Otherwise, on the next call of this function you                                will read the same messages.</li>                </ul>               

⌨️ 快捷键说明

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