added multiChannel support

This commit is contained in:
Marty Kraimer
2015-03-20 10:31:35 -04:00
parent cdc72bc5ae
commit 8f054db6cd
25 changed files with 1378 additions and 64 deletions

View File

@@ -33,6 +33,21 @@ exampleEasyMonitor_LIBS += pvAccess
exampleEasyMonitor_LIBS += pvData
exampleEasyMonitor_LIBS += Com
PROD_HOST += exampleEasyMultiDouble
exampleEasyMultiDouble_SRCS += exampleEasyMultiDouble.cpp
exampleEasyMultiDouble_LIBS += easyPVA
exampleEasyMultiDouble_LIBS += pvAccess
exampleEasyMultiDouble_LIBS += pvData
exampleEasyMultiDouble_LIBS += Com
PROD_HOST += exampleEasyNTMultiChannel
exampleEasyNTMultiChannel_SRCS += exampleEasyNTMultiChannel.cpp
exampleEasyNTMultiChannel_LIBS += easyPVA
exampleEasyNTMultiChannel_LIBS += pvAccess
exampleEasyNTMultiChannel_LIBS += nt
exampleEasyNTMultiChannel_LIBS += pvData
exampleEasyNTMultiChannel_LIBS += Com
#===========================
include $(TOP)/configure/RULES

View File

@@ -0,0 +1,56 @@
/*exampleEasyMultiDouble.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/easyMultiDouble.h>
using namespace std;
using namespace epics::pvData;
using namespace epics::pvAccess;
using namespace epics::easyPVA;
static void example(EasyPVAPtr const &easyPVA)
{
cout << "example multiDouble\n";
size_t num = 5;
shared_vector<string> channelNames(num);
channelNames[0] = "exampleDouble01";
channelNames[1] = "exampleDouble02";
channelNames[2] = "exampleDouble03";
channelNames[3] = "exampleDouble04";
channelNames[4] = "exampleDouble05";
PVStringArrayPtr pvNames =
getPVDataCreate()->createPVScalarArray<PVStringArray>();
pvNames->replace(freeze(channelNames));
EasyMultiDoublePtr multiDouble(EasyMultiDouble::create(easyPVA,pvNames));
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);
return 0;
}

View File

@@ -0,0 +1,65 @@
/*exampleEasyNTMultiChannel.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/easyNTMultiChannel.h>
using namespace std;
using namespace epics::pvData;
using namespace epics::pvAccess;
using namespace epics::easyPVA;
using namespace epics::nt;
static void example(EasyPVAPtr const &easyPVA)
{
cout << "example ntMultiChannel\n";
size_t num = 5;
shared_vector<string> channelNames(num);
channelNames[0] = "exampleDouble";
channelNames[1] = "exampleDoubleArray";
channelNames[2] = "exampleString";
channelNames[3] = "exampleBoolean";
channelNames[4] = "exampleEnum";
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);
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);
return 0;
}

View File

@@ -1,4 +1,4 @@
/*exampleEasyProcess.cpp */
/*exampleEasyPut.cpp */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
@@ -22,7 +22,7 @@ using namespace epics::easyPVA;
static void examplePut(EasyPVAPtr const &easyPVA)
{
cout << "example process\n";
cout << "example put\n";
EasyChannelPtr channel = easyPVA->channel("exampleDouble");
EasyPutPtr put = channel->put();
EasyPutDataPtr putData = put->getData();