first release !
[profile/ivi/genivi/genivi-audio-manager.git] / AudioManagerDaemon / src / ControlSender.cpp
index de2e3b7..232c8e7 100644 (file)
@@ -6,26 +6,31 @@
  */
 
 #include "ControlSender.h"
-#include "control/ControlSendInterface.h"
-#include "control/ControlReceiveInterface.h"
-#include "pluginTemplate.h"
+#include "PluginTemplate.h"
+#include <dlt/dlt.h>
 #include <assert.h>
 
-std::string controlPluginFile= "/home/christian/workspace/gitserver/build/plugins/control/libPluginControlInterface.so";
 
-ControlSender::ControlSender()
+ControlSender::ControlSender(std::string controlPluginFile)
+       :mlibHandle(NULL),
+        mController(NULL)
 {
-       ControlSendInterface* (*createFunc)();
-       createFunc = getCreateFunction<ControlSendInterface*()>(controlPluginFile,mlibHandle);
-
-       assert(createFunc!=NULL);
-
-       mController = createFunc();
+       if (!controlPluginFile.empty())
+       {
+               ControlSendInterface* (*createFunc)();
+               createFunc = getCreateFunction<ControlSendInterface*()>(controlPluginFile,mlibHandle);
+               assert(createFunc!=NULL);
+               mController = createFunc();
+       }
+       else
+       {
+               DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("No controller loaded !"));
+       }
 }
 
 ControlSender::~ControlSender()
 {
-       dlclose(mlibHandle);
+       if (mlibHandle) dlclose(mlibHandle);
 }
 
 void ControlSender::hookAllPluginsLoaded()