2008-09-10 1.1.0

org.eclipse.soda.dk.serial.connection
Class SerialConnection

java.lang.Object
  extended by org.eclipse.soda.dk.core.EscObject
      extended by org.eclipse.soda.dk.connection.Connection
          extended by org.eclipse.soda.dk.connection.StreamConnection
              extended by org.eclipse.soda.dk.serial.connection.SerialConnection
All Implemented Interfaces:
ConnectionService, SerialConnectionService

public class SerialConnection
extends StreamConnection
implements ConnectionService, SerialConnectionService

Serial Port (RS232) Connection. The SerialConnection class implements the SerialConnectionService and provides the controls for the connection.

The list of exported services:

Version:
1.1.0
See Also:
SerialConnectionService, ConnectionService

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.eclipse.soda.dk.serial.connection.service.SerialConnectionService
SerialConnectionService.Hardwareflowcontrol, SerialConnectionService.Parity, SerialConnectionService.Softwareflowcontrol, SerialConnectionService.Stopbits
 
Field Summary
static java.lang.String CLASS_NAME
          Defines the full class name.
protected static char[] TOSTRING_NAME
          Define the to string name (char[]) constant.
 
Fields inherited from class org.eclipse.soda.dk.connection.Connection
CHANNEL_ACTIVE_STATE_RESOURCE, CHANNEL_ALIVE_STATE_RESOURCE, CHANNEL_CLOSED_RESOURCE, CHANNEL_CONNECTED_STATE_RESOURCE, CHANNEL_CREATED_STATE_RESOURCE, CHANNEL_DEAD_STATE_RESOURCE, CHANNEL_OPEN, CHANNEL_OPENFAILED_RESOURCE, CHANNEL_READ_BYTES_RESOURCE, CHANNEL_STARTED_STATE_RESOURCE, CHANNEL_WRITE_BYTES_RESOURCE, CLIENT_WAIT_RESOURCE, CLOSE_RESOURCE, CLOSED_RESOURCE, configurationService, logLevel, OPEN_RESOURCE, OPENFAILED_RESOURCE, READ_BYTES_RESOURCE, readByteCount, WRITE_BYTES_RESOURCE, writeByteCount
 
Fields inherited from class org.eclipse.soda.dk.core.EscObject
CLONE_EXCEPTION_RESOURCE, EMPTY_BYTES, EMPTY_STRING, ERROR_OCCURRED_EXCEPTION_RESOURCE, ID_FILTER_KEY, ID_KEY, ID_KEY_ANY, ID_NAME_KEY, INTEGER_TABLE, INTEGER_TABLE_SIZE, KEY_KEY, LOG_DEBUG, LOG_DEFAULT, LOG_ERROR, LOG_INFO, LOG_LEVEL_KEY, LOG_TRACE, LOG_WARNING, LONG_TABLE, LONG_TABLE_SIZE, PREFIX_KEY, READONLY_EMPTY_COLLECTION, READONLY_EMPTY_LIST, READONLY_EMPTY_MAP, RESOURCE_BUNDLE, SLEEP_EXCEPTION_RESOURCE, SYSTEM_INFO_RESOURCE, TO_STRING_CONFIGURATION_KEYS, TRACE_LEVEL_HIGH, TRACE_LEVEL_LOW, TRACE_LEVEL_MAX, TRACE_LEVEL_MIN, TRACE_LEVEL_NONE, TRACE_LEVEL_NORMAL, TRACELEVEL_KEY, UNKNOWN_ERROR_RESOURCE, Unmodifiable
 
