Browse Source

!10379 更新基线
Merge pull request !10379 from 80274480/ST2

陈礼鹏80274480 1 year ago
parent
commit
274d581d8b

+ 1 - 1
DevAdapter/CMakeLists.txt

@@ -288,7 +288,7 @@ if(DEVADAPTER_USING_CONAN)
         #合入目前全量包中的DEP文件内容
         conan_cmake_run(REQUIRES VendorDLL/7.6.0@LR04.02_VendorLib/testing
             BASIC_SETUP CMAKE_TARGETS)
-        set(SELF_CONAN_LIB_NAME self/2024.0607.01@LR04.02_VendorLib/testing)
+        set(SELF_CONAN_LIB_NAME self/2024.0808.02@LR04.02_VendorLib/testing)
         add_subdirectory(self)
     endif(MSVC)
 

+ 0 - 94
Module/mod_healthmanager/mod_healthmanager.cpp

@@ -1384,100 +1384,6 @@ namespace
 	}
 }
 
-ErrorCodeEnum CHealthManagerEntity::DealSpecifiedEntity(DealType type, LPCTSTR lpcszEntityName, LPCTSTR lpcszCmdline, bool bForce, CSimpleStringA& strErrMsg)
-{
-	ErrorCodeEnum result(Error_Succeed);
-	strErrMsg.Clear();
-
-	switch (type) {
-	case Deal_Start:
-	{
-		CSmartPointer<IEntityFunction> pFunc = GetFunction();
-		CSmartPointer<IEntityFunctionPrivilege> pFuncPrivilege = pFunc.ConvertCase<IEntityFunctionPrivilege>();
-		CSimpleStringA strEntityName(lpcszEntityName);
-		CEntityRunInfo info = {};
-		result = GetFunction()->GetEntityRunInfo(strEntityName, info);
-		bool toStart(true);
-		Dbg("entity: %s, %s,%s", strEntityName.GetData(), SpStrError(result), SpStrEntityState(info.eState));
-		if ((info.eState != EntityState_NoStart && info.eState == EntityState_Lost
-			&& info.eState == EntityState_Close && info.eState == EntityState_UnLoading)
-			&& (bForce)) {
-
-		}
-
-		if (info.eState != EntityState_NoStart && bForce) {
-			Dbg("to terminal entity..");
-			CSmartPointer<IAsynWaitSp> spWait;
-			result = pFuncPrivilege->StopEntity(strEntityName, spWait);
-			Dbg("stop entity return %s", SpStrError(result));
-			if (result == Error_Succeed && spWait != NULL) {
-				Dbg("to wait after stop...");
-				result = spWait->WaitAnswer(60 * 1000);
-				Dbg("wait result: %s", SpStrError(result));
-				if (result != Error_Succeed) {
-					CSmartPointer<IAsynWaitSp> spWait2;
-					result = pFuncPrivilege->TerminateEntity(strEntityName, spWait2);
-					Dbg("terminal entity return %s", SpStrError(result));
-					if (result == Error_Succeed && spWait2 != NULL) {
-						Dbg("to wait after terminal...");
-						result = spWait2->WaitAnswer(60 * 1000);
-						Dbg("wait result: %s", SpStrError(result));
-					}
-				}
-			}
-
-			if (result != Error_Succeed) {
-				strErrMsg = CSimpleStringA::Format("重启前停止实体失败 %s, %s", SpStrEntityState(info.eState), SpStrError(result));
-				toStart = false;
-			}
-		}
-		else if (info.eState != EntityState_NoStart) {
-			result = Error_InvalidState;
-			strErrMsg = CSimpleStringA::Format("实体[%s]当前状态(%s)不支持该操作", strEntityName.GetData(), SpStrEntityState(info.eState));
-			toStart = false;
-		}
-
-		if (toStart) {
-			Dbg("to start entity..");
-			CSmartPointer<IAsynWaitSp> spWait;
-			result = pFuncPrivilege->StartEntity(strEntityName, lpcszCmdline, spWait);
-			Dbg("start entity return %s", SpStrError(result));
-			if (result == Error_Succeed && spWait != NULL) {
-				Dbg("to wait...");
-				result = spWait->WaitAnswer(60 * 1000);
-				Dbg("wait result: %s", SpStrError(result));
-			}
-			if (result != Error_Succeed) {
-				strErrMsg = CSimpleStringA::Format("启动实体失败 %s", SpStrError(result));
-			}
-		}
-	}
-	break;
-	case Deal_Close:
-		result = Error_NotImpl;
-		break;
-	case Deal_Pause:
-		result = Error_NotImpl;
-		break;
-	case Deal_Continue:
-		result = Error_NotImpl;
-		break;
-	case Deal_Kill:
-		result = Error_NotImpl;
-		break;
-	case Deal_Test:
-		result = Error_NotImpl;
-		break;
-	case Deal_Restart:
-		result = Error_NotImpl;
-		break;
-	default:
-		result = Error_NotSupport;
-		break;
-	}
-	return result;
-}
-
 bool CHealthManagerEntity::IsTestMode()
 {
 	static int flag = -1;

+ 0 - 11
Module/mod_healthmanager/mod_healthmanager.h

@@ -30,16 +30,6 @@ typedef ErrorCodeEnum (*pfFrameworkQuit)(RebootTriggerEnum eReason);
 #define DEPLOYSTATE_DONE 1
 #define DEPLOYSTATE_FAILED 2
 
-enum DealType
-{
-    Deal_Start = 1,
-    Deal_Close,
-    Deal_Pause,
-    Deal_Continue,
-    Deal_Kill,
-    Deal_Test,
-    Deal_Restart
-};
 
 struct ModuleRunInfo
 {
@@ -297,7 +287,6 @@ private:
 
 	bool IsTestMode();
 
-	ErrorCodeEnum DealSpecifiedEntity(DealType type, LPCTSTR lpcszEntityName, LPCTSTR lpcszCmdline, bool bForce, CSimpleStringA& strErrMsg);
 	void ToCalcRebootHourAndMinute(int restartBegin, int restartEnd);
 };
 #endif // __MOD_HEALTHMANAGER_H

+ 32 - 6
Module/mod_vtmloader/VtmLoaderFSM.cpp

@@ -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;
 		}

