gov.aps.epics.jca
Class Channel

java.lang.Object
  |
  +--gov.aps.epics.jca.Channel
All Implemented Interfaces:
CaConstants
Direct Known Subclasses:
JNIChannel

public abstract class Channel
extends java.lang.Object
implements CaConstants

The class representing a CA Channel.

A Channel is a link between a client (the application) and a CA process variable located on a CA server. All operations between the client and the process variable are handled by this object of this class.

 // Access a process variable thru a Channel.
 
 try {

   // Create a default context.
   Context theContext= Ca.createContext();

   // Print some info about the context.
   Ca.printInfo(theContext);
   System.out.println();

   // Create a Channel
   Channel theChannel= theContext.createChannel("myProcessVariableName");
   theContext.pendIO(1.0);

   // Print some info about the channel.
   Ca.printInfo(theChannel);
   System.out.println();
 
   // Use the Channel
   theChannel.put(45.5);
   theContext.pendIO(1.0);

   DBR theDBR= theChannel.get();
   theContext.pendIO(1.0);

   // Print some info about the requested value.
   Ca.printInfo(theDBR);
   System.out.println();

   // Clear the channel and destroy the context.
   theChannel.clear();
   theContext.destroy();

 } catch(CaException cae) {
   cae.printStackTrace();
 }

 

See Also:
Ca, Context, DBR

Field Summary
 
Fields inherited from interface gov.aps.epics.jca.CaConstants
CA_K_ERROR, CA_K_FATAL, CA_K_INFO, CA_K_SEVERE, CA_K_SUCCESS, CA_K_WARNING, CA_M_ERROR, CA_M_LEVEL, CA_M_MSG_NO, CA_M_SEVERE, CA_M_SEVERITY, CA_M_SUCCESS, CA_OP_ADD_MONITOR, CA_OP_CLEAR_MONITOR, CA_OP_CONN_DOWN, CA_OP_CONN_UP, CA_OP_FIRST, CA_OP_GET, CA_OP_LAST, CA_OP_OTHER, CA_OP_PUT, CA_OP_SEARCH, CA_OP_STRING, CA_V_MSG_NO, CA_V_SEVERITY, CA_V_SUCCESS, CALLBACK_MODE_FIRST, CALLBACK_MODE_LAST, CALLBACK_MODE_STRING, CS_CLOSED, CS_CONN, CS_FIRST, CS_LAST, CS_NEVER_CONN, CS_PREV_CONN, CS_STRING, DBE_ALARM, DBE_LOG, DBE_VALUE, DBR_BYTE, DBR_CTRL_BYTE, DBR_CTRL_DOUBLE, DBR_CTRL_ENUM, DBR_CTRL_FLOAT, DBR_CTRL_INT, DBR_CTRL_SHORT, DBR_CTRL_STRING, DBR_DOUBLE, DBR_ENUM, DBR_FIRST, DBR_FLOAT, DBR_GR_BYTE, DBR_GR_DOUBLE, DBR_GR_FLOAT, DBR_GR_INT, DBR_GR_SHORT, DBR_GR_STRING, DBR_INT, DBR_LABELS_ENUM, DBR_LAST, DBR_PUT_ACKS, DBR_PUT_ACKT, DBR_SHORT, DBR_STRING, DBR_STS_BYTE, DBR_STS_DOUBLE, DBR_STS_ENUM, DBR_STS_FLOAT, DBR_STS_INT, DBR_STS_SHORT, DBR_STS_STRING, DBR_STSACK_STRING, DBR_TIME_BYTE, DBR_TIME_DOUBLE, DBR_TIME_ENUM, DBR_TIME_FLOAT, DBR_TIME_INT, DBR_TIME_SHORT, DBR_TIME_STRING, DBR_TYPE_STRING, DISABLE_PREEMPTIVE_CALLBACK, ECA_ADDFAIL, ECA_ALLOCMEM, ECA_ANACHRONISM, ECA_BADCHID, ECA_BADCOUNT, ECA_BADFUNCPTR, ECA_BADMASK, ECA_BADMONID, ECA_BADPRIORITY, ECA_BADSTR, ECA_BADSYNCGRP, ECA_BADTYPE, ECA_BUILDGET, ECA_CHANDESTROY, ECA_CHIDNOTFND, ECA_CHIDRETRY, ECA_CONN, ECA_DBLCHNL, ECA_DBLCLFAIL, ECA_DEFUNCT, ECA_DISCONN, ECA_DISCONNCHID, ECA_DLCKREST, ECA_EMPTYSTR, ECA_EVDISALLOW, ECA_FIRST, ECA_GETFAIL, ECA_INTERNAL, ECA_IODONE, ECA_IOINPROGRESS, ECA_ISATTACHED, ECA_LAST, ECA_MAXIOC, ECA_MESSAGE_STRING, ECA_NEEDSFP, ECA_NEWADDR, ECA_NEWCONN, ECA_NOCACTX, ECA_NOCAST, ECA_NOCHANMSG, ECA_NOCONVERT, ECA_NORDACCESS, ECA_NOREPEATER, ECA_NORMAL, ECA_NOSEARCHADDR, ECA_NOSUPPORT, ECA_NOTINSERVICE, ECA_NOTTHREADED, ECA_NOWTACCESS, ECA_OVEVFAIL, ECA_PUTCBINPROG, ECA_PUTFAIL, ECA_SERVBEHIND, ECA_SOCK, ECA_STRTOBIG, ECA_TIMEOUT, ECA_TOLARGE, ECA_UKNCHAN, ECA_UKNFIELD, ECA_UKNHOST, ECA_UKNSERV, ENABLE_PREEMPTIVE_CALLBACK, THREAD_CTRL_EXTERNAL, THREAD_CTRL_FIRST, THREAD_CTRL_INTERNAL, THREAD_CTRL_LAST, THREAD_CTRL_STRING
 
