Best practices

The license functions should be used in appropriate places in the code. The following criteria should be considered:

  • Checks should take place regularly but not in too short intervals.
  • The license should be checked at a central point. It should be prevented that the license is checked in each function call. This would technically be possible, but it would affect performance.
  • "sltCheckLicense", "sltGetUnitCounter" and "sltGetFeatureMap" are checked during the Quality Gates (QG) are replaced by corresponding functions in CONTROL to ensure additional security. However, this also means that these functions can not be used without Quality Gate Check. If the Add-on needs to be tested without QG, it is necessary to replace these functions for the test. C++ and C# functions are currently not affected.
  • One of the Quality Gate Checks, is a LicenseCheck. This checks whether the "sltCheckLicense" function is called at least once when using WinCC OA panels or scripts. If this is not the case, the Add-on will not be released to protect the provider.

Do

  • The validity of the license should be displayed visually for the user. A pure edition in the log is not effective.
  • A visual representation of the validity in configuration interfaces helps the user to recognize in time that his license is invalid.
  • A visual representation of the validity of the graphical objects also helps the user a good way to quickly identify an invalid license.

Don't

  • Saving the license function results in a global variable, so as not to have to execute the license function each time, is not expedient because the global variable can be manipulated externally during runtime.
string itemNr = "YOUR_PRODUCT_CODE";

if (globalExists ( "add-Check License"))
{
  return AddOnCheckLicense;
}
else
{
  addGlobal ("AddOnCheckLicense", BOOL_VAR);
  AddOnCheckLicense = sltCheckLicense (itemNr);
  return AddOnCheckLicense;
}
  • A mere output of the license function results in the log is not effective.

results matching ""

    No results matching ""