Fields inherited from interface org.eclipse.soda.dk.serial.connection.service.SerialConnectionService
BAUDRATE, BAUDRATE_DEFAULT, BAUDRATE_KEY, COMPORT, COMPORT_DEFAULT, COMPORT_KEY, CONNECTION_TYPE, DATABITS, DATABITS_5, DATABITS_6, DATABITS_7, DATABITS_8, DATABITS_DEFAULT, DATABITS_KEY, DEFAULT_BAUDRATE, DEFAULT_COMPORT, DEFAULT_DATABITS, DEFAULT_HARDWAREFLOWCONTROL, DEFAULT_PARITY, DEFAULT_READINTERVALTIMEOUT, DEFAULT_READTOTALTIMEOUT, DEFAULT_SOFTWAREFLOWCONTROL, DEFAULT_STOPBITS, DEFAULT_WRITETOTALTIMEOUT, FACTORY_SERVICE_NAME, HARDWAREFLOWCONTROL, Hardwareflowcontrol_0, HARDWAREFLOWCONTROL_0, Hardwareflowcontrol_1, HARDWAREFLOWCONTROL_1, HARDWAREFLOWCONTROL_DEFAULT, HARDWAREFLOWCONTROL_KEY, MANAGED_SERVICE_NAME, PARITY, PARITY_DEFAULT, Parity_even, PARITY_EVEN, PARITY_KEY, Parity_mark, Parity_none, PARITY_NONE, Parity_odd, PARITY_ODD, Parity_space, PARITY_SPACE, READINTERVALTIMEOUT, READINTERVALTIMEOUT_DEFAULT, READINTERVALTIMEOUT_KEY, READTOTALTIMEOUT, READTOTALTIMEOUT_DEFAULT, READTOTALTIMEOUT_KEY, SerialConnection, SERVICE_DESCRIPTION, SERVICE_NAME, SOFTWAREFLOWCONTROL, Softwareflowcontrol_0, SOFTWAREFLOWCONTROL_0, Softwareflowcontrol_1, SOFTWAREFLOWCONTROL_1, SOFTWAREFLOWCONTROL_DEFAULT, SOFTWAREFLOWCONTROL_KEY, STOPBITS, Stopbits_1, STOPBITS_1, Stopbits_1_5, STOPBITS_1_5, Stopbits_2, STOPBITS_2, STOPBITS_DEFAULT, STOPBITS_KEY, WRITETOTALTIMEOUT, WRITETOTALTIMEOUT_DEFAULT, WRITETOTALTIMEOUT_KEY
 
Constructor Summary
SerialConnection(ConfigurationService configuration)
          Constructs an instance of this class from the specified configuration parameter.
SerialConnection(java.util.Dictionary properties)
           
SerialConnection(int portNumber, int baudRate, int dataBits, int parity, int stopBits, int hardwareFlowControl, int softwareFlowControl, int readTotalTimeout, int readIntervalTimeout, int writeTotalTimeout)
          Constructs an SerialConnection object using the input parameter(s).
SerialConnection(java.lang.String portName, int baudRate, int dataBits, int parity, int stopBits, int hardwareFlowControl, int softwareFlowControl, int readTotalTimeout, int readIntervalTimeout, int writeTotalTimeout)
          Constructs an instance of this class from the specified port name, baud rate, data bits, parity, stop bits, hardware flow control, software flow control, read total timeout, read interval timeout and write total timeout parameters.
 
Method Summary
 void changeBaudRate(int baudRate)
          Perform the changeBaudRate action method.
 void close()
          Perform the close action method.
 java.lang.String getOutputName()
          Gets the output name (String) value.
static java.lang.String getPortName(int portNumber)
           
 long getReceivedTotalTimeout()
          Gets the received total timeout (long) value.
 java.lang.String getType()
          Gets the String type property value.
 void open()
          Perform the open action method.
 int read(byte[] bytes)
          Read bytes.
 int read(byte[] bytes, int offset, int length)
          Read bytes.
 void setReceivedTotalTimeout(long timeout)
           
 
Methods inherited from class org.eclipse.soda.dk.connection.StreamConnection
flush, getInputStream, getOutputStream, setInputStream, setOutputStream, write, write
 
Methods inherited from class org.eclipse.soda.dk.connection.Connection
attemptRecoveryFromError, exit, finalize, getConfigurationService, getDefaultResource, getErrorSeverity, getLogDetails4, getLogDetails5, getLogLevel, getReadByteCount, getResource, getWriteByteCount, isOpen, setConfigurationInformation, setConfigurationService, setLogLevel, setOpen, setReadByteCount, setWriteByteCount, toStringInfo, updateReadByteCount, updateWriteByteCount
 
