cdev
Class ControlSystem

java.lang.Object
  |
  +--cdev.ControlSystem

public class ControlSystem
extends java.lang.Object
implements java.lang.Runnable


Field Summary
static byte CDEV_ACCESSCHANGED
          Change in access permission of device.
static byte CDEV_CONFLICT
          Conflicts of data types or tags.
static byte CDEV_CONVERT
          cdev.Data conversion error.
static byte CDEV_DELETE_CALLBACK
          The callback object will be deleted
static byte CDEV_DISCONNECTED
          Channel has been disconnected.
static byte CDEV_ERROR
          Errors that are not in any categories.
static byte CDEV_INCOMPLETE
          More data to come.
static byte CDEV_INVALIDARG
          Invalid argument passed to cdev calls
static byte CDEV_INVALIDOBJ
          Invalid CDEV objects.
static byte CDEV_INVALIDOP
          Operation is unsupported.
static byte CDEV_INVALIDSVC
          Wrong service during dynamic loading.
static byte CDEV_IOFAILED
          Low level network service IO failed.
static byte CDEV_NOACCESS
          Insufficient access to perform request.
static byte CDEV_NOTCONNECTED
          CSystem not connected to low network service.
static byte CDEV_NOTFOUND
          CDEV cannot find user request.
static byte CDEV_OUTOFRANGE
          Value out of range for device attribute.
static byte CDEV_RECONNECTED
          Channel has been reconnected.
static byte CDEV_SUCCESS
          CDEV success.
static byte CDEV_TIMEOUT
          Time out.
static byte CDEV_WARNING
          Failure is non-consequential.
 
Constructor Summary
ControlSystem()
          Constructor.
ControlSystem(java.lang.String name)
          Construct a ControlSystem object with a given name.
 
Method Summary
 void connect(java.lang.String host, int port)
           
 void disconnect()
           
static DeviceTransaction findTransaction(int trnum)
          findTransaction: Called by IOService to find a pending transaction based upon the transaction number (used for bookkeeping).
 void finish()
          Finish all use of this ControlSystem.
 void flush()
          Flushes any pending I/O to the server(s).
static ControlSystem getDefault()
          Get the default ControlSystem object.
static ControlSystem getDefault(java.lang.String name)
          Get the default ControlSystem object for a given name.
 Device getDevice(java.lang.String name)
          Device factory method.
 java.lang.String getHostname()
           
 java.lang.String getHostName()
           
 java.lang.String getName()
           
 int getPort()
           
static void handleResponse(int trnum, int status, Data results, DeviceError err)
          handleResponse: Called by IOService to deliver results from an earlier transaction posting.
 boolean isConnected()
           
 void pend()
          Wait for server responses for the default duration.
 void pend(double sec)
          Wait for server responses for the given duration.
 void pend(long millisec)
          Wait for server responses for the given duration.
 void reconnect()
           
 void registerIOService(IOService s)
          Register an IOService with this ControlSystem
 void resumeIO()
          Resume I/O
 void run()
           
 void suspendIO()
          Suspend I/O
 java.lang.String txTableToString(java.lang.String title)
          Convert the transaction table to a String.
 void unregisterIOService(IOService s)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CDEV_WARNING

public static final byte CDEV_WARNING
Failure is non-consequential.

CDEV_ERROR

public static final byte CDEV_ERROR
Errors that are not in any categories.

CDEV_SUCCESS

public static final byte CDEV_SUCCESS
CDEV success.

CDEV_INVALIDOBJ

public static final byte CDEV_INVALIDOBJ
Invalid CDEV objects.

CDEV_INVALIDARG

public static final byte CDEV_INVALIDARG
Invalid argument passed to cdev calls

CDEV_INVALIDSVC

public static final byte CDEV_INVALIDSVC
Wrong service during dynamic loading.

CDEV_INVALIDOP

public static final byte CDEV_INVALIDOP
Operation is unsupported.

CDEV_NOTCONNECTED

public static final byte CDEV_NOTCONNECTED
CSystem not connected to low network service.

CDEV_IOFAILED

public static final byte CDEV_IOFAILED
Low level network service IO failed.

CDEV_CONFLICT

public static final byte CDEV_CONFLICT
Conflicts of data types or tags.

