|
@@ -1234,6 +1234,18 @@ int CVtmLoaderFSM::EntityLoad()
|
|
|
DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM)("StartEntity InteractiveControl failed(%d).", eErrCode);
|
|
|
return -1;
|
|
|
}
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("to start entity MediaController");
|
|
|
+ eErrCode = pFuncPrivilege->StartEntity("MediaController", NULL, spWait);
|
|
|
+ if (eErrCode == Error_Succeed)
|
|
|
+ {
|
|
|
+ if (spWait != NULL)
|
|
|
+ eErrCode = spWait->WaitAnswer(MAX_AYSNC_TIMEOUT);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM)("StartEntity MediaController failed(%d).", eErrCode);
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("to start entity AccessAuthorization");
|
|
|
eErrCode = pFuncPrivilege->StartEntity("AccessAuthorization", NULL, spWait);
|
|
|
if (eErrCode == Error_Succeed)
|
|
@@ -1965,12 +1977,14 @@ void CVtmLoaderFSM::CheckDeviceEntity(SpReqAnsContext<VtmLoaderService_CheckDevi
|
|
|
}
|
|
|
|
|
|
CEntityStaticInfo staticInfo;
|
|
|
- if (m_pEntity->GetFunction()->GetEntityStaticInfo(ctx->Req.entityName.GetData(), staticInfo) != Error_Succeed)
|
|
|
+ ErrorCodeEnum eErrCode = Error_Unexpect;
|
|
|
+ if ((eErrCode = m_pEntity->GetFunction()->GetEntityStaticInfo(ctx->Req.entityName.GetData(), staticInfo)) != Error_Succeed)
|
|
|
{
|
|
|
+ DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM)("GetEntityStaticInfo(%s), failed:%d", ctx->Req.entityName.GetData(), eErrCode);
|
|
|
ctx->Answer(Error_Unexpect, VtmLoader_FailToGetEntityInfo);
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("staticInfo.wEntityDevelopID:%x", staticInfo.wEntityDevelopID);
|
|
|
switch (staticInfo.wEntityDevelopID)
|
|
|
{
|
|
|
case 0x201:
|
|
@@ -2587,9 +2601,10 @@ void CVtmLoaderFSM::CheckVideo(SpReqAnsContext<VtmLoaderService_CheckDeviceEntit
|
|
|
ctx->Answer(Error_Unexpect, VtmLoader_FailToGetEntityInfo);
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
+ m_bMediaControllerOK = false;
|
|
|
//(re)start entity
|
|
|
eErrCode = pFuncPrivilege->StartEntity(ctx->Req.entityName.GetData(), NULL, spWait);
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("StartEntity %s eErrCode(%d).", ctx->Req.entityName.GetData(), eErrCode);
|
|
|
if (eErrCode == Error_Succeed)
|
|
|
{
|
|
|
if (spWait != NULL)
|
|
@@ -2614,27 +2629,38 @@ void CVtmLoaderFSM::CheckVideo(SpReqAnsContext<VtmLoaderService_CheckDeviceEntit
|
|
|
{
|
|
|
CSimpleStringA csCameraState("");
|
|
|
eErrCode = GetEntityBase()->GetFunction()->GetSysVar("CameraState", csCameraState);
|
|
|
- if (eErrCode == Error_Succeed && csCameraState.Compare("N") == 0)
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("eErrCode:%d csCameraState:%s", eErrCode, csCameraState.GetData());
|
|
|
+ if (!m_bMediaControllerOK)
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("wait for MediaController to check video setting");
|
|
|
+ else if (eErrCode == Error_Succeed && csCameraState.Compare("N") == 0)
|
|
|
+ {
|
|
|
ctx->Answer(Error_Succeed);
|
|
|
+ return;
|
|
|
+ }
|
|
|
else
|
|
|
+ {
|
|
|
ctx->Answer(Error_Unexpect, VtmLoader_FailToStartEntity);
|
|
|
- return;
|
|
|
+ return;
|
|
|
+ }
|
|
|
}
|
|
|
else if (runInfo.eState == EntityState_Lost || runInfo.eState == EntityState_Close || runInfo.eState == EntityState_Killed)
|
|
|
{
|
|
|
+ DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM)("runInfo.eState:%d", runInfo.eState);
|
|
|
ctx->Answer(Error_Unexpect, VtmLoader_FailToStartEntity);
|
|
|
return;
|
|
|
}
|
|
|
+ Sleep(2000);
|
|
|
count++;
|
|
|
if (count > 5)
|
|
|
{
|
|
|
+ DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM)("after timeout, entity state is not right");
|
|
|
ctx->Answer(Error_Unexpect, VtmLoader_FailToStartEntity);
|
|
|
return;
|
|
|
}
|
|
|
- Sleep(2000);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+ DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM)("failed to GetEntityRunInfo, eErrCode:%d", eErrCode);
|
|
|
ctx->Answer(Error_Unexpect, VtmLoader_FailToStartEntity);
|
|
|
return;
|
|
|
}
|