summaryrefslogtreecommitdiffstats
path: root/ucad.c
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2017-10-12 10:22:36 +0200
committerMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2017-10-12 10:22:36 +0200
commit9badf033d3ecea4d3bde6bbbb2ac80f389b822ef (patch)
tree0b32d2680853b43ac0fc7d5b55d88ccf3f7ec11a /ucad.c
parent9694246130cd69c91b11a5002d8daaa854262f87 (diff)
downloaduca-net-9badf033d3ecea4d3bde6bbbb2ac80f389b822ef.tar.gz
uca-net-9badf033d3ecea4d3bde6bbbb2ac80f389b822ef.tar.bz2
uca-net-9badf033d3ecea4d3bde6bbbb2ac80f389b822ef.tar.xz
uca-net-9badf033d3ecea4d3bde6bbbb2ac80f389b822ef.zip
Send flag that denotes serialization validity
Before, we tried to install an existing property if the new property could not been serialized. Now, we always send a property description but denote if it is properly serialized.
Diffstat (limited to 'ucad.c')
-rw-r--r--ucad.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/ucad.c b/ucad.c
index 09f075c..d2fd300 100644
--- a/ucad.c
+++ b/ucad.c
@@ -105,7 +105,7 @@ prepare_error_reply (GError *error, UcaNetErrorReply *reply)
}
}
-static gboolean
+static void
serialize_param_spec (GParamSpec *pspec, UcaNetMessageProperty *prop)
{
strncpy (prop->name, g_param_spec_get_name (pspec), sizeof (prop->name));
@@ -114,6 +114,7 @@ serialize_param_spec (GParamSpec *pspec, UcaNetMessageProperty *prop)
prop->value_type = pspec->value_type;
prop->flags = pspec->flags;
+ prop->valid = TRUE;
if (g_type_is_a (pspec->value_type, G_TYPE_ENUM)) {
GEnumClass *enum_class;
@@ -163,12 +164,11 @@ serialize_param_spec (GParamSpec *pspec, UcaNetMessageProperty *prop)
break;
default:
g_warning ("Cannot serialize property %s", prop->name);
- return FALSE;
+ prop->valid = FALSE;
+ break;
}
#undef CASE_NUMERIC
-
- return TRUE;
}
static void
@@ -186,8 +186,8 @@ handle_get_properties_request (GSocketConnection *connection, UcaCamera *camera,
for (guint i = N_BASE_PROPERTIES - 1; i < num_properties; i++) {
UcaNetMessageProperty property;
- if (serialize_param_spec (pspecs[i], &property))
- send_reply (connection, &property, sizeof (property), error);
+ serialize_param_spec (pspecs[i], &property);
+ send_reply (connection, &property, sizeof (property), error);
}
g_free (pspecs);