Aldebaran documentation What's new in NAOqi 2.4.3?

qi::Session

A session is what allows you to connect services together locally or over the network. They can be used as server or client and can register or obtain services (on all sides, even in multi-client). You can read the guides to register a service and get a service.

Reference

qi::Session Class Reference

Introduction

More...

#include <qi/session.hpp>
  • Inherits: noncopyable, boost::enable_shared_from_this< Session >

Enumerations

enum ServiceLocality
Name Value Brief
ServiceLocality_All 0
ServiceLocality_Local 1
ServiceLocality_Remote 2

Public Signals

qi::Signal<unsigned int, std::string> serviceRegistered
qi::Signal<unsigned int, std::string> serviceUnregistered
qi::Signal connected
qi::Signal<std::string> disconnected

Public Functions

Session(bool enforceAuthentication)
~Session()
qi::FutureSync<void> connect(const char* serviceDirectoryURL)
qi::FutureSync<void> connect(const std::string& serviceDirectoryURL)
qi::FutureSync<void> connect(const qi::Url& serviceDirectoryURL)
bool isConnected() const
qi::Url url() const
qi::FutureSync<std::vector<ServiceInfo>> services(ServiceLocality locality)
qi::FutureSync<qi::AnyObject> service(const std::string& aservice)
qi::FutureSync<qi::AnyObject> service(const std::string& service, const std::string& protocol)
qi::FutureSync<void> listen(const qi::Url& address)
std::vector<qi::Url> endpoints() const
bool setIdentity(const std::string& key, const std::string& crt)
qi::FutureSync<void> close()
qi::FutureSync<void> listenStandalone(const qi::Url& address)
qi::FutureSync<unsigned int> registerService(const std::string& name, AnyObject object)
qi::FutureSync<void> unregisterService(unsigned int serviceId)
void setAuthProviderFactory(AuthProviderFactoryPtr)
void setClientAuthenticatorFactory(ClientAuthenticatorFactoryPtr)
void loadService(const std::string& moduleName, const std::string& renameModule, const AnyReferenceVector& args)
qi::FutureSync<void> waitForService(const std::string& service)

Detailed Description

A Session allows you to interconnect services on the same machine or over the network.

Signals Documentation

qi::Signal<unsigned int, std::string> qi::Session::serviceRegistered
qi::Signal<unsigned int, std::string> qi::Session::serviceUnregistered
qi::Signal qi::Session::connected
qi::Signal<std::string> qi::Session::disconnected

Function Documentation

qi::Session::Session(bool enforceAuthentication = false)
qi::Session::~Session()
qi::FutureSync<void> qi::Session::connect(const char* serviceDirectoryURL)
qi::FutureSync<void> qi::Session::connect(const std::string& serviceDirectoryURL)
qi::FutureSync<void> qi::Session::connect(const qi::Url& serviceDirectoryURL)
bool qi::Session::isConnected() const
qi::Url qi::Session::url() const
qi::FutureSync<std::vector<ServiceInfo>> qi::Session::services(ServiceLocality locality = ServiceLocality_All)
qi::FutureSync<qi::AnyObject> qi::Session::service(const std::string& aservice)
qi::FutureSync<qi::AnyObject> qi::Session::service(const std::string& service, const std::string& protocol)
qi::FutureSync<void> qi::Session::listen(const qi::Url& address)
std::vector<qi::Url> qi::Session::endpoints() const
bool qi::Session::setIdentity(const std::string& key, const std::string& crt)
qi::FutureSync<void> qi::Session::close()
qi::FutureSync<void> qi::Session::listenStandalone(const qi::Url& address)
qi::FutureSync<unsigned int> qi::Session::registerService(const std::string& name, AnyObject object)
qi::FutureSync<void> qi::Session::unregisterService(unsigned int serviceId)
void qi::Session::setAuthProviderFactory(AuthProviderFactoryPtr)
void qi::Session::setClientAuthenticatorFactory(ClientAuthenticatorFactoryPtr)
void qi::Session::loadService(const std::string& moduleName, const std::string& renameModule = "", const AnyReferenceVector& args = AnyReferenceVector()

Load a module and register the specified object on the session

Tries to call the factory with (this, args...) if possible, otherwise it calls it with (args...) only.

qi::FutureSync<void> qi::Session::waitForService(const std::string& service)

Waits for a service to become available. The future is set immediately if the service is already available.