ServiceManager API¶
NAOqi Core | API
Namespace : qi
ServiceManager does not have yet a specialized proxy.
qi::ServiceManager Class Reference¶
Public Signals¶
-
qi::Signal<std::string, qi::ServiceEventReason>
serviceStarted
-
qi::Signal<std::string, qi::ServiceEventReason>
serviceStopped
-
qi::Signal<std::string>
serviceAdded
-
qi::Signal<std::string>
serviceRemoved
Public Functions¶
-
(qi::SessionPtr session)ServiceManager
-
(qi::SessionPtr session, const std::vector<std::string>& coreServices)ServiceManager
-
()~ServiceManager
-
qi::Future<void>
(const std::string& name)start
-
qi::Future<void>
(const std::string& name)stop
-
qi::Future<void>
()stopAllServices
-
qi::Future<void>
(const std::string& name)restart
-
qi::Future<bool>
(const std::string& name) constisServiceRunning
-
std::vector<qi::ServiceProcessInfo>
()services
-
qi::ServiceProcessInfo
(const std::string& name)service
-
qi::Future<size_t>
(const std::string& name)serviceMemoryUsage
-
qi::Future<bool>
(const std::string& name)startService
-
qi::Future<bool>
(const std::string& name)stopService
-
qi::Future<bool>
(const std::string& name)restartService
Detailed Description¶
ServiceManager allows you to control services installed by PackageManager.
Each std::string name given by user are processed. The best form is PackageName.ServiceName. The function checking the name throws if package or service does not exist. The other form allowed for compatibility, is ServiceName only. It is dangerous to use that because it may conflict. And you could have launch an other service. It throws if the service cannot be found in any package.
Signals Documentation¶
-
qi::Signal<std::string, qi::ServiceEventReason>
qi::ServiceManager::
serviceStarted
¶ Reason is always ProcessStartRequest.
-
qi::Signal<std::string, qi::ServiceEventReason>
qi::ServiceManager::
serviceStopped
¶ Reason can be ProcessStopRequest when the stop is regular. Or ProcessCrashed if an error occurred.
-
qi::Signal<std::string>
qi::ServiceManager::
serviceAdded
¶ Signal sent when a new service is handled by ServiceManager.
-
qi::Signal<std::string>
qi::ServiceManager::
serviceRemoved
¶ Signal sent when a service is removed from serviceManager.
Function Documentation¶
-
qi::ServiceManager::
ServiceManager
(qi::SessionPtr session)¶ As soon as package manager is available, launch asynchronously autorun-services.
-
qi::ServiceManager::
ServiceManager
(qi::SessionPtr session, const std::vector<std::string>& coreServices)¶ As soon as package manager is available, launch asynchronously autorun-services.
-
qi::ServiceManager::
~ServiceManager
()¶ Stop all services.
-
qi::Future<void>
qi::ServiceManager::
start
(const std::string& name)¶ Brief: Start a service with his name.
Returns: false on error, true on success Send signal qi::ServiceManager::serviceStarted if service is successfully launched.
-
qi::Future<void>
qi::ServiceManager::
stop
(const std::string& name)¶ Brief: Stop service with his name.
Returns: false on error, true on success Try to kill with sigTerm. After 15 second, kill with sigKill.
Send signal qi::ServiceManager::serviceStopped if service is successfully stopped. If service is sigTermed reason of the signal is proccessStopped, if it is sigKilled the reason is processCrashed.
-
qi::Future<void>
qi::ServiceManager::
stopAllServices
()¶ Try to kill with sigTerm. After 15 second, kill with sigKill.
Send signal qi::ServiceManager::serviceStopped if service is successfully stopped. If service is sigTermed reason of the signal is proccessStopped, if it is sigKilled the reason is processCrashed.
-
qi::Future<void>
qi::ServiceManager::
restart
(const std::string& name)¶ In fact, call stop and start.
If service is not already started, it is the same as qi::ServiceManager::startService.
-
qi::Future<bool>
qi::ServiceManager::
isServiceRunning
(const std::string& name)const
¶ Brief: Check that the service named name is started or not.
Returns: True if service is running, False otherwise.
-
std::vector<qi::ServiceProcessInfo>
qi::ServiceManager::
services
()¶ Get the list of all services.
-
qi::ServiceProcessInfo
qi::ServiceManager::
service
(const std::string& name)¶
-
qi::Future<size_t>
qi::ServiceManager::
serviceMemoryUsage
(const std::string& name)¶
-
qi::Future<bool>
qi::ServiceManager::
startService
(const std::string& name)¶ Send signal qi::ServiceManager::serviceStarted if service is successfully launched. DeprecatedSince 2.5.0 use ‘start’ instead false on error, true on success
-
qi::Future<bool>
qi::ServiceManager::
stopService
(const std::string& name)¶ Brief: Stop service with his name.
Returns: false on error, true on success Try to kill with sigTerm. After 15 second, kill with sigKill.
Send signal qi::ServiceManager::serviceStopped if service is successfully stopped. If service is sigTermed reason of the signal is proccessStopped, if it is sigKilled the reason is processCrashed. DeprecatedSince 2.5.0 use ‘stop’ instead
-
qi::Future<bool>
qi::ServiceManager::
restartService
(const std::string& name)¶ In fact, call stop and start. DeprecatedSince 2.5.0 use ‘restart’ instead
If service is not already started, it is the same as qi::ServiceManager::startService.