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

📄 javax.comm.commportidentifier.html

📁 java串口通讯api
💻 HTML
📖 第 1 页 / 共 2 页
字号:
    <dt> <b>Returns:</b>
    <dd> a CommPortIdentifier object
    <dt> <b>Throws:</b> <a href="javax.comm.NoSuchPortException.html#_top_">NoSuchPortException</a>
    <dd> if the port object is invalid
  </dl></dd>
</dl>
<a name="addPortName(java.lang.String, int, javax.comm.CommDriver)"><img src="images/green-ball.gif" width=12 height=12 alt=" o "></a>
<a name="addPortName"><b>addPortName</b></a>
<pre>
 public static void addPortName(String portName,
                                int portType,
                                <a href="javax.comm.CommDriver.html#_top_">CommDriver</a> driver)
</pre>
<dl>
  <dd> Adds <CODE>portName</CODE> to the list of ports.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> portName - The name of the port being added
    <dd> portType - The type of the port being added
    <dd> driver - The driver representing the port being added
    <dt> <b>See Also:</b>
    <dd> <a href="javax.comm.CommDriver.html#_top_">CommDriver</a>
  </dl></dd>
</dl>
<a name="getName()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getName"><b>getName</b></a>
<pre>
 public String getName()
</pre>
<dl>
  <dd> Returns the name of the port. The port name should be identifiable by the user. Ideally, it should be the label on the hardware. For example, "COM1" and "COM2" on PCs; "Serial A" and "Serial B" on Sun Ultra workstations. The port name may be stored by an application and subsequently used to create a <CODE>CommPortIdentifier</CODE> object using <CODE>getPortIdentifier(String portName)</CODE> method.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the name of the port
  </dl></dd>
</dl>
<a name="getPortType()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getPortType"><b>getPortType</b></a>
<pre>
 public int getPortType()
</pre>
<dl>
  <dd> Returns the port type.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> portType - PORT_SERIAL or PORT_PARALLEL
  </dl></dd>
</dl>
<a name="open(java.lang.String, int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="open"><b>open</b></a>
<pre>
 public synchronized <a href="javax.comm.CommPort.html#_top_">CommPort</a> open(String appname,
                                   int timeout) throws <a href="javax.comm.PortInUseException.html#_top_">PortInUseException</a>
</pre>
<dl>
  <dd> Opens the communications port. <CODE>open</CODE> obtains exclusive ownership of the port. If the port is owned by some other application, a <CODE>PORT_OWNERSHIP_REQUESTED</CODE> event is propagated using the <CODE>CommPortOwnershipListener</CODE> event mechanism. If the application that owns the port calls <CODE>close</CODE> during the event processing, then this <CODE>open</CODE> will succeed. There is one <CODE>InputStream</CODE> and one <CODE>OutputStream</CODE> associated with each port. After a port is opened with <CODE>open</CODE>, then all calls to <CODE>getInputStream</CODE> will return the same stream object until <CODE>close</CODE> is called.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> appname - Name of application making this call.              This name will become the owner of the port.              Useful when resolving ownership contention.
    <dd> timeout - time in milliseconds to block waiting              for port open.
    <dt> <b>Returns:</b>
    <dd> a <CODE>CommPort</CODE> object
    <dt> <b>Throws:</b> <a href="javax.comm.PortInUseException.html#_top_">PortInUseException</a>
    <dd> if the port is in use by some			    other application that is not willing to relinquish              ownership
  </dl></dd>
</dl>
<a name="getCurrentOwner()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getCurrentOwner"><b>getCurrentOwner</b></a>
<pre>
 public String getCurrentOwner()
</pre>
<dl>
  <dd> Returns the owner of the port.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> current owner of the port.
  </dl></dd>
</dl>
<a name="isCurrentlyOwned()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="isCurrentlyOwned"><b>isCurrentlyOwned</b></a>
<pre>
 public boolean isCurrentlyOwned()
</pre>
<dl>
  <dd> Checks whether the port is owned.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> boolean	<CODE>true</CODE> if the port is owned by some application, 		<CODE>false</CODE> if the port is not owned.
  </dl></dd>
</dl>
<a name="addPortOwnershipListener(javax.comm.CommPortOwnershipListener)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="addPortOwnershipListener"><b>addPortOwnershipListener</b></a>
<pre>
 public void addPortOwnershipListener(<a href="javax.comm.CommPortOwnershipListener.html#_top_">CommPortOwnershipListener</a> listener)
</pre>
<dl>
  <dd> Registers an interested application so that it can receive notification of changes in port ownership. This includes notification of the following events: <UL> <LI> <CODE>PORT_OWNED</CODE>: Port became owned <LI> <CODE>PORT_UNOWNED</CODE>: Port became unowned <LI> <CODE>PORT_OWNERSHIP_REQUESTED</CODE>: If the application owns this port and is willing to give up ownership, then it should call <CODE>close</CODE> now. </UL> The <CODE>ownershipChange</CODE> method of the listener registered using <CODE>addPortOwnershipListener</CODE> will be called with one of the above events.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> listener - a <CODE>CommPortOwnershipListener</CODE> callback object
  </dl></dd>
</dl>
<a name="removePortOwnershipListener(javax.comm.CommPortOwnershipListener)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="removePortOwnershipListener"><b>removePortOwnershipListener</b></a>
<pre>
 public void removePortOwnershipListener(<a href="javax.comm.CommPortOwnershipListener.html#_top_">CommPortOwnershipListener</a> lsnr)
</pre>
<dl>
  <dd> Deregisters a <CODE>CommPortOwnershipListener</CODE> registered using <CODE>addPortOwnershipListener</CODE>
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> listener - The CommPortOwnershipListener object that was		previously registered using addPortOwnershipListener
  </dl></dd>
</dl>
<a name="open(java.io.FileDescriptor)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="open"><b>open</b></a>
<pre>
 public <a href="javax.comm.CommPort.html#_top_">CommPort</a> open(FileDescriptor fd) throws <a href="javax.comm.UnsupportedCommOperationException.html#_top_">UnsupportedCommOperationException</a>
</pre>
<dl>
  <dd> Opens the communications port using a <CODE>FileDescriptor</CODE> object on platforms that support this technique.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> fd - The <CODE>FileDescriptor</CODE> object used to builda <CODE>CommPort</CODE>.
    <dt> <b>Returns:</b>
    <dd> a <CODE>CommPort</CODE> object.
    <dt> <b>Throws:</b> <a href="javax.comm.UnsupportedCommOperationException.html#_top_">UnsupportedCommOperationException</a>
    <dd> is thrown                  on platforms which do not support this functionality.
  </dl></dd>
</dl>
<hr>
<pre>
<a href="packages.html">All Packages</a>  <a href="tree.html">Class Hierarchy</a>  <a href="Package-javax.comm.html">This Package</a>  <a href="javax.comm.CommPort.html#_top_">Previous</a>  <a href="javax.comm.ParallelPort.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
</body>
</html>

⌨️ 快捷键说明

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