From 691b249776d2fd11e4d7e72a9e1982c110277a64 Mon Sep 17 00:00:00 2001 From: Adam Sutton Date: Mon, 10 Jun 2013 13:42:28 +0100 Subject: [PATCH] idnode prop: added support for str_enum This allows classes to define enumerated types, such as required for the DVB FE configuration. --- src/prop.c | 9 +++++++++ src/prop.h | 2 ++ 2 files changed, 11 insertions(+) diff --git a/src/prop.c b/src/prop.c index 48c8edaf..f791199c 100644 --- a/src/prop.c +++ b/src/prop.c @@ -164,6 +164,15 @@ prop_add_params_to_msg(void *obj, const property_t *p, htsmsg_t *msg) htsmsg_add_u32(m, "rdonly", 1); if (p->options & PO_NOSAVE) htsmsg_add_u32(m, "nosave", 1); + if (p[i].type == PT_STR && p[i].str_enum) { + htsmsg_t *l = htsmsg_create_list(); + const char **e = p[i].str_enum(obj); + while (*e) { + htsmsg_add_str(l, NULL, *e); + e++; + } + htsmsg_add_msg(m, "enum", l); + } if (obj) prop_read_value(obj, p+i, m, "value"); htsmsg_add_msg(msg, NULL, m); diff --git a/src/prop.h b/src/prop.h index a0083c85..13e9e9ff 100644 --- a/src/prop.h +++ b/src/prop.h @@ -14,6 +14,7 @@ typedef enum { #define PO_NONE 0x0 #define PO_RDONLY 0x1 // Note: if this is changed, change PROPDEF2 #define PO_NOSAVE 0x2 +#define PO_WRONCE 0x4 typedef struct property { const char *id; @@ -24,6 +25,7 @@ typedef struct property { const char *(*str_get)(void *ptr); void (*str_set)(void *ptr, const char *str); + const char **(*str_enum)(void *ptr); void (*notify)(void *ptr);