cash2ecash

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

commit 87b1373d9a793ea45264f7c09a7a6abf0721896d
parent 6c4db15ef9c1592d1785ec8270a138aada9a5429
Author: Tellenbach Reto <tellr1@bfh.ch>
Date:   Fri,  5 Jun 2026 22:00:46 +0200

[wip] UI: function to run qr-show

Diffstat:
M.gitignore | 2++
Msrc/taler-digitizer.c | 58+++++++++++++++++++++++++++++++++++++++++++++++++++++++---
2 files changed, 57 insertions(+), 3 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -12,3 +12,5 @@ CMakeFiles/ # IDE files .vscode +# localy built programs +ext/* diff --git a/src/taler-digitizer.c b/src/taler-digitizer.c @@ -23,7 +23,7 @@ * @author Reto Tellenbach */ - +#include <stdio.h> #include <gnunet/gnunet_util_lib.h> #include "taler_digitizer_util.h" #include "taler/taler_digitizer_service.h" @@ -38,6 +38,9 @@ */ #define DIGITIZER_PERSON_WITHDRAWAL_PERIOD_TIME_UNIT GNUNET_TIME_UNIT_DAYS +#define FRAMEBUFFER_SIZE 256 +#define PATH_QR_SHOW "../ext/QRshow" + /** * Global return value */ @@ -270,6 +273,33 @@ struct DIGITIZER_DisplayContext *display_ctx; static void state_controller_task(void *cls); +enum GNUNET_GenericReturnValue +run_qr_show(int showtime,char *wopid_url) +{ + FILE *fp; + //char buffer[FRAMEBUFFER_SIZE]; + char *command; + char *url; + url = TALER_url_join(wopid_url, + "", + "external-confirmation", + "1"); + GNUNET_asprintf(&command, + "%s -c ../taler-digitizer.conf -d \"%d s\" %s\n", + PATH_QR_SHOW, + showtime, + url); + fp = popen(command, "r"); + if (fp == NULL) { + GNUNET_free(url); + TALER_LOG_ERROR("Failed to open framebuffer\n"); + return GNUNET_SYSERR; + } + + GNUNET_free(url); + pclose(fp); + return GNUNET_OK; +} /** * Joinn currency and V.F format value string to TALER amount". @@ -848,7 +878,24 @@ static void Idle_state_task(void *cls) } /** - * + * Idle state + * prepare for new withdrawal process and + * check for start signal from UI + */ +static void ScanQR_state_task(void *cls) +{ + (void)cls; + + get_accounts_handle = TALER_BANK_get_accounts (curl_ctx, + cfg_bank_base_url, + cfg_bank_account_username, + cfg_bank_authentication, + &on_get_accounts_done, + NULL); +} + +/** + * Switch between State tasks */ static void state_controller_task(void *cls) { @@ -870,7 +917,12 @@ static void state_controller_task(void *cls) { GNUNET_SCHEDULER_add_now(TerminalError_state_task,NULL); return; - } + } + case DIGITIZER_STATE_SCAN_QR: + { + GNUNET_SCHEDULER_add_now(ScanQR_state_task,NULL); + return; + } default: {