Installation Layer
The Installation Layer (IL) is an add-on which has to be purchased via the Slooptools Store and installed via the installer. As with the other add-ons, the structure is based on a WinCC OA subproject. This add-on also includes the Codemeter CtrlExt. This is necessary to be able to check the licenses of the add-ons.
The installation layer is responsible for completing other add-ons. The central element here is the installation layer script, which is automatically added to the console when added to a project. This checks at startup of the script and every 5 minutes whether new add-ons have been installed. If an add-on was found, the IL performs the following actions on each add-on:
- Create a _Slooptools_Add_ons data point.
- Describe the created data point with the information from the AddonInformation.json file.
- Add a menu entry to the Slooptools category in system management. This menu entry opens a panel in which information about the add-on is displayed.
SLTLicense Control Extension
With the installation layer the SLTLicenseCtrlExt is delivered. The following functions are provided by the Control Extension:
bool sltCheckLicense (string itemNumber)
- Check if the license is valid and if the installed addon version can be used with the license.
int sltDecreaseUnitCounter (string itemNumber, int amount)
- Decreases the UnitCounter of the respective license. (Only if there is a UnitCounter)
- Example: The license is valid for [X] hours / days. As soon as the counter was decremented the last time, the license is invalid.
int sltDecreaseUnitCounterChecked (string itemNumber, int amount)
- Decreases the UnitCounter of the respective license, but not below 1. (Only if a UnitCounter exists.) If the UnitCounter is reduced to 0, the license will be invalidated, there may be cases where this is not desired)
- Example: The license is valid for [Y] widgets. Then the last decrementing should not set the counter to 0 because otherwise the complete license would be invalid, which does not correspond to the license type. Here in the application prevents further widgets can be used.
int sltGetUnitCounter (string itemNumber)
- Queries the UnitCounter of the license. (Only if there is a UnitCounter)
string sltGetExpirationTime (string itemNumber)
- Returns the expiration date of the license in the format “% Y-% m-% dT% I:% M:% S”
int sltGetFeatureMap (string itemNumber)
- Returns the Int value of the 32Bit FeatureMap
string sltGetProductText (string itemNumber)
- Returns the product name and the provider name with | separated
Each of these functions uses the ItemNumber. The ItemNumber of the add-on is the data point name of the respective add-on of the data point type “SloopTools_Add_ons” whereby in WinCC OA the “-” was replaced by a “” due to WinCC OA specifications. The CtrlExtension can deal however with all kinds.
These functions can be used here in appropriate places in the code described here. However, the following criteria should be taken into account:
- License checks should be held regularly, but not in too short intervals.
- The license should be checked at a central location. It should be prevented that the license is checked in each function call. Although technically possible, this would reduce the performance of the add-on.
- sltCheckLicense, sltGetUnitCounter and sltGetFeatureMap are replaced by corresponding functions during the Quality Gate (QG) to ensure additional security. This also means that these functions can not be used normally without a Quality Gate Check. If the add-on needs to be tested without QG, it is necessary to replace these functions for the test.
- Using #uses SLTLicenseCtrlExt
The licenses are bound to the project. This means that other projects that use the same add-on on the same computer must also have a license activated.