Actin®  Version 5.3.0
Software for Robotics Simulation and Control
Actin SDK Quickstart

Acquiring and verifying a license using the API

The following code snippet demonstrates a simple example usage of the licensing API for acquiring/verifying a license.

int main(void)
{
if(EcActinLicenseHandle::isDefaultHandleInvalid())
{
//Providesupportforactivation/registration
}
//Programcontinues
...
return 0;
}

The new licensing API provides a class EcActinLicenseHandle, that both hides (encapsulates) and generalizes the process of validating a license using one or more licensing approaches. The licensing approaches (called Licensing Schemes) derive from a common base class EcLicensingSchemeBase and can be added to the licenseCheck project’s source tree in a pluggable manner.

In order to create/use any objects from Actin Libraries, it is recom-mended to initialize the Actin Licensing sub-system by calling a static method EcActinLicenseHandle::initialize() before using any of the other Actin libraries. This creates a default singleton instance for EcActinLicenseHandle that is used by the internal components of Actin Libraries as well as may be used by the user to validate the license. The user can get this default singleton instance using a static method EcActinLicenseHandle::defaultInstance() and perform license validation by calling the isInvalid() method of this object. For convenience, another static method EcActinLicenseHandle::isDefaultHandleValid() has been provided which fetches the default instance and calls isInvalid() using the same for license verification. This is provided to make the code more concise and readable.

NOTE: As per recent updates, the EcActinLicenseHandle::initialize() call was made optional/implicit i.e. it’s automatically called on first use of EcActinLicenseHandle::defaultInstance(). However, it is worth noting that this makes the defaultInstance() call thread-unsafe. The default instance in EcActinLicenseHandle is created for product ID returned by EcActinLicenseHandle::defaultProductId(). The value returned by this function can be configured in CMake using cache variable EC_LICENSING_PRODUCT_ID. By default, it returns the output of EcActinLicenseHandle::actinProductId() i.e. 108.

When an instance of EcActinLicenseHandle is created (including the default instance explicitly created via EcActinLicenseHandle::initialize() or implicitly via EcActinLicenseHandle::defaultInstance()), the configured licensing schemes are also initialized. Each scheme usually performs license validation during initialization and caches the result in a member variable, which can later be used to return the verification result without much overhead. However, some licensing schemes may not do so. For some schemes, the validation may happen on every call to isInvalid() method of the scheme.

Created by Energid Technologies www.energid.com
Copyright © 2016 Energid. All trademarks mentioned in this document are property of their respective owners.