##// END OF EJS Templates
Improve acquisition robustness
perrinel -
r818:5251097ccf22
parent child
Show More
@@ -105,9 +105,6 struct VariableController::VariableControllerPrivate {
105 void processRequest(std::shared_ptr<Variable> var, const SqpRange &rangeRequested,
105 void processRequest(std::shared_ptr<Variable> var, const SqpRange &rangeRequested,
106 QUuid varRequestId);
106 QUuid varRequestId);
107
107
108 QVector<SqpRange> provideNotInCacheDateTimeList(std::shared_ptr<Variable> variable,
109 const SqpRange &dateTime);
110
111 std::shared_ptr<Variable> findVariable(QUuid vIdentifier);
108 std::shared_ptr<Variable> findVariable(QUuid vIdentifier);
112 std::shared_ptr<IDataSeries>
109 std::shared_ptr<IDataSeries>
113 retrieveDataSeries(const QVector<AcquisitionDataPacket> acqDataPacketVector);
110 retrieveDataSeries(const QVector<AcquisitionDataPacket> acqDataPacketVector);
@@ -596,13 +593,10 void VariableController::VariableControllerPrivate::processRequest(std::shared_p
596 auto varStrategyRangesRequested
593 auto varStrategyRangesRequested
597 = m_VariableCacheStrategy->computeRange(oldRange, rangeRequested);
594 = m_VariableCacheStrategy->computeRange(oldRange, rangeRequested);
598
595
599 auto notInCacheRangeList = QVector<SqpRange>{varStrategyRangesRequested.second};
596 auto notInCacheRangeList
600 auto inCacheRangeList = QVector<SqpRange>{};
597 = Variable::provideNotInCacheRangeList(oldRange, varStrategyRangesRequested.second);
601 if (m_VarIdToVarRequestIdQueueMap.find(varId) == m_VarIdToVarRequestIdQueueMap.cend()) {
598 auto inCacheRangeList
602 notInCacheRangeList
599 = Variable::provideInCacheRangeList(oldRange, varStrategyRangesRequested.second);
603 = var->provideNotInCacheRangeList(varStrategyRangesRequested.second);
604 inCacheRangeList = var->provideInCacheRangeList(varStrategyRangesRequested.second);
605 }
606
600
607 if (!notInCacheRangeList.empty()) {
601 if (!notInCacheRangeList.empty()) {
608 varRequest.m_RangeRequested = varStrategyRangesRequested.first;
602 varRequest.m_RangeRequested = varStrategyRangesRequested.first;
@@ -804,26 +798,22 void VariableController::VariableControllerPrivate::updateVariableRequest(QUuid
804 var->setRange(varRequest.m_RangeRequested);
798 var->setRange(varRequest.m_RangeRequested);
805 var->setCacheRange(varRequest.m_CacheRangeRequested);
799 var->setCacheRange(varRequest.m_CacheRangeRequested);
806 qCDebug(LOG_VariableController()) << tr("1: onDataProvided")
800 qCDebug(LOG_VariableController()) << tr("1: onDataProvided")
807 << varRequest.m_RangeRequested;
801 << varRequest.m_RangeRequested
808 qCDebug(LOG_VariableController()) << tr("2: onDataProvided")
809 << varRequest.m_CacheRangeRequested;
802 << varRequest.m_CacheRangeRequested;
803 qCDebug(LOG_VariableController()) << tr("2: onDataProvided var points before")
804 << var->nbPoints()
805 << varRequest.m_DataSeries->nbPoints();
810 var->mergeDataSeries(varRequest.m_DataSeries);
806 var->mergeDataSeries(varRequest.m_DataSeries);
811 qCDebug(LOG_VariableController()) << tr("3: onDataProvided");
807 qCDebug(LOG_VariableController()) << tr("3: onDataProvided var points after")
808 << var->nbPoints();
812
809
813 /// @todo MPL: confirm
814 // Variable update is notified only if there is no pending request for it
815 // if
816 // (m_VarIdToVarRequestIdQueueMap.count(varIdToVarRequestMapIt->first)
817 // == 0) {
818 emit var->updated();
810 emit var->updated();
819 // }
820 }
811 }
821 else {
812 else {
822 qCCritical(LOG_VariableController())
813 qCCritical(LOG_VariableController())
823 << tr("Impossible to update data to a null variable");
814 << tr("Impossible to update data to a null variable");
824 }
815 }
825 }
816 }
826
827 // cleaning varRequestId
817 // cleaning varRequestId
828 qCDebug(LOG_VariableController()) << tr("0: erase REQUEST in MAP ?")
818 qCDebug(LOG_VariableController()) << tr("0: erase REQUEST in MAP ?")
829 << m_VarRequestIdToVarIdVarRequestMap.size();
819 << m_VarRequestIdToVarIdVarRequestMap.size();
@@ -850,12 +840,10 void VariableController::VariableControllerPrivate::cancelVariableRequest(QUuid
850 std::remove(varRequestIdQueue.begin(), varRequestIdQueue.end(), varRequestId),
840 std::remove(varRequestIdQueue.begin(), varRequestIdQueue.end(), varRequestId),
851 varRequestIdQueue.end());
841 varRequestIdQueue.end());
852 if (varRequestIdQueue.empty()) {
842 if (varRequestIdQueue.empty()) {
853
854 qCCritical(LOG_VariableController())
855 << tr("VariableControllerPrivate::cancelVariableRequest")
856 << varIdToVarRequestIdQueueMapIt->first;
857 varIdToVarRequestIdQueueMapIt
843 varIdToVarRequestIdQueueMapIt
858 = m_VarIdToVarRequestIdQueueMap.erase(varIdToVarRequestIdQueueMapIt);
844 = m_VarIdToVarRequestIdQueueMap.erase(varIdToVarRequestIdQueueMapIt);
845
846 // Recompute if there is any next request based on the removed request.
859 }
847 }
860 else {
848 else {
861 ++varIdToVarRequestIdQueueMapIt;
849 ++varIdToVarRequestIdQueueMapIt;
@@ -180,7 +180,6 void CosinusProvider::requestDataLoading(QUuid acqIdentifier,
180 for (const auto &dateTime : qAsConst(times)) {
180 for (const auto &dateTime : qAsConst(times)) {
181 if (m_VariableToEnableProvider[acqIdentifier]) {
181 if (m_VariableToEnableProvider[acqIdentifier]) {
182 auto scalarSeries = this->retrieveData(acqIdentifier, dateTime, parameters.m_Data);
182 auto scalarSeries = this->retrieveData(acqIdentifier, dateTime, parameters.m_Data);
183 qCCritical(LOG_CosinusProvider()) << "TORM: CosinusProvider::dataProvided";
184 emit dataProvided(acqIdentifier, scalarSeries, dateTime);
183 emit dataProvided(acqIdentifier, scalarSeries, dateTime);
185 }
184 }
186 }
185 }
@@ -188,7 +187,6 void CosinusProvider::requestDataLoading(QUuid acqIdentifier,
188
187
189 void CosinusProvider::requestDataAborting(QUuid acqIdentifier)
188 void CosinusProvider::requestDataAborting(QUuid acqIdentifier)
190 {
189 {
191 // TODO: Add Mutex
192 qCDebug(LOG_CosinusProvider()) << "CosinusProvider::requestDataAborting" << acqIdentifier
190 qCDebug(LOG_CosinusProvider()) << "CosinusProvider::requestDataAborting" << acqIdentifier
193 << QThread::currentThread()->objectName();
191 << QThread::currentThread()->objectName();
194 auto it = m_VariableToEnableProvider.find(acqIdentifier);
192 auto it = m_VariableToEnableProvider.find(acqIdentifier);
@@ -196,7 +194,7 void CosinusProvider::requestDataAborting(QUuid acqIdentifier)
196 it.value() = false;
194 it.value() = false;
197 }
195 }
198 else {
196 else {
199 qCWarning(LOG_CosinusProvider())
197 qCDebug(LOG_CosinusProvider())
200 << tr("Aborting progression of inexistant identifier detected !!!");
198 << tr("Aborting progression of inexistant identifier detected !!!");
201 }
199 }
202 }
200 }
General Comments 0
You need to be logged in to leave comments. Login now