Main Page | Packages | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

ikayaki.squid.SerialIO Class Reference

List of all members.

Public Member Functions

void writeMessage (String message) throws SerialIOException
void closePort ()
void serialEvent (SerialPortEvent event)
synchronized void addSerialIOListener (SerialIOListener l)
synchronized void removeSerialIOListener (SerialIOListener l)
String getPortName ()

Static Public Member Functions

static SerialIO openPort (SerialParameters parameters) throws SerialIOException
static void closeAllPorts ()

Private Types

enum  LogEvent { SESSION_START, SEND, REVEIVE }

Private Member Functions

 SerialIO (SerialParameters parameters) throws SerialIOException
synchronized void fireSerialIOEvent (String message)
void debug (LogEvent e, String message)
String padn (int n)

Private Attributes

EventListenerList listenerList = new EventListenerList()
SerialPort sPort
OutputStream os
InputStream is
String portName
BufferedWriter logWriter
boolean logWriterTriedCreate = false

Static Private Attributes

static final boolean DEBUG = false
static final DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss.SSS")
static Vector< SerialIOopenPorts = new Vector<SerialIO>()

Detailed Description

This class represents hardware layer to serial port communications.

Author:
Aki Sysmäläinen, Aki Korpua

Definition at line 43 of file SerialIO.java.


Member Enumeration Documentation

enum ikayaki::squid::SerialIO::LogEvent [private]
 

Logwriter event type

Enumeration values:
SESSION_START 
SEND 
REVEIVE 

Definition at line 95 of file SerialIO.java.


Constructor & Destructor Documentation

ikayaki.squid.SerialIO.SerialIO SerialParameters  parameters  )  throws SerialIOException [private]
 

Creates an instance of SerialIO which represents one serial port.

Parameters:
parameters parameters for the serial port being opened.
Exceptions:
SerialIOException if something goes wrong.

Definition at line 105 of file SerialIO.java.

References ikayaki.squid.SerialIO.debug(), and ikayaki.squid.SerialIO.sPort.

Referenced by ikayaki.squid.SerialIO.openPort().

Here is the call graph for this function:


Member Function Documentation

synchronized void ikayaki.squid.SerialIO.addSerialIOListener SerialIOListener  l  ) 
 

Adds a MeasurementListener to the project.

Parameters:
l the listener to be added.

Definition at line 310 of file SerialIO.java.

References ikayaki.squid.SerialIO.listenerList.

Referenced by ikayaki.squid.Degausser.Degausser(), ikayaki.util.SerialProxy.Forwarder.Forwarder(), ikayaki.squid.Handler.Handler(), and ikayaki.squid.Magnetometer.Magnetometer().

static void ikayaki.squid.SerialIO.closeAllPorts  )  [static]
 

Closes all open serialports and their streams

Definition at line 253 of file SerialIO.java.

References ikayaki.squid.SerialIO.closePort(), and ikayaki.squid.SerialIO.openPorts.

Here is the call graph for this function:

void ikayaki.squid.SerialIO.closePort  ) 
 

Closes this serial port and it's streams

Definition at line 234 of file SerialIO.java.

References ikayaki.squid.SerialIO.is, ikayaki.squid.SerialIO.os, and ikayaki.squid.SerialIO.sPort.

Referenced by ikayaki.squid.SerialIO.closeAllPorts().

void ikayaki.squid.SerialIO.debug LogEvent  e,
String  message
[private]
 

Debug logger.

Parameters:
e LogEvent type.
message String to write; portname if e==SESSION_START.

Definition at line 350 of file SerialIO.java.

References ikayaki.squid.SerialIO.SESSION_START.

Referenced by ikayaki.squid.SerialIO.serialEvent(), ikayaki.squid.SerialIO.SerialIO(), and ikayaki.squid.SerialIO.writeMessage().

synchronized void ikayaki.squid.SerialIO.fireSerialIOEvent String  message  )  [private]
 

Notifies all listeners that have registered for MeasurementEvents.

Parameters:
message 

Definition at line 328 of file SerialIO.java.

References ikayaki.squid.SerialIO.listenerList.

Referenced by ikayaki.squid.SerialIO.serialEvent().

String ikayaki.squid.SerialIO.getPortName  ) 
 

Definition at line 399 of file SerialIO.java.

Referenced by ikayaki.util.SerialProxy.Forwarder.serialIOEvent().

static SerialIO ikayaki.squid.SerialIO.openPort SerialParameters  parameters  )  throws SerialIOException [static]
 

Definition at line 178 of file SerialIO.java.

