public abstract class Channel extends Object
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 objects of this class.
The following code shows how to synchronously create a channel.
try {
JCALibrary jca= JCALibrary.getInstance();
Context ctxt= jca.createContext(JCALibrary.JNI_THREAD_SAFE);
Channel ch= ctxt.createChannel("my.Channel");
ctxt.pendIO(1.0);
... // If we're here, then the channel has been found and connected.
...
ch.destroy();
ctxt.destroy();
} catch(CAException caEx) {
System.err.println("A Error occured: "+caEx);
}
The following code shows how to asynchronously create a channel.
try {
JCALibrary jca= JCALibrary.getInstance();
Context ctxt= jca.createContext(JCALibrary.JNI_THREAD_SAFE);
Channel ch= ctxt.createChannel("my.Channel", new ConnectionListener() {
public void connectionChanged(ConnectionEvent ev) {
System.out.println("Channel is connected: "+ev.isConnected());
});
ctxt.flushIO();
... // We have no clue on whether the channel has been found and connected.
... // until the connection callback is called.
... //
ch.destroy();
ctxt.destroy();
} catch(CAException caEx) {
System.err.println("A Error occured: "+caEx);
}
Context| Modifier and Type | Class and Description |
|---|---|
static class |
Channel.ConnectionState
Enumeration class representing the Channel's connection state.
|
| Modifier and Type | Field and Description |
|---|---|
static Channel.ConnectionState |
CLOSED
Channel has been closed and destroyed.
|
static Channel.ConnectionState |
CONNECTED
Channel is connected.
|
static Channel.ConnectionState |
DISCONNECTED
Channel is disconnected.
|
static Channel.ConnectionState |
NEVER_CONNECTED
Channel has never been connected.
|
static short |
PRIORITY_ARCHIVE
Archive priority.
|
static short |
PRIORITY_DEFAULT
Default priority.
|
static short |
PRIORITY_LINKS_DB
DB links priority.
|
static short |
PRIORITY_MAX
Maximal priority.
|
static short |
PRIORITY_MIN
Minimal priority.
|
static short |
PRIORITY_OPI
OPI priority.
|
| Constructor and Description |
|---|
Channel() |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
addAccessRightsListener(AccessRightsListener l)
Adds a AccessRightsListener which will be notified of the access rights's changes of this Channel.
|
abstract void |
addConnectionListener(ConnectionListener l)
Adds a ConnectionListener which will be notified of the connection state's changes of this Channel.
|
Monitor |
addMonitor(DBRType type,
int count,
int mask)
Add a monitor to this channel.
|
abstract Monitor |
addMonitor(DBRType type,
int count,
int mask,
MonitorListener l)
Adds a monitor to this Channel.
|
Monitor |
addMonitor(int mask)
Add a monitor to this channel using the channel's native DBR type and count.
|
Monitor |
addMonitor(int mask,
MonitorListener l)
Add a monitor to this channel using the channel's native DBR type and count.
|
protected void |
checkMonitorSize(DBRType type,
int count,
int maxArrayBytes)
Checks whether the size of this monitor is greater than maxArrayBytes,
and throws an exception if it is.
|
abstract void |
destroy()
Clear the ressources used by this channel.
|
void |
dispose() |
DBR |
get()
Synchronously reads this Channel's value using the native DBR type and count.
|
abstract DBR |
get(DBRType type,
int count)
Synchronously Reads a specified number of elements of a specified type from this Channel.
|
abstract void |
get(DBRType type,
int count,
GetListener l)
Asynchronously reads a specified number of elements of a specified type from this Channel
|
void |
get(GetListener l)
Asynchronously reads this Channel's value using the native DBR type and count.
|
DBR |
get(int count)
Synchronously Reads a specified number elements from this Channel value using the native DBR type.
|
void |
get(int count,
GetListener l)
Asynchronously Reads a specified number from this Channel's value using the native DBR type.
|
abstract AccessRightsListener[] |
getAccessRightsListeners()
Returns the AccessRightsListeners registered with this channel.
|
abstract ConnectionListener[] |
getConnectionListeners()
Returns the ConnectionListeners registered with this channel.
|
abstract Channel.ConnectionState |
getConnectionState()
Returns the connection state of this channel.
|
abstract Context |
getContext()
Returns the context which created this channel.
|
abstract int |
getElementCount()
Returns the element count of this channel.
|
abstract DBRType |
getFieldType()
Returns the DBR type of this Channel.
|
abstract String |
getHostName()
Returns the Channel's hostname.
|
abstract String |
getName()
Returns the name of this channel.
|
abstract boolean |
getReadAccess()
Returns whether read operations are allowed on this Channel.
|
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(PrintStream out)
Prints details information about this Channel to the specified output stream.
|
void |
put(byte value)
Synchronously writes a value to this Channel.
|
abstract void |
put(byte[] value)
Synchronously writes an array to this Channel.
|
abstract void |
put(byte[] value,
PutListener l)
Asynchronously writes an array to this Channel.
|
void |
put(byte value,
PutListener l)
Asynchronously writes a value to this Channel.
|
void |
put(double value)
Synchronously writes a value to this Channel.
|
abstract void |
put(double[] value)
Synchronously writes an array to this Channel.
|
abstract void |
put(double[] value,
PutListener l)
Asynchronously writes an array to this Channel.
|
void |
put(double value,
PutListener l)
Asynchronously writes a value to this Channel.
|
void |
put(float value)
Synchronously writes a value to this Channel.
|
abstract void |
put(float[] value)
Synchronously writes an array to this Channel.
|
abstract void |
put(float[] value,
PutListener l)
Asynchronously writes an array to this Channel.
|
void |
put(float value,
PutListener l)
Asynchronously writes a value to this Channel.
|
void |
put(int value)
Synchronously writes a value to this Channel.
|
abstract void |
put(int[] value)
Synchronously writes an array to this Channel.
|
abstract void |
put(int[] value,
PutListener l)
Asynchronously writes an array to this Channel.
|
void |
put(int value,
PutListener l)
Asynchronously writes a value to this Channel.
|
void |
put(short value)
Synchronously writes a value to this Channel.
|
abstract void |
put(short[] value)
Synchronously writes an array to this Channel.
|
abstract void |
put(short[] value,
PutListener l)
Asynchronously writes an array to this Channel.
|
void |
put(short value,
PutListener l)
Asynchronously writes a value to this Channel.
|
void |
put(String value)
Synchronously writes a value to this Channel.
|
abstract void |
put(String[] value)
Synchronously writes an array to this Channel.
|
abstract void |
put(String[] value,
PutListener l)
Asynchronously writes an array to this Channel.
|
void |
put(String value,
PutListener l)
Asynchronously writes a value to this Channel.
|
abstract void |
putACKS(Severity severity)
Synchronously writes an Alarm Acknowledge Severity value to this Channel.
|
abstract void |
putACKS(Severity severity,
PutListener l)
Asynchronously writes an Alarm Acknowledge Severity value to this Channel.
|
abstract void |
putACKT(boolean value)
Synchronously writes an Alarm Acknowledge Transient value to this Channel.
|
abstract void |
putACKT(boolean value,
PutListener l)
Asynchronously writes an Alarm Acknowledge Transient value to this Channel.
|
abstract void |
removeAccessRightsListener(AccessRightsListener l)
Removes a AccessRightsListener which will be notified of the access rights's changes of this Channel.
|
abstract void |
removeConnectionListener(ConnectionListener l)
Removes a ConnectionListener .
|
public static final Channel.ConnectionState NEVER_CONNECTED
public static final Channel.ConnectionState DISCONNECTED
public static final Channel.ConnectionState CONNECTED
public static final Channel.ConnectionState CLOSED
public static final short PRIORITY_MIN
public static final short PRIORITY_MAX
public static final short PRIORITY_DEFAULT
public static final short PRIORITY_LINKS_DB
public static final short PRIORITY_ARCHIVE
public static final short PRIORITY_OPI
public abstract Context getContext() throws IllegalStateException
IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)public abstract void destroy()
throws CAException,
IllegalStateException
IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)CAExceptionpublic abstract ConnectionListener[] getConnectionListeners() throws IllegalStateException
IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)public abstract void addConnectionListener(ConnectionListener l) throws CAException, IllegalStateException
l - the ConnectionListener to register.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)public abstract void removeConnectionListener(ConnectionListener l) throws CAException, IllegalStateException
l - the ConnectionListener to remove.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)public abstract AccessRightsListener[] getAccessRightsListeners() throws IllegalStateException
IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)public abstract void addAccessRightsListener(AccessRightsListener l) throws CAException, IllegalStateException
l - the ConnectionListener to register.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)public abstract void removeAccessRightsListener(AccessRightsListener l) throws CAException, IllegalStateException
l - the ConnectionListener to remove.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)public abstract String getName() throws IllegalStateException
IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)public abstract DBRType getFieldType() throws IllegalStateException
IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)DBRpublic abstract int getElementCount()
throws IllegalStateException
IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)public abstract Channel.ConnectionState getConnectionState() throws IllegalStateException
IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)Channel.ConnectionStatepublic abstract String getHostName() throws IllegalStateException
IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)public abstract boolean getReadAccess()
throws IllegalStateException
IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)public abstract boolean getWriteAccess()
throws IllegalStateException
IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)public void put(byte value)
throws CAException,
IllegalStateException
value - the value.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)public void put(byte value,
PutListener l)
throws CAException,
IllegalStateException
value - the value.l - the PutListener to notify when the request has been completed.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)public void put(short value)
throws CAException,
IllegalStateException
value - the value.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)public void put(short value,
PutListener l)
throws CAException,
IllegalStateException
value - the value.l - the PutListener to notify when the request has been completed.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)public void put(int value)
throws CAException,
IllegalStateException
value - the value.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)public void put(int value,
PutListener l)
throws CAException,
IllegalStateException
value - the value.l - the PutListener to notify when the request has been completed.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)public void put(float value)
throws CAException,
IllegalStateException
value - the value.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)public void put(float value,
PutListener l)
throws CAException,
IllegalStateException
value - the value.l - the PutListener to notify when the request has been completed.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)public void put(double value)
throws CAException,
IllegalStateException
value - the value.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)public void put(double value,
PutListener l)
throws CAException,
IllegalStateException
value - the value.l - the PutListener to notify when the request has been completed.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)public void put(String value) throws CAException, IllegalStateException
value - the value.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)public void put(String value, PutListener l) throws CAException, IllegalStateException
value - the value.l - the PutListener to notify when the request has been completed.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)public abstract void put(byte[] value)
throws CAException,
IllegalStateException
value - the value.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)public abstract void put(byte[] value,
PutListener l)
throws CAException,
IllegalStateException
value - the value.l - the PutListener to notify when the request has been completed.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)public abstract void put(short[] value)
throws CAException,
IllegalStateException
value - the value.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)public abstract void put(short[] value,
PutListener l)
throws CAException,
IllegalStateException
value - the value.l - the PutListener to notify when the request has been completed.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)public abstract void put(int[] value)
throws CAException,
IllegalStateException
value - the value.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)public abstract void put(int[] value,
PutListener l)
throws CAException,
IllegalStateException
value - the value.l - the PutListener to notify when the request has been completed.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)public abstract void put(float[] value)
throws CAException,
IllegalStateException
value - the value.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)public abstract void put(float[] value,
PutListener l)
throws CAException,
IllegalStateException
value - the value.l - the PutListener to notify when the request has been completed.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)public abstract void put(double[] value)
throws CAException,
IllegalStateException
value - the value.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)public abstract void put(double[] value,
PutListener l)
throws CAException,
IllegalStateException
value - the value.l - the PutListener to notify when the request has been completed.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)public abstract void put(String[] value) throws CAException, IllegalStateException
value - the value.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)public abstract void put(String[] value, PutListener l) throws CAException, IllegalStateException
value - the value.l - the PutListener to notify when the request has been completed.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)public abstract void putACKT(boolean value)
throws CAException,
IllegalStateException
value - the value, true equals YES and false equals NO.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)public abstract void putACKT(boolean value,
PutListener l)
throws CAException,
IllegalStateException
value - the value, true equals YES and false equals NO.l - the PutListener to notify when the request has been completed.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)public abstract void putACKS(Severity severity) throws CAException, IllegalStateException
severity - to acknowledge.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)public abstract void putACKS(Severity severity, PutListener l) throws CAException, IllegalStateException
severity - to acknowledge.l - the PutListener to notify when the request has been completed.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)public DBR get() throws CAException, IllegalStateException
CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)public void get(GetListener l) throws CAException, IllegalStateException
l - the GetListener to notify when the request has been completed.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)public DBR get(int count) throws CAException, IllegalStateException
count - the number of element to read.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)public void get(int count,
GetListener l)
throws CAException,
IllegalStateException
count - the number of element to read.l - the GetListener to notify when the request has been completed.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)public abstract DBR get(DBRType type, int count) throws CAException, IllegalStateException
type - the DBR type to read.count - the number of element to read.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)public abstract void get(DBRType type, int count, GetListener l) throws CAException, IllegalStateException
type - the DBR type.count - the number of element to read.l - the GetListener to notify when the request has been completed.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)public Monitor addMonitor(int mask) throws CAException, IllegalStateException
mask - the mask value indicating when the listener need to be notified.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)public Monitor addMonitor(int mask, MonitorListener l) throws CAException, IllegalStateException
mask - the mask value indicating when the listener need to be notified.l - a MonitorListener to be notified when the value/log/alarm changed.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)Monitorpublic Monitor addMonitor(DBRType type, int count, int mask) throws CAException, IllegalStateException
type - the monitor's type.count - the monitor's element count.mask - the mask value indicating when the listener need to be notified.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)public abstract Monitor addMonitor(DBRType type, int count, int mask, MonitorListener l) throws CAException, IllegalStateException
type - the monitor's type.count - the monitor's element count.mask - the mask value indicating when the listener need to be notified.l - a MonitorListener to be notified when the value/log/alarm changed.CAException - if a Channel Exception occured while performing this operation.IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)Monitorprotected void checkMonitorSize(DBRType type, int count, int maxArrayBytes)
type - type for the monitorcount - size of the monitormaxArrayBytes - maximum size of the arraypublic void printInfo()
throws IllegalStateException
IllegalStateException - if the channel is in no state to perform this operation (ie destroyed, etc...)public void printInfo(PrintStream out) throws IllegalStateException
out - the output stream.IllegalStateExceptionpublic void dispose()
Copyright © 2004-2020 EPICS. All Rights Reserved.