Index: include/libroarlight/roardmx.h
===================================================================
--- include/libroarlight/roardmx.h	(revision 5928)
+++ include/libroarlight/roardmx.h	(revision 5931)
@@ -91,4 +91,8 @@
 };
 
+// database access:
+int roar_roardmx_str2event(const char * event);
+const char * roar_roardmx_event2str(const int event);
+
 // generic things:
 int roar_roardmx_message_new (struct roar_roardmx_message * mes);
Index: libroarlight/roardmx.c
===================================================================
--- libroarlight/roardmx.c	(revision 5926)
+++ libroarlight/roardmx.c	(revision 5931)
@@ -29,4 +29,105 @@
 #define BCHK(x) if ( (x) == NULL ) { roar_err_set(ROAR_ERROR_FAULT); return -1; }
 
+// database access:
+static const struct {
+ const int id;
+ const char * const name;
+} __eventnames[] = {
+//$ grep '^#define ROAR_ROARDMX_EVENT_' roardmx.h | cut -d ' ' -f2 | while read line; do name=`echo $line | cut -d_ -f4 | tr A-Z a-z`; for suffix in beat off on hold; do printf " {%-56s \"%s\"},\n" "$line|ROAR_ROARDMX_ETYPE_`tr a-z A-Z <<<$suffix`," $name-$suffix; done; printf " {%-56s \"%s\"},\n" $line, $name; done
+ {ROAR_ROARDMX_EVENT_NONE|ROAR_ROARDMX_ETYPE_BEAT,         "none-beat"},
+ {ROAR_ROARDMX_EVENT_NONE|ROAR_ROARDMX_ETYPE_OFF,          "none-off"},
+ {ROAR_ROARDMX_EVENT_NONE|ROAR_ROARDMX_ETYPE_ON,           "none-on"},
+ {ROAR_ROARDMX_EVENT_NONE|ROAR_ROARDMX_ETYPE_HOLD,         "none-hold"},
+ {ROAR_ROARDMX_EVENT_NONE,                                 "none"},
+ {ROAR_ROARDMX_EVENT_STEP|ROAR_ROARDMX_ETYPE_BEAT,         "step-beat"},
+ {ROAR_ROARDMX_EVENT_STEP|ROAR_ROARDMX_ETYPE_OFF,          "step-off"},
+ {ROAR_ROARDMX_EVENT_STEP|ROAR_ROARDMX_ETYPE_ON,           "step-on"},
+ {ROAR_ROARDMX_EVENT_STEP|ROAR_ROARDMX_ETYPE_HOLD,         "step-hold"},
+ {ROAR_ROARDMX_EVENT_STEP,                                 "step"},
+ {ROAR_ROARDMX_EVENT_TAP|ROAR_ROARDMX_ETYPE_BEAT,          "tap-beat"},
+ {ROAR_ROARDMX_EVENT_TAP|ROAR_ROARDMX_ETYPE_OFF,           "tap-off"},
+ {ROAR_ROARDMX_EVENT_TAP|ROAR_ROARDMX_ETYPE_ON,            "tap-on"},
+ {ROAR_ROARDMX_EVENT_TAP|ROAR_ROARDMX_ETYPE_HOLD,          "tap-hold"},
+ {ROAR_ROARDMX_EVENT_TAP,                                  "tap"},
+ {ROAR_ROARDMX_EVENT_BEAT|ROAR_ROARDMX_ETYPE_BEAT,         "beat-beat"},
+ {ROAR_ROARDMX_EVENT_BEAT|ROAR_ROARDMX_ETYPE_OFF,          "beat-off"},
+ {ROAR_ROARDMX_EVENT_BEAT|ROAR_ROARDMX_ETYPE_ON,           "beat-on"},
+ {ROAR_ROARDMX_EVENT_BEAT|ROAR_ROARDMX_ETYPE_HOLD,         "beat-hold"},
+ {ROAR_ROARDMX_EVENT_BEAT,                                 "beat"},
+ {ROAR_ROARDMX_EVENT_BLACKOUT|ROAR_ROARDMX_ETYPE_BEAT,     "blackout-beat"},
+ {ROAR_ROARDMX_EVENT_BLACKOUT|ROAR_ROARDMX_ETYPE_OFF,      "blackout-off"},
+ {ROAR_ROARDMX_EVENT_BLACKOUT|ROAR_ROARDMX_ETYPE_ON,       "blackout-on"},
+ {ROAR_ROARDMX_EVENT_BLACKOUT|ROAR_ROARDMX_ETYPE_HOLD,     "blackout-hold"},
+ {ROAR_ROARDMX_EVENT_BLACKOUT,                             "blackout"},
+ {ROAR_ROARDMX_EVENT_FULLON|ROAR_ROARDMX_ETYPE_BEAT,       "fullon-beat"},
+ {ROAR_ROARDMX_EVENT_FULLON|ROAR_ROARDMX_ETYPE_OFF,        "fullon-off"},
+ {ROAR_ROARDMX_EVENT_FULLON|ROAR_ROARDMX_ETYPE_ON,         "fullon-on"},
+ {ROAR_ROARDMX_EVENT_FULLON|ROAR_ROARDMX_ETYPE_HOLD,       "fullon-hold"},
+ {ROAR_ROARDMX_EVENT_FULLON,                               "fullon"},
+ {ROAR_ROARDMX_EVENT_FLASH|ROAR_ROARDMX_ETYPE_BEAT,        "flash-beat"},
+ {ROAR_ROARDMX_EVENT_FLASH|ROAR_ROARDMX_ETYPE_OFF,         "flash-off"},
+ {ROAR_ROARDMX_EVENT_FLASH|ROAR_ROARDMX_ETYPE_ON,          "flash-on"},
+ {ROAR_ROARDMX_EVENT_FLASH|ROAR_ROARDMX_ETYPE_HOLD,        "flash-hold"},
+ {ROAR_ROARDMX_EVENT_FLASH,                                "flash"},
+ {ROAR_ROARDMX_EVENT_STROBE|ROAR_ROARDMX_ETYPE_BEAT,       "strobe-beat"},
+ {ROAR_ROARDMX_EVENT_STROBE|ROAR_ROARDMX_ETYPE_OFF,        "strobe-off"},
+ {ROAR_ROARDMX_EVENT_STROBE|ROAR_ROARDMX_ETYPE_ON,         "strobe-on"},
+ {ROAR_ROARDMX_EVENT_STROBE|ROAR_ROARDMX_ETYPE_HOLD,       "strobe-hold"},
+ {ROAR_ROARDMX_EVENT_STROBE,                               "strobe"},
+ {ROAR_ROARDMX_EVENT_STROBEREADY|ROAR_ROARDMX_ETYPE_BEAT,  "strobeready-beat"},
+ {ROAR_ROARDMX_EVENT_STROBEREADY|ROAR_ROARDMX_ETYPE_OFF,   "strobeready-off"},
+ {ROAR_ROARDMX_EVENT_STROBEREADY|ROAR_ROARDMX_ETYPE_ON,    "strobeready-on"},
+ {ROAR_ROARDMX_EVENT_STROBEREADY|ROAR_ROARDMX_ETYPE_HOLD,  "strobeready-hold"},
+ {ROAR_ROARDMX_EVENT_STROBEREADY,                          "strobeready"},
+ {ROAR_ROARDMX_EVENT_STROBELOAD|ROAR_ROARDMX_ETYPE_BEAT,   "strobeload-beat"},
+ {ROAR_ROARDMX_EVENT_STROBELOAD|ROAR_ROARDMX_ETYPE_OFF,    "strobeload-off"},
+ {ROAR_ROARDMX_EVENT_STROBELOAD|ROAR_ROARDMX_ETYPE_ON,     "strobeload-on"},
+ {ROAR_ROARDMX_EVENT_STROBELOAD|ROAR_ROARDMX_ETYPE_HOLD,   "strobeload-hold"},
+ {ROAR_ROARDMX_EVENT_STROBELOAD,                           "strobeload"},
+ {ROAR_ROARDMX_EVENT_FOG|ROAR_ROARDMX_ETYPE_BEAT,          "fog-beat"},
+ {ROAR_ROARDMX_EVENT_FOG|ROAR_ROARDMX_ETYPE_OFF,           "fog-off"},
+ {ROAR_ROARDMX_EVENT_FOG|ROAR_ROARDMX_ETYPE_ON,            "fog-on"},
+ {ROAR_ROARDMX_EVENT_FOG|ROAR_ROARDMX_ETYPE_HOLD,          "fog-hold"},
+ {ROAR_ROARDMX_EVENT_FOG,                                  "fog"},
+ {ROAR_ROARDMX_EVENT_FOGREADY|ROAR_ROARDMX_ETYPE_BEAT,     "fogready-beat"},
+ {ROAR_ROARDMX_EVENT_FOGREADY|ROAR_ROARDMX_ETYPE_OFF,      "fogready-off"},
+ {ROAR_ROARDMX_EVENT_FOGREADY|ROAR_ROARDMX_ETYPE_ON,       "fogready-on"},
+ {ROAR_ROARDMX_EVENT_FOGREADY|ROAR_ROARDMX_ETYPE_HOLD,     "fogready-hold"},
+ {ROAR_ROARDMX_EVENT_FOGREADY,                             "fogready"},
+ {ROAR_ROARDMX_EVENT_FOGHEAT|ROAR_ROARDMX_ETYPE_BEAT,      "fogheat-beat"},
+ {ROAR_ROARDMX_EVENT_FOGHEAT|ROAR_ROARDMX_ETYPE_OFF,       "fogheat-off"},
+ {ROAR_ROARDMX_EVENT_FOGHEAT|ROAR_ROARDMX_ETYPE_ON,        "fogheat-on"},
+ {ROAR_ROARDMX_EVENT_FOGHEAT|ROAR_ROARDMX_ETYPE_HOLD,      "fogheat-hold"},
+ {ROAR_ROARDMX_EVENT_FOGHEAT,                              "fogheat"}
+};
+
+int roar_roardmx_str2event(const char * event) {
+ size_t i;
+
+ if ( event == NULL ) {
+  roar_err_set(ROAR_ERROR_FAULT);
+  return -1;
+ }
+
+ for (i = 0; i < (sizeof(__eventnames)/sizeof(*__eventnames)); i++)
+  if ( !strcasecmp(event, __eventnames[i].name) )
+   return __eventnames[i].id;
+
+ roar_err_set(ROAR_ERROR_NOENT);
+ return -1;
+}
+
+const char * roar_roardmx_event2str(const int event) {
+ size_t i;
+
+ for (i = 0; i < (sizeof(__eventnames)/sizeof(*__eventnames)); i++)
+  if ( __eventnames[i].id == event )
+   return __eventnames[i].name;
+
+ roar_err_set(ROAR_ERROR_NOENT);
+ return NULL;
+}
+
+// generic things:
 int roar_roardmx_message_new (struct roar_roardmx_message * mes) {
  BCHK(mes);
