Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Use new proplist in libngf client.
  • Loading branch information
Juho Hämäläinen committed Nov 29, 2012
1 parent 41f06c3 commit 23a42ac
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions libngf/client.c
Expand Up @@ -53,6 +53,7 @@ enum ValueType
VALUE_TYPE_UNKNOWN = 0,
VALUE_TYPE_STRING,
VALUE_TYPE_INTEGER,
VALUE_TYPE_UNSIGNED,
VALUE_TYPE_BOOLEAN
};

Expand Down Expand Up @@ -321,6 +322,9 @@ _parse_value_type (const char *type)
else if (strncmp (type, "integer", 7) == 0)
return VALUE_TYPE_INTEGER;

else if (strncmp (type, "unsigned", 8) == 0)
return VALUE_TYPE_UNSIGNED;

else if (strncmp (type, "boolean", 7) == 0)
return VALUE_TYPE_BOOLEAN;

Expand All @@ -335,7 +339,8 @@ _append_property (const char *key,
{
DBusMessageIter *iter = (DBusMessageIter*) userdata;
int value_type = VALUE_TYPE_UNKNOWN;
int number = 0;
int32_t integer_value = 0;
uint32_t unsigned_value = 0;

DBusMessageIter sub, ssub;

Expand All @@ -353,16 +358,23 @@ _append_property (const char *key,
break;

case VALUE_TYPE_INTEGER:
number = ngf_proplist_parse_integer (value);
ngf_proplist_parse_integer (value, &integer_value);
dbus_message_iter_open_container (&sub, DBUS_TYPE_VARIANT, DBUS_TYPE_INT32_AS_STRING, &ssub);
dbus_message_iter_append_basic (&ssub, DBUS_TYPE_INT32, &number);
dbus_message_iter_append_basic (&ssub, DBUS_TYPE_INT32, &integer_value);
dbus_message_iter_close_container (&sub, &ssub);
break;

case VALUE_TYPE_UNSIGNED:
ngf_proplist_parse_unsigned (value, &unsigned_value);
dbus_message_iter_open_container (&sub, DBUS_TYPE_VARIANT, DBUS_TYPE_UINT32_AS_STRING, &ssub);
dbus_message_iter_append_basic (&ssub, DBUS_TYPE_UINT32, &unsigned_value);
dbus_message_iter_close_container (&sub, &ssub);
break;

case VALUE_TYPE_BOOLEAN:
number = ngf_proplist_parse_boolean (value);
ngf_proplist_parse_boolean (value, &integer_value);
dbus_message_iter_open_container (&sub, DBUS_TYPE_VARIANT, DBUS_TYPE_BOOLEAN_AS_STRING, &ssub);
dbus_message_iter_append_basic (&ssub, DBUS_TYPE_BOOLEAN, &number);
dbus_message_iter_append_basic (&ssub, DBUS_TYPE_BOOLEAN, &integer_value);
dbus_message_iter_close_container (&sub, &ssub);
break;

Expand Down

0 comments on commit 23a42ac

Please sign in to comment.