+ 3 - 1
Module/mod_vtmloader/VtmLoaderFSM.h

@@ -135,6 +135,7 @@ public:
 	void SaveTerminalNo(SpReqAnsContext<VtmLoaderService_SaveTerminalNo_Req, VtmLoaderService_SaveTerminalNo_Ans>::Pointer ctx);
 	void DealWithOldEvent(SpReqAnsContext<VtmLoaderService_DealWithOldEvent_Req, VtmLoaderService_DealWithOldEvent_Ans>::Pointer ctx);
 	bool CheckConfigInfoInTestRoom();
+	void SetVideoEntityOK() { m_bMediaControllerOK = true; }
 private:
 	void s0_on_entry();
 	void s0_on_exit();
@@ -168,7 +169,6 @@ private:
 	void GetDns(string& dns);
 	void ToCheckIfInstalling();
 
-
 private:
 	CSystemStaticInfo m_sysInfo;
 	CSimpleStringA m_strNetworkCheckUrl, m_csErrEntity, m_defaultSystemId, m_terminalNoFromWeb, m_csEntityList;
@@ -184,6 +184,8 @@ private:
 	map<CSimpleStringA, EntityLoadInfo> m_safeLoadOpt;
 	map<CSimpleStringA, EntityLoadInfo> m_operatingOpt;
 
+	bool m_bMediaControllerOK;
+
 	bool RefreshDeviceConfig(SpReqAnsContext<VtmLoaderService_CheckDeviceEntity_Req, VtmLoaderService_CheckDeviceEntity_Ans>::Pointer ctx);
 	void CheckDeviceBaseEntity(SpReqAnsContext<VtmLoaderService_CheckDeviceEntity_Req, VtmLoaderService_CheckDeviceEntity_Ans>::Pointer ctx, WORD wEntityID);
 	void CheckEntityRestartIdle(SpReqAnsContext<VtmLoaderService_CheckDeviceEntity_Req, VtmLoaderService_CheckDeviceEntity_Ans>::Pointer ctx);

+ 13 - 5
Module/mod_vtmloader/mod_vtmloader.cpp

@@ -47,12 +47,20 @@ void CVtmLoaderEntity::OnPreClose(EntityCloseCauseEnum eCloseCause,CSmartPointer
 }	
 
 
