diff options
-rw-r--r-- | uca-net-camera.c | 3 | ||||
-rw-r--r-- | uca-net-protocol.h | 4 | ||||
-rw-r--r-- | ucad.c | 6 |
3 files changed, 9 insertions, 4 deletions
diff --git a/uca-net-camera.c b/uca-net-camera.c index f265fc6..03e4996 100644 --- a/uca-net-camera.c +++ b/uca-net-camera.c @@ -491,8 +491,7 @@ deserialize_param_spec (UcaNetMessageProperty *prop) for (guint i = 0; i < prop->spec.genum.n_values; i++) { gchar *name; - name = g_strdup_printf ("%s_%i", prop->name, i); - + name = g_strdup (prop->spec.genum.value_names[i]); values[i].value = prop->spec.genum.values[i]; values[i].value_name = name; values[i].value_nick = name; diff --git a/uca-net-protocol.h b/uca-net-protocol.h index e3a827d..ee10b72 100644 --- a/uca-net-protocol.h +++ b/uca-net-protocol.h @@ -3,7 +3,8 @@ #include <gio/gio.h> -#define UCA_NET_MAX_ENUM_LENGTH 128 +#define UCA_NET_MAX_ENUM_LENGTH 32 +#define UCA_NET_MAX_ENUM_NAME_LENGTH 32 typedef enum { UCA_NET_MESSAGE_INVALID = 0, @@ -95,6 +96,7 @@ typedef struct { gint maximum; guint n_values; gint values[UCA_NET_MAX_ENUM_LENGTH]; + gchar value_names[UCA_NET_MAX_ENUM_LENGTH][UCA_NET_MAX_ENUM_NAME_LENGTH]; } genum; NUMERIC_STRUCT (gint) NUMERIC_STRUCT (gint64) @@ -134,8 +134,12 @@ serialize_param_spec (GParamSpec *pspec, UcaNetMessageProperty *prop) g_warning ("Cannot serialize all values of %s", prop->name); /* We do not transfer the enum value names (yet) ... */ - for (guint i = 0; i < MIN (enum_class->n_values, UCA_NET_MAX_ENUM_LENGTH); i++) + for (guint i = 0; i < MIN (enum_class->n_values, UCA_NET_MAX_ENUM_LENGTH); i++) { prop->spec.genum.values[i] = enum_class->values[i].value; + strncpy (prop->spec.genum.value_names[i], enum_class->values[i].value_name, + UCA_NET_MAX_ENUM_NAME_LENGTH); + g_print ("copied %s\n", prop->spec.genum.value_names[i]); + } return; } |