oddělení, čištění, kontrola ELC1

This commit is contained in:
2024-02-05 15:04:22 +01:00
parent 5229f16c9d
commit 37d02abd3f
54 changed files with 368 additions and 374 deletions

View File

@@ -1,3 +1,6 @@
#define LINUX 1
// #define WINDOWS 1
#include <stdio.h>
#include "licenceReader.h"
@@ -13,15 +16,16 @@ int main()
initStructure.licenceType = (int)LicenceType::EOS_EOV;
initStructure.licenceVersion = 1;
initStructure.licenceIndex = 0;
initStructure.compatibility = 1;
initStructure.licenceFilePath = "";
initStructure.cid_csd_filePath = "";
initStructure.licenceFilePath = ""; // cesta k licenčnímu souboru
// initStructure.compatibility = 0; v případě kompatibility 0 či nezadané je výstup defaultní.
// pro ELC 1 LicenceELC1Info s výstupem isValid, pro ELC 2 strukura { int protocolId = -1; int dataPointsCount = 0; }
initStructure.cid_csd_filePath = ""; // cesta k cidu/csd pro načtení a kontorlu licence
// verze původní ELC 1
LicenceReader licenceReaderELC1{};
if (licenceReaderELC1.initread(1, initStructure)) //iniciacni nacteni
if (licenceReaderELC1.initread(1, initStructure)) // iniciacni nacteni
{
LicenceInfo1 info; // struktura pro ELC1. Nemá tam asi nic jiného smysl nez true/false
LicenceELC1Info info; // struktura pro ELC1. Nemá tam asi nic jiného smysl nez true/false
if (licenceReaderELC1.getLicenceInfo(&info))
{
if (info.isValid)
@@ -39,11 +43,24 @@ int main()
// verze ELC 2 pro jeden protokol
LicenceReader licenceReaderELC2{};
if (licenceReaderELC2.initread(2, initStructure)) //iniciacni nacteni
if (licenceReaderELC2.initread(2, initStructure)) // iniciacni nacteni
{
LicenceItem21 info; // podle ELC a kompatibility určit strukuru (LicenceInfo11, LicenceInfo21, LicenceInfo31)
int protocolId = 444;
// v případě kompatibility 0, či nezadané výstup nativně je defaultní.
// v případně nenulové kompatibility, třeba 1, přidáme číslo kompatibility. Tedy pro ELC1 to bude LicenceELC1_1, pro ELC LicenceELC2_1
LicenceELC2Item info; // podle ELC a kompatibility určit strukuru (LicenceInfo11, LicenceInfo21, LicenceInfo31)
// if ()
int protocolId = 333;
// if (initStructure.compatibility == 1) //ukazka kompatibilita
// {
// LicenceELC2Item_1 info; //jiná struktura, zbytek stejný
// if (licenceReaderELC2.getLicenceItemInfo(protocolId, &info))
// {
// cout << "Pocet licencních bodu pro " << info.protocolId << ": " << info.dataPointsCount << std::endl;
// }
//...........
// }
if (licenceReaderELC2.getLicenceItemInfo(protocolId, &info))
{
@@ -60,15 +77,17 @@ int main()
LicenceReader licenceReaderCompleteELC2{};
// verze ELC 2 kompletní načtení
if (licenceReaderCompleteELC2.init(2, initStructure)) //iniciacni nacteni
if (licenceReaderCompleteELC2.init(2, initStructure)) // iniciacni nacteni
{
LicenceInfo21 info; // podle ELC a kompatibility určit strukuru (LicenceInfo11, LicenceInfo21, LicenceInfo31)
LicenceELC2Info info; // podle ELC a kompatibility určit strukuru (LicenceInfo11, LicenceInfo21, LicenceInfo31)
int protocolId = 333;
if (licenceReaderCompleteELC2.getLicenceInfo(&info))
{
if (info.licences.count(protocolId) > 0) cout << "Pocet bodu z vectoru pro protokol : " << protocolId << ": " << info.licences.at(protocolId) << "\n";
else cout << "Pro tento protokol nejsou definovay licencni body\n";
if (info.licences.count(protocolId) > 0)
cout << "Pocet bodu z vectoru pro protokol : " << protocolId << ": " << info.licences.at(protocolId) << "\n";
else
cout << "Pro tento protokol nejsou definovay licencni body\n";
cout << "Vypis vsech licencnich bodu: " << endl;
for (const auto &pair : info.licences)
{
@@ -91,3 +110,6 @@ int main()
// system("pause");
return SUCCES;
}
// cid: 0353445355313647801b1a9f6600c747 csd: 400e00325b59000076b27f800a404013
// https://sprava.app.elzel.cz/device/417 cid: 9f54495344434954615ad803c50171bf csd: 400e00325b5900003be77f800a400043