Index: sources/storage/TreatmentLog.cpp =================================================================== diff -u -r3b323bd6a1a03429c2321a889049de1c3b11302f -r0a93485b19d83e73b7a92157d6dc084be585cfff --- sources/storage/TreatmentLog.cpp (.../TreatmentLog.cpp) (revision 3b323bd6a1a03429c2321a889049de1c3b11302f) +++ sources/storage/TreatmentLog.cpp (.../TreatmentLog.cpp) (revision 0a93485b19d83e73b7a92157d6dc084be585cfff) @@ -61,18 +61,9 @@ readEventTitles(); }); - connect(&_ApplicationController , - QOverload< const AdjustSerialNumberHDResponseData & >::of( &ApplicationController::didActionReceive ), - [ this ] ( const AdjustSerialNumberHDResponseData &vData ) - { - // The serial number is going to be received from HD - // on POST or on request - // and will be used for the device ID - // which we designed initially to be different. - _deviceID = vData.mSerialNumber; - }); + connect(&_ApplicationController, SIGNAL(didActionReceive(const AdjustSerialNumberHDResponseData &)), + this , SLOT( onActionReceive(const AdjustSerialNumberHDResponseData &))); - connect(&_Logger , SIGNAL(didLogPathSet(Logger::LogType, const QString &)), this , SLOT( onLogPathSet(Logger::LogType, const QString &))); @@ -177,6 +168,7 @@ void TreatmentLog::timerEvent(QTimerEvent *) { testPendingTxReports(); + testPendingHDSerial(); } /*! @@ -535,6 +527,12 @@ } } +void TreatmentLog::onActionReceive(const AdjustSerialNumberHDResponseData &vData) +{ + _deviceID = vData.mSerialNumber; + LOG_DEBUG(tr("Received HD serial number %1").arg(_deviceID)); +} + /*! * \brief TreatmentLog::onTxCodeReceive * \details this slot will update the treatment code sent by CS. @@ -637,6 +635,7 @@ } QFileInfoList pendingFiles; + pendingFiles = Storage::FileHandler::find( _TreatmentLog.logPath(), { QString("*.%1").arg(_treatmentLogExtPending) } ); // look into the list. // if there are pending files, @@ -656,3 +655,18 @@ emit didPendingTxr( _pendingTxr ); } } + +void TreatmentLog::testPendingHDSerial() +{ + if ( _pendingCounterHDSerial ) { + _pendingCounterHDSerial -- ; + return; + } + else { + _pendingCounterHDSerial = _pendingIntervalHDSerial; // every 10 seconds + } + + if (_deviceID.trimmed() == _deviceIDDefault) { + _ApplicationController.versionsRequest(); + } +}