ELC2 CRC check, čištění

This commit is contained in:
2024-02-07 13:36:25 +01:00
parent 37d02abd3f
commit 2bfc662b51
27 changed files with 317 additions and 234 deletions

View File

@@ -1,7 +1,6 @@
#define LINUX 1
// #define WINDOWS 1
#include <stdio.h>
#include "licenceReader.h"
/// @brief hlavní funkce
@@ -10,6 +9,7 @@
/// @return
int main()
{
try
{
InitStructure initStructure;
@@ -21,7 +21,7 @@ int main()
// 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
//verze původní ELC 1
LicenceReader licenceReaderELC1{};
if (licenceReaderELC1.initread(1, initStructure)) // iniciacni nacteni
{
@@ -43,7 +43,6 @@ int main()
// verze ELC 2 pro jeden protokol
LicenceReader licenceReaderELC2{};
if (licenceReaderELC2.initread(2, initStructure)) // iniciacni nacteni
{
// v případě kompatibility 0, či nezadané výstup nativně je defaultní.
@@ -52,7 +51,7 @@ int main()
// if ()
int protocolId = 333;
// if (initStructure.compatibility == 1) //ukazka kompatibilita
// if (initStructure.compatibility == 1) //ukazka kompatibilita 1
// {
// LicenceELC2Item_1 info; //jiná struktura, zbytek stejný
// if (licenceReaderELC2.getLicenceItemInfo(protocolId, &info))
@@ -75,8 +74,7 @@ int main()
}
LicenceReader licenceReaderCompleteELC2{};
// verze ELC 2 kompletní načtení
//verze ELC 2 kompletní načtení
if (licenceReaderCompleteELC2.init(2, initStructure)) // iniciacni nacteni
{
LicenceELC2Info info; // podle ELC a kompatibility určit strukuru (LicenceInfo11, LicenceInfo21, LicenceInfo31)
@@ -96,20 +94,29 @@ int main()
}
else
cout << "CHYBA: " << licenceReaderCompleteELC2.error.message;
}
else
{
cout << "CHYBA: " << licenceReaderCompleteELC2.error.message;
}
}
catch (...)
{
cout << "Obecna chyba\n";
}
// system("pause");
return SUCCES;
}
// cid: 0353445355313647801b1a9f6600c747 csd: 400e00325b59000076b27f800a404013
// https://sprava.app.elzel.cz/device/417 cid: 9f54495344434954615ad803c50171bf csd: 400e00325b5900003be77f800a400043
/*
CRC public size: 353
CRC gen public: 27885
CRC private size: 285
CRC gen private: 18500
CRC complete size: 638
CRC gen complete: 42051
*/