├── .gitignore ├── .travis.yml ├── LICENSE.md ├── README.adoc ├── build.gradle ├── docs ├── CHANGELOG.txt └── javadoc │ ├── allclasses-frame.html │ ├── allclasses-noframe.html │ ├── constant-values.html │ ├── deprecated-list.html │ ├── help-doc.html │ ├── index-all.html │ ├── index.html │ ├── org │ └── openmuc │ │ └── jrxtx │ │ ├── DataBits.html │ │ ├── FlowControl.html │ │ ├── Parity.html │ │ ├── PortNotFoundException.html │ │ ├── SerialPort.html │ │ ├── SerialPortBuilder.html │ │ ├── SerialPortException.html │ │ ├── SerialPortTimeoutException.html │ │ ├── StopBits.html │ │ ├── package-frame.html │ │ ├── package-summary.html │ │ └── package-tree.html │ ├── overview-tree.html │ ├── package-list │ ├── script.js │ ├── serialized-form.html │ └── stylesheet.css ├── gnu-io ├── build.gradle └── src │ ├── main │ └── java │ │ └── gnu │ │ └── io │ │ ├── CommDriver.java │ │ ├── CommPort.java │ │ ├── CommPortEnum.java │ │ ├── CommPortEnumerator.java │ │ ├── CommPortException.java │ │ ├── CommPortIdentifier.java │ │ ├── CommPortOwnershipListener.java │ │ ├── Configure.java │ │ ├── I2C.java │ │ ├── I2CPort.java │ │ ├── I2CPortEvent.java │ │ ├── I2CPortEventListener.java │ │ ├── LPRPort.java │ │ ├── LibLoadException.java │ │ ├── LibraryLoader.java │ │ ├── NoSuchPortException.java │ │ ├── ParallelPort.java │ │ ├── ParallelPortEvent.java │ │ ├── ParallelPortEventListener.java │ │ ├── PortInUseException.java │ │ ├── RS485.java │ │ ├── RS485Port.java │ │ ├── RS485PortEvent.java │ │ ├── RS485PortEventListener.java │ │ ├── RXTXCommDriver.java │ │ ├── RXTXPort.java │ │ ├── RXTXVersion.java │ │ ├── Raw.java │ │ ├── RawPort.java │ │ ├── RawPortEvent.java │ │ ├── RawPortEventListener.java │ │ ├── SerialPort.java │ │ ├── SerialPortEvent.java │ │ ├── SerialPortEventListener.java │ │ ├── UnSupportedLoggerException.java │ │ ├── UnsupportedCommOperationException.java │ │ ├── Zystem.java │ │ └── package-info.java │ └── test │ ├── java │ └── gnu │ │ └── io │ │ └── LibraryLoaderTest.java │ └── resources │ └── libs │ ├── librxtxSerial-2.2pre1.so │ └── librxtxSerial.so ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── jrxtx ├── build.gradle └── src │ ├── main │ └── java │ │ └── org │ │ └── openmuc │ │ └── jrxtx │ │ ├── DataBits.java │ │ ├── FlowControl.java │ │ ├── JRxTxPort.java │ │ ├── Parity.java │ │ ├── PortNotFoundException.java │ │ ├── SerialPort.java │ │ ├── SerialPortBuilder.java │ │ ├── SerialPortException.java │ │ ├── SerialPortTimeoutException.java │ │ ├── StopBits.java │ │ └── package-info.java │ └── test │ ├── README.txt │ ├── java │ └── org │ │ └── openmuc │ │ └── jrxtx │ │ ├── TestMain.java │ │ └── itest │ │ └── IntegrationTest.java │ ├── setup-virtual-serial-ports.sh │ └── tty0tty │ ├── README.txt │ ├── tty0tty │ └── tty0tty-1.2.zip ├── jrxtxWrapper └── build.gradle ├── license ├── COPYING.LESSER └── NOTICE ├── native ├── .gitignore ├── BUILD.sh ├── BUILD_java8.sh ├── MACOSX_IDE │ ├── .cvsignore │ └── XCode │ │ ├── .cvsignore │ │ ├── LibSerialUniversal.xcodeproj │ │ ├── .cvsignore │ │ └── project.pbxproj │ │ └── config.h ├── Makefile.am ├── Makefile.lcc ├── Makefile.macosx ├── Makefile.mingw32 ├── Makefile.msvc ├── README.md ├── autogen.sh ├── buildtest ├── buildwin32 ├── config.guess ├── config.sub ├── configure.ac ├── eclipse │ └── ies_eclipse_native_formatter_v1.xml ├── gen+conf.sh ├── install-sh ├── ltconfig ├── mkinstalldirs ├── rxtx.spec └── src │ ├── .gitignore │ ├── I2CImp.c │ ├── I2CImp.h │ ├── ParallelImp.c │ ├── ParallelImp.h │ ├── RS485Imp.c │ ├── RS485Imp.h │ ├── RawImp.c │ ├── RawImp.h │ ├── SerialImp.c │ ├── SerialImp.cpp │ ├── SerialImp.h │ ├── WinCE │ ├── README │ ├── StdAfx.cpp │ ├── StdAfx.h │ ├── gnu_io_RXTXCommDriver.cpp │ ├── gnu_io_RXTXCommDriver.h │ ├── gnu_io_RXTXPort.cpp │ ├── gnu_io_RXTXPort.h │ ├── rxtxHelpers.cpp │ ├── rxtxHelpers.h │ ├── rxtxSerial.cpp │ ├── rxtxSerial.vcp │ └── rxtxserial.dsp │ ├── fixup.c │ ├── fuserImp.c │ ├── include │ ├── gnu_io_CommPortIdentifier.h │ ├── gnu_io_I2C.h │ ├── gnu_io_I2C_I2CInputStream.h │ ├── gnu_io_I2C_I2COutputStream.h │ ├── gnu_io_I2C_MonitorThread.h │ ├── gnu_io_LPRPort.h │ ├── gnu_io_LPRPort_MonitorThread.h │ ├── gnu_io_LPRPort_ParallelInputStream.h │ ├── gnu_io_LPRPort_ParallelOutputStream.h │ ├── gnu_io_ParallelPort.h │ ├── gnu_io_RS485.h │ ├── gnu_io_RS485_MonitorThread.h │ ├── gnu_io_RS485_RS485InputStream.h │ ├── gnu_io_RS485_RS485OutputStream.h │ ├── gnu_io_RXTXCommDriver.h │ ├── gnu_io_RXTXPort.h │ ├── gnu_io_RXTXPort_MonitorThread.h │ ├── gnu_io_RXTXPort_SerialInputStream.h │ ├── gnu_io_RXTXPort_SerialOutputStream.h │ ├── gnu_io_RXTXVersion.h │ ├── gnu_io_Raw.h │ ├── gnu_io_Raw_MonitorThread.h │ ├── gnu_io_Raw_RawInputStream.h │ ├── gnu_io_Raw_RawOutputStream.h │ └── gnu_io_Zystem.h │ ├── init.c │ ├── init.cc │ ├── lfd │ ├── INSTALL │ ├── LockFileServer.rfc │ ├── Makefile │ ├── lockdaemon.c │ └── lockdaemon.c.noinetd │ ├── portmode.c │ ├── psmisc │ ├── COPYING │ ├── Makefile │ ├── README │ ├── fuser.c │ └── testing.c │ ├── termios.c │ └── win32termios.h └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | \#* 2 | .\#* 3 | *~ 4 | target/ 5 | bin/ 6 | build/ 7 | tmp/ 8 | *.class 9 | .gradle/ 10 | .svn/ 11 | .settings/ 12 | .project 13 | .classpath 14 | .metadata/ 15 | .externalToolBuilders/ 16 | gradle.properties 17 | doc/userguide/*.html 18 | doc/userguide/*.pdf 19 | *.hprof 20 | gradle-app.setting 21 | .factorypath 22 | .apt_generated/ 23 | #created by openiec61850 clientgui: 24 | lastconnection.properties 25 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | before_install: 2 | - sudo apt-get -qq update 3 | - sudo apt-get install -y librxtx-java 4 | language: java 5 | jdk: openjdk8 6 | 7 | notifications: 8 | email: true 9 | on_success: never 10 | on_failure: always 11 | 12 | script: 13 | - "bash jrxtx/src/test/setup-virtual-serial-ports.sh" 14 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | mavenCentral() 4 | } 5 | dependencies { 6 | classpath 'biz.aQute.bnd:biz.aQute.bnd.gradle:4.0.0' 7 | } 8 | } 9 | 10 | plugins { 11 | id "biz.aQute.bnd.builder" version "4.0.0" 12 | } 13 | 14 | subprojects { 15 | apply plugin: 'biz.aQute.bnd.builder' 16 | apply plugin: 'java' 17 | apply plugin: 'maven' 18 | repositories { 19 | mavenCentral() 20 | } 21 | 22 | dependencies { 23 | compile 'org.osgi:org.osgi.core:6.0.0' 24 | testCompile 'junit:junit:4.12' 25 | } 26 | 27 | jar { 28 | manifest { 29 | attributes('-removeheaders': 'Bnd-LastModified,Created-By,Tool,Private-Package') 30 | } 31 | } 32 | 33 | tasks.withType(Javadoc) { 34 | exclude "**/gnu/**" 35 | options.noTimestamp() 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /docs/CHANGELOG.txt: -------------------------------------------------------------------------------- 1 | v1.0.1 15-Jan-2018 2 | ------------------ 3 | 4 | - Java 9 compatibility 5 | 6 | 7 | v1.0.0 13-Feb-2017 8 | ------------------ 9 | 10 | - first major release 11 | 12 | - legacy RXTX API v2.2pre2 is unchanged and is part of jRxTx 13 | 14 | - fixes RXTX bug causing large CPU usage by high frequency polling of 15 | serial port 16 | 17 | - includes bug fixes from Debian RXTX package maintainers 18 | 19 | - in addition to the legacy RXTX API jRxTx offers a completely new API 20 | that provides a wrapper around RXTX. 21 | 22 | - new API offers InputStream that behaves conform to the general 23 | java.io.InputStream interface contract and behaves very similarly to 24 | the InputStream implementation provided by java.net.Socket. 25 | 26 | - jar is published on maven central 27 | 28 | - jar is OSGi bundle 29 | 30 | 31 | v0.0.1 29-Apr-2016 32 | ------------------ 33 | 34 | - alpha release 35 | -------------------------------------------------------------------------------- /docs/javadoc/allclasses-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | All Classes (jrxtx 1.0.1 API) 7 | 8 | 9 | 10 | 11 |

All Classes

12 |
13 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /docs/javadoc/allclasses-noframe.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | All Classes (jrxtx 1.0.1 API) 7 | 8 | 9 | 10 | 11 |

All Classes

12 |
13 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /docs/javadoc/constant-values.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Constant Field Values (jrxtx 1.0.1 API) 7 | 8 | 9 | 10 | 11 | 21 | 24 | 25 |
26 | 27 | 28 |
Skip navigation links
29 | 30 | 31 | 32 | 40 |
41 | 68 | 69 |
70 |

Constant Field Values

71 |

Contents

72 |
73 | 74 |
75 | 76 | 77 |
Skip navigation links
78 | 79 | 80 | 81 | 89 |
90 | 117 | 118 | 119 | 120 | -------------------------------------------------------------------------------- /docs/javadoc/deprecated-list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Deprecated List (jrxtx 1.0.1 API) 7 | 8 | 9 | 10 | 11 | 21 | 24 | 25 |
26 | 27 | 28 |
Skip navigation links
29 | 30 | 31 | 32 | 40 |
41 | 68 | 69 |
70 |

Deprecated API

71 |

Contents

72 |
73 | 74 |
75 | 76 | 77 |
Skip navigation links
78 | 79 | 80 | 81 | 89 |
90 | 117 | 118 | 119 | 120 | -------------------------------------------------------------------------------- /docs/javadoc/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | jrxtx 1.0.1 API 7 | 60 | 61 | 62 | 63 | 64 | 65 | <noscript> 66 | <div>JavaScript is disabled on your browser.</div> 67 | </noscript> 68 | <h2>Frame Alert</h2> 69 | <p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="org/openmuc/jrxtx/package-summary.html">Non-frame version</a>.</p> 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /docs/javadoc/org/openmuc/jrxtx/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | org.openmuc.jrxtx (jrxtx 1.0.1 API) 7 | 8 | 9 | 10 | 11 |

org.openmuc.jrxtx

12 |
13 |

Interfaces

14 | 17 |

Classes

18 | 21 |

Enums

22 | 28 |

Exceptions

