1 #ifndef SERVICEMANAGER_MODULE_H
2 #define SERVICEMANAGER_MODULE_H
5 #include <boost/scoped_ptr.hpp>
8 #include <qi/messaging/autoservice.hpp>
10 #include "processmanager.h"
14 #include <qi/path.hpp>
15 #include <qi/session.hpp>
16 #include <qi/trackable.hpp>
18 #include <qipackage/package_info.hpp>
50 ServiceManager(qi::SessionPtr session,
const std::vector<std::string>& coreServices);
103 std::vector<qi::ServiceProcessInfo>
services();
150 qi::SessionPtr _session;
151 std::vector<std::string> _coreServices;
153 void stopAllServices();
156 void advertiseServiceAdded(
const qi::PackageInfo2& pkgInfo);
157 void advertiseServiceRemoved(
const qi::PackageInfo2& pkgInfo);
159 void startAutoRunServices(qi::PackageInfo2 pkgInfo);
160 void stopRemovedService(qi::PackageInfo2 pkgInfo);
162 qi::AnyAutoService _packageManager;
165 ProcessManager *_interface;
168 ProcessManager *loadPlugin(
const std::string &pluginName);
171 std::string replaceVar(
const std::string &line);
172 void checkName(
const std::string &name)
const;
173 const qi::PackageService getService(
const qi::PackageInfo2 &pkgInfo,
const std::string &serviceName)
const;
174 const qi::PackageInfo2 getPackageFromServiceName(
const std::string &serviceName)
const;
175 std::pair<qi::PackageInfo2, qi::PackageService> splitServiceName(
const std::string &name)
const;
179 #endif // SERVICEMANAGER_MODULE_H
bool isServiceRunning(const std::string &name) const
Check that the service named name is started or not.
ServiceManager(qi::SessionPtr session)
Launch service manager.
qi::Signal< std::string > serviceAdded
Signal sent when a new service is handled by ServiceManager.
qi::Signal< std::string > serviceRemoved
Signal sent when a service is removed from serviceManager.
qi::ServiceProcessInfo service(const std::string &name)
Get information about one service named name.
qi::Property< bool > enableLogging
Enable or disable logging of services in QI_SERVICEMANAGER_LOGGING_PATH.
~ServiceManager()
Unload service manager.
std::vector< qi::ServiceProcessInfo > services()
Get the list of all services.
qi::Signal< std::string, qi::ServiceEventReason > serviceStopped
Sent when a service is stopped.
bool startService(const std::string &name)
Start a service with his name.
bool stopService(const std::string &name)
Stop service with his name.
qi::Signal< std::string, qi::ServiceEventReason > serviceStarted
Sent when a service is started.
size_t serviceMemoryUsage(const std::string &name)
Get the memory used by service named name.
bool restartService(const std::string &name)
Restart a service with his name.