summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2018-06-19 10:10:20 +0200
committerMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2018-06-19 10:10:20 +0200
commit1d43a09135be31a2d68afa8e50a665c333ecb084 (patch)
tree4a23a2396e43491e56f629c80d4d10bf053ea97a
parent6e4c572d74f868e73b40a44fe0821153a34e5ea0 (diff)
downloaduca-net-1d43a09135be31a2d68afa8e50a665c333ecb084.tar.gz
uca-net-1d43a09135be31a2d68afa8e50a665c333ecb084.tar.bz2
uca-net-1d43a09135be31a2d68afa8e50a665c333ecb084.tar.xz
uca-net-1d43a09135be31a2d68afa8e50a665c333ecb084.zip
Fix #10: transmit enum value nick names
-rw-r--r--uca-net-camera.c7
-rw-r--r--uca-net-protocol.h1
-rw-r--r--ucad.c3
3 files changed, 6 insertions, 5 deletions
diff --git a/uca-net-camera.c b/uca-net-camera.c
index 2b0d913..657cccc 100644
--- a/uca-net-camera.c
+++ b/uca-net-camera.c
@@ -501,12 +501,9 @@ deserialize_param_spec (UcaNetMessageProperty *prop)
values = g_new0 (GEnumValue, prop->spec.genum.n_values + 1);
for (guint i = 0; i < prop->spec.genum.n_values; i++) {
- gchar *name;
-
- 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;
+ values[i].value_name = g_strdup (prop->spec.genum.value_names[i]);
+ values[i].value_nick = g_strdup (prop->spec.genum.value_nicks[i]);
}
type = g_enum_register_static (prop->name, values);
diff --git a/uca-net-protocol.h b/uca-net-protocol.h
index 5a7611c..be59973 100644
--- a/uca-net-protocol.h
+++ b/uca-net-protocol.h
@@ -97,6 +97,7 @@ typedef struct {
guint n_values;
gint values[UCA_NET_MAX_ENUM_LENGTH];
gchar value_names[UCA_NET_MAX_ENUM_LENGTH][UCA_NET_MAX_ENUM_NAME_LENGTH];
+ gchar value_nicks[UCA_NET_MAX_ENUM_LENGTH][UCA_NET_MAX_ENUM_NAME_LENGTH];
} genum;
NUMERIC_STRUCT (gint)
NUMERIC_STRUCT (gint64)
diff --git a/ucad.c b/ucad.c
index 6545b23..e56ee42 100644
--- a/ucad.c
+++ b/ucad.c
@@ -141,6 +141,9 @@ serialize_param_spec (GParamSpec *pspec, UcaNetMessageProperty *prop)
strncpy (prop->spec.genum.value_names[i], enum_class->values[i].value_name,
UCA_NET_MAX_ENUM_NAME_LENGTH);
+
+ strncpy (prop->spec.genum.value_nicks[i], enum_class->values[i].value_nick,
+ UCA_NET_MAX_ENUM_NAME_LENGTH);
}
return;