upravy opravy

This commit is contained in:
2024-04-10 08:03:43 +02:00
parent 79cc4998bc
commit ead3ba6e3e
50 changed files with 410 additions and 2846 deletions

View File

@@ -9,11 +9,12 @@
/// @return
int main()
{
// buffer,850client,104client, 104server, web
// kouknout na unikatní klíc pro linux
try
{
InitStructure initStructure;
initStructure.licenceType = (int)LicenceType::EOS_EOV;
InitStructure initStructure = {};
initStructure.licenceType = (int)LicenceType::DRT;
initStructure.licenceVersion = 1;
initStructure.licenceIndex = 0;
initStructure.licenceFilePath = ""; // cesta k licenčnímu souboru
@@ -21,25 +22,27 @@ int main()
// pro ELC 1 LicenceELC1Info je to isValid, pro ELC 2 strukura { int protocolId = -1; int dataPointsCount = 0; }
initStructure.cid_csd_filePath = ""; // cesta k cidu/csd pro načtení a kontrolu licence
//verze původní ELC 1
LicenceReader licenceReaderELC1{};
if (licenceReaderELC1.initread(1, initStructure)) // iniciacni nacteni
{
LicenceELC1Info info; // struktura pro ELC1. Nemá tam asi nic jiného smysl nez true/false
if (licenceReaderELC1.getLicenceInfo(&info))
{
if (info.isValid)
cout << "Platna licence ELC1 \n";
else
cout << "Neplatna licence ELC1\n";
}
else
cout << "CHYBA: " << licenceReaderELC1.error.message;
}
else
{
cout << "CHYBA: " << licenceReaderELC1.error.message;
}
// verze původní ELC 1
// LicenceReader licenceReaderELC1{};
// if (licenceReaderELC1.initread(1, initStructure)) // iniciacni nacteni
// {
// LicenceELC1Info info; // struktura pro ELC1. Nemá tam asi nic jiného smysl nez true/false
// if (licenceReaderELC1.getLicenceInfo(&info))
// {
// if (info.isValid)
// cout << "Platna licence ELC1 \n";
// else
// cout << "Neplatna licence ELC1\n";
// }
// else
// cout << "CHYBA: " << licenceReaderELC1.error.message;
// }
// else
// {
// cout << "CHYBA: " << licenceReaderELC1.error.message;
// }
//TODO přidat udaje o SD, kompatibilita, čas, jmeno licenčního souboru
// verze ELC 2 pro jeden protokol
LicenceReader licenceReaderELC2{};
@@ -47,11 +50,15 @@ int main()
{
// 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
// 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;
int protocolId = 2;
//ukayka dat SD karty
cout << "SD přečteno: " << licenceReaderELC2.sdCardInfo.isLoaded << "\n";
cout << "Card size: " << licenceReaderELC2.sdCardInfo.cardSize << "\n";
cout << "serial: " << licenceReaderELC2.sdCardInfo.serialNumber << "\n";
// if (initStructure.compatibility == 1) //ukazka kompatibilita 1
// {
// LicenceELC2Item_1 info; //jiná struktura, zbytek stejný
@@ -62,24 +69,26 @@ int main()
//...........
// }
//TODO toto upravit, kdyz nic neexistuje, tak to vrátí false
if (licenceReaderELC2.getLicenceItemInfo(protocolId, &info))
{
cout << "Pocet licencních bodu pro " << info.protocolId << ": " << info.dataPointsCount << std::endl;
}
else
cout << "CHYBA: " << licenceReaderELC2.error.message;
cout << "Tento protokol nemá body";
}
else
{
cout << "CHYBA: " << licenceReaderELC2.error.message;
}
// verze ELC 2 kompletní načtení
/*
LicenceReader licenceReaderCompleteELC2{};
//verze ELC 2 kompletní načtení
if (licenceReaderCompleteELC2.init(2, initStructure)) // iniciacni nacteni
{
LicenceELC2Info info;
int protocolId = 333;
LicenceELC2Info info;
int protocolId = 2;
if (licenceReaderCompleteELC2.getLicenceInfo(&info))
{
@@ -87,26 +96,151 @@ int main()
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)
{
std::cout << "<" << pair.first << ", " << pair.second << ">" << endl;
}
// for (const auto &pair : info.licences)
// {
// std::cout << "<" << pair.first << ", " << pair.second << ">" << endl;
// }
}
else
cout << "CHYBA: " << licenceReaderCompleteELC2.error.message;
}
else
{
cout << "CHYBA: " << licenceReaderCompleteELC2.error.message;
}
*/
}
catch (...)
{
cout << "Obecna chyba\n";
}
// } ] } licC hLenght2 cSize2 ser number 4
//125-93-125-1 - 1 - 0 - 1 - 6 - 163 - 1 - 231 - 59 - 197 -3 - 216 - 90 -1 -0 -0 -0 -255-255-255-255
//
//125-93-125-1 - 1 - 0 - 1 - 6 - 163 - 1 - 231 - 59 - 197 -3 - 216 - 90 -1 -0 -236 -0 -255-255-255-255
//here ŹVżz5Ž;k+3f‰"Ş•ů[ 125-93-125-1-1-0-1-6-163-1-231-59-197-3-216-90-1-0-0-0-255-255-255-255-0
//125-1-1-0-1-6-163-1-231-59-197-3-216-90-1-0-236-0-255-255-255-255-0
string gV = "69-76-67-50-95-1-1-0-1-6-163-1-231-59-197-3-216-90-123-34-118-101-114-115-105-111-110-34-58-49-46-49-46-49-34-44-34-112-114-111-106-101-99-116-34-58-34-90-100-101-110-100-97-32-84-101-115-116-32-67-82-67-49-34-44-34-100-97-116-101-34-58-34-52-46-52-46-50-48-50-52-34-44-34-110-111-116-101-34-58-34-112-111-122-110-195-161-109-107-97-34-44-34-108-105-99-101-110-99-101-84-121-112-101-34-58-34-68-82-84-48-34-44-34-105-116-101-109-115-34-58-91-123-34-110-97-109-101-34-58-34-112-116-95-69-122-95-98-117-102-102-101-114-34-44-34-100-97-116-97-80-111-105-110-116-115-67-111-117-110-116-34-58-34-52-50-57-52-57-54-55-50-57-53-34-125-44-123-34-110-97-109-101-34-58-34-112-116-95-69-122-95-105-101-99-54-49-56-53-48-99-34-44-34-100-97-116-97-80-111-105-110-116-115-67-111-117-110-116-34-58-34-55-55-55-34-125-44-123-34-110-97-109-101-34-58-34-112-116-95-69-122-95-105-101-99-49-48-52-99-34-44-34-100-97-116-97-80-111-105-110-116-115-67-111-117-110-116-34-58-34-53-53-53-34-125-44-123-34-110-97-109-101-34-58-34-112-116-95-69-122-95-105-101-99-49-48-52-115-34-44-34-100-97-116-97-80-111-105-110-116-115-67-111-117-110-116-34-58-34-54-54-54-34-125-44-123-34-110-97-109-101-34-58-34-112-116-95-69-122-95-119-101-98-115-34-44-34-100-97-116-97-80-111-105-110-116-115-67-111-117-110-116-34-58-34-52-50-57-52-57-54-55-50-57-53-34-125-44-123-34-110-97-109-101-34-58-34-112-116-95-69-122-95-105-110-116-101-114-72-87-34-44-34-100-97-116-97-80-111-105-110-116-115-67-111-117-110-116-34-58-34-51-34-125-93-125-1-1-0-1-6-163-1-231-59-197-3-216-90-1-0-0-0-255-255-255-255-0-1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18-19-20-21-22-23-24-25-26-27-28-29-30-31-32-33-34-35-36-37-38-39-40-41-42-43-44-45-46-47-48-49-50-51-52-53-54-55-56-57-58-59-60-61-62-63-7-0-0-0-9-3-0-0-0-1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18-19-20-21-22-23-24-25-26-27-28-29-30-31-32-33-34-35-36-37-38-39-40-41-42-43-44-45-46-47-48-49-50-51-52-53-54-55-56-57-58-59-60-61-62-63-5-0-0-0-43-2-0-0-0-1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18-19-20-21-22-23-24-25-26-27-28-29-30-31-32-33-34-35-36-37-38-39-40-41-42-43-44-45-46-47-48-49-50-51-52-53-54-55-56-57-58-59-60-61-62-63-6-0-0-0-154-2-0-0-0-1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18-19-20-21-22-23-24-25-26-27-28-29-30-31-32-33-34-35-36-37-38-39-40-41-42-43-44-45-46-47-48-49-50-51-52-53-54-55-56-57-58-59-60-61-62-63-2-0-0-0-255-255-255-255-0-1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18-19-20-21-22-23-24-25-26-27-28-29-30-31-32-33-34-35-36-37-38-39-40-41-42-43-44-45-46-47-48-49-50-51-52-53-54-55-56-57-58-59-60-61-62-63-0-0-0-0-3-0-0-0-0-1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18-19-20-21-22-23-24-25-26-27-28-29-30-31-32-33-34-35-36-37-38-39-40-41-42-43-44-45-46-47-48-49-50-51-52-53-54-55-56-57-58-59-60-61-62-63-186-165";
string bV = "69-76-67-50-95-1-1-0-1-6-163-1-231-59-197-3-216-90-123-34-118-101-114-115-105-111-110-34-58-49-46-49-46-49-34-44-34-112-114-111-106-101-99-116-34-58-34-90-100-101-110-100-97-32-84-101-115-116-32-67-82-67-49-34-44-34-100-97-116-101-34-58-34-52-46-52-46-50-48-50-52-34-44-34-110-111-116-101-34-58-34-112-111-122-110-195-161-109-107-97-34-44-34-108-105-99-101-110-99-101-84-121-112-101-34-58-34-68-82-84-48-34-44-34-105-116-101-109-115-34-58-91-123-34-110-97-109-101-34-58-34-112-116-95-69-122-95-98-117-102-102-101-114-34-44-34-100-97-116-97-80-111-105-110-116-115-67-111-117-110-116-34-58-34-52-50-57-52-57-54-55-50-57-53-34-125-44-123-34-110-97-109-101-34-58-34-112-116-95-69-122-95-105-101-99-54-49-56-53-48-99-34-44-34-100-97-116-97-80-111-105-110-116-115-67-111-117-110-116-34-58-34-55-55-55-34-125-44-123-34-110-97-109-101-34-58-34-112-116-95-69-122-95-105-101-99-49-48-52-99-34-44-34-100-97-116-97-80-111-105-110-116-115-67-111-117-110-116-34-58-34-53-53-53-34-125-44-123-34-110-97-109-101-34-58-34-112-116-95-69-122-95-105-101-99-49-48-52-115-34-44-34-100-97-116-97-80-111-105-110-116-115-67-111-117-110-116-34-58-34-54-54-54-34-125-44-123-34-110-97-109-101-34-58-34-112-116-95-69-122-95-119-101-98-115-34-44-34-100-97-116-97-80-111-105-110-116-115-67-111-117-110-116-34-58-34-52-50-57-52-57-54-55-50-57-53-34-125-44-123-34-110-97-109-101-34-58-34-112-116-95-69-122-95-105-110-116-101-114-72-87-34-44-34-100-97-116-97-80-111-105-110-116-115-67-111-117-110-116-34-58-34-51-34-125-93-125-1-1-0-1-6-163-1-231-59-197-3-216-90-1-0-0-0-255-255-255-255-0-1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18-19-20-21-22-23-24-25-26-27-28-29-30-31-32-33-34-35-36-37-38-39-40-41-42-43-44-45-46-47-48-49-50-51-52-53-54-55-56-57-58-59-60-61-62-63-7-0-0-0-9-3-0-0-0-1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18-19-20-21-22-23-24-25-26-27-28-29-30-31-32-33-34-35-36-37-38-39-40-41-42-43-44-45-46-47-48-49-50-51-52-53-54-55-56-57-58-59-60-61-62-63-5-0-0-0-43-2-0-0-0-1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18-19-20-21-22-23-24-25-26-27-28-29-30-31-32-33-34-35-36-37-38-39-40-41-42-43-44-45-46-47-48-49-50-51-52-53-54-55-56-57-58-59-60-61-62-63-6-0-0-0-154-2-0-0-0-1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18-19-20-21-22-23-24-25-26-27-28-29-30-31-32-33-34-35-36-37-38-39-40-41-42-43-44-45-46-47-48-49-50-51-52-53-54-55-56-57-58-59-60-61-62-63-2-0-0-0-255-255-255-255-0-1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18-19-20-21-22-23-24-25-26-27-28-29-30-31-32-33-34-35-36-37-38-39-40-41-42-43-44-45-46-47-48-49-50-51-52-53-54-55-56-57-58-59-60-61-62-63-0-0-0-0-3-0-0-0-0-1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18-19-20-21-22-23-24-25-26-27-28-29-30-31-32-33-34-35-36-37-38-39-40-41-42-43-44-45-46-47-48-49-50-51-52-53-54-55-56-57-58-59-60-61-62-63-186-165";
// std::vector<string> gTokens;
// std::vector<string> bTokens;
// std::stringstream ssG(gV);
// std::stringstream ssB(bV);
// std::string token;
// while (getline(ssG, token, '-')) { gTokens.push_back(token); }
// while (getline(ssB, token, '-')) { bTokens.push_back(token); }
// cout << gTokens.size() << "\n";
// cout << bTokens.size() << "\n";
cout << (gV == bV) << "\n";
return SUCCES;
}
/*
pt_Ez_interHW, // 0 - interni virtualni typ pro urceni licence na dany HW
pt_Ez_buffer, // 1 - datovy Buffer
pt_Ez_webs, // 2 - Ez www conectivity server
pt_Ez_dblogc, // 3 - Ez database log client
pt_Ez_sysinfoc, // 4 - Systemove informace systemu
pt_Ez_iec104c, // 5 - IEC-104 client
pt_Ez_iec104s, // 6 - IEC-104 server
pt_Ez_iec61850c, // 7 - IEC-61850 client
pt_Ez_iec61850s, // 8 - IEC-61850 server
pt_Ez_mdbipc, // 9 - Modbus IP client
pt_Ez_mdbips, // 10 - Modbus IP server
pt_Ez_mdbrtum, // 11 - Modbus RTU master
pt_Ez_mdbrtul, // 12 - Modbus RTU slave
pt_Ez_mdbasciim, // 13 - Modbus ASCII master
pt_Ez_mdbasciil, // 14 - Modbus ASCII slave
pt_Ez_gsmm, // 15 - GSM master
pt_Ez_gsml, // 16 - GSM slave
pt_Ez_iec101m, // 17 - IEC-101 master
pt_Ez_iec101l, // 18 - IEC-101 slave
pt_Ez_iec103m, // 19 - IEC-103 master
pt_Ext_snmpc, // 20 - SNMP client
pt_Ext_snmps, // 21 - SNMP server
pt_Ez_siadc09c, // 22 - ANSI/SIA DC-09 client
pt_Ez_honeywellgxyc, // 23 - Honeywell Galaxy smart client
pt_Ez_contactidm, // 24 - Ademco Contact ID - SIA DC-05 master
pt_Ez_litesm, // 25 - EPS Lites master
pt_Ez_epsnetmpcc, // 26 - Tecomat Epsnet MPC client
pt_Ez_epsnetmpcs, // 27 - Tecomat Epsnet MPC server
pt_Ez_epsnetmpcm, // 28 - Tecomat Epsnet MPC master
pt_Ez_epsnetmpcl, // 29 - Tecomat Epsnet MPC slave
pt_Ez_epsnetplc, // 30 - Tecomat Epsnet PLC
pt_Ez_amitdbnetipc, // 31 - AMiT DB-Net/IP client
pt_Ez_amitdbnetm, // 32 - AMiT DB-Net master
pt_Ez_fatekm, // 33 - Fatek master
pt_Ez_canm, // 34 - CAN master
pt_Ez_iec6205621m, // 35 - IEC 62056.21 master
pt_Ez_mbusm, // 36 - MBus master
pt_Ez_azddakm, // 37 - AZD DAK master
pt_Ez_rwaytechc, // 38 - RwayTech client (modbus IP)
pt_Ez_weinteksl, // 39 - Weintek touch screen server/slave (modbus protokol)
Pro index 0 (pt_Ez_interHW) jsou možné hodnoty (počet licenčních bodů):
#define EZ_HW_TECOMAT 1
#define EZ_HW_WAGO 2
#define EZ_HW_NATIVE_LINUX 3
#define EZ_HW_NATIVE_LINUX_DOCKER 4
#define EZ_HW_ARM64_LINUX 5
#define EZ_HW_ARM64_LINUX_DOCKER 6
Pro ostatní je uveden skutečný požadovaný počet licenčních bodů pro daný protokol.
U protokolů pt_Ez_buffer a pt_Ez_webs nastavovat defaultně EZ_PROTO_INFINITE = 4294967295
*/
/*
pt_Ez_interHW, // 0 - interni virtualni typ pro urceni licence na dany HW
pt_Ez_buffer, // 1 - datovy Buffer
pt_Ez_webs, // 2 - Ez www conectivity server
pt_Ez_dblogc, // 3 - Ez database log client
pt_Ez_mdbipc, // 4 - Modbus IP client
pt_Ez_mdbips, // 5 - Modbus IP server
pt_Ext_snmpc, // 6 - SNMP client
pt_Ext_snmps, // 7 - SNMP server
pt_Ez_iec104s, // 8 - IEC-104 server
pt_Ez_iec104c, // 9 - IEC-104 client
pt_Ez_sysinfoc, // 10 - Systemove informace systemu
pt_Ez_siadc09c, // 11 - ANSI/SIA DC-09 client
pt_Ez_honeywellgxyc, // 12 - Honeywell Galaxy smart client
pt_Ez_iec61850s, // 13 - IEC-61850 server
pt_Ez_iec61850c, // 14 - IEC-61850 client
pt_Ez_mdbrtum, // 15 - Modbus RTU master
pt_Ez_mdbrtul, // 16 - Modbus RTU slave
pt_Ez_mdbasciim, // 17 - Modbus ASCII master
pt_Ez_mdbasciil, // 18 - Modbus ASCII slave
pt_Ez_epsnetmpcc, // 19 - Tecomat Epsnet MPC client
pt_Ez_epsnetmpcs, // 20 - Tecomat Epsnet MPC server
pt_Ez_epsnetmpcl, // 21 - Tecomat Epsnet MPC slave
pt_Ez_epsnetmpcm, // 22 - Tecomat Epsnet MPC master
pt_Ez_epsnetplc, // 23 - Tecomat Epsnet PLC
pt_Ez_litesm, // 24 - EPS Lites master
pt_Ez_contactidm, // 25 - Ademco Contact ID - SIA DC-05 master
pt_Ez_amitdbnetipc, // 26 - AMiT DB-Net/IP client
pt_Ez_amitdbnetm, // 27 - AMiT DB-Net master
pt_Ez_fatekm, // 28 - Fatek master
pt_Ez_canm, // 29 - CAN master
pt_Ez_iec6205621m, // 30 - IEC 62056.21 master
pt_Ez_mbusm, // 31 - MBus master
pt_Ez_gsmm, // 32 - GSM master
pt_Ez_gsml, // 33 - GSM slave
pt_Ez_iec101m, // 34 - IEC-101 master
pt_Ez_iec101l, // 35 - IEC-101 slave
pt_Ez_iec103m, // 36 - IEC-103 master
pt_Ez_azddakm, // 37 - AZD DAK master
pt_Ez_rwaytechc, // 38 - RwayTech client (modbus IP)
pt_Ez_weinteksl, // 39 - Weintek touch screen server/slave (modbus protokol)
*/