oddeleni a lazeni ELC1

This commit is contained in:
2024-02-01 15:07:33 +01:00
parent c0b36e9068
commit 5229f16c9d
23 changed files with 346 additions and 175 deletions

View File

@@ -6,6 +6,7 @@
#include <cstring>
#include <string>
#include <map>
#include <unordered_map>
#include <stdint.h>
using namespace std;
@@ -178,52 +179,57 @@ struct LicenceItem31
struct LicenceInfo
{
int reqDataPointsCount = 0;
map<int, int> licences = {};
unordered_map<int, int> licences = {};
};
/// @brief základní struktura, seznam polozek licencí, kompatibilita 1
struct LicenceInfoCompatibility1
{
int reqDataPointsCount = 0;
map<int, int> licences = {};
unordered_map<int, int> licences = {};
};
/// @brief základní struktura, seznam polozek licencí, kompatibilita 1
/// @brief základní struktura, seznam polozek licencí, kompatibilita 2
struct LicenceInfoCompatibility2
{
int reqDataPointsCount = 0;
map<int, int> licences = {};
unordered_map<int, int> licences = {};
};
/// @brief základní struktura, seznam polozek licencí, kompatibilita 3
struct LicenceInfoCompatibility3
{
int reqDataPointsCount = 0;
map<int, int> licences = {};
unordered_map<int, int> licences = {};
};
struct LicenceInfo1
{
bool isValid {false};
};
struct LicenceInfo11
{
int reqDataPointsCount = 0;
map<int, int> licences = {};
unordered_map<int, int> licences = {};
};
struct LicenceInfo21
{
int reqDataPointsCount = 0;
map<int, int> licences = {};
unordered_map<int, int> licences = {};
};
struct LicenceInfo31
{
int reqDataPointsCount = 0;
map<int, int> licences = {};
unordered_map<int, int> licences = {};
};
struct LicenceInfoGeneral
{
int reqDataPointsCount = 0;
map<int, int> licences = {};
unordered_map<int, int> licences = {};
};
class LicenceException : public std::exception

View File

@@ -40,11 +40,8 @@ int decrypt(const unsigned char *ciphertext, int ciphertext_len, unsigned char *
string convertToString(char* a, int size);
string base64_encode_ai(const std::string &input);
unordered_map<string, string> getArguments(int argc, char *argv[]);
char* getCharArray(string source);
void getCharsFromString1(string source, char *charArray);
void getCharsFromString(string& source, char *charArray, size_t length);
string getCompletePath(string fileName);
char* getFileContent(string fileName);
void appendStringToVector(const std::string& str, std::vector<unsigned char>& charVector);
uint16_t calculateCRC16(std::vector<unsigned char>& charVector);
uint32_t bytesToDword(uint8_t byte1, uint8_t byte2, uint8_t byte3, uint8_t byte4);

View File

@@ -1,9 +1,31 @@
#ifndef ELC1_READER__H
#define ELC1_READER__H
#include "utils.h"
#include "licenceCommon.h"
#include "licenceELC1.h"
#include "SDCard.h"
using namespace std;
namespace Reader
{
class Licence1 : public LicenceELC1
{
public:
LicenceInfo21 licenceInfo;
Licence1();
~Licence1();
Licence1(LicenceIdentification &licIdentification);
bool readLicence(LicenceInfoGeneral *licences);
bool getLicenceInfo(void *ptr);
bool getLicenceItemInfo(int protocolId, void *returnItemStructure);
void getLicenceItems();
};
}
#endif

View File

@@ -2,8 +2,6 @@
#define LICENCE_READER_H_
#include "utils.h"
#include "licenceELC11.h"
#include "licenceELC31.h"
#include "licReaderELC1.h"
#include "licReaderELC2.h"
@@ -31,9 +29,9 @@ public:
string operationErrors = "";
bool argumentsCorrect = false;
ErrorMessage error;
LicenceELC11 *licence11;
LicenceELC31 *licence31;
Licence2 *licence2;
Licence1 *licence1;
LicenceReader();
~LicenceReader();