AGXDynamics  2.31.1.0
agx::Runtime Class Referenceabstract

The Runtime class will read a license file upon creation and check what configuration is allowed to run. More...

#include <Runtime.h>

+ Inheritance diagram for agx::Runtime:

Public Types

enum  HardwareTypes { NIC = 1, USB = 2, HDD = 3 }
 
enum  Priority { HIGHEST_PRIORITY = 2147483647, LOWEST_PRIORITY = 10000, DEFAULT_PRIORITY = 1073741824 }
 Specifies the ranges of the priority which can be assigned to a singleton at the time of creation. More...
 
typedef agx::Vector< UniqueIdStruct > UniqueIdVector
 

Public Member Functions

bool checkVersion (const agx::String &versionString, int generation, int major=-1, int minor=-1, int patch=-1)
 Version string can be one of two variants: More...
 
void clear ()
 Clear any previously loaded license. More...
 
virtual std::string getClassName () const =0
 
int getPriority () const
 Return the shutdown priority of the singleton instance. More...
 
virtual void shutdown () override
 Singleton cleanup method. More...
 
Online License System
bool loadLicenseFile (agx::String licPath, bool forceRefresh=false)
 Load a License file that was created by activating AGX. More...
 
bool loadLicenseString (agx::String licenseContents, bool forceRefresh=false)
 Load a license but provided as a string instead of read from a file. More...
 
bool isLicenseRefreshed ()
 Check if license was refreshed upon loading. More...
 
agx::String readEncryptedLicense ()
 Read the encrypted license, normally the contents from the license file. More...
 
bool activateAgxLicense (int licenseId, const agx::String &activationPassword)
 Perform online activation of AGX. More...
 
bool activateAgxLicense (int licenseId, const agx::String &activationPassword, const agx::String &outputLicenseFile)
 Perform online activation of AGX. More...
 
agx::String generateOfflineActivationRequest (int licenseId, const agx::String &activationPassword)
 Generates an activation request for a machine that does not have Internet access. More...
 
bool processOfflineActivationRequest (const agx::String &activationResponse)
 Processes the response from a manual activation request. More...
 
bool deactivateAgxLicense ()
 Deactivate the currently loaded license if the license type allows it. More...
 
agx::String encryptRuntimeActivation (int runtimeLicenseId, const agx::String &runtimeLicensePassword, const agx::String &applicationFilename) const
 Encrypt license id and password for runtime activation. More...
 
bool activateEncryptedRuntime (const agx::String &encryptedRuntimeData, const agx::String &outputLicenseFile)
 Perform online activation of an encrypted runtime license. More...
 
Legacy License functions
const UniqueIdVector & getUniqueIds () const
 
bool unlock (const char *licenseString)
 Will try to unlock AGX with the license provided in licenseString. More...
 
bool unlock (const agx::String &licenseString)
 
bool verifyAndUnlock (const char *licenseStr)
 For internal usage. Use one of the unlock functions instead. More...
 
bool hasKey (const char *key) const
 
agx::String readValue (const char *key) const
 
Status functions
bool isValid () const
 
const agx::String & getStatus () const
 Provides status information if license validation failed. More...
 
const agx::String & getExtendedStatus () const
 Provides optional extended status information about why license validation failed. More...
 
bool isModuleEnabled (const char *name) const
 Check if a named AGX module is enabled. More...
 
const agx::StringVector & getEnabledModules () const
 

Static Public Member Functions

static agx::String generateMD5 (const agx::String &deviceID)
 Utility method using agxStream::MD5Checksum::getMD5. More...
 
static Runtime * instance ()
 Singleton instance method. More...
 
static bool isInitialized ()
 

Protected Member Functions

 Runtime ()
 
void _shutdown ()
 

Detailed Description

The Runtime class will read a license file upon creation and check what configuration is allowed to run.

Definition at line 72 of file Runtime.h.

Member Typedef Documentation

◆ UniqueIdVector