Constructor Summary
Channel()
           
 
Method Summary
abstract  void addAccessRightsListener(gov.aps.epics.jca.AccessRightsListener l)
          Adds a AccessRightsListener which will be notified of the access rights's changes of this Channel.
abstract  void addConnectionListener(gov.aps.epics.jca.ConnectionListener l)
          Adds a ConnectionListener which will be notified of the connection state's changes of this Channel.
abstract  gov.aps.epics.jca.Monitor addMonitorListener(int type, int count, gov.aps.epics.jca.MonitorListener l, int mask)
          Adds a monitor to this Channel with a specified type,count and mask.
 gov.aps.epics.jca.Monitor addMonitorListener(gov.aps.epics.jca.MonitorListener l, int mask)
           
abstract  void destroy()
          Clear the ressources used by this channel.
 gov.aps.epics.jca.dbr.DBR get()
          Reads getElementCount() of getFieldType() elements from this Channel.
 void get(gov.aps.epics.jca.GetListener l)
          Reads getElementCount() of getFieldType() elements from this Channel with a GetListener to be notified when the operation has been completed.
 gov.aps.epics.jca.dbr.DBR get(int count)
          Reads a specified number of getFieldType() elements from this Channel.
 void get(int count, gov.aps.epics.jca.GetListener l)
          Reads a specified number of getFieldType() elements from this Channel with a GetListener to be notified when the operation has been completed.
abstract  gov.aps.epics.jca.dbr.DBR get(int type, int count)
          Reads a specified number of elements of a specified type from this Channel.
abstract  void get(int type, int count, gov.aps.epics.jca.GetListener l)
          Reads a specified number of elements of a specified type from this Channel with a GetListener to be notified when the operation has been completed.
abstract  gov.aps.epics.jca.AccessRightsListener[] getAccessRightsListeners()
          Returns the AccessRightsListener registered with this Channel.
abstract  gov.aps.epics.jca.ConnectionListener[] getConnectionListeners()
          Returns the ConnectionListener registered with this Channel.
abstract  gov.aps.epics.jca.Context getContext()
          Returns the context which created this channel.
abstract  int getElementCount()
          Returns the element count of this Channel.
abstract  int getFieldType()
          Returns the field type of this Channel.
 java.lang.String getFieldTypeString()
          Returns the String representing the field type of this channel.
abstract  java.lang.String getHostName()
          Returns the Channel's hostname.
abstract  java.lang.String getName()
          Returns the name of this Channel.
