VRay SDK for C++
Loading...
Searching...
No Matches
VRay::ULAClient Class Reference

Public Types

enum  Flags : unsigned { flag_default = 0u , flag_noEventServer = 1u << 0 , flag_delayedServer = 1u << 1 , flag_uniqueProcess = 1u << 2 }
 A collection of flags that may be used to modify the way the client is used and what resources it will use. More...
 
typedef void(* OnLogin) (const ActiveUserDetailsView *activeUserDetails, void *userData)
 activeUserDetails will never be nullptr
 
typedef void(* OnLogout) (void *userData)
 

Static Public Member Functions

static void done ()
 Stops the event server and clears other internally held resources.
 
static bool getActiveUserDetails (ActiveUserDetails &userDetails, std::string &error)
 
static int getEventServerPort ()
 Returns the port number on which the event server is listening. Returns 0 if the server is not started or is explicitly disabled.
 
static void * init (const char *newApplicationId, unsigned initFlags, std::string &error)
 
static bool isEventServerStarted ()
 Returns true if the event server has been started and is listening on a valid port.
 
static bool isInitialized ()
 Returns true if the main part of the client is initialized (the event server is not checked).
 
static bool login (std::string &error)
 
static bool loginSync (ActiveUserDetails &userDetails, std::string &error)
 
static bool logout (std::string &error)
 
static bool logoutSync (std::string &error)
 
static bool setCustomPrompt (const char *loginPrompt, std::string &error)
 
static bool setOnLogInLogOut (OnLogin loginCallback, OnLogout logoutCallback, const void *userData=nullptr)
 
static void setSyncTimeout (int timeoutMs)
 
static bool startEventServer (std::string &error)
 A function for dedicated start of the event server, in case the delayetServer flag was used during initialization.
 

Member Enumeration Documentation

◆ Flags

enum VRay::ULAClient::Flags : unsigned

A collection of flags that may be used to modify the way the client is used and what resources it will use.

Enumerator
flag_default 

Default initialization. Suitable for a single global instance, because it starts a dedicated listening server on dynamically chosen port.

flag_delayedServer 

Disables the usage of a listening event server. A client with disabled server may be used for active user details query or asynchronous login and logout.

flag_uniqueProcess 

Delays the start of the event server, either until explicitly started or until a synchronous login or logout is performed.

Member Function Documentation

◆ getActiveUserDetails()

static bool VRay::ULAClient::getActiveUserDetails ( ActiveUserDetails userDetails,
std::string &  error 
)
inlinestatic

Gets the user details of the current actively logged in user. If there is no logged in user, an error will be returned (or if other communication error occurred). Note that this function always performs a GET request to the Unified Login Application service and will block the calling thread until the service responds or timeout is reached.

◆ init()

static void * VRay::ULAClient::init ( const char *  newApplicationId,
unsigned  initFlags,
std::string &  error 
)
inlinestatic

Initializes the Unified login client for communication with the Unified Login Application service. If the event server is enabled, this initialization includes registration of the application ID with the Unified Login service for receiving notifications about login and logout events on the system.

Parameters
newApplicationIdThe application ID that will be used. Note that this ID should be as unique as possible and it should contain only ASCII Alpha-numeric characters. E.g. "v-ray-for-sketchup-2024", "v-ray-for-rhino-2025".
initFlagsAn OR'ed collection of UnifiedLoginClient::Flags for modifying the client initialization.
[out]errorA string with detailed information if an initialization error occurred.
Returns
A handle which you most probably do not need, nullptr on error.

◆ login()

static bool VRay::ULAClient::login ( std::string &  error)
inlinestatic

Performs a login request to the Unified Login Application service. The request is synchronously waited to respond, but the calling thread will NOT be blocked until the user logs in. After a successful login, an event will be dispatched.

◆ loginSync()

static bool VRay::ULAClient::loginSync ( ActiveUserDetails userDetails,
std::string &  error 
)
inlinestatic

Performs a login request and WAITS for the user to log in, effectively blocking the calling thread. Returns the active user details of the logged in user, or an error if a timeout occurred or another failure was encountered.

Note
The timeout used for waiting may be specified with the setSyncTimeout(..) function.

◆ logout()

static bool VRay::ULAClient::logout ( std::string &  error)
inlinestatic

Performs a logout request to the Unified Login Application service. The request is synchronously waited to respond, but the calling thread will NOT be blocked until the user is logged out. After a successful logout, an event will be dispatched. Returns the error from performing the request.

◆ logoutSync()

static bool VRay::ULAClient::logoutSync ( std::string &  error)
inlinestatic

Performs a logout request and WAITS for the log out sequence to complete, effectively blocking the calling thread. Returns the error from performing the request, or timeout if it was reached before getting a notification for logout event.

Note
The timeout used for waiting may be specified with the setSyncTimeout(..) function.

◆ setCustomPrompt()

static bool VRay::ULAClient::setCustomPrompt ( const char *  loginPrompt,
std::string &  error 
)
inlinestatic

Sets a custom login prompt type to be used when a login is initiated.

Parameters
loginPromptThe custom login prompt to be used. May be empty or nullptr to revert to the default login prompt. returns the error from the internal configuration.

◆ setOnLogInLogOut()

static bool VRay::ULAClient::setOnLogInLogOut ( OnLogin  loginCallback,
OnLogout  logoutCallback,
const void *  userData = nullptr 
)
inlinestatic

Sets login and logout callbacks. To remove the callbacks, pass nullptr. The ActiveUserDetailsView pointer received in the loginCallback will never be nullptr.

◆ setSyncTimeout()

static void VRay::ULAClient::setSyncTimeout ( int  timeoutMs)
inlinestatic

Sets the timeout in milliseconds to be used after performing a loginSync() or logoutSync() request for whole operation to be finished.

Parameters
timeoutMsThe desired new timeout in milliseconds.
Note
This timeout may be overridden externally with CHAOS_UNIFIED_LOGIN_CLIENT_SYNC_TIMEOUT environment variable.

The documentation for this class was generated from the following file: