Index: sources/ApplicationController.cpp =================================================================== diff -u -r313bf0c5efcc7300b57fdb0f7d796ce721372eae -rb38ddcaebab3033a52139f8ad7a4178e2bda3cff --- sources/ApplicationController.cpp (.../ApplicationController.cpp) (revision 313bf0c5efcc7300b57fdb0f7d796ce721372eae) +++ sources/ApplicationController.cpp (.../ApplicationController.cpp) (revision b38ddcaebab3033a52139f8ad7a4178e2bda3cff) @@ -553,7 +553,7 @@ _post.isDone( ! _settingsError ); if ( _settingsError ) { LOG_APPED_PO(QString("Settings read failed")); - onPOSTFail(Gui::GuiAlarmID::ALARM_ID_HD_UI_POST_FAILURE_SETTINGS_BAD); + alarmTrigger(Gui::GuiAlarmID::ALARM_ID_HD_UI_POST_FAILURE_SETTINGS_BAD); } else { _Settings.datetimeFormat(); } @@ -613,27 +613,44 @@ } /*! - * \brief ApplicationController::onPOSTFail - * \details Sends the Alarm Trigger message, if the vSend is true, - * or - * Queues the alarms if vSend is false. - * \param vAlarmID - The alarm ID - * \param vSend - False to queue the ValarmID alarm ID, or True to send the list of the queued alarms. + * \brief ApplicationController::alarmTrigger + * \details Queues the alarms, or send the list, or send one alarm + * \param vAlarmID - The alarm ID to be triggered or queued. + * \param vSend - if true the list of queued alarms will be send + * \param vSingle - if true and vSend is true only the alarm vAlarmID will be triggered. */ -void ApplicationController::onPOSTFail(GuiAlarmID vAlarmID, bool vSend) { +void ApplicationController::alarmTrigger(GuiAlarmID vAlarmID, bool vSend, bool vSingle) +{ static QVector failList; if ( vSend ) { - for ( auto alarmID : failList ) { - qDebug()<< "sending POST fail alarm# "<< alarmID; - emit didActionTransmit(Gui::GuiActionType::ID_AlarmTriggered, {alarmID ,0,0,0,0,0,0,0}); + if ( vSingle ) { + emit didActionTransmit(Gui::GuiActionType::ID_AlarmTriggered, {vAlarmID ,0,0,0,0,0,0,0}); } + else { + for ( auto alarmID : failList ) { + //DEBUG qDebug()<< "sending POST fail alarm# "<< alarmID; + emit didActionTransmit(Gui::GuiActionType::ID_AlarmTriggered, {alarmID ,0,0,0,0,0,0,0}); + } + } } else { failList.append(vAlarmID); } } /*! + * \brief ApplicationController::onPOSTFail + * \details Sends the Alarm Trigger message, if the vSend is true, + * or + * Queues the alarms if vSend is false. + * \param vAlarmID - The alarm ID + * \param vSend - False to queue the ValarmID alarm ID, or True to send the list of the queued alarms. + */ +void ApplicationController::onPOSTFail(GuiAlarmID vAlarmID) { + alarmTrigger(vAlarmID, false, false); +} + +/*! * \brief ApplicationController::onPOSTDone * \details Sends the POST Final message */ @@ -690,7 +707,7 @@ //DEBUG qDebug() << " ***** " << Q_FUNC_INFO << vPass; if ( ! vPass ) { _post.isDone(vPass); - onPOSTFail(Gui::GuiAlarmID::ALARM_ID_HD_UI_POST_FAILURE_SETTINGS_BAD); + alarmTrigger(Gui::GuiAlarmID::ALARM_ID_HD_UI_POST_FAILURE_SETTINGS_BAD); } // if ( vPass ) // it needs more investigation initSettings(); @@ -703,7 +720,7 @@ void ApplicationController::onLogIOFail() { //DEBUG qDebug()<<"SENDING " << Gui::GuiAlarmID::ALARM_ID_HD_UI_SDCARD_FAILURE; - emit didActionTransmit(Gui::GuiActionType::ID_AlarmTriggered, {Gui::GuiAlarmID::ALARM_ID_HD_UI_SDCARD_FAILURE ,0,0,0,0,0,0,0}); + alarmTrigger(Gui::GuiAlarmID::ALARM_ID_HD_UI_SDCARD_FAILURE, true, true); // send, single, this happens after POST. } /*! @@ -715,14 +732,14 @@ //DEBUG qDebug() << " ***** " << Q_FUNC_INFO; if ( ! vPass ) { _post.isDone(vPass); - onPOSTFail(Gui::GuiAlarmID::ALARM_ID_HD_UI_POST_FAILURE_SETTINGS_BAD); + alarmTrigger(Gui::GuiAlarmID::ALARM_ID_HD_UI_POST_FAILURE_SETTINGS_BAD); } // HD POST // UI is done, let HD start the communication [ UI Check-in is the HD commjunication listener starter ] keepAlive(); emit didKeepAliveBegin (); - onPOSTFail (Gui::GuiAlarmID::ALARM_ID_NO_ALARM, true); // send queued fails + alarmTrigger (Gui::GuiAlarmID::ALARM_ID_NO_ALARM, true); // send queued fails postDoneRequest (); // send HD the POST result versionsRequest (); // send HD the version request emit didPOSTPass (_post.isDone( )); // GuiController -> GuiView : didPOSTPass(bool)