CDEV_NOTFOUND

public static final byte CDEV_NOTFOUND
CDEV cannot find user request.

CDEV_TIMEOUT

public static final byte CDEV_TIMEOUT
Time out.

CDEV_CONVERT

public static final byte CDEV_CONVERT
cdev.Data conversion error.

CDEV_OUTOFRANGE

public static final byte CDEV_OUTOFRANGE
Value out of range for device attribute.

CDEV_NOACCESS

public static final byte CDEV_NOACCESS
Insufficient access to perform request.

CDEV_ACCESSCHANGED

public static final byte CDEV_ACCESSCHANGED
Change in access permission of device.

CDEV_DISCONNECTED

public static final byte CDEV_DISCONNECTED
Channel has been disconnected.

CDEV_RECONNECTED

public static final byte CDEV_RECONNECTED
Channel has been reconnected.

CDEV_DELETE_CALLBACK

public static final byte CDEV_DELETE_CALLBACK
The callback object will be deleted

CDEV_INCOMPLETE

public static final byte CDEV_INCOMPLETE
More data to come.
Constructor Detail

ControlSystem

public ControlSystem()
              throws java.io.IOException
Constructor.

ControlSystem

public ControlSystem(java.lang.String name)
              throws java.io.IOException
Construct a ControlSystem object with a given name.
Parameters:
name - The name of the ControlSystem
Method Detail

getName

public java.lang.String getName()

getDefault

public static ControlSystem getDefault(java.lang.String name)
                                throws java.io.IOException
Get the default ControlSystem object for a given name.
Parameters:
name - The name of the ControlSystem.

getDefault

public static ControlSystem getDefault()
                                throws java.io.IOException
Get the default ControlSystem object.

registerIOService

public void registerIOService(IOService s)
Register an IOService with this ControlSystem

unregisterIOService

public void unregisterIOService(IOService s)

flush

public void flush()
           throws java.io.IOException
Flushes any pending I/O to the server(s).

connect

public void connect(java.lang.String host,
                    int port)
             throws java.lang.Exception

disconnect

public void disconnect()
                throws java.io.IOException

reconnect

public void reconnect()
               throws java.lang.Exception

isConnected

public boolean isConnected()
                    throws java.io.IOException

getHostname

public java.lang.String getHostname()
                             throws java.io.IOException

getHostName

public java.lang.String getHostName()
                             throws java.io.IOException

getPort

public int getPort()
            throws java.io.IOException

getDevice

public Device getDevice(java.lang.String name)
                 throws java.io.IOException
Device factory method. Currently just invokes device constructor. Provides backward compatibility with CDEV 1.x, plus future options.
Parameters:
name - Name of the device to get.

pend

public void pend()
          throws java.io.IOException
Wait for server responses for the default duration. Note that events may be delivered before a pend() is called.

pend

public void pend(double sec)
          throws java.io.IOException
Wait for server responses for the given duration. If "millisec" is 0, pend will NEVER return.
Parameters:
sec - The pend period in seconds. If < 0.001, then pend forever!

pend

public void pend(long millisec)
          throws java.io.IOException
Wait for server responses for the given duration. If "millisec" is 0, pend will NEVER return.
Parameters:
millisec - The pend period in milliseconds. If 0, then pend forever!

findTransaction

public static final DeviceTransaction findTransaction(int trnum)
findTransaction: Called by IOService to find a pending transaction based upon the transaction number (used for bookkeeping).

handleResponse

public static void handleResponse(int trnum,
                                  int status,
                                  Data results,
                                  DeviceError err)
handleResponse: Called by IOService to deliver results from an earlier transaction posting. Prior to this call, the IOService must update the data, error, and state fields of the transaction.
Parameters:
dt - DeviceTransaction

run

public void run()
Specified by:
run in interface java.lang.Runnable

suspendIO

public void suspendIO()
               throws java.io.IOException
Suspend I/O

resumeIO

public void resumeIO()
              throws java.lang.Exception
Resume I/O

finish

public void finish()
Finish all use of this ControlSystem. Use of this object after calling finish() is undefined.

txTableToString

public java.lang.String txTableToString(java.lang.String title)
Convert the transaction table to a String. The Title is prepended to the result.