本文整理汇总了C++中DipData::extractDataQuality方法的典型用法代码示例。如果您正苦于以下问题:C++ DipData::extractDataQuality方法的具体用法?C++ DipData::extractDataQuality怎么用?C++ DipData::extractDataQuality使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DipData
的用法示例。
在下文中一共展示了DipData::extractDataQuality方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleMessage
/*
Now the API manager can be reconfigured at run time. This means that DPE's
can be
1)added
2)removed
3)changed.
What we do NOT want to happen is that these opertions occur the when in the handler
as it will mess up the iterators and possibly the CdipDpeBridge::addValueToList operation,
so we lock this instance so that add/removes can not it can not occur whilst the handler
is iterating though the list.
*/
void CdipSubscription::handleMessage(DipSubscription* subscription, DipData& data){
//PVSSTRACE(TRACEIN,"CdipSubscription::handleMessage()");
if (this->mustGetLastPubValue()){
/**
* clear any pending update request, since we have just received the data
* the new mapping needed (see mustGetLastPubValueFlag).
* this situation may occur (for example) if updating a DPE mapping configuration
* will cause two (or more) mappings are made to an newly created subscription. The 2nd
* mapping would cause the mustGetLastPubValueFlag to be set, whilst the creation of
* the subscription will cause this subscription to automatically receive the last transmitted
* publication data. If we do'nt clear the flag this subscription will request the data a second
* time, if we don't have this mechanism subsequent mappings may not recv a value until the
* subscribed to publication explicitly publishes a new value(s).
*/
this->mustGetLastPubValueFlag = false;
}
if (data.extractDataQuality() == DIP_QUALITY_UNINITIALIZED){
PVSSLOG(ErrClass::PRIO_INFO, "Uninitialized DIP data received for :"<<subscription->getTopicName()<<", skipped.");
return;
}
//PVSSLOG(ErrClass::PRIO_INFO, "Data received and being processed.");
//PVSSINFO("DIP-70 Subscription data received " << (int)data.size() << " data fields from pub " << (const char *)(this->getPubName()) << " with ts " << data.extractDipTime().getAsMillis() << " quality "<< data.extractDataQuality());
try{
DpIdValueList *list = new DpIdValueList();
//MD In case the DIP data time is older than datapoints time ,
// then force current time and send a Warning message with the previous time and the new time.
DipLong lastTagMappingUpdateTimestamp = 0l;
DipLong timeInMs = 0l;
{
SmutexGuard guard(lock); // lock this instance whilst in this code block
std::vector<CdipDataMapping *>::const_iterator it = tagMappings.begin();
lastTagMappingUpdateTimestamp = ((*it)->timeSecondsPVSS)*1000L + (*it)->timeMSecPVSS;
if (data.extractDipTime().getAsMillis() <= lastTagMappingUpdateTimestamp) {
//Use current time instead and send warning.
timeInMs = getCurrentTimeAsDipLong();
PVSSINFO("Data from: "<<subscription->getTopicName()<<" has an older timestamp than PVSS, changed to current time.");
addMappedDPEValueInformationToUpdateList(*list, data, timeInMs,data.extractDipTime().getAsMillis(), true, true);
} else if( data.extractDipTime().getAsMillis() > getCurrentTimeAsDipLong()){
// DIP-44 Case where the DIP value is in the future, we force it to current time but
// raise the User bit to indicate source time discrepancy
timeInMs = getCurrentTimeAsDipLong();
addMappedDPEValueInformationToUpdateList(*list, data, timeInMs, 0, true, true);
} else {
timeInMs = data.extractDipTime().getAsMillis();
addMappedDPEValueInformationToUpdateList(*list, data, timeInMs, 0, true, false);
}
////
// The validity check must happen AFTER the DIP data has been parsed
// because it is only by trying to convert DIP data to DPE that we can
// determine whether the DPE is invalid or not
addMappedDPEValidityStatusToUpdateList(*list);
/////
}
sendListOfUpdatesToPVSS(list, timeInMs);
//PVSSINFO("Handle: List size = " << (int)list->getNumberOfItems ()<<".")
} catch (std::runtime_error &de){
PVSSERROR("Exception " << de.what() <<
" thrown in handler for pub" <<
(const char *)this->getPubName());
int numFields;
const char ** fields = data.getTags(numFields);
PVSSINFO("Fields in publication are:-");
for (int i = 0; i < numFields; i++){
PVSSINFO(i << " " << fields[i]);
}
} catch (...){
PVSSERROR("Exception thrown in handler for pub " <<
(const char *)this->getPubName());
}
//PVSSTRACE(TRACEOUT,"CdipSubscription::handleMessage()");
}