summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/adapter.c23
-rw-r--r--src/dbus-common.c4
-rw-r--r--src/dbus-common.h4
-rw-r--r--src/dbus-hci.c2
-rw-r--r--src/device.c29
5 files changed, 23 insertions, 39 deletions
diff --git a/src/adapter.c b/src/adapter.c
index 39d5f9c1..9cd26b08 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -1582,38 +1582,33 @@ static DBusMessage *get_properties(DBusConnection *conn,
/* Address */
property = srcaddr;
- dbus_message_iter_append_dict_entry(&dict, "Address",
- DBUS_TYPE_STRING, &property);
+ dict_append_entry(&dict, "Address", DBUS_TYPE_STRING, &property);
/* Name */
memset(str, 0, sizeof(str));
strncpy(str, (char *) adapter->dev.name, 248);
property = str;
- dbus_message_iter_append_dict_entry(&dict, "Name",
- DBUS_TYPE_STRING, &property);
+ dict_append_entry(&dict, "Name", DBUS_TYPE_STRING, &property);
/* Mode */
property = mode2str(adapter->mode);
- dbus_message_iter_append_dict_entry(&dict, "Mode",
- DBUS_TYPE_STRING, &property);
+ dict_append_entry(&dict, "Mode", DBUS_TYPE_STRING, &property);
/* Powered */
if (main_opts.offmode == HCID_OFFMODE_DEVDOWN)
value = adapter->up ? TRUE : FALSE;
else
value = adapter->scan_mode == SCAN_DISABLED ? FALSE : TRUE;
- dbus_message_iter_append_dict_entry(&dict, "Powered",
- DBUS_TYPE_BOOLEAN, &value);
+ dict_append_entry(&dict, "Powered", DBUS_TYPE_BOOLEAN, &value);
/* Discoverable */
value = adapter->scan_mode & SCAN_INQUIRY ? TRUE : FALSE;
- dbus_message_iter_append_dict_entry(&dict, "Discoverable",
- DBUS_TYPE_BOOLEAN, &value);
+ dict_append_entry(&dict, "Discoverable", DBUS_TYPE_BOOLEAN, &value);
/* DiscoverableTimeout */
- dbus_message_iter_append_dict_entry(&dict, "DiscoverableTimeout",
+ dict_append_entry(&dict, "DiscoverableTimeout",
DBUS_TYPE_UINT32, &adapter->discov_timeout);
if (adapter->state & PERIODIC_INQUIRY || adapter->state & STD_INQUIRY)
@@ -1622,8 +1617,7 @@ static DBusMessage *get_properties(DBusConnection *conn,
value = FALSE;
/* Discovering */
- dbus_message_iter_append_dict_entry(&dict, "Discovering",
- DBUS_TYPE_BOOLEAN, &value);
+ dict_append_entry(&dict, "Discovering", DBUS_TYPE_BOOLEAN, &value);
/* Devices */
devices = g_new0(char *, g_slist_length(adapter->devices) + 1);
@@ -1631,8 +1625,7 @@ static DBusMessage *get_properties(DBusConnection *conn,
struct btd_device *dev = l->data;
devices[i] = (char *) device_get_path(dev);
}
- dbus_message_iter_append_dict_entry(&dict, "Devices",
- DBUS_TYPE_ARRAY, &devices);
+ dict_append_entry(&dict, "Devices", DBUS_TYPE_ARRAY, &devices);
g_free(devices);
dbus_message_iter_close_container(&iter, &dict);
diff --git a/src/dbus-common.c b/src/dbus-common.c
index 5d04b481..a27d99a3 100644
--- a/src/dbus-common.c
+++ b/src/dbus-common.c
@@ -295,8 +295,8 @@ static void dbus_message_iter_append_variant(DBusMessageIter *iter,
dbus_message_iter_close_container(iter, &value);
}
-void dbus_message_iter_append_dict_entry(DBusMessageIter *dict,
- const char *key, int type, void *val)
+void dict_append_entry(DBusMessageIter *dict,
+ const char *key, int type, void *val)
{
DBusMessageIter entry;
diff --git a/src/dbus-common.h b/src/dbus-common.h
index 5431b701..82438eca 100644
--- a/src/dbus-common.h
+++ b/src/dbus-common.h
@@ -30,8 +30,8 @@ void hcid_dbus_exit(void);
int hcid_dbus_init(void);
void hcid_dbus_unregister(void);
-void dbus_message_iter_append_dict_entry(DBusMessageIter *dict,
- const char *key, int type, void *val);
+void dict_append_entry(DBusMessageIter *dict,
+ const char *key, int type, void *val);
dbus_bool_t dbus_connection_emit_property_changed(DBusConnection *conn,
const char *path,
diff --git a/src/dbus-hci.c b/src/dbus-hci.c
index 3abf6bdc..36aca477 100644
--- a/src/dbus-hci.c
+++ b/src/dbus-hci.c
@@ -849,7 +849,7 @@ static void append_dict_valist(DBusMessageIter *iter,
while (key) {
type = va_arg(var_args, int);
val = va_arg(var_args, void *);
- dbus_message_iter_append_dict_entry(&dict, key, type, val);
+ dict_append_entry(&dict, key, type, val);
key = va_arg(var_args, char *);
}
diff --git a/src/device.c b/src/device.c
index 2a48406f..729a846c 100644
--- a/src/device.c
+++ b/src/device.c
@@ -197,8 +197,7 @@ static DBusMessage *get_properties(DBusConnection *conn,
/* Address */
ptr = dstaddr;
- dbus_message_iter_append_dict_entry(&dict, "Address",
- DBUS_TYPE_STRING, &ptr);
+ dict_append_entry(&dict, "Address", DBUS_TYPE_STRING, &ptr);
/* Name */
ptr = NULL;
@@ -208,8 +207,7 @@ static DBusMessage *get_properties(DBusConnection *conn,
if (read_device_name(srcaddr, dstaddr, name) == 0) {
ptr = name;
- dbus_message_iter_append_dict_entry(&dict, "Name",
- DBUS_TYPE_STRING, &ptr);
+ dict_append_entry(&dict, "Name", DBUS_TYPE_STRING, &ptr);
}
/* Alias (fallback to name or address) */
@@ -222,30 +220,26 @@ static DBusMessage *get_properties(DBusConnection *conn,
ptr = name;
if (ptr)
- dbus_message_iter_append_dict_entry(&dict, "Alias",
- DBUS_TYPE_STRING, &ptr);
+ dict_append_entry(&dict, "Alias", DBUS_TYPE_STRING, &ptr);
/* Class */
if (read_remote_class(&src, &device->bdaddr, &class) == 0) {
const char *icon = class_to_icon(class);
- dbus_message_iter_append_dict_entry(&dict, "Class",
- DBUS_TYPE_UINT32, &class);
+ dict_append_entry(&dict, "Class", DBUS_TYPE_UINT32, &class);
if (icon)
- dbus_message_iter_append_dict_entry(&dict, "Icon",
+ dict_append_entry(&dict, "Icon",
DBUS_TYPE_STRING, &icon);
}
/* Paired */
boolean = device_is_paired(device);
- dbus_message_iter_append_dict_entry(&dict, "Paired",
- DBUS_TYPE_BOOLEAN, &boolean);
+ dict_append_entry(&dict, "Paired", DBUS_TYPE_BOOLEAN, &boolean);
/* Trusted */
boolean = read_trust(&src, dstaddr, GLOBAL_TRUST);
- dbus_message_iter_append_dict_entry(&dict, "Trusted",
- DBUS_TYPE_BOOLEAN, &boolean);
+ dict_append_entry(&dict, "Trusted", DBUS_TYPE_BOOLEAN, &boolean);
/* Connected */
dev = adapter_search_active_conn_by_bdaddr(adapter, &device->bdaddr);
@@ -254,21 +248,18 @@ static DBusMessage *get_properties(DBusConnection *conn,
else
boolean = FALSE;
- dbus_message_iter_append_dict_entry(&dict, "Connected",
- DBUS_TYPE_BOOLEAN, &boolean);
+ dict_append_entry(&dict, "Connected", DBUS_TYPE_BOOLEAN, &boolean);
/* UUIDs */
uuids = g_new0(char *, g_slist_length(device->uuids) + 1);
for (i = 0, l = device->uuids; l; l = l->next, i++)
uuids[i] = l->data;
- dbus_message_iter_append_dict_entry(&dict, "UUIDs",
- DBUS_TYPE_ARRAY, &uuids);
+ dict_append_entry(&dict, "UUIDs", DBUS_TYPE_ARRAY, &uuids);
g_free(uuids);
/* Adapter */
ptr = adapter_get_path(adapter);
- dbus_message_iter_append_dict_entry(&dict, "Adapter",
- DBUS_TYPE_OBJECT_PATH, &ptr);
+ dict_append_entry(&dict, "Adapter", DBUS_TYPE_OBJECT_PATH, &ptr);
dbus_message_iter_close_container(&iter, &dict);