diff --git a/include/common/SDCard.h b/include/common/SDCard.h index f82eb7f..834d9d0 100644 --- a/include/common/SDCard.h +++ b/include/common/SDCard.h @@ -24,13 +24,12 @@ const string cidFilePath = ""; struct SDCardInfo { -uint32_t cardSize {}; -uint32_t serialNumber {}; -string date = ""; -string oemID = ""; -string name = ""; -string licenceFileName = ""; -bool isLoaded = false; + uint32_t cardSize{}; + uint32_t serialNumber{}; + string date = ""; + string oemID = ""; + string name = ""; + bool isLoaded = false; }; class SDCard @@ -59,25 +58,22 @@ class SDCard bool crcCorrect = false; }; -bool readSDCard(); -bool getCIDFromFile(); -bool getCSDFromFile(); + bool readSDCard(); + bool getCIDFromFile(); + bool getCSDFromFile(); public: - SDCardData cardData; bool isLoaded = false; char cid[32] = {}; char csd[32] = {}; string filePath = ""; - string cidString = ""; //pro předání pro starý generátor - string csdString = ""; //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 SDCard(); SDCard(string cid, string csd); SDCard(const string filesPath); - - }; #endif diff --git a/include/generator/licenceGenerator.h b/include/generator/licenceGenerator.h index f0ae0a2..479e156 100644 --- a/include/generator/licenceGenerator.h +++ b/include/generator/licenceGenerator.h @@ -50,7 +50,7 @@ public: void createLicenceFile(); - LicenceInfoGeneral licenceInfo {}; + LicenceInfoGeneral licenceInfoGeneral {}; private: LicenceIdentification licIdentification; diff --git a/include/reader/licenceReader.h b/include/reader/licenceReader.h index 324b446..24837ab 100644 --- a/include/reader/licenceReader.h +++ b/include/reader/licenceReader.h @@ -23,6 +23,12 @@ struct InitStructure string cid_csd_filePath = ""; }; +/// @brief struktura pro informaci o licenci +struct LicenceInfo +{ + string licenceFileName = ""; +}; + class LicenceReader { @@ -32,6 +38,7 @@ public: bool argumentsCorrect = false; ErrorMessage error; SDCardInfo sdCardInfo {}; + LicenceInfo licInfo {}; LicenceReader(); ~LicenceReader(); @@ -39,13 +46,14 @@ public: 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 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: Licence2 *licence2 {}; //interní struktura pro zpracování licence ELC2 Licence1 *licence1 {}; //interní struktura pro zpracování licence ELC1 LicenceIdentification licIdentification {}; string configFileName = ""; + LicenceInfoGeneral licencesInfo {}; //pole licencí + }; #endif diff --git a/output/ezlic_drt0_jjacdgpdxpb.lic b/output/ezlic_drt0_jjacdgpdxpb.lic index 88d5018..ab667a0 100644 Binary files a/output/ezlic_drt0_jjacdgpdxpb.lic and b/output/ezlic_drt0_jjacdgpdxpb.lic differ diff --git a/output/licenceGenerator b/output/licenceGenerator index 60fc40f..3398e60 100644 Binary files a/output/licenceGenerator and b/output/licenceGenerator differ diff --git a/src/CreateLicence.cpp b/src/CreateLicence.cpp index 4533f1e..98add00 100644 --- a/src/CreateLicence.cpp +++ b/src/CreateLicence.cpp @@ -9,7 +9,7 @@ /// @param argc /// @param argv parametry pro generování licence /// @return -int main8(int argc, char *argv[]) +int main7(int argc, char *argv[]) { unordered_map arguments = getArguments(argc, argv); try diff --git a/src/ReadLicence.cpp b/src/ReadLicence.cpp index f18116e..df85dc2 100644 --- a/src/ReadLicence.cpp +++ b/src/ReadLicence.cpp @@ -67,8 +67,11 @@ int main() cout << "date: " << licenceReaderELC2.sdCardInfo.date << "\n"; cout << "name: " << licenceReaderELC2.sdCardInfo.name << "\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 // { // LicenceELC2Item_1 info; //jiná struktura, zbytek stejný diff --git a/src/reader/LicenceReader.cpp b/src/reader/LicenceReader.cpp index 82dd000..77ae6b0 100644 --- a/src/reader/LicenceReader.cpp +++ b/src/reader/LicenceReader.cpp @@ -75,7 +75,7 @@ bool LicenceReader::initread(int elcType, InitStructure &initStructure) try { - this->licence1->readLicence(&this->licenceInfo); + this->licence1->readLicence(&this->licencesInfo); } catch (const LicenceException &ex) { @@ -91,7 +91,7 @@ bool LicenceReader::initread(int elcType, InitStructure &initStructure) this->licence2 = &licenceELC2; licenceELC2.cid_cdsPath = initStructure.cid_csd_filePath; licenceELC2.licenceFilePath = initStructure.licenceFilePath; - this->licence2->readLicence(&this->licenceInfo); + this->licence2->readLicence(&this->licencesInfo); this->sdCardInfo.isLoaded = true; 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.name = this->licence2->sdCard.cardData.name; 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; } @@ -140,7 +144,7 @@ bool LicenceReader::getLicenceItemInfo(int protocolId, void *returnItemStructure if (!this->licIdentification.licCompatibility) // defaultní kompatibilita { LicenceELC1Info *resultPtr = static_cast(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; else resultPtr->isValid = false; @@ -157,8 +161,8 @@ bool LicenceReader::getLicenceItemInfo(int protocolId, void *returnItemStructure { LicenceELC2Item *resultPtr = static_cast(returnItemStructure); resultPtr->protocolId = protocolId; - if (this->licenceInfo.licences.count(protocolId)) - resultPtr->dataPointsCount = this->licenceInfo.licences.at(protocolId); + if (this->licencesInfo.licences.count(protocolId)) + resultPtr->dataPointsCount = this->licencesInfo.licences.at(protocolId); else { resultPtr->dataPointsCount = 0; @@ -218,7 +222,7 @@ bool LicenceReader::getLicenceInfo(void *returnStructure) { LicenceELC1Info *resultPtr = static_cast(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; } @@ -246,7 +250,7 @@ bool LicenceReader::getLicenceInfo(void *returnStructure) if (!this->licIdentification.licCompatibility) // defaultní kompatibilita { Reader::Licence2 licenceELC2 = Reader::Licence2(this->licIdentification); - licenceELC2.readLicence(&this->licenceInfo); + licenceELC2.readLicence(&this->licencesInfo); licenceELC2.getLicenceInfo(returnStructure); } else