5 * Copyright (C) 2012 Intel Corporation. All rights reserved.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27 #include <dbus/dbus.h>
31 void dbus_property_append_basic(DBusMessageIter *iter,
32 const char *key, int type, void *val)
34 DBusMessageIter value;
35 const char *signature;
37 dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &key);
40 case DBUS_TYPE_BOOLEAN:
41 signature = DBUS_TYPE_BOOLEAN_AS_STRING;
43 case DBUS_TYPE_STRING:
44 signature = DBUS_TYPE_STRING_AS_STRING;
47 signature = DBUS_TYPE_BYTE_AS_STRING;
49 case DBUS_TYPE_UINT16:
50 signature = DBUS_TYPE_UINT16_AS_STRING;
53 signature = DBUS_TYPE_INT16_AS_STRING;
55 case DBUS_TYPE_UINT32:
56 signature = DBUS_TYPE_UINT32_AS_STRING;
59 signature = DBUS_TYPE_INT32_AS_STRING;
61 case DBUS_TYPE_UINT64:
62 signature = DBUS_TYPE_UINT64_AS_STRING;
65 signature = DBUS_TYPE_INT64_AS_STRING;
67 case DBUS_TYPE_OBJECT_PATH:
68 signature = DBUS_TYPE_OBJECT_PATH_AS_STRING;
71 signature = DBUS_TYPE_VARIANT_AS_STRING;
75 dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT,
77 dbus_message_iter_append_basic(&value, type, val);
78 dbus_message_iter_close_container(iter, &value);