From fc121fcb9d65e444abe4e099de962e8c907066bb Mon Sep 17 00:00:00 2001
From: Sven Robertz <sven@cs.lth.se>
Date: Thu, 7 Mar 2013 12:27:17 +0100
Subject: [PATCH] added user action to the action enum

---
 lib/c/labcomm.c                  |  3 +++
 lib/c/labcomm.h                  | 15 ++++++++-------
 lib/c/labcomm_fd_reader_writer.c |  3 +++
 3 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/lib/c/labcomm.c b/lib/c/labcomm.c
index 2b982e6..bb487c0 100644
--- a/lib/c/labcomm.c
+++ b/lib/c/labcomm.c
@@ -355,6 +355,9 @@ static int signature_writer(
     } break;
     case labcomm_writer_available: {
     } break;
+    case labcomm_writer_send_signature:
+    case labcomm_writer_user_action:
+      return -ENOTSUP;  //HERE BE DRAGONS: should probably be cleaned up 
   }
   return 0;
 
diff --git a/lib/c/labcomm.h b/lib/c/labcomm.h
index 6d67fb2..9770188 100644
--- a/lib/c/labcomm.h
+++ b/lib/c/labcomm.h
@@ -124,13 +124,14 @@ void labcomm_decoder_free(
  */
 
 typedef enum { 
-  labcomm_writer_alloc, 
-  labcomm_writer_free,
-  labcomm_writer_start, 
-  labcomm_writer_continue, 
-  labcomm_writer_end, 
-  labcomm_writer_available,
-  labcomm_writer_send_signature
+  labcomm_writer_alloc,          // no args
+  labcomm_writer_free,           // no args
+  labcomm_writer_start,          // no args
+  labcomm_writer_continue,       // no args
+  labcomm_writer_end,            // no args
+  labcomm_writer_available,      // no args
+  labcomm_writer_send_signature, // args = (labcomm_signature_t*, struct labcomm_encoder*)
+  labcomm_writer_user_action	 // args = (int user_action, ... defined by the writer)
 } labcomm_writer_action_t;
 
 typedef struct labcomm_writer {
diff --git a/lib/c/labcomm_fd_reader_writer.c b/lib/c/labcomm_fd_reader_writer.c
index 7eb68bd..7f3e3e3 100644
--- a/lib/c/labcomm_fd_reader_writer.c
+++ b/lib/c/labcomm_fd_reader_writer.c
@@ -112,6 +112,9 @@ int labcomm_fd_writer(
       labcomm_encode_signature(e, signature);
  
     } break;
+    case labcomm_writer_user_action: {
+      result = -ENOTSUP;
+    } break;
   }
   return result;
 }
-- 
GitLab