gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-taler-mdb] 01/02: Added message for display of VM


From: gnunet
Subject: [taler-taler-mdb] 01/02: Added message for display of VM
Date: Sat, 28 Dec 2019 17:46:24 +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.

commit dfbf7d7788be411a0bd158f237c6f3f82af1f39f
Author: Dominik Hofer <address@hidden>
AuthorDate: Sat Dec 28 17:44:40 2019 +0100

    Added message for display of VM
---
 src/main.c | 37 +++++++++++++++++++++++++++++++++----
 1 file changed, 33 insertions(+), 4 deletions(-)

diff --git a/src/main.c b/src/main.c
index a5d1df3..c1e6abb 100644
--- a/src/main.c
+++ b/src/main.c
@@ -216,8 +216,13 @@ along with
 /* Cancelled Command */
 #define READER_CANCELLED "08"
 
-/* Unused reader commands */
+/* Display Request for Sold Out product */
 #define READER_DISPLAY_REQUEST "02"
+#define READER_DISPLAY_REQUEST_TIME "32"
+#define READER_DISPLAY_SOLD_OUT 
"202020202020202020204175737665726b617566742020202020202020202020"
+#define READER_DISPLAY_INTERNAL_ERROR 
"202020496e7465726e616c204572726f72202d2054727920416761696e202020i"
+
+/* Unused reader commands */
 #define READER_SESSION_CANCEL_REQUEST "04"
 #define READER_REVALUE_DENIED "0E"
 
@@ -581,6 +586,16 @@ static struct MdbCommand revalueAmount;
  * Send NACK 
  */
 static struct MdbCommand readerNACK;
+
+/**
+ * Display Request for Sold Out
+ */
+static struct MdbCommand readerDisplaySoldOut;
+
+/**
+ * Display Request for Error Message
+ */
+static struct MdbCommand readerDisplayInternalError;
 /**
  * Terminate session.
  */
@@ -1647,7 +1662,7 @@ read_keyboard_command (void *cls)
         GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                     "Product %s sold out, denying vend\n",
                     products[i].description);
-        mdb.cmd = &denyVend;
+        mdb.cmd = &readerDisplaySoldOut;
         run_mdb_event_loop ();
         start_read_keyboard ();
         return;
@@ -1866,6 +1881,11 @@ handle_ack ()
     mdb.session_running = GNUNET_NO;
     mdb.cmd = &endSession;
   }
+       if (&readerDisplaySoldOut == mdb.last_cmd)
+               mdb.cmd = &denyVend;
+       if (&readerDisplayInternalError == mdb.last_cmd)
+               mdb.cmd = &denyVend;
+
   mdb.last_cmd = NULL;
   /* Cause the write-task to be re-scheduled now */
   if (NULL != mdb.wtask)
@@ -1936,7 +1956,7 @@ handle_command (const char *hex,
                }
                if ( ((uint8_t) (chkSum & 0xFF)) != tmp )
                {
-                       mdb.cmd = &denyVend;
+                       mdb.cmd = &readerDisplayInternalError;
                        GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                      "Received command with wrong checksum `%.*s'\n",
                      (int) hex_len,
@@ -2007,7 +2027,7 @@ handle_command (const char *hex,
                 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                             "Product %s sold out, denying vend\n",
                             products[i].description);
-                mdb.cmd = &denyVend;
+                mdb.cmd = &readerDisplaySoldOut;
                 return;
               }
               payment_activity = launch_payment (&products[i]);
@@ -2949,6 +2969,15 @@ main (int argc,
                                  READER_NACK,
                                  NULL);
 
+       readerDisplaySoldOut = setup_mdb_cmd ("Display Sold Out",
+                                                                               
                                                                        
READER_DISPLAY_REQUEST,
+                                                                               
                                                                        
READER_DISPLAY_REQUEST_TIME
+                                                                               
                                                                        
READER_DISPLAY_SOLD_OUT);
+
+       readerDisplayInternalError = setup_mdb_cmd ("Display Communication 
Error",
+                                                                               
                                                                                
                        READER_DISPLAY_REQUEST,
+                                                                               
                                                                                
                        READER_DISPLAY_REQUEST_TIME
+                                                                               
                                                                                
                        READER_DISPLAY_INTERNAL_ERROR);
 
   ret = GNUNET_PROGRAM_run (argc,
                             argv,

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]