ContainerDevice.cpp 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682
  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. std::cout << "[DeviceLog] Notify.cmd:" << cmdType
  238. << " key:" << keyType.c_str()
  239. << ",Context:" << Context.c_str()
  240. << std::endl;
  241. NotifyContext.decode(Context.c_str());
  242. if (keyType == "ErrorList" && NotifyContext.size() > 0)
  243. {
  244. ResDataObject errorObj = NotifyContext[0];
  245. if (ccoscmd == PACKET_CMD_ADD)
  246. {
  247. //if (errorObj.size() > 0 && errorObj[0].GetFirstOf("Type") >= 0)
  248. //{
  249. // // Type是0表示Error
  250. // if (atoi((const char*)errorObj[0]["Type"]) == 0)
  251. // {
  252. // string strGUID = NotifyContext.GetKey(0);
  253. // if (m_pResErrorList->GetFirstOf(strGUID.c_str()) < 0)
  254. // m_pResErrorList->add(strGUID.c_str(), errorObj);
  255. // else
  256. // (*m_pResErrorList)[strGUID.c_str()].add(errorObj.GetKey(0), errorObj[0]);
  257. // PRINTA_INFO(pDevLog, "Add ErrorList %s", m_pResErrorList->encode());
  258. // }
  259. //}
  260. string strSenderId = "";
  261. int nSenderIdNum = errorObj.GetKeyCount("SenderId");
  262. if (nSenderIdNum > 0)
  263. {
  264. strSenderId = (string)errorObj["SenderId"];
  265. }
  266. string strCodeID = (string)errorObj["CodeID"];
  267. int nLevel = (int)errorObj["Level"];
  268. string strInfo = (string)errorObj["Resouceinfo"];
  269. int nType = (int)errorObj["Type"];
  270. LogicDevice::AddErrorMessage(strCodeID.c_str(), nLevel, strInfo.c_str(), nType, strSenderId.c_str());
  271. ////mLog::FINFO(pDevLog, "AddErrorMessage:%s over", errorObj.encode());
  272. return;
  273. }
  274. else if (ccoscmd == PACKET_CMD_DEL)
  275. {
  276. //if (errorObj.size() > 0 && errorObj[0].GetFirstOf("CodeID") >= 0)
  277. //{
  278. // string CodeParam = errorObj[0]["CodeID"];
  279. // if (CodeParam.size() == 0 || CodeParam == "0" || CodeParam == "")
  280. // {
  281. // m_pResErrorList->clear();
  282. // PRINTA_INFO(pDevLog, "Clear all ErrorList");
  283. // }
  284. // else
  285. // {
  286. // for (size_t n = 0; n < m_pResErrorList->size(); n++)
  287. // {
  288. // for (size_t i = 0; i < (*m_pResErrorList)[n].size(); i++)
  289. // {
  290. // string strCodekey = (*m_pResErrorList)[n].GetKey(i);
  291. // if ((*m_pResErrorList)[n][strCodekey.c_str()].GetFirstOf("Type") >= 0)
  292. // {
  293. // string strtype = (*m_pResErrorList)[n][strCodekey.c_str()]["Type"];
  294. // if (strCodekey == CodeParam && atoi(strtype.c_str()) == 0)
  295. // {
  296. // (*m_pResErrorList)[n].eraseOneOf(CodeParam.c_str());
  297. // PRINTA_INFO(pDevLog, "Clear ErrorList %s", m_pResErrorList->encode());
  298. // break;
  299. // }
  300. // }
  301. // }
  302. // }
  303. // }
  304. //}
  305. string strCodeID = (string)errorObj["CodeID"];
  306. int nLevel = (int)errorObj["Level"];
  307. string strInfo = (string)errorObj["Resouceinfo"];
  308. int nType = (int)errorObj["Type"];
  309. LogicDevice::DelErrorMessage(strCodeID.c_str(), nLevel, strInfo.c_str(), nType);
  310. ////mLog::FINFO(pDevLog, "DelErrorMessage:%s over", errorObj.encode());
  311. return;
  312. }
  313. }
  314. PacketAnalizer::MakeNotify(NotifyData, ccoscmd, keyType.c_str(), NotifyContext);
  315. //CmdFromLogicDev(&NotifyData);
  316. PublishAction(&NotifyData, (m_strEBusRoot + "/Notify").c_str(), m_pMqttConntion);
  317. PublishAction(&NotifyData, (m_strCCOSRoot + "/Notify").c_str(), m_pMqttConntion);
  318. //mLog::FINFO(pDevLog, "Notify res packet done");
  319. }
  320. else
  321. {
  322. //mLog::FERROR("wrong callback for raw data notify");
  323. }
  324. }
  325. else
  326. {
  327. std::cout << "--------------wrong notify type " << cmdType << std::endl;
  328. //mLog::FERROR("wrong notify type:%d", cmdType);
  329. }
  330. }
  331. void DEVICE_ACTION ContainerDevice::OnSystemLog(int LogLevel, string Code, string Context, string SenderId)
  332. {
  333. IoSystemLog(LogLevel, Code.c_str(), Context.c_str(),Context.size(),SenderId.c_str());
  334. }
  335. void DEVICE_ACTION ContainerDevice::OnLog(int LogLevel, string Context)
  336. {
  337. //PrintA_IOLOG(m_pLogger, LogLevel, Context.c_str(), Context.size());
  338. //mLog::FINFO("OnLog LEVEL : {$} Context: {$}", LogLevel, Context);
  339. }
  340. void DEVICE_ACTION ContainerDevice::OnPassiveDisconnected()
  341. {
  342. if (m_DisconnectEvt)
  343. {
  344. m_DisconnectEvt->SetEvent();
  345. }
  346. }
  347. bool SYSTEM_CALL ContainerDevice::GetDeviceType(GUID &DevType)
  348. {
  349. //string lDevType = m_pMidObject->GetGUID();
  350. ////if (m_pMidObject->GetDeviceType(lDevType))
  351. //{
  352. // return string_2_guid(lDevType.c_str(), DevType);
  353. //}
  354. return false;
  355. }
  356. //get device resource
  357. RET_STATUS SYSTEM_CALL ContainerDevice::GetDeviceResource(ResDataObject PARAM_OUT *pDeviceResource)
  358. {
  359. bool ret = true;
  360. string DevRes = ""; // m_pMidObject->GetResource();
  361. //if (m_pMidObject->GetDeviceResource(DevRes))
  362. {
  363. GUID DrvType;
  364. string guidstr;
  365. GetDeviceType(DrvType);
  366. guid_2_string(DrvType, guidstr);
  367. ret &= pDeviceResource->add("DeviceType", guidstr.c_str());
  368. //make device type
  369. ret &= pDeviceResource->add("ClientType", DPC_UnitClient);
  370. ResDataObject LowLayerRes;
  371. if (LowLayerRes.decode(DevRes.c_str()))
  372. {
  373. //attr
  374. int Idx = LowLayerRes.GetFirstOf("Attribute");
  375. if (Idx >= 0)
  376. {
  377. pDeviceResource->add("Attribute", LowLayerRes[Idx]);
  378. int erroridx = (*pDeviceResource)["Attribute"].GetFirstOf("ErrorList");
  379. if (erroridx < 0)
  380. {
  381. (*pDeviceResource)["Attribute"].add("ErrorList", *m_pResErrorList);
  382. }
  383. else
  384. {
  385. (*pDeviceResource)["Attribute"]["ErrorList"] = *m_pResErrorList;
  386. }
  387. }
  388. else
  389. {
  390. ResDataObject Attribute;
  391. Attribute.add("ErrorList", *m_pResErrorList);
  392. pDeviceResource->add("Attribute", Attribute);
  393. }
  394. //action
  395. Idx = LowLayerRes.GetFirstOf("Action");
  396. if (Idx >= 0)
  397. {
  398. pDeviceResource->add("Action", LowLayerRes[Idx]);
  399. }
  400. else
  401. {
  402. pDeviceResource->add("Action", "");
  403. }
  404. return RET_SUCCEED;
  405. }
  406. }
  407. return RET_FAILED;
  408. }
  409. //normal sync routine,Request to device and response from device
  410. RET_STATUS SYSTEM_CALL ContainerDevice::Request(ResDataObject PARAM_IN *pRequest, ResDataObject PARAM_OUT *pResponse)
  411. {
  412. INT ret = RET_NOSUPPORT;
  413. //1. analize request
  414. PACKET_CMD cmd = PacketAnalizer::GetPacketCmd(pRequest);
  415. string keystr = PacketAnalizer::GetPacketKey(pRequest);
  416. ResDataObject Context;
  417. if (PacketAnalizer::GetPacketContext(pRequest, Context) == false)
  418. {
  419. return RET_FAILED;
  420. }
  421. //Logger *pDevLog = GetLogHandle();
  422. if (cmd == PACKET_CMD_EXE)
  423. {
  424. string req, res;
  425. req = (const char *)Context.encode();
  426. //mLog::FINFO( "Action[%s].req:%s",keystr.c_str(), req.c_str());
  427. ret = 2;// (INT)m_pMidObject->Action(keystr, req, res);
  428. if (ret >= RET_SUCCEED)
  429. {
  430. Context.clear();
  431. //mLog::FINFO( "Action[%s].res:%s", keystr.c_str(), res.c_str());
  432. bool bObject = false;
  433. for (size_t i = 0; i < res.size(); i++)
  434. {
  435. char cValue = res[i];
  436. if (cValue != ' ' && cValue != '\t' &&
  437. cValue != '\r' && cValue != '\n')
  438. {
  439. if (cValue == '{' && res.find(':') != std::string::npos)
  440. {
  441. bObject = true;
  442. }
  443. break;
  444. }
  445. }
  446. if (bObject)
  447. {
  448. ResDataObject resp;
  449. resp.decode(res.c_str());
  450. Context.add("P0", resp);
  451. }
  452. else
  453. {
  454. Context.add("P0", res.c_str());
  455. }
  456. pResponse->update("CONTEXT", Context);
  457. //mLog::FINFO(pDevLog, "Action res packet done");
  458. }
  459. }
  460. else if (cmd == PACKET_CMD_GET)
  461. {
  462. string res;
  463. //ret = m_pMidObject->AttributeAction(ATTRACTION_GET, keystr, res);
  464. //mLog::FINFO(pDevLog, "get req:%s", keystr.c_str());
  465. assert(0);//not finished yet
  466. //ret = m_pMidObject->Get(keystr, res);
  467. if (ret >= RET_SUCCEED)
  468. {
  469. Context.clear();
  470. //mLog::FINFO(pDevLog, "get res:%s", res.c_str());
  471. bool bObject = false;
  472. for (size_t i = 0; i < res.size(); i++)
  473. {
  474. char cValue = res[i];
  475. if (cValue != ' ' && cValue != '\t' &&
  476. cValue != '\r' && cValue != '\n')
  477. {
  478. if (cValue == '{' && res.find(':') != std::string::npos)
  479. {
  480. bObject = true;
  481. }
  482. break;
  483. }
  484. }
  485. if (bObject)
  486. {
  487. ResDataObject resp;
  488. resp.decode(res.c_str());
  489. Context.add("P0", resp);
  490. }
  491. else
  492. {
  493. Context.add("P0", res.c_str());
  494. }
  495. pResponse->update("CONTEXT", Context);
  496. //mLog::FINFO(pDevLog, "Get res packet done");
  497. }
  498. }
  499. //else if (cmd == PACKET_CMD_UPDATE)
  500. //{
  501. // string res;
  502. // ret = m_pMidObject->AttributeAction(ATTRACTION_SET, keystr, res);
  503. // if (ret >= RET_SUCCEED)
  504. // {
  505. // pResponse->update("CONTEXT", res.c_str());
  506. // }
  507. //}
  508. //else if (cmd == PACKET_CMD_ADD)
  509. //{
  510. // string res;
  511. // ret = m_pMidObject->AttributeAction(ATTRACTION_ADD, keystr, res);
  512. // if (ret >= RET_SUCCEED)
  513. // {
  514. // pResponse->update("CONTEXT", res.c_str());
  515. // }
  516. //}
  517. //else if (cmd == PACKET_CMD_DEL)
  518. //{
  519. // string res;
  520. // ret = m_pMidObject->AttributeAction(ATTRACTION_DEL, keystr, res);
  521. // if (ret >= RET_SUCCEED)
  522. // {
  523. // pResponse->update("CONTEXT", res.c_str());
  524. // }
  525. //}
  526. //else if (cmd == PACKET_CMD_PART_UPDATE)
  527. //{
  528. // string res;
  529. // ret = m_pMidObject->AttributeAction(ATTRACTION_UPDATE, keystr, res);
  530. // if (ret >= RET_SUCCEED)
  531. // {
  532. // pResponse->update("CONTEXT", res.c_str());
  533. // }
  534. //}
  535. else
  536. {
  537. //wtf??
  538. }
  539. PacketAnalizer::MakeRetCode((RET_STATUS)ret, pResponse);
  540. return (RET_STATUS)ret;
  541. }
  542. //notify to lower layer
  543. RET_STATUS SYSTEM_CALL ContainerDevice::CmdToLogicDev(ResDataObject PARAM_IN *pCmd)
  544. {
  545. assert(0);//not happening
  546. return RET_FAILED;
  547. }
  548. void ContainerDevice::OnSetClientID()
  549. {
  550. //m_pMidObject->SetClientRootID((m_strClientID+"_IODevice").c_str(), "");
  551. }