mod_UpgradeMgr.cpp 16 KB

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