-void CVtmLoaderEntity::OnLog(const CAutoArray<CUUID> &SubIDs, const CUUID nLogID,const LogTypeEnum eLogType, const SeverityLevelEnum eLevel,
-	const DWORD dwSysError,const DWORD dwUserCode,const DWORD dwEntityInstanceID, const WORD wEntityDevelID, 
-	const CAutoArray<DWORD> &Param, const char *pszEntityName, const char *pszModuleName,const char *pszMessage, const linkContext &pLinkInfo)
-	{
-		
+void CVtmLoaderEntity::OnLog(const CAutoArray<CUUID>& SubIDs, const CUUID nLogID, const LogTypeEnum eLogType, const SeverityLevelEnum eLevel,
+	const DWORD dwSysError, const DWORD dwUserCode, const DWORD dwEntityInstanceID, const WORD wEntityDevelID,
+	const CAutoArray<DWORD>& Param, const char* pszEntityName, const char* pszModuleName, const char* pszMessage, const linkContext& pLinkInfo)
+{
+	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("dwUserCode:%x", dwUserCode);
+	switch (dwUserCode) {
+	case LOG_EVT_MOD_MEDIACONTROLLER_STARTED_SUCCESS:
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("set MediaController entity have checked setting");
+		m_FSM.SetVideoEntityOK();
+		break;
+	default:
+		break;
 	}
+}
 //only process healthmanager lost
 void CVtmLoaderEntity::OnEntityStateHook(const char* pszEntityName, const char* pszTriggerEntity, EntityStateEnum eState, EntityStateEnum eLastState)
 {

+ 9 - 2
Module/mod_vtmloader/mod_vtmloader.h

@@ -38,7 +38,7 @@ class CVtmLoaderEntity : public CEntityBase, public ILogListener, public IEntity
 {
 public:
 	CVtmLoaderEntity() :m_SubLogID1(0), m_SubLogID2(0), m_dwBeginTime(0),
-		m_strUserID(""), m_strUserName(""), m_strAuthorizer(""), m_strCurRight(""), m_strAuthTime("")
+		m_strUserID(""), m_strUserName(""), m_strAuthorizer(""), m_strCurRight(""), m_strAuthTime(""), m_bSubsribeMedia(false)
 	{
 	}
 
@@ -63,6 +63,11 @@ public:
 	//void NoticeAppReady(SpReqAnsContext<VtmLoaderService_NoticeAppReady_Req, VtmLoaderService_NoticeAppReady_Ans>::Pointer ctx);
 	void CheckDeviceEntity(SpReqAnsContext<VtmLoaderService_CheckDeviceEntity_Req, VtmLoaderService_CheckDeviceEntity_Ans>::Pointer ctx)
 	{
+		if (!m_bSubsribeMedia)
+		{
+			GetFunction()->SubscribeLog(m_uuidMediaController, this, Log_Event, Severity_Middle, Error_IgnoreAll, -1, "MediaController");
+			m_bSubsribeMedia = true;
+		}
 		CheckDeviceEntityEvent* pEvt = new CheckDeviceEntityEvent();
 		pEvt->ctx = ctx;
 		m_FSM.PostEventFIFO(pEvt);
@@ -81,6 +86,7 @@ public:
 	virtual void OnCeateConnection(const char* pszCallerEntity, const char* pszServiceEntity) { return; }
 	virtual void OnCloseConnection(const char* pszCallerEntity, const char* pszServiceEntity) { return; }
 	void EntityLostProc(CSimpleStringA entityName);
+	void SetVideoEntityOK() { m_FSM.SetVideoEntityOK(); }
 protected:
 	//GUITask m_task;
 	CVtmLoaderFSM m_FSM;
@@ -88,7 +94,7 @@ protected:
 	CUUID m_SubLogID2;
 	CUUID m_SubLogID3;
 	CUUID m_SubLogID4;
-
+	CUUID m_uuidMediaController;
 	// 当前维护用户信息
 	CSimpleStringA m_strUserID;
 	CSimpleStringA m_strUserName;
@@ -96,6 +102,7 @@ protected:
 	CSimpleStringA m_strAuthorizer;
 	CSimpleStringA m_strAuthTime;
 	DWORD m_dwBeginTime;
+	bool m_bSubsribeMedia;
 public:
 
 	//static std::string m_httpToken;

+ 1 - 1
Other/libmediaplayer/audio.cpp

@@ -507,7 +507,7 @@ static void sdl_audio_callback(void *opaque, uint8_t*stream, int len)
 					if (is->m_baudio_decode_finished) {
 						is->rvc_hostapi->Debug(MEDIA_LOG_DEBUG, "audio_size is -1 sdl_audio_callback return, and set abort flag to true.");
 						is->on_audio_play_finished(is->user_data);
-                        is->rvc_hostapi->Debug(MEDIA_LOG_INFO, "SDL_SemPost m_audio_play_wait_sem.");
+                        is->rvc_hostapi->Debug(MEDIA_LOG_DEBUG, "SDL_SemPost m_audio_play_wait_sem.");
                         SDL_SemPost(is->m_audio_play_wait_sem);
 						return;
 					}

+ 2 - 2
Other/libmediaplayer/player.cpp

@@ -234,7 +234,7 @@ static int mediaplay_thread_func(void* arg)
 					}
 				}
 				else {
-					pPlayer->GetMediaHostApi()->Debug(MEDIA_LOG_INFO, "---------------stop audio playing thread---------------");
+					pPlayer->GetMediaHostApi()->Debug(MEDIA_LOG_DEBUG, "---------------stop audio playing thread---------------");
 					baudioplay_thread_exit = true;
 				}
 			}
@@ -682,7 +682,7 @@ int CMediaPlayer::StopMediaPlay()
 	SDL_LockMutex(m_meida_play_start_wait_mutex);
 
 	if (NULL != m_player_stat->m_audio_play_wait_sem) {
-		m_hostapi->Debug(MEDIA_LOG_INFO, "SDL_SemPost m_audio_play_wait_sem.");
+		m_hostapi->Debug(MEDIA_LOG_DEBUG, "SDL_SemPost m_audio_play_wait_sem.");
 		SDL_SemPost(m_player_stat->m_audio_play_wait_sem);
 	}