cash2ecash

cash2ecash: cash acceptor that issues digital cash (experimental)
Log | Files | Refs | Submodules | README | LICENSE

commit 8986d51fda25fdbe6cedc14e65fbe37ffdf97822
parent 7acbce4bf3b8015180cc3bbf6724dc1bc8861c62
Author: Manuel Geissbühler <manuel@debian>
Date:   Fri, 27 Dec 2024 16:38:07 +0100

added some lines for testing

Diffstat:
M.gitignore | 1+
Dbuild/cash2ecash | 0
Dsrc/#cash2ecash.cpp# | 82-------------------------------------------------------------------------------
Msrc/cash2ecash.cpp | 2++
4 files changed, 3 insertions(+), 82 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -4,3 +4,4 @@ CMakeFiles/ *.png *.cmake +./build/* diff --git a/build/cash2ecash b/build/cash2ecash Binary files differ. diff --git a/src/#cash2ecash.cpp# b/src/#cash2ecash.cpp# @@ -1,82 +0,0 @@ -// This is the main function for the cash2ecash program -#include <cstdio> -#include <iostream> -#include <memory> -#include <ostream> - - - - -#include "cashacceptors.hpp" -#include "utils.hpp" -#include "gui.hpp" - - - - -// Global Definitions -enum state_e { INIT, SLEEP, IDLE, CONNECTION, ACCEPTCASH, DONE }; -enum state_e state = INIT; - -char test; -char *string; -Gui gui; -void guiDriver(); - -int main(int argc, char *argv[]){ - char serialpath[] = "/dev/ttyAMA3"; - std::cout << "The Program is running" <<std::endl; - DG600F cashacceptor(serialpath); - Timer timer1; - timer1.setTimeMillis(10000); - TALER_Amount testamount; - ScreenWelcome screenWelcome(800,480); - - - while (true) { - switch (state) { - case INIT: - gui.setActiveScreen(std::static_cast<Screen*>(&screenWelcome)); - state = ACCEPTCASH; - timer1.start(); - cashacceptor.startMoneyAcceptance(); - break; - case SLEEP: - break; - case IDLE: - break; - case CONNECTION: - break; - case ACCEPTCASH: - if (timer1.over()) { - cashacceptor.stopMoneyAcceptance(); - cashacceptor.readAccumulated(&testamount); - string = TALER_amount_to_string(&testamount); - printf("%s\n",string); - free(string); - cashacceptor.readFIFO(&testamount); - string = TALER_amount_to_string(&testamount); - printf("b%s\n", string); - free(string); - state = DONE; - } - - break; - case DONE: - break; - default: - std::cout << "ERROR: unhandeled state" << std::endl; - break; - } - guiDriver(); - } -} - - -void guiDriver(){ - static Timer guiSleep; - if (guiSleep.over()){ - guiSleep.setTimeMillis(gui.timerHandler()); - guiSleep.start(); - } -} diff --git a/src/cash2ecash.cpp b/src/cash2ecash.cpp @@ -6,6 +6,7 @@ #include "cashacceptors.hpp" +#include "gui/screenWelcomme.hpp" #include "utils.hpp" #include "gui.hpp" @@ -19,6 +20,7 @@ enum state_e state = INIT; char test; char *string; Gui gui; +ScreenWelcome welcome(800,480); void guiDriver(); int main(int argc, char *argv[]){