Beware, using yascaif in MATLAB is likely making use of undocumented (unsupported) MATLAB features. This is tested with 2016a, and will likely work back to ~2010 release, but may be broken by changes in future releases.
Requires Java >=1.7
Place jar(s) in matlab class path.
To make use of monitor callbacks with handles,
jars must be in matlab static class path (eg. [prefdir '/javaclasspath.txt']
).
Basic blocking calls will work if in the dynamic class path.
Use pre-build jars or:
git clone https://github.com/mdavidsaver/yascaif.git
cd yascaif
ant
A wrapper around CAJ (Channel Access for Java) library with an API intended for interactive use with shells which can call Java functions, principly MATLAB.
Entry point is yascaif.CA
.
ca = yascaif.CA % use default settings
% manually set max array bytes, address list, and auto-addr-list
ca = yascaif.CA(1000000, "", true)
ca.close() % explicitly close and cleanup
Supports CA get/put operations.
Method names are read/write to a clashing with .get
automagically added by MATLAB.
val = ca.read('pv:name')
ca.write('pv:name', val+1)
% or to put and wait for server completion notification
ca.write('pv:name', val+1, true)
Get with metadata
M = ca.readM('pv:name') % returns value+meta-data wrapper
val = M.getValue
sevr = M.getSevr % integer alarm status
time = M.getTime % double posix timestamp
Subscribe for monitor updates Deliver as callbacks.
mon = ca.monitor('pv:name')
mon = handle(mon, 'CallbackProperties') % needed by matlab >=2014a
set(mon, 'MonitorCallback', @(h,e)disp(e.getValue)) % e is same wrapper as readM()
Deliver via FIFO.
mon = ca.monitor('pv:name')
mon.setCapacity(4) % max. queue size (default 1)
mon.setTimeout(10.0) % or -1 to disable (default 5.0)
M = mon.waitFor() % wait for next update
For testing and troubleshooting a CLI is provided.
java -jar bin/yascaif-bundle-0.4a.jar
Usage: <prog> [-v] [-t timeout] [get|monitor|put] <PV names...>