Methods inherited from class org.eclipse.soda.dk.core.EscObject
createDefaultLogService, createException, createException, createInteger, createIntegerTable, createLong, createLongTable, createNumber, format, getBoolean, getCurrentTimestamp, getDefaultLogService, getFloat, getId, getIdName, getInt, getLoadLibraryName, getLogDetails, getLogDetails0, getLogDetails1, getLogDetails2, getLogDetails3, getLogDetails6, getLogDetails7, getLogService, getLong, getObject, getReadOnlyEmptyCollection, getReadOnlyEmptyList, getReadOnlyEmptyMap, getSimpleClassName, getStaticBoolean, getStaticFloat, getStaticInt, getStaticLong, getStaticObject, getStaticString, getString, getTraceLevel, getVmLibraryVersion, handleError, handleError, handleError, handleError, handleErrorInternal, handleStaticError, handleStaticException, isBackward, isDebug, isLogging, isTrace, isUnmodifiable, loadService, log, log, log, report, report, report, report, report, report, reportError, reportSystemInfo, setBackward, setDebug, setDefaultLogService, setLogService, setTraceLevel, setUnmodifiable, shouldLog, sleep, startupEscStatic, toString, toStringConfigurationKeys
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CLASS_NAME

public static final java.lang.String CLASS_NAME
Defines the full class name.

See Also:
Constant Field Values

TOSTRING_NAME

protected static final char[] TOSTRING_NAME
Define the to string name (char[]) constant.

Constructor Detail

SerialConnection

public SerialConnection(ConfigurationService configuration)
Constructs an instance of this class from the specified configuration parameter. The configuration (ConfigurationService) parameter.

Parameters:
configuration - The configuration (ConfigurationService) parameter.
See Also:
SerialConnection(int,int,int,int,int,int,int,int,int,int), SerialConnection(String,int,int,int,int,int,int,int,int,int), SerialConnection(Dictionary)

SerialConnection

public SerialConnection(java.util.Dictionary properties)
Parameters:
properties - The properties (Dictionary) parameter.
See Also:
SerialConnection(int,int,int,int,int,int,int,int,int,int), SerialConnection(String,int,int,int,int,int,int,int,int,int), SerialConnection(ConfigurationService)

SerialConnection

public SerialConnection(int portNumber,
                        int baudRate,
                        int dataBits,
                        int parity,
                        int stopBits,
                        int hardwareFlowControl,
                        int softwareFlowControl,
                        int readTotalTimeout,
                        int readIntervalTimeout,
                        int writeTotalTimeout)
                 throws java.lang.IllegalArgumentException
Constructs an SerialConnection object using the input parameter(s). int int int int int int int int int int The exception description.

Parameters:
portNumber - The port number (int) parameter.
baudRate - The baud rate (int) parameter.
dataBits - The data bits (int) parameter.
parity - The parity (int) parameter.
stopBits - The stop bits (int) parameter.
hardwareFlowControl - The hardware flow control (int) parameter.
softwareFlowControl - The software flow control (int) parameter.
readTotalTimeout - The read total timeout (int) parameter.
readIntervalTimeout - The read interval timeout (int) parameter.
writeTotalTimeout - The write total timeout (int) parameter.
Throws:
java.lang.IllegalArgumentException - Illegal Argument Exception.
See Also:
SerialConnection(String,int,int,int,int,int,int,int,int,int), SerialConnection(Dictionary), SerialConnection(ConfigurationService)

SerialConnection

public SerialConnection(java.lang.String portName,
                        int baudRate,
                        int dataBits,
                        int parity,
                        int stopBits,
                        int hardwareFlowControl,
                        int softwareFlowControl,
                        int readTotalTimeout,
                        int readIntervalTimeout,
                        int writeTotalTimeout)
                 throws java.lang.IllegalArgumentException
