1 //******************************************************************
3 // Copyright 2014 Samsung Electronics All Rights Reserved.
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
11 // http://www.apache.org/licenses/LICENSE-2.0
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
21 /// @file PluginManager.cpp
26 #include "PluginManager.h"
30 PluginManager::PluginManager()
32 handle = dlopen("./libpmimpl.so", RTLD_LAZY);
35 fprintf(stderr, "%s\n", dlerror());
38 PluginManagerImpl* (*create)(void*);
39 create = (PluginManagerImpl * (*)(void*))dlsym(handle, "create_object");
40 destroy = (void (*)(PluginManagerImpl *))dlsym(handle, "destroy_object");
41 pluginManagerImpl = (PluginManagerImpl *)create(NULL);
44 PluginManager::~PluginManager(void)
46 destroy(pluginManagerImpl);
50 int PluginManager::startPlugins(const std::string key, const std::string value)
52 return pluginManagerImpl->startPlugins(key, value);
55 int PluginManager::stopPlugins(const std::string key, const std::string value)
57 return pluginManagerImpl->stopPlugins(key, value);
60 int PluginManager::rescanPlugin()
62 return pluginManagerImpl->rescanPlugin();
65 std::vector<Plugin> PluginManager::getPlugins(void)
67 return pluginManagerImpl->getAllPlugins();
70 std::string PluginManager::getState(const std::string plugID)
72 return pluginManagerImpl->getState(plugID);