Skip to content

Commit cfc35ab

Browse files
authored
Merge pull request #645 from deXol/develop
[BLE] #644 Remove cpzCtr check for ble during database import
2 parents ef45bd2 + ca28fbd commit cfc35ab

File tree

1 file changed

+30
-24
lines changed

1 file changed

+30
-24
lines changed

src/MPDevice.cpp

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3280,22 +3280,25 @@ bool MPDevice::generateSavePackets(AsyncJobs *jobs, bool tackleCreds, bool tackl
32803280

32813281
/* We need to diff cpz ctr values for firmwares running < v1.2 */
32823282
/* Diff: cpzctr values can only be added by design */
3283-
for (qint32 i = 0; i < cpzCtrValue.length(); i++)
3283+
if (!isBLE())
32843284
{
3285-
bool cpzCtrFound = false;
3286-
for (qint32 j = 0; j < cpzCtrValueClone.length(); j++)
3285+
for (qint32 i = 0; i < cpzCtrValue.length(); i++)
32873286
{
3288-
if (cpzCtrValue[i] == cpzCtrValueClone[j])
3287+
bool cpzCtrFound = false;
3288+
for (qint32 j = 0; j < cpzCtrValueClone.length(); j++)
32893289
{
3290-
cpzCtrFound = true;
3291-
break;
3290+
if (cpzCtrValue[i] == cpzCtrValueClone[j])
3291+
{
3292+
cpzCtrFound = true;
3293+
break;
3294+
}
3295+
}
3296+
if (!cpzCtrFound)
3297+
{
3298+
qDebug() << "Adding missing cpzctr";
3299+
diagSavePacketsGenerated = true;
3300+
jobs->append(new MPCommandJob(this, MPCmd::ADD_CARD_CPZ_CTR, cpzCtrValue[i], pMesProt->getDefaultFuncDone()));
32923301
}
3293-
}
3294-
if (!cpzCtrFound)
3295-
{
3296-
qDebug() << "Adding missing cpzctr";
3297-
diagSavePacketsGenerated = true;
3298-
jobs->append(new MPCommandJob(this, MPCmd::ADD_CARD_CPZ_CTR, cpzCtrValue[i], pMesProt->getDefaultFuncDone()));
32993302
}
33003303
}
33013304

@@ -5327,23 +5330,26 @@ void MPDevice::startImportFileMerging(const MPDeviceProgressCb &cbProgress, Mess
53275330
/* We arrive here knowing that the CPZ is in the CPZ/CTR list */
53285331
qInfo() << "Starting File Merging...";
53295332

5330-
/// Know if we need to add CPZ CTR packets (additive process)
5331-
for (qint32 i = 0; i < importedCpzCtrValue.size(); i++)
5333+
if (!isBLE())
53325334
{
5333-
bool cpzFound = false;
5334-
for (qint32 j = 0; j < cpzCtrValue.size(); j++)
5335+
/// Know if we need to add CPZ CTR packets (additive process)
5336+
for (qint32 i = 0; i < importedCpzCtrValue.size(); i++)
53355337
{
5336-
if (cpzCtrValue[j] == importedCpzCtrValue[i])
5338+
bool cpzFound = false;
5339+
for (qint32 j = 0; j < cpzCtrValue.size(); j++)
53375340
{
5338-
cpzFound = true;
5339-
break;
5341+
if (cpzCtrValue[j] == importedCpzCtrValue[i])
5342+
{
5343+
cpzFound = true;
5344+
break;
5345+
}
53405346
}
5341-
}
53425347

5343-
if (!cpzFound)
5344-
{
5345-
qDebug() << "CPZ CTR not in our DB: " << importedCpzCtrValue[i].toHex();
5346-
cpzCtrValue.append(importedCpzCtrValue[i]);
5348+
if (!cpzFound)
5349+
{
5350+
qDebug() << "CPZ CTR not in our DB: " << importedCpzCtrValue[i].toHex();
5351+
cpzCtrValue.append(importedCpzCtrValue[i]);
5352+
}
53475353
}
53485354
}
53495355

0 commit comments

Comments
 (0)