oddeleni a lazeni ELC1
This commit is contained in:
@@ -8,20 +8,24 @@ SDCard::SDCard()
|
||||
SDCard::SDCard(const string cds_cid_Path)
|
||||
{
|
||||
this->filePath = cds_cid_Path;
|
||||
if (getCIDFromFile() == false) return;
|
||||
if (getCSDFromFile() == false) return;
|
||||
if (getCIDFromFile() == false)
|
||||
return;
|
||||
if (getCSDFromFile() == false)
|
||||
return;
|
||||
this->isLoaded = SDCard::readSDCard();
|
||||
}
|
||||
|
||||
SDCard::SDCard(string cid, string csd)
|
||||
{
|
||||
for (unsigned int i = 0; i < cid.length(); i++) this->cid[i] = cid[i];
|
||||
for (unsigned int i = 0; i < csd.length(); i++) this->csd[i] = csd[i];
|
||||
for (unsigned int i = 0; i < cid.length(); i++)
|
||||
this->cid[i] = cid[i];
|
||||
for (unsigned int i = 0; i < csd.length(); i++)
|
||||
this->csd[i] = csd[i];
|
||||
|
||||
this->isLoaded = SDCard::readSDCard();
|
||||
}
|
||||
|
||||
bool SDCard:: readSDCard()
|
||||
bool SDCard::readSDCard()
|
||||
{
|
||||
|
||||
BYTE cHexNibbleToNo[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
@@ -99,7 +103,6 @@ bool SDCard:: readSDCard()
|
||||
this->cardData.CRCOK = ((sdCrc << 1) | 1) == this->cardData.CID[15];
|
||||
this->cardData.crcCorrect = (int)this->cardData.CID[15] == (int)((sdCrc << 1) | 1);
|
||||
return this->cardData.crcCorrect;
|
||||
|
||||
}
|
||||
|
||||
bool SDCard::getCIDFromFile()
|
||||
@@ -109,11 +112,14 @@ bool SDCard::getCIDFromFile()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (content.size() >= 32)
|
||||
|
||||
if (content.size() >= CID_LENGTH)
|
||||
{
|
||||
for (int i = 0; i<32;i++) this->cid[i] = content[i];
|
||||
for (int i = 0; i < 32; i++)
|
||||
this->cid[i] = content[i];
|
||||
}
|
||||
else return false;
|
||||
else
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -125,11 +131,13 @@ bool SDCard::getCSDFromFile()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (content.size() >= 32)
|
||||
if (content.size() >= CSD_LENGTH)
|
||||
{
|
||||
for (int i = 0; i<32;i++) this->csd[i] = content[i];
|
||||
for (int i = 0; i < 32; i++)
|
||||
this->csd[i] = content[i];
|
||||
}
|
||||
else return false;
|
||||
else
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -58,8 +58,7 @@ LicenceELC1::LicenceELC1(LicenceIdentification &licIdentification) : lIdentifica
|
||||
|
||||
bool LicenceELC1::getSDData()
|
||||
{
|
||||
for (int i = 0; i < CID_LENGTH; i++)
|
||||
this->sdData.CID_nibble[i] = (BYTE)cid[i];
|
||||
for (int i = 0; i < CID_LENGTH; i++) this->sdData.CID_nibble[i] = (BYTE)cid[i];
|
||||
|
||||
for (int i = 0; i < cnibblescount / 2; i++)
|
||||
{
|
||||
@@ -91,12 +90,10 @@ bool LicenceELC1::getSDData()
|
||||
this->sdData.manufacturerDate[i] = date[i];
|
||||
|
||||
// CSD
|
||||
for (unsigned int i = 0; i < CSD_LENGTH; i++)
|
||||
this->sdData.CSD_nibble[i] = (BYTE)csd[i];
|
||||
for (unsigned int i = 0; i < CSD_LENGTH; i++) this->sdData.CSD_nibble[i] = (BYTE)csd[i];
|
||||
|
||||
for (unsigned int i = 0; i < cnibblescount / 2; i++)
|
||||
{
|
||||
//
|
||||
this->sdData.CSD[i] = cHexNibble_to_No1[this->sdData.CSD_nibble[2 * i]] << 4 | cHexNibble_to_No1[this->sdData.CSD_nibble[2 * i + 1]];
|
||||
}
|
||||
|
||||
@@ -104,10 +101,6 @@ bool LicenceELC1::getSDData()
|
||||
{
|
||||
this->sdData.cardSize = this->sdData.CSD[7] << 16 | this->sdData.CSD[8] << 8 | this->sdData.CSD[9];
|
||||
this->sdData.cardGSize = (this->sdData.cardSize + 1) / 2048;
|
||||
|
||||
if (this->sdData.cardSize > 17200) // TODO result.cardSize
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
BYTE sdCrc = 0;
|
||||
@@ -189,10 +182,6 @@ string LicenceELC1::getLicenceName(BYTE licPostfix)
|
||||
string result = "";
|
||||
char prefixChar = 97;
|
||||
|
||||
if (licPostfix > 9) // chyba
|
||||
{
|
||||
}
|
||||
|
||||
if (licType == PlcLicenceType::LicenceOther)
|
||||
{
|
||||
result = "ezlic_";
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user