29 | 34 |
35 | 36 | 37 | -------------------------------------------------------------------------------- /docs/javadoc/package-list: -------------------------------------------------------------------------------- 1 | org.openmuc.jrxtx 2 | -------------------------------------------------------------------------------- /docs/javadoc/script.js: -------------------------------------------------------------------------------- 1 | function show(type) 2 | { 3 | count = 0; 4 | for (var key in methods) { 5 | var row = document.getElementById(key); 6 | if ((methods[key] & type) != 0) { 7 | row.style.display = ''; 8 | row.className = (count++ % 2) ? rowColor : altColor; 9 | } 10 | else 11 | row.style.display = 'none'; 12 | } 13 | updateTabs(type); 14 | } 15 | 16 | function updateTabs(type) 17 | { 18 | for (var value in tabs) { 19 | var sNode = document.getElementById(tabs[value][0]); 20 | var spanNode = sNode.firstChild; 21 | if (value == type) { 22 | sNode.className = activeTableTab; 23 | spanNode.innerHTML = tabs[value][1]; 24 | } 25 | else { 26 | sNode.className = tableTab; 27 | spanNode.innerHTML = "" + tabs[value][1] + ""; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /docs/javadoc/serialized-form.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Serialized Form (jrxtx 1.0.1 API) 7 | 8 | 9 | 10 | 11 | 21 | 24 | 25 |
26 | 27 | 28 |
Skip navigation links
29 | 30 | 31 | 32 | 40 |
41 | 68 | 69 |
70 |

Serialized Form

71 |
72 |
73 | 107 |
108 | 109 |
110 | 111 | 112 |
Skip navigation links
113 | 114 | 115 | 116 | 124 |
125 | 152 | 153 | 154 | 155 | -------------------------------------------------------------------------------- /gnu-io/build.gradle: -------------------------------------------------------------------------------- 1 | group = 'org.openmuc' 2 | 3 | jar { 4 | manifest { 5 | attributes('Export-Package': 'gnu.io') 6 | attributes('Bundle-Name': 'gnu.io') 7 | attributes('Bundle-SymbolicName': 'gnu.io') 8 | } 9 | } 10 | 11 | uploadArchives { 12 | repositories { 13 | mavenDeployer { 14 | repository(url: "https://plugins.gradle.org/m2/") 15 | pom.project { 16 | name "gnu.io" 17 | description "gnu.io is a library for Java serial communication." 18 | 19 | licenses { 20 | license { 21 | name "GNU Lesser General Public License 2.1 or later + linking exception" 22 | url "http://www.gnu.org/licenses/lgpl-2.1.html" 23 | distribution "repo" 24 | } 25 | } 26 | } 27 | } 28 | } 29 | } 30 | 31 | task javah(dependsOn: compileJava) { 32 | doLast{ 33 | def Nclasses = [ 34 | "gnu.io.RXTXCommDriver", 35 | "gnu.io.CommPortIdentifier", 36 | "gnu.io.RXTXVersion", 37 | "gnu.io.I2C", 38 | "gnu.io.LPRPort", 39 | "gnu.io.RXTXPort", 40 | "gnu.io.Zystem", 41 | "gnu.io.Raw", 42 | "gnu.io.RS485", 43 | "gnu.io.ParallelPort" 44 | ]; 45 | 46 | def nativeIncludes = "${project.rootDir}/native/src/include" 47 | def classpath = project(':gnu-io').sourceSets.main.output.classesDir 48 | for (Nclass in Nclasses) { 49 | 50 | logger.info("Generating header for " + Nclass) 51 | 52 | exec { 53 | executable "javah" 54 | args "-d", "$nativeIncludes", "-classpath", "$classpath" , Nclass 55 | } 56 | } 57 | } 58 | } 59 | 60 | compileJava { 61 | options.encoding = "UTF-8" 62 | options.compilerArgs << "-Xlint:unchecked" 63 | } 64 | 65 | -------------------------------------------------------------------------------- /gnu-io/src/main/java/gnu/io/CommDriver.java: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------- 2 | | RXTX License v 2.1 - LGPL v 2.1 + Linking Over Controlled Interface. 3 | | RXTX is a native interface to serial ports in java. 4 | | Copyright 1997-2007 by Trent Jarvi tjarvi@qbang.org and others who 5 | | actually wrote it. See individual source files for more information. 6 | | 7 | | A copy of the LGPL v 2.1 may be found at 8 | | http://www.gnu.org/licenses/lgpl.txt on March 4th 2007. A copy is 9 | | here for your convenience. 10 | | 11 | | This library is free software; you can redistribute it and/or 12 | | modify it under the terms of the GNU Lesser General Public 13 | | License as published by the Free Software Foundation; either 14 | | version 2.1 of the License, or (at your option) any later version. 15 | | 16 | | This library is distributed in the hope that it will be useful, 17 | | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | | Lesser General Public License for more details. 20 | | 21 | | An executable that contains no derivative of any portion of RXTX, but 22 | | is designed to work with RXTX by being dynamically linked with it, 23 | | is considered a "work that uses the Library" subject to the terms and 24 | | conditions of the GNU Lesser General Public License. 25 | | 26 | | The following has been added to the RXTX License to remove 27 | | any confusion about linking to RXTX. We want to allow in part what 28 | | section 5, paragraph 2 of the LGPL does not permit in the special 29 | | case of linking over a controlled interface. The intent is to add a 30 | | Java Specification Request or standards body defined interface in the 31 | | future as another exception but one is not currently available. 32 | | 33 | | http://www.fsf.org/licenses/gpl-faq.html#LinkingOverControlledInterface 34 | | 35 | | As a special exception, the copyright holders of RXTX give you 36 | | permission to link RXTX with independent modules that communicate with 37 | | RXTX solely through the Sun Microsytems CommAPI interface version 2, 38 | | regardless of the license terms of these independent modules, and to copy 39 | | and distribute the resulting combined work under terms of your choice, 40 | | provided that every copy of the combined work is accompanied by a complete 41 | | copy of the source code of RXTX (the version of RXTX used to produce the 42 | | combined work), being distributed under the terms of the GNU Lesser General 43 | | Public License plus this exception. An independent module is a 44 | | module which is not derived from or based on RXTX. 45 | | 46 | | Note that people who make modified versions of RXTX are not obligated 47 | | to grant this special exception for their modified versions; it is 48 | | their choice whether to do so. The GNU Lesser General Public License 49 | | gives permission to release a modified version without this exception; this 50 | | exception also makes it possible to release a modified version which 51 | | carries forward this exception. 52 | | 53 | | You should have received a copy of the GNU Lesser General Public 54 | | License along with this library; if not, write to the Free 55 | | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 56 | | All trademarks belong to their respective owners. 57 | --------------------------------------------------------------------------*/ 58 | package gnu.io; 59 | 60 | /** 61 | * @author Trent Jarvi 62 | * @version %I%, %G% 63 | * @since JDK1.0 64 | */ 65 | 66 | public interface CommDriver { 67 | public abstract CommPort getCommPort(String portName, int portType); 68 | 69 | public abstract void initialize(); 70 | } 71 | -------------------------------------------------------------------------------- /gnu-io/src/main/java/gnu/io/CommPortEnum.java: -------------------------------------------------------------------------------- 1 | package gnu.io; 2 | 3 | public interface CommPortEnum { 4 | int value(); 5 | } 6 | -------------------------------------------------------------------------------- /gnu-io/src/main/java/gnu/io/CommPortEnumerator.java: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------- 2 | | RXTX License v 2.1 - LGPL v 2.1 + Linking Over Controlled Interface. 3 | | RXTX is a native interface to serial ports in java. 4 | | Copyright 1997-2007 by Trent Jarvi tjarvi@qbang.org and others who 5 | | actually wrote it. See individual source files for more information. 6 | | 7 | | A copy of the LGPL v 2.1 may be found at 8 | | http://www.gnu.org/licenses/lgpl.txt on March 4th 2007. A copy is 9 | | here for your convenience. 10 | | 11 | | This library is free software; you can redistribute it and/or 12 | | modify it under the terms of the GNU Lesser General Public 13 | | License as published by the Free Software Foundation; either 14 | | version 2.1 of the License, or (at your option) any later version. 15 | | 16 | | This library is distributed in the hope that it will be useful, 17 | | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | | Lesser General Public License for more details. 20 | | 21 | | An executable that contains no derivative of any portion of RXTX, but 22 | | is designed to work with RXTX by being dynamically linked with it, 23 | | is considered a "work that uses the Library" subject to the terms and 24 | | conditions of the GNU Lesser General Public License. 25 | | 26 | | The following has been added to the RXTX License to remove 27 | | any confusion about linking to RXTX. We want to allow in part what 28 | | section 5, paragraph 2 of the LGPL does not permit in the special 29 | | case of linking over a controlled interface. The intent is to add a 30 | | Java Specification Request or standards body defined interface in the 31 | | future as another exception but one is not currently available. 32 | | 33 | | http://www.fsf.org/licenses/gpl-faq.html#LinkingOverControlledInterface 34 | | 35 | | As a special exception, the copyright holders of RXTX give you 36 | | permission to link RXTX with independent modules that communicate with 37 | | RXTX solely through the Sun Microsytems CommAPI interface version 2, 38 | | regardless of the license terms of these independent modules, and to copy 39 | | and distribute the resulting combined work under terms of your choice, 40 | | provided that every copy of the combined work is accompanied by a complete 41 | | copy of the source code of RXTX (the version of RXTX used to produce the 42 | | combined work), being distributed under the terms of the GNU Lesser General 43 | | Public License plus this exception. An independent module is a 44 | | module which is not derived from or based on RXTX. 45 | | 46 | | Note that people who make modified versions of RXTX are not obligated 47 | | to grant this special exception for their modified versions; it is 48 | | their choice whether to do so. The GNU Lesser General Public License 49 | | gives permission to release a modified version without this exception; this 50 | | exception also makes it possible to release a modified version which 51 | | carries forward this exception. 52 | | 53 | | You should have received a copy of the GNU Lesser General Public 54 | | License along with this library; if not, write to the Free 55 | | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 56 | | All trademarks belong to their respective owners. 57 | --------------------------------------------------------------------------*/ 58 | package gnu.io; 59 | 60 | import java.util.Enumeration; 61 | 62 | /** 63 | * @author Trent Jarvi 64 | * @version %I%, %G% 65 | * @since JDK1.0 66 | */ 67 | 68 | class CommPortEnumerator implements Enumeration { 69 | private CommPortIdentifier index; 70 | private final static boolean debug = false; 71 | static { 72 | if (debug) 73 | System.out.println("CommPortEnumerator:{}"); 74 | } 75 | 76 | CommPortEnumerator() { 77 | } 78 | 79 | /*------------------------------------------------------------------------------ 80 | nextElement() 81 | accept: 82 | perform: 83 | return: 84 | exceptions: 85 | comments: 86 | ------------------------------------------------------------------------------*/ 87 | public CommPortIdentifier nextElement() { 88 | if (debug) 89 | System.out.println("CommPortEnumerator:nextElement()"); 90 | synchronized (CommPortIdentifier.Sync) { 91 | if (index != null) 92 | index = index.next; 93 | else 94 | index = CommPortIdentifier.CommPortIndex; 95 | return (index); 96 | } 97 | } 98 | 99 | /*------------------------------------------------------------------------------ 100 | hasMoreElements() 101 | accept: 102 | perform: 103 | return: 104 | exceptions: 105 | comments: 106 | ------------------------------------------------------------------------------*/ 107 | public boolean hasMoreElements() { 108 | if (debug) 109 | System.out.println( 110 | "CommPortEnumerator:hasMoreElements() " + CommPortIdentifier.CommPortIndex == null ? false : true); 111 | synchronized (CommPortIdentifier.Sync) { 112 | if (index != null) 113 | return index.next == null ? false : true; 114 | else 115 | return CommPortIdentifier.CommPortIndex == null ? false : true; 116 | } 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /gnu-io/src/main/java/gnu/io/CommPortException.java: -------------------------------------------------------------------------------- 1 | package gnu.io; 2 | 3 | import java.io.IOException; 4 | 5 | /** 6 | * Thrown to indicate that there is an error creating or accessing a COM. 7 | */ 8 | public class CommPortException extends IOException { 9 | public CommPortException(String message) { 10 | super(message); 11 | } 12 | 13 | public CommPortException(String message, Throwable cause) { 14 | super(message); 15 | super.initCause(cause); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /gnu-io/src/main/java/gnu/io/CommPortOwnershipListener.java: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------- 2 | | RXTX License v 2.1 - LGPL v 2.1 + Linking Over Controlled Interface. 3 | | RXTX is a native interface to serial ports in java. 4 | | Copyright 1997-2007 by Trent Jarvi tjarvi@qbang.org and others who 5 | | actually wrote it. See individual source files for more information. 6 | | 7 | | A copy of the LGPL v 2.1 may be found at 8 | | http://www.gnu.org/licenses/lgpl.txt on March 4th 2007. A copy is 9 | | here for your convenience. 10 | | 11 | | This library is free software; you can redistribute it and/or 12 | | modify it under the terms of the GNU Lesser General Public 13 | | License as published by the Free Software Foundation; either 14 | | version 2.1 of the License, or (at your option) any later version. 15 | | 16 | | This library is distributed in the hope that it will be useful, 17 | | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | | Lesser General Public License for more details. 20 | | 21 | | An executable that contains no derivative of any portion of RXTX, but 22 | | is designed to work with RXTX by being dynamically linked with it, 23 | | is considered a "work that uses the Library" subject to the terms and 24 | | conditions of the GNU Lesser General Public License. 25 | | 26 | | The following has been added to the RXTX License to remove 27 | | any confusion about linking to RXTX. We want to allow in part what 28 | | section 5, paragraph 2 of the LGPL does not permit in the special 29 | | case of linking over a controlled interface. The intent is to add a 30 | | Java Specification Request or standards body defined interface in the 31 | | future as another exception but one is not currently available. 32 | | 33 | | http://www.fsf.org/licenses/gpl-faq.html#LinkingOverControlledInterface 34 | | 35 | | As a special exception, the copyright holders of RXTX give you 36 | | permission to link RXTX with independent modules that communicate with 37 | | RXTX solely through the Sun Microsytems CommAPI interface version 2, 38 | | regardless of the license terms of these independent modules, and to copy 39 | | and distribute the resulting combined work under terms of your choice, 40 | | provided that every copy of the combined work is accompanied by a complete 41 | | copy of the source code of RXTX (the version of RXTX used to produce the 42 | | combined work), being distributed under the terms of the GNU Lesser General 43 | | Public License plus this exception. An independent module is a 44 | | module which is not derived from or based on RXTX. 45 | | 46 | | Note that people who make modified versions of RXTX are not obligated 47 | | to grant this special exception for their modified versions; it is 48 | | their choice whether to do so. The GNU Lesser General Public License 49 | | gives permission to release a modified version without this exception; this 50 | | exception also makes it possible to release a modified version which 51 | | carries forward this exception. 52 | | 53 | | You should have received a copy of the GNU Lesser General Public 54 | | License along with this library; if not, write to the Free 55 | | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 56 | | All trademarks belong to their respective owners. 57 | --------------------------------------------------------------------------*/ 58 | package gnu.io; 59 | import java.util.*; 60 | 61 | /** 62 | * @author Trent Jarvi 63 | * @version %I%, %G% 64 | * @since JDK1.0 65 | */ 66 | 67 | public interface CommPortOwnershipListener extends EventListener 68 | { 69 | public static final int PORT_OWNED =1; 70 | public static final int PORT_UNOWNED =2; 71 | public static final int PORT_OWNERSHIP_REQUESTED =3; 72 | 73 | public abstract void ownershipChange( int type ); 74 | } 75 | -------------------------------------------------------------------------------- /gnu-io/src/main/java/gnu/io/I2CPortEvent.java: -------------------------------------------------------------------------------- 1 | /* Non functional contact taj@qbang.org for details */ 2 | 3 | /*------------------------------------------------------------------------- 4 | | RXTX License v 2.1 - LGPL v 2.1 + Linking Over Controlled Interface. 5 | | RXTX is a native interface to serial ports in java. 6 | | Copyright 1997-2007 by Trent Jarvi tjarvi@qbang.org and others who 7 | | actually wrote it. See individual source files for more information. 8 | | 9 | | A copy of the LGPL v 2.1 may be found at 10 | | http://www.gnu.org/licenses/lgpl.txt on March 4th 2007. A copy is 11 | | here for your convenience. 12 | | 13 | | This library is free software; you can redistribute it and/or 14 | | modify it under the terms of the GNU Lesser General Public 15 | | License as published by the Free Software Foundation; either 16 | | version 2.1 of the License, or (at your option) any later version. 17 | | 18 | | This library is distributed in the hope that it will be useful, 19 | | but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 | | Lesser General Public License for more details. 22 | | 23 | | An executable that contains no derivative of any portion of RXTX, but 24 | | is designed to work with RXTX by being dynamically linked with it, 25 | | is considered a "work that uses the Library" subject to the terms and 26 | | conditions of the GNU Lesser General Public License. 27 | | 28 | | The following has been added to the RXTX License to remove 29 | | any confusion about linking to RXTX. We want to allow in part what 30 | | section 5, paragraph 2 of the LGPL does not permit in the special 31 | | case of linking over a controlled interface. The intent is to add a 32 | | Java Specification Request or standards body defined interface in the 33 | | future as another exception but one is not currently available. 34 | | 35 | | http://www.fsf.org/licenses/gpl-faq.html#LinkingOverControlledInterface 36 | | 37 | | As a special exception, the copyright holders of RXTX give you 38 | | permission to link RXTX with independent modules that communicate with 39 | | RXTX solely through the Sun Microsytems CommAPI interface version 2, 40 | | regardless of the license terms of these independent modules, and to copy 41 | | and distribute the resulting combined work under terms of your choice, 42 | | provided that every copy of the combined work is accompanied by a complete 43 | | copy of the source code of RXTX (the version of RXTX used to produce the 44 | | combined work), being distributed under the terms of the GNU Lesser General 45 | | Public License plus this exception. An independent module is a 46 | | module which is not derived from or based on RXTX. 47 | | 48 | | Note that people who make modified versions of RXTX are not obligated 49 | | to grant this special exception for their modified versions; it is 50 | | their choice whether to do so. The GNU Lesser General Public License 51 | | gives permission to release a modified version without this exception; this 52 | | exception also makes it possible to release a modified version which 53 | | carries forward this exception. 54 | | 55 | | You should have received a copy of the GNU Lesser General Public 56 | | License along with this library; if not, write to the Free 57 | | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 58 | | All trademarks belong to their respective owners. 59 | --------------------------------------------------------------------------*/ 60 | package gnu.io; 61 | import java.util.*; 62 | 63 | /** 64 | * @author Trent Jarvi 65 | * @version %I%, %G% 66 | * @since JDK1.0 67 | */ 68 | 69 | public class I2CPortEvent extends EventObject 70 | { 71 | public static final int DATA_AVAILABLE =1; 72 | public static final int OUTPUT_BUFFER_EMPTY =2; 73 | public static final int CTS =3; 74 | public static final int DSR =4; 75 | public static final int RI =5; 76 | public static final int CD =6; 77 | public static final int OE =7; 78 | public static final int PE =8; 79 | public static final int FE =9; 80 | public static final int BI =10; 81 | 82 | private boolean OldValue; 83 | private boolean NewValue; 84 | private int eventType; 85 | /*public int eventType =0; depricated */ 86 | 87 | public I2CPortEvent(I2CPort srcport, int eventtype, boolean oldvalue, boolean newvalue) 88 | { 89 | super( srcport ); 90 | OldValue=oldvalue; 91 | NewValue=newvalue; 92 | eventType=eventtype; 93 | } 94 | public int getEventType() 95 | { 96 | return(eventType); 97 | } 98 | public boolean getNewValue() 99 | { 100 | return( NewValue ); 101 | } 102 | public boolean getOldValue() 103 | { 104 | return( OldValue ); 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /gnu-io/src/main/java/gnu/io/I2CPortEventListener.java: -------------------------------------------------------------------------------- 1 | /* Non functional contact tjarvi@qbang for details */ 2 | 3 | /*------------------------------------------------------------------------- 4 | | RXTX License v 2.1 - LGPL v 2.1 + Linking Over Controlled Interface. 5 | | RXTX is a native interface to serial ports in java. 6 | | Copyright 1997-2007 by Trent Jarvi tjarvi@qbang.org and others who 7 | | actually wrote it. See individual source files for more information. 8 | | 9 | | A copy of the LGPL v 2.1 may be found at 10 | | http://www.gnu.org/licenses/lgpl.txt on March 4th 2007. A copy is 11 | | here for your convenience. 12 | | 13 | | This library is free software; you can redistribute it and/or 14 | | modify it under the terms of the GNU Lesser General Public 15 | | License as published by the Free Software Foundation; either 16 | | version 2.1 of the License, or (at your option) any later version. 17 | | 18 | | This library is distributed in the hope that it will be useful, 19 | | but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 | | Lesser General Public License for more details. 22 | | 23 | | An executable that contains no derivative of any portion of RXTX, but 24 | | is designed to work with RXTX by being dynamically linked with it, 25 | | is considered a "work that uses the Library" subject to the terms and 26 | | conditions of the GNU Lesser General Public License. 27 | | 28 | | The following has been added to the RXTX License to remove 29 | | any confusion about linking to RXTX. We want to allow in part what 30 | | section 5, paragraph 2 of the LGPL does not permit in the special 31 | | case of linking over a controlled interface. The intent is to add a 32 | | Java Specification Request or standards body defined interface in the 33 | | future as another exception but one is not currently available. 34 | | 35 | | http://www.fsf.org/licenses/gpl-faq.html#LinkingOverControlledInterface 36 | | 37 | | As a special exception, the copyright holders of RXTX give you 38 | | permission to link RXTX with independent modules that communicate with 39 | | RXTX solely through the Sun Microsytems CommAPI interface version 2, 40 | | regardless of the license terms of these independent modules, and to copy 41 | | and distribute the resulting combined work under terms of your choice, 42 | | provided that every copy of the combined work is accompanied by a complete 43 | | copy of the source code of RXTX (the version of RXTX used to produce the 44 | | combined work), being distributed under the terms of the GNU Lesser General 45 | | Public License plus this exception. An independent module is a 46 | | module which is not derived from or based on RXTX. 47 | | 48 | | Note that people who make modified versions of RXTX are not obligated 49 | | to grant this special exception for their modified versions; it is 50 | | their choice whether to do so. The GNU Lesser General Public License 51 | | gives permission to release a modified version without this exception; this 52 | | exception also makes it possible to release a modified version which 53 | | carries forward this exception. 54 | | 55 | | You should have received a copy of the GNU Lesser General Public 56 | | License along with this library; if not, write to the Free 57 | | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 58 | | All trademarks belong to their respective owners. 59 | --------------------------------------------------------------------------*/ 60 | package gnu.io; 61 | import java.util.*; 62 | 63 | /** 64 | * @author Trent Jarvi 65 | * @version %I%, %G% 66 | * @since JDK1.0 67 | */ 68 | 69 | 70 | public interface I2CPortEventListener extends EventListener 71 | { 72 | public abstract void I2CEvent( I2CPortEvent ev ); 73 | } 74 | -------------------------------------------------------------------------------- /gnu-io/src/main/java/gnu/io/LibLoadException.java: -------------------------------------------------------------------------------- 1 | package gnu.io; 2 | 3 | class LibLoadException extends Exception { 4 | 5 | public LibLoadException(String message) { 6 | super(message); 7 | } 8 | 9 | public LibLoadException(String message, Throwable cause) { 10 | super(message, cause); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /gnu-io/src/main/java/gnu/io/LibraryLoader.java: -------------------------------------------------------------------------------- 1 | package gnu.io; 2 | 3 | import java.io.Closeable; 4 | import java.io.File; 5 | import java.io.FileOutputStream; 6 | import java.io.IOException; 7 | import java.io.InputStream; 8 | import java.net.URISyntaxException; 9 | import java.net.URL; 10 | import java.net.URLDecoder; 11 | import java.util.Enumeration; 12 | import java.util.HashSet; 13 | import java.util.Set; 14 | import java.util.jar.JarEntry; 15 | import java.util.jar.JarFile; 16 | import java.util.regex.Matcher; 17 | import java.util.regex.Pattern; 18 | 19 | /** 20 | * LibraryLoader to load a nested binary from a jar. 21 | */ 22 | class LibraryLoader { 23 | public static final Pattern FILE_NAME_PATTERN = Pattern.compile("^(.+)(\\.[^\\.]+)$"); 24 | 25 | private static Set successfullyLoaded = new HashSet(); 26 | 27 | public synchronized static void loadRxtxNative() { 28 | try { 29 | loadLibsFromJar("/libs"); 30 | } catch (LibLoadException e) { 31 | try { 32 | System.loadLibrary("rxtxSerial"); 33 | } catch (UnsatisfiedLinkError e1) { 34 | System.err.println("Could not load lib from jar and from system."); 35 | e.printStackTrace(); 36 | throw e1; 37 | } 38 | } 39 | } 40 | 41 | private static boolean loadLibsFromJar(String... toResPaths) throws LibLoadException { 42 | for (String toResPath : toResPaths) { 43 | 44 | if (successfullyLoaded.contains(toResPath)) { 45 | continue; // skip if loaded already 46 | } 47 | try { 48 | loadLib(toResPath); 49 | } catch (URISyntaxException e) { 50 | throw new LibLoadException("Failed to load Library.", e); 51 | } catch (IOException e) { 52 | throw new LibLoadException("Failed to load Library.", e); 53 | } 54 | successfullyLoaded.add(toResPath); 55 | } 56 | 57 | return true; 58 | } 59 | 60 | private static void loadLib(String libsDIr) throws URISyntaxException, IOException, LibLoadException { 61 | 62 | URL dirUrl = LibraryLoader.class.getResource(libsDIr); 63 | 64 | if (dirUrl == null) { 65 | throw new LibLoadException("directory does not exist " + libsDIr); 66 | } 67 | 68 | String protocol = dirUrl.getProtocol(); 69 | if (protocol.equals("jar")) { 70 | loadFromJar(dirUrl, libsDIr); 71 | } 72 | else if (protocol.equals("file")) { 73 | loadFromFile(dirUrl); 74 | } 75 | else { 76 | throw new LibLoadException("unknown protocol: " + protocol); 77 | } 78 | } 79 | 80 | private static boolean loadFromFile(URL dirUrl) throws URISyntaxException { 81 | File libsDir = new File(dirUrl.toURI()); 82 | 83 | if (!libsDir.isDirectory()) { 84 | return false; 85 | } 86 | 87 | for (File lib : libsDir.listFiles()) { 88 | System.load(lib.getAbsolutePath()); 89 | } 90 | 91 | return true; 92 | } 93 | 94 | private static void loadFromJar(URL dirUrl, String libsDir) throws IOException, LibLoadException { 95 | String jarPath = dirUrl.getPath().substring(5, dirUrl.getPath().indexOf("!")); 96 | 97 | JarFile jar = new JarFile(URLDecoder.decode(jarPath, "UTF-8")); 98 | 99 | Enumeration entries = jar.entries(); 100 | 101 | while (entries.hasMoreElements()) { 102 | JarEntry element = entries.nextElement(); 103 | 104 | if (element.isDirectory() || !element.getName().startsWith(libsDir.substring(1))) { 105 | continue; 106 | } 107 | 108 | InputStream fileInputStream = jar.getInputStream(element); 109 | try { 110 | saveResStreamToFileAndLoad(element.getName(), fileInputStream); 111 | } finally { 112 | saveClose(fileInputStream); 113 | } 114 | } 115 | } 116 | 117 | private static void saveResStreamToFileAndLoad(String fileName, InputStream is) 118 | throws IOException, LibLoadException { 119 | Matcher matcher = FILE_NAME_PATTERN.matcher(fileName); 120 | if (!matcher.matches()) { 121 | throw new LibLoadException("Filename '" + fileName + "' does not match pattern."); 122 | } 123 | File tempFileLib = File.createTempFile(matcher.group(1), matcher.group(2)); 124 | tempFileLib.deleteOnExit(); 125 | 126 | FileOutputStream fos = null; 127 | try { 128 | 129 | fos = new FileOutputStream(tempFileLib); 130 | byte[] buffer = new byte[2048]; 131 | int len; 132 | while ((len = is.read(buffer)) > 0) { 133 | fos.write(buffer, 0, len); 134 | } 135 | 136 | System.load(tempFileLib.getAbsolutePath()); 137 | } finally { 138 | saveClose(fos); 139 | } 140 | } 141 | 142 | private static void saveClose(Closeable closeable) throws IOException { 143 | if (closeable != null) { 144 | closeable.close(); 145 | } 146 | } 147 | 148 | private LibraryLoader() { 149 | } 150 | 151 | } 152 | -------------------------------------------------------------------------------- /gnu-io/src/main/java/gnu/io/NoSuchPortException.java: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------- 2 | | RXTX License v 2.1 - LGPL v 2.1 + Linking Over Controlled Interface. 3 | | RXTX is a native interface to serial ports in java. 4 | | Copyright 1997-2007 by Trent Jarvi tjarvi@qbang.org and others who 5 | | actually wrote it. See individual source files for more information. 6 | | 7 | | A copy of the LGPL v 2.1 may be found at 8 | | http://www.gnu.org/licenses/lgpl.txt on March 4th 2007. A copy is 9 | | here for your convenience. 10 | | 11 | | This library is free software; you can redistribute it and/or 12 | | modify it under the terms of the GNU Lesser General Public 13 | | License as published by the Free Software Foundation; either 14 | | version 2.1 of the License, or (at your option) any later version. 15 | | 16 | | This library is distributed in the hope that it will be useful, 17 | | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | | Lesser General Public License for more details. 20 | | 21 | | An executable that contains no derivative of any portion of RXTX, but 22 | | is designed to work with RXTX by being dynamically linked with it, 23 | | is considered a "work that uses the Library" subject to the terms and 24 | | conditions of the GNU Lesser General Public License. 25 | | 26 | | The following has been added to the RXTX License to remove 27 | | any confusion about linking to RXTX. We want to allow in part what 28 | | section 5, paragraph 2 of the LGPL does not permit in the special 29 | | case of linking over a controlled interface. The intent is to add a 30 | | Java Specification Request or standards body defined interface in the 31 | | future as another exception but one is not currently available. 32 | | 33 | | http://www.fsf.org/licenses/gpl-faq.html#LinkingOverControlledInterface 34 | | 35 | | As a special exception, the copyright holders of RXTX give you 36 | | permission to link RXTX with independent modules that communicate with 37 | | RXTX solely through the Sun Microsytems CommAPI interface version 2, 38 | | regardless of the license terms of these independent modules, and to copy 39 | | and distribute the resulting combined work under terms of your choice, 40 | | provided that every copy of the combined work is accompanied by a complete 41 | | copy of the source code of RXTX (the version of RXTX used to produce the 42 | | combined work), being distributed under the terms of the GNU Lesser General 43 | | Public License plus this exception. An independent module is a 44 | | module which is not derived from or based on RXTX. 45 | | 46 | | Note that people who make modified versions of RXTX are not obligated 47 | | to grant this special exception for their modified versions; it is 48 | | their choice whether to do so. The GNU Lesser General Public License 49 | | gives permission to release a modified version without this exception; this 50 | | exception also makes it possible to release a modified version which 51 | | carries forward this exception. 52 | | 53 | | You should have received a copy of the GNU Lesser General Public 54 | | License along with this library; if not, write to the Free 55 | | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 56 | | All trademarks belong to their respective owners. 57 | --------------------------------------------------------------------------*/ 58 | package gnu.io; 59 | 60 | /** 61 | * The requested Port does not exist 62 | * 63 | * @author Trent Jarvi 64 | * @version %I%, %G% 65 | * @since JDK1.0 66 | */ 67 | 68 | public class NoSuchPortException extends Exception { 69 | NoSuchPortException(String str) { 70 | super(str); 71 | } 72 | 73 | public NoSuchPortException() { 74 | super(); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /gnu-io/src/main/java/gnu/io/ParallelPortEvent.java: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------- 2 | | RXTX License v 2.1 - LGPL v 2.1 + Linking Over Controlled Interface. 3 | | RXTX is a native interface to serial ports in java. 4 | | Copyright 1997-2007 by Trent Jarvi tjarvi@qbang.org and others who 5 | | actually wrote it. See individual source files for more information. 6 | | 7 | | A copy of the LGPL v 2.1 may be found at 8 | | http://www.gnu.org/licenses/lgpl.txt on March 4th 2007. A copy is 9 | | here for your convenience. 10 | | 11 | | This library is free software; you can redistribute it and/or 12 | | modify it under the terms of the GNU Lesser General Public 13 | | License as published by the Free Software Foundation; either 14 | | version 2.1 of the License, or (at your option) any later version. 15 | | 16 | | This library is distributed in the hope that it will be useful, 17 | | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | | Lesser General Public License for more details. 20 | | 21 | | An executable that contains no derivative of any portion of RXTX, but 22 | | is designed to work with RXTX by being dynamically linked with it, 23 | | is considered a "work that uses the Library" subject to the terms and 24 | | conditions of the GNU Lesser General Public License. 25 | | 26 | | The following has been added to the RXTX License to remove 27 | | any confusion about linking to RXTX. We want to allow in part what 28 | | section 5, paragraph 2 of the LGPL does not permit in the special 29 | | case of linking over a controlled interface. The intent is to add a 30 | | Java Specification Request or standards body defined interface in the 31 | | future as another exception but one is not currently available. 32 | | 33 | | http://www.fsf.org/licenses/gpl-faq.html#LinkingOverControlledInterface 34 | | 35 | | As a special exception, the copyright holders of RXTX give you 36 | | permission to link RXTX with independent modules that communicate with 37 | | RXTX solely through the Sun Microsytems CommAPI interface version 2, 38 | | regardless of the license terms of these independent modules, and to copy 39 | | and distribute the resulting combined work under terms of your choice, 40 | | provided that every copy of the combined work is accompanied by a complete 41 | | copy of the source code of RXTX (the version of RXTX used to produce the 42 | | combined work), being distributed under the terms of the GNU Lesser General 43 | | Public License plus this exception. An independent module is a 44 | | module which is not derived from or based on RXTX. 45 | | 46 | | Note that people who make modified versions of RXTX are not obligated 47 | | to grant this special exception for their modified versions; it is 48 | | their choice whether to do so. The GNU Lesser General Public License 49 | | gives permission to release a modified version without this exception; this 50 | | exception also makes it possible to release a modified version which 51 | | carries forward this exception. 52 | | 53 | | You should have received a copy of the GNU Lesser General Public 54 | | License along with this library; if not, write to the Free 55 | | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 56 | | All trademarks belong to their respective owners. 57 | --------------------------------------------------------------------------*/ 58 | package gnu.io; 59 | import java.util.*; 60 | 61 | /** 62 | * @author Trent Jarvi 63 | * @version %I%, %G% 64 | * @since JDK1.0 65 | */ 66 | 67 | public class ParallelPortEvent extends EventObject 68 | { 69 | static public final int PAR_EV_ERROR =1; 70 | static public final int PAR_EV_BUFFER =2; 71 | 72 | 73 | private boolean OldValue; 74 | private boolean NewValue; 75 | private int eventType; 76 | /*public int eventType =0; depricated */ 77 | 78 | public ParallelPortEvent(ParallelPort srcport, int eventtype, 79 | boolean oldvalue, boolean newvalue) 80 | { 81 | super( srcport ); 82 | OldValue=oldvalue; 83 | NewValue=newvalue; 84 | eventType=eventtype; 85 | } 86 | public int getEventType() 87 | { 88 | return(eventType); 89 | } 90 | public boolean getNewValue() 91 | { 92 | return( NewValue ); 93 | } 94 | public boolean getOldValue() 95 | { 96 | return( OldValue ); 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /gnu-io/src/main/java/gnu/io/ParallelPortEventListener.java: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------- 2 | | RXTX License v 2.1 - LGPL v 2.1 + Linking Over Controlled Interface. 3 | | RXTX is a native interface to serial ports in java. 4 | | Copyright 1997-2007 by Trent Jarvi tjarvi@qbang.org and others who 5 | | actually wrote it. See individual source files for more information. 6 | | 7 | | A copy of the LGPL v 2.1 may be found at 8 | | http://www.gnu.org/licenses/lgpl.txt on March 4th 2007. A copy is 9 | | here for your convenience. 10 | | 11 | | This library is free software; you can redistribute it and/or 12 | | modify it under the terms of the GNU Lesser General Public 13 | | License as published by the Free Software Foundation; either 14 | | version 2.1 of the License, or (at your option) any later version. 15 | | 16 | | This library is distributed in the hope that it will be useful, 17 | | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | | Lesser General Public License for more details. 20 | | 21 | | An executable that contains no derivative of any portion of RXTX, but 22 | | is designed to work with RXTX by being dynamically linked with it, 23 | | is considered a "work that uses the Library" subject to the terms and 24 | | conditions of the GNU Lesser General Public License. 25 | | 26 | | The following has been added to the RXTX License to remove 27 | | any confusion about linking to RXTX. We want to allow in part what 28 | | section 5, paragraph 2 of the LGPL does not permit in the special 29 | | case of linking over a controlled interface. The intent is to add a 30 | | Java Specification Request or standards body defined interface in the 31 | | future as another exception but one is not currently available. 32 | | 33 | | http://www.fsf.org/licenses/gpl-faq.html#LinkingOverControlledInterface 34 | | 35 | | As a special exception, the copyright holders of RXTX give you 36 | | permission to link RXTX with independent modules that communicate with 37 | | RXTX solely through the Sun Microsytems CommAPI interface version 2, 38 | | regardless of the license terms of these independent modules, and to copy 39 | | and distribute the resulting combined work under terms of your choice, 40 | | provided that every copy of the combined work is accompanied by a complete 41 | | copy of the source code of RXTX (the version of RXTX used to produce the 42 | | combined work), being distributed under the terms of the GNU Lesser General 43 | | Public License plus this exception. An independent module is a 44 | | module which is not derived from or based on RXTX. 45 | | 46 | | Note that people who make modified versions of RXTX are not obligated 47 | | to grant this special exception for their modified versions; it is 48 | | their choice whether to do so. The GNU Lesser General Public License 49 | | gives permission to release a modified version without this exception; this 50 | | exception also makes it possible to release a modified version which 51 | | carries forward this exception. 52 | | 53 | | You should have received a copy of the GNU Lesser General Public 54 | | License along with this library; if not, write to the Free 55 | | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 56 | | All trademarks belong to their respective owners. 57 | --------------------------------------------------------------------------*/ 58 | package gnu.io; 59 | 60 | import java.util.*; 61 | 62 | /** 63 | * @author Trent Jarvi 64 | * @version %I%, %G% 65 | * @since JDK1.0 66 | */ 67 | 68 | public interface ParallelPortEventListener extends EventListener 69 | { 70 | public abstract void parallelEvent(ParallelPortEvent ev ); 71 | } 72 | -------------------------------------------------------------------------------- /gnu-io/src/main/java/gnu/io/PortInUseException.java: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------- 2 | | RXTX License v 2.1 - LGPL v 2.1 + Linking Over Controlled Interface. 3 | | RXTX is a native interface to serial ports in java. 4 | | Copyright 1997-2007 by Trent Jarvi tjarvi@qbang.org and others who 5 | | actually wrote it. See individual source files for more information. 6 | | 7 | | A copy of the LGPL v 2.1 may be found at 8 | | http://www.gnu.org/licenses/lgpl.txt on March 4th 2007. A copy is 9 | | here for your convenience. 10 | | 11 | | This library is free software; you can redistribute it and/or 12 | | modify it under the terms of the GNU Lesser General Public 13 | | License as published by the Free Software Foundation; either 14 | | version 2.1 of the License, or (at your option) any later version. 15 | | 16 | | This library is distributed in the hope that it will be useful, 17 | | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | | Lesser General Public License for more details. 20 | | 21 | | An executable that contains no derivative of any portion of RXTX, but 22 | | is designed to work with RXTX by being dynamically linked with it, 23 | | is considered a "work that uses the Library" subject to the terms and 24 | | conditions of the GNU Lesser General Public License. 25 | | 26 | | The following has been added to the RXTX License to remove 27 | | any confusion about linking to RXTX. We want to allow in part what 28 | | section 5, paragraph 2 of the LGPL does not permit in the special 29 | | case of linking over a controlled interface. The intent is to add a 30 | | Java Specification Request or standards body defined interface in the 31 | | future as another exception but one is not currently available. 32 | | 33 | | http://www.fsf.org/licenses/gpl-faq.html#LinkingOverControlledInterface 34 | | 35 | | As a special exception, the copyright holders of RXTX give you 36 | | permission to link RXTX with independent modules that communicate with 37 | | RXTX solely through the Sun Microsytems CommAPI interface version 2, 38 | | regardless of the license terms of these independent modules, and to copy 39 | | and distribute the resulting combined work under terms of your choice, 40 | | provided that every copy of the combined work is accompanied by a complete 41 | | copy of the source code of RXTX (the version of RXTX used to produce the 42 | | combined work), being distributed under the terms of the GNU Lesser General 43 | | Public License plus this exception. An independent module is a 44 | | module which is not derived from or based on RXTX. 45 | | 46 | | Note that people who make modified versions of RXTX are not obligated 47 | | to grant this special exception for their modified versions; it is 48 | | their choice whether to do so. The GNU Lesser General Public License 49 | | gives permission to release a modified version without this exception; this 50 | | exception also makes it possible to release a modified version which 51 | | carries forward this exception. 52 | | 53 | | You should have received a copy of the GNU Lesser General Public 54 | | License along with this library; if not, write to the Free 55 | | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 56 | | All trademarks belong to their respective owners. 57 | --------------------------------------------------------------------------*/ 58 | package gnu.io; 59 | 60 | /** 61 | * The port requested is currently in use 62 | * 63 | * @author Trent Jarvi 64 | * @version %I%, %G% 65 | * @since JDK1.0 66 | */ 67 | 68 | public class PortInUseException extends Exception { 69 | /** 70 | * the owner of the port requested. 71 | */ 72 | public String currentOwner; 73 | 74 | /** 75 | * create a instance of the Exception and store the current owner 76 | * 77 | * @param str 78 | * detailed information about the current owner 79 | */ 80 | PortInUseException(String str) { 81 | super(str); 82 | currentOwner = str; 83 | } 84 | 85 | public PortInUseException() { 86 | super(); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /gnu-io/src/main/java/gnu/io/RS485PortEvent.java: -------------------------------------------------------------------------------- 1 | /* Non functional contact tjarvi@qbang.org for details */ 2 | /*------------------------------------------------------------------------- 3 | | RXTX License v 2.1 - LGPL v 2.1 + Linking Over Controlled Interface. 4 | | RXTX is a native interface to serial ports in java. 5 | | Copyright 1997-2007 by Trent Jarvi tjarvi@qbang.org and others who 6 | | actually wrote it. See individual source files for more information. 7 | | 8 | | A copy of the LGPL v 2.1 may be found at 9 | | http://www.gnu.org/licenses/lgpl.txt on March 4th 2007. A copy is 10 | | here for your convenience. 11 | | 12 | | This library is free software; you can redistribute it and/or 13 | | modify it under the terms of the GNU Lesser General Public 14 | | License as published by the Free Software Foundation; either 15 | | version 2.1 of the License, or (at your option) any later version. 16 | | 17 | | This library is distributed in the hope that it will be useful, 18 | | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | | Lesser General Public License for more details. 21 | | 22 | | An executable that contains no derivative of any portion of RXTX, but 23 | | is designed to work with RXTX by being dynamically linked with it, 24 | | is considered a "work that uses the Library" subject to the terms and 25 | | conditions of the GNU Lesser General Public License. 26 | | 27 | | The following has been added to the RXTX License to remove 28 | | any confusion about linking to RXTX. We want to allow in part what 29 | | section 5, paragraph 2 of the LGPL does not permit in the special 30 | | case of linking over a controlled interface. The intent is to add a 31 | | Java Specification Request or standards body defined interface in the 32 | | future as another exception but one is not currently available. 33 | | 34 | | http://www.fsf.org/licenses/gpl-faq.html#LinkingOverControlledInterface 35 | | 36 | | As a special exception, the copyright holders of RXTX give you 37 | | permission to link RXTX with independent modules that communicate with 38 | | RXTX solely through the Sun Microsytems CommAPI interface version 2, 39 | | regardless of the license terms of these independent modules, and to copy 40 | | and distribute the resulting combined work under terms of your choice, 41 | | provided that every copy of the combined work is accompanied by a complete 42 | | copy of the source code of RXTX (the version of RXTX used to produce the 43 | | combined work), being distributed under the terms of the GNU Lesser General 44 | | Public License plus this exception. An independent module is a 45 | | module which is not derived from or based on RXTX. 46 | | 47 | | Note that people who make modified versions of RXTX are not obligated 48 | | to grant this special exception for their modified versions; it is 49 | | their choice whether to do so. The GNU Lesser General Public License 50 | | gives permission to release a modified version without this exception; this 51 | | exception also makes it possible to release a modified version which 52 | | carries forward this exception. 53 | | 54 | | You should have received a copy of the GNU Lesser General Public 55 | | License along with this library; if not, write to the Free 56 | | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 57 | | All trademarks belong to their respective owners. 58 | --------------------------------------------------------------------------*/ 59 | package gnu.io; 60 | import java.util.*; 61 | 62 | /** 63 | * @author Trent Jarvi 64 | * @version %I%, %G% 65 | * @since JDK1.0 66 | */ 67 | 68 | 69 | public class RS485PortEvent extends EventObject 70 | { 71 | public static final int DATA_AVAILABLE =1; 72 | public static final int OUTPUT_BUFFER_EMPTY =2; 73 | public static final int CTS =3; 74 | public static final int DSR =4; 75 | public static final int RI =5; 76 | public static final int CD =6; 77 | public static final int OE =7; 78 | public static final int PE =8; 79 | public static final int FE =9; 80 | public static final int BI =10; 81 | 82 | private boolean OldValue; 83 | private boolean NewValue; 84 | private int eventType; 85 | /*public int eventType =0; depricated */ 86 | 87 | public RS485PortEvent(RS485Port srcport, int eventtype, boolean oldvalue, boolean newvalue) 88 | { 89 | super( srcport ); 90 | OldValue=oldvalue; 91 | NewValue=newvalue; 92 | eventType=eventtype; 93 | } 94 | public int getEventType() 95 | { 96 | return(eventType); 97 | } 98 | public boolean getNewValue() 99 | { 100 | return( NewValue ); 101 | } 102 | public boolean getOldValue() 103 | { 104 | return( OldValue ); 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /gnu-io/src/main/java/gnu/io/RS485PortEventListener.java: -------------------------------------------------------------------------------- 1 | /* Non functional contact tjarvi@qbang.org for details */ 2 | /*------------------------------------------------------------------------- 3 | | RXTX License v 2.1 - LGPL v 2.1 + Linking Over Controlled Interface. 4 | | RXTX is a native interface to serial ports in java. 5 | | Copyright 1997-2007 by Trent Jarvi tjarvi@qbang.org and others who 6 | | actually wrote it. See individual source files for more information. 7 | | 8 | | A copy of the LGPL v 2.1 may be found at 9 | | http://www.gnu.org/licenses/lgpl.txt on March 4th 2007. A copy is 10 | | here for your convenience. 11 | | 12 | | This library is free software; you can redistribute it and/or 13 | | modify it under the terms of the GNU Lesser General Public 14 | | License as published by the Free Software Foundation; either 15 | | version 2.1 of the License, or (at your option) any later version. 16 | | 17 | | This library is distributed in the hope that it will be useful, 18 | | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | | Lesser General Public License for more details. 21 | | 22 | | An executable that contains no derivative of any portion of RXTX, but 23 | | is designed to work with RXTX by being dynamically linked with it, 24 | | is considered a "work that uses the Library" subject to the terms and 25 | | conditions of the GNU Lesser General Public License. 26 | | 27 | | The following has been added to the RXTX License to remove 28 | | any confusion about linking to RXTX. We want to allow in part what 29 | | section 5, paragraph 2 of the LGPL does not permit in the special 30 | | case of linking over a controlled interface. The intent is to add a 31 | | Java Specification Request or standards body defined interface in the 32 | | future as another exception but one is not currently available. 33 | | 34 | | http://www.fsf.org/licenses/gpl-faq.html#LinkingOverControlledInterface 35 | | 36 | | As a special exception, the copyright holders of RXTX give you 37 | | permission to link RXTX with independent modules that communicate with 38 | | RXTX solely through the Sun Microsytems CommAPI interface version 2, 39 | | regardless of the license terms of these independent modules, and to copy 40 | | and distribute the resulting combined work under terms of your choice, 41 | | provided that every copy of the combined work is accompanied by a complete 42 | | copy of the source code of RXTX (the version of RXTX used to produce the 43 | | combined work), being distributed under the terms of the GNU Lesser General 44 | | Public License plus this exception. An independent module is a 45 | | module which is not derived from or based on RXTX. 46 | | 47 | | Note that people who make modified versions of RXTX are not obligated 48 | | to grant this special exception for their modified versions; it is 49 | | their choice whether to do so. The GNU Lesser General Public License 50 | | gives permission to release a modified version without this exception; this 51 | | exception also makes it possible to release a modified version which 52 | | carries forward this exception. 53 | | 54 | | You should have received a copy of the GNU Lesser General Public 55 | | License along with this library; if not, write to the Free 56 | | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 57 | | All trademarks belong to their respective owners. 58 | --------------------------------------------------------------------------*/ 59 | package gnu.io; 60 | import java.util.*; 61 | 62 | /** 63 | * @author Trent Jarvi 64 | * @version %I%, %G% 65 | * @since JDK1.0 66 | */ 67 | 68 | public interface RS485PortEventListener extends EventListener 69 | { 70 | public abstract void RS485Event( RS485PortEvent ev ); 71 | } 72 | -------------------------------------------------------------------------------- /gnu-io/src/main/java/gnu/io/RXTXVersion.java: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------- 2 | | RXTX License v 2.1 - LGPL v 2.1 + Linking Over Controlled Interface. 3 | | RXTX is a native interface to serial ports in java. 4 | | Copyright 1997-2009 by Trent Jarvi tjarvi@qbang.org and others who 5 | | actually wrote it. See individual source files for more information. 6 | | 7 | | A copy of the LGPL v 2.1 may be found at 8 | | http://www.gnu.org/licenses/lgpl.txt on March 4th 2007. A copy is 9 | | here for your convenience. 10 | | 11 | | This library is free software; you can redistribute it and/or 12 | | modify it under the terms of the GNU Lesser General Public 13 | | License as published by the Free Software Foundation; either 14 | | version 2.1 of the License, or (at your option) any later version. 15 | | 16 | | This library is distributed in the hope that it will be useful, 17 | | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | | Lesser General Public License for more details. 20 | | 21 | | An executable that contains no derivative of any portion of RXTX, but 22 | | is designed to work with RXTX by being dynamically linked with it, 23 | | is considered a "work that uses the Library" subject to the terms and 24 | | conditions of the GNU Lesser General Public License. 25 | | 26 | | The following has been added to the RXTX License to remove 27 | | any confusion about linking to RXTX. We want to allow in part what 28 | | section 5, paragraph 2 of the LGPL does not permit in the special 29 | | case of linking over a controlled interface. The intent is to add a 30 | | Java Specification Request or standards body defined interface in the 31 | | future as another exception but one is not currently available. 32 | | 33 | | http://www.fsf.org/licenses/gpl-faq.html#LinkingOverControlledInterface 34 | | 35 | | As a special exception, the copyright holders of RXTX give you 36 | | permission to link RXTX with independent modules that communicate with 37 | | RXTX solely through the Sun Microsytems CommAPI interface version 2, 38 | | regardless of the license terms of these independent modules, and to copy 39 | | and distribute the resulting combined work under terms of your choice, 40 | | provided that every copy of the combined work is accompanied by a complete 41 | | copy of the source code of RXTX (the version of RXTX used to produce the 42 | | combined work), being distributed under the terms of the GNU Lesser General 43 | | Public License plus this exception. An independent module is a 44 | | module which is not derived from or based on RXTX. 45 | | 46 | | Note that people who make modified versions of RXTX are not obligated 47 | | to grant this special exception for their modified versions; it is 48 | | their choice whether to do so. The GNU Lesser General Public License 49 | | gives permission to release a modified version without this exception; this 50 | | exception also makes it possible to release a modified version which 51 | | carries forward this exception. 52 | | 53 | | You should have received a copy of the GNU Lesser General Public 54 | | License along with this library; if not, write to the Free 55 | | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 56 | | All trademarks belong to their respective owners. 57 | --------------------------------------------------------------------------*/ 58 | package gnu.io; 59 | 60 | /** 61 | * A class to keep the current version in 62 | */ 63 | 64 | public class RXTXVersion { 65 | /*------------------------------------------------------------------------------ 66 | RXTXVersion 67 | accept: - 68 | perform: Set Version. 69 | return: - 70 | exceptions: Throwable 71 | comments: 72 | See INSTALL for details. 73 | ------------------------------------------------------------------------------*/ 74 | private static String Version; 75 | 76 | static { 77 | LibraryLoader.loadRxtxNative(); 78 | Version = "RXTX-2.2pre2"; 79 | } 80 | 81 | /** 82 | * static method to return the current version of RXTX unique to RXTX. 83 | * 84 | * @return a string representing the version "RXTX-1.4-9" 85 | */ 86 | public static String getVersion() { 87 | return Version; 88 | } 89 | 90 | public static native String nativeGetVersion(); 91 | } 92 | -------------------------------------------------------------------------------- /gnu-io/src/main/java/gnu/io/RawPort.java: -------------------------------------------------------------------------------- 1 | /* Non functional contact tjarvi@qbang.org for details */ 2 | /*------------------------------------------------------------------------- 3 | | RXTX License v 2.1 - LGPL v 2.1 + Linking Over Controlled Interface. 4 | | RXTX is a native interface to serial ports in java. 5 | | Copyright 1997-2007 by Trent Jarvi tjarvi@qbang.org and others who 6 | | actually wrote it. See individual source files for more information. 7 | | 8 | | A copy of the LGPL v 2.1 may be found at 9 | | http://www.gnu.org/licenses/lgpl.txt on March 4th 2007. A copy is 10 | | here for your convenience. 11 | | 12 | | This library is free software; you can redistribute it and/or 13 | | modify it under the terms of the GNU Lesser General Public 14 | | License as published by the Free Software Foundation; either 15 | | version 2.1 of the License, or (at your option) any later version. 16 | | 17 | | This library is distributed in the hope that it will be useful, 18 | | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | | Lesser General Public License for more details. 21 | | 22 | | An executable that contains no derivative of any portion of RXTX, but 23 | | is designed to work with RXTX by being dynamically linked with it, 24 | | is considered a "work that uses the Library" subject to the terms and 25 | | conditions of the GNU Lesser General Public License. 26 | | 27 | | The following has been added to the RXTX License to remove 28 | | any confusion about linking to RXTX. We want to allow in part what 29 | | section 5, paragraph 2 of the LGPL does not permit in the special 30 | | case of linking over a controlled interface. The intent is to add a 31 | | Java Specification Request or standards body defined interface in the 32 | | future as another exception but one is not currently available. 33 | | 34 | | http://www.fsf.org/licenses/gpl-faq.html#LinkingOverControlledInterface 35 | | 36 | | As a special exception, the copyright holders of RXTX give you 37 | | permission to link RXTX with independent modules that communicate with 38 | | RXTX solely through the Sun Microsytems CommAPI interface version 2, 39 | | regardless of the license terms of these independent modules, and to copy 40 | | and distribute the resulting combined work under terms of your choice, 41 | | provided that every copy of the combined work is accompanied by a complete 42 | | copy of the source code of RXTX (the version of RXTX used to produce the 43 | | combined work), being distributed under the terms of the GNU Lesser General 44 | | Public License plus this exception. An independent module is a 45 | | module which is not derived from or based on RXTX. 46 | | 47 | | Note that people who make modified versions of RXTX are not obligated 48 | | to grant this special exception for their modified versions; it is 49 | | their choice whether to do so. The GNU Lesser General Public License 50 | | gives permission to release a modified version without this exception; this 51 | | exception also makes it possible to release a modified version which 52 | | carries forward this exception. 53 | | 54 | | You should have received a copy of the GNU Lesser General Public 55 | | License along with this library; if not, write to the Free 56 | | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 57 | | All trademarks belong to their respective owners. 58 | --------------------------------------------------------------------------*/ 59 | package gnu.io; 60 | 61 | import java.util.TooManyListenersException; 62 | 63 | /** 64 | * @author Trent Jarvi 65 | * @version %I%, %G% 66 | * @since JDK1.0 67 | */ 68 | 69 | abstract class RawPort extends CommPort { 70 | public static final int DATABITS_5 = 5; 71 | public static final int DATABITS_6 = 6; 72 | public static final int DATABITS_7 = 7; 73 | public static final int DATABITS_8 = 8; 74 | public static final int PARITY_NONE = 0; 75 | public static final int PARITY_ODD = 1; 76 | public static final int PARITY_EVEN = 2; 77 | public static final int PARITY_MARK = 3; 78 | public static final int PARITY_SPACE = 4; 79 | public static final int STOPBITS_1 = 1; 80 | public static final int STOPBITS_1_5 = 0; // wrong 81 | public static final int STOPBITS_2 = 2; 82 | public static final int FLOWCONTROL_NONE = 0; 83 | public static final int FLOWCONTROL_RTSCTS_IN = 1; 84 | public static final int FLOWCONTROL_RTSCTS_OUT = 2; 85 | public static final int FLOWCONTROL_XONXOFF_IN = 4; 86 | public static final int FLOWCONTROL_XONXOFF_OUT = 8; 87 | public static final int WRITE_SIZE = 8; 88 | public static final int IO_PORT = 0x378; 89 | 90 | public abstract void setRawPortParams(int b, int d, int s, int p) throws UnsupportedCommOperationException; 91 | 92 | public abstract void addEventListener(RawPortEventListener lsnr) throws TooManyListenersException; 93 | 94 | public abstract void removeEventListener(); 95 | } 96 | -------------------------------------------------------------------------------- /gnu-io/src/main/java/gnu/io/RawPortEvent.java: -------------------------------------------------------------------------------- 1 | /* Non functional contact tjarvi@qbang.org for details */ 2 | 3 | /*------------------------------------------------------------------------- 4 | | RXTX License v 2.1 - LGPL v 2.1 + Linking Over Controlled Interface. 5 | | RXTX is a native interface to serial ports in java. 6 | | Copyright 1997-2007 by Trent Jarvi tjarvi@qbang.org and others who 7 | | actually wrote it. See individual source files for more information. 8 | | 9 | | A copy of the LGPL v 2.1 may be found at 10 | | http://www.gnu.org/licenses/lgpl.txt on March 4th 2007. A copy is 11 | | here for your convenience. 12 | | 13 | | This library is free software; you can redistribute it and/or 14 | | modify it under the terms of the GNU Lesser General Public 15 | | License as published by the Free Software Foundation; either 16 | | version 2.1 of the License, or (at your option) any later version. 17 | | 18 | | This library is distributed in the hope that it will be useful, 19 | | but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 | | Lesser General Public License for more details. 22 | | 23 | | An executable that contains no derivative of any portion of RXTX, but 24 | | is designed to work with RXTX by being dynamically linked with it, 25 | | is considered a "work that uses the Library" subject to the terms and 26 | | conditions of the GNU Lesser General Public License. 27 | | 28 | | The following has been added to the RXTX License to remove 29 | | any confusion about linking to RXTX. We want to allow in part what 30 | | section 5, paragraph 2 of the LGPL does not permit in the special 31 | | case of linking over a controlled interface. The intent is to add a 32 | | Java Specification Request or standards body defined interface in the 33 | | future as another exception but one is not currently available. 34 | | 35 | | http://www.fsf.org/licenses/gpl-faq.html#LinkingOverControlledInterface 36 | | 37 | | As a special exception, the copyright holders of RXTX give you 38 | | permission to link RXTX with independent modules that communicate with 39 | | RXTX solely through the Sun Microsytems CommAPI interface version 2, 40 | | regardless of the license terms of these independent modules, and to copy 41 | | and distribute the resulting combined work under terms of your choice, 42 | | provided that every copy of the combined work is accompanied by a complete 43 | | copy of the source code of RXTX (the version of RXTX used to produce the 44 | | combined work), being distributed under the terms of the GNU Lesser General 45 | | Public License plus this exception. An independent module is a 46 | | module which is not derived from or based on RXTX. 47 | | 48 | | Note that people who make modified versions of RXTX are not obligated 49 | | to grant this special exception for their modified versions; it is 50 | | their choice whether to do so. The GNU Lesser General Public License 51 | | gives permission to release a modified version without this exception; this 52 | | exception also makes it possible to release a modified version which 53 | | carries forward this exception. 54 | | 55 | | You should have received a copy of the GNU Lesser General Public 56 | | License along with this library; if not, write to the Free 57 | | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 58 | | All trademarks belong to their respective owners. 59 | --------------------------------------------------------------------------*/ 60 | package gnu.io; 61 | import java.util.*; 62 | 63 | /** 64 | * @author Trent Jarvi 65 | * @version %I%, %G% 66 | * @since JDK1.0 67 | */ 68 | 69 | public class RawPortEvent extends EventObject 70 | { 71 | public static final int DATA_AVAILABLE =1; 72 | public static final int OUTPUT_BUFFER_EMPTY =2; 73 | public static final int CTS =3; 74 | public static final int DSR =4; 75 | public static final int RI =5; 76 | public static final int CD =6; 77 | public static final int OE =7; 78 | public static final int PE =8; 79 | public static final int FE =9; 80 | public static final int BI =10; 81 | 82 | private boolean OldValue; 83 | private boolean NewValue; 84 | private int eventType; 85 | /*public int eventType =0; depricated */ 86 | 87 | public RawPortEvent(RawPort srcport, int eventtype, boolean oldvalue, boolean newvalue) 88 | { 89 | super( srcport ); 90 | OldValue=oldvalue; 91 | NewValue=newvalue; 92 | eventType=eventtype; 93 | } 94 | public int getEventType() 95 | { 96 | return(eventType); 97 | } 98 | public boolean getNewValue() 99 | { 100 | return( NewValue ); 101 | } 102 | public boolean getOldValue() 103 | { 104 | return( OldValue ); 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /gnu-io/src/main/java/gnu/io/RawPortEventListener.java: -------------------------------------------------------------------------------- 1 | /* Non functional contact tjavi@qbang.org for details */ 2 | 3 | /*------------------------------------------------------------------------- 4 | | RXTX License v 2.1 - LGPL v 2.1 + Linking Over Controlled Interface. 5 | | RXTX is a native interface to serial ports in java. 6 | | Copyright 1997-2007 by Trent Jarvi tjarvi@qbang.org and others who 7 | | actually wrote it. See individual source files for more information. 8 | | 9 | | A copy of the LGPL v 2.1 may be found at 10 | | http://www.gnu.org/licenses/lgpl.txt on March 4th 2007. A copy is 11 | | here for your convenience. 12 | | 13 | | This library is free software; you can redistribute it and/or 14 | | modify it under the terms of the GNU Lesser General Public 15 | | License as published by the Free Software Foundation; either 16 | | version 2.1 of the License, or (at your option) any later version. 17 | | 18 | | This library is distributed in the hope that it will be useful, 19 | | but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 | | Lesser General Public License for more details. 22 | | 23 | | An executable that contains no derivative of any portion of RXTX, but 24 | | is designed to work with RXTX by being dynamically linked with it, 25 | | is considered a "work that uses the Library" subject to the terms and 26 | | conditions of the GNU Lesser General Public License. 27 | | 28 | | The following has been added to the RXTX License to remove 29 | | any confusion about linking to RXTX. We want to allow in part what 30 | | section 5, paragraph 2 of the LGPL does not permit in the special 31 | | case of linking over a controlled interface. The intent is to add a 32 | | Java Specification Request or standards body defined interface in the 33 | | future as another exception but one is not currently available. 34 | | 35 | | http://www.fsf.org/licenses/gpl-faq.html#LinkingOverControlledInterface 36 | | 37 | | As a special exception, the copyright holders of RXTX give you 38 | | permission to link RXTX with independent modules that communicate with 39 | | RXTX solely through the Sun Microsytems CommAPI interface version 2, 40 | | regardless of the license terms of these independent modules, and to copy 41 | | and distribute the resulting combined work under terms of your choice, 42 | | provided that every copy of the combined work is accompanied by a complete 43 | | copy of the source code of RXTX (the version of RXTX used to produce the 44 | | combined work), being distributed under the terms of the GNU Lesser General 45 | | Public License plus this exception. An independent module is a 46 | | module which is not derived from or based on RXTX. 47 | | 48 | | Note that people who make modified versions of RXTX are not obligated 49 | | to grant this special exception for their modified versions; it is 50 | | their choice whether to do so. The GNU Lesser General Public License 51 | | gives permission to release a modified version without this exception; this 52 | | exception also makes it possible to release a modified version which 53 | | carries forward this exception. 54 | | 55 | | You should have received a copy of the GNU Lesser General Public 56 | | License along with this library; if not, write to the Free 57 | | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 58 | | All trademarks belong to their respective owners. 59 | --------------------------------------------------------------------------*/ 60 | package gnu.io; 61 | import java.util.*; 62 | 63 | /** 64 | * @author Trent Jarvi 65 | * @version %I%, %G% 66 | * @since JDK1.0 67 | */ 68 | 69 | public interface RawPortEventListener extends EventListener 70 | { 71 | public abstract void RawEvent( RawPortEvent ev ); 72 | } 73 | -------------------------------------------------------------------------------- /gnu-io/src/main/java/gnu/io/SerialPortEvent.java: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------- 2 | | RXTX License v 2.1 - LGPL v 2.1 + Linking Over Controlled Interface. 3 | | RXTX is a native interface to serial ports in java. 4 | | Copyright 1997-2007 by Trent Jarvi tjarvi@qbang.org and others who 5 | | actually wrote it. See individual source files for more information. 6 | | 7 | | A copy of the LGPL v 2.1 may be found at 8 | | http://www.gnu.org/licenses/lgpl.txt on March 4th 2007. A copy is 9 | | here for your convenience. 10 | | 11 | | This library is free software; you can redistribute it and/or 12 | | modify it under the terms of the GNU Lesser General Public 13 | | License as published by the Free Software Foundation; either 14 | | version 2.1 of the License, or (at your option) any later version. 15 | | 16 | | This library is distributed in the hope that it will be useful, 17 | | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | | Lesser General Public License for more details. 20 | | 21 | | An executable that contains no derivative of any portion of RXTX, but 22 | | is designed to work with RXTX by being dynamically linked with it, 23 | | is considered a "work that uses the Library" subject to the terms and 24 | | conditions of the GNU Lesser General Public License. 25 | | 26 | | The following has been added to the RXTX License to remove 27 | | any confusion about linking to RXTX. We want to allow in part what 28 | | section 5, paragraph 2 of the LGPL does not permit in the special 29 | | case of linking over a controlled interface. The intent is to add a 30 | | Java Specification Request or standards body defined interface in the 31 | | future as another exception but one is not currently available. 32 | | 33 | | http://www.fsf.org/licenses/gpl-faq.html#LinkingOverControlledInterface 34 | | 35 | | As a special exception, the copyright holders of RXTX give you 36 | | permission to link RXTX with independent modules that communicate with 37 | | RXTX solely through the Sun Microsytems CommAPI interface version 2, 38 | | regardless of the license terms of these independent modules, and to copy 39 | | and distribute the resulting combined work under terms of your choice, 40 | | provided that every copy of the combined work is accompanied by a complete 41 | | copy of the source code of RXTX (the version of RXTX used to produce the 42 | | combined work), being distributed under the terms of the GNU Lesser General 43 | | Public License plus this exception. An independent module is a 44 | | module which is not derived from or based on RXTX. 45 | | 46 | | Note that people who make modified versions of RXTX are not obligated 47 | | to grant this special exception for their modified versions; it is 48 | | their choice whether to do so. The GNU Lesser General Public License 49 | | gives permission to release a modified version without this exception; this 50 | | exception also makes it possible to release a modified version which 51 | | carries forward this exception. 52 | | 53 | | You should have received a copy of the GNU Lesser General Public 54 | | License along with this library; if not, write to the Free 55 | | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 56 | | All trademarks belong to their respective owners. 57 | --------------------------------------------------------------------------*/ 58 | package gnu.io; 59 | import java.util.*; 60 | 61 | /** 62 | * @author Trent Jarvi 63 | * @version %I%, %G% 64 | * @since JDK1.0 65 | */ 66 | 67 | public class SerialPortEvent extends EventObject 68 | { 69 | public static final int DATA_AVAILABLE =1; 70 | public static final int OUTPUT_BUFFER_EMPTY =2; 71 | public static final int CTS =3; 72 | public static final int DSR =4; 73 | public static final int RI =5; 74 | public static final int CD =6; 75 | public static final int OE =7; 76 | public static final int PE =8; 77 | public static final int FE =9; 78 | public static final int BI =10; 79 | 80 | private boolean OldValue; 81 | private boolean NewValue; 82 | private int eventType; 83 | /*public int eventType =0; depricated */ 84 | 85 | public SerialPortEvent(SerialPort srcport, int eventtype, boolean oldvalue, boolean newvalue) 86 | { 87 | super( srcport ); 88 | OldValue=oldvalue; 89 | NewValue=newvalue; 90 | eventType=eventtype; 91 | } 92 | public int getEventType() 93 | { 94 | return(eventType); 95 | } 96 | public boolean getNewValue() 97 | { 98 | return( NewValue ); 99 | } 100 | public boolean getOldValue() 101 | { 102 | return( OldValue ); 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /gnu-io/src/main/java/gnu/io/SerialPortEventListener.java: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------- 2 | | RXTX License v 2.1 - LGPL v 2.1 + Linking Over Controlled Interface. 3 | | RXTX is a native interface to serial ports in java. 4 | | Copyright 1997-2007 by Trent Jarvi tjarvi@qbang.org and others who 5 | | actually wrote it. See individual source files for more information. 6 | | 7 | | A copy of the LGPL v 2.1 may be found at 8 | | http://www.gnu.org/licenses/lgpl.txt on March 4th 2007. A copy is 9 | | here for your convenience. 10 | | 11 | | This library is free software; you can redistribute it and/or 12 | | modify it under the terms of the GNU Lesser General Public 13 | | License as published by the Free Software Foundation; either 14 | | version 2.1 of the License, or (at your option) any later version. 15 | | 16 | | This library is distributed in the hope that it will be useful, 17 | | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | | Lesser General Public License for more details. 20 | | 21 | | An executable that contains no derivative of any portion of RXTX, but 22 | | is designed to work with RXTX by being dynamically linked with it, 23 | | is considered a "work that uses the Library" subject to the terms and 24 | | conditions of the GNU Lesser General Public License. 25 | | 26 | | The following has been added to the RXTX License to remove 27 | | any confusion about linking to RXTX. We want to allow in part what 28 | | section 5, paragraph 2 of the LGPL does not permit in the special 29 | | case of linking over a controlled interface. The intent is to add a 30 | | Java Specification Request or standards body defined interface in the 31 | | future as another exception but one is not currently available. 32 | | 33 | | http://www.fsf.org/licenses/gpl-faq.html#LinkingOverControlledInterface 34 | | 35 | | As a special exception, the copyright holders of RXTX give you 36 | | permission to link RXTX with independent modules that communicate with 37 | | RXTX solely through the Sun Microsytems CommAPI interface version 2, 38 | | regardless of the license terms of these independent modules, and to copy 39 | | and distribute the resulting combined work under terms of your choice, 40 | | provided that every copy of the combined work is accompanied by a complete 41 | | copy of the source code of RXTX (the version of RXTX used to produce the 42 | | combined work), being distributed under the terms of the GNU Lesser General 43 | | Public License plus this exception. An independent module is a 44 | | module which is not derived from or based on RXTX. 45 | | 46 | | Note that people who make modified versions of RXTX are not obligated 47 | | to grant this special exception for their modified versions; it is 48 | | their choice whether to do so. The GNU Lesser General Public License 49 | | gives permission to release a modified version without this exception; this 50 | | exception also makes it possible to release a modified version which 51 | | carries forward this exception. 52 | | 53 | | You should have received a copy of the GNU Lesser General Public 54 | | License along with this library; if not, write to the Free 55 | | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 56 | | All trademarks belong to their respective owners. 57 | --------------------------------------------------------------------------*/ 58 | package gnu.io; 59 | import java.util.*; 60 | 61 | /** 62 | * @author Trent Jarvi 63 | * @version %I%, %G% 64 | * @since JDK1.0 65 | */ 66 | 67 | 68 | public interface SerialPortEventListener extends EventListener 69 | { 70 | public abstract void serialEvent( SerialPortEvent ev ); 71 | } 72 | -------------------------------------------------------------------------------- /gnu-io/src/main/java/gnu/io/UnSupportedLoggerException.java: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------- 2 | | RXTX License v 2.1 - LGPL v 2.1 + Linking Over Controlled Interface. 3 | | RXTX is a native interface to serial ports in java. 4 | | Copyright 1997-2007 by Trent Jarvi tjarvi@qbang.org and others who 5 | | actually wrote it. See individual source files for more information. 6 | | 7 | | A copy of the LGPL v 2.1 may be found at 8 | | http://www.gnu.org/licenses/lgpl.txt on March 4th 2007. A copy is 9 | | here for your convenience. 10 | | 11 | | This library is free software; you can redistribute it and/or 12 | | modify it under the terms of the GNU Lesser General Public 13 | | License as published by the Free Software Foundation; either 14 | | version 2.1 of the License, or (at your option) any later version. 15 | | 16 | | This library is distributed in the hope that it will be useful, 17 | | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | | Lesser General Public License for more details. 20 | | 21 | | An executable that contains no derivative of any portion of RXTX, but 22 | | is designed to work with RXTX by being dynamically linked with it, 23 | | is considered a "work that uses the Library" subject to the terms and 24 | | conditions of the GNU Lesser General Public License. 25 | | 26 | | The following has been added to the RXTX License to remove 27 | | any confusion about linking to RXTX. We want to allow in part what 28 | | section 5, paragraph 2 of the LGPL does not permit in the special 29 | | case of linking over a controlled interface. The intent is to add a 30 | | Java Specification Request or standards body defined interface in the 31 | | future as another exception but one is not currently available. 32 | | 33 | | http://www.fsf.org/licenses/gpl-faq.html#LinkingOverControlledInterface 34 | | 35 | | As a special exception, the copyright holders of RXTX give you 36 | | permission to link RXTX with independent modules that communicate with 37 | | RXTX solely through the Sun Microsytems CommAPI interface version 2, 38 | | regardless of the license terms of these independent modules, and to copy 39 | | and distribute the resulting combined work under terms of your choice, 40 | | provided that every copy of the combined work is accompanied by a complete 41 | | copy of the source code of RXTX (the version of RXTX used to produce the 42 | | combined work), being distributed under the terms of the GNU Lesser General 43 | | Public License plus this exception. An independent module is a 44 | | module which is not derived from or based on RXTX. 45 | | 46 | | Note that people who make modified versions of RXTX are not obligated 47 | | to grant this special exception for their modified versions; it is 48 | | their choice whether to do so. The GNU Lesser General Public License 49 | | gives permission to release a modified version without this exception; this 50 | | exception also makes it possible to release a modified version which 51 | | carries forward this exception. 52 | | 53 | | You should have received a copy of the GNU Lesser General Public 54 | | License along with this library; if not, write to the Free 55 | | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 56 | | All trademarks belong to their respective owners. 57 | --------------------------------------------------------------------------*/ 58 | package gnu.io; 59 | 60 | /** 61 | * Exception thrown when a method does not support the requested functionality. 62 | * 63 | * @author Trent Jarvi 64 | * @version %I%, %G% 65 | * @since JDK1.0 66 | */ 67 | 68 | public class UnSupportedLoggerException extends Exception { 69 | /** 70 | * create an instances with no message about why the Exception was thrown. 71 | * 72 | * @since JDK1.0 73 | */ 74 | public UnSupportedLoggerException() { 75 | super(); 76 | } 77 | 78 | /** 79 | * create an instance with a message about why the Exception was thrown. 80 | * 81 | * @param str 82 | * A detailed message explaining the reason for the Exception. 83 | * @since JDK1.0 84 | */ 85 | public UnSupportedLoggerException(String str) { 86 | super(str); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /gnu-io/src/main/java/gnu/io/UnsupportedCommOperationException.java: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------- 2 | | RXTX License v 2.1 - LGPL v 2.1 + Linking Over Controlled Interface. 3 | | RXTX is a native interface to serial ports in java. 4 | | Copyright 1997-2007 by Trent Jarvi tjarvi@qbang.org and others who 5 | | actually wrote it. See individual source files for more information. 6 | | 7 | | A copy of the LGPL v 2.1 may be found at 8 | | http://www.gnu.org/licenses/lgpl.txt on March 4th 2007. A copy is 9 | | here for your convenience. 10 | | 11 | | This library is free software; you can redistribute it and/or 12 | | modify it under the terms of the GNU Lesser General Public 13 | | License as published by the Free Software Foundation; either 14 | | version 2.1 of the License, or (at your option) any later version. 15 | | 16 | | This library is distributed in the hope that it will be useful, 17 | | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | | Lesser General Public License for more details. 20 | | 21 | | An executable that contains no derivative of any portion of RXTX, but 22 | | is designed to work with RXTX by being dynamically linked with it, 23 | | is considered a "work that uses the Library" subject to the terms and 24 | | conditions of the GNU Lesser General Public License. 25 | | 26 | | The following has been added to the RXTX License to remove 27 | | any confusion about linking to RXTX. We want to allow in part what 28 | | section 5, paragraph 2 of the LGPL does not permit in the special 29 | | case of linking over a controlled interface. The intent is to add a 30 | | Java Specification Request or standards body defined interface in the 31 | | future as another exception but one is not currently available. 32 | | 33 | | http://www.fsf.org/licenses/gpl-faq.html#LinkingOverControlledInterface 34 | | 35 | | As a special exception, the copyright holders of RXTX give you 36 | | permission to link RXTX with independent modules that communicate with 37 | | RXTX solely through the Sun Microsytems CommAPI interface version 2, 38 | | regardless of the license terms of these independent modules, and to copy 39 | | and distribute the resulting combined work under terms of your choice, 40 | | provided that every copy of the combined work is accompanied by a complete 41 | | copy of the source code of RXTX (the version of RXTX used to produce the 42 | | combined work), being distributed under the terms of the GNU Lesser General 43 | | Public License plus this exception. An independent module is a 44 | | module which is not derived from or based on RXTX. 45 | | 46 | | Note that people who make modified versions of RXTX are not obligated 47 | | to grant this special exception for their modified versions; it is 48 | | their choice whether to do so. The GNU Lesser General Public License 49 | | gives permission to release a modified version without this exception; this 50 | | exception also makes it possible to release a modified version which 51 | | carries forward this exception. 52 | | 53 | | You should have received a copy of the GNU Lesser General Public 54 | | License along with this library; if not, write to the Free 55 | | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 56 | | All trademarks belong to their respective owners. 57 | --------------------------------------------------------------------------*/ 58 | package gnu.io; 59 | 60 | /** 61 | * Exception thrown when a method does not support the requested functionality. 62 | * 63 | * @author Trent Jarvi 64 | * @version %I%, %G% 65 | * @since JDK1.0 66 | */ 67 | 68 | public class UnsupportedCommOperationException extends Exception { 69 | /** 70 | * create an instances with no message about why the Exception was thrown. 71 | * 72 | * @since JDK1.0 73 | */ 74 | public UnsupportedCommOperationException() { 75 | super(); 76 | } 77 | 78 | /** 79 | * create an instance with a message about why the Exception was thrown. 80 | * 81 | * @param str 82 | * A detailed message explaining the reason for the Exception. 83 | * @since JDK1.0 84 | */ 85 | public UnsupportedCommOperationException(String str) { 86 | super(str); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /gnu-io/src/main/java/gnu/io/package-info.java: -------------------------------------------------------------------------------- 1 | @java.lang.Deprecated 2 | package gnu.io; 3 | -------------------------------------------------------------------------------- /gnu-io/src/test/java/gnu/io/LibraryLoaderTest.java: -------------------------------------------------------------------------------- 1 | package gnu.io; 2 | 3 | import java.util.regex.Matcher; 4 | import java.util.regex.Pattern; 5 | 6 | import org.junit.Assert; 7 | import org.junit.Test; 8 | 9 | public class LibraryLoaderTest { 10 | 11 | @Test 12 | public void test1() throws Exception { 13 | 14 | } 15 | 16 | @Test 17 | public void test2() throws Exception { 18 | Pattern pattern = Pattern.compile("^(.+)(\\.[^\\.]+)$"); 19 | Matcher matcher = pattern.matcher("hello.hello.world.txt"); 20 | Assert.assertTrue(matcher.matches()); 21 | Assert.assertEquals(".txt", matcher.group(2)); 22 | Assert.assertEquals("hello.hello.world", matcher.group(1)); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /gnu-io/src/test/resources/libs/librxtxSerial-2.2pre1.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openmuc/jrxtx/a785442a2925b3b55f91b9d53f744e8ab39a267b/gnu-io/src/test/resources/libs/librxtxSerial-2.2pre1.so -------------------------------------------------------------------------------- /gnu-io/src/test/resources/libs/librxtxSerial.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openmuc/jrxtx/a785442a2925b3b55f91b9d53f744e8ab39a267b/gnu-io/src/test/resources/libs/librxtxSerial.so -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openmuc/jrxtx/a785442a2925b3b55f91b9d53f744e8ab39a267b/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS="-Xmx64m" 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /jrxtx/build.gradle: -------------------------------------------------------------------------------- 1 | version = '1.0.1' 2 | group = 'org.openmuc' 3 | def libName = 'librxtxSerial' 4 | 5 | dependencies { 6 | compile project(':gnu-io') 7 | testCompile project(':gnu-io').sourceSets.main.output 8 | } 9 | 10 | jar { 11 | from project(':gnu-io').sourceSets.main.output 12 | 13 | manifest { 14 | attributes('Export-Package': 'org.openmuc.jrxtx, gnu.io') 15 | attributes('Bundle-Name': 'jRxTx') 16 | attributes('Bundle-SymbolicName': project.group+'.'+project.name) 17 | } 18 | } 19 | 20 | uploadArchives { 21 | repositories { 22 | mavenDeployer { 23 | repository(url: "https://plugins.gradle.org/m2/") 24 | pom.project { 25 | name "jRxTx" 26 | description "jRxTx is a library for Java serial communication." 27 | 28 | licenses { 29 | license { 30 | name "GNU Lesser General Public License 2.1 or later + linking exception" 31 | url "http://www.gnu.org/licenses/lgpl-2.1.html" 32 | distribution "repo" 33 | } 34 | } 35 | } 36 | } 37 | } 38 | } 39 | 40 | task copyNativeLibs(type: Copy) { 41 | def Set libs 42 | def libInclude = "**/${libName}" 43 | def resDir = project(':jrxtx').sourceSets.main.output.resourcesDir 44 | 45 | libs = fileTree(dir: "${project.rootDir}/native", includes: ["${libInclude}.so", "${libInclude}.dll", "${libInclude}.jnilib" ]).files 46 | from libs 47 | into resDir.absolutePath + '/libs' 48 | 49 | // The resulting Manifest was missing Bundle-NativeCode, so the native librarys could not be loaded in an osgi context 50 | // credits to b-dreissigacker 51 | def Set bundleNativeLibs = [] 52 | def String bundleNativeCode 53 | 54 | doLast { 55 | libs.each { 56 | if ( it.getName().endsWith('.dll') ) bundleNativeLibs.add('libs/'+it.getName()+';osname=Win32;processor=x86') 57 | if ( it.getName().endsWith('.so') ) bundleNativeLibs.add('libs/'+it.getName()+';osname=Linux;processor=x86-64') 58 | if ( it.getName().endsWith('.jnilib') ) bundleNativeLibs.add('libs/'+it.getName()+';osname=MacOSX;processor=x86-64') 59 | } 60 | 61 | bundleNativeCode = bundleNativeLibs.join(',') 62 | if(bundleNativeCode.length() > 0) { 63 | jar { 64 | manifest { 65 | attributes('Bundle-NativeCode': bundleNativeCode) 66 | } 67 | } 68 | } 69 | } 70 | } 71 | 72 | task(buildWithNative) { 73 | dependsOn(copyNativeLibs) 74 | dependsOn(jar) 75 | tasks.findByName("jar").mustRunAfter "copyNativeLibs" 76 | } 77 | 78 | tasks.withType(Test) { 79 | dependsOn copyNativeLibs 80 | mustRunAfter copyNativeLibs 81 | } 82 | 83 | task copyJavadoc(type: Sync, dependsOn: "javadoc") { 84 | from "${project(':jrxtx').docsDir.getAbsolutePath()}/javadoc/" 85 | into "${project.rootDir}/docs/javadoc/" 86 | } 87 | -------------------------------------------------------------------------------- /jrxtx/src/main/java/org/openmuc/jrxtx/DataBits.java: -------------------------------------------------------------------------------- 1 | package org.openmuc.jrxtx; 2 | 3 | import gnu.io.SerialPort; 4 | 5 | /** 6 | * The data bits. 7 | */ 8 | @SuppressWarnings("deprecation") 9 | public enum DataBits { 10 | /** 11 | * 5 data bits will be used for each character. 12 | */ 13 | DATABITS_5(SerialPort.DATABITS_5), 14 | /** 15 | * 6 data bits will be used for each character. 16 | */ 17 | DATABITS_6(SerialPort.DATABITS_6), 18 | /** 19 | * 8 data bits will be used for each character. 20 | */ 21 | DATABITS_7(SerialPort.DATABITS_7), 22 | /** 23 | * 8 data bits will be used for each character. 24 | */ 25 | DATABITS_8(SerialPort.DATABITS_8),; 26 | private int odlValue; 27 | 28 | private DataBits(int oldValue) { 29 | this.odlValue = oldValue; 30 | } 31 | 32 | int getOldValue() { 33 | return this.odlValue; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /jrxtx/src/main/java/org/openmuc/jrxtx/FlowControl.java: -------------------------------------------------------------------------------- 1 | package org.openmuc.jrxtx; 2 | 3 | /** 4 | * The flow control. 5 | * 6 | * @see SerialPort#setFlowControl(FlowControl) 7 | * @see SerialPortBuilder#setFlowControl(FlowControl) 8 | */ 9 | public enum FlowControl { 10 | /** 11 | * No flow control. 12 | */ 13 | NONE, 14 | 15 | /** 16 | * Hardware flow control on input and output (RTS/CTS). 17 | * 18 | *

19 | * Sets RFR (ready for receiving) formally known as RTS and the CTS (clear to send) flag. 20 | *

21 | */ 22 | RTS_CTS, 23 | 24 | /** 25 | * Software flow control on input and output. 26 | */ 27 | XON_XOFF 28 | 29 | } 30 | -------------------------------------------------------------------------------- /jrxtx/src/main/java/org/openmuc/jrxtx/Parity.java: -------------------------------------------------------------------------------- 1 | package org.openmuc.jrxtx; 2 | 3 | import gnu.io.SerialPort; 4 | 5 | /** 6 | * The parity. 7 | */ 8 | @SuppressWarnings("deprecation") 9 | public enum Parity { 10 | /** 11 | * No parity bit will be sent with each data character at all. 12 | */ 13 | NONE(SerialPort.PARITY_NONE), 14 | /** 15 | * An odd parity bit will be sent with each data character. I.e. will be set to 1 if the data character contains an 16 | * even number of bits set to 1. 17 | */ 18 | ODD(SerialPort.PARITY_ODD), 19 | /** 20 | * An even parity bit will be sent with each data character. I.e. will be set to 1 if the data character contains an 21 | * odd number of bits set to 1. 22 | */ 23 | EVEN(SerialPort.PARITY_EVEN), 24 | /** 25 | * A mark parity bit (i.e. always 1) will be sent with each data character. 26 | */ 27 | MARK(SerialPort.PARITY_MARK), 28 | /** 29 | * A space parity bit (i.e. always 0) will be sent with each data character 30 | */ 31 | SPACE(4),; 32 | private static final Parity[] VALUES = values(); 33 | private int odlValue; 34 | 35 | private Parity(int oldValue) { 36 | this.odlValue = oldValue; 37 | } 38 | 39 | int getOldValue() { 40 | return this.odlValue; 41 | } 42 | 43 | static Parity forValue(int parity) { 44 | for (Parity p : VALUES) { 45 | if (p.odlValue == parity) { 46 | return p; 47 | } 48 | } 49 | 50 | // should not occur 51 | throw new RuntimeException("Error."); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /jrxtx/src/main/java/org/openmuc/jrxtx/PortNotFoundException.java: -------------------------------------------------------------------------------- 1 | package org.openmuc.jrxtx; 2 | 3 | /** 4 | * Signals that the provided serial port name provided via {@link SerialPortBuilder#newBuilder(String)}, 5 | * {@link SerialPortBuilder#setPortName(String)} doesn't exist on the host system. 6 | */ 7 | public class PortNotFoundException extends SerialPortException { 8 | 9 | private static final long serialVersionUID = 2766015292714524756L; 10 | 11 | /** 12 | * Constructs a new PortNotFoundException with the specified detail message. 13 | * 14 | * @param message 15 | * the detail message. 16 | */ 17 | public PortNotFoundException(String message) { 18 | super(message); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /jrxtx/src/main/java/org/openmuc/jrxtx/SerialPort.java: -------------------------------------------------------------------------------- 1 | package org.openmuc.jrxtx; 2 | 3 | import java.io.Closeable; 4 | import java.io.IOException; 5 | import java.io.InputStream; 6 | import java.io.OutputStream; 7 | 8 | /** 9 | * Serial port for communication using UARTs. Can be used for communication protocols such as RS-232 and RS-485. 10 | *

11 | * A SerialPort is created using {@link SerialPortBuilder}. Once closed it cannot be opened again but has to be 12 | * recreated. 13 | */ 14 | public interface SerialPort extends Closeable { 15 | 16 | /** 17 | * Returns the input stream for this serial port. 18 | *

19 | * Closing the returned InputStream will close the associated serial port. 20 | * 21 | * @return the InputStream object that can be used to read from the port. 22 | * @throws IOException 23 | * if an I/O error occurred 24 | */ 25 | InputStream getInputStream() throws IOException; 26 | 27 | /** 28 | * Returns the output stream for this serial port. 29 | * 30 | * @return the OutputStream object that can be used to write to the port. 31 | * @throws IOException 32 | * if an I/O error occurred. 33 | */ 34 | OutputStream getOutputStream() throws IOException; 35 | 36 | /** 37 | * Closes the serial port. 38 | *

39 | * Also closes the associated input and output streams. 40 | * 41 | * @throws IOException 42 | * if an I/O error occurred. 43 | */ 44 | void close() throws IOException; 45 | 46 | /** 47 | * Returns whether the serial port is currently open and available for communication. 48 | * 49 | * @return true if the serial port is closed. 50 | */ 51 | boolean isClosed(); 52 | 53 | /** 54 | * Get the name of the serial port. 55 | * 56 | * @return the serial port name. 57 | */ 58 | String getPortName(); 59 | 60 | /** 61 | * Get the current data bits config. 62 | * 63 | * @return the dataBits the data bits. 64 | */ 65 | DataBits getDataBits(); 66 | 67 | /** 68 | * Set the data bits. 69 | * 70 | * @param dataBits 71 | * the new dataBits. 72 | * @throws IOException 73 | * if an I/O exception occurred when setting the new data bits.. 74 | */ 75 | void setDataBits(DataBits dataBits) throws IOException; 76 | 77 | /** 78 | * Get the parity. 79 | * 80 | * @return the new parity. 81 | */ 82 | Parity getParity(); 83 | 84 | /** 85 | * Set the new parity. 86 | * 87 | * @param parity 88 | * the new parity. 89 | * @throws IOException 90 | * if an I/O exception occurred when setting the new parity. 91 | */ 92 | void setParity(Parity parity) throws IOException; 93 | 94 | /** 95 | * Get the current stop bits settings. 96 | * 97 | * @return the stopBits the stop bits. 98 | */ 99 | StopBits getStopBits(); 100 | 101 | /** 102 | * Set the stop bits. 103 | * 104 | * @param stopBits 105 | * the stopBits to set 106 | * @throws IOException 107 | * if an I/O exception occurred when setting the new stop bits. 108 | */ 109 | void setStopBits(StopBits stopBits) throws IOException; 110 | 111 | /** 112 | * @return the baudRate setting. 113 | * 114 | * @see #setBaudRate(int) 115 | */ 116 | int getBaudRate(); 117 | 118 | /** 119 | * Sets the baud rate of the system. 120 | * 121 | * @param baudRate 122 | * the new baud rate. 123 | * @throws IOException 124 | * if an I/O exception occurred when setting the new baud rate. 125 | * 126 | * @see #getBaudRate() 127 | */ 128 | void setBaudRate(int baudRate) throws IOException; 129 | 130 | /** 131 | * Returns setting for serial port timeout. 0 returns implies that the option is disabled (i.e., 132 | * timeout of infinity). 133 | * 134 | * @return the serialPortTimeout. 135 | * 136 | * @see #setSerialPortTimeout(int) 137 | */ 138 | int getSerialPortTimeout(); 139 | 140 | /** 141 | * Enable/disable serial port timeout with the specified timeout, in milliseconds. With this option set to a 142 | * non-zero timeout, a read() call on the InputStream associated with this serial port will block for only this 143 | * amount of time. If the timeout expires, a org.openmuc.jrxtx.SerialPortTimeoutExcepption is raised, though the 144 | * serial port is still valid. The option must be enabled prior to entering the blocking operation to have effect. 145 | * The timeout must be > 0. A timeout of zero is interpreted as an infinite timeout. 146 | * 147 | * @param serialPortTimeout 148 | * the specified timeout, in milliseconds. 149 | * @throws IOException 150 | * if there is an error in the underlying protocol. 151 | * 152 | * @see #getSerialPortTimeout() 153 | */ 154 | void setSerialPortTimeout(int serialPortTimeout) throws IOException; 155 | 156 | /** 157 | * Set the flow control type. 158 | * 159 | * @param flowControl 160 | * the flow control. 161 | * @throws IOException 162 | * if an I/O exception occurred when setting the new baud rate. 163 | */ 164 | void setFlowControl(FlowControl flowControl) throws IOException; 165 | 166 | /** 167 | * Get the current flow control settings. 168 | * 169 | * @return the flow control. 170 | */ 171 | FlowControl getFlowControl(); 172 | } 173 | -------------------------------------------------------------------------------- /jrxtx/src/main/java/org/openmuc/jrxtx/SerialPortBuilder.java: -------------------------------------------------------------------------------- 1 | package org.openmuc.jrxtx; 2 | 3 | import java.io.IOException; 4 | import java.util.ArrayList; 5 | import java.util.Enumeration; 6 | import java.util.List; 7 | 8 | import gnu.io.CommPortIdentifier; 9 | 10 | /** 11 | * Builder class for SerialPorts. Provides a convenient way to set the various fields of a SerialPort. 12 | * 13 | * Example: 14 | * 15 | *

 16 |  * 
 17 |  * SerialPort port = newBuilder("/dev/ttyS0")
 18 |  *                   .setBaudRate(19200)
 19 |  *                   .setParity(Parity.EVEN)
 20 |  *                   .build();
 21 |  * InputStream is = port.getInputStream();
 22 |  * ..
 23 |  * 
 24 |  * 
25 | */ 26 | @SuppressWarnings("deprecation") 27 | public class SerialPortBuilder { 28 | 29 | private String portName; 30 | private int baudRate; 31 | private DataBits dataBits; 32 | private Parity parity; 33 | private StopBits stopBits; 34 | private FlowControl flowControl; 35 | 36 | /** 37 | * Get the serial port names on the host system. 38 | * 39 | * @return the serial ports names. 40 | */ 41 | public static String[] getSerialPortNames() { 42 | Enumeration identifiers = CommPortIdentifier.getPortIdentifiers(); 43 | List result = new ArrayList(20); 44 | 45 | while (identifiers.hasMoreElements()) { 46 | CommPortIdentifier identifier = identifiers.nextElement(); 47 | if (identifier.getPortType() != CommPortIdentifier.PORT_SERIAL) { 48 | continue; 49 | } 50 | 51 | result.add(identifier.getName()); 52 | } 53 | String[] res = new String[result.size()]; 54 | return result.toArray(res); 55 | } 56 | 57 | private SerialPortBuilder(String portName) { 58 | this.portName = portName; 59 | this.baudRate = 9600; 60 | this.dataBits = DataBits.DATABITS_8; 61 | this.parity = Parity.EVEN; 62 | this.stopBits = StopBits.STOPBITS_1; 63 | this.flowControl = FlowControl.NONE; 64 | } 65 | 66 | /** 67 | * Constructs a new SerialPortBuilder with the default values. 68 | * 69 | * @param portName 70 | * the serial port name. E.g. on Unix systems: "/dev/ttyUSB0" and on Unix 71 | * @return returns the new builder. 72 | */ 73 | public static SerialPortBuilder newBuilder(String portName) { 74 | return new SerialPortBuilder(portName); 75 | } 76 | 77 | /** 78 | * Set the serial port name. 79 | * 80 | * @param portName 81 | * the serial port name e.g. "/dev/ttyUSB0" 82 | * @return the serial port builder. 83 | */ 84 | public SerialPortBuilder setPortName(String portName) { 85 | this.portName = portName; 86 | return this; 87 | } 88 | 89 | /** 90 | * Set the baud rate for the serial port. Values such as 9600 or 115200. 91 | * 92 | * @param baudRate 93 | * the baud rate. 94 | * @return the serial port builder. 95 | * 96 | * @see SerialPortBuilder#setBaudRate(int) 97 | */ 98 | public SerialPortBuilder setBaudRate(int baudRate) { 99 | this.baudRate = baudRate; 100 | return this; 101 | } 102 | 103 | /** 104 | * Set the number of data bits transfered with the serial port. 105 | * 106 | * @param dataBits 107 | * the number of dataBits. 108 | * @return the serial port builder. 109 | * @see SerialPort#setDataBits(DataBits) 110 | */ 111 | public SerialPortBuilder setDataBits(DataBits dataBits) { 112 | this.dataBits = dataBits; 113 | return this; 114 | } 115 | 116 | /** 117 | * Set the parity of the serial port. 118 | * 119 | * @param parity 120 | * the parity. 121 | * @return the serial port builder. 122 | * @see SerialPort#setParity(Parity) 123 | */ 124 | public SerialPortBuilder setParity(Parity parity) { 125 | this.parity = parity; 126 | return this; 127 | } 128 | 129 | /** 130 | * Set the number of stop bits after each data bits. 131 | * 132 | * @param stopBits 133 | * the number of stop bits. 134 | * @return the serial port builder. 135 | * 136 | * @see SerialPort#setStopBits(StopBits) 137 | */ 138 | public SerialPortBuilder setStopBits(StopBits stopBits) { 139 | this.stopBits = stopBits; 140 | return this; 141 | } 142 | 143 | /** 144 | * Set the flow control type. 145 | * 146 | * @param flowControl 147 | * the flow control. 148 | * 149 | * @return the serial port builder. 150 | * 151 | * @see SerialPort#setFlowControl(FlowControl) 152 | */ 153 | public SerialPortBuilder setFlowControl(FlowControl flowControl) { 154 | this.flowControl = flowControl; 155 | return this; 156 | } 157 | 158 | /** 159 | * Combine all of the options that have been set and return a new SerialPort object. 160 | * 161 | * @return a new serial port object. 162 | * @throws IOException 163 | * if an I/O exception occurred while opening the serial port. 164 | */ 165 | public SerialPort build() throws IOException { 166 | return JRxTxPort.openSerialPort(portName, baudRate, parity, dataBits, stopBits, flowControl); 167 | } 168 | } 169 | -------------------------------------------------------------------------------- /jrxtx/src/main/java/org/openmuc/jrxtx/SerialPortException.java: -------------------------------------------------------------------------------- 1 | package org.openmuc.jrxtx; 2 | 3 | import java.io.IOException; 4 | 5 | /** 6 | * Signals that a I/O exception with the SerialPort occurred. 7 | * 8 | * @see SerialPort 9 | */ 10 | public class SerialPortException extends IOException { 11 | 12 | private static final long serialVersionUID = -4848841747671551647L; 13 | 14 | /** 15 | * Constructs a new SerialPortException with the specified detail message. 16 | * 17 | * @param message 18 | * the detail message. 19 | */ 20 | public SerialPortException(String message) { 21 | super(message); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /jrxtx/src/main/java/org/openmuc/jrxtx/SerialPortTimeoutException.java: -------------------------------------------------------------------------------- 1 | package org.openmuc.jrxtx; 2 | 3 | import java.io.InterruptedIOException; 4 | 5 | /** 6 | * Signals that the read function of the SerialPort input stream has timed out. 7 | */ 8 | public class SerialPortTimeoutException extends InterruptedIOException { 9 | 10 | private static final long serialVersionUID = -5808479011360793837L; 11 | 12 | public SerialPortTimeoutException() { 13 | super(); 14 | } 15 | 16 | /** 17 | * Constructs a new SerialPortTimeoutException with the specified detail message. 18 | * 19 | * @param message 20 | * the detail message. 21 | */ 22 | public SerialPortTimeoutException(String message) { 23 | super(message); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /jrxtx/src/main/java/org/openmuc/jrxtx/StopBits.java: -------------------------------------------------------------------------------- 1 | package org.openmuc.jrxtx; 2 | 3 | import gnu.io.SerialPort; 4 | 5 | /** 6 | * The stop bits. 7 | */ 8 | @SuppressWarnings("deprecation") 9 | public enum StopBits { 10 | /** 11 | * 1 stop bit will be sent at the end of every character. 12 | */ 13 | STOPBITS_1(SerialPort.STOPBITS_1), 14 | /** 15 | * 1.5 stop bits will be sent at the end of every character 16 | */ 17 | STOPBITS_1_5(SerialPort.STOPBITS_1_5), 18 | /** 19 | * 2 stop bits will be sent at the end of every character 20 | */ 21 | STOPBITS_2(SerialPort.STOPBITS_2); 22 | 23 | private int odlValue; 24 | 25 | private StopBits(int oldValue) { 26 | this.odlValue = oldValue; 27 | } 28 | 29 | int getOldValue() { 30 | return this.odlValue; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /jrxtx/src/main/java/org/openmuc/jrxtx/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Packaged coating functionality for RxTx communication via java. 3 | */ 4 | package org.openmuc.jrxtx; 5 | -------------------------------------------------------------------------------- /jrxtx/src/test/README.txt: -------------------------------------------------------------------------------- 1 | These integration tests use virtual serial ports under Linux. In order 2 | to run these integration tests the null modem emulator tty0tty has to 3 | be used to create two serial ports that are connected (one for the 4 | server and one for the client). 5 | 6 | Steps: 7 | 8 | - first change the group ownership of the /dev folder so that you as a 9 | regular user can create the serial ports. 10 | 11 | - run tty0tty to create the two connected virtual serial ports: 12 | tty0tty /dev/ttyS99 /dev/ttyS100 . 13 | 14 | - run the itest using "gradle itest" 15 | -------------------------------------------------------------------------------- /jrxtx/src/test/java/org/openmuc/jrxtx/TestMain.java: -------------------------------------------------------------------------------- 1 | package org.openmuc.jrxtx; 2 | 3 | import java.io.IOException; 4 | 5 | public class TestMain { 6 | 7 | public static void main(String[] args) throws IOException { 8 | String[] portNames = SerialPortBuilder.getSerialPortNames(); 9 | 10 | for (String portName : portNames) { 11 | System.out.println(portName); 12 | } 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /jrxtx/src/test/java/org/openmuc/jrxtx/itest/IntegrationTest.java: -------------------------------------------------------------------------------- 1 | package org.openmuc.jrxtx.itest; 2 | 3 | import java.io.IOException; 4 | import java.io.InputStream; 5 | import java.io.OutputStream; 6 | import java.util.concurrent.Callable; 7 | import java.util.concurrent.ExecutorService; 8 | import java.util.concurrent.Executors; 9 | import java.util.concurrent.Future; 10 | 11 | import org.junit.After; 12 | import org.junit.Assert; 13 | import org.junit.Before; 14 | import org.junit.Test; 15 | import org.openmuc.jrxtx.SerialPort; 16 | import org.openmuc.jrxtx.SerialPortBuilder; 17 | import org.openmuc.jrxtx.SerialPortException; 18 | import org.openmuc.jrxtx.SerialPortTimeoutException; 19 | 20 | public class IntegrationTest { 21 | 22 | private final static String PORT_1_NAME = "/dev/ttyS99"; 23 | private final static String PORT_2_NAME = "/dev/ttyS100"; 24 | 25 | private ExecutorService executor = Executors.newFixedThreadPool(1); 26 | 27 | SerialPort serialPort1 = null; 28 | SerialPort serialPort2 = null; 29 | 30 | InputStream is1, is2; 31 | OutputStream os1, os2; 32 | 33 | @Before 34 | public void setUp() throws IOException { 35 | serialPort1 = SerialPortBuilder.newBuilder(PORT_1_NAME).setBaudRate(2400).build(); 36 | serialPort2 = SerialPortBuilder.newBuilder(PORT_2_NAME).setBaudRate(2400).build(); 37 | 38 | is1 = serialPort1.getInputStream(); 39 | is2 = serialPort2.getInputStream(); 40 | 41 | os1 = serialPort1.getOutputStream(); 42 | os2 = serialPort2.getOutputStream(); 43 | } 44 | 45 | @After 46 | public void tearDown() { 47 | if (serialPort1 != null) { 48 | try { 49 | serialPort1.close(); 50 | } catch (IOException e) { 51 | } 52 | } 53 | if (serialPort2 != null) { 54 | try { 55 | serialPort2.close(); 56 | } catch (IOException e) { 57 | } 58 | } 59 | } 60 | 61 | @Test 62 | public void serialPortCloseTest() throws Exception { 63 | Future future = executor.submit(new Callable() { 64 | public Boolean call() throws IOException { 65 | try { 66 | is2.read(); 67 | } catch (SerialPortException e) { 68 | return true; 69 | } 70 | return false; 71 | } 72 | }); 73 | serialPort2.close(); 74 | Assert.assertEquals(true, future.get()); 75 | } 76 | 77 | @Test 78 | public void simpleWriteReadTest() throws Exception { 79 | 80 | os1.write(99); 81 | int port2received = is2.read(); 82 | Assert.assertEquals(99, port2received); 83 | 84 | } 85 | 86 | @Test 87 | public void timoutTest() throws Exception { 88 | 89 | serialPort2.setSerialPortTimeout(300); 90 | boolean timeoutExceptionThrown = false; 91 | try { 92 | is2.read(); 93 | } catch (SerialPortTimeoutException e) { 94 | timeoutExceptionThrown = true; 95 | } 96 | Assert.assertEquals(true, timeoutExceptionThrown); 97 | } 98 | 99 | @Test 100 | public void streamCloseTest() throws Exception { 101 | Assert.assertEquals(false, serialPort2.isClosed()); 102 | is2.close(); 103 | Assert.assertEquals(true, serialPort2.isClosed()); 104 | } 105 | 106 | } 107 | -------------------------------------------------------------------------------- /jrxtx/src/test/setup-virtual-serial-ports.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | 4 | # configure the directory /dev 5 | # in a way that the tool tty0tty 6 | # can add ttyS* devices without being superuser 7 | if [ ! -w /dev ] 8 | then 9 | sudo chown root:$USER /dev 10 | sudo chmod 775 /dev 11 | fi 12 | 13 | 14 | if [ ! -e /usr/bin/tty0tty ] 15 | then 16 | DIR_NAME=`dirname $0` 17 | cd ${DIR_NAME} 18 | WORKING_DIRECTORY=`pwd` 19 | sudo cp ${WORKING_DIRECTORY}/tty0tty/tty0tty /usr/bin/tty0tty 20 | fi 21 | 22 | killall tty0tty 23 | tty0tty /dev/ttyS99 /dev/ttyS100 & 24 | -------------------------------------------------------------------------------- /jrxtx/src/test/tty0tty/README.txt: -------------------------------------------------------------------------------- 1 | 2 | tty0tty - linux null modem emulator v1.2 3 | 4 | Copyright (c) : 2013 Luis Claudio Gambôa Lopes and Maximiliano Pin max.pin@bitroit.com 5 | 6 | This program is free software; you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 2, or (at your option) 9 | any later version. 10 | 11 | For more details, please have a look in the original tty0tty ZIP folder. 12 | 13 | - To run: 14 | ./tty0tty 15 | 16 | (/dev/pts/1) <=> (/dev/pts/2) 17 | 18 | - Or, with fix aliases, run: 19 | ./tty0tty /dev/ttyS99 /dev/ttyS100 20 | 21 | (/dev/ttyS99) <=> (/dev/ttyS100) 22 | 23 | the connection is (no handshaking!): 24 | 25 | TX -> RX 26 | RX <- TX 27 | 28 | 29 | Sources from https://github.com/freemed/tty0tty.git 30 | -------------------------------------------------------------------------------- /jrxtx/src/test/tty0tty/tty0tty: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openmuc/jrxtx/a785442a2925b3b55f91b9d53f744e8ab39a267b/jrxtx/src/test/tty0tty/tty0tty -------------------------------------------------------------------------------- /jrxtx/src/test/tty0tty/tty0tty-1.2.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openmuc/jrxtx/a785442a2925b3b55f91b9d53f744e8ab39a267b/jrxtx/src/test/tty0tty/tty0tty-1.2.zip -------------------------------------------------------------------------------- /jrxtxWrapper/build.gradle: -------------------------------------------------------------------------------- 1 | version = project(':jrxtx').version 2 | group = project(':jrxtx').group 3 | 4 | dependencies { 5 | compile project(':jrxtx') 6 | } 7 | 8 | jar { 9 | from project(':jrxtx').sourceSets.main.output 10 | manifest { 11 | attributes('Bundle-Name': 'jRxTxWrapper') 12 | attributes('Export-Package': 'org.openmuc.jrxtx') 13 | attributes('Bundle-SymbolicName': project.group+'.'+project.name) 14 | } 15 | } 16 | 17 | uploadArchives { 18 | repositories { 19 | mavenDeployer { 20 | repository(url: "https://plugins.gradle.org/m2/") 21 | pom.project { 22 | name "jRxTxWrapper" 23 | description "jRxTxWrapper is a library for Java serial communication." 24 | 25 | licenses { 26 | license { 27 | name "GNU Lesser General Public License 2.1 or later + linking exception" 28 | url "http://www.gnu.org/licenses/lgpl-2.1.html" 29 | distribution "repo" 30 | } 31 | } 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /native/.gitignore: -------------------------------------------------------------------------------- 1 | .libs/ 2 | .autotools 3 | .cproject 4 | Makefile 5 | 6 | aclocal.m4 7 | autom4te.cache/ 8 | compile 9 | config.h.in~ 10 | 11 | 12 | config.h 13 | config.log 14 | config.status 15 | librxtxSerial.la 16 | libtool 17 | stamp-h1 18 | stamp-h.in 19 | 20 | Makefile.in 21 | config.h.in 22 | configure 23 | ltmain.sh 24 | missing 25 | -------------------------------------------------------------------------------- /native/BUILD.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -euo pipefail 3 | 4 | ./autogen.sh 5 | 6 | ./configure 7 | 8 | make clean 9 | make 10 | -------------------------------------------------------------------------------- /native/BUILD_java8.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -euxo pipefail 3 | 4 | JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_*.jdk/Contents/Home ./BUILD.sh 5 | -------------------------------------------------------------------------------- /native/MACOSX_IDE/.cvsignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /native/MACOSX_IDE/XCode/.cvsignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | build 3 | Headers 4 | -------------------------------------------------------------------------------- /native/MACOSX_IDE/XCode/LibSerialUniversal.xcodeproj/.cvsignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.mode1 3 | *.pbxuser 4 | -------------------------------------------------------------------------------- /native/MACOSX_IDE/XCode/config.h: -------------------------------------------------------------------------------- 1 | /* Define if you have the header file. */ 2 | #define HAVE_FCNTL_H 1 3 | 4 | /* Define if you have the header file. */ 5 | #define HAVE_GRP_H 1 6 | 7 | /* Define if you have the header file. */ 8 | #define HAVE_PWD_H 1 9 | 10 | /* Define if you have the header file. */ 11 | #define HAVE_SIGNAL_H 1 12 | 13 | /* Define if you have the header file. */ 14 | #define HAVE_SYS_FCNTL_H 1 15 | 16 | /* Define if you have the header file. */ 17 | #define HAVE_SYS_FILE_H 1 18 | 19 | /* Define if you have the header file. */ 20 | #define HAVE_SYS_SIGNAL_H 1 21 | 22 | /* Define if you have the header file. */ 23 | #define HAVE_SYS_TIME_H 1 24 | 25 | /* Define if you have the header file. */ 26 | #define HAVE_TERMIOS_H 1 27 | 28 | /* Name of package */ 29 | #define PACKAGE "Serial" 30 | 31 | /* Version number of package */ 32 | #define VERSION "2.1-8" 33 | 34 | //#define DEBUG 35 | //#define DEBUG_VERBOSE -------------------------------------------------------------------------------- /native/Makefile.lcc: -------------------------------------------------------------------------------- 1 | # Copyright 2001 Valentin Pavlov 2 | # 3 | # 4 | # The library loads but java APIs still need some modifications 5 | # the native - too. 6 | # 7 | # A make file for compiling rxtx with lcc contributed by Valentin Pavlov 8 | # lcc may be downloaded from: http://www.cs.virginia.edu/~lcc-win32/ 9 | # 10 | # You will need a config.h file in the src directory. Other builds usually 11 | # generate them automatically. The following should work. 12 | #define HAVE_FCNTL_H 13 | #define HAVE_SIGNAL_H 14 | #undef HAVE_SYS_FCNTL_H 15 | #undef HAVE_SYS_FILE_H 16 | #undef HAVE_SYS_SIGNAL_H 17 | #undef HAVE_TERMIOS_H 18 | #undef HAVE_SYS_TIME_H 19 | # if you know how to create the above in a dos Makefile send in the changes. 20 | # 21 | # the following commands should then work fine on the command line. 22 | # 23 | # cd src 24 | # make -f ..\Makefile.lcc 25 | # 26 | # You will need to do some programming to get this working. rxtx has moved 27 | # to full event support and the win32 code has not been updated to reflect 28 | # the changes. There is no windows parallel port code at this time. 29 | # 30 | # Thur Jan 24 2001 put Comments in the Makefile. taj@www.linux.org.uk. 31 | # added javac/javah/jar build rule. 32 | 33 | CFLAGS=-I\JDK\INCLUDE -I\jdk\include\win32 -I. 34 | CC=lcc 35 | LINKER=lcclnk 36 | OBJS=init.obj SerialImp.obj termios.obj fuserImp.obj 37 | SRC=init.c SerialImp.c termios.c fuserImp.c 38 | LIBS= 39 | JAVA_HOME=D:\jdk 40 | 41 | lib: $(OBJS) 42 | lcclnk -dll $(OBJS) wsock32.lib -o rxtxSerial.dll 43 | 44 | init.obj: RXTXcomm.jar 45 | $(CC) $(CFLAGS) init.c 46 | 47 | SerialImp.obj: RXTXcomm.jar config.h 48 | $(CC) $(CFLAGS) SerialImp.c 49 | 50 | fuserImp.obj: RXTXcomm.jar config.h 51 | 52 | termios.obj: RXTXcomm.jar 53 | $(CC) $(CFLAGS) termios.c 54 | 55 | RXTXcomm.jar: 56 | javac -d . -O *.java 57 | jar -cf RXTXcomm.jar gnu 58 | javah -jni gnu.io.RXTXPort gnu.io.RXTXCommDriver 59 | 60 | config.h: 61 | echo please read how to create config.h in the Makefile 62 | 63 | install: 64 | copy rxtxSerial.dll $(JAVA_HOME)\jre\bin 65 | copy RXTXcomm.jar $(JAVA_HOME)\jre\lib\ext 66 | -------------------------------------------------------------------------------- /native/Makefile.msvc: -------------------------------------------------------------------------------- 1 | # ---- 2 | # The original author is Eugene Melekhov 3 | # Object Tools http://www.object-tools.com 4 | # Contributed to rxtx Wed Sep 8 2004 5 | # Reportedly builds rxtxSerial.dll but rxtxParallel.dll is untested. 6 | # Accepted as is by taj@www.linux.org.uk 7 | # --- 8 | # This is the first quick and dirty attempt to compile rxtx for Windows 9 | # using Microsoft Visual C compiler. I've done this mostly to debug rxtx 10 | # with Microsoft debugger 11 | # 12 | # This makefile was made for MSVC 6.0. I'm afraid that debug info command 13 | # line switches like /Z7 -debugtype:CV -pdb:NONE won't work with 14 | # MSVC 7.0 or above. 15 | # Last tested successfully with Visual C++ Express 2008 (without the 16 | # LINKFLAGS just mentioned). 17 | # 18 | # The serial port library seems to be working, except the hangup while 19 | # writing to unplugged serial port. BTW the mingw32 library behavior 20 | # is the same. 21 | # 22 | # Parallel port library compiles, but I have not used it 23 | # 24 | # To build rxtx library execute commands like the following 25 | # mkdir build 26 | # copy Makefile.msvc build\Makefile 27 | # cd build 28 | # nmake 29 | # 30 | # To build only serial/parallel library use 31 | # nmake serial 32 | # or 33 | # nmake parallel 34 | # 35 | # If you wish to make the version with debug info then do something 36 | # like this 37 | # nmake serial DEBUG_INFO=1 38 | # 39 | # 'nmake clean' will remove all object dll and other working files 40 | # 41 | # Please make sure that variable JAVA_HOME points to the place where 42 | # your Java SDK is located 43 | # 44 | 45 | JAVA_HOME = D:\Apps\Java\j2sdk1.4.2_17 46 | COMMINSTALL="$(JAVA_HOME)\jre\lib\ext" 47 | LIBINSTALL="$(JAVA_HOME)\jre\bin" 48 | JUNIT_JAR=D:\Apps\junit3.8.2\junit.jar 49 | 50 | JAVAC = $(JAVA_HOME)\bin\javac -source 1.5 -target 1.5 51 | JAR = $(JAVA_HOME)\bin\jar 52 | JAVAH = $(JAVA_HOME)\bin\javah 53 | JAVA = $(JAVA_HOME)\bin\java 54 | 55 | SRC=..\src 56 | CFLAGS= -nologo -I$(JAVA_HOME)\include -I$(JAVA_HOME)\include\win32 -I$(SRC) -I. -DWIN32 57 | LINK_FLAGS = -nologo -map -incremental:no 58 | 59 | !IFDEF DEBUG_INFO 60 | JAVAC = $(JAVAC) -g 61 | CFLAGS = -Z7 -Oi -Oy- $(CFLAGS) 62 | CFLAGS_DLL = $(CFLAGS_DLL) -GZ 63 | #LINK_FLAGS = $(LINK_FLAGS) -debug -debugtype:CV -pdb:NONE 64 | LINK_FLAGS = $(LINK_FLAGS) -debug 65 | DEBUG_INFO_FLAG = DEBUG_INFO^=1 66 | !ELSE 67 | CFLAGS = $(CFLAGS) -Ox 68 | !ENDIF 69 | 70 | OBJS=init.obj SerialImp.obj termios.obj fuserImp.obj 71 | PARALLEL_OBJS= ParallelImp.obj termios.obj init.obj 72 | 73 | 74 | all: serial parallel 75 | 76 | serial: RXTXcomm.jar rxtxSerial.dll 77 | 78 | parallel: RXTXcomm.jar rxtxParallel.dll 79 | 80 | init.obj: config.h 81 | $(CC) $(CFLAGS) /TP -c $(SRC)\init.cc 82 | 83 | fixup.obj: config.h 84 | $(CC) $(CFLAGS) -c $(SRC)\fixup.c 85 | 86 | fuserImp.obj: $(SRC)\fuserImp.c config.h gnu_io_CommPortIdentifier.h 87 | $(CC) $(CFLAGS) -c $(SRC)\fuserImp.c 88 | 89 | termios.obj: $(SRC)\termios.c $(SRC)\win32termios.h config.h 90 | $(CC) $(CFLAGS) -c $(SRC)\termios.c 91 | SerialImp.obj: $(SRC)\SerialImp.c $(SRC)\SerialImp.h $(SRC)\win32termios.h config.h gnu_io_RXTXPort.h 92 | $(CC) $(CFLAGS) -c $(SRC)\SerialImp.c 93 | 94 | ParallelImp.obj: $(SRC)\ParallelImp.c $(SRC)\ParallelImp.h $(SRC)\win32termios.h config.h gnu_io_LPRPort.h 95 | $(CC) $(CFLAGS) -c $(SRC)\ParallelImp.c 96 | 97 | rxtxSerial.dll: $(OBJS) 98 | link -dll -out:$@ $** $(LINK_FLAGS) 99 | 100 | rxtxParallel.dll: $(PARALLEL_OBJS) 101 | link -dll -out:$@ $** $(LINK_FLAGS) 102 | 103 | 104 | gnu_io_RXTXPort.h gnu_io_CommPortIdentifier.h gnu_io_LPRPort.h gnu_io_RXTXVersion.h: RXTXcomm.jar 105 | $(JAVAH) -jni gnu.io.RXTXPort gnu.io.CommPortIdentifier gnu.io.LPRPort gnu.io.RXTXVersion 106 | 107 | RXTXcomm.jar: 108 | $(JAVAC) -d . ..\src\main\java\gnu\io\*.java 109 | $(JAR) -cf RXTXcomm.jar gnu 110 | 111 | config.h: Makefile 112 | echo #define HAVE_FCNTL_H >> config.h 113 | echo #define HAVE_SIGNAL_H >> config.h 114 | echo #undef HAVE_SYS_FCNTL_H >> config.h 115 | echo #undef HAVE_SYS_FILE_H >> config.h 116 | echo #undef HAVE_SYS_SIGNAL_H >> config.h 117 | echo #undef HAVE_TERMIOS_H >> config.h 118 | echo #undef HAVE_SYS_TIME_H >> config.h 119 | 120 | testcp\stamp: RXTXcomm.jar test\java\gnu\io\rxtx\tests\*.java 121 | -mkdir testcp 122 | $(JAVAC) -classpath RXTXcomm.jar;$(JUNIT_JAR) -d testcp test\java\gnu\io\rxtx\tests\*.java 123 | echo > testcp\stamp 124 | 125 | tests: all testcp\stamp 126 | $(JAVA) -classpath RXTXcomm.jar;testcp;$(JUNIT_JAR) gnu.io.rxtx.tests.RXTXTestSuite 127 | 128 | clean: 129 | -rmdir /s /q gnu 130 | -rmdir /s /q testcp 131 | -del *.obj *.h RXTXcomm.jar rxtxSerial.* rxtxParallel.* 132 | 133 | install: all 134 | @REM xcopy /Y RXTXcomm.jar $(COMMINSTALL) 135 | @REM xcopy RXTXcomm.jar "e:\matlab~1\java\jarext\commapi\win32" 136 | @REM xcopy /Y rxtx*.dll $(LIBINSTALL) 137 | @REM xcopy $(TARGETLIBS) "e:\matlab~1\bin\win32" 138 | -------------------------------------------------------------------------------- /native/README.md: -------------------------------------------------------------------------------- 1 | USE BUILD.sh 2 | -------------------------------------------------------------------------------- /native/autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Run this to generate all the initial makefiles, etc. 3 | # Taken from the GNOME package http://www.gnome.org 4 | 5 | srcdir=. 6 | PKG_NAME="rxtx library" 7 | 8 | DIE=0 9 | 10 | (autoconf --version) < /dev/null > /dev/null 2>&1 || { 11 | echo 12 | echo "**Error**: You must have "\`autoconf\'" installed to compile rxtx." 13 | echo "Download the appropriate package for your distribution," 14 | echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" 15 | DIE=1 16 | } 17 | 18 | # avoid libtool on Mac OS X codename Darwin Dmitry 19 | 20 | LIBTOOLIZE=libtoolize 21 | if test `uname` != "Darwin"; then 22 | (libtoolize --version) < /dev/null > /dev/null 2>&1 || { 23 | echo 24 | echo "**Error**: You must have "\`libtool\'" installed to compile rxtx." 25 | echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2.tar.gz" 26 | echo "(or a newer version if it is available)" 27 | DIE=1 28 | } 29 | else 30 | LIBTOOLIZE=glibtoolize 31 | fi 32 | 33 | (automake --version) < /dev/null > /dev/null 2>&1 || { 34 | echo 35 | echo "**Error**: You must have "\`automake\'" installed to compile rxtx." 36 | echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz" 37 | echo "(or a newer version if it is available)" 38 | DIE=1 39 | NO_AUTOMAKE=yes 40 | } 41 | 42 | 43 | # if no automake, don't bother testing for aclocal 44 | test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || { 45 | echo 46 | echo "**Error**: Missing "\`aclocal\'". The version of "\`automake\' 47 | echo "installed doesn't appear recent enough." 48 | echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz" 49 | echo "(or a newer version if it is available)" 50 | DIE=1 51 | } 52 | 53 | if test "$DIE" -eq 1; then 54 | exit 1 55 | fi 56 | 57 | #if test -z "$*"; then 58 | # echo "**Warning**: I am going to run "\`configure\'" with no arguments." 59 | # echo "If you wish to pass any to it, please specify them on the" 60 | # echo \`$0\'" command line." 61 | # echo 62 | #fi 63 | 64 | for j in `find $srcdir -name configure.ac -print` 65 | do 66 | i=`dirname $j` 67 | if test -f $i/NO-AUTO-GEN; then 68 | echo skipping $i -- flagged as no auto-gen 69 | else 70 | macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < $j` 71 | echo processing $i 72 | ## debug 73 | test -n "$macrodirs" && echo \`aclocal\' will also look in \`$macrodirs\' 74 | (cd $i; \ 75 | aclocalinclude="$ACLOCAL_FLAGS"; \ 76 | for k in $macrodirs; do \ 77 | if test -d $k; then aclocalinclude="$aclocalinclude -I $k"; \ 78 | else echo "**Warning**: No such directory \`$k'. Ignored."; fi; \ 79 | done; \ 80 | $LIBTOOLIZE --copy --force; \ 81 | aclocal $aclocalinclude; \ 82 | autoheader; automake --add-missing --gnu; autoheader; autoconf) 83 | fi 84 | done 85 | 86 | #if test x$NOCONFIGURE = x; then 87 | #echo running $srcdir/configure --enable-maintainer-mode "$@" 88 | #$srcdir/configure --enable-maintainer-mode "$@" \ 89 | #&& echo Now type \`make\' to compile the $PKG_NAME 90 | #else 91 | #echo Skipping configure process. 92 | #fi 93 | -------------------------------------------------------------------------------- /native/buildtest: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | echo buildtest started `date` 3 | MOUNT=/usr/local 4 | export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/java/jdk1.3/bin:/usr/local/cross-tools/i386-mingw32/bin/:/usr/local/cross-tools/i386-mingw32/bin 5 | unset JAVA_HOME 6 | 7 | 8 | mount 10.0.2.1:/usr/src/linux-2.2.14 /usr/src/linux 9 | mount 10.0.2.1:/mnt/hda3/local /usr/local 10 | 11 | echo -n building gcc-win32 12 | export PATH=/usr/local/cross-tools/i386-mingw32/bin/:/bin:/usr/bin:/usr/java/jdk1.3/bin/: 13 | export WIN32INCLUDE=/home/jarvi/RXTX/tools/win32-include 14 | ../configure --target=i386-mingw32 --host=i386-redhat-linux > ../logs/configure-log-mingw32 2>&1 && make > ../logs/make-log-gcc-win32 2>&1 15 | echo " build result=$?" 16 | rm -rf ../build/* 17 | unset WIN32INCLUDE 18 | export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/java/jdk1.3/bin:/usr/local/cross-tools/i386-mingw32/bin/:/usr/local/cross-tools/i386-mingw32/bin 19 | 20 | umount /usr/local 21 | mount 10.0.2.1:/mnt/hda3/local/kaffe/usr/local/ /usr/local 22 | echo -n building kaffe 23 | export JAVA_HOME=/usr/local 24 | ../configure > ../logs/configure-log-kaffe 2>&1 && make > ../logs/make-log-kaffe 2>&1 25 | echo " build result=$?" 26 | rm -rf ../build/* 27 | unset JAVA_HOME 28 | 29 | umount /usr/local 30 | mount 10.0.2.1:/mnt/hda3/local /usr/local 31 | 32 | for i in \ 33 | j2sdk1.4.0 \ 34 | jdk117_v2 \ 35 | jdk118 \ 36 | jdk118_v1 \ 37 | jdk118_v3 \ 38 | jdk1.2 \ 39 | jdk1.2.2-006-sun \ 40 | jdk1.3 41 | do export JAVA_HOME=$MOUNT/$i 42 | echo -n building with $JAVA_HOME 43 | ../configure > ../logs/configure-log-$i 2>&1 && make > ../logs/make-log-$i 2>&1 44 | echo " build result=$?" 45 | rm -rf ../build/* 46 | unset JAVA_HOME 47 | done 48 | umount /usr/local 49 | umount /usr/src/linux 50 | echo buildtest finished `date` 51 | -------------------------------------------------------------------------------- /native/buildwin32: -------------------------------------------------------------------------------- 1 | rm -f config.cache config.h config.status 2 | export WIN32INCLUDE=/home/bob/win32-include 3 | export PATH=/usr/local/cross-tools/i386-mingw32/bin/:/bin:/usr/bin:/home/rxtx/jdk1.5.0/bin: 4 | ../configure --target=i386-mingw32 --host=i386-pc-linux --build=i386-mingw32 5 | make 6 | #export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/java/jdk1.3/bin:/usr/local/cross-tools/i386-mingw32/bin/:/usr/local/cross-tools/i386-mingw32/bin 7 | 8 | -------------------------------------------------------------------------------- /native/gen+conf.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ./autogen.sh 4 | 5 | ./configure 6 | -------------------------------------------------------------------------------- /native/mkinstalldirs: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # mkinstalldirs --- make directory hierarchy 3 | # Author: Noah Friedman 4 | # Created: 1993-05-16 5 | # Public domain 6 | 7 | # $Id: mkinstalldirs,v 1.1.1.1 1999-03-18 18:18:47 douglau Exp $ 8 | 9 | errstatus=0 10 | 11 | for file 12 | do 13 | set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` 14 | shift 15 | 16 | pathcomp= 17 | for d 18 | do 19 | pathcomp="$pathcomp$d" 20 | case "$pathcomp" in 21 | -* ) pathcomp=./$pathcomp ;; 22 | esac 23 | 24 | if test ! -d "$pathcomp"; then 25 | echo "mkdir $pathcomp" 1>&2 26 | 27 | mkdir "$pathcomp" || lasterr=$? 28 | 29 | if test ! -d "$pathcomp"; then 30 | errstatus=$lasterr 31 | fi 32 | fi 33 | 34 | pathcomp="$pathcomp/" 35 | done 36 | done 37 | 38 | exit $errstatus 39 | 40 | # mkinstalldirs ends here 41 | -------------------------------------------------------------------------------- /native/rxtx.spec: -------------------------------------------------------------------------------- 1 | Summary: RXTX 2 | Name: rxtx 3 | Version: 2.1 4 | Release: 7pre17 5 | License: LGPL 6 | Group: Development/Libraries 7 | Source: rxtx-%{PACKAGE_VERSION}-%{PACKAGE_RELEASE}.tar.gz 8 | URL: www.rxtx.org 9 | Buildroot: /var/tmp/rxtx-root 10 | 11 | %description 12 | rxtx is an full implementation of java commapi which aims to support RS232 13 | IEEE 1284, RS485, I2C and RawIO. This is a developers release. 14 | %prep 15 | %setup -q -n rxtx-%{version}-%{release} 16 | 17 | %build 18 | export THREADS_FLAG=native 19 | ./autogen.sh 20 | CFLAGS="$RPM_OPT_FLAGS" LDFLAGS=-s ./configure --prefix=/usr 21 | pwd 22 | make 23 | 24 | %install 25 | rm -rf $RPM_BUILD_ROOT 26 | mkdir -p $RPM_BUILD_ROOT$JAVA_HOME/jre/lib/ext $RPM_BUILD_ROOT$JAVA_HOME/jre/lib/i386 27 | make RXTX_PATH=$RPM_BUILD_ROOT$JAVA_HOME/jre/lib/i386/ JHOME=$RPM_BUILD_ROOT$JAVA_HOME/jre/lib/ext install 28 | echo "Driver=gnu.io.RXTXCommDriver" > $RPM_BUILD_ROOT$JAVA_HOME/jre/lib/ext/gnu.io.rxtx.properties 29 | 30 | find $RPM_BUILD_ROOT/usr -xtype f -print | \ 31 | sed "s@^$RPM_BUILD_ROOT@@g" > INSTALLED_FILES 32 | 33 | if [ "$(cat INSTALLED_FILES)X" = "X" ] ; then 34 | echo "No files!" 35 | exit -1 36 | fi 37 | 38 | %files -f INSTALLED_FILES 39 | %defattr(-,root,root) 40 | %doc AUTHORS ChangeLog README RMISecurityManager.html COPYING INSTALL PORTING TODO 41 | 42 | %clean 43 | rm -rf $RPM_BUILD_ROOT 44 | 45 | %changelog 46 | * Sun Mar 21 2004 Willem Riede 47 | - adjust spec file to support rpmbuild by ordinary user in Fedora context. 48 | -------------------------------------------------------------------------------- /native/src/.gitignore: -------------------------------------------------------------------------------- 1 | win32s.h 2 | fixup.cc 3 | new.c 4 | init.cc 5 | typedefs_md.h.diff 6 | Serial.def 7 | termios.c 8 | -------------------------------------------------------------------------------- /native/src/ParallelImp.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------- 2 | | RXTX License v 2.1 - LGPL v 2.1 + Linking Over Controlled Interface. 3 | | RXTX is a native interface to serial ports in java. 4 | | Copyright 1997-2007 by Trent Jarvi tjarvi@qbang.org and others who 5 | | actually wrote it. See individual source files for more information. 6 | | 7 | | A copy of the LGPL v 2.1 may be found at 8 | | http://www.gnu.org/licenses/lgpl.txt on March 4th 2007. A copy is 9 | | here for your convenience. 10 | | 11 | | This library is free software; you can redistribute it and/or 12 | | modify it under the terms of the GNU Lesser General Public 13 | | License as published by the Free Software Foundation; either 14 | | version 2.1 of the License, or (at your option) any later version. 15 | | 16 | | This library is distributed in the hope that it will be useful, 17 | | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | | Lesser General Public License for more details. 20 | | 21 | | An executable that contains no derivative of any portion of RXTX, but 22 | | is designed to work with RXTX by being dynamically linked with it, 23 | | is considered a "work that uses the Library" subject to the terms and 24 | | conditions of the GNU Lesser General Public License. 25 | | 26 | | The following has been added to the RXTX License to remove 27 | | any confusion about linking to RXTX. We want to allow in part what 28 | | section 5, paragraph 2 of the LGPL does not permit in the special 29 | | case of linking over a controlled interface. The intent is to add a 30 | | Java Specification Request or standards body defined interface in the 31 | | future as another exception but one is not currently available. 32 | | 33 | | http://www.fsf.org/licenses/gpl-faq.html#LinkingOverControlledInterface 34 | | 35 | | As a special exception, the copyright holders of RXTX give you 36 | | permission to link RXTX with independent modules that communicate with 37 | | RXTX solely through the Sun Microsytems CommAPI interface version 2, 38 | | regardless of the license terms of these independent modules, and to copy 39 | | and distribute the resulting combined work under terms of your choice, 40 | | provided that every copy of the combined work is accompanied by a complete 41 | | copy of the source code of RXTX (the version of RXTX used to produce the 42 | | combined work), being distributed under the terms of the GNU Lesser General 43 | | Public License plus this exception. An independent module is a 44 | | module which is not derived from or based on RXTX. 45 | | 46 | | Note that people who make modified versions of RXTX are not obligated 47 | | to grant this special exception for their modified versions; it is 48 | | their choice whether to do so. The GNU Lesser General Public License 49 | | gives permission to release a modified version without this exception; this 50 | | exception also makes it possible to release a modified version which 51 | | carries forward this exception. 52 | | 53 | | You should have received a copy of the GNU Lesser General Public 54 | | License along with this library; if not, write to the Free 55 | | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 56 | | All trademarks belong to their respective owners. 57 | --------------------------------------------------------------------------*/ 58 | /* gnu.io.ParallelPort constants */ 59 | /* this appears to be handled in /usr/src/linux/misc/parport_pc.c */ 60 | #define LPT_MODE_ANY 0 61 | #define LPT_MODE_SPP 1 62 | #define LPT_MODE_PS2 2 63 | #define LPT_MODE_EPP 3 64 | #define LPT_MODE_ECP 4 65 | #define LPT_MODE_NIBBLE 5 66 | 67 | /* some popular releases of Slackware do not have SSIZE_MAX */ 68 | 69 | #ifndef SSIZE_MAX 70 | # if defined(INT_MAX) 71 | # define SSIZE_MAX INT_MAX 72 | # elif defined(MAXINT) 73 | # define SSIZE_MAX MAXINT 74 | # else 75 | # define SSIZE_MAX 2147483647 /* ugh */ 76 | # endif 77 | #endif 78 | 79 | /* gnu.io.ParallelPortEvent constants */ 80 | #define PAR_EV_ERROR 1 81 | #define PAR_EV_BUFFER 2 82 | 83 | /* java exception class names */ 84 | #define UNSUPPORTED_COMM_OPERATION "gnu/io/UnsupportedCommOperationException" 85 | #define ARRAY_INDEX_OUT_OF_BOUNDS "java/lang/ArrayIndexOutOfBoundsException" 86 | #define OUT_OF_MEMORY "java/lang/OutOfMemoryError" 87 | #define IO_EXCEPTION "java/io/IOException" 88 | #define PORT_IN_USE_EXCEPTION "gnu/io/PortInUseException" 89 | 90 | /* 91 | Flow Control defines inspired by reading how mgetty by Gert Doering does it 92 | */ 93 | 94 | /* PROTOTYPES */ 95 | jboolean is_interrupted(JNIEnv *, jobject); 96 | int send_event(JNIEnv *, jobject, jint, int); 97 | int read_byte_array(int fd, unsigned char *buffer, int length, int threshold, 98 | int timeout); 99 | int get_java_var(JNIEnv *, jobject, char *, char *); 100 | void report(char *); 101 | void report_error(char *); 102 | void throw_java_exception(JNIEnv *, char *, char *, char *); 103 | void throw_java_exception_system_msg(JNIEnv *, char *, char *); 104 | 105 | -------------------------------------------------------------------------------- /native/src/WinCE/README: -------------------------------------------------------------------------------- 1 | Hi. 2 | Enclosed you'll find a version of rxtx for Windows CE. 3 | It was compiled using Microsoft's eMbedded Visual C++ 3.0 (which is free). 4 | It was tested on Compaq iPAQ 3650 (ARM). 5 | 6 | Native code is completely rewritten, since CE doesn't have overlapped IO 7 | (and MANY other things), but does non-overlapped better than regular Win32 8 | - simultanous multiple operations on the same handle are OK. 9 | I tried compiling this project under NT (with Visual C++ 6.0) and it 10 | compiles without problems but it doesn't work right because NT doesn't 11 | support simultanous operations without overlapping. 12 | Yes, that means that there's no compatibility between Win32 and Win32CE - 13 | neither direction. I love Microsoft. 14 | 15 | Aha, I used unicode everywhere, since both CE and Java use it internally 16 | (CE doesn't have ANSI at all) and I didn't find converting data back and 17 | forth sensible. 18 | 19 | Windows CE doesn't have stdio and console at all so I had to make printj() 20 | function. Look at it - it can be quite usable for other projects. Basically 21 | it works like printf() but uses System.out.print() for output. 22 | 23 | You can find more info on Java serial support on 24 | http://www.mhobot.w.pl/java/comm 25 | 26 | Michal Hobot 27 | MichalHobot@netscape.net 28 | 29 | Krakow, 30 | Poland 31 | -------------------------------------------------------------------------------- /native/src/WinCE/StdAfx.cpp: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------- 2 | | RXTX License v 2.1 - LGPL v 2.1 + Linking Over Controlled Interface. 3 | | RXTX is a native interface to serial ports in java. 4 | | Copyright 2002-2004 Michal Hobot MichalHobot@netscape.net 5 | | Copyright 1997-2007 by Trent Jarvi tjarvi@qbang.org and others who 6 | | actually wrote it. See individual source files for more information. 7 | | 8 | | A copy of the LGPL v 2.1 may be found at 9 | | http://www.gnu.org/licenses/lgpl.txt on March 4th 2007. A copy is 10 | | here for your convenience. 11 | | 12 | | This library is free software; you can redistribute it and/or 13 | | modify it under the terms of the GNU Lesser General Public 14 | | License as published by the Free Software Foundation; either 15 | | version 2.1 of the License, or (at your option) any later version. 16 | | 17 | | This library is distributed in the hope that it will be useful, 18 | | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | | Lesser General Public License for more details. 21 | | 22 | | An executable that contains no derivative of any portion of RXTX, but 23 | | is designed to work with RXTX by being dynamically linked with it, 24 | | is considered a "work that uses the Library" subject to the terms and 25 | | conditions of the GNU Lesser General Public License. 26 | | 27 | | The following has been added to the RXTX License to remove 28 | | any confusion about linking to RXTX. We want to allow in part what 29 | | section 5, paragraph 2 of the LGPL does not permit in the special 30 | | case of linking over a controlled interface. The intent is to add a 31 | | Java Specification Request or standards body defined interface in the 32 | | future as another exception but one is not currently available. 33 | | 34 | | http://www.fsf.org/licenses/gpl-faq.html#LinkingOverControlledInterface 35 | | 36 | | As a special exception, the copyright holders of RXTX give you 37 | | permission to link RXTX with independent modules that communicate with 38 | | RXTX solely through the Sun Microsytems CommAPI interface version 2, 39 | | regardless of the license terms of these independent modules, and to copy 40 | | and distribute the resulting combined work under terms of your choice, 41 | | provided that every copy of the combined work is accompanied by a complete 42 | | copy of the source code of RXTX (the version of RXTX used to produce the 43 | | combined work), being distributed under the terms of the GNU Lesser General 44 | | Public License plus this exception. An independent module is a 45 | | module which is not derived from or based on RXTX. 46 | | 47 | | Note that people who make modified versions of RXTX are not obligated 48 | | to grant this special exception for their modified versions; it is 49 | | their choice whether to do so. The GNU Lesser General Public License 50 | | gives permission to release a modified version without this exception; this 51 | | exception also makes it possible to release a modified version which 52 | | carries forward this exception. 53 | | 54 | | You should have received a copy of the GNU Lesser General Public 55 | | License along with this library; if not, write to the Free 56 | | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 57 | | All trademarks belong to their respective owners. 58 | --------------------------------------------------------------------------*/ 59 | // stdafx.cpp : source file that includes just the standard includes 60 | // rxtxSerial.pch will be the pre-compiled header 61 | // stdafx.obj will contain the pre-compiled type information 62 | #include "stdafx.h" 63 | 64 | // TODO: reference any additional headers you need in STDAFX.H 65 | // and not in this file 66 | -------------------------------------------------------------------------------- /native/src/WinCE/StdAfx.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------- 2 | | RXTX License v 2.1 - LGPL v 2.1 + Linking Over Controlled Interface. 3 | | RXTX is a native interface to serial ports in java. 4 | | Copyright 2002-2004 Michal Hobot MichalHobot@netscape.net 5 | | actually wrote it. See individual source files for more information. 6 | | 7 | | A copy of the LGPL v 2.1 may be found at 8 | | http://www.gnu.org/licenses/lgpl.txt on March 4th 2007. A copy is 9 | | here for your convenience. 10 | | 11 | | This library is free software; you can redistribute it and/or 12 | | modify it under the terms of the GNU Lesser General Public 13 | | License as published by the Free Software Foundation; either 14 | | version 2.1 of the License, or (at your option) any later version. 15 | | 16 | | This library is distributed in the hope that it will be useful, 17 | | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | | Lesser General Public License for more details. 20 | | 21 | | An executable that contains no derivative of any portion of RXTX, but 22 | | is designed to work with RXTX by being dynamically linked with it, 23 | | is considered a "work that uses the Library" subject to the terms and 24 | | conditions of the GNU Lesser General Public License. 25 | | 26 | | The following has been added to the RXTX License to remove 27 | | any confusion about linking to RXTX. We want to allow in part what 28 | | section 5, paragraph 2 of the LGPL does not permit in the special 29 | | case of linking over a controlled interface. The intent is to add a 30 | | Java Specification Request or standards body defined interface in the 31 | | future as another exception but one is not currently available. 32 | | 33 | | http://www.fsf.org/licenses/gpl-faq.html#LinkingOverControlledInterface 34 | | 35 | | As a special exception, the copyright holders of RXTX give you 36 | | permission to link RXTX with independent modules that communicate with 37 | | RXTX solely through the Sun Microsytems CommAPI interface version 2, 38 | | regardless of the license terms of these independent modules, and to copy 39 | | and distribute the resulting combined work under terms of your choice, 40 | | provided that every copy of the combined work is accompanied by a complete 41 | | copy of the source code of RXTX (the version of RXTX used to produce the 42 | | combined work), being distributed under the terms of the GNU Lesser General 43 | | Public License plus this exception. An independent module is a 44 | | module which is not derived from or based on RXTX. 45 | | 46 | | Note that people who make modified versions of RXTX are not obligated 47 | | to grant this special exception for their modified versions; it is 48 | | their choice whether to do so. The GNU Lesser General Public License 49 | | gives permission to release a modified version without this exception; this 50 | | exception also makes it possible to release a modified version which 51 | | carries forward this exception. 52 | | 53 | | You should have received a copy of the GNU Lesser General Public 54 | | License along with this library; if not, write to the Free 55 | | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 56 | | All trademarks belong to their respective owners. 57 | --------------------------------------------------------------------------*/ 58 | 59 | // stdafx.h : include file for standard system include files, 60 | // or project specific include files that are used frequently, but 61 | // are changed infrequently 62 | // 63 | #if !defined(AFX_STDAFX_H__B78985E1_0CAF_4EE2_8807_4D04C75EAFCE__INCLUDED_) 64 | #define AFX_STDAFX_H__B78985E1_0CAF_4EE2_8807_4D04C75EAFCE__INCLUDED_ 65 | 66 | #if _MSC_VER > 1000 67 | #pragma once 68 | #endif // _MSC_VER > 1000 69 | 70 | #include 71 | #include "gnu_io_RXTXPort.h" 72 | #include "gnu_io_RXTXCommDriver.h" 73 | 74 | // Insert your headers here 75 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 76 | 77 | #include 78 | #include 79 | // TODO: reference additional headers your program requires here 80 | 81 | //{{AFX_INSERT_LOCATION}} 82 | // Microsoft eMbedded Visual C++ will insert additional declarations immediately before the previous line. 83 | 84 | #endif // !defined(AFX_STDAFX_H__B78985E1_0CAF_4EE2_8807_4D04C75EAFCE__INCLUDED_) 85 | -------------------------------------------------------------------------------- /native/src/WinCE/gnu_io_RXTXCommDriver.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class gnu_io_RXTXCommDriver */ 4 | 5 | #ifndef _Included_gnu_io_RXTXCommDriver 6 | #define _Included_gnu_io_RXTXCommDriver 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | #undef gnu_io_RXTXCommDriver_debug 11 | #define gnu_io_RXTXCommDriver_debug 0L 12 | /* 13 | * Class: gnu_io_RXTXCommDriver 14 | * Method: nativeGetVersion 15 | * Signature: ()Ljava/lang/String; 16 | */ 17 | JNIEXPORT jstring JNICALL Java_gnu_io_RXTXCommDriver_nativeGetVersion(JNIEnv *, 18 | jclass); 19 | 20 | /* 21 | * Class: gnu_io_RXTXCommDriver 22 | * Method: registerKnownPorts 23 | * Signature: (I)Z 24 | */ 25 | JNIEXPORT jboolean JNICALL Java_gnu_io_RXTXCommDriver_registerKnownPorts( 26 | JNIEnv *, jobject, jint); 27 | 28 | /* 29 | * Class: gnu_io_RXTXCommDriver 30 | * Method: isPortPrefixValid 31 | * Signature: (Ljava/lang/String;)Z 32 | */ 33 | JNIEXPORT jboolean JNICALL Java_gnu_io_RXTXCommDriver_isPortPrefixValid( 34 | JNIEnv *, jobject, jstring); 35 | 36 | /* 37 | * Class: gnu_io_RXTXCommDriver 38 | * Method: testRead 39 | * Signature: (Ljava/lang/String;I)Z 40 | */ 41 | JNIEXPORT jboolean JNICALL Java_gnu_io_RXTXCommDriver_testRead(JNIEnv *, 42 | jobject, jstring, jint); 43 | 44 | /* 45 | * Class: gnu_io_RXTXCommDriver 46 | * Method: getDeviceDirectory 47 | * Signature: ()Ljava/lang/String; 48 | */ 49 | JNIEXPORT jstring JNICALL Java_gnu_io_RXTXCommDriver_getDeviceDirectory( 50 | JNIEnv *, jobject); 51 | 52 | #ifdef __cplusplus 53 | } 54 | #endif 55 | #endif 56 | -------------------------------------------------------------------------------- /native/src/WinCE/rxtxSerial.cpp: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------- 2 | | RXTX License v 2.1 - LGPL v 2.1 + Linking Over Controlled Interface. 3 | | RXTX is a native interface to serial ports in java. 4 | | Copyright 2002-2004 Michal Hobot MichalHobot@netscape.net 5 | | Copyright 1997-2007 by Trent Jarvi tjarvi@qbang.org and others who 6 | | actually wrote it. See individual source files for more information. 7 | | 8 | | A copy of the LGPL v 2.1 may be found at 9 | | http://www.gnu.org/licenses/lgpl.txt on March 4th 2007. A copy is 10 | | here for your convenience. 11 | | 12 | | This library is free software; you can redistribute it and/or 13 | | modify it under the terms of the GNU Lesser General Public 14 | | License as published by the Free Software Foundation; either 15 | | version 2.1 of the License, or (at your option) any later version. 16 | | 17 | | This library is distributed in the hope that it will be useful, 18 | | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | | Lesser General Public License for more details. 21 | | 22 | | An executable that contains no derivative of any portion of RXTX, but 23 | | is designed to work with RXTX by being dynamically linked with it, 24 | | is considered a "work that uses the Library" subject to the terms and 25 | | conditions of the GNU Lesser General Public License. 26 | | 27 | | The following has been added to the RXTX License to remove 28 | | any confusion about linking to RXTX. We want to allow in part what 29 | | section 5, paragraph 2 of the LGPL does not permit in the special 30 | | case of linking over a controlled interface. The intent is to add a 31 | | Java Specification Request or standards body defined interface in the 32 | | future as another exception but one is not currently available. 33 | | 34 | | http://www.fsf.org/licenses/gpl-faq.html#LinkingOverControlledInterface 35 | | 36 | | As a special exception, the copyright holders of RXTX give you 37 | | permission to link RXTX with independent modules that communicate with 38 | | RXTX solely through the Sun Microsytems CommAPI interface version 2, 39 | | regardless of the license terms of these independent modules, and to copy 40 | | and distribute the resulting combined work under terms of your choice, 41 | | provided that every copy of the combined work is accompanied by a complete 42 | | copy of the source code of RXTX (the version of RXTX used to produce the 43 | | combined work), being distributed under the terms of the GNU Lesser General 44 | | Public License plus this exception. An independent module is a 45 | | module which is not derived from or based on RXTX. 46 | | 47 | | Note that people who make modified versions of RXTX are not obligated 48 | | to grant this special exception for their modified versions; it is 49 | | their choice whether to do so. The GNU Lesser General Public License 50 | | gives permission to release a modified version without this exception; this 51 | | exception also makes it possible to release a modified version which 52 | | carries forward this exception. 53 | | 54 | | You should have received a copy of the GNU Lesser General Public 55 | | License along with this library; if not, write to the Free 56 | | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 57 | | All trademarks belong to their respective owners. 58 | --------------------------------------------------------------------------*/ 59 | // rxtxSerial.cpp : Defines the entry point for the DLL application. 60 | // 61 | #include "StdAfx.h" 62 | 63 | BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, 64 | LPVOID lpReserved) { 65 | switch (ul_reason_for_call) { 66 | case DLL_PROCESS_ATTACH: 67 | case DLL_THREAD_ATTACH: 68 | case DLL_THREAD_DETACH: 69 | case DLL_PROCESS_DETACH: 70 | break; 71 | } 72 | return TRUE; 73 | } 74 | 75 | -------------------------------------------------------------------------------- /native/src/fixup.c: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------- 2 | | RXTX License v 2.1 - LGPL v 2.1 + Linking Over Controlled Interface. 3 | | RXTX is a native interface to serial ports in java. 4 | | Copyright 1997-2007 by Trent Jarvi tjarvi@qbang.org and others who 5 | | actually wrote it. See individual source files for more information. 6 | | 7 | | A copy of the LGPL v 2.1 may be found at 8 | | http://www.gnu.org/licenses/lgpl.txt on March 4th 2007. A copy is 9 | | here for your convenience. 10 | | 11 | | This library is free software; you can redistribute it and/or 12 | | modify it under the terms of the GNU Lesser General Public 13 | | License as published by the Free Software Foundation; either 14 | | version 2.1 of the License, or (at your option) any later version. 15 | | 16 | | This library is distributed in the hope that it will be useful, 17 | | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | | Lesser General Public License for more details. 20 | | 21 | | An executable that contains no derivative of any portion of RXTX, but 22 | | is designed to work with RXTX by being dynamically linked with it, 23 | | is considered a "work that uses the Library" subject to the terms and 24 | | conditions of the GNU Lesser General Public License. 25 | | 26 | | The following has been added to the RXTX License to remove 27 | | any confusion about linking to RXTX. We want to allow in part what 28 | | section 5, paragraph 2 of the LGPL does not permit in the special 29 | | case of linking over a controlled interface. The intent is to add a 30 | | Java Specification Request or standards body defined interface in the 31 | | future as another exception but one is not currently available. 32 | | 33 | | http://www.fsf.org/licenses/gpl-faq.html#LinkingOverControlledInterface 34 | | 35 | | As a special exception, the copyright holders of RXTX give you 36 | | permission to link RXTX with independent modules that communicate with 37 | | RXTX solely through the Sun Microsytems CommAPI interface version 2, 38 | | regardless of the license terms of these independent modules, and to copy 39 | | and distribute the resulting combined work under terms of your choice, 40 | | provided that every copy of the combined work is accompanied by a complete 41 | | copy of the source code of RXTX (the version of RXTX used to produce the 42 | | combined work), being distributed under the terms of the GNU Lesser General 43 | | Public License plus this exception. An independent module is a 44 | | module which is not derived from or based on RXTX. 45 | | 46 | | Note that people who make modified versions of RXTX are not obligated 47 | | to grant this special exception for their modified versions; it is 48 | | their choice whether to do so. The GNU Lesser General Public License 49 | | gives permission to release a modified version without this exception; this 50 | | exception also makes it possible to release a modified version which 51 | | carries forward this exception. 52 | | 53 | | You should have received a copy of the GNU Lesser General Public 54 | | License along with this library; if not, write to the Free 55 | | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 56 | | All trademarks belong to their respective owners. 57 | --------------------------------------------------------------------------*/ 58 | asm(".section .idata$3\n" ".long 0,0,0,0, 0,0,0,0"); 59 | -------------------------------------------------------------------------------- /native/src/include/gnu_io_CommPortIdentifier.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class gnu_io_CommPortIdentifier */ 4 | 5 | #ifndef _Included_gnu_io_CommPortIdentifier 6 | #define _Included_gnu_io_CommPortIdentifier 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | #undef gnu_io_CommPortIdentifier_debug 11 | #define gnu_io_CommPortIdentifier_debug 0L 12 | #undef gnu_io_CommPortIdentifier_PORT_SERIAL 13 | #define gnu_io_CommPortIdentifier_PORT_SERIAL 1L 14 | #undef gnu_io_CommPortIdentifier_PORT_PARALLEL 15 | #define gnu_io_CommPortIdentifier_PORT_PARALLEL 2L 16 | #undef gnu_io_CommPortIdentifier_PORT_I2C 17 | #define gnu_io_CommPortIdentifier_PORT_I2C 3L 18 | #undef gnu_io_CommPortIdentifier_PORT_RS485 19 | #define gnu_io_CommPortIdentifier_PORT_RS485 4L 20 | #undef gnu_io_CommPortIdentifier_PORT_RAW 21 | #define gnu_io_CommPortIdentifier_PORT_RAW 5L 22 | /* 23 | * Class: gnu_io_CommPortIdentifier 24 | * Method: native_psmisc_report_owner 25 | * Signature: (Ljava/lang/String;)Ljava/lang/String; 26 | */ 27 | JNIEXPORT jstring JNICALL Java_gnu_io_CommPortIdentifier_native_1psmisc_1report_1owner( 28 | JNIEnv *, jobject, jstring); 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | #endif 34 | -------------------------------------------------------------------------------- /native/src/include/gnu_io_I2C_I2CInputStream.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class gnu_io_I2C_I2CInputStream */ 4 | 5 | #ifndef _Included_gnu_io_I2C_I2CInputStream 6 | #define _Included_gnu_io_I2C_I2CInputStream 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | #undef gnu_io_I2C_I2CInputStream_MAX_SKIP_BUFFER_SIZE 11 | #define gnu_io_I2C_I2CInputStream_MAX_SKIP_BUFFER_SIZE 2048L 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | #endif 16 | -------------------------------------------------------------------------------- /native/src/include/gnu_io_I2C_I2COutputStream.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class gnu_io_I2C_I2COutputStream */ 4 | 5 | #ifndef _Included_gnu_io_I2C_I2COutputStream 6 | #define _Included_gnu_io_I2C_I2COutputStream 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | #ifdef __cplusplus 11 | } 12 | #endif 13 | #endif 14 | -------------------------------------------------------------------------------- /native/src/include/gnu_io_I2C_MonitorThread.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class gnu_io_I2C_MonitorThread */ 4 | 5 | #ifndef _Included_gnu_io_I2C_MonitorThread 6 | #define _Included_gnu_io_I2C_MonitorThread 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | #undef gnu_io_I2C_MonitorThread_MIN_PRIORITY 11 | #define gnu_io_I2C_MonitorThread_MIN_PRIORITY 1L 12 | #undef gnu_io_I2C_MonitorThread_NORM_PRIORITY 13 | #define gnu_io_I2C_MonitorThread_NORM_PRIORITY 5L 14 | #undef gnu_io_I2C_MonitorThread_MAX_PRIORITY 15 | #define gnu_io_I2C_MonitorThread_MAX_PRIORITY 10L 16 | #ifdef __cplusplus 17 | } 18 | #endif 19 | #endif 20 | -------------------------------------------------------------------------------- /native/src/include/gnu_io_LPRPort.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class gnu_io_LPRPort */ 4 | 5 | #ifndef _Included_gnu_io_LPRPort 6 | #define _Included_gnu_io_LPRPort 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | #undef gnu_io_LPRPort_debug 11 | #define gnu_io_LPRPort_debug 0L 12 | #undef gnu_io_LPRPort_LPT_MODE_ANY 13 | #define gnu_io_LPRPort_LPT_MODE_ANY 0L 14 | #undef gnu_io_LPRPort_LPT_MODE_SPP 15 | #define gnu_io_LPRPort_LPT_MODE_SPP 1L 16 | #undef gnu_io_LPRPort_LPT_MODE_PS2 17 | #define gnu_io_LPRPort_LPT_MODE_PS2 2L 18 | #undef gnu_io_LPRPort_LPT_MODE_EPP 19 | #define gnu_io_LPRPort_LPT_MODE_EPP 3L 20 | #undef gnu_io_LPRPort_LPT_MODE_ECP 21 | #define gnu_io_LPRPort_LPT_MODE_ECP 4L 22 | #undef gnu_io_LPRPort_LPT_MODE_NIBBLE 23 | #define gnu_io_LPRPort_LPT_MODE_NIBBLE 5L 24 | #undef gnu_io_LPRPort_debug 25 | #define gnu_io_LPRPort_debug 0L 26 | /* 27 | * Class: gnu_io_LPRPort 28 | * Method: Initialize 29 | * Signature: ()V 30 | */ 31 | JNIEXPORT void JNICALL Java_gnu_io_LPRPort_Initialize 32 | (JNIEnv *, jclass); 33 | 34 | /* 35 | * Class: gnu_io_LPRPort 36 | * Method: open 37 | * Signature: (Ljava/lang/String;)I 38 | */ 39 | JNIEXPORT jint JNICALL Java_gnu_io_LPRPort_open(JNIEnv *, jobject, jstring); 40 | 41 | /* 42 | * Class: gnu_io_LPRPort 43 | * Method: setLPRMode 44 | * Signature: (I)Z 45 | */ 46 | JNIEXPORT jboolean JNICALL Java_gnu_io_LPRPort_setLPRMode(JNIEnv *, jobject, 47 | jint); 48 | 49 | /* 50 | * Class: gnu_io_LPRPort 51 | * Method: isPaperOut 52 | * Signature: ()Z 53 | */ 54 | JNIEXPORT jboolean JNICALL Java_gnu_io_LPRPort_isPaperOut(JNIEnv *, jobject); 55 | 56 | /* 57 | * Class: gnu_io_LPRPort 58 | * Method: isPrinterBusy 59 | * Signature: ()Z 60 | */ 61 | JNIEXPORT jboolean JNICALL Java_gnu_io_LPRPort_isPrinterBusy(JNIEnv *, jobject); 62 | 63 | /* 64 | * Class: gnu_io_LPRPort 65 | * Method: isPrinterError 66 | * Signature: ()Z 67 | */ 68 | JNIEXPORT jboolean JNICALL Java_gnu_io_LPRPort_isPrinterError(JNIEnv *, jobject); 69 | 70 | /* 71 | * Class: gnu_io_LPRPort 72 | * Method: isPrinterSelected 73 | * Signature: ()Z 74 | */ 75 | JNIEXPORT jboolean JNICALL Java_gnu_io_LPRPort_isPrinterSelected(JNIEnv *, 76 | jobject); 77 | 78 | /* 79 | * Class: gnu_io_LPRPort 80 | * Method: isPrinterTimedOut 81 | * Signature: ()Z 82 | */ 83 | JNIEXPORT jboolean JNICALL Java_gnu_io_LPRPort_isPrinterTimedOut(JNIEnv *, 84 | jobject); 85 | 86 | /* 87 | * Class: gnu_io_LPRPort 88 | * Method: nativeClose 89 | * Signature: ()V 90 | */ 91 | JNIEXPORT void JNICALL Java_gnu_io_LPRPort_nativeClose 92 | (JNIEnv *, jobject); 93 | 94 | /* 95 | * Class: gnu_io_LPRPort 96 | * Method: setInputBufferSize 97 | * Signature: (I)V 98 | */ 99 | JNIEXPORT void JNICALL Java_gnu_io_LPRPort_setInputBufferSize 100 | (JNIEnv *, jobject, jint); 101 | 102 | /* 103 | * Class: gnu_io_LPRPort 104 | * Method: getInputBufferSize 105 | * Signature: ()I 106 | */ 107 | JNIEXPORT jint JNICALL Java_gnu_io_LPRPort_getInputBufferSize(JNIEnv *, jobject); 108 | 109 | /* 110 | * Class: gnu_io_LPRPort 111 | * Method: setOutputBufferSize 112 | * Signature: (I)V 113 | */ 114 | JNIEXPORT void JNICALL Java_gnu_io_LPRPort_setOutputBufferSize 115 | (JNIEnv *, jobject, jint); 116 | 117 | /* 118 | * Class: gnu_io_LPRPort 119 | * Method: getOutputBufferSize 120 | * Signature: ()I 121 | */ 122 | JNIEXPORT jint JNICALL Java_gnu_io_LPRPort_getOutputBufferSize(JNIEnv *, 123 | jobject); 124 | 125 | /* 126 | * Class: gnu_io_LPRPort 127 | * Method: getOutputBufferFree 128 | * Signature: ()I 129 | */ 130 | JNIEXPORT jint JNICALL Java_gnu_io_LPRPort_getOutputBufferFree(JNIEnv *, 131 | jobject); 132 | 133 | /* 134 | * Class: gnu_io_LPRPort 135 | * Method: writeByte 136 | * Signature: (I)V 137 | */ 138 | JNIEXPORT void JNICALL Java_gnu_io_LPRPort_writeByte 139 | (JNIEnv *, jobject, jint); 140 | 141 | /* 142 | * Class: gnu_io_LPRPort 143 | * Method: writeArray 144 | * Signature: ([BII)V 145 | */ 146 | JNIEXPORT void JNICALL Java_gnu_io_LPRPort_writeArray 147 | (JNIEnv *, jobject, jbyteArray, jint, jint); 148 | 149 | /* 150 | * Class: gnu_io_LPRPort 151 | * Method: drain 152 | * Signature: ()V 153 | */ 154 | JNIEXPORT void JNICALL Java_gnu_io_LPRPort_drain 155 | (JNIEnv *, jobject); 156 | 157 | /* 158 | * Class: gnu_io_LPRPort 159 | * Method: nativeavailable 160 | * Signature: ()I 161 | */ 162 | JNIEXPORT jint JNICALL Java_gnu_io_LPRPort_nativeavailable(JNIEnv *, jobject); 163 | 164 | /* 165 | * Class: gnu_io_LPRPort 166 | * Method: readByte 167 | * Signature: ()I 168 | */ 169 | JNIEXPORT jint JNICALL Java_gnu_io_LPRPort_readByte(JNIEnv *, jobject); 170 | 171 | /* 172 | * Class: gnu_io_LPRPort 173 | * Method: readArray 174 | * Signature: ([BII)I 175 | */ 176 | JNIEXPORT jint JNICALL Java_gnu_io_LPRPort_readArray(JNIEnv *, jobject, 177 | jbyteArray, jint, jint); 178 | 179 | /* 180 | * Class: gnu_io_LPRPort 181 | * Method: eventLoop 182 | * Signature: ()V 183 | */ 184 | JNIEXPORT void JNICALL Java_gnu_io_LPRPort_eventLoop 185 | (JNIEnv *, jobject); 186 | 187 | #ifdef __cplusplus 188 | } 189 | #endif 190 | #endif 191 | -------------------------------------------------------------------------------- /native/src/include/gnu_io_LPRPort_MonitorThread.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class gnu_io_LPRPort_MonitorThread */ 4 | 5 | #ifndef _Included_gnu_io_LPRPort_MonitorThread 6 | #define _Included_gnu_io_LPRPort_MonitorThread 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | #undef gnu_io_LPRPort_MonitorThread_MIN_PRIORITY 11 | #define gnu_io_LPRPort_MonitorThread_MIN_PRIORITY 1L 12 | #undef gnu_io_LPRPort_MonitorThread_NORM_PRIORITY 13 | #define gnu_io_LPRPort_MonitorThread_NORM_PRIORITY 5L 14 | #undef gnu_io_LPRPort_MonitorThread_MAX_PRIORITY 15 | #define gnu_io_LPRPort_MonitorThread_MAX_PRIORITY 10L 16 | #ifdef __cplusplus 17 | } 18 | #endif 19 | #endif 20 | -------------------------------------------------------------------------------- /native/src/include/gnu_io_LPRPort_ParallelInputStream.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class gnu_io_LPRPort_ParallelInputStream */ 4 | 5 | #ifndef _Included_gnu_io_LPRPort_ParallelInputStream 6 | #define _Included_gnu_io_LPRPort_ParallelInputStream 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | #undef gnu_io_LPRPort_ParallelInputStream_MAX_SKIP_BUFFER_SIZE 11 | #define gnu_io_LPRPort_ParallelInputStream_MAX_SKIP_BUFFER_SIZE 2048L 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | #endif 16 | -------------------------------------------------------------------------------- /native/src/include/gnu_io_LPRPort_ParallelOutputStream.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class gnu_io_LPRPort_ParallelOutputStream */ 4 | 5 | #ifndef _Included_gnu_io_LPRPort_ParallelOutputStream 6 | #define _Included_gnu_io_LPRPort_ParallelOutputStream 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | #ifdef __cplusplus 11 | } 12 | #endif 13 | #endif 14 | -------------------------------------------------------------------------------- /native/src/include/gnu_io_ParallelPort.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class gnu_io_ParallelPort */ 4 | 5 | #ifndef _Included_gnu_io_ParallelPort 6 | #define _Included_gnu_io_ParallelPort 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | #undef gnu_io_ParallelPort_debug 11 | #define gnu_io_ParallelPort_debug 0L 12 | #undef gnu_io_ParallelPort_LPT_MODE_ANY 13 | #define gnu_io_ParallelPort_LPT_MODE_ANY 0L 14 | #undef gnu_io_ParallelPort_LPT_MODE_SPP 15 | #define gnu_io_ParallelPort_LPT_MODE_SPP 1L 16 | #undef gnu_io_ParallelPort_LPT_MODE_PS2 17 | #define gnu_io_ParallelPort_LPT_MODE_PS2 2L 18 | #undef gnu_io_ParallelPort_LPT_MODE_EPP 19 | #define gnu_io_ParallelPort_LPT_MODE_EPP 3L 20 | #undef gnu_io_ParallelPort_LPT_MODE_ECP 21 | #define gnu_io_ParallelPort_LPT_MODE_ECP 4L 22 | #undef gnu_io_ParallelPort_LPT_MODE_NIBBLE 23 | #define gnu_io_ParallelPort_LPT_MODE_NIBBLE 5L 24 | #ifdef __cplusplus 25 | } 26 | #endif 27 | #endif 28 | -------------------------------------------------------------------------------- /native/src/include/gnu_io_RS485_MonitorThread.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class gnu_io_RS485_MonitorThread */ 4 | 5 | #ifndef _Included_gnu_io_RS485_MonitorThread 6 | #define _Included_gnu_io_RS485_MonitorThread 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | #undef gnu_io_RS485_MonitorThread_MIN_PRIORITY 11 | #define gnu_io_RS485_MonitorThread_MIN_PRIORITY 1L 12 | #undef gnu_io_RS485_MonitorThread_NORM_PRIORITY 13 | #define gnu_io_RS485_MonitorThread_NORM_PRIORITY 5L 14 | #undef gnu_io_RS485_MonitorThread_MAX_PRIORITY 15 | #define gnu_io_RS485_MonitorThread_MAX_PRIORITY 10L 16 | #ifdef __cplusplus 17 | } 18 | #endif 19 | #endif 20 | -------------------------------------------------------------------------------- /native/src/include/gnu_io_RS485_RS485InputStream.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class gnu_io_RS485_RS485InputStream */ 4 | 5 | #ifndef _Included_gnu_io_RS485_RS485InputStream 6 | #define _Included_gnu_io_RS485_RS485InputStream 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | #undef gnu_io_RS485_RS485InputStream_MAX_SKIP_BUFFER_SIZE 11 | #define gnu_io_RS485_RS485InputStream_MAX_SKIP_BUFFER_SIZE 2048L 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | #endif 16 | -------------------------------------------------------------------------------- /native/src/include/gnu_io_RS485_RS485OutputStream.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class gnu_io_RS485_RS485OutputStream */ 4 | 5 | #ifndef _Included_gnu_io_RS485_RS485OutputStream 6 | #define _Included_gnu_io_RS485_RS485OutputStream 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | #ifdef __cplusplus 11 | } 12 | #endif 13 | #endif 14 | -------------------------------------------------------------------------------- /native/src/include/gnu_io_RXTXCommDriver.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class gnu_io_RXTXCommDriver */ 4 | 5 | #ifndef _Included_gnu_io_RXTXCommDriver 6 | #define _Included_gnu_io_RXTXCommDriver 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | #undef gnu_io_RXTXCommDriver_debug 11 | #define gnu_io_RXTXCommDriver_debug 0L 12 | #undef gnu_io_RXTXCommDriver_devel 13 | #define gnu_io_RXTXCommDriver_devel 0L 14 | /* 15 | * Class: gnu_io_RXTXCommDriver 16 | * Method: registerKnownPorts 17 | * Signature: (I)Z 18 | */ 19 | JNIEXPORT jboolean JNICALL Java_gnu_io_RXTXCommDriver_registerKnownPorts( 20 | JNIEnv *, jobject, jint); 21 | 22 | /* 23 | * Class: gnu_io_RXTXCommDriver 24 | * Method: isPortPrefixValid 25 | * Signature: (Ljava/lang/String;)Z 26 | */ 27 | JNIEXPORT jboolean JNICALL Java_gnu_io_RXTXCommDriver_isPortPrefixValid( 28 | JNIEnv *, jobject, jstring); 29 | 30 | /* 31 | * Class: gnu_io_RXTXCommDriver 32 | * Method: testRead 33 | * Signature: (Ljava/lang/String;I)Z 34 | */ 35 | JNIEXPORT jboolean JNICALL Java_gnu_io_RXTXCommDriver_testRead(JNIEnv *, 36 | jobject, jstring, jint); 37 | 38 | /* 39 | * Class: gnu_io_RXTXCommDriver 40 | * Method: getDeviceDirectory 41 | * Signature: ()Ljava/lang/String; 42 | */ 43 | JNIEXPORT jstring JNICALL Java_gnu_io_RXTXCommDriver_getDeviceDirectory( 44 | JNIEnv *, jobject); 45 | 46 | /* 47 | * Class: gnu_io_RXTXCommDriver 48 | * Method: nativeGetVersion 49 | * Signature: ()Ljava/lang/String; 50 | */ 51 | JNIEXPORT jstring JNICALL Java_gnu_io_RXTXCommDriver_nativeGetVersion(JNIEnv *, 52 | jclass); 53 | 54 | #ifdef __cplusplus 55 | } 56 | #endif 57 | #endif 58 | -------------------------------------------------------------------------------- /native/src/include/gnu_io_RXTXPort_MonitorThread.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class gnu_io_RXTXPort_MonitorThread */ 4 | 5 | #ifndef _Included_gnu_io_RXTXPort_MonitorThread 6 | #define _Included_gnu_io_RXTXPort_MonitorThread 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | #undef gnu_io_RXTXPort_MonitorThread_MIN_PRIORITY 11 | #define gnu_io_RXTXPort_MonitorThread_MIN_PRIORITY 1L 12 | #undef gnu_io_RXTXPort_MonitorThread_NORM_PRIORITY 13 | #define gnu_io_RXTXPort_MonitorThread_NORM_PRIORITY 5L 14 | #undef gnu_io_RXTXPort_MonitorThread_MAX_PRIORITY 15 | #define gnu_io_RXTXPort_MonitorThread_MAX_PRIORITY 10L 16 | #ifdef __cplusplus 17 | } 18 | #endif 19 | #endif 20 | -------------------------------------------------------------------------------- /native/src/include/gnu_io_RXTXPort_SerialInputStream.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class gnu_io_RXTXPort_SerialInputStream */ 4 | 5 | #ifndef _Included_gnu_io_RXTXPort_SerialInputStream 6 | #define _Included_gnu_io_RXTXPort_SerialInputStream 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | #undef gnu_io_RXTXPort_SerialInputStream_MAX_SKIP_BUFFER_SIZE 11 | #define gnu_io_RXTXPort_SerialInputStream_MAX_SKIP_BUFFER_SIZE 2048L 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | #endif 16 | -------------------------------------------------------------------------------- /native/src/include/gnu_io_RXTXPort_SerialOutputStream.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class gnu_io_RXTXPort_SerialOutputStream */ 4 | 5 | #ifndef _Included_gnu_io_RXTXPort_SerialOutputStream 6 | #define _Included_gnu_io_RXTXPort_SerialOutputStream 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | #ifdef __cplusplus 11 | } 12 | #endif 13 | #endif 14 | -------------------------------------------------------------------------------- /native/src/include/gnu_io_RXTXVersion.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class gnu_io_RXTXVersion */ 4 | 5 | #ifndef _Included_gnu_io_RXTXVersion 6 | #define _Included_gnu_io_RXTXVersion 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | /* 11 | * Class: gnu_io_RXTXVersion 12 | * Method: nativeGetVersion 13 | * Signature: ()Ljava/lang/String; 14 | */ 15 | JNIEXPORT jstring JNICALL Java_gnu_io_RXTXVersion_nativeGetVersion(JNIEnv *, 16 | jclass); 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | #endif 22 | -------------------------------------------------------------------------------- /native/src/include/gnu_io_Raw_MonitorThread.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class gnu_io_Raw_MonitorThread */ 4 | 5 | #ifndef _Included_gnu_io_Raw_MonitorThread 6 | #define _Included_gnu_io_Raw_MonitorThread 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | #undef gnu_io_Raw_MonitorThread_MIN_PRIORITY 11 | #define gnu_io_Raw_MonitorThread_MIN_PRIORITY 1L 12 | #undef gnu_io_Raw_MonitorThread_NORM_PRIORITY 13 | #define gnu_io_Raw_MonitorThread_NORM_PRIORITY 5L 14 | #undef gnu_io_Raw_MonitorThread_MAX_PRIORITY 15 | #define gnu_io_Raw_MonitorThread_MAX_PRIORITY 10L 16 | #ifdef __cplusplus 17 | } 18 | #endif 19 | #endif 20 | -------------------------------------------------------------------------------- /native/src/include/gnu_io_Raw_RawInputStream.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class gnu_io_Raw_RawInputStream */ 4 | 5 | #ifndef _Included_gnu_io_Raw_RawInputStream 6 | #define _Included_gnu_io_Raw_RawInputStream 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | #undef gnu_io_Raw_RawInputStream_MAX_SKIP_BUFFER_SIZE 11 | #define gnu_io_Raw_RawInputStream_MAX_SKIP_BUFFER_SIZE 2048L 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | #endif 16 | -------------------------------------------------------------------------------- /native/src/include/gnu_io_Raw_RawOutputStream.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class gnu_io_Raw_RawOutputStream */ 4 | 5 | #ifndef _Included_gnu_io_Raw_RawOutputStream 6 | #define _Included_gnu_io_Raw_RawOutputStream 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | #ifdef __cplusplus 11 | } 12 | #endif 13 | #endif 14 | -------------------------------------------------------------------------------- /native/src/include/gnu_io_Zystem.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class gnu_io_Zystem */ 4 | 5 | #ifndef _Included_gnu_io_Zystem 6 | #define _Included_gnu_io_Zystem 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | #undef gnu_io_Zystem_SILENT_MODE 11 | #define gnu_io_Zystem_SILENT_MODE 0L 12 | #undef gnu_io_Zystem_FILE_MODE 13 | #define gnu_io_Zystem_FILE_MODE 1L 14 | #undef gnu_io_Zystem_NET_MODE 15 | #define gnu_io_Zystem_NET_MODE 2L 16 | #undef gnu_io_Zystem_MEX_MODE 17 | #define gnu_io_Zystem_MEX_MODE 3L 18 | #undef gnu_io_Zystem_PRINT_MODE 19 | #define gnu_io_Zystem_PRINT_MODE 4L 20 | #undef gnu_io_Zystem_J2EE_MSG_MODE 21 | #define gnu_io_Zystem_J2EE_MSG_MODE 5L 22 | #undef gnu_io_Zystem_J2SE_LOG_MODE 23 | #define gnu_io_Zystem_J2SE_LOG_MODE 6L 24 | #ifdef __cplusplus 25 | } 26 | #endif 27 | #endif 28 | -------------------------------------------------------------------------------- /native/src/init.c: -------------------------------------------------------------------------------- 1 | /* init.c is used for compiling dll's with lcc. More info in Makefile.lcc */ 2 | 3 | #ifdef _WIN32 4 | #include 5 | #include 6 | 7 | /** 8 | * Lcc requuires that there should be LibraryMain function and seeks 9 | * by default for LibMain. This might be someway not usefull for jni 10 | * interface it satisfies lcc linker. 11 | */ 12 | BOOL WINAPI __declspec(dllexport) LibMain(HINSTANCE hDLLInst, DWORD fdwReason, LPVOID lpvReserved) { 13 | return TRUE; 14 | } 15 | 16 | /** 17 | * This is the standart implementation of Java 2 OnLoad and OnUnload native 18 | * library calls. This template defines them empty functions 19 | * 20 | * Now in SerialImp.c 21 | */ 22 | /* 23 | JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) { return JNI_VERSION_1_2; } 24 | JNIEXPORT void JNICALL JNI_OnUnload(JavaVM *vm, void *reserved) {} 25 | */ 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /native/src/init.cc: -------------------------------------------------------------------------------- 1 | #include 2 | /* 3 | extern "C" 4 | { int WINAPI dll_entry (HANDLE handke, DWORD dword, void *var); }; 5 | int WINAPI dll_entry (HANDLE , DWORD dword, void *) 6 | { return 1; } 7 | */ 8 | #ifdef __CYGWIN32__ 9 | 10 | struct _reent *_impure_ptr; 11 | extern struct _reent *__imp_reent_data; 12 | #endif 13 | 14 | extern "C" { 15 | int WINAPI dll_entry (HANDLE h, DWORD reason, void *ptr); 16 | } 17 | ; 18 | 19 | int WINAPI dll_entry (HANDLE , 20 | DWORD reason, 21 | void *) 22 | { 23 | #ifdef __CYGWIN32__ 24 | _impure_ptr = __imp_reent_data; 25 | #endif 26 | 27 | switch (reason) 28 | { 29 | case DLL_PROCESS_ATTACH: 30 | break; 31 | case DLL_PROCESS_DETACH: 32 | break; 33 | case DLL_THREAD_ATTACH: 34 | break; 35 | case DLL_THREAD_DETACH: 36 | break; 37 | } 38 | return 1; 39 | } 40 | 41 | -------------------------------------------------------------------------------- /native/src/lfd/INSTALL: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------- 2 | | RXTX License v 2.1 - LGPL v 2.1 + Linking Over Controlled Interface. 3 | | RXTX is a native interface to serial ports in java. 4 | | Copyright 2002-2007 by Trent Jarvi tjarvi@qbang.org and others who 5 | | actually wrote it. See individual source files for more information. 6 | | 7 | | A copy of the LGPL v 2.1 may be found at 8 | | http://www.gnu.org/licenses/lgpl.txt on March 4th 2007. A copy is 9 | | here for your convenience. 10 | | 11 | | This library is free software; you can redistribute it and/or 12 | | modify it under the terms of the GNU Lesser General Public 13 | | License as published by the Free Software Foundation; either 14 | | version 2.1 of the License, or (at your option) any later version. 15 | | 16 | | This library is distributed in the hope that it will be useful, 17 | | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | | Lesser General Public License for more details. 20 | | 21 | | An executable that contains no derivative of any portion of RXTX, but 22 | | is designed to work with RXTX by being dynamically linked with it, 23 | | is considered a "work that uses the Library" subject to the terms and 24 | | conditions of the GNU Lesser General Public License. 25 | | 26 | | The following has been added to the RXTX License to remove 27 | | any confusion about linking to RXTX. We want to allow in part what 28 | | section 5, paragraph 2 of the LGPL does not permit in the special 29 | | case of linking over a controlled interface. The intent is to add a 30 | | Java Specification Request or standards body defined interface in the 31 | | future as another exception but one is not currently available. 32 | | 33 | | http://www.fsf.org/licenses/gpl-faq.html#LinkingOverControlledInterface 34 | | 35 | | As a special exception, the copyright holders of RXTX give you 36 | | permission to link RXTX with independent modules that communicate with 37 | | RXTX solely through the Sun Microsytems CommAPI interface version 2, 38 | | regardless of the license terms of these independent modules, and to copy 39 | | and distribute the resulting combined work under terms of your choice, 40 | | provided that every copy of the combined work is accompanied by a complete 41 | | copy of the source code of RXTX (the version of RXTX used to produce the 42 | | combined work), being distributed under the terms of the GNU Lesser General 43 | | Public License plus this exception. An independent module is a 44 | | module which is not derived from or based on RXTX. 45 | | 46 | | Note that people who make modified versions of RXTX are not obligated 47 | | to grant this special exception for their modified versions; it is 48 | | their choice whether to do so. The GNU Lesser General Public License 49 | | gives permission to release a modified version without this exception; this 50 | | exception also makes it possible to release a modified version which 51 | | carries forward this exception. 52 | | 53 | | You should have received a copy of the GNU Lesser General Public 54 | | License along with this library; if not, write to the Free 55 | | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 56 | | All trademarks belong to their respective owners. 57 | --------------------------------------------------------------------------*/ 58 | 1. BUILDING LFD 59 | 60 | In the src/lfd directory edit lockdaemon.c and specify the following defines: 61 | 62 | #define LOCK fhs_lock 63 | #define UNLOCK fhs_unlock 64 | #define LOCKDIR "/var/lock" 65 | 66 | LOCK may be fhs_lock (linux) or uucp_lock (Solaris) 67 | UNLOCK may be fhs_unlock (Linux) or fhs_unlock (Solaris) 68 | LOCkDIR may be /var/lock (Linux) or /var/spool/lock (Solaris) 69 | 70 | After setting up the defines type make to build lfd. 71 | 72 | 2. INSTALLING. 73 | 74 | daemons are usually placed in the /usr/sbin directory. 75 | in.lfd will need to be setup for inetd or xinetd support. 76 | 77 | 2.1 xinetd support on RedHat Linux: 78 | 79 | edit /etc/services and add the following lines: 80 | 81 | lockfiled 50001/tcp # lock file daemon 82 | lockfiled 50001/ucp # lock file daemon 83 | 84 | 85 | create a file /etc/xinetd.d/lfd with the folowing contents: 86 | 87 | # default: on 88 | # description: The lockfiled server serves lockfiles; it uses \ 89 | # 90 | service lfd 91 | { 92 | flags = REUSE 93 | socket_type = stream 94 | wait = no 95 | user = uucp 96 | server = /usr/sbin/in.lfd 97 | log_on_failure += USERID 98 | disable = no 99 | } 100 | 101 | 2.2 inetd support on Solaris: 102 | 103 | edit /etc/services and add the following lines: 104 | 105 | lfd 50001/tcp # lock file daemon 106 | lfd 50001/ucp # lock file daemon 107 | 108 | add the following line to /etc/inetd.conf 109 | 110 | lockfiled stream tcp nowait uucp /usr/sbin/in.lfd lfd 111 | 112 | 113 | -------------------------------------------------------------------------------- /native/src/lfd/Makefile: -------------------------------------------------------------------------------- 1 | CC=gcc 2 | CFLAGS= -Wall -g 3 | 4 | all: 5 | $(CC) $(CFLAGS) lockdaemon.c -o lfd 6 | chown root:uucp lfd 7 | chmod 2755 lfd 8 | -------------------------------------------------------------------------------- /native/src/psmisc/COPYING: -------------------------------------------------------------------------------- 1 | psmisc (fuser, killall and pstree) program code, documentation and 2 | auxiliary programs are 3 | Copyright 1993-1998 Werner Almesberger. 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms of parts of or the 7 | whole original or derived work are permitted provided that the 8 | original work is properly attributed to the author. The name of the 9 | author may not be used to endorse or promote products derived from 10 | this software without specific prior written permission. This work 11 | is provided "as is" and without any express or implied warranties. 12 | -------------------------------------------------------------------------------- /native/src/psmisc/Makefile: -------------------------------------------------------------------------------- 1 | CC=cc 2 | CFLAGS=-O -D_GNU_SOURCE -Wall -Wno-parentheses -Wwrite-strings -Wpointer-arith 3 | REAL_CPP=/lib/cpp 4 | LIBDIR=/usr/lib 5 | 6 | all: libpsmisc.la testing 7 | 8 | testing: testing.c libpsmisc.la 9 | cp .libs/*so* . 10 | $(CC) $(CFLAGS) -L .libs -lpsmisc -o testing testing.c 11 | libpsmisc.la: fuser.c Makefile 12 | libtool --mode=compile $(CC) $(CFLAGS) -c fuser.c 13 | libtool --mode=link $(CC) $(CFLAGS) --version-info 1:0:1 -o libpsmisc.la -rpath $(LIBDIR) fuser.lo 14 | 15 | clean: 16 | rm -rf *.o .libs *~ core testing *.lo libps* 17 | -------------------------------------------------------------------------------- /native/src/psmisc/README: -------------------------------------------------------------------------------- 1 | psmisc, version 18 2 | + _hacks_ to get a lib Trent Jarvi taj@parcelfarce.linux.theplanet.co.uk 3 | This is experimental work for rxtx. 4 | try testing /dev/tty1 to see whats up. 5 | 6 | get psmisc if you are interested in the real package 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | ================== 26 | 27 | This package contains four little utilities that use the proc FS: 28 | 29 | fuser identifies processes using files or sockets (similar to Sun's 30 | or SGI's fuser) 31 | killall kills processes by name, e.g. killall -HUP named 32 | pidof like killall, buts lists PIDs instead of killing processes 33 | pstree shows the currently running processes as a tree 34 | 35 | They should work with most recent kernels. Man pages are included. 36 | 37 | - Werner Almesberger 38 | -------------------------------------------------------------------------------- /native/src/psmisc/testing.c: -------------------------------------------------------------------------------- 1 | extern void show_user(char[]); 2 | 3 | int main(int argc, char **argv) { 4 | 5 | if (argv[1]) 6 | show_user(argv[1]); 7 | else 8 | show_user("/dev/tty1"); 9 | exit(0); 10 | } 11 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'openmuc-jrxtx' 2 | include ":gnu-io", ":jrxtx", ":jrxtxWrapper" 3 | --------------------------------------------------------------------------------