SqueezeBrains SDK 1.13
License

License management. More...

Collaboration diagram for License:

Data Structures

struct  sb_t_license_configuration
 Defines the configurations of the license. More...
 
struct  sb_t_license_module
 Defines all the attributes and properties of a license module. More...
 
struct  sb_t_license
 Defines the license and its properties. More...
 

Macros

#define SB_LICENSE_VENDOR_CODE_SIZE   32
 Size, in bytes, of the string of the vendor code.
 

Enumerations

enum  sb_t_license_module_status { SB_LICENSE_MODULE_STATUS_NULL = 0 , SB_LICENSE_MODULE_STATUS_ACTIVE , SB_LICENSE_MODULE_STATUS_DISABLED , SB_LICENSE_MODULE_STATUS_ERR }
 Enumerations of status of a module of the license. More...
 
enum  sb_t_license_type {
  SB_LICENSE_NULL = 0 , SB_LICENSE_DISABLED , SB_LICENSE_DEMO , SB_LICENSE_MASTER ,
  SB_LICENSE_NOT_PRESENT
}
 Enumerations of the license types. More...
 
enum  sb_t_license_configuration_id { SB_LICENSE_PREMIUM = 0 , SB_LICENSE_STANDARD , SB_LICENSE_BASIC , SB_LICENSE_CONFIGURATION_NUMBER }
 Enumerations of the license configurations. More...
 
enum  sb_t_license_module_id {
  SB_LICENSE_MODULE_NONE = -1 , SB_LICENSE_MODULE_RETINA , SB_LICENSE_MODULE_SURFACE , SB_LICENSE_MODULE_DEEP_CORTEX ,
  SB_LICENSE_MODULE_DEEP_SURFACE , SB_LICENSE_MODULE_NUMBER
}
 Enumerations of modules of the SB library. More...
 

Functions

sb_t_err sb_license_get_hw_info (char **const str)
 Returns the hardware information. More...
 
sb_t_err sb_license_check (SB_HANDLE module, char **const msg)
 Checks the license status and if the project can be used with the current license configuration. More...
 
sb_t_err sb_license_configuration_check (SB_HANDLE module, sb_t_license_configuration_id configuration_id, char **const msg)
 Checks if the project can be used with a license configuration. More...
 
sb_t_err sb_license_get_info (sb_t_license *const info)
 Returns the license information. More...
 
sb_t_err sb_license_format_info (const sb_t_license *const info, char *const str, int str_size)
 Formats the license structure. More...
 
const char * sb_license_format_module_id (sb_t_license_module_id code)
 Returns the string of the module id. More...
 
const char * sb_license_format_module_status (sb_t_license_module_status status)
 Returns the string of the feature status. More...
 
const char * sb_license_format_type (sb_t_license_type type)
 Returns the string of the license type. More...
 
const char * sb_license_format_configuration (sb_t_license_configuration_id configuration)
 Returns the string of the license configuration. More...
 
sb_t_err sb_license_apply_v2c (const char *const v2c, char **const msg_err, int verbosity)
 Applies the v2c file to the usb dongle key. More...
 

Detailed Description

License management.

See License for more information.

Enumeration Type Documentation

◆ sb_t_license_configuration_id

Enumerations of the license configurations.

The values are 32 bits both for 32 and 64 bits library version.

Enumerator
SB_LICENSE_PREMIUM 

Premium configuration.

SB_LICENSE_STANDARD 

Standard configuration.

SB_LICENSE_BASIC 

Basic configuration.

SB_LICENSE_CONFIGURATION_NUMBER 

Number of configurations.

This field must be the last of the enum.

Definition at line 6812 of file sb.h.

◆ sb_t_license_module_id

Enumerations of modules of the SB library.

The values are 32 bits both for 32 and 64 bits library version.

Enumerator
SB_LICENSE_MODULE_NONE 

Module type not defined.

SB_LICENSE_MODULE_RETINA 

Retina.

SB_LICENSE_MODULE_SURFACE 

Surface.

SB_LICENSE_MODULE_DEEP_CORTEX 

Deep Cortex.

SB_LICENSE_MODULE_DEEP_SURFACE 

Deep Surface.

SB_LICENSE_MODULE_NUMBER 

Number of modules.

This field must be the last of the enum.

