mod_UpgradeMgr.cpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502
  1. #include "stdafx.h"
  2. #include "mod_UpgradeMgr.h"
  3. #include "LocalMediaPlay_client_g.h"
  4. #include "fileutil.h"
  5. #include <regex>
  6. #include "RVCComm.h"
  7. #ifdef RVC_OS_WIN
  8. #include <io.h>
  9. #include "EventCode.h"
  10. #else
  11. #include <unistd.h>
  12. #include <dirent.h>
  13. #include <errno.h>
  14. #include "EventCode.h"
  15. #endif
  16. #include "json/json.h"
  17. namespace Task
  18. {
  19. //查询灰度控制
  20. struct QueryUpgradeControlTaskReq : CHTTPReq {
  21. string m_reqStr;
  22. string ToJson() {
  23. return m_reqStr;
  24. }
  25. };
  26. struct QueryUpgradeControlTaskRet : CHTTPRet {
  27. string m_retStr;
  28. bool Parse(string strData) {
  29. m_retStr=strData;
  30. return true;
  31. }
  32. };
  33. struct InitFSMTask : public ITaskSp{
  34. CUpgradeMgrEntity* Mgr;
  35. explicit InitFSMTask(CUpgradeMgrEntity* e) : Mgr(e) {}
  36. void Process(){
  37. LOG_FUNCTION();
  38. Mgr->bNewUpgradeMgr = true;//默认新模式
  39. CSystemStaticInfo info;
  40. ErrorCodeEnum Err = Mgr->GetFunction()->GetSystemStaticInfo(info);
  41. if (Err != Error_Succeed) {
  42. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("InitFSMTask")("load GetSystemStaticInfo fail ");
  43. LogWarn(Severity_Low, Error_Exception, WARN_TASK_START_NEW_MODE, "init new upgradeTaskMgr");
  44. }
  45. else {
  46. LogWarn(Severity_Low, Error_Exception, WARN_TASK_START_NEW_MODE, CSimpleStringA::Format("init new upgradeTaskMgr, version = %s",info.InstallVersion.ToString().GetData()).GetData());
  47. }
  48. if(Mgr->bNewUpgradeMgr){
  49. ErrorCodeEnum rc =Mgr->m_taskFSM.Init(Mgr);//启动新状态机
  50. if (rc != Error_Succeed)
  51. {
  52. LogWarn(Severity_Middle, Error_Exception, ERR_TASK_INIT_NEW_UPGRADE, "init new upgradeTaskMgr FSM fail");
  53. Mgr->m_testResult=Error_InvalidState;//自检失败
  54. return;
  55. }else{
  56. DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI("InitFSMTask")("init new upgradeTaskMgr FSM succ");
  57. Mgr->m_initSucc = true;
  58. }
  59. Mgr->m_beginSM3HashTime = CSmallDateTime::GetNow();
  60. }else{
  61. LogWarn(Severity_Low, Error_Exception, WARN_TASK_START_OLD_MODE, "init old upgradeTaskMgr");
  62. }
  63. }
  64. };
  65. struct RollBackTask : public ITaskSp {
  66. CUpgradeMgrEntity* Mgr;
  67. CVersion historyVersion;
  68. explicit RollBackTask(CUpgradeMgrEntity* e, CVersion version) : Mgr(e) {
  69. historyVersion = version;
  70. }
  71. void Process() {
  72. bool loop = true;
  73. while (loop) {
  74. //判断是否继续执行
  75. CSmartPointer<IConfigInfo> spConfig;
  76. ErrorCodeEnum ret = Mgr->GetFunction()->OpenConfig(Config_CenterSetting, spConfig);
  77. int rollbackTemp = 0;
  78. if (ret == Error_Succeed) {
  79. spConfig->ReadConfigValueInt("UpgradeManager", "RollbackFlag", rollbackTemp);
  80. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("RollbackUpdate")("get centerSetting RollbackFlag=%d", rollbackTemp);
  81. }
  82. else {
  83. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("RollbackUpdate")("get centerSetting RollbackFlag fail");
  84. }
  85. if (rollbackTemp == 0) {
  86. //立即回退模式
  87. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Immediate mode,begin rollback version");
  88. ErrorCodeEnum rc = Mgr->m_taskFSM.RollBackToHistoryVersion(historyVersion);
  89. if (rc == Error_Succeed)
  90. {
  91. // 通过事件通知健康实体
  92. LogEvent(Severity_Middle, Event_Req_Framework_Rollback, "rollback upgrade succeed");
  93. }
  94. else
  95. {
  96. LogWarn(Severity_Low, rc, ERR_TASK_ROLLBACK_FAIL, "rollback upgrade fail");
  97. }
  98. loop = false;//退出
  99. }
  100. else {
  101. //等待首页回退模式
  102. CSimpleStringA strValue;
  103. if (Mgr->GetFunction()->GetSysVar("UIState", strValue) == Error_Succeed && strValue.Compare("M") == 0) {
  104. // 已经进入首页,开始回退
  105. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("enter main page, begin rollback version");
  106. ErrorCodeEnum rc = Mgr->m_taskFSM.RollBackToHistoryVersion(historyVersion);
  107. if (rc == Error_Succeed)
  108. {
  109. // 通过事件通知健康实体
  110. LogEvent(Severity_Middle, Event_Req_Framework_Rollback, "rollback upgrade succeed");
  111. }
  112. else
  113. {
  114. LogWarn(Severity_Low, rc, ERR_TASK_ROLLBACK_FAIL, "rollback upgrade fail");
  115. }
  116. loop = false;//退出
  117. }
  118. else {
  119. Sleep(30 * 1000);//继续循环
  120. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("enter not main page, rollback version delay 30s");
  121. }
  122. }
  123. }
  124. Mgr->m_taskFSM.m_bRollbackTask = false;//线程退出
  125. }
  126. };
  127. }
  128. // 升级管理 UpgradeManager 0x506
  129. void CUpgradeMgrEntity::OnStarted()
  130. {
  131. // 初始化状态机
  132. //m_fsm.Init(this);
  133. auto pFunc = GetFunction();
  134. // 监视准入状态
  135. ErrorCodeEnum rc;
  136. CSimpleStringA strValue;
  137. if (pFunc->GetSysVar("UIState", strValue) == Error_Succeed && strValue.Compare("M") ==0)
  138. {
  139. // 已经进入首页状态
  140. DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI("OnStarted")("system page isStartup 1");
  141. m_bStartUp =true;
  142. }
  143. else
  144. {
  145. // 否则启动监控
  146. rc= pFunc->RegistSysVarEvent("UIState", this);
  147. if (rc != Error_Succeed)
  148. {
  149. LogWarn(Severity_Middle, rc, ERR_WRAN_REGIST_SYS_VAR_FAIL, CSimpleStringA::Format("RegistSysVarEvent UIState is fail,%d",(int)rc).GetData());
  150. m_testResult=Error_InvalidState;//自检失败
  151. }else{
  152. DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI("OnStarted")("RegistSysVarEvent UIState succ");
  153. }
  154. }
  155. if (pFunc->GetSysVar("RunState", strValue) == Error_Succeed && strValue.Compare("N") ==0)
  156. {
  157. // 已经进入终端启动成功状态
  158. DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI("OnStarted")("====framework is start up 1====");
  159. m_bSystemStartUp =true;
  160. }
  161. else
  162. {
  163. // 否则启动监控RunState
  164. rc= pFunc->RegistSysVarEvent("RunState", this);
  165. if (rc != Error_Succeed)
  166. {
  167. LogWarn(Severity_Middle, rc, ERR_WRAN_REGIST_SYS_VAR_FAIL, CSimpleStringA::Format("RegistSysVarEvent RunState is fail,%d",(int)rc).GetData());
  168. m_testResult=Error_InvalidState;//自检失败
  169. }else{
  170. DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI("OnStarted")("RegistSysVarEvent RunState succ");
  171. }
  172. }
  173. //启动灰度控制判断,看启动什么状态机
  174. Task::InitFSMTask* task = new Task::InitFSMTask(this);
  175. rc = this->GetFunction()->PostThreadPoolTask(task);
  176. if (rc != Error_Succeed)
  177. {
  178. LogWarn(Severity_Middle, rc, ERR_TASK_INIT_NEW_UPGRADE, CSimpleStringA::Format("Post InitFSMTask task to Thread is fail,%d",(int)rc).GetData());
  179. m_testResult=Error_InvalidState;//自检失败
  180. }
  181. }
  182. void CUpgradeMgrEntity::OnSelfTest(EntityTestEnum eTestType,CSmartPointer<ITransactionContext> pTransactionContext)
  183. {
  184. if (Test_ShakeHand == eTestType)
  185. {
  186. //根据不同情况返回握手情况,监控实体根据不同情况杀死实体进程
  187. pTransactionContext->SendAnswer(m_testResult);
  188. }
  189. }
  190. void CUpgradeMgrEntity::OnPreClose(EntityCloseCauseEnum eCloseCause,CSmartPointer<ITransactionContext> pTransactionContext)
  191. {
  192. GetFunction()->UnsubscribeBroadcast("Download");
  193. GetFunction()->UnsubscribeBroadcast("UpgradeRun");
  194. pTransactionContext->SendAnswer(Error_Succeed);
  195. }
  196. void CUpgradeMgrEntity::OnSysVarEvent(const char *pszKey, const char *pszValue,const char *pszOldValue,const char *pszEntityName)
  197. {
  198. if(strcmp("UIState",pszKey)==0){
  199. if(!m_bStartUp){
  200. if (strcmp(pszValue, "M") ==0){
  201. DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI("OnSysVarEvent")("system page isStartup 2");
  202. m_bStartUp = true;
  203. }
  204. }
  205. }
  206. if(strcmp("RunState",pszKey)==0){
  207. if(!m_bSystemStartUp){
  208. if (strcmp(pszValue, "N") ==0){
  209. DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI("OnSysVarEvent")("====framework is start up 2====");
  210. m_bSystemStartUp = true;
  211. }
  212. }
  213. }
  214. }
  215. char CUpgradeMgrEntity::GetInstallStateVal(const InstallStateEnum enumVal)
  216. {
  217. const struct {
  218. int ch;
  219. InstallStateEnum val;
  220. } tbl[] = {
  221. {'A', Install_Active},
  222. {'I', Install_Pending},
  223. {'S', Install_SetToStart},
  224. {'F', Install_FailRun},
  225. {'R', Install_RollBack},
  226. {'U', Install_Upgraded},
  227. {'C',Install_Cancelled},
  228. {'W',Install_WaitConfirm},
  229. {'D', Install_Installed},
  230. };
  231. int i;
  232. for (i = 0; i < sizeof(tbl)/sizeof(tbl[0]); ++i) {
  233. if (tbl[i].val == enumVal) {
  234. return tbl[i].ch;
  235. }
  236. }
  237. return ' '; // error
  238. }
  239. //新状态机不处理
  240. ErrorCodeEnum CUpgradeMgrEntity::RegistLocalPack(const CSimpleStringA &strPackFile)
  241. {
  242. if(m_initSucc){
  243. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("RegistLocalPack")("RegistLocalPack new UpgradeMgr is not deal with");
  244. return Error_NotImpl;
  245. }else{
  246. DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI("RegistLocalPack")("initFSM is not end");
  247. return Error_Pending;//状态机还未启动
  248. }
  249. }
  250. //新状态机不处理
  251. DWORD CUpgradeMgrEntity::RegistManualPack(const CSimpleStringA &strPackFile)
  252. {
  253. if(m_initSucc){
  254. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("RegistManualPack")("RegistManualPack new UpgradeMgr is not deal with");
  255. return UPGRADE_MGR_NOT_IMPLEMENT;
  256. }else{
  257. DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI("RegistManualPack")("initFSM is not end");
  258. return Error_Pending;//状态机还未启动
  259. }
  260. }
  261. //新状态机不处理
  262. ErrorCodeEnum CUpgradeMgrEntity::CancelUpdate(const CSimpleStringA &strPackFile)
  263. {
  264. if(m_initSucc){
  265. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("CancelUpdate")("CancelUpdate new UpgradeMgr is not deal with");
  266. return Error_NotImpl;
  267. }else{
  268. DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI("CancelUpdate")("initFSM is not end");
  269. return Error_Pending;//状态机还未启动
  270. }
  271. }
  272. //新状态机处理
  273. ErrorCodeEnum CUpgradeMgrEntity::RollbackUpdate(const CSimpleStringA &strVersion)
  274. {
  275. if(m_initSucc){
  276. if(bNewUpgradeMgr){
  277. DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI("RollbackUpdate")("RollbackUpdate new UpgradeMgr deal with");
  278. if(strVersion.GetLength()==0){
  279. LogWarn(Severity_Low, Error_NotImpl, ERR_TASK_ROLLBACK_FAIL, "version is empty , rollback upgrade fail");
  280. return Error_NotImpl;
  281. }else{
  282. ErrorCodeEnum rc = Error_Succeed;
  283. DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI("RollbackUpdate")("try rollback to version: [%s]", (const char*)strVersion);
  284. int w1, w2, w3, w4;
  285. int ret = sscanf(strVersion, "%d.%d.%d.%d", &w1, &w2, &w3, &w4);
  286. if (ret <4)
  287. {
  288. DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI("RollbackUpdate")("version [%s] parse fail", (const char*)strVersion);
  289. rc= Error_Param;
  290. }
  291. else
  292. { //回退放入线程当中
  293. if (!m_taskFSM.m_bRollbackTask) {
  294. Task::RollBackTask* rTask = new Task::RollBackTask(this, CVersion(w1, w2, w3, w4));
  295. ErrorCodeEnum rc = this->GetFunction()->PostThreadPoolTask(rTask);
  296. if (Error_Succeed == rc) {
  297. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("RollbackUpdate")("RollbackFlag thread start succ");
  298. m_taskFSM.m_bRollbackTask = true;//启动线程
  299. }
  300. else {
  301. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("RollbackUpdate")("RollbackFlag thread start fail : %d",(int)rc);
  302. }
  303. }
  304. else {
  305. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("RollbackUpdate")("RollbackFlag thread is exist");
  306. return Error_Succeed;
  307. }
  308. }
  309. }
  310. }else{
  311. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("RollbackUpdate")("RollbackUpdate old UpgradeMgr deal not with");
  312. return Error_Succeed;
  313. }
  314. }else{
  315. DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI("RollbackUpdate")("initFSM is not end");
  316. return Error_Pending;//状态机还未启动
  317. }
  318. }
  319. //新状态机不处理
  320. DWORD CUpgradeMgrEntity::GetManualPacks(CSimpleStringA &strManualPacks)
  321. {
  322. if(m_initSucc){
  323. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("GetManualPacks")("GetManualPacks new UpgradeMgr is not deal with");
  324. return UPGRADE_MGR_NOT_IMPLEMENT;
  325. }else{
  326. DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI("GetManualPacks")("initFSM is not end");
  327. return Error_Pending;//状态机还未启动
  328. }
  329. }
  330. CServerSessionBase* CUpgradeMgrEntity::OnNewSession(const char* /*pszRemoteEntityName*/, const char * /*pszParam*/)
  331. {
  332. return new CUpgradeMgrSession(this);
  333. }
  334. //新状态机不处理
  335. ErrorCodeEnum CUpgradeMgrEntity::SwitchUpgrade(const CSimpleStringA &strPack)
  336. {
  337. if(m_initSucc){
  338. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("SwitchUpgrade")("SwitchUpgrade new UpgradeMgr is not deal with");
  339. return Error_NotImpl;
  340. }else{
  341. DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI("SwitchUpgrade")("initFSM is not end");
  342. return Error_Pending;//状态机还未启动
  343. }
  344. }
  345. //新状态机处理
  346. ErrorCodeEnum CUpgradeMgrEntity::GetUpgradeState(bool &bInstalling, CSimpleStringA &strPackFile, CSimpleStringA &strExecID,
  347. char &cInstallState, bool &bSysInstall, bool &bLightPack, CSimpleStringA &strNewVersion)
  348. {
  349. if(m_initSucc){
  350. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("GetUpgradeState")("GetUpgradeState new UpgradeMgr deal with");
  351. return m_taskFSM.GetUpgradeState(bInstalling, strPackFile, strExecID, cInstallState, bSysInstall, bLightPack, strNewVersion);
  352. }else{
  353. DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI("GetUpgradeState")("initFSM is not end");
  354. return Error_Pending;//状态机还未启动
  355. }
  356. }
  357. ErrorCodeEnum CUpgradeMgrEntity::testActive()
  358. {
  359. CSimpleStringA rootVerPath;
  360. ErrorCodeEnum rc = this->GetFunction()->GetPath("RootVer",rootVerPath);//获取version根路径
  361. if(rc!=Error_Succeed){
  362. LogWarn(Severity_Middle, Error_Exception, ERR_WRAN_OPEN_ACTIVE_FAIL,"testActive fail , get RootVer path is fai");
  363. return Error_Bug;
  364. }
  365. CSimpleStringA strActiveFile = CSimpleStringA::Format("%s" SPLIT_SLASH_STR "active.txt", rootVerPath.GetData());
  366. FILE* fp = fopen(strActiveFile.GetData(),"rb+");
  367. if(fp==NULL){
  368. #ifdef RVC_OS_WIN
  369. LogWarn(Severity_Middle, Error_Exception, ERR_WRAN_OPEN_ACTIVE_FAIL,CSimpleStringA::Format("open write active.txt fail,please edit active attribute, err=%d",(int)GetLastError()).GetData());
  370. #else
  371. LogWarn(Severity_Middle, Error_Exception, ERR_WRAN_OPEN_ACTIVE_FAIL,CSimpleStringA::Format("open write active.txt fail,please edit active attribute, err=%d",errno).GetData());
  372. #endif
  373. return Error_Unexpect;
  374. }
  375. fclose(fp);
  376. return Error_Succeed;
  377. }
  378. ErrorCodeEnum CUpgradeMgrEntity::NewStopMediaPlay()
  379. {
  380. #ifdef RVC_OS_WIN
  381. // 通知媒体停止播放广告和声音
  382. LocalMediaPlay::PlayService_ClientBase *pClient = new LocalMediaPlay::PlayService_ClientBase(this);
  383. ErrorCodeEnum rc = pClient->Connect();
  384. if (rc == Error_Succeed)
  385. {
  386. DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI("NewStopMediaPlay")("connect to entity [LocalMediaPlay] succeed, start StopMediaPlay now");
  387. //采用新接口停止所有音视频播放
  388. LocalMediaPlay::PlayService_StopPlayAllMedias_Req req1 = {};
  389. LocalMediaPlay::PlayService_StopPlayAllMedias_Ans ans1 = {};
  390. if (Error_Succeed == (*pClient)(EntityResource::getLink().upgradeLink())->StopPlayAllMedias(req1, ans1, 10000))
  391. {
  392. DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI("NewStopMediaPlay")("StopPlayAllMedias success");
  393. }else{
  394. DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI("NewStopMediaPlay")("StopPlayAllMedias fail");
  395. pClient->GetFunction()->CloseSession();
  396. pClient->SafeDelete();
  397. return rc;
  398. }
  399. pClient->GetFunction()->CloseSession();
  400. }
  401. else
  402. {
  403. LogWarn(Severity_Low, rc, ERR_TASK_STOP_MEDIA_FAIL, "connect to entity [LocalMediaPlay] fail");
  404. }
  405. pClient->SafeDelete();
  406. return rc;
  407. #else
  408. // 通知媒体停止播放广告和声音
  409. LocalMediaPlay::PlayService_ClientBase *pClient = new LocalMediaPlay::PlayService_ClientBase(this);
  410. ErrorCodeEnum rc = pClient->Connect();
  411. if (rc == Error_Succeed)
  412. {
  413. DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI("NewStopMediaPlay")("connect to entity [LocalMediaPlay] succeed, start StopMediaPlay now");
  414. LocalMediaPlay::PlayService_StopPlayVideo_Req req1 = {};
  415. LocalMediaPlay::PlayService_StopPlayVideo_Ans ans1 = {};
  416. req1.CfgInx = 1;
  417. rc = (*pClient)(EntityResource::getLink().upgradeLink())->StopPlayVideo(req1, ans1, 10000);
  418. if (Error_Succeed == rc)
  419. {
  420. DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI("NewStopMediaPlay")("StopPlayVideo success");
  421. }else{
  422. Dbg("StopPlayVideo fail");
  423. pClient->GetFunction()->CloseSession();
  424. pClient->SafeDelete();
  425. return rc;
  426. }
  427. LocalMediaPlay::PlayService_StopPlayAudio_Req req2 = {};
  428. LocalMediaPlay::PlayService_StopPlayAudio_Ans ans2 = {};
  429. rc = (*pClient)(EntityResource::getLink().upgradeLink())->StopPlayAudio(req2, ans2, 10000);
  430. if (Error_Succeed == rc)
  431. {
  432. Dbg("StopPlayAudio success");
  433. }else{
  434. Dbg("StopPlayAudio fail");
  435. pClient->GetFunction()->CloseSession();
  436. pClient->SafeDelete();
  437. return rc;
  438. }
  439. pClient->GetFunction()->CloseSession();
  440. }
  441. else
  442. {
  443. LogWarn(Severity_Low, rc, ERR_TASK_STOP_MEDIA_FAIL, "connect to entity [LocalMediaPlay] fail");
  444. pClient->SafeDelete();
  445. }
  446. return rc;
  447. #endif
  448. }
  449. SP_BEGIN_ENTITY_MAP()
  450. SP_ENTITY(CUpgradeMgrEntity)
  451. SP_END_ENTITY_MAP()
  452. void CUpgradeMgrEntity::HttpsLogCallBack(const char* logtxt)
  453. {
  454. if(logtxt!=NULL){
  455. DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI("HttpsLogCallBack")("http dbg: %s",logtxt);
  456. }
  457. }