nl.tbdev.IR
Class Serial
java.lang.Object
|
+--nl.tbdev.IR.Serial
- Direct Known Subclasses:
- SerialTini
- public class Serial
- extends java.lang.Object
Implement the device independend part of the serial communications
for IR usage. For IR internal use only!
|
Method Summary |
static void |
display(java.lang.String comment,
byte[] data,
int len)
display is a helper function usefull during debugging. |
Frame |
readFrame()
read frame from the serial stream, processing special characters |
void |
setLocBofs(int bof)
Set number of BOFs to expect |
void |
setRemBofs(int bof)
Set number of BOFs to be sent |
boolean |
setSpeed(int speed)
Set speed of COMM port |
void |
writeFrame(byte[] frame)
Write the byte array to the output, escapes special characters and
adds leadin and CRC.
NOTE: Minimal implementation only! # XBOFs == default!! |
| Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
XBOF
protected final byte XBOF
BOF
protected final byte BOF
EOF
protected final byte EOF
CE
protected final byte CE
XVAL
protected final byte XVAL
serIn
protected java.io.InputStream serIn
serOut
protected java.io.OutputStream serOut
serialPort
protected javax.comm.SerialPort serialPort
drainPort
protected boolean drainPort
fcs
protected Fcs fcs
lFrame
protected byte[] lFrame
dFrame
protected Frame dFrame
offset
protected int offset
state
protected int state
data
protected byte[] data
garbage
protected byte[] garbage
pos
protected int pos
num
protected int num
remBofs
protected int remBofs
locBofs
protected int locBofs
GARBAGE
protected final int GARBAGE
SYNCING
protected final int SYNCING
XBOFSYNCING
protected final int XBOFSYNCING
READING
protected final int READING
ESCREADING
protected final int ESCREADING
Serial
public Serial()
readFrame
public Frame readFrame()
- read frame from the serial stream, processing special characters
- Returns:
- Frame returns Frame with results of null if no complete
frame could be read or a CRC error occurred.
writeFrame
public void writeFrame(byte[] frame)
- Write the byte array to the output, escapes special characters and
adds leadin and CRC.
NOTE: Minimal implementation only! # XBOFs == default!!
- Parameters:
frame - The array of bytes to be written.
setSpeed
public boolean setSpeed(int speed)
- Set speed of COMM port
- Parameters:
speed - integer value of speed- Returns:
- boolean value indication success/failure
setRemBofs
public void setRemBofs(int bof)
- Set number of BOFs to be sent
- Parameters:
bof - Number of BOFs
setLocBofs
public void setLocBofs(int bof)
- Set number of BOFs to expect
- Parameters:
bof - Number of BOFs
display
public static void display(java.lang.String comment,
byte[] data,
int len)
- display is a helper function usefull during debugging. Dumps the
data in HEX format to standard output.
- Parameters:
comment - Comment to be printed.data - The data to be displayed.len - Length of the data to be displayed. Allows for displaying
part of the array.