[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-mdb] branch master updated: fixtodos
From: |
gnunet |
Subject: |
[taler-taler-mdb] branch master updated: fixtodos |
Date: |
Fri, 06 Dec 2019 12:12:55 +0100 |
This is an automated email from the git hooks/post-receive script.
dominik-hofer pushed a commit to branch master
in repository taler-mdb.
The following commit(s) were added to refs/heads/master by this push:
new 98b5626 fixtodos
98b5626 is described below
commit 98b5626ace51fcd0a2c7b0f35198ff2464e1c51b
Author: Dominik Hofer <address@hidden>
AuthorDate: Fri Dec 6 12:02:53 2019 +0100
fixtodos
---
src/main.c | 34 +++++++++++++++++++++++++++++++---
1 file changed, 31 insertions(+), 3 deletions(-)
diff --git a/src/main.c b/src/main.c
index 4f9c4bd..c35c6e3 100644
--- a/src/main.c
+++ b/src/main.c
@@ -25,6 +25,8 @@ along with
* TODO:
* - comment code (Boss)
* - replace remaining MDB magic constants with #defines (Hofer)
+* - no warnings for known commands that we do not care about (maybe
DEBUG-level logging!) (Hofer)
+* - implement cancel confirmation (Hofer)
*/
#include "config.h"
#include <stdio.h>
@@ -142,6 +144,16 @@ along with
#define VMC_VEND_SUCCESS 0x02
#define VMC_VEND_FAILURE 0x03
#define VMC_VEND_SESSION_COMPLETE 0x04
+
+/**
+ * Commands for the reader (our device).
+ */
+#define VMC_READER 0x14
+#define VMC_READER_ENABLE 0x01
+#define VMC_READER_CANCEL 0x02
+
+#define VMC_REQUEST_ID 0x17
+
/**
* Out of sequence.
*/
@@ -158,10 +170,10 @@ along with
#define READER_VEND_APPROVE "05"
#define READER_VEND_DENIED "06"
#define READER_END_SESSION "07"
+#define READER_CANCELLED "08"
/* Unused reader commands */
#define READER_DISPLAY_REQUEST "02"
-#define READER_SESSION_CANCELLED "08"
#define READER_SESSION_CANCEL_REQUEST "04"
#define READER_REVALUE_APPROVED "0D"
#define READER_REVALUE_DENIED "0E"
@@ -492,6 +504,11 @@ static struct MdbCommand denyVend;
*/
static struct MdbCommand approveVend;
+/**
+ * Confirm cancellation by machine.
+ */
+static struct MdbCommand readerCancelled;
+
/**
* Terminate session.
*/
@@ -1747,7 +1764,7 @@ handle_command (const char *hex,
"Received request for configuration via MDB\n");
mdb.cmd = &readerConfigData;
break;
- case 0x14:
+ case VMC_READER:
{
unsigned int subcmd;
@@ -1766,11 +1783,15 @@ handle_command (const char *hex,
switch (subcmd)
{
- case 0x01:
+ case VMC_READER_ENABLE:
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Received Reader Enable via MDB\n");
mdb.session_running = GNUNET_NO;
break;
+ case VMC_READER_CANCEL:
+ mdb.cmd = &readerCancelled;
+ mdb.session_running = GNUNET_NO;
+ break;
default:
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Unknown MDB sub-command %X of command %X\n",
@@ -1780,6 +1801,10 @@ handle_command (const char *hex,
}
break;
}
+ case VMC_REQUEST_ID:
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Received VMC request ID, no need to handle (done by HW)\n");
+ break;
case VMC_ACKN:
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Received acknowledgement (for command `%s') from MDB\n",
@@ -2395,6 +2420,9 @@ main (int argc,
approveVend = setup_mdb_cmd ("Approve Vend",
READER_VEND_APPROVE,
"0001");
+ readerCancelled = setup_mdb_cmd ("Confirm cancellation",
+ READER_CANCELLED,
+ NULL);
denyVend = setup_mdb_cmd ("Deny Vend",
READER_VEND_DENIED,
NULL);
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [taler-taler-mdb] branch master updated: fixtodos,
gnunet <=