Oddělení informace o licenci
This commit is contained in:
@@ -24,13 +24,12 @@ const string cidFilePath = "";
|
|||||||
|
|
||||||
struct SDCardInfo
|
struct SDCardInfo
|
||||||
{
|
{
|
||||||
uint32_t cardSize {};
|
uint32_t cardSize{};
|
||||||
uint32_t serialNumber {};
|
uint32_t serialNumber{};
|
||||||
string date = "";
|
string date = "";
|
||||||
string oemID = "";
|
string oemID = "";
|
||||||
string name = "";
|
string name = "";
|
||||||
string licenceFileName = "";
|
bool isLoaded = false;
|
||||||
bool isLoaded = false;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class SDCard
|
class SDCard
|
||||||
@@ -59,25 +58,22 @@ class SDCard
|
|||||||
bool crcCorrect = false;
|
bool crcCorrect = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool readSDCard();
|
bool readSDCard();
|
||||||
bool getCIDFromFile();
|
bool getCIDFromFile();
|
||||||
bool getCSDFromFile();
|
bool getCSDFromFile();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
SDCardData cardData;
|
SDCardData cardData;
|
||||||
bool isLoaded = false;
|
bool isLoaded = false;
|
||||||
char cid[32] = {};
|
char cid[32] = {};
|
||||||
char csd[32] = {};
|
char csd[32] = {};
|
||||||
string filePath = "";
|
string filePath = "";
|
||||||
string cidString = ""; //pro předání pro starý generátor
|
string cidString = ""; // pro předání pro starý generátor
|
||||||
string csdString = ""; //pro předání pro starý generátor
|
string csdString = ""; // pro předání pro starý generátor
|
||||||
|
|
||||||
SDCard();
|
SDCard();
|
||||||
SDCard(string cid, string csd);
|
SDCard(string cid, string csd);
|
||||||
SDCard(const string filesPath);
|
SDCard(const string filesPath);
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public:
|
|||||||
|
|
||||||
void createLicenceFile();
|
void createLicenceFile();
|
||||||
|
|
||||||
LicenceInfoGeneral licenceInfo {};
|
LicenceInfoGeneral licenceInfoGeneral {};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LicenceIdentification licIdentification;
|
LicenceIdentification licIdentification;
|
||||||
|
|||||||
@@ -23,6 +23,12 @@ struct InitStructure
|
|||||||
string cid_csd_filePath = "";
|
string cid_csd_filePath = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// @brief struktura pro informaci o licenci
|
||||||
|
struct LicenceInfo
|
||||||
|
{
|
||||||
|
string licenceFileName = "";
|
||||||
|
};
|
||||||
|
|
||||||
class LicenceReader
|
class LicenceReader
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -32,6 +38,7 @@ public:
|
|||||||
bool argumentsCorrect = false;
|
bool argumentsCorrect = false;
|
||||||
ErrorMessage error;
|
ErrorMessage error;
|
||||||
SDCardInfo sdCardInfo {};
|
SDCardInfo sdCardInfo {};
|
||||||
|
LicenceInfo licInfo {};
|
||||||
|
|
||||||
LicenceReader();
|
LicenceReader();
|
||||||
~LicenceReader();
|
~LicenceReader();
|
||||||
@@ -39,13 +46,14 @@ public:
|
|||||||
bool initread(int elcType, InitStructure &initStructure);
|
bool initread(int elcType, InitStructure &initStructure);
|
||||||
bool getLicenceInfo(void *returnStructure); //vrací informace o všech licenčních bodech základě předané návratové struktury
|
bool getLicenceInfo(void *returnStructure); //vrací informace o všech licenčních bodech základě předané návratové struktury
|
||||||
bool getLicenceItemInfo(int protocolId, void *returnItemStructure); //vrací informace o licenčím bodu na základě id protocolu a předané návratové struktury
|
bool getLicenceItemInfo(int protocolId, void *returnItemStructure); //vrací informace o licenčím bodu na základě id protocolu a předané návratové struktury
|
||||||
LicenceInfoGeneral licenceInfo {}; //pole licencí
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Licence2 *licence2 {}; //interní struktura pro zpracování licence ELC2
|
Licence2 *licence2 {}; //interní struktura pro zpracování licence ELC2
|
||||||
Licence1 *licence1 {}; //interní struktura pro zpracování licence ELC1
|
Licence1 *licence1 {}; //interní struktura pro zpracování licence ELC1
|
||||||
LicenceIdentification licIdentification {};
|
LicenceIdentification licIdentification {};
|
||||||
string configFileName = "";
|
string configFileName = "";
|
||||||
|
LicenceInfoGeneral licencesInfo {}; //pole licencí
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -9,7 +9,7 @@
|
|||||||
/// @param argc
|
/// @param argc
|
||||||
/// @param argv parametry pro generování licence
|
/// @param argv parametry pro generování licence
|
||||||
/// @return
|
/// @return
|
||||||
int main8(int argc, char *argv[])
|
int main7(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
unordered_map<string, string> arguments = getArguments(argc, argv);
|
unordered_map<string, string> arguments = getArguments(argc, argv);
|
||||||
try
|
try
|
||||||
|
|||||||
@@ -67,8 +67,11 @@ int main()
|
|||||||
cout << "date: " << licenceReaderELC2.sdCardInfo.date << "\n";
|
cout << "date: " << licenceReaderELC2.sdCardInfo.date << "\n";
|
||||||
cout << "name: " << licenceReaderELC2.sdCardInfo.name << "\n";
|
cout << "name: " << licenceReaderELC2.sdCardInfo.name << "\n";
|
||||||
cout << "oemID: " << licenceReaderELC2.sdCardInfo.oemID << "\n";
|
cout << "oemID: " << licenceReaderELC2.sdCardInfo.oemID << "\n";
|
||||||
cout << "licenceFileName: " << licenceReaderELC2.sdCardInfo.licenceFileName << "\n";
|
|
||||||
|
|
||||||
|
cout << "název licenčního souboru: " << licenceReaderELC2.licInfo.licenceFileName << "\n";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// if (initStructure.compatibility == 1) //ukazka kompatibilita 1
|
// if (initStructure.compatibility == 1) //ukazka kompatibilita 1
|
||||||
// {
|
// {
|
||||||
// LicenceELC2Item_1 info; //jiná struktura, zbytek stejný
|
// LicenceELC2Item_1 info; //jiná struktura, zbytek stejný
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ bool LicenceReader::initread(int elcType, InitStructure &initStructure)
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
this->licence1->readLicence(&this->licenceInfo);
|
this->licence1->readLicence(&this->licencesInfo);
|
||||||
}
|
}
|
||||||
catch (const LicenceException &ex)
|
catch (const LicenceException &ex)
|
||||||
{
|
{
|
||||||
@@ -91,7 +91,7 @@ bool LicenceReader::initread(int elcType, InitStructure &initStructure)
|
|||||||
this->licence2 = &licenceELC2;
|
this->licence2 = &licenceELC2;
|
||||||
licenceELC2.cid_cdsPath = initStructure.cid_csd_filePath;
|
licenceELC2.cid_cdsPath = initStructure.cid_csd_filePath;
|
||||||
licenceELC2.licenceFilePath = initStructure.licenceFilePath;
|
licenceELC2.licenceFilePath = initStructure.licenceFilePath;
|
||||||
this->licence2->readLicence(&this->licenceInfo);
|
this->licence2->readLicence(&this->licencesInfo);
|
||||||
|
|
||||||
this->sdCardInfo.isLoaded = true;
|
this->sdCardInfo.isLoaded = true;
|
||||||
this->sdCardInfo.serialNumber = this->licence2->sdCard.cardData.serialNumber;
|
this->sdCardInfo.serialNumber = this->licence2->sdCard.cardData.serialNumber;
|
||||||
@@ -99,7 +99,11 @@ bool LicenceReader::initread(int elcType, InitStructure &initStructure)
|
|||||||
this->sdCardInfo.date = this->licence2->sdCard.cardData.date;
|
this->sdCardInfo.date = this->licence2->sdCard.cardData.date;
|
||||||
this->sdCardInfo.name = this->licence2->sdCard.cardData.name;
|
this->sdCardInfo.name = this->licence2->sdCard.cardData.name;
|
||||||
this->sdCardInfo.oemID = this->licence2->sdCard.cardData.oemID;
|
this->sdCardInfo.oemID = this->licence2->sdCard.cardData.oemID;
|
||||||
this->sdCardInfo.licenceFileName = this->licence2->licFileName;
|
|
||||||
|
this->licInfo.licenceFileName = this->licence2->licFileName;
|
||||||
|
|
||||||
|
//this->licenceInfo.
|
||||||
|
//this->sdCardInfo.licenceFileName = this->licence2->licFileName;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -140,7 +144,7 @@ bool LicenceReader::getLicenceItemInfo(int protocolId, void *returnItemStructure
|
|||||||
if (!this->licIdentification.licCompatibility) // defaultní kompatibilita
|
if (!this->licIdentification.licCompatibility) // defaultní kompatibilita
|
||||||
{
|
{
|
||||||
LicenceELC1Info *resultPtr = static_cast<LicenceELC1Info *>(returnItemStructure);
|
LicenceELC1Info *resultPtr = static_cast<LicenceELC1Info *>(returnItemStructure);
|
||||||
if (this->licenceInfo.licences.count(1)) // stare eov má natvrdo "id" 1.
|
if (this->licencesInfo.licences.count(1)) // stare eov má natvrdo "id" 1.
|
||||||
resultPtr->isValid = true;
|
resultPtr->isValid = true;
|
||||||
else
|
else
|
||||||
resultPtr->isValid = false;
|
resultPtr->isValid = false;
|
||||||
@@ -157,8 +161,8 @@ bool LicenceReader::getLicenceItemInfo(int protocolId, void *returnItemStructure
|
|||||||
{
|
{
|
||||||
LicenceELC2Item *resultPtr = static_cast<LicenceELC2Item *>(returnItemStructure);
|
LicenceELC2Item *resultPtr = static_cast<LicenceELC2Item *>(returnItemStructure);
|
||||||
resultPtr->protocolId = protocolId;
|
resultPtr->protocolId = protocolId;
|
||||||
if (this->licenceInfo.licences.count(protocolId))
|
if (this->licencesInfo.licences.count(protocolId))
|
||||||
resultPtr->dataPointsCount = this->licenceInfo.licences.at(protocolId);
|
resultPtr->dataPointsCount = this->licencesInfo.licences.at(protocolId);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
resultPtr->dataPointsCount = 0;
|
resultPtr->dataPointsCount = 0;
|
||||||
@@ -218,7 +222,7 @@ bool LicenceReader::getLicenceInfo(void *returnStructure)
|
|||||||
{
|
{
|
||||||
LicenceELC1Info *resultPtr = static_cast<LicenceELC1Info *>(returnStructure);
|
LicenceELC1Info *resultPtr = static_cast<LicenceELC1Info *>(returnStructure);
|
||||||
|
|
||||||
if (this->licenceInfo.licences.count(1)) // starý EOS má natvrdo "id" 1
|
if (this->licencesInfo.licences.count(1)) // starý EOS má natvrdo "id" 1
|
||||||
{
|
{
|
||||||
resultPtr->isValid = true;
|
resultPtr->isValid = true;
|
||||||
}
|
}
|
||||||
@@ -246,7 +250,7 @@ bool LicenceReader::getLicenceInfo(void *returnStructure)
|
|||||||
if (!this->licIdentification.licCompatibility) // defaultní kompatibilita
|
if (!this->licIdentification.licCompatibility) // defaultní kompatibilita
|
||||||
{
|
{
|
||||||
Reader::Licence2 licenceELC2 = Reader::Licence2(this->licIdentification);
|
Reader::Licence2 licenceELC2 = Reader::Licence2(this->licIdentification);
|
||||||
licenceELC2.readLicence(&this->licenceInfo);
|
licenceELC2.readLicence(&this->licencesInfo);
|
||||||
licenceELC2.getLicenceInfo(returnStructure);
|
licenceELC2.getLicenceInfo(returnStructure);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user