23#include "pv/pvaClient.h"
24#include "pv/pvaClientMultiChannel.h"
25#include "pv/pvEnumerated.h"
39typedef std::tr1::shared_ptr<exampleStateChangeRequester> exampleStateChangeRequesterPtr;
41typedef std::tr1::shared_ptr<exampleGetRequester> exampleGetRequesterPtr;
43typedef std::tr1::shared_ptr<exampleMonitorRequester> exampleMonitorRequesterPtr;
45typedef std::tr1::shared_ptr<examplePutRequester> examplePutRequesterPtr;
48 public std::tr1::enable_shared_from_this<exampleStateChangeRequester> {
54 static exampleStateChangeRequesterPtr create() {
59 virtual void channelStateChange(epics::pvaClient::PvaClientChannelPtr
const &channel,
bool isConnected) {
61 fprintf(stdout,
"StateChange: %s is connected\n", channel->getChannelName().c_str());
63 fprintf(stdout,
"StateChange: %s is not connected\n", channel->getChannelName().c_str());
68 public std::tr1::enable_shared_from_this<exampleGetRequester> {
74 static exampleGetRequesterPtr create() {
79 virtual void channelGetConnect(
const epics::pvData::Status &status,
80 epics::pvaClient::PvaClientGetPtr
const &clientGet) {
81 fprintf(stdout,
"ChannelGetConnected: status=%s %s\n",
82 epics::pvData::Status::StatusTypeName[status.getType()],
83 clientGet->getPvaClientChannel()->getChannelName().c_str());
85 virtual void getDone(
const epics::pvData::Status &status,
86 epics::pvaClient::PvaClientGetPtr
const &clientGet) {
87 fprintf(stdout,
"GetDone: status=%s %s\n",
88 epics::pvData::Status::StatusTypeName[status.getType()],
89 clientGet->getPvaClientChannel()->getChannelName().c_str());
94 public std::tr1::enable_shared_from_this<exampleMonitorRequester> {
100 static exampleMonitorRequesterPtr create() {
105 virtual void monitorConnect(
const epics::pvData::Status &status,
106 epics::pvaClient::PvaClientMonitorPtr
const &monitor,
107 epics::pvData::StructureConstPtr
const &structure) {
108 fprintf(stdout,
"MonitorConnected: status=%s %s\n",
109 epics::pvData::Status::StatusTypeName[status.getType()],
110 monitor->getPvaClientChannel()->getChannelName().c_str());
112 virtual void event(epics::pvaClient::PvaClientMonitorPtr
const &monitor) {
113 fprintf(stdout,
"Event: %s\n", monitor->getPvaClientChannel()->getChannelName().c_str());
115 virtual void unlisten() {
116 fprintf(stdout,
"Unlisten: \n");
121 public std::tr1::enable_shared_from_this<examplePutRequester> {
127 static examplePutRequesterPtr create() {
132 virtual void channelPutConnect(
const epics::pvData::Status &status,
133 epics::pvaClient::PvaClientPutPtr
const &clientPut) {
134 fprintf(stdout,
"ChannelPutConnected: status=%s %s\n",
135 epics::pvData::Status::StatusTypeName[status.getType()],
136 clientPut->getPvaClientChannel()->getChannelName().c_str());
138 virtual void getDone(
const epics::pvData::Status &status,
139 epics::pvaClient::PvaClientPutPtr
const &clientPut) {
140 fprintf(stdout,
"GetDone: status=%s %s\n",
141 epics::pvData::Status::StatusTypeName[status.getType()],
142 clientPut->getPvaClientChannel()->getChannelName().c_str());
144 virtual void putDone(
const epics::pvData::Status &status,
145 epics::pvaClient::PvaClientPutPtr
const &clientPut) {
146 fprintf(stdout,
"PutDone: status=%s %s\n",
147 epics::pvData::Status::StatusTypeName[status.getType()],
148 clientPut->getPvaClientChannel()->getChannelName().c_str());
162 long numMonitorElements;
164 long numMonitorReadings;
167 bool pvEnumeratedStructure;
168 epics::pvData::Type fieldType;
169 epics::pvData::ScalarType scalarType;
173 double mean, median, sigma, min, max, spread, stDev, rms, MAD;
174 bool haveGetPtr, havePutPtr, haveMonitorPtr;
184 epics::pvaClient::PvaClientPtr pvaClientPtr;
185 std::vector<epics::pvaClient::PvaClientMultiChannelPtr> pvaClientMultiChannelPtr;
186 int numMultiChannels;
187 std::vector<epics::pvaClient::PvaClientGetPtr> pvaClientGetPtr;
188 std::vector<epics::pvaClient::PvaClientPutPtr> pvaClientPutPtr;
189 std::vector<epics::pvaClient::PvaClientMonitorPtr> pvaClientMonitorPtr;
191 epics::pvData::shared_vector<const std::string> pvaChannelNames;
192 epics::pvData::shared_vector<const std::string> pvaChannelNamesTop;
193 epics::pvData::shared_vector<const std::string> pvaChannelNamesSub;
194 epics::pvData::shared_vector<epics::pvData::boolean> isConnected;
195 epics::pvData::shared_vector<epics::pvData::boolean> isInternalConnected;
196 epics::pvData::shared_vector<const std::string> pvaProvider;
197 epics::pvaClient::PvaClientChannelStateChangeRequesterPtr stateChangeReqPtr;
198 epics::pvaClient::PvaClientGetRequesterPtr getReqPtr;
199 epics::pvaClient::PvaClientMonitorRequesterPtr monitorReqPtr;
200 epics::pvaClient::PvaClientPutRequesterPtr putReqPtr;
201 bool useStateChangeCallbacks;
202 bool useGetCallbacks;
203 bool useMonitorCallbacks;
204 bool usePutCallbacks;
205 bool includeAlarmSeverity;
206 long numPVs, prevNumPVs, numInternalPVs, prevNumInternalPVs, numNotConnected;
208 bool limitGetReadings;
212void allocPVA(
PVA_OVERALL *pva,
long PVs,
long repeats);
214void reallocPVA(
PVA_OVERALL *pva,
long PVs,
long repeats);
218void ConnectPVA(
PVA_OVERALL *pva,
double pendIOTime);
221long PrepPut(
PVA_OVERALL *pva,
long index,
double value);
222long PrepPut(
PVA_OVERALL *pva,
long index, int64_t value);
223long PrepPut(
PVA_OVERALL *pva,
long index,
char *value);
224long PrepPut(
PVA_OVERALL *pva,
long index,
double *value,
long length);
225long PrepPut(
PVA_OVERALL *pva,
long index, int64_t *value,
long length);
226long PrepPut(
PVA_OVERALL *pva,
long index,
char **value,
long length);
230long PollMonitoredPVA(
PVA_OVERALL **pva,
long count);
231long WaitEventMonitoredPVA(
PVA_OVERALL *pva,
long index,
double secondsToWait);
232long count_chars(
char *
string,
char c);
234void PausePVAMonitoring(
PVA_OVERALL **pva,
long count);
236void ResumePVAMonitoring(
PVA_OVERALL **pva,
long count);
239std::string GetProviderName(
PVA_OVERALL *pva,
long index);
240std::string GetRemoteAddress(
PVA_OVERALL *pva,
long index);
243std::string GetAlarmSeverity(
PVA_OVERALL *pva,
long index);
244std::string GetStructureID(
PVA_OVERALL *pva,
long index);
245std::string GetFieldType(
PVA_OVERALL *pva,
long index);
247uint32_t GetElementCount(
PVA_OVERALL *pva,
long index);
248std::string GetNativeDataType(
PVA_OVERALL *pva,
long index);
250uint32_t GetEnumChoices(
PVA_OVERALL *pva,
long index,
char ***choices);
254long ExtractNTScalarValue(
PVA_OVERALL *pva,
long index, epics::pvData::PVStructurePtr pvStructurePtr,
bool monitorMode);
255long ExtractNTScalarArrayValue(
PVA_OVERALL *pva,
long index, epics::pvData::PVStructurePtr pvStructurePtr,
bool monitorMode);
256long ExtractNTEnumValue(
PVA_OVERALL *pva,
long index, epics::pvData::PVStructurePtr pvStructurePtr,
bool monitorMode);
257long ExtractScalarValue(
PVA_OVERALL *pva,
long index, epics::pvData::PVFieldPtr PVFieldPtr,
bool monitorMode);
258long ExtractScalarArrayValue(
PVA_OVERALL *pva,
long index, epics::pvData::PVFieldPtr PVFieldPtr,
bool monitorMode);
259long ExtractStructureValue(
PVA_OVERALL *pva,
long index, epics::pvData::PVFieldPtr PVFieldPtr,
bool monitorMode);
261long PutNTScalarValue(
PVA_OVERALL *pva,
long index);
262long PutNTScalarArrayValue(
PVA_OVERALL *pva,
long index);
264long PutScalarValue(
PVA_OVERALL *pva,
long index, epics::pvData::PVFieldPtr PVFieldPtr);
265long PutScalarArrayValue(
PVA_OVERALL *pva,
long index, epics::pvData::PVFieldPtr PVFieldPtr);
266long PutStructureValue(
PVA_OVERALL *pva,
long index, epics::pvData::PVFieldPtr PVFieldPtr);