Maps SDK for C++ 1.0.0
Loading...
Searching...
No Matches
gem::ActivationService Class Reference

ActivationService object. More...

Inheritance diagram for gem::ActivationService:
Collaboration diagram for gem::ActivationService:

Public Member Functions

 ActivationService (const ActivationService &)=delete
 ActivationService (ActivationService &&)=default
 Default move constructor noexcept is deduced.
ActivationService & operator= (const ActivationService &)=delete
 Copy assignment operator is deleted to prevent copying of this service.
ActivationService & operator= (ActivationService &&)=default
 Default move assignment operator.
int generateLicenseKey (ProgressListener listener, const gem::String &applicationId, const gem::String &productId=gem::ProductID::CORE)
 Generates a new license key for the given application and productId.
int activate (ProgressListener listener, const gem::String &applicationId, const gem::String &licenseKey, const gem::String &productId=gem::ProductID::CORE)
 Performs an activation of the supplied ProductID.
int deactivate (ProgressListener listener, const gem::String &applicationId, const gem::String &licenseKey, const gem::String &productId=gem::ProductID::CORE)
 Performs a deactivation of the supplied license key and product.
std::pair< int, gem::StringcompleteActivation (const gem::String &activationResponseBlob)
 Used to finalize an activation that required the extra step.
std::pair< int, gem::StringcompleteOfflineActivation (const gem::String &offlineActivationKey)
 Used to finalize an OFFLINE activation that required the extra step.
std::pair< int, gem::StringcompleteOfflineDeactivation (const gem::String &offlineDeactivationKey)
 Used to finalize an OFFLINE deactivation that required the extra step.
bool isActive (const gem::String &productId) const
 Used to check quickly if the product is active or not on this device.
gem::StringList getProductIds (bool bIncludeExpired=false) const
 Gets a list of product ids (gem::ProductID) that are found on the device.
gem::ActivationInfoList getActivationsForProduct (const gem::String &productId)
 Gets a list of product activations that are found on the device.
gem::ActivationInfoList getActivationsForGate (gem::EGate gate)
 Gets a list of product activations that are found on the device for the given gate.
int deleteActivation (const gem::String &activationId)
 Deletes the activation that matches the given id.
void onUsageDetected ()
 Notifies the activation service that usage of the SDK has been detected.
void onAppTokenRejected (const gem::String &appToken)
 Notifies the activation service that the given app token has been rejected by the online services.
void setUseGPSTimeForActivation (bool useGpsTime)
 Sets whether GPS time should be used for activation related operations.
void setMandatoryGPSTimeForActivation (bool mandatoryGpsTime)
 Sets whether GPS time should be mandatory for activation related operations.

Detailed Description

ActivationService object.

Implements share-read / write Api object over IActivationService.

This behaves like a singleton, i.e. all instances are shared behind the same API interface.

Handles SDK and feature activation.

Provides methods to activate the SDK with license keys or tokens, enabling access to premium or restricted features.

Use of gem::ActivationService is required when the SDK initialization fails with gem::error::KActivation. Not all SDKs require the use of this service, for example the evaluation ones.

Member Function Documentation

◆ activate()

int gem::ActivationService::activate ( ProgressListener listener,
const gem::String & applicationId,
const gem::String & licenseKey,
const gem::String & productId = gem::ProductID::CORE )
inline

Performs an activation of the supplied ProductID.

The process involves sending an HTTP request to Magic Lane Services.

Parameters
[in]listenerThe listener for the activation progress notifications.
[in]applicationIdThe application id for which the activation is performed.
[in]licenseKeyversion 4 UUID which allows the product activation.
[in]productIdThe kind of product that wants to be activated. If no other instructions were supplied, use the default (ProductID::CORE). The errors from below will also be delivered on IProgressListener::notifyComplete.
Returns
gem::KNoError if the activation was successfully started/completed.
error::KRequired in case there's no internet connection. Either try again or follow the manual. An extra step is required to complete the activation.
error::KInvalidInput if the input is invalid. Check notifyComplete hint for details.
error::KIo if something went wrong when interacting with the license file from disk.
error::KNoMemory in the rare ocasion when allocations are not possible.
error::KNetworkFailed in case there was an internet connection but the activation request failed to start.

◆ completeActivation()

std::pair< int, gem::String > gem::ActivationService::completeActivation ( const gem::String & activationResponseBlob)
inline

Used to finalize an activation that required the extra step.

Parameters
[in]activationResponseBlobThe activation response blob obtained after doing the request described in the manual.
Returns
gem::KNoError if the activation was successfully completed.
error::KInvalidInput if the input is invalid. Check the return string for details.
error::KNotFound in case the supplied response doesn't find a match inside this SDK (on this device).
error::KIo if something went wrong when interacting with the license file from disk.

◆ completeOfflineActivation()

std::pair< int, gem::String > gem::ActivationService::completeOfflineActivation ( const gem::String & offlineActivationKey)
inline

Used to finalize an OFFLINE activation that required the extra step.

Parameters
[in]offlineActivationKeyThe offline_activation_key short string of letters and digits obtained after doing the request described in the manual.
Returns
gem::KNoError if the activation was successfully completed.
error::KInvalidInput if the input is invalid. Check the return string for details.
error::KNotFound in case the supplied response doesn't find a match inside this SDK (on this device).
error::KIo if something went wrong when interacting with the license file from disk.

◆ completeOfflineDeactivation()

