#include "CashUtils.h" #include #define MAX_COINS 64 #define MAX_NOTES 16 /***************************************************************************** * Get current inserted coins * * getAllInsertedCoins(uint16_t *types, uint16_t *values) * all inserted coins of this past transaction are stored, max 64 */ uint32_t CashUtils::getAmountOfInsertedCoins(hwinf* hw) { uint32_t result = 0; uint16_t types[MAX_COINS]; uint16_t values[MAX_COINS]; hw->getAllInsertedCoins(types, values); for (int i = 0; i < MAX_COINS; i++) { result += values[i]; } return result; } /***************************************************************************** * Get current inserted notes * * virtual uint8_t bna_getCurrentNotes(uint16_t latestBill, uint16_t *currentNotes) const =0; * returns number of collected bank notes since start-command (current transaction) * latestBill: last accepted bank note, value in cent * currentNotes an array with up to 16 (further) notes collected * */ uint32_t CashUtils::getAmountOfInsertedNotes(hwinf* hw) { uint32_t result = 0; uint16_t values[MAX_NOTES]; hw->bna_getCurrentNotes(0, values); for (int i = 0; i < MAX_COINS; i++) { result += values[i]; } return result; }