abstract  boolean getReadAccess()
          Returns whether read operations are allowed on this Channel.
abstract  int getState()
          Returns the connection state of this channel
 java.lang.String getStateString()
           
abstract  boolean getWriteAccess()
          Returns whether write operations are allowed on this Channel.
 void printInfo()
          Prints details information about this Channel to the standard output stream.
 void printInfo(java.io.PrintStream out)
          Prints details information about this Channel to the specified output stream.
 void put(byte value)
          Writes a value to this Channel.
abstract  void put(byte[] value)
          Writes an array to this Channel.
abstract  void put(byte[] value, gov.aps.epics.jca.PutListener l)
          Writes an array to this Channel with a PutListener to be notified when the operation has been completed.
 void put(byte value, gov.aps.epics.jca.PutListener l)
          Writes a value to this Channel with a PutListener to be notified when the operation has been completed.
 void put(double value)
          Writes a value to this Channel.
abstract  void put(double[] value)
          Writes an array to this Channel.
abstract  void put(double[] value, gov.aps.epics.jca.PutListener l)
          Writes an array to this Channel with a PutListener to be notified when the operation has been completed.
 void put(double value, gov.aps.epics.jca.PutListener l)
          Writes a value to this Channel with a PutListener to be notified when the operation has been completed.
 void put(float value)
          Writes a value to this Channel.
abstract  void put(float[] value)
          Writes an array to this Channel.
abstract  void put(float[] value, gov.aps.epics.jca.PutListener l)
          Writes an array to this Channel with a PutListener to be notified when the operation has been completed.
 void put(float value, gov.aps.epics.jca.PutListener l)
          Writes a value to this Channel with a PutListener to be notified when the operation has been completed.
 void put(int value)
          Writes a value to this Channel.
abstract  void put(int[] value)
          Writes an array to this Channel.
abstract  void put(int[] value, gov.aps.epics.jca.PutListener l)
          Writes an array to this Channel with a PutListener to be notified when the operation has been completed.
 void put(int value, gov.aps.epics.jca.PutListener l)
          Writes a value to this Channel with a PutListener to be notified when the operation has been completed.
 void put(short value)
          Writes a value to this Channel.
abstract  void put(short[] value)
          Writes an array to this Channel.
abstract  void put(short[] value, gov.aps.epics.jca.PutListener l)
          Writes an array to this Channel with a PutListener to be notified when the operation has been completed.
 void put(short value, gov.aps.epics.jca.PutListener l)
          Writes a value to this Channel with a PutListener to be notified when the operation has been completed.
 void put(java.lang.String value)
          Writes a value to this Channel.
abstract  void put(java.lang.String[] value)
          Writes an array to this Channel.
abstract  void put(java.lang.String[] value, gov.aps.epics.jca.PutListener l)
          Writes an array to this Channel with a PutListener to be notified when the operation has been completed.
 void put(java.lang.String value, gov.aps.epics.jca.PutListener l)
          Writes a value to this Channel with a PutListener to be notified when the operation has been completed.
abstract  void removeAccessRightsListener(gov.aps.epics.jca.AccessRightsListener l)
          Removes a AccessRightsListener which will be notified of the access rights's changes of this Channel.
abstract  void removeConnectionListener(gov.aps.epics.jca.ConnectionListener l)
          Removes a ConnectionListener .
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Channel

public Channel()
Method Detail

getContext

public abstract gov.aps.epics.jca.Context getContext()
Returns the context which created this channel.


destroy

public abstract void destroy()
                      throws CaException
Clear the ressources used by this channel. No further access should be made to a channel after it has been cleared.

CaException

getConnectionListeners

public abstract gov.aps.epics.jca.ConnectionListener[] getConnectionListeners()
Returns the ConnectionListener registered with this Channel. Might be null.


addConnectionListener

public abstract void addConnectionListener(gov.aps.epics.jca.ConnectionListener l)
                                    throws CaException
Adds a ConnectionListener which will be notified of the connection state's changes of this Channel.

Parameters:
l - the ConnectionListener to be registered.
CaException

removeConnectionListener

public abstract void removeConnectionListener(gov.aps.epics.jca.ConnectionListener l)
                                       throws CaException
