taler-mdb

GNU Taler Extensions and Integrations
Log | Files | Refs | Submodules | README | LICENSE

commit ee1e8756f0df0963804386b1fff8b59a97079d35
parent eee5bf78ed11895fa4c08840b2c267d6231885d3
Author: Christian Grothoff <christian@grothoff.org>
Date:   Tue, 10 Dec 2019 10:37:37 +0100

act on reader disable

Diffstat:
Msrc/main.c | 18+++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/src/main.c b/src/main.c @@ -140,7 +140,7 @@ along with * Machine is polling for something. */ #define VMC_POLL 0x12 - + /** * Vending, with sub-command. */ @@ -155,6 +155,7 @@ along with * Commands for the reader (our device). */ #define VMC_READER 0x14 +#define VMC_READER_DISABLE 0x00 #define VMC_READER_ENABLE 0x01 #define VMC_READER_CANCEL 0x02 @@ -1302,7 +1303,8 @@ launch_payment (const struct Product *product) "summary", product->description, "amount", TALER_JSON_from_amount (&product->price), "fulfillment_url", fulflmntUrl - ,"auto_refund", GNUNET_JSON_from_time_rel (MAX_REFUND_DELAY) + ,"auto_refund", GNUNET_JSON_from_time_rel ( + MAX_REFUND_DELAY) ); GNUNET_free (fulflmntUrl); if (NULL == orderReq) @@ -1653,7 +1655,7 @@ write_mdb_command (void *cls) chkSum += mdb.txBuffer[idx] = mdb.cmd->cmd.bin[idx]; for (size_t idx = 0; idx < mdb.cmd->data.bin_size; idx++) chkSum += mdb.txBuffer[idx + mdb.cmd->cmd.bin_size] = - mdb.cmd->data.bin[idx]; + mdb.cmd->data.bin[idx]; mdb.txBuffer[mdb.cmd->cmd.bin_size + mdb.cmd->data.bin_size] = (uint8_t) (chkSum & 0xFF); } @@ -1846,6 +1848,16 @@ handle_command (const char *hex, switch (subcmd) { + case VMC_READER_DISABLE: + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Received Reader Disable via MDB\n"); + mdb.session_running = GNUNET_NO; + if (NULL != payment_activity) + { + cleanup_payment (payment_activity); + payment_activity = NULL; + } + break; case VMC_READER_ENABLE: GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Received Reader Enable via MDB\n");