ContainerDevice.cpp 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680
  1. #include <assert.h>
  2. #include <iostream>
  3. #include <functional>
  4. #include "common_api.h"
  5. #include "PacketAnalizer.h"
  6. #include "ContainerDevice.h"
  7. #include "ImagePool.h"
  8. #include "LogLocalHelper.h"
  9. #include "Log4CPP.h"
  10. using namespace std::placeholders;
  11. ContainerDevice::ContainerDevice()
  12. {
  13. m_ImagePool = new ImagePoolEx();
  14. m_DisconnectEvt = 0;
  15. //m_pMqttClient = NULL;
  16. }
  17. ContainerDevice::~ContainerDevice()
  18. {
  19. CompleteUnInit();
  20. delete m_ImagePool;
  21. }
  22. bool ConverCmdType_IoLevel2Ccos(ATTRACTION iocmd, PACKET_CMD &ccoscmd)
  23. {
  24. if (iocmd == ATTRACTION_GET)
  25. {
  26. ccoscmd = PACKET_CMD_GET;
  27. }
  28. else if (iocmd == ATTRACTION_SET)
  29. {
  30. ccoscmd = PACKET_CMD_UPDATE;
  31. }
  32. else if (iocmd == ATTRACTION_ADD)
  33. {
  34. ccoscmd = PACKET_CMD_ADD;
  35. }
  36. else if (iocmd == ATTRACTION_DEL)
  37. {
  38. ccoscmd = PACKET_CMD_DEL;
  39. }
  40. else if (iocmd == ATTRACTION_UPDATE)
  41. {
  42. ccoscmd = PACKET_CMD_PART_UPDATE;
  43. }
  44. else if (iocmd == ATTRACTION_DATA)
  45. {
  46. ccoscmd = PACKET_CMD_DATA;
  47. }
  48. else if (iocmd == ATTRACTION_MSG)
  49. {
  50. ccoscmd = PACKET_CMD_MSG;
  51. }
  52. else
  53. {
  54. //wtf??
  55. FERROR("unknown iocmd:{$},packetcmd:{$}", (int)iocmd, (int)ccoscmd);
  56. return false;
  57. }
  58. return true;
  59. }
  60. bool ConverCmdType_Ccos2IoLevel(PACKET_CMD ccoscmd, ATTRACTION &iocmd)
  61. {
  62. if (ccoscmd == PACKET_CMD_GET)
  63. {
  64. iocmd = ATTRACTION_GET;
  65. }
  66. else if (ccoscmd == PACKET_CMD_UPDATE)
  67. {
  68. iocmd = ATTRACTION_SET;
  69. }
  70. else if (ccoscmd == PACKET_CMD_ADD)
  71. {
  72. iocmd = ATTRACTION_ADD;
  73. }
  74. else if (ccoscmd == PACKET_CMD_DEL)
  75. {
  76. iocmd = ATTRACTION_DEL;
  77. }
  78. else if (ccoscmd == PACKET_CMD_PART_UPDATE)
  79. {
  80. iocmd = ATTRACTION_UPDATE;
  81. }
  82. else if (ccoscmd == PACKET_CMD_DATA)
  83. {
  84. iocmd = ATTRACTION_DATA;
  85. }
  86. else if (ccoscmd == PACKET_CMD_MSG)
  87. {
  88. iocmd = ATTRACTION_MSG;
  89. }
  90. else
  91. {
  92. //wtf??
  93. FERROR("unknown iocmd:{$},packetcmd:{$}", (int)iocmd, (int)ccoscmd);
  94. return false;
  95. }
  96. return true;
  97. }
  98. void ContainerDevice::SubscribeSelf()
  99. {
  100. LogicDevice::SubscribeSelf();
  101. //委托IODevice订阅
  102. //m_pMidObject->SubscribeSelf();
  103. }
  104. void ContainerDevice::Init(CCOS_DEVICE_OBJ* ccosDeviceModule, DEVICE_HANDLE hDevice, /*std::unique_ptr <nsDEV::IODevice> &&pMid,*/std::shared_ptr<LinuxEvent> DisconnectEvt)
  105. {
  106. //m_pMidObject = std::move(pMid);
  107. CompleteInit();
  108. //g_pDPCDeviceObject = this;
  109. //auto a = std::bind(&ContainerDevice::NotifyCallBackEntry, this, _1, _2, _3);
  110. //m_pMidObject->EventCenter->OnNotify.Push(this,&ContainerDevice::NotifyCallBackEntry);
  111. ////auto b = std::bind(&ContainerDevice::RawDataNotifyCallBackEntry, this, _1, _2, _3, _4, _5, _6);
  112. //m_pMidObject->EventCenter->OnDataNotify.Push(this, &ContainerDevice::RawDataNotifyCallBackEntry);
  113. ////auto c = std::bind(&ContainerDevice::NotifyCallBackSetBlockSize, this, _1, _2, _3, _4, _5);
  114. //m_pMidObject->EventCenter->OnMaxBlockSize.Push(this, &ContainerDevice::NotifyCallBackSetBlockSize);
  115. //m_pMidObject->EventCenter->OnSystemLog.Push(this, &ContainerDevice::OnSystemLog);
  116. //m_pMidObject->EventCenter->OnLog.Push(this, &ContainerDevice::OnLog);
  117. //m_pMidObject->Prepare();
  118. m_DisconnectEvt = DisconnectEvt;
  119. }
  120. #define CcosImageFul ("ImageFull")
  121. #define CcosImagePrev ("ImagePrev")
  122. #define CcosImageId ("Sharememid")
  123. void DEVICE_ACTION ContainerDevice::NotifyCallBackSetBlockSize(string QueName, DWORD BlockSize, DWORD FulBlockCount, DWORD PrevBlockSize, DWORD PrevBlockCount)
  124. {
  125. //Logger *pDevLog = GetLogHandle ();
  126. FINFO ("SetBlockSize. Que:{$},BlockSize:{$},BlockCount:{$},PrevBlockSize:{$},PrevBlockCount:{$}", QueName.c_str(),BlockSize,FulBlockCount,PrevBlockSize,PrevBlockCount);
  127. if (((ImagePoolEx*) m_ImagePool)->SetMaxBlockSize (QueName.c_str (), BlockSize, FulBlockCount, PrevBlockSize, PrevBlockCount) == false)
  128. {
  129. FERROR( "SetMaxBlockSize Callback Failed");
  130. }
  131. else
  132. {
  133. FINFO( "SetMaxBlockSize Callback Succeed");
  134. }
  135. }
  136. void DEVICE_ACTION ContainerDevice::RawDataNotifyCallBackEntry(int cmdType, string keyType, string Context,string Head,char *pRawData,int DataLength)
  137. {
  138. PACKET_CMD ccoscmd = PACKET_CMD_DATA;
  139. //Logger *pDevLog = GetLogHandle();
  140. //if (ConverCmdType_IoLevel2Ccos((ATTRACTION)cmdType, ccoscmd))
  141. {
  142. BLOCK_IMAGE_TYPE imgType;
  143. if (cmdType == 0)
  144. {
  145. imgType = FULL_BLOCK_IMG;
  146. }
  147. else if (cmdType == 1 || cmdType == 2)
  148. {
  149. imgType = PREV_BLOCK_IMG;
  150. }
  151. else
  152. {
  153. FERROR( "wrong callback for data notify. cmdtype:{$}", cmdType);
  154. return;
  155. }
  156. //UnvalidSMBid
  157. unsigned long Id = ((ImagePoolEx*)m_ImagePool)->AddFrameWithHead(imgType, Head, pRawData, DataLength);
  158. if (Id != UnvalidSMBid)
  159. {
  160. ResDataObject NotifyData;
  161. ResDataObject NotifyContext;
  162. FINFO("Data Notify. key:{$},Context:{$},Head:{$}", keyType.c_str(), Context.c_str(), Head.c_str());
  163. NotifyContext.decode(Context.c_str());
  164. NotifyContext [CcosImageId] = Id;
  165. PacketAnalizer::MakeNotify(NotifyData, ccoscmd, keyType.c_str(), NotifyContext);
  166. //CmdFromLogicDev(&NotifyData);
  167. PublishAction(&NotifyData, (m_strEBusRoot + "/Notify").c_str(), m_pMqttConntion);
  168. PublishAction(&NotifyData, (m_strCCOSRoot + "/Notify").c_str(), m_pMqttConntion);
  169. FINFO("Data Notify res packet done");
  170. }
  171. else
  172. {
  173. FERROR("can't save frame 2 sharememory.keyType:{$}.Head:{$}.Context:{$}.DataLen:{$}", keyType.c_str(), Head.c_str(), Context.c_str(), DataLength);
  174. }
  175. }
  176. //else
  177. //{
  178. // FERROR("wrong notify type:%d", cmdType);
  179. //}
  180. }
  181. void DEVICE_ACTION ContainerDevice::NotifyCallBackEntry(int cmdType, string keyType, string Context)
  182. {
  183. std::cout << "--------------NotifyCallBackEntry " << std::endl;
  184. //3. Notify
  185. PACKET_CMD ccoscmd;
  186. //Logger* pDevLog = GetLogHandle();
  187. if (ConverCmdType_IoLevel2Ccos((ATTRACTION)cmdType, ccoscmd))
  188. {
  189. /*
  190. try
  191. {
  192. if (keyType == "SubscribeTopic") {
  193. // 去MQTT Broker 订阅
  194. std::cout << "--------------SubscribeTopic " << keyType << std::endl;
  195. FINFO(pDevLog, "SubscribeTopic.cmd:%d key:%s,Context:%s", cmdType, keyType.c_str(), Context.c_str());
  196. ResDataObject topics;
  197. topics.decode(Context.c_str());
  198. for (size_t i = 0; i < topics.size(); i++)
  199. {
  200. SubscribeOne((const char*)topics[i]);
  201. }
  202. }
  203. else if (keyType == "Unsubscribe") {
  204. // 取消订阅
  205. FINFO(pDevLog, "Unsubscribe.cmd:%d key:%s,Context:%s", cmdType, keyType.c_str(), Context.c_str());
  206. ResDataObject topics;
  207. topics.decode(Context.c_str());
  208. for (size_t i = 0; i < topics.size(); i++)
  209. {
  210. SubscribeOne((const char*)topics[i], true);
  211. }
  212. }
  213. else {
  214. // 那就是事件通知,往主题上publish 内容
  215. FINFO(pDevLog, "Notify to MQTT .cmd:%d key:%s,Context:%s", cmdType, keyType.c_str(), Context.c_str());
  216. ostringstream ostopic;
  217. ostopic << TOPIC_PREFIX << "Notify/" << keyType;
  218. FINFO(pDevLog, "PUBLISH TO MQTT TOPIC :%s,Context:%s", ostopic.str().c_str(), Context.c_str());
  219. if (m_pMqttClient->is_connected()) {
  220. m_pMqttClient->publish(ostopic.str(), Context);
  221. }
  222. else {
  223. FERROR( "MQTT Server Still not Connected ", cmdType);
  224. std::cout << "MQTT Server Still not Connected, Try Publish" << cmdType << " keytype: " << keyType << "Context : " << Context << std::endl;
  225. }
  226. }
  227. }
  228. catch (const mqtt::exception& exc)
  229. {
  230. FERROR( "MQTT Server Still not Connected %s", exc.what());
  231. }*/
  232. if (ccoscmd != PACKET_CMD_DATA)
  233. {
  234. //raw data
  235. ResDataObject NotifyData;
  236. ResDataObject NotifyContext;
  237. FINFO("Notify.cmd:{$} key:{$},Context:{$}", cmdType, keyType.c_str(), Context.c_str());
  238. std::cout << "[DeviceLog] Notify.cmd:" << cmdType
  239. << " key:" << keyType.c_str()
  240. << ",Context:" << Context.c_str()
  241. << std::endl;
  242. NotifyContext.decode(Context.c_str());
  243. if (keyType == "ErrorList" && NotifyContext.size() > 0)
  244. {
  245. ResDataObject errorObj = NotifyContext[0];
  246. if (ccoscmd == PACKET_CMD_ADD)
  247. {
  248. //if (errorObj.size() > 0 && errorObj[0].GetFirstOf("Type") >= 0)
  249. //{
  250. // // Type是0表示Error
  251. // if (atoi((const char*)errorObj[0]["Type"]) == 0)
  252. // {
  253. // string strGUID = NotifyContext.GetKey(0);
  254. // if (m_pResErrorList->GetFirstOf(strGUID.c_str()) < 0)
  255. // m_pResErrorList->add(strGUID.c_str(), errorObj);
  256. // else
  257. // (*m_pResErrorList)[strGUID.c_str()].add(errorObj.GetKey(0), errorObj[0]);
  258. // PRINTA_INFO(pDevLog, "Add ErrorList %s", m_pResErrorList->encode());
  259. // }
  260. //}
  261. string strSenderId = "";
  262. int nSenderIdNum = errorObj.GetKeyCount("SenderId");
  263. if (nSenderIdNum > 0)
  264. {
  265. strSenderId = (string)errorObj["SenderId"];
  266. }
  267. string strCodeID = (string)errorObj["CodeID"];
  268. int nLevel = (int)errorObj["Level"];
  269. string strInfo = (string)errorObj["Resouceinfo"];
  270. int nType = (int)errorObj["Type"];
  271. LogicDevice::AddErrorMessage(strCodeID.c_str(), nLevel, strInfo.c_str(), nType, strSenderId.c_str());
  272. FINFO("AddErrorMessage:{$} over", errorObj.encode());
  273. return;
  274. }
  275. else if (ccoscmd == PACKET_CMD_DEL)
  276. {
  277. //if (errorObj.size() > 0 && errorObj[0].GetFirstOf("CodeID") >= 0)
  278. //{
  279. // string CodeParam = errorObj[0]["CodeID"];
  280. // if (CodeParam.size() == 0 || CodeParam == "0" || CodeParam == "")
  281. // {
  282. // m_pResErrorList->clear();
  283. // PRINTA_INFO(pDevLog, "Clear all ErrorList");
  284. // }
  285. // else
  286. // {
  287. // for (size_t n = 0; n < m_pResErrorList->size(); n++)
  288. // {
  289. // for (size_t i = 0; i < (*m_pResErrorList)[n].size(); i++)
  290. // {
  291. // string strCodekey = (*m_pResErrorList)[n].GetKey(i);
  292. // if ((*m_pResErrorList)[n][strCodekey.c_str()].GetFirstOf("Type") >= 0)
  293. // {
  294. // string strtype = (*m_pResErrorList)[n][strCodekey.c_str()]["Type"];
  295. // if (strCodekey == CodeParam && atoi(strtype.c_str()) == 0)
  296. // {
  297. // (*m_pResErrorList)[n].eraseOneOf(CodeParam.c_str());
  298. // PRINTA_INFO(pDevLog, "Clear ErrorList %s", m_pResErrorList->encode());
  299. // break;
  300. // }
  301. // }
  302. // }
  303. // }
  304. // }
  305. //}
  306. string strCodeID = (string)errorObj["CodeID"];
  307. int nLevel = (int)errorObj["Level"];
  308. string strInfo = (string)errorObj["Resouceinfo"];
  309. int nType = (int)errorObj["Type"];
  310. LogicDevice::DelErrorMessage(strCodeID.c_str(), nLevel, strInfo.c_str(), nType);
  311. FINFO("DelErrorMessage:{$} over", errorObj.encode());
  312. return;
  313. }
  314. }
  315. PacketAnalizer::MakeNotify(NotifyData, ccoscmd, keyType.c_str(), NotifyContext);
  316. //CmdFromLogicDev(&NotifyData);
  317. PublishAction(&NotifyData, (m_strEBusRoot + "/Notify").c_str(), m_pMqttConntion);
  318. PublishAction(&NotifyData, (m_strCCOSRoot + "/Notify").c_str(), m_pMqttConntion);
  319. FINFO("Notify res packet done");
  320. }
  321. else
  322. {
  323. FERROR("wrong callback for raw data notify");
  324. }
  325. }
  326. else
  327. {
  328. std::cout << "--------------wrong notify type " << cmdType << std::endl;
  329. FERROR("wrong notify type:{$}", cmdType);
  330. }
  331. }
  332. void DEVICE_ACTION ContainerDevice::OnSystemLog(int LogLevel, string Code, string Context, string SenderId)
  333. {
  334. IoSystemLog(LogLevel, Code.c_str(), Context.c_str(),Context.size(),SenderId.c_str());
  335. }
  336. void DEVICE_ACTION ContainerDevice::OnLog(int LogLevel, string Context)
  337. {
  338. //PrintA_IOLOG(m_pLogger, LogLevel, Context.c_str(), Context.size());
  339. FINFO("OnLog LEVEL : {$} Context: {$}", LogLevel, Context);
  340. }
  341. void DEVICE_ACTION ContainerDevice::OnPassiveDisconnected()
  342. {
  343. if (m_DisconnectEvt)
  344. {
  345. m_DisconnectEvt->SetEvent();
  346. }
  347. }
  348. bool SYSTEM_CALL ContainerDevice::GetDeviceType(GUID &DevType)
  349. {
  350. //string lDevType = m_pMidObject->GetGUID();
  351. ////if (m_pMidObject->GetDeviceType(lDevType))
  352. //{
  353. // return string_2_guid(lDevType.c_str(), DevType);
  354. //}
  355. return false;
  356. }
  357. //get device resource
  358. RET_STATUS SYSTEM_CALL ContainerDevice::GetDeviceResource(ResDataObject PARAM_OUT *pDeviceResource)
  359. {
  360. bool ret = true;
  361. string DevRes = ""; // m_pMidObject->GetResource();
  362. //if (m_pMidObject->GetDeviceResource(DevRes))
  363. {
  364. GUID DrvType;
  365. string guidstr;
  366. GetDeviceType(DrvType);
  367. guid_2_string(DrvType, guidstr);
  368. ret &= pDeviceResource->add("DeviceType", guidstr.c_str());
  369. //make device type
  370. ret &= pDeviceResource->add("ClientType", DPC_UnitClient);
  371. ResDataObject LowLayerRes;
  372. if (LowLayerRes.decode(DevRes.c_str()))
  373. {
  374. //attr
  375. int Idx = LowLayerRes.GetFirstOf("Attribute");
  376. if (Idx >= 0)
  377. {
  378. pDeviceResource->add("Attribute", LowLayerRes[Idx]);
  379. int erroridx = (*pDeviceResource)["Attribute"].GetFirstOf("ErrorList");
  380. if (erroridx < 0)
  381. {
  382. (*pDeviceResource)["Attribute"].add("ErrorList", *m_pResErrorList);
  383. }
  384. else
  385. {
  386. (*pDeviceResource)["Attribute"]["ErrorList"] = *m_pResErrorList;
  387. }
  388. }
  389. else
  390. {
  391. ResDataObject Attribute;
  392. Attribute.add("ErrorList", *m_pResErrorList);
  393. pDeviceResource->add("Attribute", Attribute);
  394. }
  395. //action
  396. Idx = LowLayerRes.GetFirstOf("Action");
  397. if (Idx >= 0)
  398. {
  399. pDeviceResource->add("Action", LowLayerRes[Idx]);
  400. }
  401. else
  402. {
  403. pDeviceResource->add("Action", "");
  404. }
  405. return RET_SUCCEED;
  406. }
  407. }
  408. return RET_FAILED;
  409. }
  410. //normal sync routine,Request to device and response from device
  411. RET_STATUS SYSTEM_CALL ContainerDevice::Request(ResDataObject PARAM_IN *pRequest, ResDataObject PARAM_OUT *pResponse)
  412. {
  413. INT ret = RET_NOSUPPORT;
  414. //1. analize request
  415. PACKET_CMD cmd = PacketAnalizer::GetPacketCmd(pRequest);
  416. string keystr = PacketAnalizer::GetPacketKey(pRequest);
  417. ResDataObject Context;
  418. if (PacketAnalizer::GetPacketContext(pRequest, Context) == false)
  419. {
  420. return RET_FAILED;
  421. }
  422. //Logger *pDevLog = GetLogHandle();
  423. if (cmd == PACKET_CMD_EXE)
  424. {
  425. string req, res;
  426. req = (const char *)Context.encode();
  427. FINFO( "Action[{$}].req:{$}",keystr.c_str(), req.c_str());
  428. ret = 2;// (INT)m_pMidObject->Action(keystr, req, res);
  429. if (ret >= RET_SUCCEED)
  430. {
  431. Context.clear();
  432. FINFO( "Action[{$}].res:{$}", keystr.c_str(), res.c_str());
  433. bool bObject = false;
  434. for (size_t i = 0; i < res.size(); i++)
  435. {
  436. char cValue = res[i];
  437. if (cValue != ' ' && cValue != '\t' &&
  438. cValue != '\r' && cValue != '\n')
  439. {
  440. if (cValue == '{' && res.find(':') != std::string::npos)
  441. {
  442. bObject = true;
  443. }
  444. break;
  445. }
  446. }
  447. if (bObject)
  448. {
  449. ResDataObject resp;
  450. resp.decode(res.c_str());
  451. Context.add("P0", resp);
  452. }
  453. else
  454. {
  455. Context.add("P0", res.c_str());
  456. }
  457. pResponse->update("CONTEXT", Context);
  458. FINFO("Action res packet done");
  459. }
  460. }
  461. else if (cmd == PACKET_CMD_GET)
  462. {
  463. string res;
  464. //ret = m_pMidObject->AttributeAction(ATTRACTION_GET, keystr, res);
  465. FINFO("get req:{$}", keystr.c_str());
  466. assert(0);//not finished yet
  467. //ret = m_pMidObject->Get(keystr, res);
  468. if (ret >= RET_SUCCEED)
  469. {
  470. Context.clear();
  471. FINFO("get res:{$}", res.c_str());
  472. bool bObject = false;
  473. for (size_t i = 0; i < res.size(); i++)
  474. {
  475. char cValue = res[i];
  476. if (cValue != ' ' && cValue != '\t' &&
  477. cValue != '\r' && cValue != '\n')
  478. {
  479. if (cValue == '{' && res.find(':') != std::string::npos)
  480. {
  481. bObject = true;
  482. }
  483. break;
  484. }
  485. }
  486. if (bObject)
  487. {
  488. ResDataObject resp;
  489. resp.decode(res.c_str());
  490. Context.add("P0", resp);
  491. }
  492. else
  493. {
  494. Context.add("P0", res.c_str());
  495. }
  496. pResponse->update("CONTEXT", Context);
  497. FINFO("Get res packet done");
  498. }
  499. }
  500. //else if (cmd == PACKET_CMD_UPDATE)
  501. //{
  502. // string res;
  503. // ret = m_pMidObject->AttributeAction(ATTRACTION_SET, keystr, res);
  504. // if (ret >= RET_SUCCEED)
  505. // {
  506. // pResponse->update("CONTEXT", res.c_str());
  507. // }
  508. //}
  509. //else if (cmd == PACKET_CMD_ADD)
  510. //{
  511. // string res;
  512. // ret = m_pMidObject->AttributeAction(ATTRACTION_ADD, keystr, res);
  513. // if (ret >= RET_SUCCEED)
  514. // {
  515. // pResponse->update("CONTEXT", res.c_str());
  516. // }
  517. //}
  518. //else if (cmd == PACKET_CMD_DEL)
  519. //{
  520. // string res;
  521. // ret = m_pMidObject->AttributeAction(ATTRACTION_DEL, keystr, res);
  522. // if (ret >= RET_SUCCEED)
  523. // {
  524. // pResponse->update("CONTEXT", res.c_str());
  525. // }
  526. //}
  527. //else if (cmd == PACKET_CMD_PART_UPDATE)
  528. //{
  529. // string res;
  530. // ret = m_pMidObject->AttributeAction(ATTRACTION_UPDATE, keystr, res);
  531. // if (ret >= RET_SUCCEED)
  532. // {
  533. // pResponse->update("CONTEXT", res.c_str());
  534. // }
  535. //}
  536. else
  537. {
  538. //wtf??
  539. }
  540. PacketAnalizer::MakeRetCode((RET_STATUS)ret, pResponse);
  541. return (RET_STATUS)ret;
  542. }
  543. //notify to lower layer
  544. RET_STATUS SYSTEM_CALL ContainerDevice::CmdToLogicDev(ResDataObject PARAM_IN *pCmd)
  545. {
  546. assert(0);//not happening
  547. return RET_FAILED;
  548. }
  549. void ContainerDevice::OnSetClientID()
  550. {
  551. //m_pMidObject->SetClientRootID((m_strClientID+"_IODevice").c_str(), "");
  552. }