all EasyChannel methods are implemented except channelArray; EasyMultiChannel not started.

This commit is contained in:
Marty Kraimer
2015-03-13 15:09:55 -04:00
parent 5dc5e746f4
commit cdc72bc5ae
32 changed files with 4366 additions and 1747 deletions

View File

@@ -5,6 +5,13 @@ include $(TOP)/configure/CONFIG
# ADD MACRO DEFINITIONS AFTER THIS LINE
PROD_HOST += exampleEasyProcess
exampleEasyProcess_SRCS += exampleEasyProcess.cpp
exampleEasyProcess_LIBS += easyPVA
exampleEasyProcess_LIBS += pvAccess
exampleEasyProcess_LIBS += pvData
exampleEasyProcess_LIBS += Com
PROD_HOST += exampleEasyGet
exampleEasyGet_SRCS += exampleEasyGet.cpp
exampleEasyGet_LIBS += easyPVA
@@ -12,6 +19,20 @@ exampleEasyGet_LIBS += pvAccess
exampleEasyGet_LIBS += pvData
exampleEasyGet_LIBS += Com
PROD_HOST += exampleEasyPut
exampleEasyPut_SRCS += exampleEasyPut.cpp
exampleEasyPut_LIBS += easyPVA
exampleEasyPut_LIBS += pvAccess
exampleEasyPut_LIBS += pvData
exampleEasyPut_LIBS += Com
PROD_HOST += exampleEasyMonitor
exampleEasyMonitor_SRCS += exampleEasyMonitor.cpp
exampleEasyMonitor_LIBS += easyPVA
exampleEasyMonitor_LIBS += pvAccess
exampleEasyMonitor_LIBS += pvData
exampleEasyMonitor_LIBS += Com
#===========================
include $(TOP)/configure/RULES

View File

@@ -26,7 +26,7 @@ static void exampleDouble(EasyPVAPtr const &easyPVA)
double value;
try {
cout << "short way\n";
value = easyPVA->channel("exampleDouble")->get()->getDouble();
value = easyPVA->channel("exampleDouble")->get()->getData()->getDouble();
cout << "as double " << value << endl;
} catch (std::runtime_error e) {
cout << "exception " << e.what() << endl;
@@ -40,17 +40,18 @@ static void exampleDouble(EasyPVAPtr const &easyPVA)
easyGet->issueConnect();
status = easyGet->waitConnect();
if(!status.isOK()) {cout << " createGet failed\n"; return;}
value = easyGet->getDouble();
EasyGetDataPtr easyData = easyGet->getData();
value = easyData->getDouble();
cout << "as double " << value << endl;
}
static void exampleDoubleArray(EasyPVAPtr const &easyPVA)
{
cout << "example double array\n";
shared_vector<double> value;
shared_vector<const double> value;
try {
cout << "short way\n";
value = easyPVA->createChannel("exampleDoubleArray")->createGet()->getDoubleArray();
value = easyPVA->channel("exampleDoubleArray")->get()->getData()->getDoubleArray();
cout << "as doubleArray " << value << endl;
} catch (std::runtime_error e) {
cout << "exception " << e.what() << endl;
@@ -60,7 +61,8 @@ static void exampleDoubleArray(EasyPVAPtr const &easyPVA)
EasyChannelPtr easyChannel = easyPVA->createChannel("exampleDoubleArray");
easyChannel->connect(2.0);
EasyGetPtr easyGet = easyChannel->createGet();
value = easyGet->getDoubleArray();
EasyGetDataPtr easyData = easyGet->getData();
value = easyData->getDoubleArray();
cout << "as doubleArray " << value << endl;
} catch (std::runtime_error e) {
cout << "exception " << e.what() << endl;
@@ -73,7 +75,8 @@ static void examplePowerSupply(EasyPVAPtr const &easyPVA)
PVStructurePtr pvStructure;
try {
cout << "short way\n";
pvStructure = easyPVA->createChannel("examplePowerSupply")->createGet("field()")->getPVStructure();
pvStructure = easyPVA->channel("examplePowerSupply")->
get("field()")->getData()->getPVStructure();
cout << pvStructure << endl;
} catch (std::runtime_error e) {
cout << "exception " << e.what() << endl;

View File

@@ -0,0 +1,46 @@
/*monitorPowerSupply.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 <epicsThread.h>
#include <iostream>
#include <pv/easyPVA.h>
using namespace std;
using namespace epics::pvData;
using namespace epics::pvAccess;
using namespace epics::easyPVA;
static void exampleMonitor(EasyPVAPtr const &easyPVA)
{
EasyMonitorPtr monitor = easyPVA->channel("examplePowerSupply")->monitor("");
EasyMonitorDataPtr easyData = monitor->getData();
while(true) {
monitor->waitEvent();
cout << "changed\n";
easyData->showChanged(cout);
cout << "overrun\n";
easyData->showOverrun(cout);
monitor->releaseEvent();
}
}
int main(int argc,char *argv[])
{
EasyPVAPtr easyPVA = EasyPVA::create();
exampleMonitor(easyPVA);
cout << "done\n";
return 0;
}

View File

@@ -0,0 +1,44 @@
/*exampleEasyProcess.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 exampleProcess(EasyPVAPtr const &easyPVA)
{
cout << "example process\n";
EasyChannelPtr channel = easyPVA->channel("exampleDouble");
EasyProcessPtr process = channel->createProcess();
try {
process->process();
cout << channel->get("field()")->getData()->showChanged(cout) << endl;
process->process();
cout << channel->get("field()")->getData()->showChanged(cout) << endl;
} catch (std::runtime_error e) {
cout << "exception " << e.what() << endl;
}
}
int main(int argc,char *argv[])
{
EasyPVAPtr easyPVA = EasyPVA::create();
exampleProcess(easyPVA);
return 0;
}

View File

@@ -0,0 +1,45 @@
/*exampleEasyProcess.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 examplePut(EasyPVAPtr const &easyPVA)
{
cout << "example process\n";
EasyChannelPtr channel = easyPVA->channel("exampleDouble");
EasyPutPtr put = channel->put();
EasyPutDataPtr putData = put->getData();
try {
putData->putDouble(3.0); put->put();
cout << channel->get("field()")->getData()->showChanged(cout) << endl;
putData->putDouble(4.0); put->put();
cout << channel->get("field()")->getData()->showChanged(cout) << endl;
} catch (std::runtime_error e) {
cout << "exception " << e.what() << endl;
}
}
int main(int argc,char *argv[])
{
EasyPVAPtr easyPVA = EasyPVA::create();
examplePut(easyPVA);
return 0;
}