Functions to query the current license state. More...
Macros | |
#define | LI_COMMONVISIONBLOX 1 |
Image Manager licensed through CVB-type dongle. More... | |
#define | LI_CVB11_FP_LICENSE 8 |
Image Manager and Foundation Package licensed through CVB License engine. | |
#define | LI_CVB11_IM_LICENSE 7 |
Image Manager licensed through CVB License engine. | |
#define | LI_CVC 2 |
Image Manager licensed through CVC-type dongle. More... | |
#define | LI_FOUNDATION_V1 6 |
Image Manager licensed through CVB-type dongle with version 1 Foundation license. More... | |
#define | LI_HARDWARE 5 |
Image Manager licensed through other hardware (e.g. node-locked). More... | |
#define | LI_MINOS 4 |
Image Manager licensed through Minos dongle. More... | |
#define | LI_NOLICENSE 0 |
No Image Manager license found. | |
#define | LI_VISIONBLOX 3 |
Image Manager licensed through VisionBlox dongle. More... | |
Functions | |
cvbval_t | GetLicenseCount () |
Returns the number of licenses in the current snapshot. More... | |
cvblicres_t | GetLicenseInfo () |
Indicates whether Common Vision Blox has been licensed or not. More... | |
cvbres_t | GetLicenseInfoEx (cvbval_t Index, cvblicres_t &SerialNumber, cvbbool_t &IsFoundation) |
Accesses one of the licenses in the current snapshot. More... | |
cvbres_t | GetMagicNumber (size_t Index, char *ProviderName, size_t &ProviderNameBufferSize, char *ToolID, size_t &ToolIDBufferSize, char *MagicNumber, size_t &MagicNumberBufferSize, cvblicres_t &SerialNumber) |
Retrieve a Magic Number data set from the last snapshot. More... | |
cvbval_t | GetMagicNumberCount () |
Gets the total number of Magic Numbers currently available from the last snapshot. More... | |
cvblicres_t | GetSerialNumber () |
Returns the serial number of Common Vision Blox. More... | |
cvbres_t | GetToolMagicNumber (const char *ToolID, size_t Index, char *ProviderName, size_t &ProviderNameBufferSize, char *MagicNumber, size_t &MagicNumberBufferSize, cvblicres_t &SerialNumber) |
Retrieve a Magic Number data set for a specific tool ID from the last snapshot. More... | |
cvbval_t | GetToolMagicNumberCount (const char *ToolID) |
Gets the number of Magic Numbers currently available for a specific ToolID from the last snapshot. More... | |
cvbbool_t | IsSerialNumberAvailable (cvblicres_t SerialNumber) |
Checks if a specific Common Vision Blox serial number is available in the last snapshot. More... | |
cvbbool_t | IsToolMagicNumberAvailable (const char *ToolID, cvbbool_t IgnoreSerial999) |
Checks if a tool magic number is available for the given ToolID on the last snapshot. More... | |
cvbres_t | UpdateLicenses () |
Update the set of license information that can be queried with the GetLicenseCount and GetLicenseInfoEx. More... | |
cvbres_t | UpdateLicensesDeep () |
Updates a snapshot of the full set of licensing information currently provided by the Common Vision Blox License infrastructure. More... | |
Functions to query the current license state.
You are probably familiar with the approach Common Vision Blox takes for licensing tools like e.g. Minos: A Common Vision Blox serial number is paired with a Common Vision Blox Magic Number, and during runtime the tool verifies - through an undisclosed hashing algorithm - whether the serial number and the Magic Number match, outputting a message and/or limiting its functionality if they don't.
The same approach may be used by programs using Common Vision Blox, making use of the infrastructure provided by Common Vision Blox. All you need in order to implement this is a hashing algorithm. Enter your Magic Number into the License.ini file (e.g. through the Management Console) under a tool ID chosen by you (make sure it doesn't collide with one of the IDs that are already in use). When your tool initializes, use the functions GetToolMagicNumberCount and GetToolMagicNumber to query the available Magic Numbers for your algorithm (note that there may be more than one of them available!) and use GetLicenseCount and GetLicenseInfoEx to retrieve the set of available serial numbers. Once you have gathered that data, check if there is a match between one of the serial numbers and one of the Magic Numbers, and if there is, memorize the serial number for which the match was made.
After that, whenever restricted functionality is being called you can simply use UpdateLicenses and IsSerialNumberAvailable (both operate with only little latency) to make sure that the license (dongle) with the matching serial number is still present.
#define LI_COMMONVISIONBLOX 1 |
Image Manager licensed through CVB-type dongle.
#define LI_CVC 2 |
Image Manager licensed through CVC-type dongle.
#define LI_FOUNDATION_V1 6 |
Image Manager licensed through CVB-type dongle with version 1 Foundation license.
#define LI_HARDWARE 5 |
Image Manager licensed through other hardware (e.g. node-locked).
#define LI_MINOS 4 |
Image Manager licensed through Minos dongle.
#define LI_VISIONBLOX 3 |
Image Manager licensed through VisionBlox dongle.
cvbval_t GetLicenseCount | ( | ) |
Returns the number of licenses in the current snapshot.
cvblicres_t GetLicenseInfo | ( | ) |
Indicates whether Common Vision Blox has been licensed or not.
cvbres_t GetLicenseInfoEx | ( | cvbval_t | Index, |
cvblicres_t & | SerialNumber, | ||
cvbbool_t & | IsFoundation | ||
) |
Accesses one of the licenses in the current snapshot.
[in] | Index | Index of the license to be retrieved (must be in the range [0...GetLicenseCount()[) |
[out] | SerialNumber | Variable to receive the serial number of the license at Index. |
[out] | IsFoundation | true if the license at Index is also valid for the Common Vision Blox Foundation Package. |
cvbres_t GetMagicNumber | ( | size_t | Index, |
char * | ProviderName, | ||
size_t & | ProviderNameBufferSize, | ||
char * | ToolID, | ||
size_t & | ToolIDBufferSize, | ||
char * | MagicNumber, | ||
size_t & | MagicNumberBufferSize, | ||
cvblicres_t & | SerialNumber | ||
) |
Retrieve a Magic Number data set from the last snapshot.
The data this function works on may be updated using the UpdateLicensesDeep. The available Magic Number count may be queried using GetMagicNumberCount.
[in] | Index | Index of the Magic Number entry to be retrieved. Must be in the range [0, GetMagicNumberCount()[. |
[in,out] | ProviderName | Pointer to a buffer to be filled with the string identifying the Magic Number provider from which this entry comes. May be nullptr to query this name's ProviderNameBufferSize. |
[in,out] | ProviderNameBufferSize | Size of the ProviderName buffer in bytes. Will receive the required length of the name including nul-termination if ProviderName is nullptr. |
[in,out] | ToolID | Pointer to a buffer to be filled with the tool ID string for this Magic Number entry. May be nullptr, in to query this id ToolIDBufferSize. |
[in,out] | ToolIDBufferSize | Size of the ToolID buffer in bytes. Will receive the required length of the name including nul-termination if ProviderName is nullptr. |
[in,out] | MagicNumber | Pointer to a buffer to be filled with the Magic Number string for this Magic Number entry. May be nullptr, in to query this id MagicNumberBufferSize. |
[in,out] | MagicNumberBufferSize | Size of the MagicNumber buffer in bytes. Will receive the required length of the number including nul-termination if MagicNumber is nullptr. |
[out] | SerialNumber | Serial number associated with this Magic Number entry. For some Magic Number providers like the WIBU CodeMeter keys it is possible to tell for which Common Vision Blox serial number a Magic Number is intended. In that case the serial number matching this Magic Number entry will be set. In all other cases, this value will be 0. |
cvbval_t GetMagicNumberCount | ( | ) |
Gets the total number of Magic Numbers currently available from the last snapshot.
Returns the total number of Magic Numbers currently availably on your system. Individual Magic Numbers can be queried using the functions listed under See Also. The data this function works on, can be updated (e.g. when there is the possibility that the available set of Magic Numbers might have changed) using UpdateLicensesDeep.
For a more extensive description on the use case(s) of this function, please refer to the documentation of UpdateLicensesDeep.
cvblicres_t GetSerialNumber | ( | ) |
Returns the serial number of Common Vision Blox.
cvbres_t GetToolMagicNumber | ( | const char * | ToolID, |
size_t | Index, | ||
char * | ProviderName, | ||
size_t & | ProviderNameBufferSize, | ||
char * | MagicNumber, | ||
size_t & | MagicNumberBufferSize, | ||
cvblicres_t & | SerialNumber | ||
) |
Retrieve a Magic Number data set for a specific tool ID from the last snapshot.
The data this function works on may be updated using UpdateLicensesDeep. The available Magic Number count may be queried using GetToolMagicNumberCount.
[in] | ToolID | Tool ID for which to retrieve a Magic Number entry. |
[in] | Index | Index of the Magic Number entry to be retrieved. Must fall into the range [0, GetToolMagicNumberCount (ToolID)-1. |
[in,out] | ProviderName | Pointer to a buffer to be filled with the string identifying the Magic Number provider from which this entry comes. May be nullptr to query this name's ProviderNameBufferSize. |
[in,out] | ProviderNameBufferSize | Size of the ProviderName buffer in bytes. Will receive the required length of the name including nul-termination if ProviderName is nullptr. |
[in,out] | MagicNumber | Pointer to a buffer to be filled with the Magic Number string for this Magic Number entry. May be nullptr, in to query this id MagicNumberBufferSize. |
[in,out] | MagicNumberBufferSize | Size of the MagicNumber buffer in bytes. Will receive the required length of the number including nul-termination if MagicNumber is nullptr. |
[out] | SerialNumber | Serial number associated with this Magic Number entry. For some Magic Number providers like the WIBU CodeMeter keys it is possible to tell for which Common Vision Blox serial number a Magic Number is intended. In that case the serial number matching this Magic Number entry will be set. In all other cases, this value will be 0. |
cvbval_t GetToolMagicNumberCount | ( | const char * | ToolID | ) |
Gets the number of Magic Numbers currently available for a specific ToolID from the last snapshot.
Returns the total number of Magic Numbers currently availably on your system for the given ToolID. Individual Magic Numbers can be queried using the functions listed under See Also. The data this function works on can be updated (e.g. when there is the possibility that the available set of Magic Numbers might have changed) using UpdateLicensesDeep.
For a more extensive description on the use case(s) of this function, please refer to the documentation of UpdateLicensesDeep.
[in] | ToolID | Tool ID for which to query the number of available Magic Numbers. |
cvbbool_t IsSerialNumberAvailable | ( | cvblicres_t | SerialNumber | ) |
Checks if a specific Common Vision Blox serial number is available in the last snapshot.
Allows for a quick check if a given Common Vision Blox serial number is (still) available on this system. Individual serial numbers can be queried using the function GetLicenseCount and GetLicenseInfoEx. The data this function works on can be updated (e.g. when there is the possibility that the available set of Magic Numbers might have changed) using UpdateLicenses or (slower!) UpdateLicensesDeep.
For a more extensive description on the use case(s) of this function, please refer to the documentation of UpdateLicenses and UpdateLicensesDeep.
[in] | SerialNumber | Serial number to check for. |
cvbbool_t IsToolMagicNumberAvailable | ( | const char * | ToolID, |
cvbbool_t | IgnoreSerial999 | ||
) |
Checks if a tool magic number is available for the given ToolID on the last snapshot.
Allows for a quick check if there is Magic Number information available at all for the given tool ID. Individual Magic Numbers can be queried using the functions listed under See Also. The data this function works on can be updated (e.g. when there is the possibility that the available set of Magic Numbers might have changed) using UpdateLicensesDeep.
For a more extensive description on the use case(s) of this function, please refer to the documentation of UpdateLicensesDeep.
[in] | ToolID | Tool ID for which to query the number of available Magic Numbers. |
[in] | IgnoreSerial999 | true to ignore those Magic Numbers that are intended for use with the trial licenses; false otherwise. |
cvbres_t UpdateLicenses | ( | ) |
Update the set of license information that can be queried with the GetLicenseCount and GetLicenseInfoEx.
Starting with version 2011 (11.00.000), Common Vision Blox uses a new license concept that allows for multiple serial numbers on a system (i.e. an automatic concatenation of licenses becomes possible). With this new approach, the functions GetLicenseInfo and GetSerialNumber no longer suffice. Instead, a new set of functions has been added that allows for a more detailed query of the license state.
To avoid race conditions, these functions no longer directly query the license providers, but work on a cached snapshot of the license state. UpdateLicenses may be called to update that cache - an operation you should expect to take in the order of 1 to 2 ms.
cvbres_t UpdateLicensesDeep | ( | ) |
Updates a snapshot of the full set of licensing information currently provided by the Common Vision Blox License infrastructure.
Unlike UpdateLicenses, which just performs a quick query of the set of currently available serial numbers, this call also updates the Magic Number information.