Add plausibility check for inserted coins

This commit is contained in:
Siegfried Siegert 2024-09-26 11:48:39 +02:00
parent 647dc9fe4b
commit 4e58fbe4e1
Signed by untrusted user: SiegfriedSiegert
GPG Key ID: 68371E015E8F0B03

View File

@ -1012,18 +1012,24 @@ char T_datif::loadRecDataFromFrame()
uit2=uchar2uint(receivedData[7],receivedData[6]); // value of last coin uit2=uchar2uint(receivedData[7],receivedData[6]); // value of last coin
//if (uitmp>0) // nur 1x bei neuer Münze 6.10.23 aendern: //if (uitmp>0) // nur 1x bei neuer Münze 6.10.23 aendern:
// beim Wechsler hat die kleinste Muenze immer coin type 0! // beim Wechsler hat die kleinste Muenze immer coin type 0!
if (uitmp>10000 || uit2>10000) if (uitmp>10000 || uit2>10000)
{ {
uitmp=0; uitmp=0;
uit2=0; uit2=0;
} }
if ((newInsertedAmount != lastInsertedAmount) || uit2>0 )
{ if (uit2==3 || uit2==5 || uit2==10 || uit2==20 || uit2==50 || uit2==100 || uit2==200 || uit2==500)
gpi_storeCurrentPayment(newInsertedAmount, uitmp, uit2); {
emit datif_gotNewCoin(); // OR BILL if (uitmp & 0x8000)>0 // valid coin
//qDebug()<<"emit new coin"; if ((newInsertedAmount != lastInsertedAmount) || uit2>0 )
lastInsertedAmount=newInsertedAmount; {
//qCritical()<<"datif 112 store and emit new coin "<<newInsertedAmount<<" "<<uitmp<<" "<<uit2; gpi_storeCurrentPayment(newInsertedAmount, uitmp, uit2);
emit datif_gotNewCoin(); // OR BILL if (uitmp & 0x8000)>0
//qDebug()<<"emit new coin";
lastInsertedAmount=newInsertedAmount;
//qCritical()<<"datif 112 store and emit new coin "<<newInsertedAmount<<" "<<uitmp<<" "<<uit2;
}
} }
break; break;