License Management

The ruiSetLicenseData() function sets or clears the license data. The legal parameter values include RUI_KEY_STATUS_UNCHANGED (-1).

Note:Different from the V4 of the Usage Intelligence SDK, a sessionID parameter can be supplied.

The ruiSetLicenseData() function can be called between ruiCreateConfig() and ruiStopSDK() and can be called zero or more times. However, the usage requirements of the sessionID parameter are different if ruiSetLicenseData() is called before ruiStartSDK() or called after ruiStartSDK(). See sessionId for more information.

The ruiSetLicenseData() function can be called while a New Registration is being performed (ruiCreateConfig(), ruiStartSDK()). However, the event data is not written to the log file until the New Registration completes, and if the New Registration fails, the data will be lost.

The ruiSetLicenseData() function is an asynchronous function, returning immediately with further functionality executed on separate thread(s).

ruiSetLicenseData()

RUIRESULT ruiSetLicenseData(RUIINSTANCE* ruiInstance, int32_t keyType, int32_t keyExpired, int32_t keyActivated, int32_t keyBlacklisted, int32_t keyWhitelisted, const char* sessionID)

Parameters

The ruiSetLicenseData() function has the following parameters.

ruiSetLicenseData() Parameters

Parameter

Description

ruiInstance (RUIINSTANCE*)

Pointer to the RUI instance created via ruiCreateInstance()

keyType (int32_t)

The keyType parameter can be set to any of the constant types below.

RUI_KEY_TYPE_UNCHANGED  (-1)

RUI_KEY_TYPE_EVALUATION (0)

RUI_KEY_TYPE_PURCHASED  (1)

RUI_KEY_TYPE_FREEWARE   (2)

RUI_KEY_TYPE_UNKNOWN    (3)

RUI_KEY_TYPE_NFR        (4)

RUI_KEY_TYPE_CUSTOM1    (5)

RUI_KEY_TYPE_CUSTOM2    (6)

RUI_KEY_TYPE_CUSTOM3    (7)

Note:The three custom values may be used freely to denote your own custom license types.

keyExpired (int32_t)

Indicates whether the client license has expired. One of the values below:

RUI_KEY_STATUS_UNCHANGED (-1)

RUI_KEY_STATUS_NO        (0)

RUI_KEY_STATUS_YES       (1)

keyActivated (int32_t)

Indicates whether the client license has been activated. One of the values below:

RUI_KEY_STATUS_UNCHANGED (-1)

RUI_KEY_STATUS_NO        (0)

RUI_KEY_STATUS_YES       (1)

keyBlacklisted (int32_t)

Indicates whether the client license key has been blacklisted. One of the values below:

RUI_KEY_STATUS_UNCHANGED (-1)

RUI_KEY_STATUS_NO        (0)

RUI_KEY_STATUS_YES       (1)

keyWhitelisted (int32_t)

Indicates whether the client license key has been whitelisted. One of the values below:

RUI_KEY_STATUS_UNCHANGED (-1)

RUI_KEY_STATUS_NO        (0)

RUI_KEY_STATUS_YES       (1)

sessionId (const char*)

Optional SessionId parameter to associate keys to a specific session. NULL if not used.

The usage requirements of the sessionID parameter are different if ruiSetLicenseData() is called before ruiStartSDK() or called after ruiStartSDK().

Called before startSDK (regardless of multiSessionEnabled)sessionID must be empty.
Called after startSDK and multiSessionEnabled is set to falsesessionID must be empty. This is similar to event tracking APIs.
Called after startSDK and multiSessionEnabled is set to truesessionID must be a current valid value used in ruiStartSession(), or it can be empty. This is different than normal event tracking APIs, whereby a empty value is not allowed.

Returns

The ruiSetLicenseData() function returns one of the return status constants below.

ruiSetLicenseData() Returns

Return

Description

RUI_OK

Function successful.

RUI_INVALID_SDK_OBJECT

SDK Instance parameter is NULL or invalid.

RUI_SDK_INTERNAL_ERROR_FATAL

Irrecoverable internal fatal error. No further API calls should be made.

RUI_SDK_ABORTED

A required New Registration has failed, and hence the SDK is aborted. ruiStopSDK() and ruiDestroyInstance() are possible.

RUI_SDK_SUSPENDED

The Server has instructed a temporary back-off.

RUI_SDK_PERMANENTLY_DISABLED

The Server has instructed a permanent disable.

RUI_SDK_OPTED_OUT

Instance has been instructed by the application to opt-out.

RUI_CONFIG_NOT_CREATED

Configuration has not been successfully created.

RUI_SDK_ALREADY_STOPPED

SDK has already been successfully stopped.

RUI_INVALID_SESSION_ID_EXPECTED_EMPTY

The sessionID is expected to be empty, and it was not.

RUI_INVALID_SESSION_ID_EXPECTED_NON_EMPTY

The sessionID is expected to be non-empty, and it was not.

RUI_INVALID_SESSION_ID_TOO_SHORT

The sessionID violates its allowable minimum length.

RUI_INVALID_SESSION_ID_TOO_LONG

The sessionID violates its allowable maximum length.

RUI_INVALID_SESSION_ID_NOT_ACTIVE

The sessionID is not currently in use.