ContainerDevice.cpp 16 KB

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