<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://www.jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java_by_API%2Fjavax.comm%2FCommPort</id>
		<title>Java by API/javax.comm/CommPort - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://www.jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java_by_API%2Fjavax.comm%2FCommPort"/>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java_by_API/javax.comm/CommPort&amp;action=history"/>
		<updated>2026-04-25T00:19:08Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://www.jexp.ru/index.php?title=Java_by_API/javax.comm/CommPort&amp;diff=2113&amp;oldid=prev</id>
		<title> в 17:43, 31 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java_by_API/javax.comm/CommPort&amp;diff=2113&amp;oldid=prev"/>
				<updated>2010-05-31T17:43:48Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 17:43, 31 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://www.jexp.ru/index.php?title=Java_by_API/javax.comm/CommPort&amp;diff=2114&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java_by_API/javax.comm/CommPort&amp;diff=2114&amp;oldid=prev"/>
				<updated>2010-05-31T14:41:46Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== CommPort: getInputStream() ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
 * @(#)SimpleRead.java  1.12 98/06/25 SMI&lt;br /&gt;
 *&lt;br /&gt;
 * Copyright (c) 1998 Sun Microsystems, Inc. All Rights Reserved.&lt;br /&gt;
 *&lt;br /&gt;
 * Sun grants you (&amp;quot;Licensee&amp;quot;) a non-exclusive, royalty free, license &lt;br /&gt;
 * to use, modify and redistribute this software in source and binary&lt;br /&gt;
 * code form, provided that i) this copyright notice and license appear&lt;br /&gt;
 * on all copies of the software; and ii) Licensee does not utilize the&lt;br /&gt;
 * software in a manner which is disparaging to Sun.&lt;br /&gt;
 *&lt;br /&gt;
 * This software is provided &amp;quot;AS IS,&amp;quot; without a warranty of any kind.&lt;br /&gt;
 * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,&lt;br /&gt;
 * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A&lt;br /&gt;
 * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND&lt;br /&gt;
 * ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY&lt;br /&gt;
 * LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THE&lt;br /&gt;
 * SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS&lt;br /&gt;
 * BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,&lt;br /&gt;
 * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES,&lt;br /&gt;
 * HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING&lt;br /&gt;
 * OUT OF THE USE OF OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN&lt;br /&gt;
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.&lt;br /&gt;
 *&lt;br /&gt;
 * This software is not designed or intended for use in on-line control&lt;br /&gt;
 * of aircraft, air traffic, aircraft navigation or aircraft&lt;br /&gt;
 * communications; or in the design, construction, operation or&lt;br /&gt;
 * maintenance of any nuclear facility. Licensee represents and&lt;br /&gt;
 * warrants that it will not use or redistribute the Software for such&lt;br /&gt;
 * purposes.&lt;br /&gt;
 */&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import java.io.InputStream;&lt;br /&gt;
import java.util.Enumeration;&lt;br /&gt;
import java.util.TooManyListenersException;&lt;br /&gt;
import javax.rum.rumPortIdentifier;&lt;br /&gt;
import javax.rum.PortInUseException;&lt;br /&gt;
import javax.rum.SerialPort;&lt;br /&gt;
import javax.rum.SerialPortEvent;&lt;br /&gt;
import javax.rum.SerialPortEventListener;&lt;br /&gt;
import javax.rum.UnsupportedCommOperationException;&lt;br /&gt;
public class MainClass implements Runnable, SerialPortEventListener {&lt;br /&gt;
  static CommPortIdentifier portId;&lt;br /&gt;
  static Enumeration portList;&lt;br /&gt;
  InputStream inputStream;&lt;br /&gt;
  SerialPort serialPort;&lt;br /&gt;
  Thread readThread;&lt;br /&gt;
  public static void main(String[] args) {&lt;br /&gt;
    portList = CommPortIdentifier.getPortIdentifiers();&lt;br /&gt;
    while (portList.hasMoreElements()) {&lt;br /&gt;
      portId = (CommPortIdentifier) portList.nextElement();&lt;br /&gt;
      if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {&lt;br /&gt;
        // if (portId.getName().equals(&amp;quot;COM1&amp;quot;)) {&lt;br /&gt;
        if (portId.getName().equals(&amp;quot;/dev/term/a&amp;quot;)) {&lt;br /&gt;
          MainClass reader = new MainClass();&lt;br /&gt;
        }&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  public MainClass() {&lt;br /&gt;
    try {&lt;br /&gt;
      serialPort = (SerialPort) portId.open(&amp;quot;MainClassApp&amp;quot;, 2000);&lt;br /&gt;
    } catch (PortInUseException e) {&lt;br /&gt;
    }&lt;br /&gt;
    try {&lt;br /&gt;
      inputStream = serialPort.getInputStream();&lt;br /&gt;
    } catch (IOException e) {&lt;br /&gt;
    }&lt;br /&gt;
    try {&lt;br /&gt;
      serialPort.addEventListener(this);&lt;br /&gt;
    } catch (TooManyListenersException e) {&lt;br /&gt;
    }&lt;br /&gt;
    serialPort.notifyOnDataAvailable(true);&lt;br /&gt;
    try {&lt;br /&gt;
      serialPort.setSerialPortParams(9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1,&lt;br /&gt;
          SerialPort.PARITY_NONE);&lt;br /&gt;
    } catch (UnsupportedCommOperationException e) {&lt;br /&gt;
    }&lt;br /&gt;
    readThread = new Thread(this);&lt;br /&gt;
    readThread.start();&lt;br /&gt;
  }&lt;br /&gt;
  public void run() {&lt;br /&gt;
    try {&lt;br /&gt;
      Thread.sleep(20000);&lt;br /&gt;
    } catch (InterruptedException e) {&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  public void serialEvent(SerialPortEvent event) {&lt;br /&gt;
    switch (event.getEventType()) {&lt;br /&gt;
    case SerialPortEvent.BI:&lt;br /&gt;
    case SerialPortEvent.OE:&lt;br /&gt;
    case SerialPortEvent.FE:&lt;br /&gt;
    case SerialPortEvent.PE:&lt;br /&gt;
    case SerialPortEvent.CD:&lt;br /&gt;
    case SerialPortEvent.CTS:&lt;br /&gt;
    case SerialPortEvent.DSR:&lt;br /&gt;
    case SerialPortEvent.RI:&lt;br /&gt;
    case SerialPortEvent.OUTPUT_BUFFER_EMPTY:&lt;br /&gt;
      break;&lt;br /&gt;
    case SerialPortEvent.DATA_AVAILABLE:&lt;br /&gt;
      byte[] readBuffer = new byte[20];&lt;br /&gt;
      try {&lt;br /&gt;
        while (inputStream.available() &amp;gt; 0) {&lt;br /&gt;
          int numBytes = inputStream.read(readBuffer);&lt;br /&gt;
        }&lt;br /&gt;
        System.out.print(new String(readBuffer));&lt;br /&gt;
      } catch (IOException e) {&lt;br /&gt;
      }&lt;br /&gt;
      break;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>