Dev Center
Table of contents

License Methods

Method Description
InitLicense Initializes license key and activate the SDK.
GetDeviceUUID Gets the device uuid used for license activating.
IsInstanceValid Gets whether the instance is valid when charging by concurrent instances count.
SetDeviceFriendlyName Sets a human-readable name that identifies the device.
SetLicenseCachePath Sets a directory path for saving the license cache.
SetMaxConcurrentInstanceCount Sets the max concurrent instance count used for current device and process.
GetInstancePoolStatus Gets a struct to represent the status of an instance pool.
GetIdleInstancesCount Deprecated
InitLicenseFromServer Deprecated
InitLicenseFromLicenseContent Deprecated
OutputLicenseToString Deprecated
OutputLicenseToStringPtr Deprecated
FreeLicenseString Deprecated
InitDLSConnectionParameters Deprecated
InitLicenseFromDLS Deprecated
InitLTSConnectionParameters Deprecated
InitLicenseFromLTS Deprecated

InitLicense

Initializes license key and activate the SDK.

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

Parameters
[in] pLicense The product keys.
[in, out] errorMsgBuffer The buffer is allocated by caller and the recommended length is 512. The error message will be copied to the buffer.
[in] errorMsgBufferLen The length of allocated buffer.

Return Value
Returns error code (returns 0 if the function operates successfully).
You can call GetErrorString to get detailed error message.

Code Snippet

char errorBuf[512];
dynamsoft::dbr::CBarcodeReader::InitLicense("YOUR-LICENSE-KEY", errorBuf, 512);
CBarcodeReader* reader = CBarcodeReader::GetInstance();
if(reader != NULL)
{
    // add further process
    reader->Recycle();
}

GetDeviceUUID

Gets the device uuid used for license activating.

static int dynamsoft::dbr::CBarcodeReader::GetDeviceUUID(int uuidGenerationMethod, char ** uuid)

Parameters

[in] uuidGenerationMethod The method used to generate the UUID.

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

[out] uuid The result UUID.

Return Value

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

You can call GetErrorString to get detailed error message.

Remarks

The method FreeString needs to be called to release memory allocated for the result UUID.

IsInstanceValid

Gets whether the instance is valid when charging by concurrent instances count.

int dynamsoft::dbr::CBarcodeReader::IsInstanceValid()

Return Value

Returns an int value indicating whether the instance is valid for running on concurrent instance mode.

  • 0: The instance is not valid for running on concurrent instance mode.
  • 1: The instance is valid for running on concurrent instance mode.

Remarks

This method is meaningful only when using a license charged by concurrent instances count.

SetDeviceFriendlyName

Sets a human-readable name that identifies the device.

static int dynamsoft::dbr::CBarcodeReader::SetDeviceFriendlyName(const char* name)

Parameters

[in] name The device alias.

Return Value

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

You can call GetErrorString to get detailed error message.

Code Snippet

char errorBuf[512];
dynamsoft::dbr::CBarcodeReader::SetDeviceFriendlyName("My-PC");
dynamsoft::dbr::CBarcodeReader::InitLicense("YOUR-LICENSE-KEY", errorBuf, 512);
CBarcodeReader* reader = CBarcodeReader::GetInstance();
if(reader != NULL)
{
    // add further process
    reader->Recycle();
}

SetLicenseCachePath

Sets a directory path for saving the license cache.

static int dynamsoft::dbr::CBarcodeReader::SetLicenseCachePath(const char* directoryPath)

Parameters

[in] directoryPath The directory path where to save the license cache.

Return Value

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

You can call GetErrorString to get detailed error message.

Code Snippet

char errorBuf[512];
dynamsoft::dbr::CBarcodeReader::SetLicenseCachePath("DIRECTORY-PATH-FOR-LICENSE-CACHE");
dynamsoft::dbr::CBarcodeReader::InitLicense("YOUR-LICENSE-KEY", errorBuf, 512);
CBarcodeReader* reader = CBarcodeReader::GetInstance();
if(reader != NULL)
{
    // add further process
    reader->Recycle();
}

SetMaxConcurrentInstanceCount

Sets the max concurrent instance count used for current device and process.

