|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectorg.mbari.puck.Puck
public abstract class Puck
Define operations that can be performed on an MBARI PUCK. These include operations such as read, write, erase, etc. According to PUCK specification, these operations will be recognized and executed if device is in "PUCK mode" (as opposed to "instrument mode"). Thus the setPuckMode() method should be invoked prior to executing the other methods.
The "PUCK offset" points to the location in PUCK memory to be accessed by the next read() or write() operation; these operations automatically advance the offset by the number of bytes read or written. In addition, the offset can be explicitly set with setOffset().
| Nested Class Summary | |
|---|---|
static class |
Puck.Datasheet
Instrument data sheet associated with PUCK device. |
| Field Summary | |
|---|---|
protected boolean |
_readyToWrite
Indicates that PUCK memory is ready to be written to; set to true by erase(), set to false by flush(). |
| Constructor Summary | |
|---|---|
Puck(gnu.io.SerialPort port)
Create Puck, using specified SerialPort. |
|
| Method Summary | |
|---|---|
void |
close()
Free resources. |
void |
erase()
Erase PUCK payload and set offset to 0. |
boolean |
externalDevice()
Return true if PUCK device is external to instrument. |
void |
flush()
End a PUCK write session; no other write() calls should be attempted following flush(), until a new write session is intiated with erase(). |
protected void |
flushInput()
Discard characters from input until no more are available. |
int |
getOffset()
Return PUCK read/write offset |
void |
getPuckPrompt(int nTries)
Send PUCK "null command" and look for appropriate response. |
abstract int |
getVersionNumber()
Return a version number for the datasheet, per section 4 of the PUCK specification. |
boolean |
hasPayload()
Return true if PUCK has payload space, else return false. |
abstract byte[] |
nullCommand()
Return PUCK "null" command" |
abstract byte[] |
promptString()
Return PUCK prompt string. |
int |
read(byte[] payload,
int offset,
int nBytesRequested)
Read up to nBytesRequested bytes from current PUCK offset into an array of bytes. |
Puck.Datasheet |
readDatasheet()
Read and return PUCK datasheet. |
protected java.lang.String |
readResponse(long timeout)
Read and return PUCK response after trimming whitespace from beginning and end; throw Exception if response contains "ERR". |
void |
setBaud(int baud)
Set baud rate on both sides of comm link. |
int |
setFastBaud()
Configure PUCK interface for highest valid baud, on both sides of serial link. |
void |
setInstrumentMode()
Put device into Instrument mode. |
void |
setOffset(int offset)
Set PUCK read/write offset. |
abstract void |
setPuckMode(int nTries)
Put device into PUCK mode |
int |
size()
Return total size of PUCK storage, in bytes; includes datasheet. |
int |
skipDatasheet()
Move read/write offset to just past datasheet, to beginning of payload section. |
void |
write(byte[] payload)
Write payload bytes, starting at current PUCK offset. |
boolean |
writeableDatasheet()
Return true if datasheet is writeable; else return false |
void |
writeDatasheet(Puck.Datasheet datasheet)
Write datasheet |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected boolean _readyToWrite
| Constructor Detail |
|---|
public Puck(gnu.io.SerialPort port)
throws java.io.IOException,
java.lang.Exception
java.io.IOException
java.lang.Exception| Method Detail |
|---|
public void flush()
throws java.io.IOException,
java.lang.Exception
java.io.IOException
java.lang.Exception
public Puck.Datasheet readDatasheet()
throws java.io.IOException,
java.lang.Exception
java.io.IOException
java.lang.Exception
public void writeDatasheet(Puck.Datasheet datasheet)
throws java.io.IOException,
java.lang.Exception
java.io.IOException
java.lang.Exception
public int skipDatasheet()
throws java.io.IOException,
java.lang.Exception
java.io.IOException
java.lang.Exception
public void setInstrumentMode()
throws java.lang.Exception
java.lang.Exception
public void erase()
throws java.lang.Exception
java.lang.Exception
public void setOffset(int offset)
throws java.lang.Exception
java.lang.Exception
public int getOffset()
throws java.lang.Exception
java.lang.Exception
public void write(byte[] payload)
throws java.io.IOException,
java.lang.Exception
java.io.IOException
java.lang.Exception
public int read(byte[] payload,
int offset,
int nBytesRequested)
throws java.lang.Exception
java.lang.Exception
public void setBaud(int baud)
throws java.lang.Exception
java.lang.Exception
public int setFastBaud()
throws java.io.IOException
java.io.IOException
public int size()
throws java.io.IOException,
java.lang.Exception
java.io.IOException
java.lang.Exception
public void getPuckPrompt(int nTries)
throws java.lang.Exception
java.lang.Exception
protected java.lang.String readResponse(long timeout)
throws java.lang.Exception
java.lang.Exception
public boolean hasPayload()
throws java.lang.Exception
java.lang.Exception
public boolean writeableDatasheet()
throws java.lang.Exception
java.lang.Exception
public boolean externalDevice()
throws java.lang.Exception
java.lang.Exception
public void close()
throws java.io.IOException
java.io.IOException
public abstract void setPuckMode(int nTries)
throws java.io.IOException
java.io.IOExceptionpublic abstract byte[] nullCommand()
public abstract byte[] promptString()
public abstract int getVersionNumber()
protected void flushInput()
throws java.lang.Exception
java.lang.Exception
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||