Aldebaran documentation What's new in NAOqi 2.4.3?

ServiceManager API

NAOqi Core | API


Namespace : qi

ServiceManager does not have yet a specialized proxy.

qi::ServiceManager Class Reference

Introduction

ServiceManager Module. More...

Public Members

qi::Property<bool> enableLogging

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

ServiceManager(qi::SessionPtr session)
ServiceManager(qi::SessionPtr session, const std::vector<std::string>& coreServices)
~ServiceManager()
bool startService(const std::string& name)
bool stopService(const std::string& name)
bool restartService(const std::string& name)
bool isServiceRunning(const std::string& name) const
std::vector<qi::ServiceProcessInfo> services()
qi::ServiceProcessInfo service(const std::string& name)
size_t serviceMemoryUsage(const std::string& name)

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.

Members Documentation

qi::Property<bool> qi::ServiceManager::enableLogging

Enable or disable logging of services in QI_SERVICEMANAGER_LOGGING_PATH.

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.

bool qi::ServiceManager::startService(const std::string& name)

Send signal qi::ServiceManager::serviceStarted if service is successfully launched.

Throw if name is incorrect. See general description.

bool qi::ServiceManager::stopService(const std::string& name)

Try to kill with sigTerm. After 1 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.

bool qi::ServiceManager::restartService(const std::string& name)

In fact, call stop and start.

If service is not already started, it is the same as qi::ServiceManager::startService.

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)
size_t qi::ServiceManager::serviceMemoryUsage(const std::string& name)