|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectSerialio.SerLooker
Looks for things to happen on the serial port object.
| Field Summary | |
protected SerialPort |
sp
|
| Constructor Summary | |
SerLooker()
Create a serial port 'looker'. |
|
SerLooker(SerialPort sp)
Create a serial port 'looker'. |
|
SerLooker(SerialPort sp,
int bufSize)
Create a serial port 'looker' with a specific save data buffer. |
|
| Method Summary | |
void |
abort()
Aborts a waitFor operation in progress. |
int |
getAbortCheck()
Deprecated. The method is no longer required |
byte[] |
getData()
Returns the data received while the port was waiting for specific data. |
byte[] |
getDataItemSighted()
Returns the data item that was sighted. |
int |
getNapTime()
Get the sleep interval used when waiting for data |
int |
getRcvCount()
Returns the number of bytes received while the port was waiting for specific data. |
boolean |
getSaveReset()
Get the saveReset flag. |
SerialPort |
getSerialPort(SerialPort sp)
Gets the serial port object |
void |
setAbortCheck(int per)
Deprecated. The method is no longer required since the port timout (setTimeoutRx) value is always 0. |
void |
setNapTime(int napTime)
Set the sleep interval used when waiting for data Note: SerialPort.setTimeoutRx is not used to allow quick aborts on some platforms (esp WinNT) where some threading behaviour is not well behaved. |
void |
setSaveData(int bufSize)
Controls if the object saves data when waiting for a specific response. |
void |
setSaveDataBeforeMatch(boolean onOff)
Sets the object to save data before the match. |
void |
setSaveReset(boolean onOff)
Set the saveReset flag. |
void |
setSerialPort(SerialPort sp)
Sets the serial port object |
void |
setShowBytesAsReceived(boolean onOff)
Sets the object to show each byte to the console as received Setting this true can be handy for debugging & sanity checks. |
boolean |
waitFor(byte[] snd,
byte[] rcv,
int tmo)
Send data (optional) and wait for a specific response. |
boolean |
waitFor(byte[] snd,
int waitForCount,
int tmo)
Send data (optional) and wait for count bytes in the input queue. |
boolean |
waitFor(byte[] snd,
java.util.Vector lookForList,
int tmo)
Send data (optional) and wait for any of a list of responses. |
boolean |
waitFor(java.lang.String Ssnd,
java.lang.String Srcv,
int tmo)
Send data (optional) and wait for a specific response. |
boolean |
waitFor(java.lang.String Ssnd,
java.util.Vector lookForList,
int tmo)
Send data (optional) and wait for any of a list of responses. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected SerialPort sp
| Constructor Detail |
public SerLooker()
public SerLooker(SerialPort sp)
sp - a valid SerialPort object
public SerLooker(SerialPort sp,
int bufSize)
sp - a valid SerialPort objectbufSize - size of buffer used when looking for desired data| Method Detail |
public boolean waitFor(byte[] snd,
int waitForCount,
int tmo)
throws java.io.IOException
snd - data to send (currently only UTF8 data is sent)tmo - timeout in milliseconds if cnt bytes not available within tmo
java.io.IOException - if error
public boolean waitFor(java.lang.String Ssnd,
java.lang.String Srcv,
int tmo)
throws java.io.IOException
tmo - timeout in milliseconds if Srcv string not found
java.io.IOException - if error
public boolean waitFor(byte[] snd,
byte[] rcv,
int tmo)
throws java.io.IOException
tmo - timeout in milliseconds if Srcv string not found
java.io.IOException - if error
public boolean waitFor(java.lang.String Ssnd,
java.util.Vector lookForList,
int tmo)
throws java.io.IOException
Ssnd - string to send (currently only UTF8 data is sent)tmo - timeout in milliseconds if none of the data patterns sighted
java.io.IOException - if error
public boolean waitFor(byte[] snd,
java.util.Vector lookForList,
int tmo)
throws java.io.IOException
snd - data to send (currently only UTF8 data is sent)tmo - timeout in milliseconds if none of the data patterns sighted
java.io.IOException - if error
Note: on some platforms (e.g. WinNT 4) using waitFor when setTimeoutRx(n)
where n is greater than 0, AND there is data in the input queue, can cause
data in the queue to be lost due to OS driver issues.public void setSaveData(int bufSize)
bufSize - Sets the size of the save buffer (0 turns saving off)public void setNapTime(int napTime)
napTime - The time to sleep between checks for datapublic int getNapTime()
public int getRcvCount()
public void abort()
public void setSerialPort(SerialPort sp)
sp - a valid SerialPort objectpublic SerialPort getSerialPort(SerialPort sp)
public void setAbortCheck(int per)
public int getAbortCheck()
public void setSaveReset(boolean onOff)
onOff - State for save buffer resetpublic boolean getSaveReset()
public byte[] getDataItemSighted()
public void setShowBytesAsReceived(boolean onOff)
public void setSaveDataBeforeMatch(boolean onOff)
public byte[] getData()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||