|
|
@@ -1931,14 +1931,12 @@ void CVtmLoaderFSM::CheckDeviceEntity(SpReqAnsContext<VtmLoaderService_CheckDevi
|
|
|
case 0x203:
|
|
|
case 0x204:
|
|
|
case 0x206:
|
|
|
+ case 0x209:
|
|
|
case 0x213:
|
|
|
case 0x217:
|
|
|
case 0x220:
|
|
|
CheckDeviceBaseEntity(ctx, staticInfo.wEntityDevelopID);
|
|
|
break;
|
|
|
- case 0x209://Gpio
|
|
|
- CheckEntityRestartIdle(ctx);
|
|
|
- break;
|
|
|
case 0x301://SIPPhone
|
|
|
CheckAudio(ctx);
|
|
|
break;
|
|
|
@@ -2394,6 +2392,56 @@ void CVtmLoaderFSM::CheckDeviceBaseEntity(SpReqAnsContext<VtmLoaderService_Check
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
+ case 0x209: //gpio
|
|
|
+ {
|
|
|
+ GpioService_ClientBase* pClient = new GpioService_ClientBase(this->m_pEntity);
|
|
|
+ if (pClient != NULL)
|
|
|
+ {
|
|
|
+ eErrCode = pClient->Connect();
|
|
|
+ if (eErrCode == Error_Succeed)
|
|
|
+ {
|
|
|
+ int retryTimes = maxRetryTimes;
|
|
|
+ do {
|
|
|
+ GpioService_GetDevInfo_Req reqQ;
|
|
|
+ GpioService_GetDevInfo_Ans ansQ;
|
|
|
+ eErrCode = (*pClient)(EntityResource::getLink().upgradeLink())->GetDevInfo(reqQ, ansQ, 5000);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("eErrCode:%d,ansQ.state:%d", eErrCode, ansQ.state);
|
|
|
+ if (eErrCode == Error_DevNotAvailable)
|
|
|
+ {
|
|
|
+ DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM).setLogCode(VtmLoaderService_LogCode_CheckDeviceEntity).setResultCode("RTA1F23")("%d", eErrCode);
|
|
|
+ ctx->Answer(Error_Unexpect, VtmLoader_EntityNotInNormal);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ else if (eErrCode == Error_Succeed)
|
|
|
+ {
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("return to caller");
|
|
|
+ ctx->Answer(Error_Succeed);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Sleep(retryGetDevInfoInterval);
|
|
|
+ retryTimes--;
|
|
|
+ } while (retryTimes > 0);
|
|
|
+ if (retryTimes == 0)
|
|
|
+ {
|
|
|
+ DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM).setLogCode(VtmLoaderService_LogCode_CheckDeviceEntity).setResultCode("RTA1F23")
|
|
|
+ ("after have tried x times");
|
|
|
+ ctx->Answer(Error_Unexpect, VtmLoader_EntityNotInNormal);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setLogCode(VtmLoaderService_LogCode_CheckDeviceEntity).setResultCode("RTA1F22")
|
|
|
+ ("connect to %s failed.error code:%d", csEntityName.GetData(), eErrCode);
|
|
|
+ ctx->Answer(Error_Unexpect, VtmLoader_FailToConnectEntity);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setLogCode(VtmLoaderService_LogCode_CheckDeviceEntity).setResultCode("RTA1F22")
|
|
|
+ ("new client failed.");
|
|
|
+ ctx->Answer(Error_Unexpect, VtmLoader_FailToConnectEntity);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
case 0x213: //ContactlessCard
|
|
|
{
|
|
|
ContactlessCardService_ClientBase* pClient = new ContactlessCardService_ClientBase(this->m_pEntity);
|
|
|
@@ -2499,78 +2547,6 @@ void CVtmLoaderFSM::CheckDeviceBaseEntity(SpReqAnsContext<VtmLoaderService_Check
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
|
-void CVtmLoaderFSM::CheckEntityRestartIdle(SpReqAnsContext<VtmLoaderService_CheckDeviceEntity_Req, VtmLoaderService_CheckDeviceEntity_Ans>::Pointer ctx)
|
|
|
-{
|
|
|
- CSmartPointer<IEntityFunctionPrivilege> pFuncPrivilege = m_pEntity->GetFunction().ConvertCase<IEntityFunctionPrivilege>();
|
|
|
- CSmartPointer<IAsynWaitSp> spWait;
|
|
|
- CEntityRunInfo runInfo;
|
|
|
-
|
|
|
- //to check entity state
|
|
|
- ErrorCodeEnum eErrCode = m_pEntity->GetFunction()->GetEntityRunInfo(ctx->Req.entityName.GetData(), runInfo);
|
|
|
- if (eErrCode == Error_Succeed)
|
|
|
- {
|
|
|
- if (runInfo.eState != EntityState_NoStart)
|
|
|
- {
|
|
|
- eErrCode = pFuncPrivilege->TerminateEntity(ctx->Req.entityName.GetData(), spWait);
|
|
|
- if (spWait != NULL)
|
|
|
- eErrCode = spWait->WaitAnswer(MAX_AYSNC_TIMEOUT);
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM)("GetEntityRunInfo %s failed(%d).", ctx->Req.entityName.GetData(), eErrCode);
|
|
|
- ctx->Answer(Error_Unexpect, VtmLoader_FailToGetEntityInfo);
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- //(re)start entity
|
|
|
- eErrCode = pFuncPrivilege->StartEntity(ctx->Req.entityName.GetData(), NULL, spWait);
|
|
|
- if (eErrCode == Error_Succeed)
|
|
|
- {
|
|
|
- if (spWait != NULL)
|
|
|
- eErrCode = spWait->WaitAnswer(MAX_AYSNC_TIMEOUT);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM)("StartEntity %s failed(%d).", ctx->Req.entityName.GetData(), eErrCode);
|
|
|
- ctx->Answer(Error_Unexpect, VtmLoader_FailToStartEntity);
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- //TODO we should wait for device entity open suc?
|
|
|
- int count = 0;
|
|
|
- do
|
|
|
- {
|
|
|
- CEntityRunInfo runInfo;
|
|
|
- eErrCode = m_pEntity->GetFunction()->GetEntityRunInfo(ctx->Req.entityName.GetData(), runInfo);
|
|
|
- if (eErrCode == Error_Succeed)
|
|
|
- {
|
|
|
- if (runInfo.eState == EntityState_Idle)
|
|
|
- {
|
|
|
- ctx->Answer(Error_Succeed);
|
|
|
- return;
|
|
|
- }
|
|
|
- else if (runInfo.eState == EntityState_Lost || runInfo.eState == EntityState_Close || runInfo.eState == EntityState_Killed)
|
|
|
- {
|
|
|
- ctx->Answer(Error_Unexpect, VtmLoader_FailToStartEntity);
|
|
|
- return;
|
|
|
- }
|
|
|
- count++;
|
|
|
- if (count > 5)
|
|
|
- {
|
|
|
- ctx->Answer(Error_Unexpect, VtmLoader_FailToStartEntity);
|
|
|
- return;
|
|
|
- }
|
|
|
- Sleep(2000);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- ctx->Answer(Error_Unexpect, VtmLoader_FailToStartEntity);
|
|
|
- return;
|
|
|
- }
|
|
|
- } while (true);
|
|
|
-
|
|
|
-}
|
|
|
void CVtmLoaderFSM::CheckAudio(SpReqAnsContext<VtmLoaderService_CheckDeviceEntity_Req, VtmLoaderService_CheckDeviceEntity_Ans>::Pointer ctx)
|
|
|
{
|
|
|
CSmartPointer<IEntityFunctionPrivilege> pFuncPrivilege = m_pEntity->GetFunction().ConvertCase<IEntityFunctionPrivilege>();
|