📄 commconnection.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc on Fri Sep 27 14:47:29 CDT 2002 --><TITLE>Mobile Information Device Profile 2.0: Interface CommConnection</TITLE><LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style"></HEAD><BODY BGCOLOR="white"><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_top"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3"> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/CommConnection.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><strong>MIDP 2.0</strong></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> PREV CLASS <B>NEXT CLASS</B></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html" TARGET="_top"><B>FRAMES</B></A> <A HREF="CommConnection.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">javax.microedition.io</FONT><BR>Interface CommConnection</H2><DL><DT><B>All Superinterfaces:</B> <DD>Connection, InputConnection, OutputConnection, StreamConnection</DD></DL><HR><DL><DT>public interface <B>CommConnection</B><DT>extends StreamConnection</DL><P>This interface defines a logical serial port connection. A "logical" serial port is defined as a logical connection through which bytes are transferring serially. The logical serial port is defined within the underlying operating system and may not necessarily correspond to a physical RS-232 serial port. For instance, IrDA IRCOMM ports can commonly be configured as a logical serial port within the operating system so that it can act as a "logical" serial port. <P> A comm port is accessed using a Generic Connection Framework string with an explicit port identifier and embedded configuration parameters, each separated with a semi-colon (;). </P> <P> Only one application may be connected to a particular serial port at a given time. An <code>java.io.IOException</code> is thrown, if an attempt is made to open the serial port with <code>Connector.open()</code> and the connection is already open. </P> <P> A URI with the type and parameters is used to open the connection. The scheme (defined in RFC 2396) must be:<BR> <code>comm:<port identifier>[<optional parameters>]</code> </P> <P> The first parameter must be a port identifier, which is a logical device name. These identifiers are most likely device specific and should be used with care. </P> <P> The valid identifiers for a particular device and OS can be queried through the method <code>System.getProperty()</code> using the key <em>"microedition.commports"</em>. A comma separated list of ports is returned which can be combined with a <code>comm:</code> prefix as the URL string to be used to open a serial port connection. (See port naming convention below.) </P> <P> Any additional parameters must be separated by a semi-colon (;) and spaces are not allowed in the string. If a particular optional parameter is not applicable to a particular port, the parameter MAY be ignored. The port identifier MUST NOT contain a semi-colon (;). </P> <P> Legal parameters are defined by the definition of the parameters below. Illegal or unrecognized parameters cause an <code>IllegalArgumentException</code>. If the value of a parameter is supported by the device, it must be honored. If the value of a parameter is not supported a <code>java.io.IOException</code> is thrown. If a <code>baudrate</code> parameter is requested, it is treated in the same way that the <code>setBaudRate</code> method handles baudrates. e.g., if the baudrate requested is not supported the system MAY substitute a valid baudrate, which can be discovered using the <code>getBaudRate</code> method. </P> <H2> Optional Parameters </H2> <P> <TABLE BORDER="1"> <TR> <TH> Parameter</TH> <TH>Default</TH> <TH>Description</TH> </TR> <TR> <TD><code>baudrate</code></TD> <TD><code>platform dependent</code></TD> <TD>The speed of the port.</TD> </TR> <TR> <TD><code>bitsperchar</code></TD> <TD><code>8</code></TD> <TD>The number bits per character(<code>7</code> or <code>8</code>).</TD> </TR> <TR> <TD><code>stopbits</code></TD> <TD><code>1</code></TD> <TD>The number of stop bits per char(<code>1</code> or <code>2</code>)</TD> </TR> <TR> <TD><code>parity</code></TD> <TD><code>none</code></TD> <TD>The parity can be <code>odd</code>, <code>even</code>, or <code>none</code>.</TD> </TR> <TR> <TD><code>blocking</code></TD> <TD><code>on</code></TD> <TD>If <code>on</code>, wait for a full buffer when reading.</TD> </TR> <TR> <TD><code>autocts</code></TD> <TD><code>on</code></TD> <TD>If <code>on</code>, wait for the CTS line to be on before writing. </TD> </TR> <TR> <TD><code>autorts</code></TD> <TD><code>on</code></TD> <TD>If <code>on</code>, turn on the RTS line when the input buffer is not full. If <code>off</code>, the RTS line is always on.</TD> </TR> </TABLE> <H2> BNF Format for Connector.open() string </H2> <P> The URI must conform to the BNF syntax specified below. If the URI does not conform to this syntax, an <code>IllegalArgumentException</code> is thrown. </P> <TABLE BORDER="1"> <TR> <TD><comm_connection_string> </TD> <TD>::= "<strong>comm:</strong>"<port_id>[<options_list>] ; </TD> </TR> <TR> <TD><port_id> </TD> <TD>::= <I>string of alphanumeric characters</I> </TD> </TR> <TR> <TD><options_list> </TD> <TD>::= *(<baud_rate_string>| <bitsperchar>| <stopbits>| <parity>| <blocking>| <autocts>| <autorts>) ; <BR>; if an option duplicates a previous option in the <BR>; option list, that option overrides the previous <BR>; option</TD> </TR> <TR> <TD><baud_rate_string> </TD> <TD>::= "<strong>;baudrate=</strong>"<baud_rate> </TD> </TR> <TR> <TD><baud_rate> </TD> <TD>::= <I>string of digits</I> </TD> </TR> <TR> <TD><bitsperchar> </TD> <TD>::= "<strong>;bitsperchar=</strong>"<bit_value> </TD> </TR> <TR> <TD><bit_value> </TD> <TD>::= "7" | "8" </TD> </TR> <TR> <TD><stopbits> </TD> <TD>::= "<strong>;stopbits=</strong>"<stop_value> </TD> </TR> <TR> <TD><stop_value> </TD> <TD>::= "1" | "2" </TD> </TR> <TR> <TD><parity> </TD> <TD>::= "<strong>;parity=</strong>"<parity_value> </TD> </TR> <TR> <TD><parity_value> </TD> <TD>::= "even" | "odd" | "none" </TD> </TR> <TR> <TD><blocking> </TD> <TD>::= "<strong>;blocking=</strong>"<on_off> </TD> </TR> <TR> <TD><autocts> </TD> <TD>::= "<strong>;autocts=</strong>"<on_off> </TD> </TR> <TR> <TD><autorts> </TD> <TD>::= "<strong>;autorts=</strong>"<on_off> </TD> </TR> <TR> <TD><on_off> </TD> <TD>::= "on" | "off" </TD> </TR></TABLE>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -