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.
Summary¶
class qi::Session
Functions (class qi::Session)
-
qi::Session::defaultServiceTimeout
qi::Session::setClientAuthenticatorFactory
qi::Session::unregisterService
qi::Session::setAuthProviderFactory
qi::Session::serviceDirectoryServiceName
Signals (class qi::Session)
Global Classes
Reference¶
qi::Session Class Reference¶
Introduction¶
#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¶
-
(bool enforceAuthentication, SessionConfig config)Session
-
(SessionConfig defaultConfig)Session
-
()~Session
-
const SessionConfig&
() constconfig
-
qi::FutureSync<void>
()connect
-
qi::FutureSync<void>
(const char* serviceDirectoryURL)connect
-
qi::FutureSync<void>
(const std::string& serviceDirectoryURL)connect
-
qi::FutureSync<void>
(const qi::Url& serviceDirectoryURL)connect
-
bool
() constisConnected
-
qi::Url
() consturl
-
qi::FutureSync<std::vector<ServiceInfo>>
(ServiceLocality locality)services
-
qi::FutureSync<qi::AnyObject>
(const std::string& name)service
-
qi::FutureSync<qi::AnyObject>
(const std::string& name, qi::MilliSeconds timeout)service
-
qi::FutureSync<qi::AnyObject>
(const std::string& name, const std::string& protocol)service
-
qi::FutureSync<qi::AnyObject>
(const std::string& name, const std::string& protocol, qi::MilliSeconds timeout)service
-
qi::FutureSync<void>
()listen
-
qi::FutureSync<void>
(const qi::Url& address)listen
-
qi::FutureSync<void>
(const std::vector<qi::Url>& addresses)listen
-
std::vector<qi::Url>
() constendpoints
-
bool
(const std::string& key, const std::string& crt)setIdentity
-
qi::FutureSync<void>
()close
-
qi::FutureSync<void>
()listenStandalone
-
qi::FutureSync<void>
(const qi::Url& address)listenStandalone
-
qi::FutureSync<void>
(const std::vector<qi::Url>& addresses)listenStandalone
-
qi::FutureSync<unsigned int>
(const std::string& name, AnyObject object)registerService
-
qi::FutureSync<void>
(unsigned int serviceId)unregisterService
-
void
(AuthProviderFactoryPtr)setAuthProviderFactory
-
void
(ClientAuthenticatorFactoryPtr)setClientAuthenticatorFactory
-
qi::FutureSync<unsigned int>
(const std::string& moduleName, const std::string& renameModule, const AnyReferenceVector& args)loadService
- template<typename T>
-
qi::FutureSync<T>
(const std::string& moduleName, const AnyReferenceVector& args)callModule
-
FutureSync<void>
(const std::string& servicename, MilliSeconds timeout)waitForService
-
qi::FutureSync<void>
(const std::string& service)waitForService
Public Static Functions¶
-
const char*
()serviceDirectoryServiceName
-
qi::MilliSeconds
()defaultServiceTimeout
-
MilliSeconds
()defaultWaitForServiceTimeout
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¶
-
static const char*
qi::Session::
serviceDirectoryServiceName
()¶
-
static qi::MilliSeconds
qi::Session::
defaultServiceTimeout
()¶
-
static MilliSeconds
qi::Session::
defaultWaitForServiceTimeout
()¶
-
qi::Session::
Session
(SessionConfig defaultConfig)¶
-
qi::Session::
~Session
()¶
-
const SessionConfig&
qi::Session::
config
()const
¶
-
qi::FutureSync<void>
qi::Session::
connect
()¶ Uses the connection URL from the configuration or the hardcoded default connect URL if the first one isn’t set.
-
qi::FutureSync<void>
qi::Session::
connect
(const char* serviceDirectoryURL)¶ Ignores the configuration URL and uses the given one instead.
-
qi::FutureSync<void>
qi::Session::
connect
(const std::string& serviceDirectoryURL)¶
-
qi::FutureSync<void>
qi::Session::
connect
(const qi::Url& serviceDirectoryURL)¶
-
qi::FutureSync<std::vector<ServiceInfo>>
qi::Session::
services
(ServiceLocality locality = ServiceLocality_All)¶
-
qi::FutureSync<qi::AnyObject>
qi::Session::
service
(const std::string& name)¶
-
qi::FutureSync<qi::AnyObject>
qi::Session::
service
(const std::string& name, qi::MilliSeconds timeout)¶
-
qi::FutureSync<qi::AnyObject>
qi::Session::
service
(const std::string& name, const std::string& protocol)¶
-
qi::FutureSync<qi::AnyObject>
qi::Session::
service
(const std::string& name, const std::string& protocol, qi::MilliSeconds timeout)¶ Returns the asked service.
If the timeout triggers, the returned future is canceled.
-
qi::FutureSync<void>
qi::Session::
listen
()¶ Uses the listen URLs from the configuration.
-
qi::FutureSync<void>
qi::Session::
listen
(const qi::Url& address)¶ Ignores the configuration listen URLs and uses the given one instead.
-
qi::FutureSync<void>
qi::Session::
listen
(const std::vector<qi::Url>& addresses)¶ Ignores the configuration listen URLs and uses the given ones instead. If the parameter is empty, uses the hardcoded default listen URL.
-
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
()¶ Uses the listen URLs from the configuration or the hardcoded default listen URL if the first one is empty.
-
qi::FutureSync<void>
qi::Session::
listenStandalone
(const qi::Url& address)¶ Ignores the configuration listen URLs and uses the given one instead.
-
qi::FutureSync<void>
qi::Session::
listenStandalone
(const std::vector<qi::Url>& addresses)¶ Ignores the configuration listen URLs and uses the given ones instead.
-
qi::FutureSync<unsigned int>
qi::Session::
registerService
(const std::string& name, AnyObject object)¶
-
qi::FutureSync<void>
qi::Session::
unregisterService
(unsigned int serviceId)¶
-
qi::FutureSync<unsigned int>
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.
- template<typename T>
-
qi::FutureSync<T>
qi::Session::
callModule
(const std::string& moduleName, const AnyReferenceVector& args = AnyReferenceVector()¶ Load a module and call the specified function asynchronously
Tries to call the function with (this, args...) if possible, otherwise it calls it with (args...) only.
-
FutureSync<void>
qi::Session::
waitForService
(const std::string& servicename, MilliSeconds timeout)¶ Waits for a service to become available and fails if the timeout has expired. The future is set immediately if the service is already available. The future is canceled if the timeout triggered.
-
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. The timeout used is given by defaultWaitForServiceTimeout().