From 84b90467e8e9dcaafaf75738f4bf9840365424b9 Mon Sep 17 00:00:00 2001 From: christian mueller Date: Thu, 9 Feb 2012 12:38:18 +0100 Subject: * adoption of RoutinInterfaceAsync to testHMI * adoption of projekttypes.h to HMI * comment out wrapper dlt messages because too much pollution --- PluginControlInterface/include/ControlSender.h | 29 ++++++++++++-- PluginControlInterface/src/ControlSender.cpp | 53 ++++++++++++++++---------- 2 files changed, 58 insertions(+), 24 deletions(-) (limited to 'PluginControlInterface') diff --git a/PluginControlInterface/include/ControlSender.h b/PluginControlInterface/include/ControlSender.h index 834c432..d21856b 100644 --- a/PluginControlInterface/include/ControlSender.h +++ b/PluginControlInterface/include/ControlSender.h @@ -82,13 +82,34 @@ public: private: ControlReceiveInterface * mControlReceiveInterface; - struct handleStack + struct handleStatus { - bool ok; + bool status; am_Handle_s handle; }; - std::list mListOpenHandles; - am_mainConnectionID_t mCurrentID; + + struct mainConnectionSet + { + am_mainConnectionID_t connectionID; + std::vector listHandleStaus; + }; + + class findHandle + { + am_Handle_s mHandle; + public: + explicit findHandle(am_Handle_s handle) : + mHandle(handle) + { + } + bool operator()(handleStatus* handle) const + { + return (handle->handle.handle == mHandle.handle); + } + }; + + std::vector mListOpenConnections; + ; }; #endif /* CONTROLSENDER_H_ */ diff --git a/PluginControlInterface/src/ControlSender.cpp b/PluginControlInterface/src/ControlSender.cpp index be750fe..c65059d 100644 --- a/PluginControlInterface/src/ControlSender.cpp +++ b/PluginControlInterface/src/ControlSender.cpp @@ -40,7 +40,8 @@ extern "C" void destroyControlPluginInterface(ControlSendInterface* controlSendI } ControlSenderPlugin::ControlSenderPlugin() : - mControlReceiveInterface(NULL) + mControlReceiveInterface(NULL), + mListOpenConnections() { } @@ -76,15 +77,17 @@ am_Error_e ControlSenderPlugin::hookUserConnectionRequest(const am_sourceID_t so mControlReceiveInterface->getRoute(true, sourceID, sinkID, listRoutes); if (listRoutes.empty()) return E_NOT_POSSIBLE; + + std::vector listHandleStaus; std::vector::iterator it(listRoutes[0].route.begin()); for (; it != listRoutes[0].route.end(); ++it) { mControlReceiveInterface->connect(handle, connectionID, it->connectionFormat, it->sourceID, it->sinkID); //this is primitive and works only for one connect at a time... otherwise the handles get mixed up! - handleStack stack; - stack.handle=handle; - stack.ok=false; - mListOpenHandles.push_back(stack); + handleStatus status; + status.handle=handle; + status.status=false; + listHandleStaus.push_back(status); } am_MainConnection_s mainConnectionData; mainConnectionData.connectionID=0; @@ -92,7 +95,10 @@ am_Error_e ControlSenderPlugin::hookUserConnectionRequest(const am_sourceID_t so mainConnectionData.delay=0; mainConnectionData.route=listRoutes[0]; mControlReceiveInterface->enterMainConnectionDB(mainConnectionData,mainConnectionID); - mCurrentID=mainConnectionID; + mainConnectionSet set; + set.connectionID=mainConnectionID; + set.listHandleStaus=listHandleStaus; + mListOpenConnections.push_back(set); return E_OK; } @@ -268,20 +274,27 @@ void ControlSenderPlugin::cbAckConnect(const am_Handle_s handle, const am_Error_ //here is no error check !!!! //\todo: add error check here //\todo: algorith can be much better written here - bool allOk = true; - std::list::iterator it(mListOpenHandles.begin()); - - for (; it != mListOpenHandles.end(); ++it) - { - if (it->handle.handle == handle.handle) - it->ok = true; - allOk = allOk && it->ok; - } - - if (allOk) - { - mControlReceiveInterface->changeMainConnectionStateDB(mCurrentID,CS_CONNECTED); - } + std::vector::iterator it(mListOpenConnections.begin()); +// for(;it!=mListOpenConnections.end();++it) +// { +// std::vector::iterator hit; +// hit=std::find_if(it->listHandleStaus.begin(),it->listHandleStaus.end(),findHandle); +// } +// +// bool allOk = true; +// std::list::iterator it(mListOpenHandles.begin()); +// +// for (; it != mListOpenHandles.end(); ++it) +// { +// if (it->handle.handle == handle.handle) +// it->ok = true; +// allOk = allOk && it->ok; +// } +// +// if (allOk) +// { +// mControlReceiveInterface->changeMainConnectionStateDB(mCurrentID,CS_CONNECTED); +// } } void ControlSenderPlugin::cbAckDisconnect(const am_Handle_s handle, const am_Error_e errorID) -- cgit v1.2.1