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/macro.hpp>
16 #include <qi/session.hpp>
17 #include <qi/trackable.hpp>
19 #include <qipackage/package_info.hpp>
51 ServiceManager(qi::SessionPtr session,
const std::vector<std::string>& coreServices);
67 qi::Future<void>
start(
const std::string &name);
80 qi::Future<void>
stop(
const std::string &name);
102 qi::Future<void>
restart(
const std::string &name);
116 std::vector<qi::ServiceProcessInfo>
services();
139 QI_API_DEPRECATED_MSG(Use
'start' instead)
154 QI_API_DEPRECATED_MSG(Use
'stop' instead)
155 qi::Future<bool>
stopService(
const std::string &name);
165 QI_API_DEPRECATED_MSG(Use
'restart' instead)
194 qi::SessionPtr _session;
195 std::vector<std::string> _coreServices;
198 void restartAutoService();
200 void advertiseServiceAdded(
const qi::PackageInfo2& pkgInfo);
201 void advertiseServiceRemoved(
const qi::PackageInfo2& pkgInfo);
203 void startAutoRunServices(qi::PackageInfo2 pkgInfo);
204 void stopRemovedService(qi::PackageInfo2 pkgInfo);
206 qi::AnyObject _packageManager;
209 ProcessManager *_interface;
212 ProcessManager *loadPlugin(
const std::string &pluginName);
215 std::string replaceVar(
const std::string &line);
216 void checkName(
const std::string &name)
const;
217 const qi::PackageService getService(
const qi::PackageInfo2 &pkgInfo,
const std::string &serviceName)
const;
218 const qi::PackageInfo2 getPackageFromServiceName(
const std::string &serviceName)
const;
219 std::pair<qi::PackageInfo2, qi::PackageService> splitServiceName(
const std::string &name)
const;
223 #endif // SERVICEMANAGER_MODULE_H
qi::Future< void > restart(const std::string &name)
Restart a service with his name.
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::Future< size_t > serviceMemoryUsage(const std::string &name)
Get the memory used by service named name.
qi::Future< bool > isServiceRunning(const std::string &name) const
Check that the service named name is started or not.
qi::ServiceProcessInfo service(const std::string &name)
Get information about one service named name.
qi::Future< bool > startService(const std::string &name)
Start a service with his name.
qi::Future< bool > restartService(const std::string &name)
Restart a service with his name.
qi::Future< void > stop(const std::string &name)
Stop service with his name.
~ServiceManager()
Unload service manager.
qi::Future< bool > stopService(const std::string &name)
Stop service with his name.
std::vector< qi::ServiceProcessInfo > services()
Get the list of all services.
qi::Future< void > stopAllServices()
Stop all services.
qi::Signal< std::string, qi::ServiceEventReason > serviceStopped
Sent when a service is stopped.
qi::Future< void > start(const std::string &name)
Start a service with his name.
qi::Signal< std::string, qi::ServiceEventReason > serviceStarted
Sent when a service is started.