BakeoutController-Basic  0.1
A Controller for the Omicron vacuum chamber
Classes | Public Member Functions | List of all members
kernel.serial_ports.RXTXPortWrapper Class Reference
Inheritance diagram for kernel.serial_ports.RXTXPortWrapper:
Inheritance graph
[legend]
Collaboration diagram for kernel.serial_ports.RXTXPortWrapper:
Collaboration graph
[legend]

Public Member Functions

PortCommunicator getCommunicator ()
 
InputStream getInputStream () throws IOException
 
OutputStream getOutputStream () throws IOException
 
PortConfiguration getConfig ()
 
int getBaudRate ()
 
int getStopBits ()
 
int getDataBits ()
 
int getParityBits ()
 
void setConfig (PortConfiguration newConfig)
 
void open () throws PortInUseException, UnsupportedCommOperationException
 
boolean isPortOpen ()
 
void close ()
 

Additional Inherited Members

- Public Attributes inherited from kernel.serial_ports.PortConfiguration
int DATABITS_8 = RXTXPort.DATABITS_8
 
int BAUD_RATE_9600 = 9600
 
int PARITY_NONE = RXTXPort.PARITY_NONE
 
int STOPBITS_1 = RXTXPort.STOPBITS_1
 

Detailed Description

Wraps the RXTX port

Definition at line 17 of file RXTXPortWrapper.java.

Member Function Documentation

void kernel.serial_ports.RXTXPortWrapper.close ( )

closes the port

Implements kernel.serial_ports.SerialPort.

Definition at line 177 of file RXTXPortWrapper.java.

177  {
178  if (this.isPortOpen){
179  this.port.close();
180  this.isPortOpen = false;
181 
182  Runtime.getRuntime().removeShutdownHook(shutdownThread);
183 
184  writeLogEntryForPortClosed();
185  }
186  }
int kernel.serial_ports.RXTXPortWrapper.getBaudRate ( )
Returns
The current baud rate set on the port

Implements kernel.serial_ports.PortConfiguration.

Definition at line 104 of file RXTXPortWrapper.java.

104  {
105  return this.port.getBaudRate();
106  }
PortCommunicator kernel.serial_ports.RXTXPortWrapper.getCommunicator ( )
Returns
Something capable of retrieving an input and output stream for communicating through the port

Implements kernel.serial_ports.SerialPort.

Definition at line 66 of file RXTXPortWrapper.java.

66  {
67  return this;
68  }
PortConfiguration kernel.serial_ports.RXTXPortWrapper.getConfig ( )
Returns
Something capable of expressing the port's configuration

Implements kernel.serial_ports.SerialPort.

Definition at line 96 of file RXTXPortWrapper.java.

96  {
97  return this;
98  }
int kernel.serial_ports.RXTXPortWrapper.getDataBits ( )
Returns
The number of data bits on the port

Implements kernel.serial_ports.PortConfiguration.

Definition at line 120 of file RXTXPortWrapper.java.

120  {
121  return this.port.getDataBits();
122  }
InputStream kernel.serial_ports.RXTXPortWrapper.getInputStream ( ) throws IOException
Returns
The input stream for the wrapped port
Exceptions
IOExceptionif the port is not open. The resulting InputStream cannot be retrieved

Implements kernel.serial_ports.PortCommunicator.

Definition at line 75 of file RXTXPortWrapper.java.

75  {
76  assertPortOpen();
77  writeLogEntryForInputStreamRequest();
78  return this.port.getInputStream();
79  }
OutputStream kernel.serial_ports.RXTXPortWrapper.getOutputStream ( ) throws IOException
Returns
The output stream for the wrapped port
Exceptions
IOExceptionif the port is not open. The port must be open prior to retrieving the port's OutputStream

Implements kernel.serial_ports.PortCommunicator.

Definition at line 86 of file RXTXPortWrapper.java.

86  {
87  assertPortOpen();
88  writeLogEntryForOutputStreamRequest();
89  return this.port.getOutputStream();
90  }
int kernel.serial_ports.RXTXPortWrapper.getParityBits ( )
Returns
The number of parity bits set on the port

Implements kernel.serial_ports.PortConfiguration.

Definition at line 128 of file RXTXPortWrapper.java.

128  {
129  return this.port.getParity();
130  }
int kernel.serial_ports.RXTXPortWrapper.getStopBits ( )
Returns
The current number of stop bits on the port

Implements kernel.serial_ports.PortConfiguration.

Definition at line 112 of file RXTXPortWrapper.java.

112  {
113  return this.port.getStopBits();
114  }
boolean kernel.serial_ports.RXTXPortWrapper.isPortOpen ( )
Returns
true if the port is open, otherwise false

Implements kernel.serial_ports.SerialPort.

Definition at line 170 of file RXTXPortWrapper.java.

170  {
171  return this.isPortOpen;
172  }
void kernel.serial_ports.RXTXPortWrapper.open ( ) throws PortInUseException, UnsupportedCommOperationException

Open the port

Exceptions
PortInUseExceptionif the port cannot be opened
UnsupportedCommOperationExceptionif the port can be opened, but the configuration cannot be set

Implements kernel.serial_ports.SerialPort.

Definition at line 146 of file RXTXPortWrapper.java.

147  {
148  if (!this.isPortOpen){
149  this.port = new RXTXPort(this.portName);
150  this.isPortOpen = true;
151 
152  shutdownThread = new PortShutdown(this);
153  Runtime.getRuntime().addShutdownHook(shutdownThread);
154 
155  try {
156  setConfigurationParametersForOpenPort();
157  } catch (IOException error){
158  throw new UnsupportedCommOperationException(
159  "Unable to set port configuration parameters"
160  );
161  }
162 
163  writeLogEntryForPortOpen();
164  }
165  }
void kernel.serial_ports.RXTXPortWrapper.setConfig ( PortConfiguration  newConfig)

Sets the port configuration to a new config

Parameters
newConfigthe new parameters required of the port

Implements kernel.serial_ports.SerialPort.

Definition at line 136 of file RXTXPortWrapper.java.

136  {
137  this.desiredPortConfiguration = newConfig;
138  }

The documentation for this class was generated from the following file:
Git Repo