class RED::ILicense

Interface that exposes license management methods. More...

#include <REDILicense.h>

Inherits: IREDObject.

Public functions:

virtual const RED::Version &GetSDKVersion ( ) const = 0
virtual RED_RCIsProductActivated ( bool & oActivated, RED::PRODUCT iProduct ) const = 0
virtual RED_RCIsTemporaryLicense ( bool & oTemporary, LicenseTime & oEndDate ) const = 0
virtual RED_RCSetLicense ( const RED::String & iLicenseKey, unsigned int iCustomerID ) = 0
virtual RED_RCSetOnlineLicense ( unsigned int iCustomerID, unsigned int iTimeOut = 5 ) = 0

Public static functions:

static RED::CIDGetClassID ( )

Detailed description:

Interface that exposes license management methods.

The RED::ILicense interface exposes the REDsdk licensing API. It enables customers to disarm the REDsdk license checks in order to deploy their applications to their own customers.

There are two licensing modes in REDsdk: per-seat or software vendor licensing. Each mode comes with its own API to set up a license.

Whatever the licensing mode you chose, licensing your REDsdk-based application is the very first step in running it. If you miss or fail to license correctly your application, REDsdk API calls will fail.

In both modes, the customer is provided with a customer ID uniquely identifying him in Redway3d's customers list. This ID is encrypted and privately held to respect customer's privacy. Alternatively, he may have received a generic customer ID with a temporary license key for evaluation purpose.

Per-seat mode

In this mode, the customer ID must be supplied to REDsdk using RED::ILicense::SetOnlineLicense.

A connection is initiated with the Redway3d's licensing servers waiting for a green light. This process is blocking as no other REDsdk call can be operated as long as a valid license has not been received.

Software vendor mode

In this mode, a REDsdk customer must also have received a license key along with his customer ID. Both information need to be supplied to the API to remove REDsdk protection.

Code example

The CID_REDResourceManager is the only object that exposes this interface.

A customer should always have those lines of code inserted into his application after having created a RED::IResourceManager instance and before any call to the other RED::Factory methods:

  // create the unique instance of the REDResourceManager:
  RED::Object* resmgr = RED::Factory::CreateInstance( CID_REDResourceManager );
  if( resmgr == NULL )
    ERROR;

  // get the interface to the RED resource manager
  RED::IResourceManager *iresmgr = _resmgr->As<RED::IResourceManager>();

  // get the interface to the licensing API
  RED::ILicense* ilicense = _resmgr->As< RED::ILicense >();

  // setup the customer licensing information (per-seat mode)
  ilicense->SetOnlineLicense( my_customer_ID );
  // or (software vendor mode)
  ilicense->SetLicense( my_license_key, my_customer_ID );

You can then check if your application is correctly activated by calling RED::ILicense::IsProductActivated.

Upon success, those lines of code definitely disarm the REDsdk protection.

Functions documentation

public virtual const RED::Version & RED::ILicense::GetSDKVersion() const = 0

Gets the version of REDsdk currently in use.

Returns:

A constant reference to the REDsdk version.
public virtual RED_RC RED::ILicense::IsProductActivated(bool &oActivated,
RED::PRODUCTiProduct
)const = 0

Gets the activation state of the application.

A product is activated if it has at least a valid license key associated with it.

Please note that license may be time limited.

Parameters:

oActivatedReference to the activation flag value.
iProductproduct to check for validity.

Returns:

RED_OK on succes,
RED_FAIL otherwise.
public virtual RED_RC RED::ILicense::IsTemporaryLicense(bool &oTemporary,
LicenseTime &oEndDate
)const = 0

Gets the temporary state of the current license and, if meaningful, the end date of the license.

Parameters:

oTemporaryReference to the temporary flag of the license.
oEndDateReference to the end date of a temporary license. Undefined if the license is not temporary.

Returns:

RED_OK on succes,
RED_FAIL otherwise.
public virtual RED_RC RED::ILicense::SetLicense(const RED::String &iLicenseKey,
unsigned intiCustomerID
) = 0

Sets a software vendor license.

This method is needed to authorize REDsdk in software vendor mode. If not called, REDsdk will fail to start. See Setting up a REDsdk software vendor license for details on setting up a software vendor license.

Parameters:

iLicenseKeythe license key.
iCustomerIDthe customer ID.

Returns:

RED_OK on success,
RED_ALLOC_FAILURE on a memory allocation error,
RED_FAIL otherwise.
public virtual RED_RC RED::ILicense::SetOnlineLicense(unsigned intiCustomerID,
unsigned intiTimeOut = 5
) = 0

Sets a per-seat license.

This method is needed to authorize REDsdk in per-seat mode. If not called, REDsdk will fail to start. See Setting up a REDsdk per-seat license for details on setting a per-seat license.

Parameters:

iCustomerIDthe customer ID.
iTimeOutthe maximum duration before the call returns in seconds (default is 5 sec). If set to 0, the call blocks until something happens.

Returns:

RED_OK on success,
RED_ALLOC_FAILURE on a memory allocation error,
RED_TIME_OUT if the process took more time than allowed before ending,
RED_NO_CONNECTION_TO_LICENSE_SERVER when the connection to the license server can't be initiated,
RED_INVALID_CUSTOMER_ID when the entered customer ID is not valid,
RED_INVALID_LICENSE when an invalid license has been received,
RED_ALL_LICENSES_IN_USE when no more license is available for the entered customer ID,
RED_FAIL otherwise.