Added an isOpen() function call.
This commit is contained in:
parent
33df74c31f
commit
85e219a285
14
INSTALL
14
INSTALL
|
@ -123,31 +123,31 @@ Maven:
|
|||
<dependency>
|
||||
<groupId>com.fazecast</groupId>
|
||||
<artifactId>jSerialComm</artifactId>
|
||||
<version>1.3.4</version>
|
||||
<version>1.3.5</version>
|
||||
</dependency>
|
||||
|
||||
Ivy:
|
||||
|
||||
<dependency org="com.fazecast" name="jSerialComm" rev="1.3.4"/>
|
||||
<dependency org="com.fazecast" name="jSerialComm" rev="1.3.5"/>
|
||||
|
||||
Grape:
|
||||
|
||||
@Grapes(
|
||||
@Grab(group='com.fazecast', module='jSerialComm', version='1.3.4')
|
||||
@Grab(group='com.fazecast', module='jSerialComm', version='1.3.5')
|
||||
)
|
||||
|
||||
Gradle:
|
||||
|
||||
'com.fazecast:jSerialComm:1.3.4'
|
||||
'com.fazecast:jSerialComm:1.3.5'
|
||||
|
||||
Buildr:
|
||||
|
||||
'com.fazecast:jSerialComm:jar:1.3.4'
|
||||
'com.fazecast:jSerialComm:jar:1.3.5'
|
||||
|
||||
SBT:
|
||||
|
||||
libraryDependencies += "com.fazecast" % "jSerialComm" % "1.3.4"
|
||||
libraryDependencies += "com.fazecast" % "jSerialComm" % "1.3.5"
|
||||
|
||||
Leiningen:
|
||||
|
||||
[com.fazecast/jSerialComm "1.3.4"]
|
||||
[com.fazecast/jSerialComm "1.3.5"]
|
||||
|
|
|
@ -4,7 +4,7 @@ apply plugin: 'maven'
|
|||
|
||||
group = 'com.fazecast'
|
||||
archivesBaseName = 'jSerialComm'
|
||||
version = '1.3.4'
|
||||
version = '1.3.5'
|
||||
|
||||
sourceCompatibility = 1.6
|
||||
targetCompatibility = 1.6
|
||||
|
|
|
@ -38,7 +38,7 @@ import java.util.Date;
|
|||
* This class provides native access to serial ports and devices without requiring external libraries or tools.
|
||||
*
|
||||
* @author Will Hedgecock <will.hedgecock@fazecast.com>
|
||||
* @version 1.3.4
|
||||
* @version 1.3.5
|
||||
* @see java.io.InputStream
|
||||
* @see java.io.OutputStream
|
||||
*/
|
||||
|
@ -257,12 +257,18 @@ public final class SerialPort
|
|||
* Opens this serial port for reading and writing.
|
||||
* <p>
|
||||
* All serial port parameters or timeouts can be changed at any time after the port has been opened.
|
||||
* <p>
|
||||
* Note that calling this method on an already opened port will simply return a value of true.
|
||||
*
|
||||
* @return Whether the port was successfully opened.
|
||||
*/
|
||||
public final boolean openPort()
|
||||
{
|
||||
// If this is an Android application, we must explicitly allow serial port access to this library
|
||||
// Return true if already opened
|
||||
if (isOpened)
|
||||
return true;
|
||||
|
||||
// If this is an Android root application, we must explicitly allow serial port access to this library
|
||||
if (isAndroid)
|
||||
{
|
||||
try
|
||||
|
@ -277,7 +283,7 @@ public final class SerialPort
|
|||
}
|
||||
|
||||
try { Thread.sleep(500); } catch (Exception e) {}
|
||||
if (!isOpened && (portHandle = openPortNative()) > 0)
|
||||
if ((portHandle = openPortNative()) > 0)
|
||||
{
|
||||
inputStream = new SerialPortInputStream();
|
||||
outputStream = new SerialPortOutputStream();
|
||||
|
@ -289,6 +295,8 @@ public final class SerialPort
|
|||
|
||||
/**
|
||||
* Closes this serial port.
|
||||
* <p>
|
||||
* Note that calling this method on an already closed port will simply return a value of true.
|
||||
*
|
||||
* @return Whether the port was successfully closed.
|
||||
*/
|
||||
|
@ -305,6 +313,13 @@ public final class SerialPort
|
|||
return !isOpened;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the port is currently open and available for communication.
|
||||
*
|
||||
* @return Whether the port is opened.
|
||||
*/
|
||||
public final boolean isOpen() { return isOpened; }
|
||||
|
||||
// Serial Port Setup Methods
|
||||
private static native void initializeLibrary(); // Initializes the JNI code
|
||||
private static native void uninitializeLibrary(); // Un-initializes the JNI code
|
||||
|
|
|
@ -31,7 +31,7 @@ import java.util.EventListener;
|
|||
* This interface must be implemented to enable simple event-based serial port I/O.
|
||||
*
|
||||
* @author Will Hedgecock <will.hedgecock@fazecast.com>
|
||||
* @version 1.3.4
|
||||
* @version 1.3.5
|
||||
* @see java.util.EventListener
|
||||
*/
|
||||
public interface SerialPortDataListener extends EventListener
|
||||
|
|
|
@ -31,7 +31,7 @@ import java.util.EventObject;
|
|||
* This class describes an asynchronous serial port event.
|
||||
*
|
||||
* @author Will Hedgecock <will.hedgecock@fazecast.com>
|
||||
* @version 1.3.4
|
||||
* @version 1.3.5
|
||||
* @see java.util.EventObject
|
||||
*/
|
||||
public final class SerialPortEvent extends EventObject
|
||||
|
|
|
@ -31,7 +31,7 @@ package com.fazecast.jSerialComm;
|
|||
* <i>Note</i>: Using this interface will negate any serial port read timeout settings since they make no sense in an asynchronous context.
|
||||
*
|
||||
* @author Will Hedgecock <will.hedgecock@fazecast.com>
|
||||
* @version 1.3.4
|
||||
* @version 1.3.5
|
||||
* @see com.fazecast.jSerialComm.SerialPortDataListener
|
||||
* @see java.util.EventListener
|
||||
*/
|
||||
|
|
|
@ -32,7 +32,7 @@ import java.util.Scanner;
|
|||
* This class provides a test case for the jSerialComm library.
|
||||
*
|
||||
* @author Will Hedgecock <will.hedgecock@gmail.com>
|
||||
* @version 1.3.4
|
||||
* @version 1.3.5
|
||||
* @see java.io.InputStream
|
||||
* @see java.io.OutputStream
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue