Use this class to retrieve licensing information and status. In particular this class may be used to query any additional data that may be customized for the end-user's license, or to control restrictions that apply to a demonstration license.
Each product license applies to a single Trimble Access application running on a given mobile device or PC identified by its unique serial number. A tsc_LicenseInformation instance contains nothing that may be used to identify the end user.
Another type of license is the "License-free" one. This means there is actually no license at all for a plugin, and it may be installed and run by anyone. To make a plugin License-free, submit the GUID of the plugin to Trimble and if approved you will receive a string to paste into the LicenseName macro in the scapi.props file in the build project. This type of license has no useful data in this class, other than the GUID, the special name, and the type.
tsc_LicenseInformation (const char* forWhichGuid);
Retrieves the license information for the specified GUID. This would normally be the currently active plugin's application GUID, such as that returned by tsc_Application::GetProductGuid(), although the GUID of any Trimble Accessa app or plugin will work.
Note that the information retrieved is pertinent to the current hardware device only. If the supplied GUID is not licensed for the current device, most methods will return empty or default values; in particular IsCurrentlyValid() will return false and the license type will be None.
bool IsCurrentlyValid (bool allowDemo = true);
Tests the license to see that it is valid at the present point in time. This is not necessarily the same as when the program was started. The allowDemo parameter defaults to true and considers the Demo license type to be valid.
tsc_String Name();
The name of the license, which is generally the name of the application and a version number. For a License-free plugin, this field will contain "LicenseFree:<64 hex digits>". The name itself is a secure way of indicating the plugin is licensed by default.
tsc_String Guid();
The GUID which uniquely identifies this product. This will be the same as the GUID passed in to the constructor, possibly with case differences.
tsc_LicenseType Type();
x_Code TypeAsXCode();
tsc_String TypeAsString();
Returns the type of the license, as an enumeration, an x-code, or a string. The string value is translated into the currently configured language. For License-free licenses, these methods return "None".
double Activation() const;
Returns the date/time when this license became (or will become) valid, in seconds UTC to match the Survey Core format.
double Expiration() const;
Returns the date/time when this license expires, in seconds UTC to match the Survey Core format.
tsc_String CustomData();
The custom data string from the license. This is generally empty, but may be configured by Trimble to convey additional information about the license.
double Expiration(const char* productTag) const;
Returns the warranty expiration date of the specified product, in seconds UTC to match the Survey Core format.
A <productTag> element must exist inside the <warrantyexpiration> element in the license file. If such an element is not found, the function returns double_Null.
Because the <warrantyexpiration> element is at the top level in the license file, the function operates independently of the current app and will work regardless of the GUID supplied in the constructor.
enum tsc_LicenseType
{
tscli_Full = 0, A perpetual license.
tscli_Timed, A license that expires after a given period.
tscli_Demo, A demonstration license. The meaning of this is determined by the licensed software.
tscli_None, There is no license.
tscli_LicenseFree The plugin is free of licensing.
};