Definition at line 6828 of file sb.h.

◆ sb_t_license_module_status

Enumerations of status of a module of the license.

The values are 32 bits both for 32 and 64 bits library version.

Enumerator
SB_LICENSE_MODULE_STATUS_NULL 

The license status is undefined.

SB_LICENSE_MODULE_STATUS_ACTIVE 

The license is valid and active.

SB_LICENSE_MODULE_STATUS_DISABLED 

The license is disabled.

SB_LICENSE_MODULE_STATUS_ERR 

There is an error. See the field sb_t_license_module::err.

Definition at line 6787 of file sb.h.

◆ sb_t_license_type

Enumerations of the license types.

The values are 32 bits both for 32 and 64 bits library version.

Enumerator
SB_LICENSE_NULL 

License type isn't defined.

SB_LICENSE_DISABLED 

License is disabled.

SB_LICENSE_DEMO 

Demo license: has an expiry date.

SB_LICENSE_MASTER 

Master license: hasn't an expiry date.

SB_LICENSE_NOT_PRESENT 

License is not present.

Definition at line 6799 of file sb.h.

Function Documentation

◆ sb_license_apply_v2c()

sb_t_err sb_license_apply_v2c ( const char *const  v2c,
char **const  msg_err,
int  verbosity 
)

Applies the v2c file to the usb dongle key.

The function burns the usb dongle key with the Vendor to CUstomer (v2c) license file. You cannot apply the file twice or apply a previous license.

Warning
Only one usb dongle key must be connected to the PC
Parameters
[in]v2cFile name of the Vendor to Customer license.
[out]msg_errIn case there is an error the variable is filled with the pointer to a message error.
The string must be freed with sb_free . It can be NULL.
[in]verbosityVerbosity of the message. Set to 0 to disable all the messages.
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
License
sb_free

◆ sb_license_check()

sb_t_err sb_license_check ( SB_HANDLE  module,
char **const  msg 
)

Checks the license status and if the project can be used with the current license configuration.

There are the following cases:

  1. returned value is SB_ERR_NONE and msg is NULL: you can use the project with the current license without limitations.
  2. returned value is SB_ERR_NONE and msg is allocated: there are some warnings, you can use the project with the current license but with some limitations.
  3. returned value is SB_ERR_LICENSE and msg is allocated: the project cannot be used with the current license.
    Attention
    The string msg MUST be deallocated with sb_free .
    Parameters
    [in]moduleHandle of the module to be checked.
    [out]msgpointer to the string filled with a message.
    Returns
    If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
    SB_ERR_LICENSE is returned if the license isn't valid for the current project of dosen't exits.
    See also
    License
    sb_init
    sb_free

◆ sb_license_configuration_check()

sb_t_err sb_license_configuration_check ( SB_HANDLE  module,
sb_t_license_configuration_id  configuration_id,
char **const  msg 
)

Checks if the project can be used with a license configuration.

There are the following cases:

  1. returned value is SB_ERR_NONE and msg is NULL: you can use the project with the license configuration without limitations.
  2. returned value is SB_ERR_NONE and msg is allocated: there are some warnings, you can use the project with the license configuration but with some limitations.
  3. returned value is SB_ERR_LICENSE and msg is allocated: the project cannot be used with the license configuration, that is you cannot call sb_svl_run or sb_project_detection .

If you want to check only the error condition, and you are not interested in the reason for the error, you can call the function with msg equal to NULL.

Attention
The string msg MUST be deallocated with sb_free .
Parameters
[in]moduleHandle of the module to be checked.
[in]configuration_idLicense configuration identifier.
[out]msgPointer to the string filled with a message describing the reasons for the error or warning.
It can be NULL, in this case you cannot check for warning conditions, that is you can call sb_svl_run or sb_project_detection but with some limitations.
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
SB_ERR_LICENSE is returned if the project cannot be used with the license configuration.
See also
License configuration compatibility
sb_free

◆ sb_license_format_configuration()

const char * sb_license_format_configuration ( sb_t_license_configuration_id  configuration)

Returns the string of the license configuration.

Interprets the contents of the type and converts it to a C-string containing a human-readable version of the corresponding configuration.
The string must not be freed.

Parameters
[in]configurationLicense configuration.
Returns
A C-string containing the license configuration in a human-readable format.