References ikayaki.squid.SerialIO.openPorts, and ikayaki.squid.SerialIO.SerialIO().

Referenced by ikayaki.squid.Handler.Handler(), ikayaki.util.SerialProxy.main(), and ikayaki.squid.SquidEmulator.main().

Here is the call graph for this function:

String ikayaki.squid.SerialIO.padn int  n  )  [private]
 

Zero-paddes a number if it's <10.

Parameters:
n int to pad.
Returns:
padded String.

Definition at line 395 of file SerialIO.java.

synchronized void ikayaki.squid.SerialIO.removeSerialIOListener SerialIOListener  l  ) 
 

Removes a MeasurementListener from the project.

Parameters:
l the listener to be removed

Definition at line 319 of file SerialIO.java.

References ikayaki.squid.SerialIO.listenerList.

void ikayaki.squid.SerialIO.serialEvent SerialPortEvent  event  ) 
 

This method is run when a serial message is received from serial port. It generates a new SerialIOEvent.

Definition at line 262 of file SerialIO.java.

References ikayaki.squid.SerialIO.debug(), ikayaki.squid.SerialIO.fireSerialIOEvent(), and ikayaki.squid.SerialIO.is.

Here is the call graph for this function:

void ikayaki.squid.SerialIO.writeMessage String  message  )  throws SerialIOException
 

Writes an ASCII format message to serial port.

Parameters:
message a message to be send
Exceptions:
SerialIOException if exception occurs.

Definition at line 203 of file SerialIO.java.

References ikayaki.squid.SerialIO.debug(), ikayaki.squid.SerialIO.os, and ikayaki.squid.SerialIO.portName.

Referenced by ikayaki.squid.Degausser.blockingWrite(), ikayaki.squid.SquidFront.initRawActions(), ikayaki.squid.Magnetometer.Magnetometer(), ikayaki.squid.Handler.seekHome(), ikayaki.util.SerialProxy.Forwarder.serialIOEvent(), and ikayaki.squid.SquidEmulator.writeMessage().

Here is the call graph for this function:


Member Data Documentation

final DateFormat ikayaki.squid.SerialIO.dateFormat = new SimpleDateFormat("HH:mm:ss.SSS") [static, private]
 

Definition at line 50 of file SerialIO.java.

final boolean ikayaki.squid.SerialIO.DEBUG = false [static, private]
 

Definition at line 49 of file SerialIO.java.

InputStream ikayaki.squid.SerialIO.is [private]
 

Inputstream of this port

Definition at line 75 of file SerialIO.java.

Referenced by ikayaki.squid.SerialIO.closePort(), and ikayaki.squid.SerialIO.serialEvent().

EventListenerList ikayaki.squid.SerialIO.listenerList = new EventListenerList() [private]
 

Listeners for this port.

Definition at line 60 of file SerialIO.java.

Referenced by ikayaki.squid.SerialIO.addSerialIOListener(), ikayaki.squid.SerialIO.fireSerialIOEvent(), and ikayaki.squid.SerialIO.removeSerialIOListener().

BufferedWriter ikayaki.squid.SerialIO.logWriter [private]
 

Logwriter buffer

Definition at line 85 of file SerialIO.java.

boolean ikayaki.squid.SerialIO.logWriterTriedCreate = false [private]
 

Have we tried to create the log writer? (Don't want to try again if it didn't work.)

Definition at line 90 of file SerialIO.java.

Vector<SerialIO> ikayaki.squid.SerialIO.openPorts = new Vector<SerialIO>() [static, private]
 

All opened serial ports

Definition at line 55 of file SerialIO.java.

Referenced by ikayaki.squid.SerialIO.closeAllPorts(), and ikayaki.squid.SerialIO.openPort().

OutputStream ikayaki.squid.SerialIO.os [private]
 

Outputstream of this port

Definition at line 70 of file SerialIO.java.

Referenced by ikayaki.squid.SerialIO.closePort(), and ikayaki.squid.SerialIO.writeMessage().

String ikayaki.squid.SerialIO.portName [private]
 

Name of this port

Definition at line 80 of file SerialIO.java.

Referenced by ikayaki.squid.SerialIO.writeMessage().

SerialPort ikayaki.squid.SerialIO.sPort [private]
 

This serial port

Definition at line 65 of file SerialIO.java.

Referenced by ikayaki.squid.SerialIO.closePort(), and ikayaki.squid.SerialIO.SerialIO().


The documentation for this class was generated from the following file:
Generated on Fri May 6 16:01:20 2005 for Squid by  doxygen 1.4.1