ImFusion SDK 4.3
ImFusion::LicenseManagerSDK Namespace Reference

LicenseManagerSDK provide an interface to our license system for SDK users. More...

Detailed Description

LicenseManagerSDK provide an interface to our license system for SDK users.

Note: You must call Framework::init() before calling any function of LicenseManagerSDK (except for addCustomToken()). The earliest you are allowed to call any function of LicenseManagerSDK is in Framework::InitConfig::licenseInitFunction.

Functions

int setKeyAndCode (const std::string &key, const std::string &code=std::string(""))
 Set license information If a code is provided an offline activation will be performed otherwise an online activation is performed.
 
int setLicenseKey (std::string_view key)
 Set license key An online activation is performed.
 
bool setProxy (const std::string &host)
 Set proxy to use for connecting to license server.
 
std::string token ()
 Return base64 encoded token for this machine.
 
std::string key ()
 Return currently used license key.
 
bool isActivated ()
 Check whether a valid license is installed.
 
void addCustomToken (const std::string &token)
 Add custom token used for licensing. Needs to be called before any other method of LicenseManagerSDK is called.
 
std::optional< std::chrono::system_clock::time_point > expirationDate ()
 Returns an optional point in time at which the license will expire. The optional will be empty if the license does not expire.
 
std::optional< DateTime::TimePointexpirationDateTimePoint ()
 Returns an optional point in time at which the license will expire. The optional will be empty if the license does not expire.
 

Function Documentation

◆ setKeyAndCode()

int setKeyAndCode ( const std::string & key,
const std::string & code = std::string("") )

Set license information If a code is provided an offline activation will be performed otherwise an online activation is performed.

Parameters
keyLicense key
codeActivation code
Returns
Status code: 0 = success, -1 = invalid license key format, -2 = activation code does not match license key, -3 = activation failed
Note
This method needs to be called before e.g. an ApplicationController is instantiated. Usually there is no need to call this method if isActivated() returns true.
In contrast to setLicenseKey() this method should be used for license systems which do support offline activation using code.

◆ setLicenseKey()

int setLicenseKey ( std::string_view key)

Set license key An online activation is performed.

Parameters
keyLicense key
Returns
Status code: 0 = success, -1 = invalid license key format, -3 = activation failed
Note
This method needs to be called before e.g. an ApplicationController is instantiated. Usually there is no need to call this method if isActivated() returns true.
In contrast to setKeyAndCode() this method should be used for license systems which do not support offline activation using code. (e.g. LicenseSpring)

◆ setProxy()

bool setProxy ( const std::string & host)

Set proxy to use for connecting to license server.

To disable a previously set proxy pass in an empty string.

Parameters
hostHost address of proxy server. Optionally can contain port in form :[port] at the end and a specific proxy type in the front (e.g. http://). If no port or proxy type is given 1080 and http are used.
Returns
True if proxy was set, false if proxy could not be set or is not supported

◆ expirationDate()

std::optional< std::chrono::system_clock::time_point > expirationDate ( )

Returns an optional point in time at which the license will expire. The optional will be empty if the license does not expire.

Deprecated
"Use expirationDateTimePoint instead"
Search Tab / S to search, Esc to close