added support for privider ca; many minor changes; note exampleDatabaseEasyPVA.zip changed
This commit is contained in:
2
Doxyfile
2
Doxyfile
@ -1078,7 +1078,7 @@ HTML_EXTRA_STYLESHEET =
|
||||
# files will be copied as-is; there are no commands or markers available.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
#HTML_EXTRA_FILES = documentation/overview.html
|
||||
HTML_EXTRA_FILES = documentation/overview.html
|
||||
|
||||
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
|
||||
# will adjust the colors in the stylesheet and background images according to
|
||||
|
@ -28,14 +28,16 @@
|
||||
<h1>EPICS easyPVA</h1>
|
||||
<!-- Maturity: Working Draft or Request for Comments, or Recommendation, and date. -->
|
||||
<h2 class="nocount">EPICS V4 Working Group, Working Draft,
|
||||
13-Mar-2015</h2>
|
||||
25-Mar-2015</h2>
|
||||
<dl>
|
||||
<dt>This version:</dt>
|
||||
<dd><a
|
||||
href="easyPVA.html">easyPVA.html
|
||||
</a> </dd>
|
||||
<dt>Latest version:</dt>
|
||||
<dd>none</dd>
|
||||
<dd><a
|
||||
href="easyPVA_20150325.html">easyPVA_20150325.html</a>
|
||||
</dd>
|
||||
<dt>Previous version:</dt>
|
||||
<dd>none</dd>
|
||||
<dt>Editors:</dt>
|
||||
@ -61,12 +63,13 @@ scalar and scalarArray data types.
|
||||
Additional methods provide access to the full features of pvAccess.
|
||||
</p>
|
||||
<p>
|
||||
EasyMultiChannel provides access to data from multiple channels as long
|
||||
as each channel has a top level field named <b>value</b>.
|
||||
EasyMultiChannel provides two ways to access data from multiple channels:
|
||||
The first is as an NTMultiChannel. The second is as a double array.
|
||||
The double array can be used if the value field of every channel is a numeric scalar.
|
||||
There is code for NTMultiChannel that helps with access to more complicated data types.
|
||||
EasyMultiChannel provides access to data from multiple channels.
|
||||
It can be used directly by a client or via EasyMultiDouble or EasyNTMultiChannel.
|
||||
EasyMultiDouble allows the client to get and put data to multiple channels.
|
||||
But each channel must have a value field that is a numeric scalar.
|
||||
EasyNTMultiChannel allows the client to get and put data to multiple channels.
|
||||
Each channel must have a value field.
|
||||
The data for the channels is presented via normative type NTMultiChannel.
|
||||
</p>
|
||||
<!-- last para of Abstract is boilerplate reference to EPICS -->
|
||||
<p>For more information about EPICS generally, please refer to the home page of the <a
|
||||
@ -77,7 +80,7 @@ There is code for NTMultiChannel that helps with access to more complicated data
|
||||
|
||||
<h2 class="nocount">Status of this Document and of the EasyPVA Software</h2>
|
||||
|
||||
<p>Under development</p>
|
||||
<p>EasyPVACPP is ready for use.</p>
|
||||
|
||||
</div> <!-- head -->
|
||||
|
||||
@ -98,7 +101,7 @@ an interface to many of the features provided by pvData and pvAccess.</p>
|
||||
<p>
|
||||
A user overview is available via
|
||||
<a
|
||||
href="./overiew.html">overview.html
|
||||
href="./overview.html">overview.html
|
||||
</a>
|
||||
</p>
|
||||
<p>
|
||||
@ -123,7 +126,7 @@ make
|
||||
</pre>
|
||||
|
||||
<h2>Example and Test Database</h2>
|
||||
<p>The examples require that an example pvAccess server is runnimg.
|
||||
<p>The examples and tests require that an example pvAccess server is runnimg.
|
||||
This distribution has a file <b>exampleDatabaseEasyPVA.zip</b>.
|
||||
When unzipped this is used to create an example IOC database.
|
||||
The database has the record used by the examples are tests that come with easyPVAJava.
|
||||
@ -155,10 +158,60 @@ mrk> pwd
|
||||
/home/hg/easyPVACPP/example
|
||||
mrk> bin/linux-x86_64/exampleEasyGet
|
||||
</pre>
|
||||
<p>
|
||||
See the source code for each example.
|
||||
<p>The following is a brief description of each example.
|
||||
In order to understand each example it
|
||||
helps to also bee loooking at the source for the example.</p>
|
||||
<h2>exampleEasyGet</h2>
|
||||
<p>This has a number of examples:</p>
|
||||
<dl>
|
||||
<dt>exampleDouble</dt>
|
||||
<dd>
|
||||
This shows two methods for getting data from a channel that has a numeric
|
||||
scalar value field.
|
||||
</dd>
|
||||
<dt>exampleDoubleArray</dt>
|
||||
<dd>
|
||||
This shows two methods for getting data from a channel that has a
|
||||
double array value field.
|
||||
</dd>
|
||||
<dt>exampleCADouble</dt>
|
||||
<dd>
|
||||
This is like exampleDouble except it uses provider <b>ca</b>.
|
||||
</dd>
|
||||
<dt>exampleCADoubleArray</dt>
|
||||
<dd>
|
||||
This is like exampleDoubleArray except it uses provider <b>ca</b>.
|
||||
</dd>
|
||||
<dt>examplePowerSupply</dt>
|
||||
<dd>
|
||||
This is an example of getting data from a channel that does not
|
||||
have a value field.
|
||||
</dd>
|
||||
</dl>
|
||||
<h2>exampleEasyMonitor</h2>
|
||||
<p>This is an example of creating a monitor on a channel.
|
||||
It monitors a channel that models a powerSupply, i. e. it is not a "standard" record.
|
||||
It does not have a value field.
|
||||
</p>
|
||||
|
||||
<p>After starting the example a change can be made to the powerSupply by issuing:</p>
|
||||
<pre>
|
||||
pvput -r "power.value,voltage.value" examplePowerSupply 6 6
|
||||
</pre>
|
||||
<h2>exampleEasyPut</h2>
|
||||
<p>This example gets and puts to channel exampleDouble.</p>
|
||||
<h2>exampleEasyProcess</h2>
|
||||
<p>This example makes a process request to channel exampleDouble.</p>
|
||||
<h2>helloWorldPutGet</h2>
|
||||
<p>This is an example of issuing a channelPutGet.</p>
|
||||
<h2>exampleEasyMultiDouble</h2>
|
||||
<p>This is an example of issuing gets and puts to multiple channels where each
|
||||
channel has a numeric scalar value field.</p>
|
||||
<h2>exampleEasyNTMultiChannel</h2>
|
||||
<p>This is an example of using NDMultiChannel to obtain data from multiple channels.
|
||||
</p>
|
||||
<h2>helloWorldRPC</h2>
|
||||
<p>This is an example of issuing a channelRPC request.
|
||||
It does <b>not</b> use easyPVA.</p>
|
||||
</div> <!-- class="contents" -->
|
||||
</body>
|
||||
</html>
|
||||
|
217
documentation/easyPVA_20150325.html
Normal file
217
documentation/easyPVA_20150325.html
Normal file
@ -0,0 +1,217 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
|
||||
<title>EPICS easyPVA</title>
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="http://epics-pvdata.sourceforge.net/base.css" />
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="http://epics-pvdata.sourceforge.net/epicsv4.css" />
|
||||
<style type="text/css">
|
||||
/*<![CDATA[*/
|
||||
.about { margin-left: 3em; margin-right: 3em; font-size: .83em}
|
||||
table { margin-left: auto; margin-right: auto }
|
||||
.diagram { text-align: center; margin: 2.5em 0 }
|
||||
body { margin-right: 10% }
|
||||
/*]]>*/</style>
|
||||
|
||||
<!-- Script that generates the Table of Contents -->
|
||||
<script type="text/javascript" src="http://epics-pvdata.sourceforge.net/script/tocgen.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="head">
|
||||
<h1>EPICS easyPVA</h1>
|
||||
<!-- Maturity: Working Draft or Request for Comments, or Recommendation, and date. -->
|
||||
<h2 class="nocount">EPICS V4 Working Group, Working Draft,
|
||||
25-Mar-2015</h2>
|
||||
<dl>
|
||||
<dt>This version:</dt>
|
||||
<dd><a
|
||||
href="easyPVA.html">easyPVA.html
|
||||
</a> </dd>
|
||||
<dt>Latest version:</dt>
|
||||
<dd><a
|
||||
href="easyPVA_20150325.html">easyPVA_20150325.html</a>
|
||||
</dd>
|
||||
<dt>Previous version:</dt>
|
||||
<dd>none</dd>
|
||||
<dt>Editors:</dt>
|
||||
<dd>Marty Kraimer, BNL</dd>
|
||||
<dd>Matej Sekoranja, Cosylab</dd>
|
||||
</dl>
|
||||
|
||||
<h2 class="nocount">Abstract</h2>
|
||||
|
||||
<p>EasyPVA (Easy PVAccess) is a software library that provides to an EPICS client programmer, a friendly
|
||||
client side programming interface to the data of an EPICS based control system. It is intended
|
||||
for such uses as rapid development of ad hoc programs by controls engineers, or to provide
|
||||
scientists a way to directly develop analytical applications.</p>
|
||||
|
||||
<p>Specifically, easyPVA provides an easy interface for pvAccess, which is the
|
||||
software support for high speed controls network communications used in EPICS version 4.
|
||||
PvAccess provides a callback based interface, which can be hard to use.
|
||||
EasyPVA provides an interface that does not require callbacks even for monitors.
|
||||
</p>
|
||||
<p>
|
||||
EasyChannel provides many "convenience" methods to directly get and put
|
||||
scalar and scalarArray data types.
|
||||
Additional methods provide access to the full features of pvAccess.
|
||||
</p>
|
||||
<p>
|
||||
EasyMultiChannel provides access to data from multiple channels.
|
||||
It can be used directly by a client or via EasyMultiDouble or EasyNTMultiChannel.
|
||||
EasyMultiDouble allows the client to get and put data to multiple channels.
|
||||
But each channel must have a value field that is a numeric scalar.
|
||||
EasyNTMultiChannel allows the client to get and put data to multiple channels.
|
||||
Each channel must have a value field.
|
||||
The data for the channels is presented via normative type NTMultiChannel.
|
||||
</p>
|
||||
<!-- last para of Abstract is boilerplate reference to EPICS -->
|
||||
<p>For more information about EPICS generally, please refer to the home page of the <a
|
||||
href="http://www.aps.anl.gov/epics/">Experimental Physics and Industrial
|
||||
Control System</a>.</p>
|
||||
|
||||
|
||||
|
||||
<h2 class="nocount">Status of this Document and of the EasyPVA Software</h2>
|
||||
|
||||
<p>EasyPVACPP is ready for use.</p>
|
||||
|
||||
</div> <!-- head -->
|
||||
|
||||
<div id="toc">
|
||||
<h2 class="nocount">Table of Contents</h2>
|
||||
</div>
|
||||
|
||||
<!-- Place what you would like in the Table of Contents, inside the contents div -->
|
||||
<div id="contents" class="contents">
|
||||
<hr />
|
||||
|
||||
<h2>Introduction</h2>
|
||||
|
||||
<p>EasyPVA is a synchronous API for accessing PVData via PVAccess. It provides
|
||||
an interface to many of the features provided by pvData and pvAccess.</p>
|
||||
|
||||
<p>This document describes the layout of the source files in this project.</p>
|
||||
<p>
|
||||
A user overview is available via
|
||||
<a
|
||||
href="./overview.html">overview.html
|
||||
</a>
|
||||
</p>
|
||||
<p>
|
||||
Doxygen documentation is available at
|
||||
<a
|
||||
href="./html/index.html">doxygenDoc
|
||||
</a>
|
||||
</p>
|
||||
<h2>Building</h2>
|
||||
<p>After obtaining the source:</p>
|
||||
<pre>
|
||||
cd configure
|
||||
cp ExampleRELEASE.local RELEASE.local
|
||||
</pre>
|
||||
<p>Edit <b>RELEASE.local</b> so that all path names are correct for you environment.
|
||||
</p>
|
||||
<p>
|
||||
Then:</p>
|
||||
<pre>
|
||||
cd ..
|
||||
make
|
||||
</pre>
|
||||
|
||||
<h2>Example and Test Database</h2>
|
||||
<p>The examples and tests require that an example pvAccess server is runnimg.
|
||||
This distribution has a file <b>exampleDatabaseEasyPVA.zip</b>.
|
||||
When unzipped this is used to create an example IOC database.
|
||||
The database has the record used by the examples are tests that come with easyPVAJava.
|
||||
It uses pvDatabaseCPP to build the database.
|
||||
</p>
|
||||
<p>
|
||||
After unzipping the file:
|
||||
</p>
|
||||
<pre>
|
||||
cd configure
|
||||
cp ExampleRELEASE.local RELEASE.local
|
||||
edit RELEASE.local
|
||||
cd ..
|
||||
make
|
||||
cd iocBoot/exampleDatabase
|
||||
../../bin/<arch:>/exampleDatabase st.cmd
|
||||
</pre>
|
||||
<h2>Testing</h2>
|
||||
<p>The tests will fail unless the example database is running.</p>
|
||||
<p>Once it is running:</p>
|
||||
<pre>
|
||||
make runtests
|
||||
</pre>
|
||||
<h2>Examples</h2>
|
||||
<p>Examples are in directory <b>example/src</b>.
|
||||
An example of how to run them is:</p>
|
||||
<pre>
|
||||
mrk> pwd
|
||||
/home/hg/easyPVACPP/example
|
||||
mrk> bin/linux-x86_64/exampleEasyGet
|
||||
</pre>
|
||||
<p>The following is a brief description of each example.
|
||||
In order to understand each example it
|
||||
helps to also bee loooking at the source for the example.</p>
|
||||
<h2>exampleEasyGet</h2>
|
||||
<p>This has a number of examples:</p>
|
||||
<dl>
|
||||
<dt>exampleDouble</dt>
|
||||
<dd>
|
||||
This shows two methods for getting data from a channel that has a numeric
|
||||
scalar value field.
|
||||
</dd>
|
||||
<dt>exampleDoubleArray</dt>
|
||||
<dd>
|
||||
This shows two methods for getting data from a channel that has a
|
||||
double array value field.
|
||||
</dd>
|
||||
<dt>exampleCADouble</dt>
|
||||
<dd>
|
||||
This is like exampleDouble except it uses provider <b>ca</b>.
|
||||
</dd>
|
||||
<dt>exampleCADoubleArray</dt>
|
||||
<dd>
|
||||
This is like exampleDoubleArray except it uses provider <b>ca</b>.
|
||||
</dd>
|
||||
<dt>examplePowerSupply</dt>
|
||||
<dd>
|
||||
This is an example of getting data from a channel that does not
|
||||
have a value field.
|
||||
</dd>
|
||||
</dl>
|
||||
<h2>exampleEasyMonitor</h2>
|
||||
<p>This is an example of creating a monitor on a channel.
|
||||
It monitors a channel that models a powerSupply, i. e. it is not a "standard" record.
|
||||
It does not have a value field.
|
||||
</p>
|
||||
<p>After starting the example a change can be made to the powerSupply by issuing:</p>
|
||||
<pre>
|
||||
pvput -r "power.value,voltage.value" examplePowerSupply 6 6
|
||||
</pre>
|
||||
<h2>exampleEasyPut</h2>
|
||||
<p>This example gets and puts to channel exampleDouble.</p>
|
||||
<h2>exampleEasyProcess</h2>
|
||||
<p>This example makes a process request to channel exampleDouble.</p>
|
||||
<h2>helloWorldPutGet</h2>
|
||||
<p>This is an example of issuing a channelPutGet.</p>
|
||||
<h2>exampleEasyMultiDouble</h2>
|
||||
<p>This is an example of issuing gets and puts to multiple channels where each
|
||||
channel has a numeric scalar value field.</p>
|
||||
<h2>exampleEasyNTMultiChannel</h2>
|
||||
<p>This is an example of using NDMultiChannel to obtain data from multiple channels.
|
||||
</p>
|
||||
<h2>helloWorldRPC</h2>
|
||||
<p>This is an example of issuing a channelRPC request.
|
||||
It does <b>not</b> use easyPVA.</p>
|
||||
</div> <!-- class="contents" -->
|
||||
</body>
|
||||
</html>
|
@ -84,6 +84,16 @@ EasyProcessPtr process = channel->createProcess();
|
||||
process->process();
|
||||
|
||||
</pre>
|
||||
<p><b>easyPVACPP</b> includes a number of examples.</p>
|
||||
<p>easyPVA does <b>not</b> provide support for:</p>
|
||||
<dl>
|
||||
<dt>ChannelArray</dt>
|
||||
<dd>TBD</dd>
|
||||
<dt>ChannelRPC</dt>
|
||||
<dd>pvAccess itself already provides an easy to use synchronous interface.
|
||||
The examples include helloWorldRPC, which is an example of using channelRP.
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<h2>EasyPVA</h2>
|
||||
<p>An instance of EasyPVA is obtained via the call:</p>
|
||||
@ -94,10 +104,9 @@ EasyPVAPtr easyPVA = EasyPVA::create();
|
||||
<p>EasyPVA has methods to create instances of <b>EasyChannel</b>.
|
||||
The client can specify the provider name or use the default provider.
|
||||
The client can manage it's own channels or can let easyPVA cache channels.
|
||||
An example of using the cache method is:</p>
|
||||
An example of using the cached method is:</p>
|
||||
<pre>
|
||||
string channelName("exampleDouble");
|
||||
EasyChannelPtr easyChannel = easyPVA->channel(channelName);
|
||||
EasyChannelPtr easyChannel = easyPVA->channel("exampleDouble");
|
||||
</pre>
|
||||
<p>This will attempt to connect to channel exampleDouble.
|
||||
Since the client did not specify a timeout an exception wll be thrown if
|
||||
@ -109,8 +118,7 @@ returned to the client.
|
||||
</p>
|
||||
<p>An example of using a non cached method is:</p>
|
||||
<pre>
|
||||
string channelName("exampleDouble");
|
||||
EasyChannelPtr easyChannel = easyPVA->createChannel(channelName);
|
||||
EasyChannelPtr easyChannel = easyPVA->createChannel("exampleDouble");
|
||||
</pre>
|
||||
<p>This will create an EasyChannel and return it to the client.
|
||||
The client must itself connect.
|
||||
@ -120,7 +128,7 @@ This is useful if the client wants to connect to multiple channels in parallel.
|
||||
<h2>EasyChannel - Wrapper For Single Channel</h2>
|
||||
<h3>EasyChannel</h3>
|
||||
<p>This provides methods for connecting to a channel and for creating instances of
|
||||
EasyField, EasyProcess, ..., EasyRPC.</p>
|
||||
EasyField, EasyProcess, ..., EasyPutGet.</p>
|
||||
<p>Connection must be made before any create method is called or
|
||||
an exception is raised.
|
||||
The following is a synchronous connection request:</p>
|
||||
@ -289,20 +297,20 @@ It has methods:</p>
|
||||
<h2>EasyMultiChannel - Wrapper For Multiple Channels</h2>
|
||||
<h3>EasyMultiChannel</h3>
|
||||
<p>This provides methods for connecting to multiple channels.
|
||||
For now clients has no reason to use this directly.
|
||||
Instead they will use it via EasyMultiDouble or EasyNTMultiChannel.
|
||||
A client can either use EasyMultiChannel directly or use EasyMultiDouble or EasyNTMultiChannel.
|
||||
But both impose restrictions on what can be accessed.
|
||||
</p>
|
||||
<h3>EasyMultiDouble</h3>
|
||||
<p>This provides support for gets and puts to the value field of multiple channels.
|
||||
Each channel must have a value field that is a numeric scalar.
|
||||
The client always sees that data as a PVDoubleArray.
|
||||
The client always sees the data as a PVDoubleArray.
|
||||
All channels must connect.
|
||||
If any problems occur an exception is thrown.
|
||||
</p>
|
||||
<h3>EasyNTMultiChannel</h3>
|
||||
<p>This provides support for gets and puts to the value field of multiple channels.
|
||||
Each channel must have a value field.
|
||||
The client always sees that data as a NTMultiChannel, which is one
|
||||
The client always sees the data as a NTMultiChannel, which is one
|
||||
of the types provided by normativeTypesCPP.
|
||||
All channels must connect.
|
||||
If any problems occur an exception is thrown.
|
||||
|
@ -48,6 +48,22 @@ exampleEasyNTMultiChannel_LIBS += nt
|
||||
exampleEasyNTMultiChannel_LIBS += pvData
|
||||
exampleEasyNTMultiChannel_LIBS += Com
|
||||
|
||||
PROD_HOST += helloWorldRPC
|
||||
helloWorldRPC_SRCS += helloWorldRPC.cpp
|
||||
helloWorldRPC_LIBS += easyPVA
|
||||
helloWorldRPC_LIBS += pvAccess
|
||||
helloWorldRPC_LIBS += nt
|
||||
helloWorldRPC_LIBS += pvData
|
||||
helloWorldRPC_LIBS += Com
|
||||
|
||||
PROD_HOST += helloWorldPutGet
|
||||
helloWorldPutGet_SRCS += helloWorldPutGet.cpp
|
||||
helloWorldPutGet_LIBS += easyPVA
|
||||
helloWorldPutGet_LIBS += pvAccess
|
||||
helloWorldPutGet_LIBS += nt
|
||||
helloWorldPutGet_LIBS += pvData
|
||||
helloWorldPutGet_LIBS += Com
|
||||
|
||||
#===========================
|
||||
|
||||
include $(TOP)/configure/RULES
|
||||
|
@ -84,12 +84,63 @@ static void examplePowerSupply(EasyPVAPtr const &easyPVA)
|
||||
|
||||
}
|
||||
|
||||
static void exampleCADouble(EasyPVAPtr const &easyPVA)
|
||||
{
|
||||
cout << "example double scalar\n";
|
||||
double value;
|
||||
try {
|
||||
cout << "short way\n";
|
||||
value = easyPVA->channel("double00","ca",5.0)->get()->getData()->getDouble();
|
||||
cout << "as double " << value << endl;
|
||||
} catch (std::runtime_error e) {
|
||||
cout << "exception " << e.what() << endl;
|
||||
}
|
||||
cout << "long way\n";
|
||||
EasyChannelPtr easyChannel = easyPVA->createChannel("double00","ca");
|
||||
easyChannel->issueConnect();
|
||||
Status status = easyChannel->waitConnect(2.0);
|
||||
if(!status.isOK()) {cout << " connect failed\n"; return;}
|
||||
EasyGetPtr easyGet = easyChannel->createGet();
|
||||
easyGet->issueConnect();
|
||||
status = easyGet->waitConnect();
|
||||
if(!status.isOK()) {cout << " createGet failed\n"; return;}
|
||||
EasyGetDataPtr easyData = easyGet->getData();
|
||||
value = easyData->getDouble();
|
||||
cout << "as double " << value << endl;
|
||||
}
|
||||
|
||||
static void exampleCADoubleArray(EasyPVAPtr const &easyPVA)
|
||||
{
|
||||
cout << "example double array\n";
|
||||
shared_vector<const double> value;
|
||||
try {
|
||||
cout << "short way\n";
|
||||
value = easyPVA->channel("doubleArray","ca",5.0)->get()->getData()->getDoubleArray();
|
||||
cout << "as doubleArray " << value << endl;
|
||||
} catch (std::runtime_error e) {
|
||||
cout << "exception " << e.what() << endl;
|
||||
}
|
||||
try {
|
||||
cout << "long way\n";
|
||||
EasyChannelPtr easyChannel = easyPVA->createChannel("doubleArray","ca");
|
||||
easyChannel->connect(2.0);
|
||||
EasyGetPtr easyGet = easyChannel->createGet();
|
||||
EasyGetDataPtr easyData = easyGet->getData();
|
||||
value = easyData->getDoubleArray();
|
||||
cout << "as doubleArray " << value << endl;
|
||||
} catch (std::runtime_error e) {
|
||||
cout << "exception " << e.what() << endl;
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
EasyPVAPtr easyPVA = EasyPVA::create();
|
||||
exampleDouble(easyPVA);
|
||||
exampleDoubleArray(easyPVA);
|
||||
examplePowerSupply(easyPVA);
|
||||
exampleCADouble(easyPVA);
|
||||
exampleCADoubleArray(easyPVA);
|
||||
cout << "done\n";
|
||||
return 0;
|
||||
}
|
||||
|
@ -47,10 +47,38 @@ static void example(EasyPVAPtr const &easyPVA)
|
||||
|
||||
}
|
||||
|
||||
static void exampleCA(EasyPVAPtr const &easyPVA)
|
||||
{
|
||||
cout << "example multiDouble\n";
|
||||
size_t num = 5;
|
||||
shared_vector<string> channelNames(num);
|
||||
channelNames[0] = "double01";
|
||||
channelNames[1] = "double02";
|
||||
channelNames[2] = "double03";
|
||||
channelNames[3] = "double04";
|
||||
channelNames[4] = "double05";
|
||||
PVStringArrayPtr pvNames =
|
||||
getPVDataCreate()->createPVScalarArray<PVStringArray>();
|
||||
pvNames->replace(freeze(channelNames));
|
||||
EasyMultiDoublePtr multiDouble(EasyMultiDouble::create(easyPVA,pvNames,5.0,"ca"));
|
||||
try {
|
||||
shared_vector<double> data = multiDouble->get();
|
||||
cout << "initial " << data << endl;
|
||||
for(size_t i=0; i<num; ++i) data[i] = data[i] + 1.1;
|
||||
multiDouble->put(data);
|
||||
data = multiDouble->get();
|
||||
cout << "final " << data << endl;
|
||||
} catch (std::runtime_error e) {
|
||||
cout << "exception " << e.what() << endl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
EasyPVAPtr easyPVA = EasyPVA::create();
|
||||
example(easyPVA);
|
||||
exampleCA(easyPVA);
|
||||
return 0;
|
||||
}
|
||||
|
@ -56,10 +56,46 @@ static void example(EasyPVAPtr const &easyPVA)
|
||||
|
||||
}
|
||||
|
||||
static void exampleCA(EasyPVAPtr const &easyPVA)
|
||||
{
|
||||
cout << "example ntMultiChannel\n";
|
||||
size_t num = 5;
|
||||
shared_vector<string> channelNames(num);
|
||||
channelNames[0] = "double00";
|
||||
channelNames[1] = "doubleArray";
|
||||
channelNames[2] = "string00";
|
||||
channelNames[3] = "mbbiwierd";
|
||||
channelNames[4] = "enum01";
|
||||
PVStringArrayPtr pvNames =
|
||||
getPVDataCreate()->createPVScalarArray<PVStringArray>();
|
||||
pvNames->replace(freeze(channelNames));
|
||||
NTMultiChannelBuilderPtr builder = NTMultiChannel::createBuilder();
|
||||
StructureConstPtr structure = builder->
|
||||
addTimeStamp()->
|
||||
addSeverity() ->
|
||||
addStatus() ->
|
||||
addMessage() ->
|
||||
addSecondsPastEpoch() ->
|
||||
addNanoseconds() ->
|
||||
addUserTag() ->
|
||||
createStructure();
|
||||
EasyNTMultiChannelPtr easy = EasyNTMultiChannel::create(
|
||||
easyPVA,pvNames,structure,5.0,"ca");
|
||||
try {
|
||||
NTMultiChannelPtr nt = easy->get();
|
||||
cout << "initial\n" << nt->getPVStructure() << endl;
|
||||
|
||||
} catch (std::runtime_error e) {
|
||||
cout << "exception " << e.what() << endl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
EasyPVAPtr easyPVA = EasyPVA::create();
|
||||
example(easyPVA);
|
||||
exampleCA(easyPVA);
|
||||
return 0;
|
||||
}
|
||||
|
48
example/src/helloWorldPutGet.cpp
Normal file
48
example/src/helloWorldPutGet.cpp
Normal file
@ -0,0 +1,48 @@
|
||||
/*helloWorldPutGet.cpp */
|
||||
/**
|
||||
* Copyright - See the COPYRIGHT that is included with this distribution.
|
||||
* EPICS pvData is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
*/
|
||||
/**
|
||||
* @author mrk
|
||||
*/
|
||||
|
||||
/* Author: Marty Kraimer */
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <pv/easyPVA.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace epics::pvData;
|
||||
using namespace epics::pvAccess;
|
||||
using namespace epics::easyPVA;
|
||||
|
||||
|
||||
static void example(EasyPVAPtr const &easyPVA)
|
||||
{
|
||||
cout << "helloWorldPutGet\n";
|
||||
try {
|
||||
EasyChannelPtr channel = easyPVA->channel("exampleHello");
|
||||
EasyPutGetPtr putGet = channel->createPutGet();
|
||||
putGet->connect();
|
||||
EasyPutDataPtr putData = putGet->getPutData();
|
||||
PVStructurePtr arg = putData->getPVStructure();
|
||||
PVStringPtr pvValue = arg->getSubField<PVString>("argument.value");
|
||||
pvValue->put("World");
|
||||
putGet->putGet();
|
||||
EasyGetDataPtr getData = putGet->getGetData();
|
||||
cout << getData->getPVStructure() << endl;
|
||||
} catch (std::runtime_error e) {
|
||||
cout << "exception " << e.what() << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
EasyPVAPtr easyPVA = EasyPVA::create();
|
||||
example(easyPVA);
|
||||
return 0;
|
||||
}
|
77
example/src/helloWorldRPC.cpp
Normal file
77
example/src/helloWorldRPC.cpp
Normal file
@ -0,0 +1,77 @@
|
||||
/*exampleChannelRPC.cpp */
|
||||
/**
|
||||
* Copyright - See the COPYRIGHT that is included with this distribution.
|
||||
* EPICS pvData is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
*/
|
||||
/**
|
||||
* @author mrk
|
||||
*/
|
||||
|
||||
/* Author: Marty Kraimer */
|
||||
|
||||
#include <iostream>
|
||||
#include <pv/pvData.h>
|
||||
#include <pv/pvAccess.h>
|
||||
#include <pv/rpcClient.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace epics::pvData;
|
||||
using namespace epics::pvAccess;
|
||||
|
||||
static FieldCreatePtr fieldCreate = getFieldCreate();
|
||||
static PVDataCreatePtr pvDataCreate = getPVDataCreate();
|
||||
|
||||
|
||||
static void exampleSimple()
|
||||
{
|
||||
StructureConstPtr topStructure = fieldCreate->createFieldBuilder()->
|
||||
add("value",pvString)->
|
||||
createStructure();
|
||||
PVStructurePtr pvRequest = pvDataCreate->createPVStructure(topStructure);
|
||||
PVStringPtr pvArgument = pvRequest->getSubField<PVString>("value");
|
||||
pvArgument->put("World");
|
||||
cout << "example channeRPC simple\n";
|
||||
try {
|
||||
PVStructurePtr pvResult =
|
||||
RPCClient::sendRequest("exampleHelloRPC", pvRequest);
|
||||
cout << "result\n" << pvResult << endl;
|
||||
} catch (RPCRequestException &e) {
|
||||
cout << e.what() << endl;
|
||||
}
|
||||
}
|
||||
|
||||
void exampleMore()
|
||||
{
|
||||
StructureConstPtr topStructure = fieldCreate->createFieldBuilder()->
|
||||
add("value",pvString)->
|
||||
createStructure();
|
||||
PVStructurePtr pvRequest = pvDataCreate->createPVStructure(topStructure);
|
||||
PVStringPtr pvArgument = pvRequest->getSubField<PVString>("value");
|
||||
pvArgument->put("World");
|
||||
cout << "example channeRPC more\n";
|
||||
try {
|
||||
RPCClient::shared_pointer client = RPCClient::create("exampleHelloRPC");
|
||||
client->issueConnect();
|
||||
if (client->waitConnect())
|
||||
{
|
||||
client->issueRequest(pvRequest);
|
||||
PVStructure::shared_pointer result = client->waitResponse();
|
||||
std::cout << *result << std::endl;
|
||||
}
|
||||
else {
|
||||
cout << "waitConnect timeout\n";
|
||||
return;
|
||||
}
|
||||
} catch (RPCRequestException &e) {
|
||||
cout << e.what() << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
exampleSimple();
|
||||
exampleMore();
|
||||
return 0;
|
||||
}
|
Binary file not shown.
@ -231,6 +231,9 @@ void EasyChannel::issueConnect()
|
||||
connectState = connectActive;
|
||||
ChannelProviderRegistry::shared_pointer reg = getChannelProviderRegistry();
|
||||
ChannelProvider::shared_pointer provider = reg->getProvider(providerName);
|
||||
if(!provider) {
|
||||
throw std::runtime_error(getChannelName() + " provider " + providerName + " not registered");
|
||||
}
|
||||
channel = provider->createChannel(channelName,channelRequester,ChannelProvider::PRIORITY_DEFAULT);
|
||||
if(!channel) {
|
||||
throw std::runtime_error(channelConnectStatus.getMessage());
|
||||
|
@ -24,7 +24,9 @@ class EasyNTMultiChannel;
|
||||
typedef std::tr1::shared_ptr<EasyNTMultiChannel> EasyNTMultiChannelPtr;
|
||||
|
||||
/**
|
||||
* @brief Support for multiple channels where each channel has a value field that is a scalar double.
|
||||
* @brief Support for multiple channels where each channel has a value field that
|
||||
* is a scalar, scalarArray, or enumerated structure.
|
||||
* The data is provided via normativeType NTMultiChannel.
|
||||
* If any problems arise an exception is thrown.
|
||||
*
|
||||
* @author mrk
|
||||
|
@ -14,10 +14,12 @@
|
||||
#include <pv/easyPVA.h>
|
||||
#include <pv/createRequest.h>
|
||||
#include <pv/clientFactory.h>
|
||||
#include <pv/caProvider.h>
|
||||
|
||||
using std::tr1::static_pointer_cast;
|
||||
using namespace epics::pvData;
|
||||
using namespace epics::pvAccess;
|
||||
using namespace epics::pvAccess::ca;
|
||||
using namespace std;
|
||||
|
||||
namespace epics { namespace easyPVA {
|
||||
@ -44,7 +46,10 @@ namespace easyPVAPvt {
|
||||
saveFirst = firstTime;
|
||||
firstTime = false;
|
||||
}
|
||||
if(saveFirst) ClientFactory::start();
|
||||
if(saveFirst) {
|
||||
ClientFactory::start();
|
||||
CAClientFactory::start();
|
||||
}
|
||||
}
|
||||
|
||||
static void EasyPVABeingDestroyed() {
|
||||
@ -54,7 +59,10 @@ namespace easyPVAPvt {
|
||||
--numberEasyPVA;
|
||||
numLeft = numberEasyPVA;
|
||||
}
|
||||
if(numLeft<=0) ClientFactory::stop();
|
||||
if(numLeft<=0) {
|
||||
ClientFactory::stop();
|
||||
CAClientFactory::stop();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1565,7 +1565,6 @@ public:
|
||||
* @brief Create a EasyMultiChannel.
|
||||
* @param channelNames The name. of the channel..
|
||||
* @param providerName The name of the provider.
|
||||
* @param u The union interface for each channel.
|
||||
* @return The interface to the EasyPVAStructure.
|
||||
*/
|
||||
static EasyMultiChannelPtr create(
|
||||
|
Reference in New Issue
Block a user