Definition at line 87 of file Runtime.h.

Member Enumeration Documentation

◆ HardwareTypes

Enumerator
NIC 
USB 
HDD 

Definition at line 77 of file Runtime.h.

◆ Priority

enum agx::Singleton::Priority
inherited

Specifies the ranges of the priority which can be assigned to a singleton at the time of creation.

Enumerator
HIGHEST_PRIORITY 

The highest priority that can be given to a singleton.

LOWEST_PRIORITY 

The lowest priority that can be given to a singleton.

DEFAULT_PRIORITY 

The default priority given to a singleton.

Definition at line 35 of file Singleton.h.

Constructor & Destructor Documentation

◆ Runtime()

agx::Runtime::Runtime ( )
protected

Member Function Documentation

◆ _shutdown()

void agx::Singleton::_shutdown ( )
protectedinherited

◆ activateAgxLicense() [1/2]

bool agx::Runtime::activateAgxLicense ( int  licenseId,
const agx::String &  activationPassword 
)

Perform online activation of AGX.

On successful activation, the license will also be loaded.

Returns
true on successful activation.

◆ activateAgxLicense() [2/2]

bool agx::Runtime::activateAgxLicense ( int  licenseId,
const agx::String &  activationPassword,
const agx::String &  outputLicenseFile 
)

Perform online activation of AGX.

The received license will be stored to a file locally. Any previous parsed license information will be cleared. On successful activation, the license will also be loaded.

Returns
true on successful activation.

◆ activateEncryptedRuntime()

bool agx::Runtime::activateEncryptedRuntime ( const agx::String &  encryptedRuntimeData,
const agx::String &  outputLicenseFile 
)

Perform online activation of an encrypted runtime license.

If successful, the license will be written to outputLicenseFile.

Parameters
encryptedRuntimeData- Encrypted data generated from encryptRuntimeActivation.
outputLicenseFile- Resulting license file if the online activation is successful.
Returns
true if activation is successful, otherwise false (check getStatus()) for errors

◆ checkVersion()

bool agx::Runtime::checkVersion ( const agx::String &  versionString,
int  generation,
int  major = -1,
int  minor = -1,
int  patch = -1 
)

Version string can be one of two variants:

1) Version range: begin_range - end_range, 1.2-1.4, or 1-2, 1.2.3.4-1.3.4.5 2) Pure version: 1.2, 1, 1.2.3.4, Compare versionString with the version numbers. If generation.major.minor.patch <= versionString then this method returns true

generation always have to be supplied If you are only using three or fewer version numbers, start with generation then major etc.

Returns
true If generation.major.minor.patch <= versionString then this method returns true

◆ clear()

void agx::Runtime::clear ( )

Clear any previously loaded license.

◆ deactivateAgxLicense()

bool agx::Runtime::deactivateAgxLicense ( )

Deactivate the currently loaded license if the license type allows it.

On failure, getStatus() will contain information about the failure

Returns
True if successfully deactivated the license.

◆ encryptRuntimeActivation()

agx::String agx::Runtime::encryptRuntimeActivation ( int  runtimeLicenseId,
const agx::String &  runtimeLicensePassword,
const agx::String &  applicationFilename 
) const

Encrypt license id and password for runtime activation.

The encryption will fail if applicationFilename isn't found in agxIO::Environment::RESOURCE_PATH, returning an empty string.

Parameters
runtimeLicenseId- License id of the runtime license.
runtimeLicensePassword- License password of the runtime license.
applicationFilename- Filename (including relative path) to a file in the application that doesn't change (e.g., an executable or library).
Returns
encrypted runtime activation data

◆ generateMD5()

static agx::String agx::Runtime::generateMD5 ( const agx::String &  deviceID)
static

Utility method using agxStream::MD5Checksum::getMD5.

◆ generateOfflineActivationRequest()

agx::String agx::Runtime::generateOfflineActivationRequest ( int  licenseId,
const agx::String &  activationPassword 
)

