public class AdsVariableMonitor extends AbstractVariableMonitor
| Modifier and Type | Class and Description |
|---|---|
static class |
AdsVariableMonitor.Test |
| Modifier and Type | Field and Description |
|---|---|
private AdsSocketChannel |
beckhoff
The ADS socket driver for variables retrieval.
|
private boolean |
fixedhandles
If true, we cache the variable handles, thus speeding up by factor 3.
|
private Map<String,AdsValue> |
known
The entire set of variables known in the PLC.
|
private Map<String,Long> |
permanent
The cached handles retrieved only once for each variable list change.
|
| Constructor and Description |
|---|
AdsVariableMonitor(AdsSocketChannel ads)
Construct the monitor with a valid ADS-Socket driver.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
addMonitoring(Collection<String> vars)
Clears any cached variable handles, regardless of the permanent handles
setting.
|
private Map<String,Long> |
getAdsHandles(Collection<String> vars) |
private Map<String,AdsValue> |
getAdsTypes(Collection<String> vars) |
private Map<String,Number> |
getAdsValues(Map<String,Long> handles,
Map<String,AdsValue> skel) |
private Map<String,Object> |
readBeckhoff(Collection<String> vars,
Map<String,AdsValue> skel)
Refreshing a list of variables in a Beckhoff-ADS context means
querying the
underlying socket and returning the result.
|
protected Map<String,Object> |
refreshVariables(Collection<String> vars)
Refreshing a list of variables in a Beckhoff-ADS context means
querying the
underlying socket and returning the result.
|
void |
setKnown(Map<String,AdsValue> known)
Sets the list of all known variables, can be deduced from the driver
info.
|
void |
setPersistentHandles(boolean cachehandles)
If true, we allow caching of the ADS variable handles retrieved once.
|
private boolean |
usedHandles(Collection<Long> handles) |
addCacheChangedListener, addCacheListener, getMonitored, getVariable, isRunning, removeCacheChangedListener, removeCacheListener, removeMonitoring, setLock, startMonitoring, stopMonitoringprivate final AdsSocketChannel beckhoff
private boolean fixedhandles
public AdsVariableMonitor(AdsSocketChannel ads)
props - public void setPersistentHandles(boolean cachehandles)
cachehandles - the cachehandles to setpublic boolean addMonitoring(Collection<String> vars)
addMonitoring in class AbstractVariableMonitorvars - public void setKnown(Map<String,AdsValue> known)
known - the known to setprotected Map<String,Object> refreshVariables(Collection<String> vars)
refreshVariables in class AbstractVariableMonitorvars - Names of all variables that should be refreshedprivate Map<String,Object> readBeckhoff(Collection<String> vars, Map<String,AdsValue> skel) throws IOException
vars - skel - IOExceptionprivate Map<String,AdsValue> getAdsTypes(Collection<String> vars)
private Map<String,Long> getAdsHandles(Collection<String> vars) throws IOException
IOExceptionprivate Map<String,Number> getAdsValues(Map<String,Long> handles, Map<String,AdsValue> skel) throws IOException
IOExceptionprivate boolean usedHandles(Collection<Long> handles) throws IOException
IOException