Removes a ConnectionListener .

Parameters:
l - the ConnectionListener to be removed.
CaException

getAccessRightsListeners

public abstract gov.aps.epics.jca.AccessRightsListener[] getAccessRightsListeners()
Returns the AccessRightsListener registered with this Channel. Might be null.


addAccessRightsListener

public abstract void addAccessRightsListener(gov.aps.epics.jca.AccessRightsListener l)
                                      throws CaException
Adds a AccessRightsListener which will be notified of the access rights's changes of this Channel.

Parameters:
l - the ConnectionListener to be registered.
CaException

removeAccessRightsListener

public abstract void removeAccessRightsListener(gov.aps.epics.jca.AccessRightsListener l)
                                         throws CaException
Removes a AccessRightsListener which will be notified of the access rights's changes of this Channel.

Parameters:
l - the ConnectionListener to be removed.
CaException

getName

public abstract java.lang.String getName()
Returns the name of this Channel.

Returns:
the name.

getFieldTypeString

public java.lang.String getFieldTypeString()
Returns the String representing the field type of this channel.

Returns:
the field type String.

getFieldType

public abstract int getFieldType()
Returns the field type of this Channel.

Returns:
one of DBR_XXX type.
See Also:
CaConstants

getElementCount

public abstract int getElementCount()
Returns the element count of this Channel.

Returns:
the element count.

getState

public abstract int getState()
Returns the connection state of this channel

Returns:
one of CS_XXX constants.
See Also:
CaConstants

getStateString

public java.lang.String getStateString()

getHostName

public abstract java.lang.String getHostName()
Returns the Channel's hostname.

Returns:
the hostname.

getReadAccess

public abstract boolean getReadAccess()
Returns whether read operations are allowed on this Channel.

Returns:
true is read operations are allowed, false otherwise.

getWriteAccess

public abstract boolean getWriteAccess()
Returns whether write operations are allowed on this Channel.

Returns:
true is write operations are allowed, false otherwise.

put

public void put(byte value)
         throws CaException
Writes a value to this Channel.

Parameters:
value - the value.
CaException

put

public void put(byte value,
                gov.aps.epics.jca.PutListener l)
         throws CaException
Writes a value to this Channel with a PutListener to be notified when the operation has been completed.

Parameters:
value - the value.
CaException

put

public void put(short value)
         throws CaException
Writes a value to this Channel.

Parameters:
value - the value.
CaException

put

public void put(short value,
                gov.aps.epics.jca.PutListener l)
         throws CaException
Writes a value to this Channel with a PutListener to be notified when the operation has been completed.

Parameters:
value - the value.
CaException

put

public void put(int value)
         throws CaException
Writes a value to this Channel.

Parameters:
value - the value.
CaException

put

public void put(int value,
                gov.aps.epics.jca.PutListener l)
         throws CaException
Writes a value to this Channel with a PutListener to be notified when the operation has been completed.

Parameters:
value - the value.
CaException

put

public void put(float value)
         throws CaException
Writes a value to this Channel.

Parameters:
value - the value.
CaException

put

public void put(float value,
                gov.aps.epics.jca.PutListener l)
         throws CaException
Writes a value to this Channel with a PutListener to be notified when the operation has been completed.

Parameters:
value - the value.
CaException

put

public void put(double value)
         throws CaException
Writes a value to this Channel.

Parameters:
value - the value.
CaException

put

public void put(double value,
                gov.aps.epics.jca.PutListener l)
         throws CaException
Writes a value to this Channel with a PutListener to be notified when the operation has been completed.

Parameters:
value - the value.
CaException

put

public void put(java.lang.String value)
         throws CaException
Writes a value to this Channel.

Parameters:
value - the value.
CaException

put

public void put(java.lang.String value,
                gov.aps.epics.jca.PutListener l)
         throws CaException
Writes a value to this Channel with a PutListener to be notified when the operation has been completed.

Parameters:
value - the value.
CaException

put

public abstract void put(byte[] value)
                  throws CaException
Writes an array to this Channel.

Parameters:
value - the value.
CaException

put

public abstract void put(byte[] value,
                         gov.aps.epics.jca.PutListener l)
                  throws CaException
