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();
125 void registerFloatingFeature(
const std::string& featureCode,
bool addToWatchdog =
true );
127 void releaseFloatingFeature(
const std::string& featureCode );
132 bool isInitialized()
const;
133 bool isLicenseExists()
const;
135 void updateConsumption( int32_t value = 1,
bool saveLicense =
true );
137 void updateFeatureConsumption(
const std::string& featureCode, int32_t value = 1,
bool saveLicense =
true );
139 void checkLicenseLocal();
141 void clearLocalStorage();
144 void addUserData(
const CustomField& data,
bool saveLicense =
true );
146 void removeUserData(
const std::string& key = std::string(),
bool saveLicense =
true );
148 const std::vector<CustomField>& userData();
150 std::string userData(
const std::string& key );
153 bool isAutoReleaseSet()
const;
155 void setAutoRelease(
bool autoRelease );
159 void resumeLicenseWatchdog();
161 void stopLicenseWatchdog();
165 void resumeFeatureWatchdog();
167 void stopFeatureWatchdog();
170 void addDeviceVariable(
const std::string& name,
const std::string& value,
bool saveLicense =
true );
172 void addDeviceVariable(
const DeviceVariable& variable,
bool saveLicense =
true );
174 void addDeviceVariables(
const std::vector<DeviceVariable>& variables );
178 const std::string& deviceVariableValue(
const std::string& name )
const;
183 const std::wstring& createOfflineActivationFile(
const LicenseID& licenseID,
184 const std::wstring& activationRequestFile = std::wstring() );
186 void activateLicenseOffline(
const std::wstring& activationResponseFile = std::wstring() );
188 const std::wstring& deactivateLicenseOffline(
const std::wstring& deactivationRequestFile = std::wstring() );
190 bool updateOffline(
const std::wstring& path = std::wstring(),
bool resetConsumption =
false );
195 bool isLicenseValid()
const;
197 bool isLicenseTrial()
const;
199 bool isLicenseAirGapped()
const;
201 bool isLicenseActive()
const;
203 bool isLicenseEnabled()
const;
205 bool isLicenseExpired()
const;
207 bool isLicenseMaintenanceExpired()
const;
209 bool isLicenseOfflineActivated()
const;
211 bool isLicenseFloating()
const;
213 bool isLicenseBorrowed()
const;
215 bool isLicenseOveragesAllowed()
const;
217 bool isLicenseUnlimitedConsumptionAllowed()
const;
219 bool isLicenseVMAllowed()
const;
221 bool isSubscriptionGracePeriodStarted()
const;
223 bool isGracePeriodStarted()
const;
225 tm gracePeriodEndDateTime()
const;
227 tm gracePeriodEndDateTimeUTC()
const;
229 int gracePeriodHoursRemaining()
const;
231 uint32_t getLicenseTrialPeriod()
const;
236 const std::string& getLicenseKey()
const;
238 const std::string& getLicenseUser()
const;
240 const std::string& getLicenseStatusStr()
const;
242 const std::string& getLicenseStartDate()
const;
244 const std::string& getLicenseMetadata()
const;
250 tm getLicenseExpiryDate()
const;
252 tm getLicenseExpiryDateUtc()
const;
254 tm getLicenseMaintenancePeriod()
const;
256 tm getLicenseMaintenancePeriodUtc()
const;
258 tm getLicenseLastCheckDate()
const;
260 tm getLicenseLastCheckDateUtc()
const;
262 tm getLicenseFloatingEndDateTime()
const;
264 tm getLicenseFloatingEndDateTimeUtc()
const;
266 int getDaysRemaining()
const;
268 int getMaintenanceDaysRemaining()
const;
270 int getDaysPassedSinceLastCheck()
const;
273 uint32_t getSubscriptionLicenseGracePeriod()
const;
275 tm validityWithGracePeriod()
const;
277 tm validityWithGracePeriodUtc()
const;
280 const Customer& getLicenseOwner()
const;
284 bool hasLicenseFeatures()
const;
286 const LicenseFeature& getLicenseFeature(
const std::string& featureCode )
const;
288 const std::vector<LicenseFeature>& getLicenseFeatures()
const;
290 bool hasLicenseCustomFields()
const;
292 const std::vector<CustomField>& getLicenseCustomFields()
const;
295 uint32_t getLicenseTimesActivated()
const;
297 uint32_t getLicenseMaxActivations()
const;
299 uint32_t getLicenseTransferCount()
const;
301 int32_t getLicenseTransferLimit()
const;
303 bool isDeviceTransferAllowed()
const;
305 bool isDeviceTransferLimited()
const;
308 uint32_t getLicensePolicyId()
const;
312 int32_t getLicenseTotalConsumption()
const;
314 int32_t getLicenseMaxConsumption()
const;
316 int32_t getLicenseMaxOverages()
const;
317 bool isResetLicenseConsumptionEnabled()
const;
322 uint32_t getLicenseFloatingTimeout()
const;
324 uint32_t getLicenseFloatingInUseCount()
const;
326 uint32_t getLicenseMaxFloatingUsers()
const;
328 uint32_t getMaxBorrowTime()
const;
332 void enableExceptions(
bool enable );
333 bool isExceptionsEnabled()
const;
334 bool wasError()
const;
336 const std::string& getLastErrorMsg()
const;
337 bool isInitializationError()
const;
338 bool isInternalServerError()
const;
339 bool isNetworkTimeoutError()
const;
340 bool isNoInternetError()
const;
341 bool isActivationFailed()
const;
342 bool isLicenseExpiredError()
const;
343 bool isLicenseNotFoundError()
const;
344 bool isLicenseStateError()
const;
345 bool isHardwareIDError()
const;
346 bool isGeneralError()
const;
347 bool isLicenseFeatureError()
const;
348 bool canIgnoreError()
const;
352 LicenseHandlerImpl* m_impl;
357 #endif // LS_LICENSE_HANDLER_H