static void dynamsoft::dbr::CBarcodeReader::SetMaxConcurrentInstanceCount(int countForThisDevice, int countForThisProcess = 0, int timeout= 0)

Parameters

[in] countForThisDevice The maximum number of concurrent instances that the current device can run.

[in] countForThisProcess Optional The maximum number of concurrent instances that the current process can run.

[in] timeout Optional The maximum time (in milliseconds) to wait for an available authorization or instance when calling InitLicense, GetInstance, or Decode functions.

Code Snippet

char errorBuf[512];
int countForThisDevice = 1; // The count value should be set based on your purchased license count
int countForThisProcess = 1; // The count value should be set based on your purchased license count
dynamsoft::dbr::CBarcodeReader::SetMaxConcurrentInstanceCount(countForThisDevice, countForThisProcess);
dynamsoft::dbr::CBarcodeReader::InitLicense("YOUR-LICENSE-KEY", errorBuf, 512);
CBarcodeReader* dbr = dynamsoft::dbr::CBarcodeReader::GetInstance();
// If no instance is available right away, the application will wait until one becomes available
if(dbr != NULL)
{
    // Add your code here to call decoding method, process barcode results and so on
    // ...
    // Recycle the instance to make it idle for other concurrent tasks
    dbr->Recycle();
}

GetInstancePoolStatus

Gets a struct to represent the status of an instance pool.

static InstancePoolStatus dynamsoft::dbr::CBarcodeReader::GetInstancePoolStatus()

Return Value

Returns the InstancePoolStatus struct representing the status of an instance pool.

GetIdleInstancesCount

Deprecated. It still works in this version but could be removed in the near future.

static int dynamsoft::dbr::CBarcodeReader::GetIdleInstancesCount()

InitLicenseFromServer

Deprecated. It still works in this version but could be removed in the near future.

int dynamsoft::dbr::CBarcodeReader::InitLicenseFromServer (const char* pLicenseServer, const char* pLicenseKey)

InitLicenseFromLicenseContent

Deprecated. It still works in this version but could be removed in the near future.

int dynamsoft::dbr::CBarcodeReader::InitLicenseFromLicenseContent (const char* pLicenseKey, const char* pLicenseContent)	

OutputLicenseToString

Deprecated. It still works in this version but could be removed in the near future.

int dynamsoft::dbr::CBarcodeReader::OutputLicenseToString (char content[], const int contentLen)

OutputLicenseToStringPtr

Deprecated. It still works in this version but could be removed in the near future.

int dynamsoft::dbr::CBarcodeReader::OutputLicenseToStringPtr (char** content)

FreeLicenseString

Deprecated. It still works in this version but could be removed in the near future.

void dynamsoft::dbr::CBarcodeReader::FreeLicenseString (char** content)

InitDLSConnectionParameters

Deprecated. It still works in this version but could be removed in the near future.

static int dynamsoft::dbr::CBarcodeReader::InitDLSConnectionParameters(DM_DLSConnectionParameters *pDLSConnectionParameters)

InitLicenseFromDLS

Deprecated. It still works in this version but could be removed in the near future.

static int dynamsoft::dbr::CBarcodeReader::InitLicenseFromDLS(DM_DLSConnectionParameters *pDLSConnectionParameters, char errorMsgBuffer[] = NULL, const int errorMsgBufferLen = 0)

InitLTSConnectionParameters

Deprecated. It still works in this version but could be removed in the near future.

InitLicenseFromLTS

Deprecated. It still works in this version but could be removed in the near future.

This page is compatible for:

Version 7.5.0

Is this page helpful?

YesYes NoNo

In this article:

latest version

  • Latest version
  • Version 10.x
    • Version 10.2.0
    • Version 10.0.20
    • Version 10.0.10
    • Version 10.0.0
  • Version 9.x
    • Version 9.6.40
    • Version 9.6.30
    • Version 9.6.20
    • Version 9.6.10
    • Version 9.6.0
    • Version 9.4.0
    • Version 9.2.0
    • Version 9.0.0
  • Version 8.x
    • Version 8.8.0
    • Version 8.6.0
    • Version 8.4.0
    • Version 8.2.0
    • Version 8.1.2
    • Version 8.1.0
    • Version 8.0.0
  • Version 7.x
    • Version 7.6.0
    • Version 7.5.0
Change +