|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--advancedrelay.laygo.ProtocolService
Encapsulation of a LayGO CID into a ProtocolService. This module wraps functionality related to LayGO CIDs into a Java object. Clients of this module may retreive the value of the CID for display purposes, but must not use it to directly call Laygo class functions.
Function names follow Java naming conventions. Most functions are straightforward encapsulations of standard LayGO API functions. However, functions return true on success, false on failure. Use getLastError() to retrieve the actual result code. Whenever binary data is passed to the service through parameters byte [] buffer and int size, the data is assumed to be in the first size bytes of the buffer. For complete documentation of each function, see the LayGO API Manual.
Constructor Summary | |
ProtocolService()
Basic constructor for a protocol service. |
|
ProtocolService(int cid)
Constructs a protocol service from an open CID. |
|
ProtocolService(int protocol,
int major,
int minor)
Constructs a protocol service from protocol, major and minor device ids. |
|
ProtocolService(java.lang.String service)
Constructs a protocol service from a service name. |
Method Summary | |
boolean |
attach()
Attach to the service previously detached. |
boolean |
attach(int protocol,
int major,
int minor)
Attach to a service by protocol, major and minor device id. |
boolean |
attach(java.lang.String service)
Attach to a service by name. |
boolean |
clearStatistics()
Clear statistics for the protocol service. |
boolean |
close()
Close an open protocol service. |
boolean |
connectAccept()
Accept a connection without additional data. |
boolean |
connectAccept(byte[] buffer,
int size)
Accept a connection with additional data. |
boolean |
connectReject()
Reject a connection without additional data. |
boolean |
connectReject(byte[] buffer,
int size)
Reject a connection with additional data. |
boolean |
connectRequest()
Request a connection without additional data. |
boolean |
connectRequest(byte[] buffer,
int size)
Request a connection with additional data. |
boolean |
detach()
Detach from the currently open service. |
boolean |
discardData()
Discard the next queued data event. |
boolean |
disconnectConfirm()
Confirm a disconnect without additional data. |
boolean |
disconnectConfirm(byte[] buffer,
int size)
Confirm a disconnect with additional data. |
boolean |
disconnectRequest()
Request a disconnect without additional data. |
boolean |
disconnectRequest(byte[] buffer,
int size)
Request a disconnect with additional data. |
ProtocolEvent |
event()
Read the next queued non-data event. |
int |
getCid()
Returns the CID of the protocol service. |
byte[] |
getConfiguration()
Read the configuration of the protocol service. |
int |
getLastError()
Returns the last error code from the protocol service. |
java.lang.String |
getLastErrorMessage()
Returns a string describing the last error from the protocol service. |
StatisticsTable |
getStatistics()
Read the statistics table of the protocol service. |
StatusReport |
getStatus()
Read the status of the protocol service. |
void |
invalidate()
Special reconstructor for the LayGO Device Library. |
boolean |
ioctl(int function)
Request an IO control function without input or output data. |
boolean |
ioctl(int function,
byte[] bufferIn,
int sizeIn)
Request an IO control function with input data only. |
boolean |
ioctl(int function,
byte[] bufferIn,
int sizeIn,
byte[] bufferOut,
Result sizeOut)
Request an IO control function with both input and output data. |
boolean |
ioctl(int function,
byte[] bufferOut,
Result sizeOut)
Request an IO control function with output data only. |
boolean |
listen()
Request a listen on the protocol service. |
boolean |
listenCancel()
Cancel a listen request on the protocol service. |
boolean |
loadConfiguration(java.lang.String fileName)
Load a configuration from a .cfg file into the protocol service. |
int |
maxBufferSize()
Returns the maxmimum buffer size for data written to the protocol service. |
boolean |
open()
Opens a protocol service previously opened and closed. |
boolean |
open(int cid)
Opens a protocol service by previously opened CID. |
boolean |
open(int protocol,
int major)
Opens a protocol service by protocol and major device id. |
boolean |
open(int protocol,
int major,
int minor)
Opens a protocol service by protocol, major and minor device id. |
boolean |
open(java.lang.String service)
Opens a protocol service by name. |
ProtocolEvent |
poll()
Polls the next queued event, but does not dequeue it. |
boolean |
pop()
Pops the protocol service from the top of the stack. |
int |
protocol()
Return the protocol of the service. |
boolean |
push(ProtocolService stackTop)
Pushes the protocol service onto the top of the stack. |
DataEvent |
read()
Reads the next data event queued for the protocol service. |
DataEvent |
readSpecial()
Reads the next data event with flags queued for the protocol service. |
boolean |
reopen()
Reopens the protocol service. |
boolean |
resetRequest()
Request a reset without additional data. |
boolean |
resetRequest(byte[] buffer,
int size)
Request a reset with additional data. |
boolean |
setConfiguration(byte[] buffer,
int size)
Set the configuration of the protocol service. |
int |
state()
Returns the state of the protocol service. |
java.lang.String |
toString()
Returns a string describing the protocol service. |
boolean |
write(byte[] buffer,
int size)
Writes data through the protocol service. |
boolean |
writeSpecial(byte[] buffer,
int size,
int flags)
Writes data with flags through the protocol service. |
boolean |
xoff()
Requests a protocol xoff. |
boolean |
xon()
Requests a protocol xon. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public ProtocolService()
public ProtocolService(int cid)
cid
- The open CIDpublic ProtocolService(int protocol, int major, int minor)
protocol
- The protocol to openmajor
- The major device idminor
- The minor device idpublic ProtocolService(java.lang.String service)
service
- Service name in the service database.Method Detail |
public boolean attach()
public boolean attach(int protocol, int major, int minor)
protocol
- The protocol to openmajor
- The major device idminor
- The minor device idpublic boolean attach(java.lang.String service)
service
- Service name in the service database.public boolean clearStatistics()
public boolean close()
public boolean connectAccept()
public boolean connectAccept(byte[] buffer, int size)
buffer
- additional datasize
- number of bytes of additional datapublic boolean connectReject()
public boolean connectReject(byte[] buffer, int size)
public boolean connectRequest()
public boolean connectRequest(byte[] buffer, int size)
buffer
- additional datasize
- number of bytes of additional datapublic boolean detach()
public boolean discardData()
public boolean disconnectConfirm()
public boolean disconnectConfirm(byte[] buffer, int size)
buffer
- additional datasize
- number of bytes of additional datapublic boolean disconnectRequest()
public boolean disconnectRequest(byte[] buffer, int size)
buffer
- additional datasize
- number of bytes of additional datapublic ProtocolEvent event()
public int getCid()
public byte[] getConfiguration()
public int getLastError()
public java.lang.String getLastErrorMessage()
public StatisticsTable getStatistics()
public StatusReport getStatus()
public void invalidate()
public boolean ioctl(int function)
function
- IO control function idpublic boolean ioctl(int function, byte[] bufferIn, int sizeIn)
function
- IO control function idbufferIn
- input datasizeIn
- number of bytes of input datapublic boolean ioctl(int function, byte[] bufferIn, int sizeIn, byte[] bufferOut, Result sizeOut)
function
- IO control function idbufferIn
- input datasizeIn
- number of bytes of input databufferOut
- output data buffersizeOut
- number of bytes of output datapublic boolean ioctl(int function, byte[] bufferOut, Result sizeOut)
function
- IO control function idbufferOut
- output data buffersizeOut
- number of bytes of output datapublic boolean listen()
public boolean listenCancel()
public boolean loadConfiguration(java.lang.String fileName)
fileName
- Name of .cfg filepublic int maxBufferSize()
public boolean open()
public boolean open(int cid)
cid
- The open CIDpublic boolean open(int protocol, int major)
protocol
- The protocol to openmajor
- The major device idpublic boolean open(int protocol, int major, int minor)
protocol
- The protocol to openmajor
- The major device idminor
- The minor device idpublic boolean open(java.lang.String service)
service
- Service name in the service database.public ProtocolEvent poll()
public boolean pop()
public int protocol()
public boolean push(ProtocolService stackTop)
stackTop
- service which is currently on top of the stackpublic DataEvent read() throws ProtocolEventException
ProtocolEventException
- The next queued event if not data.public DataEvent readSpecial() throws ProtocolEventException
ProtocolEventException
- The next queued event if not data.public boolean reopen()
public boolean resetRequest()
public boolean resetRequest(byte[] buffer, int size)
buffer
- additional datasize
- number of bytes of additional datapublic boolean setConfiguration(byte[] buffer, int size)
buffer
- configuration datasize
- number of bytes of configuration datapublic int state()
public java.lang.String toString()
toString
in class java.lang.Object
public boolean write(byte[] buffer, int size)
buffer
- data to writesize
- number of bytes of datapublic boolean writeSpecial(byte[] buffer, int size, int flags)
buffer
- data to writesize
- number of bytes of dataflags
- flags to send with datapublic boolean xoff()
public boolean xon()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |