|
|
@@ -72,8 +72,7 @@ unsigned int CUpsFSM::s0_on_event(FSMEvent* e)
|
|
|
e->SetHandled();
|
|
|
ShutDownTask* task = new ShutDownTask(this);
|
|
|
ShutDownEvent* sde = dynamic_cast<ShutDownEvent*>(e);
|
|
|
- task->ctx = sde->ctx; //oiltest
|
|
|
- Dbg("%d, in %d",sde->ctx->Req.ShutdownTime, sde->ctx->Req.UpTime);
|
|
|
+ task->ctx = sde->ctx;
|
|
|
GetEntityBase()->GetFunction()->PostThreadPoolTask(task);
|
|
|
return 0;
|
|
|
}
|
|
|
@@ -83,10 +82,10 @@ unsigned int CUpsFSM::s0_on_event(FSMEvent* e)
|
|
|
e->SetHandled();
|
|
|
UpsStatusEnum eUpsState;
|
|
|
ErrorCodeEnum eErrState = m_hDevHelper->GetDevStatus(eUpsState);
|
|
|
- Dbg("%d,%d",eErrState,eUpsState);
|
|
|
+ Dbg("%s,%d",SpStrError(eErrState), eUpsState);
|
|
|
GetStatusEvent* pGse = dynamic_cast<GetStatusEvent*>(e);
|
|
|
pGse->ctx->Ans.Status = eUpsState;
|
|
|
- Dbg("%d",pGse->ctx->Ans.Status);
|
|
|
+ Dbg("status: %d",pGse->ctx->Ans.Status);
|
|
|
pGse->ctx->Answer(eErrState);
|
|
|
}
|
|
|
break;
|
|
|
@@ -140,10 +139,12 @@ unsigned int CUpsFSM::s2_on_event(FSMEvent* pEvt)
|
|
|
}
|
|
|
return ret;
|
|
|
}
|
|
|
+
|
|
|
int CUpsFSM::ShutDown(SpReqAnsContext<UpsService_Shutdown_Req,UpsService_Shutdown_Ans>::Pointer ctx)
|
|
|
{
|
|
|
LOG_FUNCTION();
|
|
|
UpsStatusEnum eUpsStatus;
|
|
|
+ Dbg("shutdown time: %d, uptime: %d", ctx->Req.ShutdownTime, ctx->Req.UpTime);
|
|
|
ErrorCodeEnum err = m_hDevHelper->GetDevStatus(eUpsStatus);
|
|
|
Dbg("(%d)status:[%d],%d,%d",err,eUpsStatus,ctx->Req.ShutdownTime,ctx->Req.UpTime);
|
|
|
err = m_hDevHelper->Shutdown(ctx->Req.ShutdownTime,ctx->Req.UpTime);
|