summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/adapter.c71
-rw-r--r--src/dbus-common.c10
-rw-r--r--src/dbus-common.h10
-rw-r--r--src/dbus-hci.c19
-rw-r--r--src/device.c28
5 files changed, 61 insertions, 77 deletions
diff --git a/src/adapter.c b/src/adapter.c
index f0b60d49..24f0b3ae 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -823,10 +823,9 @@ static DBusMessage *set_discoverable_timeout(DBusConnection *conn,
path = dbus_message_get_path(msg);
- dbus_connection_emit_property_changed(conn, path,
- ADAPTER_INTERFACE,
- "DiscoverableTimeout",
- DBUS_TYPE_UINT32, &timeout);
+ emit_property_changed(conn, path,
+ ADAPTER_INTERFACE, "DiscoverableTimeout",
+ DBUS_TYPE_UINT32, &timeout);
return dbus_message_new_method_return(msg);
}
@@ -902,10 +901,8 @@ static DBusMessage *set_name(DBusConnection *conn, DBusMessage *msg,
path = dbus_message_get_path(msg);
- dbus_connection_emit_property_changed(conn, path,
- ADAPTER_INTERFACE,
- "Name", DBUS_TYPE_STRING,
- &name);
+ emit_property_changed(conn, path, ADAPTER_INTERFACE, "Name",
+ DBUS_TYPE_STRING, &name);
return dbus_message_new_method_return(msg);
}
@@ -1033,9 +1030,8 @@ static DBusMessage *remove_bonding(DBusConnection *conn, DBusMessage *msg,
const gchar *dev_path = device_get_path(device);
- dbus_connection_emit_property_changed(conn, dev_path,
- DEVICE_INTERFACE, "Paired",
- DBUS_TYPE_BOOLEAN, &paired);
+ emit_property_changed(conn, dev_path, DEVICE_INTERFACE,
+ "Paired", DBUS_TYPE_BOOLEAN, &paired);
}
proceed:
@@ -2434,22 +2430,20 @@ static void adapter_up(struct btd_adapter *adapter, int dd)
pmode = mode2str(adapter->mode);
- dbus_connection_emit_property_changed(connection, adapter->path,
- ADAPTER_INTERFACE, "Mode",
- DBUS_TYPE_STRING, &pmode);
+ emit_property_changed(connection, adapter->path, ADAPTER_INTERFACE,
+ "Mode", DBUS_TYPE_STRING, &pmode);
powered = adapter->scan_mode == SCAN_DISABLED ? FALSE : TRUE;
- dbus_connection_emit_property_changed(connection, adapter->path,
- ADAPTER_INTERFACE, "Powered",
- DBUS_TYPE_BOOLEAN, &powered);
+ emit_property_changed(connection, adapter->path, ADAPTER_INTERFACE,
+ "Powered", DBUS_TYPE_BOOLEAN, &powered);
discoverable = adapter->scan_mode == (SCAN_PAGE | SCAN_INQUIRY) ? TRUE
: FALSE;
- dbus_connection_emit_property_changed(connection, adapter->path,
- ADAPTER_INTERFACE, "Discoverable",
- DBUS_TYPE_BOOLEAN, &discoverable);
+ emit_property_changed(connection, adapter->path,
+ ADAPTER_INTERFACE, "Discoverable",
+ DBUS_TYPE_BOOLEAN, &discoverable);
load_drivers(adapter);
load_devices(adapter);
@@ -2663,20 +2657,18 @@ int adapter_stop(struct btd_adapter *adapter)
adapter->active_conn = NULL;
}
- dbus_connection_emit_property_changed(connection, adapter->path,
- ADAPTER_INTERFACE, "Mode",
- DBUS_TYPE_STRING, &mode);
+ emit_property_changed(connection, adapter->path, ADAPTER_INTERFACE,
+ "Mode", DBUS_TYPE_STRING, &mode);
powered = FALSE;
- dbus_connection_emit_property_changed(connection, adapter->path,
- ADAPTER_INTERFACE, "Powered",
- DBUS_TYPE_BOOLEAN, &powered);
+ emit_property_changed(connection, adapter->path, ADAPTER_INTERFACE,
+ "Powered", DBUS_TYPE_BOOLEAN, &powered);
if (adapter->scan_mode == (SCAN_PAGE | SCAN_INQUIRY)) {
discoverable = FALSE;
- dbus_connection_emit_property_changed(connection, adapter->path,
+ emit_property_changed(connection, adapter->path,
ADAPTER_INTERFACE, "Discoverable",
DBUS_TYPE_BOOLEAN, &discoverable);
}
@@ -2952,7 +2944,7 @@ void adapter_set_state(struct btd_adapter *adapter, int state)
adapter->oor_devices = NULL;
}
- dbus_connection_emit_property_changed(connection, path,
+ emit_property_changed(connection, path,
ADAPTER_INTERFACE, "Discovering",
DBUS_TYPE_BOOLEAN, &discov_active);
@@ -3125,19 +3117,18 @@ void adapter_mode_changed(struct btd_adapter *adapter, uint8_t scan_mode)
return;
}
- dbus_connection_emit_property_changed(connection, path,
- ADAPTER_INTERFACE, "Mode",
- DBUS_TYPE_STRING, &mode);
+ emit_property_changed(connection, path, ADAPTER_INTERFACE, "Mode",
+ DBUS_TYPE_STRING, &mode);
if (powered == FALSE || adapter->scan_mode == SCAN_DISABLED) {
- dbus_connection_emit_property_changed(connection, path,
- ADAPTER_INTERFACE, "Powered",
- DBUS_TYPE_BOOLEAN, &powered);
+ emit_property_changed(connection, path,
+ ADAPTER_INTERFACE, "Powered",
+ DBUS_TYPE_BOOLEAN, &powered);
}
- dbus_connection_emit_property_changed(connection, path,
- ADAPTER_INTERFACE, "Discoverable",
- DBUS_TYPE_BOOLEAN, &discoverable);
+ emit_property_changed(connection, path,
+ ADAPTER_INTERFACE, "Discoverable",
+ DBUS_TYPE_BOOLEAN, &discoverable);
adapter_set_scan_mode(adapter, scan_mode);
}
@@ -3378,8 +3369,8 @@ void adapter_update_devices(struct btd_adapter *adapter)
devices[i] = (char *) device_get_path(dev);
}
- dbus_connection_emit_property_changed(connection, adapter->path,
- ADAPTER_INTERFACE, "Devices",
- DBUS_TYPE_ARRAY, &devices);
+ emit_property_changed(connection, adapter->path,
+ ADAPTER_INTERFACE, "Devices",
+ DBUS_TYPE_ARRAY, &devices);
g_free(devices);
}
diff --git a/src/dbus-common.c b/src/dbus-common.c
index fdf384f2..89deccbf 100644
--- a/src/dbus-common.c
+++ b/src/dbus-common.c
@@ -347,11 +347,11 @@ void dict_append_array(DBusMessageIter *dict, const char *key, int type,
dbus_message_iter_close_container(dict, &entry);
}
-dbus_bool_t dbus_connection_emit_property_changed(DBusConnection *conn,
- const char *path,
- const char *interface,
- const char *name,
- int type, void *value)
+dbus_bool_t emit_property_changed(DBusConnection *conn,
+ const char *path,
+ const char *interface,
+ const char *name,
+ int type, void *value)
{
DBusMessage *signal;
DBusMessageIter iter;
diff --git a/src/dbus-common.h b/src/dbus-common.h
index 83f77191..3b758b9d 100644
--- a/src/dbus-common.h
+++ b/src/dbus-common.h
@@ -35,8 +35,8 @@ void dict_append_entry(DBusMessageIter *dict,
void dict_append_array(DBusMessageIter *dict, const char *key, int type,
void *val, int n_elements);
-dbus_bool_t dbus_connection_emit_property_changed(DBusConnection *conn,
- const char *path,
- const char *interface,
- const char *name,
- int type, void *value);
+dbus_bool_t emit_property_changed(DBusConnection *conn,
+ const char *path,
+ const char *interface,
+ const char *name,
+ int type, void *value);
diff --git a/src/dbus-hci.c b/src/dbus-hci.c
index 36aca477..9ee2e09b 100644
--- a/src/dbus-hci.c
+++ b/src/dbus-hci.c
@@ -1028,8 +1028,7 @@ void hcid_dbus_remote_class(bdaddr_t *local, bdaddr_t *peer, uint32_t class)
dev_path = device_get_path(device);
- dbus_connection_emit_property_changed(connection, dev_path,
- DEVICE_INTERFACE, "Class",
+ emit_property_changed(connection, dev_path, DEVICE_INTERFACE, "Class",
DBUS_TYPE_UINT32, &class);
}
@@ -1059,17 +1058,15 @@ void hcid_dbus_remote_name(bdaddr_t *local, bdaddr_t *peer, uint8_t status,
dev_path = device_get_path(device);
- dbus_connection_emit_property_changed(connection,
- dev_path, DEVICE_INTERFACE,
- "Name", DBUS_TYPE_STRING, &name);
+ emit_property_changed(connection, dev_path,
+ DEVICE_INTERFACE, "Name",
+ DBUS_TYPE_STRING, &name);
if (read_device_alias(srcaddr, dstaddr,
- alias, sizeof(alias)) < 1) {
-
- dbus_connection_emit_property_changed(connection,
- dev_path, DEVICE_INTERFACE,
- "Alias", DBUS_TYPE_STRING, &name);
- }
+ alias, sizeof(alias)) < 1)
+ emit_property_changed(connection, dev_path,
+ DEVICE_INTERFACE, "Alias",
+ DBUS_TYPE_STRING, &name);
}
}
diff --git a/src/device.c b/src/device.c
index 80d655f3..df9306eb 100644
--- a/src/device.c
+++ b/src/device.c
@@ -287,9 +287,9 @@ static DBusMessage *set_alias(DBusConnection *conn, DBusMessage *msg,
ERROR_INTERFACE ".Failed",
strerror(-err));
- dbus_connection_emit_property_changed(conn, dbus_message_get_path(msg),
- DEVICE_INTERFACE, "Alias",
- DBUS_TYPE_STRING, &alias);
+ emit_property_changed(conn, dbus_message_get_path(msg),
+ DEVICE_INTERFACE, "Alias",
+ DBUS_TYPE_STRING, &alias);
return dbus_message_new_method_return(msg);
}
@@ -309,9 +309,9 @@ static DBusMessage *set_trust(DBusConnection *conn, DBusMessage *msg,
write_trust(srcaddr, dstaddr, GLOBAL_TRUST, value);
- dbus_connection_emit_property_changed(conn, dbus_message_get_path(msg),
- DEVICE_INTERFACE, "Trusted",
- DBUS_TYPE_BOOLEAN, &value);
+ emit_property_changed(conn, dbus_message_get_path(msg),
+ DEVICE_INTERFACE, "Trusted",
+ DBUS_TYPE_BOOLEAN, &value);
return dbus_message_new_method_return(msg);
}
@@ -526,10 +526,8 @@ void device_set_connected(DBusConnection *conn, struct btd_device *device,
{
device->connected = connected;
- dbus_connection_emit_property_changed(conn, device->path,
- DEVICE_INTERFACE,
- "Connected", DBUS_TYPE_BOOLEAN,
- &connected);
+ emit_property_changed(conn, device->path, DEVICE_INTERFACE,
+ "Connected", DBUS_TYPE_BOOLEAN, &connected);
if (connected && device->secmode3) {
struct btd_adapter *adapter = device_get_adapter(device);
@@ -830,9 +828,8 @@ static void services_changed(struct btd_device *device)
for (i = 0, l = device->uuids; l; l = l->next, i++)
uuids[i] = l->data;
- dbus_connection_emit_property_changed(conn, device->path,
- DEVICE_INTERFACE, "UUIDs",
- DBUS_TYPE_ARRAY, &uuids);
+ emit_property_changed(conn, device->path, DEVICE_INTERFACE, "UUIDs",
+ DBUS_TYPE_ARRAY, &uuids);
g_free(uuids);
}
@@ -1301,9 +1298,8 @@ int device_set_paired(DBusConnection *conn, struct btd_device *device,
device_set_temporary(device, FALSE);
- dbus_connection_emit_property_changed(conn, device->path,
- DEVICE_INTERFACE, "Paired",
- DBUS_TYPE_BOOLEAN, &paired);
+ emit_property_changed(conn, device->path, DEVICE_INTERFACE, "Paired",
+ DBUS_TYPE_BOOLEAN, &paired);
/* If we were initiators start service discovery immediately.
* However if the other end was the initator wait a few seconds