std::pair< int, gem::String > gem::ActivationService::completeOfflineDeactivation ( const gem::String & offlineDeactivationKey)
inline

Used to finalize an OFFLINE deactivation that required the extra step.

Parameters
[in]offlineDeactivationKeyThe offline_deactivation_key short string of letters and digits obtained after doing the request described in the manual.
Returns
gem::KNoError if the deactivation was successfully completed.
error::KInvalidInput if the input is invalid. Check the return string for details.
error::KNotFound in case the supplied response doesn't find a match inside this SDK (on this device).
error::KIo if something went wrong when interacting with the license file from disk.

◆ deactivate()

int gem::ActivationService::deactivate ( ProgressListener listener,
const gem::String & applicationId,
const gem::String & licenseKey,
const gem::String & productId = gem::ProductID::CORE )
inline

Performs a deactivation of the supplied license key and product.

The process involves sending an HTTP request to Magic Lane Services.

Parameters
[in]listenerThe listener for the activation progress notifications.
[in]applicationIdThe application id for which the deactivation is performed. Required for security purposes.
[in]licenseKeyversion 4 UUID which identifies the activation.
[in]productIdThe kind of product that wants to be deactivated. If no other instructions were supplied, use the default (ProductID::CORE). The errors from below will also be delivered on IProgressListener::notifyComplete.
Returns
gem::KNoError if the activation was successfully started/completed.
error::KRequired in case there's no internet connection.
error::KInvalidInput if the input is invalid. Check notifyComplete hint for details.
error::KIo if something went wrong when interacting with the license file from disk.
error::KNoMemory in the rare ocasion when allocations are not possible.
error::KNetworkFailed in case there was an internet connection but the activation request failed to start.

◆ deleteActivation()

int gem::ActivationService::deleteActivation ( const gem::String & activationId)
inline

Deletes the activation that matches the given id.

Note: it does NOT deactivate it, it deletes it directly.

Parameters
[in]activationIdThe id of the activation that wants to be deleted.
Returns
gem::KNoError if the deletion was successful.

◆ generateLicenseKey()

int gem::ActivationService::generateLicenseKey ( ProgressListener listener,
const gem::String & applicationId,
const gem::String & productId = gem::ProductID::CORE )
inline

Generates a new license key for the given application and productId.

The process involves sending an HTTP request to Magic Lane Services.

Parameters
[in]listenerThe listener for the activation progress notifications.
[in]applicationIdThe application id for which the license key is created.
[in]productIdThe kind of product that the key will be bound to. The errors from below will also be delivered on IProgressListener::notifyComplete.
Returns
gem::KNoError if the generation was successfully started/completed.
error::KRequired in case there's no internet connection or activation service could not be reached.
error::KInvalidInput if the input is invalid. Check notifyComplete hint for details.
error::KNoMemory in the rare ocasion when allocations are not possible.
error::KNetworkFailed in case there was an internet connection but the generation request failed to start.

◆ getActivationsForGate()

gem::ActivationInfoList gem::ActivationService::getActivationsForGate ( gem::EGate gate)
inline

Gets a list of product activations that are found on the device for the given gate.

Parameters
[in]gateThe gate for which the activations will be retrieved.
Returns
The list of product activations.

◆ getActivationsForProduct()

gem::ActivationInfoList gem::ActivationService::getActivationsForProduct ( const gem::String & productId)
inline

Gets a list of product activations that are found on the device.

Parameters
[in]productIdThe product for which the activations will be retrieved.
Returns
The list of product activations.

◆ getProductIds()

gem::StringList gem::ActivationService::getProductIds ( bool bIncludeExpired = false) const
inline

Gets a list of product ids (gem::ProductID) that are found on the device.

Parameters
[in]bIncludeExpiredChoose whether or not to include the expired product ids as well. Defaults to false.
Returns
The list of product ids.

◆ isActive()

bool gem::ActivationService::isActive ( const gem::String & productId) const
inline

Used to check quickly if the product is active or not on this device.

Parameters
[in]productIdThe product that will be checked.
Returns
The active status.

◆ onAppTokenRejected()

void gem::ActivationService::onAppTokenRejected ( const gem::String & appToken)
inline

Notifies the activation service that the given app token has been rejected by the online services.

Parameters
[in]appTokenThe app token that was rejected.

◆ operator=() [1/2]

ActivationService & gem::ActivationService::operator= ( ActivationService && )
default

Default move assignment operator.

Uses the compiler-generated default implementation for move assignment.

Note
noexcept is deduced.
Returns
ActivationService& reference to this instance

◆ operator=() [2/2]

ActivationService & gem::ActivationService::operator= ( const ActivationService & )
delete

Copy assignment operator is deleted to prevent copying of this service.

Returns
ActivationService& reference to this instance

◆ setMandatoryGPSTimeForActivation()

void gem::ActivationService::setMandatoryGPSTimeForActivation ( bool mandatoryGpsTime)
inline

Sets whether GPS time should be mandatory for activation related operations.

Parameters
[in]mandatoryGpsTimeIf true, GPS time will be mandatory for activation operations. If set to true and no GPS time is available, activation operations will fail.

◆ setUseGPSTimeForActivation()

void gem::ActivationService::setUseGPSTimeForActivation ( bool useGpsTime)
inline

Sets whether GPS time should be used for activation related operations.

Parameters
[in]useGpsTimeIf true, GPS time will be used for activation operations; otherwise, system time will be used.