Finding the Remaining Days/Hours of a Trial License

Declare Variables/Constants

#define FEATURE_NAME           "FeatureTrial"
#define FEATURE_VERSION         "1.0"
#define CONTACT_SERVER         "localhost"

static const char *pcScopeFeatureInfo =
 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
          "<sentinelScope>"
                "<feature index=\"0\">"             
                    "<name>"FEATURE_NAME"</name>"                                                             
                    "<version>"FEATURE_VERSION"</version>"     
                "</feature>"                                               
          "</sentinelScope>";
sntl_licensing_attr_t *pAttrAppContext = NULL;
sntl_licensing_app_context_t *pAppContext = NULL;
char *pcFeatureInfo = NULL;

API Calls

To check the remaining days/hours for a trial license, execute the APIs in the specified sequential order only:

sntl_licensing_attr_new(&pAttrAppContext);
sntl_licensing_attr_set_appcontext_contact_server (pAttrAppContext, CONTACT_SERVER);

If instead the LSFORCEHOST or LSHOST environment variables are set, then the above-mentioned steps are not required.

sntl_licensing_app_context_new(0, pAttrAppContext, &pAppContext);
sntl_licensing_get_info(pAppContext, pcScopeFeatureInfo, SNTL_QUERY_FEATURE_INFO_VERSION(v), &pcFeatureInfo);

If the sntl_licensing_get_info call is successful, the pcFeatureInfo parameter contains an XML-based output having the detailed information (an example output is shown here).

Parse this XML, the "trialDaysLeft" and the "trialSecondsLeft" tags in this XML contains the remaining number of trial days and trial hours (in seconds), respectively.

NOTE   The trial usage information is refreshed while requesting, updating or releasing a trial license.

Note

Refer to the C sample of the Unified API (installed in the Sentinel RMS SDK) for a specific API function, its parameters, and usage.