CashUtils: is not a class, it is a namespace
This commit is contained in:
parent
7affcb0313
commit
05113057b0
@ -1,6 +1,6 @@
|
|||||||
#include "CashUtils.h"
|
#include "CashUtils.h"
|
||||||
|
|
||||||
CashUtils::CashUtils(QObject *parent) : QObject(parent){}
|
#include <QDebug>
|
||||||
|
|
||||||
#define MAX_COINS 64
|
#define MAX_COINS 64
|
||||||
#define MAX_NOTES 16
|
#define MAX_NOTES 16
|
||||||
@ -11,7 +11,7 @@ CashUtils::CashUtils(QObject *parent) : QObject(parent){}
|
|||||||
* getAllInsertedCoins(uint16_t *types, uint16_t *values)
|
* getAllInsertedCoins(uint16_t *types, uint16_t *values)
|
||||||
* all inserted coins of this past transaction are stored, max 64
|
* all inserted coins of this past transaction are stored, max 64
|
||||||
*/
|
*/
|
||||||
uint32_t getAmountOfInsertedCoins(hwinf* hw)
|
uint32_t CashUtils::getAmountOfInsertedCoins(hwinf* hw)
|
||||||
{
|
{
|
||||||
uint32_t result = 0;
|
uint32_t result = 0;
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ uint32_t getAmountOfInsertedCoins(hwinf* hw)
|
|||||||
hw->getAllInsertedCoins(types, values);
|
hw->getAllInsertedCoins(types, values);
|
||||||
|
|
||||||
for (int i = 0; i < MAX_COINS; i++) {
|
for (int i = 0; i < MAX_COINS; i++) {
|
||||||
result += (types[i] * values[i]);
|
result += values[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@ -32,43 +32,20 @@ uint32_t getAmountOfInsertedCoins(hwinf* hw)
|
|||||||
*
|
*
|
||||||
* virtual uint8_t bna_getCurrentNotes(uint16_t latestBill, uint16_t *currentNotes) const =0;
|
* virtual uint8_t bna_getCurrentNotes(uint16_t latestBill, uint16_t *currentNotes) const =0;
|
||||||
* returns number of collected bank notes since start-command (current transaction)
|
* returns number of collected bank notes since start-command (current transaction)
|
||||||
* latestBill: not used
|
* latestBill: last accepted bank note, value in cent
|
||||||
* currentNotes[0] = last bill value
|
* currentNotes an array with up to 16 (further) notes collected
|
||||||
* currentNotes[1] = 0/1 1 if bill in escrow 0 if bill in cash box (stacker)
|
|
||||||
* currentNotes[2,3] = total sum of collected bills within this transaction
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
uint32_t getAmountOfInsertedNotes(hwinf* hw)
|
uint32_t CashUtils::getAmountOfInsertedNotes(hwinf* hw)
|
||||||
{
|
{
|
||||||
uint32_t result = 0;
|
uint32_t result = 0;
|
||||||
|
|
||||||
uint16_t currentNotes[MAX_NOTES];
|
uint16_t values[MAX_NOTES];
|
||||||
hw->bna_getCurrentNotes(0, currentNotes);
|
hw->bna_getCurrentNotes(0, values);
|
||||||
|
|
||||||
result = currentNotes[2] + ( currentNotes[3] >> 16);
|
for (int i = 0; i < MAX_COINS; i++) {
|
||||||
|
result += values[i];
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
* Get changer result
|
|
||||||
*
|
|
||||||
* virtual uint8_t changer_getChangeResult(uint32_t *returnedAmount) const =0;
|
|
||||||
* get result of coin dispensing
|
|
||||||
* receivedData[0]: 0: not yet started
|
|
||||||
* 1:amount returned
|
|
||||||
* 2:only partial return
|
|
||||||
* 3: no return possible
|
|
||||||
* receivedData[2,3,4,5]: returned amount
|
|
||||||
*
|
|
||||||
* Note: to get changed amount this method must be called after changing!
|
|
||||||
*/
|
|
||||||
|
|
||||||
uint32_t getAmountDueToChange(hwinf* hw)
|
|
||||||
{
|
|
||||||
Q_UNUSED(hw)
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
@ -4,20 +4,11 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include "interfaces.h"
|
#include "interfaces.h"
|
||||||
|
|
||||||
class CashUtils : public QObject
|
namespace CashUtils {
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
uint32_t getAmountOfInsertedCoins(hwinf* hw);
|
||||||
static uint32_t getAmountOfInsertedCoins(hwinf* hw);
|
uint32_t getAmountOfInsertedNotes(hwinf* hw);
|
||||||
static uint32_t getAmountOfInsertedNotes(hwinf* hw);
|
|
||||||
static uint32_t getAmountDueToChange(hwinf* hw);
|
|
||||||
|
|
||||||
private:
|
}
|
||||||
explicit CashUtils(QObject *parent = nullptr);
|
|
||||||
|
|
||||||
signals:
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // CASHUTILS_H
|
#endif // CASHUTILS_H
|
||||||
|
Loading…
Reference in New Issue
Block a user