oddeleni a lazeni ELC1
This commit is contained in:
@@ -60,7 +60,7 @@ LicenceReader::LicenceReader()
|
||||
// this->licIdentification.licCompatibility = compatibility;
|
||||
// }
|
||||
|
||||
/// @brief inicializace generátoru a načtení licenčních bodů
|
||||
/// @brief inicializace generátoru a načtení licenčních bodů do obecné struktury
|
||||
/// @param elcType
|
||||
/// @param licenceType
|
||||
/// @param licenceVersion
|
||||
@@ -72,18 +72,28 @@ bool LicenceReader::initread(int elcType, InitStructure &initStructure) // TOTO
|
||||
try
|
||||
{
|
||||
elcSwitchType = elcType * 10 + licCompatibility;
|
||||
|
||||
|
||||
if (init(elcType, initStructure))
|
||||
{
|
||||
switch (elcSwitchType)
|
||||
{
|
||||
case 11:
|
||||
{ // old eoseov
|
||||
LicenceELC11 licence = LicenceELC11(this->licIdentification);
|
||||
this->licence11 = &licence;
|
||||
licence.cid_cdsPath = initStructure.cid_csd_filePath;
|
||||
licence.licenceFilePath = initStructure.licenceFilePath;
|
||||
this->licence11->readLicence(&this->licenceInfo);
|
||||
Reader::Licence1 licenceELC1 = Reader::Licence1(this->licIdentification);
|
||||
this->licence1 = &licenceELC1;
|
||||
licenceELC1.cid_cdsPath = initStructure.cid_csd_filePath;
|
||||
licenceELC1.licenceFilePath = initStructure.licenceFilePath;
|
||||
|
||||
try
|
||||
{
|
||||
this->licence1->readLicence(&this->licenceInfo);
|
||||
}
|
||||
catch (const LicenceException &ex)
|
||||
{
|
||||
error.code = ex.getErrorCode();
|
||||
error.message = ex.getErrorMessage();
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 21:
|
||||
@@ -93,12 +103,11 @@ bool LicenceReader::initread(int elcType, InitStructure &initStructure) // TOTO
|
||||
licenceELC2.cid_cdsPath = initStructure.cid_csd_filePath;
|
||||
licenceELC2.licenceFilePath = initStructure.licenceFilePath;
|
||||
this->licence2->readLicence(&this->licenceInfo);
|
||||
|
||||
break;
|
||||
}
|
||||
case 31:
|
||||
{
|
||||
LicenceELC31 licence = LicenceELC31(this->licIdentification);
|
||||
// LicenceELC31 licence = LicenceELC31(this->licIdentification);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -142,9 +151,13 @@ bool LicenceReader::init(int elcType, InitStructure &initStructure)
|
||||
|
||||
elcSwitchType = elcType * 10 + licCompatibility;
|
||||
|
||||
return true; // TODO testy
|
||||
return true;
|
||||
}
|
||||
|
||||
/// @brief vrací informace o licenčím bodu na základě id protocolu a předané návratové struktury
|
||||
/// @param protocolId
|
||||
/// @param returnItemStructure
|
||||
/// @return
|
||||
bool LicenceReader::getLicenceItemInfo(int protocolId, void *returnItemStructure)
|
||||
{
|
||||
try
|
||||
@@ -152,18 +165,14 @@ bool LicenceReader::getLicenceItemInfo(int protocolId, void *returnItemStructure
|
||||
switch (elcSwitchType)
|
||||
{
|
||||
case 11:
|
||||
{ // old eoseov
|
||||
LicenceItem11 *resultPtr = static_cast<LicenceItem11 *>(returnItemStructure);
|
||||
resultPtr->protocolId = protocolId;
|
||||
if (this->licenceInfo.licences.count(protocolId))
|
||||
resultPtr->dataPointsCount = this->licenceInfo.licences.at(protocolId);
|
||||
else
|
||||
resultPtr->dataPointsCount = 0;
|
||||
{
|
||||
LicenceInfo1 *resultPtr = static_cast<LicenceInfo1 *>(returnItemStructure);
|
||||
if (this->licenceInfo.licences.count(1)) resultPtr->isValid = true; //stare eov melo natvrdo "id" 1.
|
||||
else resultPtr->isValid = false;
|
||||
break;
|
||||
}
|
||||
case 21:
|
||||
{
|
||||
|
||||
LicenceItem21 *resultPtr = static_cast<LicenceItem21 *>(returnItemStructure);
|
||||
resultPtr->protocolId = protocolId; // protocolId;
|
||||
if (this->licenceInfo.licences.count(protocolId))
|
||||
@@ -174,7 +183,7 @@ bool LicenceReader::getLicenceItemInfo(int protocolId, void *returnItemStructure
|
||||
}
|
||||
case 31:
|
||||
{
|
||||
LicenceELC31 licence = LicenceELC31(this->licIdentification);
|
||||
// LicenceELC31 licence = LicenceELC31(this->licIdentification);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -195,66 +204,83 @@ bool LicenceReader::getLicenceItemInfo(int protocolId, void *returnItemStructure
|
||||
return true;
|
||||
}
|
||||
|
||||
/// @brief vrací informace o všech licenčních bodech základě předané návratové struktury
|
||||
/// @param returnStructure
|
||||
/// @return
|
||||
bool LicenceReader::getLicenceInfo(void *returnStructure)
|
||||
{
|
||||
// const type_info& ti1 = typeid(returnStructure);
|
||||
// cout << "TTTYP: " << ti1.name() << endl;
|
||||
switch (elcSwitchType)
|
||||
try
|
||||
{
|
||||
case 11:
|
||||
{ // old eoseov
|
||||
break;
|
||||
}
|
||||
case 21:
|
||||
{
|
||||
try
|
||||
switch (elcSwitchType)
|
||||
{
|
||||
case 11:
|
||||
{ // old eoseov
|
||||
|
||||
LicenceInfo1 *resultPtr = static_cast<LicenceInfo1 *>(returnStructure);
|
||||
|
||||
if (this->licenceInfo.licences.count(1))
|
||||
{
|
||||
resultPtr->isValid = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
resultPtr->isValid = false;
|
||||
}
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
case 21:
|
||||
{
|
||||
|
||||
Reader::Licence2 licenceELC2 = Reader::Licence2(this->licIdentification);
|
||||
licenceELC2.readLicence(&this->licenceInfo);
|
||||
return licenceELC2.getLicenceInfo(returnStructure);
|
||||
|
||||
// catch (const LicenceException &ex)
|
||||
// {
|
||||
// error.code = ex.getErrorCode();
|
||||
// error.message = ex.getErrorMessage();
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// LicenceELC21 licence = LicenceELC21(this->licIdentification);
|
||||
// try
|
||||
// {
|
||||
// licence.readLicence(&this->licenceInfo);
|
||||
// return licence.getLicenceInfo(returnStructure);
|
||||
// }
|
||||
// catch (const LicenceException &ex)
|
||||
// {
|
||||
// error.code = ex.getErrorCode();
|
||||
// error.message = ex.getErrorMessage();
|
||||
// return false;
|
||||
// }
|
||||
break;
|
||||
}
|
||||
catch (const LicenceException &ex)
|
||||
case 31:
|
||||
{
|
||||
error.code = ex.getErrorCode();
|
||||
error.message = ex.getErrorMessage();
|
||||
return false;
|
||||
// LicenceELC31 licence = LicenceELC31(this->licIdentification);
|
||||
// try
|
||||
// {
|
||||
// licence.readLicence();
|
||||
// return licence.getLicenceInfo(returnStructure);
|
||||
// }
|
||||
// catch (const LicenceException &ex)
|
||||
// {
|
||||
// error.code = ex.getErrorCode();
|
||||
// error.message = ex.getErrorMessage();
|
||||
// return false;
|
||||
// }
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// LicenceELC21 licence = LicenceELC21(this->licIdentification);
|
||||
// try
|
||||
// {
|
||||
// licence.readLicence(&this->licenceInfo);
|
||||
// return licence.getLicenceInfo(returnStructure);
|
||||
// }
|
||||
// catch (const LicenceException &ex)
|
||||
// {
|
||||
// error.code = ex.getErrorCode();
|
||||
// error.message = ex.getErrorMessage();
|
||||
// return false;
|
||||
// }
|
||||
break;
|
||||
}
|
||||
case 31:
|
||||
catch (const LicenceException &ex)
|
||||
{
|
||||
LicenceELC31 licence = LicenceELC31(this->licIdentification);
|
||||
// try
|
||||
// {
|
||||
// licence.readLicence();
|
||||
// return licence.getLicenceInfo(returnStructure);
|
||||
// }
|
||||
// catch (const LicenceException &ex)
|
||||
// {
|
||||
// error.code = ex.getErrorCode();
|
||||
// error.message = ex.getErrorMessage();
|
||||
// return false;
|
||||
// }
|
||||
break;
|
||||
error.code = ex.getErrorCode();
|
||||
error.message = ex.getErrorMessage();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
error.code = -1;
|
||||
error.message = "Nepodařilo se identifikovat licenci";
|
||||
return false;
|
||||
}
|
||||
|
||||
LicenceReader::~LicenceReader()
|
||||
|
||||
Reference in New Issue
Block a user