1 #ifndef LS_LICENSE_HANDLER_H
2 #define LS_LICENSE_HANDLER_H
17 class LicenseHandlerImpl;
54 const std::wstring& dataLocation()
const;
56 void setDataLocation(
const std::wstring& path );
58 const std::wstring& licenseFileName()
const;
60 void setLicenseFileName(
const std::wstring& name );
62 const std::wstring& licenseFilePath()
const;
67 bool isOnline()
const;
72 const std::string& licensePolicy = std::string() )
const;
74 const LicenseID& getTrialLicense(
const std::string& userEmail )
const;
76 const std::string& getSSOUrl(
const std::string& accountCode = std::string(),
bool useAuthCode =
true );
78 const std::string& getAirGapActivationCode(
const std::string& initializationCode,
const std::string& licenseKey );
80 const std::string& getAirGapDeactivationCode(
const std::string& initializationCode );
82 void activateAirGapLicense(
const std::string& confirmationCode,
const std::wstring& activationResponseFile,
const std::string& licenseKey, uint32_t policyId );
84 void deactivateAirGapLicense(
const std::string& confirmationCode );
86 std::vector<LicenseUser::ptr_t> getLicenseUsers(
const Customer& customer );
88 std::vector<LicenseUser::ptr_t> getLicenseUsers(
const std::string& customerEmail );
90 std::vector<UserLicensesData::ptr_t> getUserLicenses(
const std::string& username,
const std::string& password );
92 void activateLicense(
const LicenseID& licenseID );
94 void activateLicense(
const LicenseID& licenseID,
const std::vector<DeviceVariable>& deviceVariables );
96 void activateLicense(
const std::string& authData,
const std::string& accountCode = std::string(),
bool useAuthCode =
true );
98 bool deactivateLicense();
100 bool changePassword(
const std::string& password,
const std::string& newPassword,
101 const std::string& user = std::string() );
103 void relinkLicense(
DeviceIDAlgorithm deviceIdAlgorithm,
const std::string& userPassword = std::string() );
107 const std::vector<std::string>& getVersionList(
const LicenseID& licenseID =
LicenseID(),
111 const std::string& version = std::string(),
114 void sendDeviceVariables();
116 std::vector<DeviceVariable> getDeviceVariables(
bool getFromBackend =
false );
118 void syncConsumption( int32_t requestOverage = -1 );
120 void syncFeatureConsumption(
const std::string& featureCode = std::string() );
122 void registerFloatingLicense();
124 void borrowFloatingLicense( uint32_t hours, uint32_t days = 0 );
126 void borrowFloatingLicense(
const std::string& borrowEndDateTime = std::string() );
128 void releaseFloatingLicense();
130 void registerFloatingFeature(
const std::string& featureCode,
bool addToWatchdog =
true );
132 void releaseFloatingFeature(
const std::string& featureCode );
137 bool isInitialized()
const;
138 bool isLicenseExists()
const;
140 void updateConsumption( int32_t value = 1,
bool saveLicense =
true );
142 void updateFeatureConsumption(
const std::string& featureCode, int32_t value = 1,
bool saveLicense =
true );
144 void checkLicenseLocal(
bool verifySignature =
false );
146 void clearLocalStorage();
148 bool isLicenseFileCorrupted();
151 void addUserData(
const CustomField& data,
bool saveLicense =
true );
153 void removeUserData(
const std::string& key = std::string(),
bool saveLicense =
true );
155 const std::vector<CustomField>& userData();
157 std::string userData(
const std::string& key );
160 bool isAutoReleaseSet()
const;
162 void setAutoRelease(
bool autoRelease );
166 void resumeLicenseWatchdog();
168 void stopLicenseWatchdog();
172 void resumeFeatureWatchdog();
174 void stopFeatureWatchdog();
177 void addDeviceVariable(
const std::string& name,
const std::string& value,
bool saveLicense =
true );
179 void addDeviceVariable(
const DeviceVariable& variable,
bool saveLicense =
true );
181 void addDeviceVariables(
const std::vector<DeviceVariable>& variables );
185 const std::string& deviceVariableValue(
const std::string& name )
const;
190 const std::wstring& createOfflineActivationFile(
const LicenseID& licenseID,
191 const std::wstring& activationRequestFile = std::wstring() );
193 const std::wstring& createOfflineActivationFile(
const LicenseID& licenseID,
194 const std::vector<DeviceVariable>& deviceVariables,
195 const std::wstring& activationRequestFile = std::wstring() );
197 void activateLicenseOffline(
const std::wstring& activationResponseFile = std::wstring() );
199 const std::wstring& deactivateLicenseOffline(
const std::wstring& deactivationRequestFile = std::wstring() );
201 bool updateOffline(
const std::wstring& path = std::wstring(),
bool resetConsumption =
false );
206 bool isLicenseValid()
const;
208 bool isLicenseTrial()
const;
210 bool isLicenseAirGapped()
const;
212 bool isLicenseActive()
const;
214 bool isLicenseEnabled()
const;
216 bool isLicenseExpired()
const;
218 bool isLicenseMaintenanceExpired()
const;
220 bool isLicenseOfflineActivated()
const;
222 bool isLicenseFloating()
const;
224 bool isLicenseBorrowed()
const;
226 bool isLicenseOveragesAllowed()
const;
228 bool isLicenseUnlimitedConsumptionAllowed()
const;
230 bool isLicenseNegativeConsumptionAllowed()
const;
232 bool isLicenseVMAllowed()
const;
234 bool isSubscriptionGracePeriodStarted()
const;
236 bool isGracePeriodStarted()
const;
238 tm gracePeriodEndDateTime()
const;
240 tm gracePeriodEndDateTimeUTC()
const;
242 int gracePeriodHoursRemaining()
const;
244 uint32_t getLicenseTrialPeriod()
const;
249 const std::string& getLicenseKey()
const;
251 const std::string& getLicenseUser()
const;
254 const uint64_t getLicenseServerId()
const;
256 const std::string& getLicenseStatusStr()
const;
258 const std::string& getLicenseStartDate()
const;
260 const std::string& getLicenseMetadata()
const;
262 const std::string& getOrderStoreId()
const;
268 tm getLicenseExpiryDate()
const;
270 tm getLicenseExpiryDateUtc()
const;
272 tm getLicenseMaintenancePeriod()
const;
274 tm getLicenseMaintenancePeriodUtc()
const;
276 tm getLicenseLastCheckDate()
const;
278 tm getLicenseLastCheckDateUtc()
const;
280 tm getLicenseFloatingEndDateTime()
const;
282 tm getLicenseFloatingEndDateTimeUtc()
const;
284 int getDaysRemaining()
const;
286 int getMaintenanceDaysRemaining()
const;
288 int getDaysPassedSinceLastCheck()
const;
291 uint32_t getSubscriptionLicenseGracePeriod()
const;
293 tm validityWithGracePeriod()
const;
295 tm validityWithGracePeriodUtc()
const;
298 const Customer& getLicenseOwner()
const;
302 bool hasLicenseFeatures()
const;
304 const LicenseFeature& getLicenseFeature(
const std::string& featureCode )
const;
306 const std::vector<LicenseFeature>& getLicenseFeatures()
const;
308 bool hasLicenseCustomFields()
const;
310 const std::vector<CustomField>& getLicenseCustomFields()
const;
313 uint32_t getLicenseTimesActivated()
const;
315 uint32_t getLicenseMaxActivations()
const;
317 uint32_t getLicenseTransferCount()
const;
319 int32_t getLicenseTransferLimit()
const;
321 bool isDeviceTransferAllowed()
const;
323 bool isDeviceTransferLimited()
const;
326 uint32_t getLicensePolicyId()
const;
330 int32_t getLicenseTotalConsumption()
const;
332 int32_t getLicenseMaxConsumption()
const;
334 int32_t getLicenseMaxOverages()
const;
335 bool isResetLicenseConsumptionEnabled()
const;
340 uint32_t getLicenseFloatingTimeout()
const;
342 uint32_t getLicenseFloatingInUseCount()
const;
344 uint32_t getLicenseMaxFloatingUsers()
const;
346 uint32_t getMaxBorrowTime()
const;
350 void enableExceptions(
bool enable );
351 bool isExceptionsEnabled()
const;
352 bool wasError()
const;
354 const std::string& getLastErrorMsg()
const;
355 bool isInitializationError()
const;
356 bool isInternalServerError()
const;
357 bool isNetworkTimeoutError()
const;
358 bool isNoInternetError()
const;
359 bool isActivationFailed()
const;
360 bool isLicenseExpiredError()
const;
361 bool isLicenseNotFoundError()
const;
362 bool isLicenseStateError()
const;
363 bool isHardwareIDError()
const;
364 bool isGeneralError()
const;
365 bool isLicenseFeatureError()
const;
366 bool canIgnoreError()
const;
370 LicenseHandlerImpl* m_impl;
375 #endif // LS_LICENSE_HANDLER_H