You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

94 lines
3.2 KiB

1 year ago
  1. #pragma once
  2. #include "IObject.h"
  3. #include <fsdk/FSDKError.h>
  4. namespace fsdk {
  5. #ifndef DOXYGEN_SHOULD_SKIP_THIS
  6. DECLARE_SMARTPTR(ILicense);
  7. #endif
  8. /**
  9. * @brief License features.
  10. */
  11. enum class LicenseFeature : uint32_t {
  12. Detection = 1,
  13. BestShot = 2,
  14. Attributes = 3,
  15. Emotions = 4,
  16. FaceFeatures = 5,
  17. Liveness = 6,
  18. Descriptor = 7,
  19. DescriptorIndex = 8,
  20. LivenessEngine = 9,
  21. TrackEngine = 10,
  22. HumanDetection = 11,
  23. PPEDetection = 17,
  24. MobileLiveness = 18,
  25. MedicalMaskDetection = 19,
  26. ReIdDescriptor = 20,
  27. ISOCheck = 21
  28. };
  29. /**
  30. * @brief License objects interface.
  31. * @note Use License objects to adopt FaceEngine functionality.
  32. * */
  33. struct ILicense : IRefCounted {
  34. /**
  35. * @brief Checks if the feature with featureId is available in this license.
  36. * @param [in] feature LicenseFeature type.
  37. * @return ResultValue with error code and true if feature is available, false if there is no such feature in this
  38. * license or feature is expired or license was not activated.
  39. * @see LicenseFeature, ResultValue and FSDKError for details.
  40. */
  41. virtual ResultValue<FSDKError, bool> checkFeatureId(LicenseFeature feature) const noexcept = 0;
  42. /**
  43. * @brief Checks if current license object is activated and could be used by FaceEngine.
  44. * @return ResultValue with error code and true if object is activated.
  45. * @see ResultValue and FSDKError for details.
  46. * @note License object which was not activated could not be used because all features are disabled by default.
  47. */
  48. virtual ResultValue<FSDKError, bool> isActivated() const noexcept = 0;
  49. /**
  50. * @brief Loads license from file.
  51. * @param [in] path path to the file.
  52. * @return Result with error code.
  53. * @see Result and FSDKError for details.
  54. */
  55. virtual Result<FSDKError>
  56. FSDK_DEPRECATED("loadFromFile is deprecated since v.5.5.0,"
  57. " Use loadFromFile(const char* path, const ISettingsProvider* settings) instead")
  58. loadFromFile(const char* path) noexcept = 0;
  59. /**
  60. * @brief Loads license from file.
  61. * @param [in] path path to the file.
  62. * @param [in] settings License settings provider.
  63. * @return Result with error code.
  64. * @see ISettingsProvider, Result and FSDKError for details.
  65. */
  66. virtual Result<FSDKError> loadFromFile(const char* path, const ISettingsProvider* settings) noexcept = 0;
  67. /**
  68. * @brief Saves license as raw format to the file. This file could be used in the next run of the application.
  69. * @param [in] path path to the file.
  70. * @return Result with error code.
  71. * @see Result and FSDKError for details.
  72. */
  73. virtual Result<FSDKError> saveToFile(const char * path) const noexcept = 0;
  74. /**
  75. * @brief Gets license expiration date.
  76. * @param [in] feature LicenseFeature type.
  77. * @return ResultValue with error code and uint32_t Unix Timestamp.
  78. * @see LicenseFeature, ResultValue and FSDKError for details.
  79. * @note License settings should be set before using this method!
  80. * @note License should be activated before calling this method!
  81. */
  82. virtual ResultValue<FSDKError, uint32_t> getExpirationDate(LicenseFeature feature) const noexcept = 0;
  83. };
  84. }