Constructs an instance of this class from the specified port name, baud rate, data bits, parity, stop bits, hardware flow control, software flow control, read total timeout, read interval timeout and write total timeout parameters. The port name ( String) parameter. The baud rate (int) parameter. The data bits (int) parameter. The parity (int) parameter. The stop bits (int) parameter. The hardware flow control (int ) parameter. The software flow control (int) parameter. The read total timeout (int) parameter. The read interval timeout (int) parameter. The write total timeout (int) parameter. Illegal Argument Exception.

Parameters:
portName - The port name (String) parameter.
baudRate - The baud rate (int) parameter.
dataBits - The data bits (int) parameter.
parity - The parity (int) parameter.
stopBits - The stop bits (int) parameter.
hardwareFlowControl - The hardware flow control (int) parameter.
softwareFlowControl - The software flow control (int) parameter.
readTotalTimeout - The read total timeout (int) parameter.
readIntervalTimeout - The read interval timeout (int) parameter.
writeTotalTimeout - The write total timeout (int) parameter.
Throws:
java.lang.IllegalArgumentException - Illegal Argument Exception.
See Also:
SerialConnection(int,int,int,int,int,int,int,int,int,int), SerialConnection(Dictionary), SerialConnection(ConfigurationService)
Method Detail

getPortName

public static java.lang.String getPortName(int portNumber)
Parameters:
portNumber - The port number (int) parameter.
Returns:
Results of the get port name (String) value.

changeBaudRate

public void changeBaudRate(int baudRate)
                    throws java.lang.RuntimeException
Perform the changeBaudRate action method. int Runtime Exception.

Parameters:
baudRate - The baud rate (int) parameter.
Throws:
java.lang.RuntimeException - Runtime Exception.

close

public void close()
           throws java.io.IOException
Perform the close action method.

Specified by:
close in interface ConnectionService
Overrides:
close in class StreamConnection
Throws:
java.io.IOException - Thrown if the IOException exception condition occurs.
See Also:
ConnectionService.close()

getOutputName

public java.lang.String getOutputName()
Gets the output name (String) value.

Overrides:
getOutputName in class EscObject
Returns:
The output name (String) value.

getReceivedTotalTimeout

public long getReceivedTotalTimeout()
Gets the received total timeout (long) value.

Returns:
The received total timeout (long) value.
See Also:
setReceivedTotalTimeout(long)

getType

public java.lang.String getType()
Gets the String type property value.

Returns:
Results of the get type (String) value.

open

public void open()
          throws java.io.IOException
Perform the open action method.

Specified by:
open in interface ConnectionService
Overrides:
open in class Connection
Throws:
java.io.IOException - Thrown if the IOException exception condition occurs.
See Also:
ConnectionService.open()

read

public int read(byte[] bytes)
         throws java.io.IOException
Description copied from class: StreamConnection
Read bytes.

Specified by:
read in interface ConnectionService
Overrides:
read in class StreamConnection
Parameters:
bytes - The bytes (byte[]) parameter.
Returns:
Results of the read (int) value.
Throws:
java.io.IOException - IOException.
See Also:
read(byte[],int,int)

read

public int read(byte[] bytes,
                int offset,
                int length)
         throws java.io.IOException
Description copied from class: StreamConnection
Read bytes.

Specified by:
read in interface ConnectionService
Overrides:
read in class StreamConnection
Parameters:
bytes - The bytes (byte[]) parameter.
offset - The offset (int) parameter.
length - The length (int) parameter.
Returns:
Results of the read (int) value.
Throws:
java.io.IOException - IOException.
See Also:
read(byte[])

setReceivedTotalTimeout

public void setReceivedTotalTimeout(long timeout)
Parameters:
timeout - The timeout (long) parameter.
See Also:
getReceivedTotalTimeout()

2008-09-10 1.1.0

Copyright (c) 1999, 2008 IBM and others. See license in Legal section. OSGi Framework Version 3.4.0.v20080605-1900