Added documentation for OS-specific differences.

This commit is contained in:
hedgecrw85 2015-06-15 12:42:25 -05:00
parent 85e219a285
commit 6f5f2c4e8b
7 changed files with 48 additions and 15 deletions

14
INSTALL
View File

@ -123,31 +123,31 @@ Maven:
<dependency>
<groupId>com.fazecast</groupId>
<artifactId>jSerialComm</artifactId>
<version>1.3.5</version>
<version>1.3.6</version>
</dependency>
Ivy:
<dependency org="com.fazecast" name="jSerialComm" rev="1.3.5"/>
<dependency org="com.fazecast" name="jSerialComm" rev="1.3.6"/>
Grape:
@Grapes(
@Grab(group='com.fazecast', module='jSerialComm', version='1.3.5')
@Grab(group='com.fazecast', module='jSerialComm', version='1.3.6')
)
Gradle:
'com.fazecast:jSerialComm:1.3.5'
'com.fazecast:jSerialComm:1.3.6'
Buildr:
'com.fazecast:jSerialComm:jar:1.3.5'
'com.fazecast:jSerialComm:jar:1.3.6'
SBT:
libraryDependencies += "com.fazecast" % "jSerialComm" % "1.3.5"
libraryDependencies += "com.fazecast" % "jSerialComm" % "1.3.6"
Leiningen:
[com.fazecast/jSerialComm "1.3.5"]
[com.fazecast/jSerialComm "1.3.6"]

View File

@ -4,7 +4,7 @@ apply plugin: 'maven'
group = 'com.fazecast'
archivesBaseName = 'jSerialComm'
version = '1.3.5'
version = '1.3.6'
sourceCompatibility = 1.6
targetCompatibility = 1.6

View File

