Resource Base
Table of contents

CLicenseManager

The CLicenseManager class provides a set of APIs to manage SDK licensing.

Definition

Namespace: dynamsoft::license

Assembly: DynamsoftLicense

class CLicenseManager 

Methods Summary

Method Description
InitLicense It is used to initialize the license using a license key.
SetDeviceFriendlyName It is used to set the friendly name of the device.
SetMaxConcurrentInstanceCount It is used to set the maximum number of allowed instances for the given device and process.
GetDeviceUUID It is used to get the unique identifier of the device.
SetLicenseCachePath It is used to set the directory path for the license cache.

InitLicense

It is used to initialize the license using a license key.

static int InitLicense(const char* pLicense, char errorMsgBuffer[] = NULL, const int errorMsgBufferLen = 0)

Parameters

[in] pLicense The license key as a string.

[in, out] errorMsgBuffer The buffer is allocated by caller and the recommended length is 256. The error message will be copied to the buffer. It can be set to NULL if error messages are not required.

[in] errorMsgBufferLen The length of the error message buffer. It is ignored if errorMsgBuffer is set to NULL.

Return value

Returns 0 if the license is initialized successfully, a negative value indicating an error otherwise.

Code Snippet

int errorCode = 0;
char szErrorMsg[256];
errorCode = CLicenseManager::InitLicense("YOUR-LICENSE-KEY", szErrorMsg, 256);
if (errorCode != EC_OK)
    cout << szErrorMsg << endl;

SetDeviceFriendlyName

It is used to set the friendly name of the device.

static int SetDeviceFriendlyName(const char* name)

Parameters

[in] name The friendly name of the device.

Return value

Returns 0 if the friendly name is set successfully, a negative value indicating an error otherwise.

SetMaxConcurrentInstanceCount

It is used to set the maximum number of allowed instances for the given device.

static int SetMaxConcurrentInstanceCount(int countForThisDevice)

Parameters

[in] countForThisDevice The maximum number of allowed instances for the device.

Return value

Returns error code (returns 0 if the function operates successfully).

GetDeviceUUID

It is used to get the unique identifier of the device.

static int GetDeviceUUID(int uuidGenerationMethod, char uuidBuffer[] , const int uuidBufferLen)

Parameters

[in] uuidGenerationMethod The method to generate the UUID.

  • 1: Generates UUID with random values.
  • 2: Generates UUID based on hardware info.

[in, out] uuidBuffer The buffer to store the UUID.

[in] uuidBufferLen The length of the UUID buffer. It is recommended to be greater than 36.

Return value

Returns 0 if the UUID is generated successfully, a negative value indicating an error otherwise.

SetLicenseCachePath

It is used to set the directory path for the license cache.

static int SetLicenseCachePath(const char* directoryPath)

Parameters

[in] directoryPath The directory path for the license cache.

Return value

Returns 0 if the directory path is set successfully, a negative value indicating an error otherwise.

This page is compatible for:

Version 1.0

Is this page helpful?

YesYes NoNo

In this article:

latest version

    • Latest version (2.2.0)
    • Version 2.x
      • Version 2.0.30
      • Version 2.0.20
      • Version 2.0.10
      • Version 2.0.0
    Change +
    © 2003–2024 Dynamsoft. All rights reserved.
    Privacy Statement / Site Map / Home / Purchase / Support