summaryrefslogtreecommitdiff
path: root/PluginControlInterface
diff options
context:
space:
mode:
Diffstat (limited to 'PluginControlInterface')
-rw-r--r--PluginControlInterface/include/ControlSender.h29
-rw-r--r--PluginControlInterface/src/ControlSender.cpp53
2 files changed, 58 insertions, 24 deletions
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<handleStack> mListOpenHandles;
- am_mainConnectionID_t mCurrentID;
+
+ struct mainConnectionSet
+ {
+ am_mainConnectionID_t connectionID;
+ std::vector<handleStatus> 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<mainConnectionSet> 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<handleStatus> listHandleStaus;
std::vector<am_RoutingElement_s>::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<handleStack>::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<mainConnectionSet>::iterator it(mListOpenConnections.begin());
+// for(;it!=mListOpenConnections.end();++it)
+// {
+// std::vector<handleStatus>::iterator hit;
+// hit=std::find_if(it->listHandleStaus.begin(),it->listHandleStaus.end(),findHandle);
+// }
+//
+// bool allOk = true;
+// std::list<handleStack>::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)