summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2016-02-18 15:31:18 +0100
committerMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2016-02-18 15:31:18 +0100
commit127005ae839abd13c1ba53a719be0500f07fb610 (patch)
tree0fa6d7892a12d079f83c96a16d2f70bcfb5b5086
parent78ef5159fcc54dc8d4fa30a5949a8676e0d304c0 (diff)
downloaduca-net-127005ae839abd13c1ba53a719be0500f07fb610.tar.gz
uca-net-127005ae839abd13c1ba53a719be0500f07fb610.tar.bz2
uca-net-127005ae839abd13c1ba53a719be0500f07fb610.tar.xz
uca-net-127005ae839abd13c1ba53a719be0500f07fb610.zip
Support custom string properties
-rw-r--r--uca-net-camera.c4
-rw-r--r--uca-net-protocol.h3
-rw-r--r--ucad.c4
3 files changed, 11 insertions, 0 deletions
diff --git a/uca-net-camera.c b/uca-net-camera.c
index d9d561b..aefb175 100644
--- a/uca-net-camera.c
+++ b/uca-net-camera.c
@@ -469,6 +469,10 @@ deserialize_param_spec (UcaNetMessageProperty *prop)
return g_param_spec_boolean (prop->name, prop->nick, prop->blurb,
prop->spec.gboolean.default_value,
prop->flags);
+ case G_TYPE_STRING:
+ return g_param_spec_string (prop->name, prop->nick, prop->blurb,
+ prop->spec.gstring.default_value,
+ prop->flags);
CASE_NUMERIC (G_TYPE_INT, int)
CASE_NUMERIC (G_TYPE_UINT, uint)
CASE_NUMERIC (G_TYPE_FLOAT, float)
diff --git a/uca-net-protocol.h b/uca-net-protocol.h
index d8e07e6..de05aac 100644
--- a/uca-net-protocol.h
+++ b/uca-net-protocol.h
@@ -84,6 +84,9 @@ typedef struct {
struct {
gboolean default_value;
} gboolean;
+ struct {
+ gchar default_value[128];
+ } gstring;
NUMERIC_STRUCT (gint)
NUMERIC_STRUCT (guint)
NUMERIC_STRUCT (gfloat)
diff --git a/ucad.c b/ucad.c
index 490964a..02e2f95 100644
--- a/ucad.c
+++ b/ucad.c
@@ -124,6 +124,10 @@ serialize_param_spec (GParamSpec *pspec, UcaNetMessageProperty *prop)
case G_TYPE_BOOLEAN:
prop->spec.gboolean.default_value = ((GParamSpecBoolean *) pspec)->default_value;
break;
+ case G_TYPE_STRING:
+ strncpy (prop->spec.gstring.default_value, ((GParamSpecString *) pspec)->default_value,
+ sizeof (prop->spec.gstring.default_value));
+ break;
CASE_NUMERIC (G_TYPE_INT, gint, GParamSpecInt)
break;
CASE_NUMERIC (G_TYPE_UINT, guint, GParamSpecUInt)