|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectikayaki.squid.SerialIO
public class SerialIO
This class represents hardware layer to serial port communications.
Nested Class Summary | |
---|---|
private static class |
SerialIO.LogEvent
Logwriter event type |
Field Summary | |
---|---|
private static DateFormat |
dateFormat
|
private static boolean |
DEBUG
|
private InputStream |
is
Inputstream of this port |
private EventListenerList |
listenerList
Listeners for this port. |
private BufferedWriter |
logWriter
Logwriter buffer |
private boolean |
logWriterTriedCreate
Have we tried to create the log writer? |
private static Vector<SerialIO> |
openPorts
All opened serial ports |
private OutputStream |
os
Outputstream of this port |
private String |
portName
Name of this port |
private javax.comm.SerialPort |
sPort
This serial port |
Constructor Summary | |
---|---|
private |
SerialIO(SerialParameters parameters)
Creates an instance of SerialIO which represents one serial port. |
Method Summary | |
---|---|
void |
addSerialIOListener(SerialIOListener l)
Adds a MeasurementListener to the project. |
static void |
closeAllPorts()
Closes all open serialports and their streams |
void |
closePort()
Closes this serial port and it's streams |
private void |
debug(SerialIO.LogEvent e,
String message)
Debug logger. |
private void |
fireSerialIOEvent(String message)
Notifies all listeners that have registered for MeasurementEvents. |
String |
getPortName()
|
static SerialIO |
openPort(SerialParameters parameters)
|
private String |
padn(int n)
Zero-paddes a number if it's <10. |
void |
removeSerialIOListener(SerialIOListener l)
Removes a MeasurementListener from the project. |
void |
serialEvent(javax.comm.SerialPortEvent event)
This method is run when a serial message is received from serial port. |
void |
writeMessage(String message)
Writes an ASCII format message to serial port. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final boolean DEBUG
private static final DateFormat dateFormat
private static Vector<SerialIO> openPorts
private EventListenerList listenerList
private javax.comm.SerialPort sPort
private OutputStream os
private InputStream is
private String portName
private BufferedWriter logWriter
private boolean logWriterTriedCreate
Constructor Detail |
---|
private SerialIO(SerialParameters parameters) throws SerialIOException
parameters
- parameters for the serial port being opened.
SerialIOException
- if something goes wrong.Method Detail |
---|
public static SerialIO openPort(SerialParameters parameters) throws SerialIOException
SerialIOException
public void writeMessage(String message) throws SerialIOException
message
- a message to be send
SerialIOException
- if exception occurs.public void closePort()
public static void closeAllPorts()
public void serialEvent(javax.comm.SerialPortEvent event)
serialEvent
in interface javax.comm.SerialPortEventListener
public void addSerialIOListener(SerialIOListener l)
l
- the listener to be added.public void removeSerialIOListener(SerialIOListener l)
l
- the listener to be removedprivate void fireSerialIOEvent(String message)
message
- private void debug(SerialIO.LogEvent e, String message)
e
- LogEvent type.message
- String to write; portname if e==SESSION_START.private String padn(int n)
n
- int to pad.
public String getPortName()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |