ELC2 CRC check, čištění
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
#define CRC = 1
|
||||
|
||||
#ifndef LICENCE_COMMON_H_
|
||||
#define LICENCE_COMMON_H_
|
||||
|
||||
@@ -5,7 +7,6 @@
|
||||
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -44,6 +45,7 @@ enum class GeneralError
|
||||
LicenceSizeMismatch = 52,
|
||||
LicenceSizeCardMismatch = 53,
|
||||
LicenceMismatch = 54,
|
||||
LicenceCRCMismatch = 54,
|
||||
ItemsCountMismatch = 61
|
||||
};
|
||||
|
||||
@@ -90,9 +92,9 @@ enum class FileNameGenerationType
|
||||
|
||||
struct Mapping
|
||||
{
|
||||
std::map<string, LicenceType> licMapTypes = {{"EOV_OSV", LicenceType::EOS_EOV}, {"DDTS", LicenceType::DDTS}, {"DRT", LicenceType::DRT}};
|
||||
std::map<string, EncryptionType> licMapEncryption = {{"CID_AES256", EncryptionType::CID_AES256}, {"FIX_AES256", EncryptionType::FIX_AES256}};
|
||||
std::map<string, PlcType> licMapPlcType = {{"WAGO", PlcType::WAGO}, {"TECO", PlcType::TECO}};
|
||||
unordered_map<string, LicenceType> licMapTypes = {{"EOV_OSV", LicenceType::EOS_EOV}, {"DDTS", LicenceType::DDTS}, {"DRT", LicenceType::DRT}};
|
||||
unordered_map<string, EncryptionType> licMapEncryption = {{"CID_AES256", EncryptionType::CID_AES256}, {"FIX_AES256", EncryptionType::FIX_AES256}};
|
||||
unordered_map<string, PlcType> licMapPlcType = {{"WAGO", PlcType::WAGO}, {"TECO", PlcType::TECO}};
|
||||
};
|
||||
|
||||
struct ErrorMessage
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#ifndef PLC_LICENCE1_COMMON_H
|
||||
#define PLC_LICENCE1_COMMON_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
#include "licenceCommon.h"
|
||||
#include "SDCard.h"
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
#ifndef PLC_LICENCE2_COMMON_H
|
||||
#define PLC_LICENCE2_COMMON_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <unordered_map>
|
||||
|
||||
#include <vector>
|
||||
#include "licenceCommon.h"
|
||||
#include "SDCard.h"
|
||||
@@ -22,25 +21,6 @@ public:
|
||||
|
||||
ErrorMessage errorMessage;
|
||||
|
||||
// enum class Error
|
||||
// {
|
||||
// SDCardReadError = 50,
|
||||
// LicenceReadError = 51,
|
||||
// LicenceSizeMismatch = 52,
|
||||
// LicenceSizeCardMismatch = 53,
|
||||
// LicenceMismatch = 54,
|
||||
// ItemsCountMismatch = 61
|
||||
// };
|
||||
|
||||
// unordered_map<Error, string> mapErrors = {
|
||||
// {Error::SDCardReadError, "Nepodařilo se načíst SD kartu."},
|
||||
// {Error::ItemsCountMismatch, "Nesouhlasí počet položek licence."},
|
||||
// {Error::LicenceSizeMismatch, "Nesouhlasí velikost souboru licence."},
|
||||
// {Error::LicenceSizeCardMismatch, "Nesouhlasí velikost SD karty."},
|
||||
// {Error::LicenceMismatch, "Nesouhlasí licence."},
|
||||
// {Error::ItemsCountMismatch, "Nesouhlasí počet položek licence."},
|
||||
// };
|
||||
|
||||
struct LicenceId
|
||||
{
|
||||
char licIdent[5] = {'E', 'L', 'C', '0', '_'};
|
||||
@@ -73,7 +53,6 @@ public:
|
||||
string projectDescription = "";
|
||||
string date = "";
|
||||
string licenceType = "";
|
||||
int crc = 0;
|
||||
};
|
||||
|
||||
struct PrivateContent // privátní šifrovaná část
|
||||
|
||||
@@ -6,9 +6,7 @@
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
#include <chrono>
|
||||
#include <format>
|
||||
#include <libgen.h> // dirname
|
||||
#include <climits>
|
||||
#include <libgen.h>
|
||||
#include <unistd.h>
|
||||
|
||||
typedef uint8_t BYTE;
|
||||
@@ -42,6 +40,8 @@ void getCharsFromString(string& source, char *charArray, size_t length);
|
||||
string getCompletePath(string fileName);
|
||||
void appendStringToVector(const std::string& str, std::vector<unsigned char>& charVector);
|
||||
uint16_t calculateCRC16(std::vector<unsigned char>& charVector);
|
||||
uint16_t calculateCRC16(std::vector<char> &charVector);
|
||||
uint16_t calculateCRC16(std::vector<unsigned char> &charVector, int removeCount);
|
||||
uint32_t bytesToDword(uint8_t byte1, uint8_t byte2, uint8_t byte3, uint8_t byte4);
|
||||
uint32_t bytesToWord(uint8_t byte1, uint8_t byte2);
|
||||
vector<unsigned char> joinVectors(const std::vector<unsigned char>& vector1, const std::vector<unsigned char>& vector2);
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#define LICENCE_READER_H_
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
#include "licReaderELC1.h"
|
||||
#include "licReaderELC2.h"
|
||||
#include "licReaderELC3.h"
|
||||
|
||||
Reference in New Issue
Block a user