Skip to content

Commit

Permalink
Update MaintenanceManager.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
gomathishankar37 authored Jan 10, 2025
1 parent a938ce7 commit 0d6b213
Showing 1 changed file with 18 additions and 19 deletions.
37 changes: 18 additions & 19 deletions MaintenanceManager/MaintenanceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -356,13 +356,13 @@ namespace WPEFramework {
exitOnNoNetwork = true;
}
}
#else /* Unsolicited & Solicited Maintenance in WHOAMI */
#else /* Unsolicited & Solicited Maintenance */
if(!internetConnectStatus)
{
exitOnNoNetwork = true;
}
#endif
if(exitOnNoNetwork)
if(exitOnNoNetwork) /* Exit Maintenance Cycle if no Internet */
{
m_statusMutex.lock();
MaintenanceManager::_instance->onMaintenanceStatusChange(MAINTENANCE_ERROR);
Expand Down Expand Up @@ -479,7 +479,7 @@ namespace WPEFramework {
}
}while(true);
}
#endif /* WhoAmI */
#endif

// Thunder plugin communication
WPEFramework::JSONRPC::LinkType<WPEFramework::Core::JSON::IElement>* MaintenanceManager::getThunderPluginHandle(const char* callsign)
Expand Down Expand Up @@ -938,11 +938,10 @@ namespace WPEFramework {
m_service->AddRef();
#if defined(ENABLE_WHOAMI)
subscribeToDeviceInitializationEvent();
#endif /* WhoAmI */
#endif
#if defined(USE_IARMBUS) || defined(USE_IARM_BUS)
InitializeIARM();
#endif /* defined(USE_IARMBUS) || defined(USE_IARM_BUS) */

#endif
/* On Success; return empty to indicate no error text. */
return (string());
}
Expand All @@ -952,7 +951,7 @@ namespace WPEFramework {
#if defined(USE_IARMBUS) || defined(USE_IARM_BUS)
stopMaintenanceTasks();
DeinitializeIARM();
#endif /* defined(USE_IARMBUS) || defined(USE_IARM_BUS) */
#endif

ASSERT(service == m_service);

Expand All @@ -979,7 +978,7 @@ namespace WPEFramework {
MaintenanceManager::m_notify_status=MAINTENANCE_IDLE;
MaintenanceManager::g_epoch_time="";

/* to know the maintenance is solicited or unsolicited */
/* to know whether the maintenance is solicited or unsolicited */
g_maintenance_type=UNSOLICITED_MAINTENANCE;
LOGINFO("Triggering Maintenance on bootup");

Expand All @@ -1004,7 +1003,7 @@ namespace WPEFramework {
MaintenanceManager::m_abort_flag=false;
MaintenanceManager::g_unsolicited_complete = false;

/* we post just to tell that we are in idle at this moment */
/* we post to tell that the maintenance is in idle state at this moment */
m_statusMutex.lock();
MaintenanceManager::_instance->onMaintenanceStatusChange(m_notify_status);
m_statusMutex.unlock();
Expand Down Expand Up @@ -1091,7 +1090,7 @@ namespace WPEFramework {
break;
case MAINT_FWDOWNLOAD_ABORTED:
SET_STATUS(g_task_status,TASK_SKIPPED);
/* we say FW update task complete */
/* Set FWDOWNLOAD Task as completed */
SET_STATUS(g_task_status,DIFD_COMPLETE);
task_thread.notify_one();
m_task_map[task_names_foreground[1].c_str()]=false;
Expand Down Expand Up @@ -1137,17 +1136,17 @@ namespace WPEFramework {
break;
case MAINT_RFC_INPROGRESS:
m_task_map[task_names_foreground[0].c_str()]=true;
/*will be set to false once COMEPLETE/ERROR received for RFC*/
/* Set false once COMPLETE/ ERROR is received for RFC*/
LOGINFO(" RFC already IN PROGRESS -> setting m_task_map of RFC to true \n");
break;
case MAINT_FWDOWNLOAD_INPROGRESS:
m_task_map[task_names_foreground[1].c_str()]=true;
/*will be set to false once COMEPLETE/ERROR received for FWDOWNLOAD*/
/* Set false once COMPLETE/ ERROR is received for FWDOWNLOAD*/
LOGINFO(" FWDOWNLOAD already IN PROGRESS -> setting m_task_map of FWDOWNLOAD to true \n");
break;
case MAINT_LOGUPLOAD_INPROGRESS:
m_task_map[task_names_foreground[2].c_str()]=true;
/*will be set to false once COMEPLETE/ERROR received for LOGUPLOAD*/
/* Set false once COMPLETE/ ERROR is received for LOGUPLOAD*/
LOGINFO(" LOGUPLOAD already IN PROGRESS -> setting m_task_map of LOGUPLOAD to true \n");
break;
default:
Expand All @@ -1161,13 +1160,13 @@ namespace WPEFramework {
}

LOGINFO(" BITFIELD Status : %x",g_task_status);
/* Send the updated status only if all task completes execution
* until that we say maintenance started */
/* Send the updated status only if all tasks complete execution
* Until that Maintenance is in started state */
if ( (g_task_status & TASKS_COMPLETED ) == TASKS_COMPLETED ){
if ( (g_task_status & ALL_TASKS_SUCCESS) == ALL_TASKS_SUCCESS ){ // all tasks success
LOGINFO("DBG:Maintenance Successfully Completed!!");
notify_status=MAINTENANCE_COMPLETE;
/* we store the time in persistant location */
/* we store the time in persistent location */
successfulTime=time(nullptr);
tm ltime=*localtime(&successfulTime);
time_t epoch_time=mktime(&ltime);
Expand All @@ -1178,7 +1177,7 @@ namespace WPEFramework {
m_setting.setValue("LastSuccessfulCompletionTime",str_successfulTime);

}
/* Check other than all success case which means we have errors */
/* Check other than all success cases which means we have errors */
else if ((g_task_status & ALL_TASKS_SUCCESS)!= ALL_TASKS_SUCCESS) {
if ((g_task_status & MAINTENANCE_TASK_SKIPPED ) == MAINTENANCE_TASK_SKIPPED ){
LOGINFO("DBG:There are Skipped Task. Maintenance Incomplete");
Expand Down Expand Up @@ -1224,7 +1223,7 @@ namespace WPEFramework {
MaintenanceManager::_instance = nullptr;
}
}
#endif /* defined(USE_IARMBUS) || defined(USE_IARM_BUS) */
#endif

#ifdef DEBUG
/**
Expand All @@ -1238,7 +1237,7 @@ namespace WPEFramework {
sendNotify(EVT_ONMAINTMGRSAMPLEEVENT, parameters);
returnResponse(true);
}
#endif /* DEBUG */
#endif

/*
* @brief This function returns the status of the current
Expand Down

0 comments on commit 0d6b213

Please sign in to comment.