◆ sb_license_format_info()

sb_t_err sb_license_format_info ( const sb_t_license *const  info,
char *const  str,
int  str_size 
)

Formats the license structure.

Interprets the contents of info and converts it to a C-string containing a human-readable version of the corresponding structure.

Parameters
[in]infoPointer to the structure of the license information.
[out]strString filled by the function.
[in]str_sizeSize, in bytes, of str
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.

◆ sb_license_format_module_id()

const char * sb_license_format_module_id ( sb_t_license_module_id  code)

Returns the string of the module id.

Interprets the contents of the code and converts it to a C-string containing a human-readable version of the corresponding id.

Warning
The string must not be freed.
Parameters
[in]codeModule id.
Returns
A C-string containing the module id in a human-readable format.

◆ sb_license_format_module_status()

const char * sb_license_format_module_status ( sb_t_license_module_status  status)

Returns the string of the feature status.

Interprets the contents of the status and converts it to a C-string containing a human-readable version of the corresponding status.
The string must not be freed.

Parameters
[in]statusFeature status.
Returns
A C-string containing the feature status in a human-readable format.

◆ sb_license_format_type()

const char * sb_license_format_type ( sb_t_license_type  type)

Returns the string of the license type.

Interprets the contents of the type and converts it to a C-string containing a human-readable version of the corresponding type.
The string must not be freed.

Parameters
[in]typeLicense type.
Returns
A C-string containing the license type in a human-readable format.

◆ sb_license_get_hw_info()

sb_t_err sb_license_get_hw_info ( char **const  str)

Returns the hardware information.

The string has to be sent to the vendor in order to obtain a Software Master license.

Attention
The string str MUST be deallocated with sb_free.
Parameters
[out]strThe function allocates the string and fills it with the hardware information.
The string str MUST be deallocated with sb_free .
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
License
sb_free

◆ sb_license_get_info()

sb_t_err sb_license_get_info ( sb_t_license *const  info)

Returns the license information.

The table below lists some possible situations that can occur with the value of the status, type and err parameters of the sb_t_license_module structure. In the wait column it is reported in which cases you can wait for the license to activate. The case that will always occur immediately after calling the sb_init function is the first, ie when the license manager has not yet initialized.

status type err Wait Description
SB_LICENSE_MODULE_STATUS_NULL SB_LICENSE_NULL SB_ERR_NONE yes The license manager has not yet started.
SB_LICENSE_MODULE_STATUS_ERR SB_LICENSE_NULL SB_ERR_LICENSE_NOT_FOUND yes USB dongle key license not found. It happen if you call sb_init with SB_INIT_ONLY_HW_LICENSE_KEY and the us dongle key is not present.
SB_LICENSE_MODULE_STATUS_ERR SB_LICENSE_NULL SB_ERR_LICENSE_WAIT_SERVER yes License server is not reachable. It happens if you have a DEMO license and the license server is not reachable.
SB_LICENSE_MODULE_STATUS_ERR SB_LICENSE_DEMO SB_ERR_LICENSE_WAIT_SERVER yes License server is not reachable. It happens if you have a Master license and a DEMO license and the license server is not reachable.
SB_LICENSE_MODULE_STATUS_ACTIVE SB_LICENSE_DEMO SB_ERR_NONE no License active.
SB_LICENSE_MODULE_STATUS_ACTIVE SB_LICENSE_MASTER SB_ERR_NONE no License active.
SB_LICENSE_MODULE_STATUS_DISABLED SB_LICENSE_DISABLED SB_ERR_LICENSE_DISABLED no License disabled.
SB_LICENSE_MODULE_STATUS_ERR SB_LICENSE_NOT_PRESENT SB_ERR_LICENSE_WAIT_SERVER no License not present. It happens with the Surface module if you are using a master license issued with versions prior to 1.5.0, ie only with the Retina module, and the license server cannot be reached.
SB_LICENSE_MODULE_STATUS_ERR SB_LICENSE_DEMO SB_ERR_LICENSE_EXPIRED no License expired.
SB_LICENSE_MODULE_STATUS_ERR SB_LICENSE_NULL SB_ERR_LICENSE_FILE no Non-existent license file, unreadable or incorrect format and the license server is not reachable
Parameters
infoPointer to the structure which will be filled with license information.
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
License