1 #ifndef LS_LICENSE_HANDLER_H 2 #define LS_LICENSE_HANDLER_H 16 class LicenseHandlerImpl;
53 const std::wstring& dataLocation()
const;
55 void setDataLocation(
const std::wstring& path );
57 std::wstring licenseFileName()
const;
59 void setLicenseFileName(
const std::wstring& name );
61 std::wstring licenseFilePath()
const;
66 bool isOnline()
const;
71 const std::string& licensePolicy = std::string() )
const;
73 const LicenseID& getTrialLicense(
const std::string& userEmail )
const;
75 const std::string& getSSOUrl(
const std::string& accountCode = std::string(),
bool useAuthCode =
true );
77 const std::string& getAirGapActivationCode(
const std::string& initializationCode,
const std::string& licenseKey );
79 const std::string& getAirGapDeactivationCode(
const std::string& initializationCode );
81 void activateAirGapLicense(
const std::string& confirmationCode,
const std::wstring& activationResponseFile,
const std::string& licenseKey, uint32_t policyId );
83 void deactivateAirGapLicense(
const std::string& confirmationCode );
85 std::vector<LicenseUser::ptr_t> getLicenseUsers(
const Customer& customer );
87 std::vector<LicenseUser::ptr_t> getLicenseUsers(
const std::string& customerEmail );
89 void activateLicense(
const LicenseID& licenseID );
91 void activateLicense(
const std::string& authData,
const std::string& accountCode = std::string(),
bool useAuthCode =
true );
93 bool deactivateLicense();
95 bool changePassword(
const std::string& password,
const std::string& newPassword,
96 const std::string& user = std::string() );
98 void relinkLicense(
DeviceIDAlgorithm deviceIdAlgorithm,
const std::string& userPassword = std::string() );
102 const std::vector<std::string>& getVersionList(
const LicenseID& licenseID =
LicenseID(),
106 const std::string& version = std::string(),
109 void sendDeviceVariables();
111 std::vector<DeviceVariable> getDeviceVariables(
bool getFromBackend =
false );
113 void syncConsumption( int32_t requestOverage = -1 );
115 void syncFeatureConsumption(
const std::string& featureCode = std::string() );
117 void registerFloatingLicense();
119 void borrowFloatingLicense( uint32_t hours, uint32_t days = 0 );
121 void borrowFloatingLicense(
const std::string& borrowEndDateTime = std::string() );
123 void releaseFloatingLicense();
127 bool isInitialized()
const;
128 bool isLicenseExists()
const;
130 void updateConsumption( int32_t value = 1,
bool saveLicense =
true );
132 void updateFeatureConsumption(
const std::string& featureCode, int32_t value = 1,
bool saveLicense =
true );
134 void checkLicenseLocal();
136 void clearLocalStorage();
139 void addUserData(
const CustomField& data,
bool saveLicense =
true );
141 void removeUserData(
const std::string& key = std::string(),
bool saveLicense =
true );
143 const std::vector<CustomField>& userData();
145 std::string userData(
const std::string& key );
148 bool isAutoReleaseSet()
const;
150 void setAutoRelease(
bool autoRelease );
154 void resumeLicenseWatchdog();
156 void stopLicenseWatchdog();
159 void addDeviceVariable(
const std::string& name,
const std::string& value,
bool saveLicense =
true );
161 void addDeviceVariable(
const DeviceVariable& variable,
bool saveLicense =
true );
163 void addDeviceVariables(
const std::vector<DeviceVariable>& variables );
167 const std::string& deviceVariableValue(
const std::string& name )
const;
172 const std::wstring& createOfflineActivationFile(
const LicenseID& licenseID,
173 const std::wstring& activationRequestFile = std::wstring() );
175 void activateLicenseOffline(
const std::wstring& activationResponseFile = std::wstring() );
177 const std::wstring& deactivateLicenseOffline(
const std::wstring& deactivationRequestFile = std::wstring() );
179 bool updateOffline(
const std::wstring& path = std::wstring(),
bool resetConsumption =
false );
184 bool isLicenseValid()
const;
186 bool isLicenseTrial()
const;
188 bool isLicenseAirGapped()
const;
190 bool isLicenseActive()
const;
192 bool isLicenseEnabled()
const;
194 bool isLicenseExpired()
const;
196 bool isLicenseMaintenanceExpired()
const;
198 bool isLicenseOfflineActivated()
const;
200 bool isLicenseFloating()
const;
202 bool isLicenseBorrowed()
const;
204 bool isLicenseOveragesAllowed()
const;
206 bool isLicenseUnlimitedConsumptionAllowed()
const;
208 bool isLicenseVMAllowed()
const;
210 bool isSubscriptionGracePeriodStarted()
const;
212 bool isGracePeriodStarted()
const;
214 tm gracePeriodEndDateTime()
const;
216 tm gracePeriodEndDateTimeUTC()
const;
218 int gracePeriodHoursRemaining()
const;
223 const std::string& getLicenseKey()
const;
225 const std::string& getLicenseUser()
const;
227 const std::string& getLicenseStatusStr()
const;
229 const std::string& getLicenseStartDate()
const;
231 const std::string& getLicenseMetadata()
const;
237 tm getLicenseExpiryDate()
const;
239 tm getLicenseExpiryDateUtc()
const;
241 tm getLicenseMaintenancePeriod()
const;
243 tm getLicenseMaintenancePeriodUtc()
const;
245 tm getLicenseLastCheckDate()
const;
247 tm getLicenseLastCheckDateUtc()
const;
249 tm getLicenseFloatingEndDateTime()
const;
251 tm getLicenseFloatingEndDateTimeUtc()
const;
253 int getDaysRemaining()
const;
255 int getMaintenanceDaysRemaining()
const;
257 int getDaysPassedSinceLastCheck()
const;
260 uint32_t getSubscriptionLicenseGracePeriod()
const;
262 tm validityWithGracePeriod()
const;
264 tm validityWithGracePeriodUtc()
const;
267 const Customer& getLicenseOwner()
const;
271 bool hasLicenseFeatures()
const;
273 const LicenseFeature& getLicenseFeature(
const std::string& featureCode )
const;
275 const std::vector<LicenseFeature>& getLicenseFeatures()
const;
277 bool hasLicenseCustomFields()
const;
279 const std::vector<CustomField>& getLicenseCustomFields()
const;
282 uint32_t getLicenseTimesActivated()
const;
284 uint32_t getLicenseMaxActivations()
const;
286 uint32_t getLicenseTransferCount()
const;
289 uint32_t getLicensePolicyId()
const;
293 int32_t getLicenseTotalConsumption()
const;
295 int32_t getLicenseMaxConsumption()
const;
297 int32_t getLicenseMaxOverages()
const;
298 bool isResetLicenseConsumptionEnabled()
const;
303 uint32_t getLicenseFloatingTimeout()
const;
305 uint32_t getLicenseFloatingInUseCount()
const;
307 uint32_t getLicenseMaxFloatingUsers()
const;
309 uint32_t getMaxBorrowTime()
const;
313 void enableExceptions(
bool enable );
314 bool isExceptionsEnabled()
const;
315 bool wasError()
const;
317 const std::string& getLastErrorMsg()
const;
318 bool isInitializationError()
const;
319 bool isInternalServerError()
const;
320 bool isNetworkTimeoutError()
const;
321 bool isNoInternetError()
const;
322 bool isActivationFailed()
const;
323 bool isLicenseExpiredError()
const;
324 bool isLicenseNotFoundError()
const;
325 bool isLicenseStateError()
const;
326 bool isHardwareIDError()
const;
327 bool isGeneralError()
const;
328 bool isLicenseFeatureError()
const;
329 bool canIgnoreError()
const;
333 LicenseHandlerImpl* m_impl;
338 #endif // LS_LICENSE_HANDLER_H LSErrorCode
LicenseSpring Error codes enum.
std::shared_ptr< Configuration > ptr_t
std::shared_ptr< LicenseStorage > ptr_t
Class for storing key-value device variable.
Class used for encapsulating LSConsumptionPeriod and converting cosumption period to/from string...
Class for storing key-value data field.
Class used for encapsulating the type of license, comparing types of licenses, and converting them to...
Class that encapsulates information about a customer.
Class that encapsulates information about license feature.
std::function< void(const LicenseSpringException &ex)> LicenseWatchdogCallback
Callback function which being called in case of error in background thread (watchdog thread)...
std::shared_ptr< LicenseUser > ptr_t
DeviceIDAlgorithm
Type of Device ID algorithm used by the SDK.
std::shared_ptr< ProductDetails > ptr_t
std::shared_ptr< Customer > ptr_t
#define LS_API
Macros that expands to dllexport, dllimport or nothing on non Windows platforms or in case of static ...
Class that represents License identifier.
This class encapsulates functionality of the both LicenseManager and the License. ...
std::shared_ptr< InstallationFile > ptr_t
Helper struct for filtering installation files by environment and channel.