Writes an array to this Channel with a PutListener to be notified when the operation has been completed.

Parameters:
value - the value.
CaException

put

public abstract void put(short[] value)
                  throws CaException
Writes an array to this Channel.

Parameters:
value - the value.
CaException

put

public abstract void put(short[] value,
                         gov.aps.epics.jca.PutListener l)
                  throws CaException
Writes an array to this Channel with a PutListener to be notified when the operation has been completed.

Parameters:
value - the value.
CaException

put

public abstract void put(int[] value)
                  throws CaException
Writes an array to this Channel.

Parameters:
value - the value.
CaException

put

public abstract void put(int[] value,
                         gov.aps.epics.jca.PutListener l)
                  throws CaException
Writes an array to this Channel with a PutListener to be notified when the operation has been completed.

Parameters:
value - the value.
CaException

put

public abstract void put(float[] value)
                  throws CaException
Writes an array to this Channel.

Parameters:
value - the value.
CaException

put

public abstract void put(float[] value,
                         gov.aps.epics.jca.PutListener l)
                  throws CaException
Writes an array to this Channel with a PutListener to be notified when the operation has been completed.

Parameters:
value - the value.
CaException

put

public abstract void put(double[] value)
                  throws CaException
Writes an array to this Channel.

Parameters:
value - the value.
CaException

put

public abstract void put(double[] value,
                         gov.aps.epics.jca.PutListener l)
                  throws CaException
Writes an array to this Channel with a PutListener to be notified when the operation has been completed.

Parameters:
value - the value.
CaException

put

public abstract void put(java.lang.String[] value)
                  throws CaException
Writes an array to this Channel.

Parameters:
value - the value.
CaException

put

public abstract void put(java.lang.String[] value,
                         gov.aps.epics.jca.PutListener l)
                  throws CaException
Writes an array to this Channel with a PutListener to be notified when the operation has been completed.

Parameters:
value - the value.
CaException

get

public gov.aps.epics.jca.dbr.DBR get()
                              throws CaException
Reads getElementCount() of getFieldType() elements from this Channel.

CaException

get

public void get(gov.aps.epics.jca.GetListener l)
         throws CaException
Reads getElementCount() of getFieldType() elements from this Channel with a GetListener to be notified when the operation has been completed.

Parameters:
l - the GetListener.
CaException

get

public gov.aps.epics.jca.dbr.DBR get(int count)
                              throws CaException
Reads a specified number of getFieldType() elements from this Channel.

Parameters:
count - the number of element to read.
CaException

get

public void get(int count,
                gov.aps.epics.jca.GetListener l)
         throws CaException
Reads a specified number of getFieldType() elements from this Channel with a GetListener to be notified when the operation has been completed.

Parameters:
count - the number of element to read.
l - the GetListener.
CaException

get

public abstract gov.aps.epics.jca.dbr.DBR get(int type,
                                              int count)
                                       throws CaException
Reads a specified number of elements of a specified type from this Channel.

Parameters:
count - the number of element to read.
CaException

get

public abstract void get(int type,
                         int count,
                         gov.aps.epics.jca.GetListener l)
                  throws CaException
Reads a specified number of elements of a specified type from this Channel with a GetListener to be notified when the operation has been completed.

Parameters:
type - the element type.
count - the number of element to read.
l - the GetListener.
CaException

addMonitorListener

public abstract gov.aps.epics.jca.Monitor addMonitorListener(int type,
                                                             int count,
                                                             gov.aps.epics.jca.MonitorListener l,
                                                             int mask)
                                                      throws CaException
Adds a monitor to this Channel with a specified type,count and mask.

Parameters:
type - the monitor element type.
count - the monitor element count.
l - the MonitorListener to be notified.
mask - the mask value indicating when the listener need to be notified.
Returns:
the Monitor object representing this monitor.
CaException

addMonitorListener

public gov.aps.epics.jca.Monitor addMonitorListener(gov.aps.epics.jca.MonitorListener l,
                                                    int mask)
                                             throws CaException
CaException

printInfo

public void printInfo()
Prints details information about this Channel to the standard output stream.


printInfo

public void printInfo(java.io.PrintStream out)
Prints details information about this Channel to the specified output stream.