commit ab59bc474f178a87a18492291c6e1c4ea12cc393
parent e9daf6a8cfe29f8fb653989d03df7ccba696e1ad
Author: Manuel Geissbühler <manuel@debian>
Date: Thu, 9 Jan 2025 10:16:15 +0100
implemented Cashacceptor calls
Diffstat:
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/src/cash2ecash.cpp b/src/cash2ecash.cpp
@@ -4,6 +4,8 @@
#include <ostream>
#include <vector>
#include <mutex>
+#include "cashacceptor/cashacceptor.hpp"
+#include "cashacceptor/dg600f.hpp"
#include "utils.hpp"
#include "gui.hpp"
#include "global.hpp"
@@ -37,12 +39,16 @@ char *string = hello;
Gui gui;
Timer withdrawalStatusTimer;
+
ScreenWelcome *screenWelcome = new ScreenWelcome;
ScreenIdentification *screenIdentification = new ScreenIdentification;
ScreenConnection *screenConnection = new ScreenConnection;
ScreenAcceptCash *screenAcceptCash = new ScreenAcceptCash(string);
void guiDriver();
BankCommunication bankCommunication;
+char serialpath[] = "/dev/ttyAMA3";
+DG600F Cashaccepor(serialpath);
+TALER_Amount confirmedAmount;
typedef void(*action_t)();
@@ -82,8 +88,8 @@ void actionEventAbortConnection(){
void actionEventFinishCashin(){
std::cout << "Action Event Finish Cashin called" << std::endl;
- static struct TALER_Amount confirmedAmount;
- TALER_string_to_amount("KUDOS:2.0", &confirmedAmount);
+ Cashaccepor.readAccumulated(&confirmedAmount);
+ Cashaccepor.stopMoneyAcceptance();
bankCommunication.withdrawalConfirmRequest(withdrawal_id, &confirmedAmount);
gui.setActiveScreen(screenWelcome);
}
@@ -116,6 +122,7 @@ void actionEventBankWithdrawalDone(){
void actionEventBankWStatusSelected(){
std::cout << "Action Event Bank Withdrawal Status Confirmed called" << std::endl;
gui.setActiveScreen(screenAcceptCash);
+ Cashaccepor.startMoneyAcceptance();
}
void actionEventBankWStatusPending(){
@@ -135,8 +142,8 @@ void actionEventIdentificationTimeout(){
void actionEventAcceptCashTimeout(){
std::cout << "Action Event Acceptcash Timeout called" << std::endl;
- static struct TALER_Amount confirmedAmount;
- TALER_string_to_amount("KUDOS:2.0", &confirmedAmount);
+ Cashaccepor.readAccumulated(&confirmedAmount);
+ Cashaccepor.stopMoneyAcceptance();
bankCommunication.withdrawalConfirmRequest(withdrawal_id, &confirmedAmount);
}
@@ -227,7 +234,7 @@ void eventHandler(){
}
int main(int argc, char *argv[]){
- char serialpath[] = "/dev/ttyAMA3";
+
std::cout << "The Program is running" <<std::endl;
Timer timer1;
timer1.setTimeMillis(10000);