@ -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 &lt;will.hedgecock@fazecast.com&gt;
* @version 1.3.5
* @version 1.3.6
* @see java.io.InputStream
* @see java.io.OutputStream
*/
@ -501,6 +501,8 @@ public final class SerialPort
/**
* Sets the serial port read and write timeout parameters.
* <p>
* <i>Note that write timeouts are only available on Windows-based systems. There is no functionality to set a write timeout on other operating systems.</i>
* <p>
* The built-in timeout mode constants should be used ({@link #TIMEOUT_NONBLOCKING}, {@link #TIMEOUT_READ_SEMI_BLOCKING},
* {@link #TIMEOUT_WRITE_SEMI_BLOCKING}, {@link #TIMEOUT_READ_BLOCKING}, {@link #TIMEOUT_WRITE_BLOCKING}, {@link #TIMEOUT_SCANNER}) to specify how
* timeouts are to be handled.
@ -531,6 +533,10 @@ public final class SerialPort
* <p>
* A value of 0 for either <i>newReadTimeout</i> or <i>newWriteTimeout</i> indicates that a {@link #readBytes(byte[],long)} or
* {@link #writeBytes(byte[],long)} call should block forever until it can return successfully (based upon the current timeout mode specified).
* <p>
* It is important to note that non-Windows operating systems only allow decisecond (1/10th of a second) granularity for serial port timeouts. As such, your
* millisecond timeout value will be rounded to the nearest decisecond under Linux or Mac OS. To ensure consistent performance across multiple platforms, it is
* advisable that you set your timeout values to be multiples of 100, although this is not strictly enforced.
*
* @param newTimeoutMode The new timeout mode as specified above.
* @param newReadTimeout The number of milliseconds of inactivity to tolerate before returning from a {@link #readBytes(byte[],long)} call.
@ -539,8 +545,13 @@ public final class SerialPort
public final void setComPortTimeouts(int newTimeoutMode, int newReadTimeout, int newWriteTimeout)
{
timeoutMode = newTimeoutMode;
readTimeout = newReadTimeout;
writeTimeout = newWriteTimeout;
if (isWindows)
{
readTimeout = newReadTimeout;
writeTimeout = newWriteTimeout;
}
else
readTimeout = Math.round((float)newReadTimeout / 100.0f) * 100;
if (isOpened)
{
@ -627,6 +638,12 @@ public final class SerialPort
* <p>
* Note that only one valid flow control configuration can be used at any time. For example, attempting to use both XOn/XOff
* <b>and</b> RTS/CTS will most likely result in an unusable serial port.
* <p>
* Also note that some flow control modes are only available on certain operating systems. Valid modes for each OS are:
* <p>
* &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Windows: CTS, RTS/CTS, DSR, DTR/DSR, Xon, Xoff, Xon/Xoff<br>
* &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Mac: RTS/CTS, Xon, Xoff, Xon/Xoff<br>
* &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Linux: RTS/CTS, Xon, Xoff, Xon/Xoff
*
* @param newFlowControlSettings The desired type of flow control to enable for this serial port.
* @see #FLOW_CONTROL_DISABLED
@ -752,6 +769,8 @@ public final class SerialPort
* <p>
* Any value other than 0 indicates the number of milliseconds of inactivity that will be tolerated before the {@link #writeBytes(byte[],long)}
* call will return.
* <p>
* Note that write timeouts are only available on Windows operating systems. This value is ignored on all other systems.
*
* @return The number of milliseconds of inactivity to tolerate before returning from a {@link #writeBytes(byte[],long)} call.
*/
@ -769,6 +788,12 @@ public final class SerialPort
* &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DSR: {@link #FLOW_CONTROL_DSR_ENABLED}<br>
* &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DTR/DSR: {@link #FLOW_CONTROL_DTR_ENABLED} | {@link #FLOW_CONTROL_DSR_ENABLED}<br>
* &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;XOn/XOff: {@link #FLOW_CONTROL_XONXOFF_IN_ENABLED} | {@link #FLOW_CONTROL_XONXOFF_OUT_ENABLED}
* <p>
* Note that some flow control modes are only available on certain operating systems. Valid modes for each OS are:
* <p>
* &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Windows: CTS, RTS/CTS, DSR, DTR/DSR, Xon, Xoff, Xon/Xoff<br>
* &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Mac: RTS/CTS, Xon, Xoff, Xon/Xoff<br>
* &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Linux: RTS/CTS, Xon, Xoff, Xon/Xoff
*
* @return The flow control settings enabled on this serial port.
* @see #FLOW_CONTROL_DISABLED

View File

@ -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 &lt;will.hedgecock@fazecast.com&gt;
* @version 1.3.5
* @version 1.3.6
* @see java.util.EventListener
*/
public interface SerialPortDataListener extends EventListener
@ -49,6 +49,8 @@ public interface SerialPortDataListener extends EventListener
* <p>
* Two or more events may be OR'd together to listen for multiple events; however, if {@link SerialPort#LISTENING_EVENT_DATA_AVAILABLE} is OR'd with {@link SerialPort#LISTENING_EVENT_DATA_RECEIVED}, the {@link SerialPort#LISTENING_EVENT_DATA_RECEIVED} flag will take precedence.
* <p>
* Note that event-based <i>write</i> callbacks are only supported on Windows operating systems. As such, the {@link SerialPort#LISTENING_EVENT_DATA_WRITTEN}
* event will never be called on a non-Windows system.
*
* @return The event constants that should trigger the {@link #serialEvent(SerialPortEvent)} callback.
* @see SerialPort#LISTENING_EVENT_DATA_AVAILABLE

View File

@ -31,7 +31,7 @@ import java.util.EventObject;
* This class describes an asynchronous serial port event.
*
* @author Will Hedgecock &lt;will.hedgecock@fazecast.com&gt;
* @version 1.3.5
* @version 1.3.6
* @see java.util.EventObject
*/
public final class SerialPortEvent extends EventObject
@ -51,6 +51,8 @@ public final class SerialPortEvent extends EventObject
* &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{@link SerialPort#LISTENING_EVENT_DATA_RECEIVED}<br>
* &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{@link SerialPort#LISTENING_EVENT_DATA_WRITTEN}<br>
* <p>
* Note that event-based write callbacks are only supported on Windows operating systems. As such, the {@link SerialPort#LISTENING_EVENT_DATA_WRITTEN}
* event will never be called on a non-Windows system.
*
* @param comPort The {@link SerialPort} about which this object is being created.
* @param serialEventType The type of serial port event that this object describes.
@ -74,6 +76,8 @@ public final class SerialPortEvent extends EventObject
* &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{@link SerialPort#LISTENING_EVENT_DATA_RECEIVED}<br>
* &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{@link SerialPort#LISTENING_EVENT_DATA_WRITTEN}<br>
* <p>
* Note that event-based write callbacks are only supported on Windows operating systems. As such, the {@link SerialPort#LISTENING_EVENT_DATA_WRITTEN}
* event will never be called on a non-Windows system.
*
* @param comPort The {@link SerialPort} about which this object is being created.
* @param serialEventType The type of serial port event that this object describes.
@ -105,6 +109,8 @@ public final class SerialPortEvent extends EventObject
* &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{@link SerialPort#LISTENING_EVENT_DATA_RECEIVED}<br>
* &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{@link SerialPort#LISTENING_EVENT_DATA_WRITTEN}<br>
* <p>
* Note that event-based write callbacks are only supported on Windows operating systems. As such, the {@link SerialPort#LISTENING_EVENT_DATA_WRITTEN}
* event will never be called on a non-Windows system.
*
* @return The serial port event that this object describes.
* @see SerialPort#LISTENING_EVENT_DATA_AVAILABLE

View File

@ -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 &lt;will.hedgecock@fazecast.com&gt;
* @version 1.3.5
* @version 1.3.6
* @see com.fazecast.jSerialComm.SerialPortDataListener
* @see java.util.EventListener
*/

View File

@ -32,7 +32,7 @@ import java.util.Scanner;
* This class provides a test case for the jSerialComm library.
*
* @author Will Hedgecock &lt;will.hedgecock@gmail.com&gt;
* @version 1.3.5
* @version 1.3.6
* @see java.io.InputStream
* @see java.io.OutputStream
*/