Generates an activation request for a machine that does not have Internet access.

◆ getClassName()

virtual std::string agx::Singleton::getClassName ( ) const
pure virtualinherited

◆ getEnabledModules()

const agx::StringVector& agx::Runtime::getEnabledModules ( ) const
Returns
the full set of enabled modules

◆ getExtendedStatus()

const agx::String& agx::Runtime::getExtendedStatus ( ) const

Provides optional extended status information about why license validation failed.

◆ getPriority()

int agx::Singleton::getPriority ( ) const
inherited

Return the shutdown priority of the singleton instance.

◆ getStatus()

const agx::String& agx::Runtime::getStatus ( ) const

Provides status information if license validation failed.

Returns
Information about the isValid result.

◆ getUniqueIds()

const UniqueIdVector& agx::Runtime::getUniqueIds ( ) const
Returns
Unique id for the platform where AGX is running.

◆ hasKey()

bool agx::Runtime::hasKey ( const char *  key) const
Returns
true if the key=value pair exists for key.
See also
readValue

◆ instance()

static Runtime* agx::Runtime::instance ( )
static

Singleton instance method.

◆ isInitialized()

static bool agx::Runtime::isInitialized ( )
static
Returns
true if this singleton is initialized (instance would then return != 0)

◆ isLicenseRefreshed()

bool agx::Runtime::isLicenseRefreshed ( )

Check if license was refreshed upon loading.

◆ isModuleEnabled()

bool agx::Runtime::isModuleEnabled ( const char *  name) const

Check if a named AGX module is enabled.

Returns
True if module name is enabled

◆ isValid()

bool agx::Runtime::isValid ( ) const
Returns
true if a valid license has been read and AGX is allowed to start. If false, getStatus() contains error information.

◆ loadLicenseFile()

bool agx::Runtime::loadLicenseFile ( agx::String  licPath,
bool  forceRefresh = false 
)

Load a License file that was created by activating AGX.

Some license types needs to be refreshed at a certain time interval and this file should be user writable to avoid the need for any manual handling or that the license must be refreshed every time AGX is initialized.

◆ loadLicenseString()

bool agx::Runtime::loadLicenseString ( agx::String  licenseContents,
bool  forceRefresh = false 
)

Load a license but provided as a string instead of read from a file.

This function is similar to loadLicenseFile, but takes the file contents as parameter instead of the filename.

Some license types are refreshed from online source when loading and to check if this has happened, isLicenseRefreshed should be used after this function and readEncryptedLicense if needed.

◆ processOfflineActivationRequest()

bool agx::Runtime::processOfflineActivationRequest ( const agx::String &  activationResponse)

Processes the response from a manual activation request.

Returns
True if the activation response could be processed successfully and a valid license received

◆ readEncryptedLicense()

agx::String agx::Runtime::readEncryptedLicense ( )

Read the encrypted license, normally the contents from the license file.

If no license is loaded, this will return the empty string

◆ readValue()

agx::String agx::Runtime::readValue ( const char *  key) const
Returns
the value associated with key. If key is not found, the empty string will be returned.

◆ shutdown()

virtual void agx::Runtime::shutdown ( )
overridevirtual

Singleton cleanup method.

Reimplemented from agx::Singleton.

◆ unlock() [1/2]

bool agx::Runtime::unlock ( const char *  licenseString)

Will try to unlock AGX with the license provided in licenseString.

This string should contain the same information as the AGX license files normally used.

If Runtime already had parsed a license and the method isValid returns true, using this method will cause isValid to return false if licenseString is not considered valid.

Returns
true if the license is valid and AGX is allowed to start.

◆ unlock() [2/2]

bool agx::Runtime::unlock ( const agx::String &  licenseString)

◆ verifyAndUnlock()

bool agx::Runtime::verifyAndUnlock ( const char *  licenseStr)

For internal usage. Use one of the unlock functions instead.


The documentation for this class was generated from the following file: