12#include "../_cexports/c_utilities.h"
13#include "../_cexports/c_core.h"
15#include "../exception.hpp"
16#include "../string.hpp"
33 class LicenseInfo final
59 LicenseInfo(
int serialNumber,
bool isFoundation) noexcept
60 : serialNumber_(serialNumber)
61 , isFoundation_(isFoundation)
65 int serialNumber_ = 0;
66 bool isFoundation_ =
false;
33 class LicenseInfo final {
…};
72 class MagicNumberEntry final
116 return serialNumber_;
121 int serialNumber) noexcept
122 : provider_(provider)
124 , magicNumber_(magicNumber)
125 , serialNumber_(serialNumber)
132 int serialNumber_ = 0;
72 class MagicNumberEntry final {
…};
143 CExports::cvbres_t code = 0;
145 auto res = CVB_CALL_CAPI(CVCGetLastErrorW(code,
nullptr, messageSize));
149 message.resize(messageSize);
150 res = CVB_CALL_CAPI(CVCGetLastErrorW(code, &message[0], messageSize));
153 errorCode =
static_cast<int>(code);
155 return Internal::WideCharStrToUTF8(message);
158 errorCode =
static_cast<int>(res);
188 return CvbException::FromCvbResult(errorCode, message);
191 inline void ThrowLastError(
int errorCode)
200 inline void ThrowLastError()
207 CExports::cvbval_t defaultTimeout = 0;
208 if (!CExports::GetDefaultTimeout(defaultTimeout))
224 if (!CExports::TranslateFileNameTyped(path.c_str(), &buffer[0], CExports::CVB_MAX_PATH))
226 return String(&buffer[0]);
237 if (!CExports::GetCVBDirectoryTyped(&buffer[0], buffer.size()))
243 if (path.back() != CVB_LIT(
'/'))
244 path += CVB_LIT(
'/');
257 if (!CExports::GetCVBDataDirectoryTyped(&buffer[0], buffer.size()))
260 return String(&buffer[0]);
279 if (resultUpdate < 0)
282 auto licCount =
static_cast<int>(CExports::GetLicenseCount());
286 for (
int i = 0; i < licCount; ++i)
288 CExports::cvblicres_t serialNumber = 0;
289 CExports::cvbbool_t isFoundation =
false;
292 CVB_CALL_CAPI(
GetLicenseInfoEx(
static_cast<CExports::cvbval_t
>(i), serialNumber, isFoundation));
294 ThrowLastError(resultInfo);
296 licenseList.push_back(LicenseInfo(
static_cast<int>(serialNumber), (isFoundation) ?
true :
false));
313 template <
class Rep,
class Period>
321 if (result >= 0 && CExports::GetLicenseCount() > 0)
328 if (end - start > timeSpan)
351 if (resultUpdate < 0)
352 ThrowLastError(resultUpdate);
354 auto magicNumberCount =
static_cast<int>(CExports::GetMagicNumberCount());
358 for (
int i = 0; i < magicNumberCount; ++i)
363 CExports::cvblicres_t serialNumber = 0;
365 toolIDSize,
nullptr, magicNumberSize, serialNumber));
366 if (resultMnSize >= 0)
373 toolIDSize, &magicNumber[0], magicNumberSize, serialNumber));
378 MagicNumberEntry(
String(provider.begin(), provider.end()),
String(toolID.begin(), toolID.end()),
379 String(magicNumber.begin(), magicNumber.end()),
static_cast<int>(serialNumber)));
393 using SystemInfo::LicenseInfo;
394 using SystemInfo::MagicNumberEntry;
404 using Utilities::LicenseInfo;
405 using Utilities::MagicNumberEntry;
Information about CVB licenses.
Definition system_info.hpp:34
int SerialNumber() const noexcept
The 32 bit CVB serial number of this license.
Definition system_info.hpp:43
bool IsFoundation() const noexcept
Check if the license includes the Common Vision Blox Foundation package.
Definition system_info.hpp:53
friend std::vector< LicenseInfo > GetLicenseInfo()
Get information about available licenses.
Definition system_info.hpp:276
A single Magic Number entry.
Definition system_info.hpp:73
String MagicNumber() const noexcept
The Magic Number which is tool-specific and at the same time specific to the Common Vision Blox Seria...
Definition system_info.hpp:103
String ToolID() const noexcept
The tool ID of the Magic Number entry.
Definition system_info.hpp:92
String Provider() const noexcept
The friendly (= human-readable) name of the license provider, that reported this Magic Number entry.
Definition system_info.hpp:82
int SerialNumber() const noexcept
The serial number assigned to this Magic Number entry (0 if it has no inherent link to a serial numbe...
Definition system_info.hpp:114
friend std::vector< MagicNumberEntry > GetMagicNumberEntries()
Query the set of currently available Magic Numbers.
Definition system_info.hpp:348
cvbres_t GetLicenseInfoEx(cvbval_t Index, cvblicres_t &SerialNumber, cvbbool_t &IsFoundation)
cvbres_t GetMagicNumber(size_t Index, char *ProviderName, size_t &ProviderNameBufferSize, char *ToolID, size_t &ToolIDBufferSize, char *MagicNumber, size_t &MagicNumberBufferSize, cvblicres_t &SerialNumber)
cvbres_t UpdateLicenses()
cvbres_t UpdateLicensesDeep()
const int CVB_ERROR
Generic unspecified error.
Definition exception.hpp:23
Namespace for helper functions related to system or CVB installation information.
Definition version.hpp:19
String ExpandPath(const String &path)
Expands a path containing an environment variable.
Definition system_info.hpp:221
String DataPath()
Directory where Common Vision Blox stores its settings.
Definition system_info.hpp:254
std::string GetLastErrorMessage()
Returns the last error message.
Definition system_info.hpp:167
WaitStatus WaitForLicense(const std::chrono::duration< Rep, Period > &timeSpan) noexcept
Wait for a given time for the license to become available.
Definition system_info.hpp:314
std::vector< MagicNumberEntry > GetMagicNumberEntries()
Query the set of currently available Magic Numbers.
Definition system_info.hpp:348
std::exception_ptr GetLastError() noexcept
Returns a pointer that points at the exception.
Definition system_info.hpp:181
String InstallPath()
Directory Common Vision Blox has been installed to.
Definition system_info.hpp:234
std::vector< LicenseInfo > GetLicenseInfo()
Get information about available licenses.
Definition system_info.hpp:276
Namespace for helpers and utilities, which are not directly related to image processing.
Definition version.hpp:16
String ExpandPath(const String &path)
Expands a path containing an environment variable.
Definition system_info.hpp:221
String DataPath()
Directory where Common Vision Blox stores its settings.
Definition system_info.hpp:254
WaitStatus WaitForLicense(const std::chrono::duration< Rep, Period > &timeSpan) noexcept
Wait for a given time for the license to become available.
Definition system_info.hpp:314
std::vector< MagicNumberEntry > GetMagicNumberEntries()
Query the set of currently available Magic Numbers.
Definition system_info.hpp:348
String InstallPath()
Directory Common Vision Blox has been installed to.
Definition system_info.hpp:234
std::vector< LicenseInfo > GetLicenseInfo()
Get information about available licenses.
Definition system_info.hpp:276
Root namespace for the Image Manager interface.
Definition c_barcode.h:15
std::string String
String for wide characters or unicode characters.
Definition string.hpp:49
WaitStatus
Status after waiting for an image to be returned.
Definition global.hpp:375
@ Ok
Everything is fine, a new image arrived.
Definition global.hpp:377
@ Timeout
A timeout occurred, no image buffer has been returned.
Definition global.hpp:379
T rethrow_exception(T... args)