working on issue #56; still problems with monitor
This commit is contained in:
@ -360,8 +360,10 @@ public:
|
||||
void connect();
|
||||
/**
|
||||
* @brief Get each channel.
|
||||
*
|
||||
* @param valueOnly use only value for union.
|
||||
*/
|
||||
void get();
|
||||
void get(bool valueOnly = true);
|
||||
/**
|
||||
* @brief Get the data from the last get.
|
||||
* @return the pvaClientNTMultiData.
|
||||
@ -476,10 +478,11 @@ public:
|
||||
/**
|
||||
* @brief Poll each channel.
|
||||
*
|
||||
* @param valueOnly use only value for union.
|
||||
* If any has new data it is used to update the double[].
|
||||
* @return (false,true) if (no, at least one) value was updated.
|
||||
*/
|
||||
bool poll();
|
||||
bool poll(bool valueOnly = true);
|
||||
/**
|
||||
* @brief Wait until poll returns true.
|
||||
* @param secondsToWait The time to keep trying.
|
||||
@ -551,11 +554,12 @@ public:
|
||||
* @brief Set the timeStamp base for computing deltaTimes.
|
||||
*/
|
||||
void startDeltaTime();
|
||||
|
||||
/**
|
||||
* @brief Update NTMultiChannel fields.
|
||||
*
|
||||
* @param valueOnly use only value for union.
|
||||
*/
|
||||
void endDeltaTime();
|
||||
void endDeltaTime(bool valueOnly = true);
|
||||
/**
|
||||
* @brief Get the time when the last get was made.
|
||||
* @return The timeStamp.
|
||||
@ -579,7 +583,6 @@ private:
|
||||
PvaClientMultiChannelPtr const &pvaNTMultiChannel,
|
||||
PvaClientChannelArray const &pvaClientChannelArray,
|
||||
epics::pvData::PVStructurePtr const & pvRequest);
|
||||
void setStructure(epics::pvData::StructureConstPtr const & structure,size_t index);
|
||||
void setPVStructure(
|
||||
epics::pvData::PVStructurePtr const &pvStructure,size_t index);
|
||||
|
||||
|
@ -44,10 +44,6 @@ PvaClientNTMultiData::PvaClientNTMultiData(
|
||||
gotTimeStamp(false)
|
||||
{
|
||||
if(PvaClient::getDebug()) cout<< "PvaClientNTMultiData::PvaClientNTMultiData()\n";
|
||||
PVFieldPtr pvValue = pvRequest->getSubField("field.value");
|
||||
if(!pvValue) {
|
||||
throw std::runtime_error("pvRequest did not specify value");
|
||||
}
|
||||
topPVStructure.resize(nchannel);
|
||||
unionValue.resize(nchannel);
|
||||
PVDataCreatePtr pvDataCreate = getPVDataCreate();
|
||||
@ -88,18 +84,6 @@ PvaClientNTMultiData::~PvaClientNTMultiData()
|
||||
if(PvaClient::getDebug()) cout<< "PvaClientNTMultiData::~PvaClientNTMultiData()\n";
|
||||
}
|
||||
|
||||
|
||||
void PvaClientNTMultiData::setStructure(StructureConstPtr const & structure,size_t index)
|
||||
{
|
||||
FieldConstPtr field = structure->getField("value");
|
||||
if(!field) {
|
||||
string message = "channel "
|
||||
+ pvaClientChannelArray[index]->getChannel()->getChannelName()
|
||||
+ " does not have top level value field";
|
||||
throw std::runtime_error(message);
|
||||
}
|
||||
}
|
||||
|
||||
void PvaClientNTMultiData::setPVStructure(
|
||||
PVStructurePtr const &pvStructure,size_t index)
|
||||
{
|
||||
@ -137,7 +121,7 @@ void PvaClientNTMultiData::startDeltaTime()
|
||||
}
|
||||
|
||||
|
||||
void PvaClientNTMultiData::endDeltaTime()
|
||||
void PvaClientNTMultiData::endDeltaTime(bool valueOnly)
|
||||
{
|
||||
for(size_t i=0; i<nchannel; ++i)
|
||||
{
|
||||
@ -145,7 +129,16 @@ void PvaClientNTMultiData::endDeltaTime()
|
||||
if(!pvst) {
|
||||
unionValue[i] = PVUnionPtr();
|
||||
} else if(unionValue[i]) {
|
||||
unionValue[i]->set(pvst->getSubField("value"));
|
||||
if(valueOnly) {
|
||||
PVFieldPtr pvValue = pvst->getSubField("value");
|
||||
if(pvValue) {
|
||||
unionValue[i]->set(pvst->getSubField("value"));
|
||||
} else {
|
||||
unionValue[i] = PVUnionPtr();
|
||||
}
|
||||
} else {
|
||||
unionValue[i]->set(pvst);
|
||||
}
|
||||
if(gotAlarm)
|
||||
{
|
||||
PVIntPtr pvSeverity = pvst->getSubField<PVInt>("alarm.severity");
|
||||
|
@ -63,13 +63,10 @@ void PvaClientNTMultiGet::connect()
|
||||
{
|
||||
pvaClientGet.resize(nchannel);
|
||||
shared_vector<epics::pvData::boolean> isConnected = pvaClientMultiChannel->getIsConnected();
|
||||
string request = "value";
|
||||
if(pvRequest->getSubField("field.alarm")) request += ",alarm";
|
||||
if(pvRequest->getSubField("field.timeStamp")) request += ",timeStamp";
|
||||
for(size_t i=0; i<nchannel; ++i)
|
||||
{
|
||||
if(isConnected[i]) {
|
||||
pvaClientGet[i] = pvaClientChannelArray[i]->createGet(request);
|
||||
pvaClientGet[i] = pvaClientChannelArray[i]->createGet(pvRequest);
|
||||
pvaClientGet[i]->issueConnect();
|
||||
}
|
||||
}
|
||||
@ -86,7 +83,7 @@ void PvaClientNTMultiGet::connect()
|
||||
this->isConnected = true;
|
||||
}
|
||||
|
||||
void PvaClientNTMultiGet::get()
|
||||
void PvaClientNTMultiGet::get(bool valueOnly)
|
||||
{
|
||||
if(!isConnected) connect();
|
||||
shared_vector<epics::pvData::boolean> isConnected = pvaClientMultiChannel->getIsConnected();
|
||||
@ -114,7 +111,7 @@ void PvaClientNTMultiGet::get()
|
||||
pvaClientNTMultiData->setPVStructure(pvaClientGet[i]->getData()->getPVStructure(),i);
|
||||
}
|
||||
}
|
||||
pvaClientNTMultiData->endDeltaTime();
|
||||
pvaClientNTMultiData->endDeltaTime(valueOnly);
|
||||
}
|
||||
|
||||
PvaClientNTMultiDataPtr PvaClientNTMultiGet::getData()
|
||||
|
@ -67,13 +67,10 @@ void PvaClientNTMultiMonitor::connect()
|
||||
{
|
||||
pvaClientMonitor.resize(nchannel);
|
||||
shared_vector<epics::pvData::boolean> isConnected = pvaClientMultiChannel->getIsConnected();
|
||||
string request = "value";
|
||||
if(pvRequest->getSubField("field.alarm")) request += ",alarm";
|
||||
if(pvRequest->getSubField("field.timeStamp")) request += ",timeStamp";
|
||||
for(size_t i=0; i<nchannel; ++i)
|
||||
{
|
||||
if(isConnected[i]) {
|
||||
pvaClientMonitor[i] = pvaClientChannelArray[i]->createMonitor(request);
|
||||
pvaClientMonitor[i] = pvaClientChannelArray[i]->createMonitor(pvRequest);
|
||||
pvaClientMonitor[i]->issueConnect();
|
||||
}
|
||||
}
|
||||
@ -94,7 +91,7 @@ void PvaClientNTMultiMonitor::connect()
|
||||
this->isConnected = true;
|
||||
}
|
||||
|
||||
bool PvaClientNTMultiMonitor::poll()
|
||||
bool PvaClientNTMultiMonitor::poll(bool valueOnly)
|
||||
{
|
||||
if(!isConnected) connect();
|
||||
bool result = false;
|
||||
@ -111,7 +108,7 @@ bool PvaClientNTMultiMonitor::poll()
|
||||
}
|
||||
}
|
||||
}
|
||||
if(result) pvaClientNTMultiData->endDeltaTime();
|
||||
if(result) pvaClientNTMultiData->endDeltaTime(valueOnly);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user