čištění a další upravy
This commit is contained in:
@@ -1,29 +1,69 @@
|
||||
#include <stdio.h>
|
||||
#include "plcLicence.h"
|
||||
#include "utils.h"
|
||||
#include <filesystem>
|
||||
|
||||
|
||||
#define FILEBUFFER 300
|
||||
#define TWO_HOURSE_SECONDS 7200
|
||||
#include "licenceGenerator.h"
|
||||
#include "licenceCommon.h"
|
||||
|
||||
/// @brief hlavní funkce
|
||||
/// @param argc
|
||||
/// @param argv parametry pro generování licence
|
||||
/// 1-cid, 2-csd, 3-stanice 4-rozvadec 5-typ licence
|
||||
/// @return
|
||||
int main5(int argc, char *argv[])
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
unordered_map<string, string> arguments = getArguments(argc, argv);
|
||||
LicenceGenerator generatorOld = LicenceGenerator(arguments["-uid"], arguments["-cid"], arguments["-csd"], arguments["-configFileName"]);
|
||||
generatorOld.createLicenceFile();
|
||||
return SUCCES;
|
||||
|
||||
LicenceGenerator licenceGenerator = LicenceGenerator();
|
||||
|
||||
PlcLicence plcWriteLicence = PlcLicence(arguments["-cid"], arguments["-csd"], arguments["-outputType"], arguments["-configFileName"]);
|
||||
if (plcWriteLicence.CreateLicence() == false)
|
||||
InitStructure initStructure;
|
||||
initStructure.elcType = 2;
|
||||
initStructure.licenceType = (int)LicenceType::EOS_EOV;
|
||||
initStructure.licenceVersion = 1;
|
||||
initStructure.licenceIndex = 0;
|
||||
initStructure.compatibility = 1;
|
||||
initStructure.licenceFilePath = "";
|
||||
initStructure.cid_csd_filePath = "";
|
||||
|
||||
// //verze #1: načtení kompletní licence a zobrazení
|
||||
// if (licenceGenerator.init(initStructure))
|
||||
// {
|
||||
// LicenceInfo21 info; // podle ELC a kompatibility určit strukuru (LicenceInfo11, LicenceInfo21, LicenceInfo31)
|
||||
// int protocolId = 345;
|
||||
// if (licenceGenerator.getLicenceInfo(protocolId, &info))
|
||||
// {
|
||||
// std::cout << "Počet licenčních bodů pro : " << protocolId << ": " << info.reqDataPointsCount << std::endl;
|
||||
// if (info.licences.count(protocolId) > 0) cout << "počet z vectoru pro : " << protocolId << info.licences.at(888) << endl;
|
||||
// cout << "všechny licenční body: " << endl;
|
||||
// for (const auto &pair : info.licences) { std::cout << "<" << pair.first << ", " << pair.second << ">" << endl; }
|
||||
// }
|
||||
// else
|
||||
// cerr << "Došlo k chybě: " << licenceGenerator.error.message;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// cerr << "Došlo k chybě: " << licenceGenerator.error.message;
|
||||
// }
|
||||
|
||||
//verze #2 : iterace pro kazdý bod zvlášť
|
||||
if (licenceGenerator.initread(initStructure))
|
||||
{
|
||||
cerr << "Licence creation failed";
|
||||
int protocolId = 888;
|
||||
|
||||
LicenceItem21 info; // podle ELC a kompatibility určit strukuru (LicenceInfo11, LicenceInfo21, LicenceInfo31)
|
||||
|
||||
if (licenceGenerator.getLicenceItemInfo(protocolId, &info))
|
||||
{
|
||||
std::cout << "Počet licenčních bodů pro " << info.protocolId << ": " << info.dataPointsCount << std::endl;
|
||||
}
|
||||
else
|
||||
cerr << "Došlo k chybě: " << licenceGenerator.error.message;
|
||||
}
|
||||
else
|
||||
{
|
||||
cerr << "Došlo k chybě: " << licenceGenerator.error.message;
|
||||
}
|
||||
|
||||
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
system("pause");
|
||||
return SUCCES;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user