summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrzej Kaczmarek <andrzej.kaczmarek@tieto.com>2012-09-19 12:22:05 +0200
committerJohan Hedberg <johan.hedberg@intel.com>2012-09-21 13:49:34 +0300
commitb9953680ea96c977b20dbb639883d5bba6e3a4ce (patch)
treed09115fb3faa8a26c5aec17b33a536bd3a199580
parentbe9a40bfc276b240530bc6b82d5bad7930c2ffee (diff)
downloadbluez-b9953680ea96c977b20dbb639883d5bba6e3a4ce.tar.gz
dbus-common: Remove conn parameter from emit_property_changed
Valid DBusConnection pointer is available static variable 'connection' so it's it's redundant to pass it as function parameter.
-rw-r--r--audio/control.c8
-rw-r--r--audio/device.c2
-rw-r--r--audio/gateway.c6
-rw-r--r--audio/headset.c18
-rw-r--r--audio/sink.c10
-rw-r--r--audio/source.c2
-rw-r--r--audio/transport.c8
-rw-r--r--profiles/health/hdp.c12
-rw-r--r--profiles/input/device.c10
-rw-r--r--profiles/network/connection.c12
-rw-r--r--profiles/proximity/immalert.c2
-rw-r--r--profiles/proximity/linkloss.c2
-rw-r--r--profiles/proximity/monitor.c21
-rw-r--r--profiles/sap/server.c8
-rw-r--r--profiles/thermometer/thermometer.c8
-rw-r--r--src/adapter.c34
-rw-r--r--src/dbus-common.c5
-rw-r--r--src/dbus-common.h3
-rw-r--r--src/device.c72
19 files changed, 118 insertions, 125 deletions
diff --git a/audio/control.c b/audio/control.c
index 5477c2d9e..02aea33a0 100644
--- a/audio/control.c
+++ b/audio/control.c
@@ -80,7 +80,7 @@ static void state_changed(struct audio_device *dev, avctp_state_t old_state,
g_dbus_emit_signal(dev->conn, dev->path,
AUDIO_CONTROL_INTERFACE,
"Disconnected", DBUS_TYPE_INVALID);
- emit_property_changed(dev->conn, dev->path,
+ emit_property_changed(dev->path,
AUDIO_CONTROL_INTERFACE, "Connected",
DBUS_TYPE_BOOLEAN, &value);
@@ -97,9 +97,9 @@ static void state_changed(struct audio_device *dev, avctp_state_t old_state,
g_dbus_emit_signal(dev->conn, dev->path,
AUDIO_CONTROL_INTERFACE, "Connected",
DBUS_TYPE_INVALID);
- emit_property_changed(dev->conn, dev->path,
- AUDIO_CONTROL_INTERFACE, "Connected",
- DBUS_TYPE_BOOLEAN, &value);
+ emit_property_changed(dev->path,
+ AUDIO_CONTROL_INTERFACE, "Connected",
+ DBUS_TYPE_BOOLEAN, &value);
break;
default:
return;
diff --git a/audio/device.c b/audio/device.c
index 4952b5734..b93a29483 100644
--- a/audio/device.c
+++ b/audio/device.c
@@ -280,7 +280,7 @@ static void device_set_state(struct audio_device *dev, audio_state_t new_state)
g_dbus_send_message(dev->conn, reply);
}
- emit_property_changed(dev->conn, dev->path,
+ emit_property_changed(dev->path,
AUDIO_INTERFACE, "State",
DBUS_TYPE_STRING, &state_str);
}
diff --git a/audio/gateway.c b/audio/gateway.c
index 53094af0e..0fe29d1ae 100644
--- a/audio/gateway.c
+++ b/audio/gateway.c
@@ -129,9 +129,9 @@ static void change_state(struct audio_device *dev, gateway_state_t new_state)
old_state = gw->state;
gw->state = new_state;
- emit_property_changed(dev->conn, dev->path,
- AUDIO_GATEWAY_INTERFACE, "State",
- DBUS_TYPE_STRING, &val);
+ emit_property_changed(dev->path,
+ AUDIO_GATEWAY_INTERFACE, "State",
+ DBUS_TYPE_STRING, &val);
for (l = gateway_callbacks; l != NULL; l = l->next) {
struct gateway_state_callback *cb = l->data;
diff --git a/audio/headset.c b/audio/headset.c
index 1ef6c491c..3ded18e24 100644
--- a/audio/headset.c
+++ b/audio/headset.c
@@ -988,7 +988,7 @@ static int headset_set_gain(struct audio_device *device, uint16_t gain, char typ
DBUS_TYPE_UINT16, &gain,
DBUS_TYPE_INVALID);
- emit_property_changed(device->conn, device->path,
+ emit_property_changed(device->path,
AUDIO_HEADSET_INTERFACE, property,
DBUS_TYPE_UINT16, &gain);
@@ -2343,7 +2343,7 @@ void headset_set_state(struct audio_device *dev, headset_state_t state)
value = FALSE;
close_sco(dev);
headset_close_rfcomm(dev);
- emit_property_changed(dev->conn, dev->path,
+ emit_property_changed(dev->path,
AUDIO_HEADSET_INTERFACE, "State",
DBUS_TYPE_STRING, &state_str);
g_dbus_emit_signal(dev->conn, dev->path,
@@ -2351,7 +2351,7 @@ void headset_set_state(struct audio_device *dev, headset_state_t state)
"Disconnected",
DBUS_TYPE_INVALID);
if (hs->state > HEADSET_STATE_CONNECTING) {
- emit_property_changed(dev->conn, dev->path,
+ emit_property_changed(dev->path,
AUDIO_HEADSET_INTERFACE, "Connected",
DBUS_TYPE_BOOLEAN, &value);
telephony_device_disconnected(dev);
@@ -2359,14 +2359,14 @@ void headset_set_state(struct audio_device *dev, headset_state_t state)
active_devices = g_slist_remove(active_devices, dev);
break;
case HEADSET_STATE_CONNECTING:
- emit_property_changed(dev->conn, dev->path,
+ emit_property_changed(dev->path,
AUDIO_HEADSET_INTERFACE, "State",
DBUS_TYPE_STRING, &state_str);
break;
case HEADSET_STATE_CONNECTED:
close_sco(dev);
if (hs->state != HEADSET_STATE_PLAY_IN_PROGRESS)
- emit_property_changed(dev->conn, dev->path,
+ emit_property_changed(dev->path,
AUDIO_HEADSET_INTERFACE, "State",
DBUS_TYPE_STRING, &state_str);
if (hs->state < state) {
@@ -2379,7 +2379,7 @@ void headset_set_state(struct audio_device *dev, headset_state_t state)
"Connected",
DBUS_TYPE_INVALID);
value = TRUE;
- emit_property_changed(dev->conn, dev->path,
+ emit_property_changed(dev->path,
AUDIO_HEADSET_INTERFACE,
"Connected",
DBUS_TYPE_BOOLEAN, &value);
@@ -2391,7 +2391,7 @@ void headset_set_state(struct audio_device *dev, headset_state_t state)
AUDIO_HEADSET_INTERFACE,
"Stopped",
DBUS_TYPE_INVALID);
- emit_property_changed(dev->conn, dev->path,
+ emit_property_changed(dev->path,
AUDIO_HEADSET_INTERFACE,
"Playing",
DBUS_TYPE_BOOLEAN, &value);
@@ -2401,7 +2401,7 @@ void headset_set_state(struct audio_device *dev, headset_state_t state)
break;
case HEADSET_STATE_PLAYING:
value = TRUE;
- emit_property_changed(dev->conn, dev->path,
+ emit_property_changed(dev->path,
AUDIO_HEADSET_INTERFACE, "State",
DBUS_TYPE_STRING, &state_str);
@@ -2414,7 +2414,7 @@ void headset_set_state(struct audio_device *dev, headset_state_t state)
g_dbus_emit_signal(dev->conn, dev->path,
AUDIO_HEADSET_INTERFACE, "Playing",
DBUS_TYPE_INVALID);
- emit_property_changed(dev->conn, dev->path,
+ emit_property_changed(dev->path,
AUDIO_HEADSET_INTERFACE, "Playing",
DBUS_TYPE_BOOLEAN, &value);
diff --git a/audio/sink.c b/audio/sink.c
index 53a0b80ce..6201d8579 100644
--- a/audio/sink.c
+++ b/audio/sink.c
@@ -116,7 +116,7 @@ static void sink_set_state(struct audio_device *dev, sink_state_t new_state)
state_str = state2str(new_state);
if (state_str)
- emit_property_changed(dev->conn, dev->path,
+ emit_property_changed(dev->path,
AUDIO_SINK_INTERFACE, "State",
DBUS_TYPE_STRING, &state_str);
@@ -147,7 +147,7 @@ static void avdtp_state_callback(struct audio_device *dev,
g_dbus_emit_signal(dev->conn, dev->path,
AUDIO_SINK_INTERFACE, "Disconnected",
DBUS_TYPE_INVALID);
- emit_property_changed(dev->conn, dev->path,
+ emit_property_changed(dev->path,
AUDIO_SINK_INTERFACE, "Connected",
DBUS_TYPE_BOOLEAN, &value);
}
@@ -218,7 +218,7 @@ static void stream_state_changed(struct avdtp_stream *stream,
AUDIO_SINK_INTERFACE,
"Connected",
DBUS_TYPE_INVALID);
- emit_property_changed(dev->conn, dev->path,
+ emit_property_changed(dev->path,
AUDIO_SINK_INTERFACE,
"Connected",
DBUS_TYPE_BOOLEAN, &value);
@@ -228,7 +228,7 @@ static void stream_state_changed(struct avdtp_stream *stream,
AUDIO_SINK_INTERFACE,
"Stopped",
DBUS_TYPE_INVALID);
- emit_property_changed(dev->conn, dev->path,
+ emit_property_changed(dev->path,
AUDIO_SINK_INTERFACE,
"Playing",
DBUS_TYPE_BOOLEAN, &value);
@@ -239,7 +239,7 @@ static void stream_state_changed(struct avdtp_stream *stream,
value = TRUE;
g_dbus_emit_signal(dev->conn, dev->path, AUDIO_SINK_INTERFACE,
"Playing", DBUS_TYPE_INVALID);
- emit_property_changed(dev->conn, dev->path,
+ emit_property_changed(dev->path,
AUDIO_SINK_INTERFACE, "Playing",
DBUS_TYPE_BOOLEAN, &value);
sink_set_state(dev, SINK_STATE_PLAYING);
diff --git a/audio/source.c b/audio/source.c
index e4ba21143..8e0166669 100644
--- a/audio/source.c
+++ b/audio/source.c
@@ -110,7 +110,7 @@ static void source_set_state(struct audio_device *dev, source_state_t new_state)
state_str = state2str(new_state);
if (state_str)
- emit_property_changed(dev->conn, dev->path,
+ emit_property_changed(dev->path,
AUDIO_SOURCE_INTERFACE, "State",
DBUS_TYPE_STRING, &state_str);
diff --git a/audio/transport.c b/audio/transport.c
index 281895e17..6541fc197 100644
--- a/audio/transport.c
+++ b/audio/transport.c
@@ -203,7 +203,7 @@ static void transport_set_state(struct media_transport *transport,
str = state2str(state);
if (g_strcmp0(str, state2str(old_state)) != 0)
- emit_property_changed(transport->conn, transport->path,
+ emit_property_changed(transport->path,
MEDIA_TRANSPORT_INTERFACE, "State",
DBUS_TYPE_STRING, &str);
}
@@ -1168,7 +1168,7 @@ static void headset_nrec_changed(struct audio_device *dev, gboolean nrec,
DBG("");
- emit_property_changed(transport->conn, transport->path,
+ emit_property_changed(transport->path,
MEDIA_TRANSPORT_INTERFACE, "NREC",
DBUS_TYPE_BOOLEAN, &nrec);
}
@@ -1367,7 +1367,7 @@ void media_transport_update_delay(struct media_transport *transport,
a2dp->delay = delay;
- emit_property_changed(transport->conn, transport->path,
+ emit_property_changed(transport->path,
MEDIA_TRANSPORT_INTERFACE, "Delay",
DBUS_TYPE_UINT16, &a2dp->delay);
}
@@ -1388,7 +1388,7 @@ void media_transport_update_volume(struct media_transport *transport,
a2dp->volume = volume;
- emit_property_changed(transport->conn, transport->path,
+ emit_property_changed(transport->path,
MEDIA_TRANSPORT_INTERFACE, "Volume",
DBUS_TYPE_UINT16, &a2dp->volume);
}
diff --git a/profiles/health/hdp.c b/profiles/health/hdp.c
index 5d62d3576..351fe1ee8 100644
--- a/profiles/health/hdp.c
+++ b/profiles/health/hdp.c
@@ -977,9 +977,9 @@ static void hdp_mcap_mdl_connected_cb(struct mcap_mdl *mdl, void *data)
dev->fr = hdp_channel_ref(chan);
- emit_property_changed(dev->conn, device_get_path(dev->dev),
- HEALTH_DEVICE, "MainChannel",
- DBUS_TYPE_OBJECT_PATH, &dev->fr->path);
+ emit_property_changed(device_get_path(dev->dev),
+ HEALTH_DEVICE, "MainChannel",
+ DBUS_TYPE_OBJECT_PATH, &dev->fr->path);
end:
hdp_channel_unref(dev->ndc);
@@ -1696,9 +1696,9 @@ static void hdp_mdl_conn_cb(struct mcap_mdl *mdl, GError *err, gpointer data)
dev->fr = hdp_channel_ref(hdp_chann);
- emit_property_changed(dev->conn, device_get_path(dev->dev),
- HEALTH_DEVICE, "MainChannel",
- DBUS_TYPE_OBJECT_PATH, &dev->fr->path);
+ emit_property_changed(device_get_path(dev->dev),
+ HEALTH_DEVICE, "MainChannel",
+ DBUS_TYPE_OBJECT_PATH, &dev->fr->path);
}
static void device_create_mdl_cb(struct mcap_mdl *mdl, uint8_t conf,
diff --git a/profiles/input/device.c b/profiles/input/device.c
index 1954b3455..dc3da8071 100644
--- a/profiles/input/device.c
+++ b/profiles/input/device.c
@@ -147,8 +147,9 @@ static gboolean intr_watch_cb(GIOChannel *chan, GIOCondition cond, gpointer data
if ((cond & (G_IO_HUP | G_IO_ERR)) && idev->ctrl_watch)
g_io_channel_shutdown(chan, TRUE, NULL);
- emit_property_changed(idev->conn, idev->path, INPUT_DEVICE_INTERFACE,
- "Connected", DBUS_TYPE_BOOLEAN, &connected);
+ emit_property_changed(idev->path,
+ INPUT_DEVICE_INTERFACE, "Connected",
+ DBUS_TYPE_BOOLEAN, &connected);
device_remove_disconnect_watch(idev->device, idev->dc_id);
idev->dc_id = 0;
@@ -492,8 +493,9 @@ static int input_device_connected(struct input_device *idev)
return err;
connected = TRUE;
- emit_property_changed(idev->conn, idev->path, INPUT_DEVICE_INTERFACE,
- "Connected", DBUS_TYPE_BOOLEAN, &connected);
+ emit_property_changed(idev->path,
+ INPUT_DEVICE_INTERFACE, "Connected",
+ DBUS_TYPE_BOOLEAN, &connected);
idev->dc_id = device_add_disconnect_watch(idev->device, disconnect_cb,
idev, NULL);
diff --git a/profiles/network/connection.c b/profiles/network/connection.c
index b81d5b5d6..178f51f45 100644
--- a/profiles/network/connection.c
+++ b/profiles/network/connection.c
@@ -119,13 +119,13 @@ static gboolean bnep_watchdog_cb(GIOChannel *chan, GIOCondition cond,
if (connection != NULL) {
gboolean connected = FALSE;
const char *property = "";
- emit_property_changed(connection, nc->peer->path,
+ emit_property_changed(nc->peer->path,
NETWORK_PEER_INTERFACE, "Connected",
DBUS_TYPE_BOOLEAN, &connected);
- emit_property_changed(connection, nc->peer->path,
+ emit_property_changed(nc->peer->path,
NETWORK_PEER_INTERFACE, "Interface",
DBUS_TYPE_STRING, &property);
- emit_property_changed(connection, nc->peer->path,
+ emit_property_changed(nc->peer->path,
NETWORK_PEER_INTERFACE, "UUID",
DBUS_TYPE_STRING, &property);
device_remove_disconnect_watch(nc->peer->device, nc->dc_id);
@@ -274,13 +274,13 @@ static gboolean bnep_setup_cb(GIOChannel *chan, GIOCondition cond,
DBUS_TYPE_INVALID);
connected = TRUE;
- emit_property_changed(connection, nc->peer->path,
+ emit_property_changed(nc->peer->path,
NETWORK_PEER_INTERFACE, "Connected",
DBUS_TYPE_BOOLEAN, &connected);
- emit_property_changed(connection, nc->peer->path,
+ emit_property_changed(nc->peer->path,
NETWORK_PEER_INTERFACE, "Interface",
DBUS_TYPE_STRING, &pdev);
- emit_property_changed(connection, nc->peer->path,
+ emit_property_changed(nc->peer->path,
NETWORK_PEER_INTERFACE, "UUID",
DBUS_TYPE_STRING, &uuid);
diff --git a/profiles/proximity/immalert.c b/profiles/proximity/immalert.c
index ebd788a90..59e4f12f9 100644
--- a/profiles/proximity/immalert.c
+++ b/profiles/proximity/immalert.c
@@ -136,7 +136,7 @@ static void imm_alert_emit_alert_signal(struct connected_device *condev,
DBG("alert %s remote %s", alert_level_str, path);
- emit_property_changed(btd_get_dbus_connection(), path,
+ emit_property_changed(path,
PROXIMITY_REPORTER_INTERFACE, "ImmediateAlertLevel",
DBUS_TYPE_STRING, &alert_level_str);
}
diff --git a/profiles/proximity/linkloss.c b/profiles/proximity/linkloss.c
index 37d1f86c9..659eaa8bb 100644
--- a/profiles/proximity/linkloss.c
+++ b/profiles/proximity/linkloss.c
@@ -137,7 +137,7 @@ static void link_loss_emit_alert_signal(struct connected_device *condev)
DBG("alert %s remote %s", alert_level_str, path);
- emit_property_changed(btd_get_dbus_connection(), path,
+ emit_property_changed(path,
PROXIMITY_REPORTER_INTERFACE, "LinkLossAlertLevel",
DBUS_TYPE_STRING, &alert_level_str);
}
diff --git a/profiles/proximity/monitor.c b/profiles/proximity/monitor.c
index a9de85b3c..a791916f2 100644
--- a/profiles/proximity/monitor.c
+++ b/profiles/proximity/monitor.c
@@ -160,7 +160,7 @@ static void linkloss_written(guint8 status, const guint8 *pdu, guint16 plen,
DBG("Link Loss Alert Level written");
- emit_property_changed(btd_get_dbus_connection(), path,
+ emit_property_changed(path,
PROXIMITY_INTERFACE, "LinkLossAlertLevel",
DBUS_TYPE_STRING, &monitor->linklosslevel);
}
@@ -289,10 +289,9 @@ static gboolean immediate_timeout(gpointer user_data)
g_free(monitor->immediatelevel);
monitor->immediatelevel = g_strdup("none");
- emit_property_changed(btd_get_dbus_connection(),
- path, PROXIMITY_INTERFACE,
- "ImmediateAlertLevel", DBUS_TYPE_STRING,
- &monitor->immediatelevel);
+ emit_property_changed(path,
+ PROXIMITY_INTERFACE, "ImmediateAlertLevel",
+ DBUS_TYPE_STRING, &monitor->immediatelevel);
return FALSE;
}
@@ -305,9 +304,8 @@ static void immediate_written(gpointer user_data)
g_free(monitor->fallbacklevel);
monitor->fallbacklevel = NULL;
- emit_property_changed(btd_get_dbus_connection(),
- path, PROXIMITY_INTERFACE,
- "ImmediateAlertLevel",
+ emit_property_changed(path,
+ PROXIMITY_INTERFACE, "ImmediateAlertLevel",
DBUS_TYPE_STRING, &monitor->immediatelevel);
monitor->immediateto = g_timeout_add_seconds(IMMEDIATE_TIMEOUT,
@@ -392,10 +390,9 @@ static void attio_disconnected_cb(gpointer user_data)
g_free(monitor->immediatelevel);
monitor->immediatelevel = g_strdup("none");
- emit_property_changed(btd_get_dbus_connection(),
- path, PROXIMITY_INTERFACE,
- "ImmediateAlertLevel", DBUS_TYPE_STRING,
- &monitor->immediatelevel);
+ emit_property_changed(path,
+ PROXIMITY_INTERFACE, "ImmediateAlertLevel",
+ DBUS_TYPE_STRING, &monitor->immediatelevel);
}
static gboolean level_is_valid(const char *level)
diff --git a/profiles/sap/server.c b/profiles/sap/server.c
index 78a63bf9e..fc3d83c3c 100644
--- a/profiles/sap/server.c
+++ b/profiles/sap/server.c
@@ -622,9 +622,9 @@ static void sap_set_connected(struct sap_server *server)
{
gboolean connected = TRUE;
- emit_property_changed(connection, server->path,
- SAP_SERVER_INTERFACE,
- "Connected", DBUS_TYPE_BOOLEAN, &connected);
+ emit_property_changed(server->path,
+ SAP_SERVER_INTERFACE, "Connected",
+ DBUS_TYPE_BOOLEAN, &connected);
server->conn->state = SAP_STATE_CONNECTED;
}
@@ -1149,7 +1149,7 @@ static void sap_io_destroy(void *data)
if (conn->state != SAP_STATE_CONNECT_IN_PROGRESS &&
conn->state != SAP_STATE_CONNECT_MODEM_BUSY)
- emit_property_changed(connection, server->path,
+ emit_property_changed(server->path,
SAP_SERVER_INTERFACE, "Connected",
DBUS_TYPE_BOOLEAN, &connected);
diff --git a/profiles/thermometer/thermometer.c b/profiles/thermometer/thermometer.c
index f58e55856..44043e881 100644
--- a/profiles/thermometer/thermometer.c
+++ b/profiles/thermometer/thermometer.c
@@ -265,7 +265,7 @@ static void change_property(struct thermometer *t, const char *name,
return;
t->intermediate = *intermediate;
- emit_property_changed(t->conn, device_get_path(t->dev),
+ emit_property_changed(device_get_path(t->dev),
THERMOMETER_INTERFACE, name,
DBUS_TYPE_BOOLEAN, &t->intermediate);
} else if (g_strcmp0(name, "Interval") == 0) {
@@ -275,7 +275,7 @@ static void change_property(struct thermometer *t, const char *name,
t->has_interval = TRUE;
t->interval = *interval;
- emit_property_changed(t->conn, device_get_path(t->dev),
+ emit_property_changed(device_get_path(t->dev),
THERMOMETER_INTERFACE, name,
DBUS_TYPE_UINT16, &t->interval);
} else if (g_strcmp0(name, "Maximum") == 0) {
@@ -284,7 +284,7 @@ static void change_property(struct thermometer *t, const char *name,
return;
t->max = *max;
- emit_property_changed(t->conn, device_get_path(t->dev),
+ emit_property_changed(device_get_path(t->dev),
THERMOMETER_INTERFACE, name,
DBUS_TYPE_UINT16, &t->max);
} else if (g_strcmp0(name, "Minimum") == 0) {
@@ -293,7 +293,7 @@ static void change_property(struct thermometer *t, const char *name,
return;
t->min = *min;
- emit_property_changed(t->conn, device_get_path(t->dev),
+ emit_property_changed(device_get_path(t->dev),
THERMOMETER_INTERFACE, name,
DBUS_TYPE_UINT16, &t->min);
} else
diff --git a/src/adapter.c b/src/adapter.c
index 06ba78ce9..4f27b35ec 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -430,7 +430,7 @@ void btd_adapter_pairable_changed(struct btd_adapter *adapter,
write_device_pairable(&adapter->bdaddr, pairable);
- emit_property_changed(connection, adapter->path,
+ emit_property_changed(adapter->path,
ADAPTER_INTERFACE, "Pairable",
DBUS_TYPE_BOOLEAN, &pairable);
@@ -654,7 +654,7 @@ static DBusMessage *set_discoverable_timeout(DBusConnection *conn,
path = dbus_message_get_path(msg);
- emit_property_changed(conn, path,
+ emit_property_changed(path,
ADAPTER_INTERFACE, "DiscoverableTimeout",
DBUS_TYPE_UINT32, &timeout);
@@ -681,7 +681,7 @@ static DBusMessage *set_pairable_timeout(DBusConnection *conn,
path = dbus_message_get_path(msg);
- emit_property_changed(conn, path,
+ emit_property_changed(path,
ADAPTER_INTERFACE, "PairableTimeout",
DBUS_TYPE_UINT32, &timeout);
@@ -711,7 +711,7 @@ void btd_adapter_class_changed(struct btd_adapter *adapter, uint8_t *new_class)
attrib_gap_set(adapter, GATT_CHARAC_APPEARANCE, cls, 2);
}
- emit_property_changed(connection, adapter->path,
+ emit_property_changed(adapter->path,
ADAPTER_INTERFACE, "Class",
DBUS_TYPE_UINT32, &class);
}
@@ -724,8 +724,7 @@ void adapter_name_changed(struct btd_adapter *adapter, const char *name)
g_free(adapter->name);
adapter->name = g_strdup(name);
- if (connection)
- emit_property_changed(connection, adapter->path,
+ emit_property_changed(adapter->path,
ADAPTER_INTERFACE, "Name",
DBUS_TYPE_STRING, &name);
@@ -2250,9 +2249,9 @@ void btd_adapter_start(struct btd_adapter *adapter)
adapter->mode = MODE_CONNECTABLE;
powered = TRUE;
- emit_property_changed(connection, adapter->path,
- ADAPTER_INTERFACE, "Powered",
- DBUS_TYPE_BOOLEAN, &powered);
+ emit_property_changed(adapter->path,
+ ADAPTER_INTERFACE, "Powered",
+ DBUS_TYPE_BOOLEAN, &powered);
call_adapter_powered_callbacks(adapter, TRUE);
@@ -2373,22 +2372,23 @@ int btd_adapter_stop(struct btd_adapter *adapter)
}
if (adapter->scan_mode == (SCAN_PAGE | SCAN_INQUIRY))
- emit_property_changed(connection, adapter->path,
+ emit_property_changed(adapter->path,
ADAPTER_INTERFACE, "Discoverable",
DBUS_TYPE_BOOLEAN, &prop_false);
if ((adapter->scan_mode & SCAN_PAGE) && adapter->pairable == TRUE)
- emit_property_changed(connection, adapter->path,
+ emit_property_changed(adapter->path,
ADAPTER_INTERFACE, "Pairable",
DBUS_TYPE_BOOLEAN, &prop_false);
if (adapter->discovering)
- emit_property_changed(connection, adapter->path,
+ emit_property_changed(adapter->path,
ADAPTER_INTERFACE, "Discovering",
DBUS_TYPE_BOOLEAN, &prop_false);
- emit_property_changed(connection, adapter->path, ADAPTER_INTERFACE,
- "Powered", DBUS_TYPE_BOOLEAN, &prop_false);
+ emit_property_changed(adapter->path,
+ ADAPTER_INTERFACE, "Powered",
+ DBUS_TYPE_BOOLEAN, &prop_false);
adapter->discovering = FALSE;
adapter->scan_mode = SCAN_DISABLED;
@@ -2583,7 +2583,7 @@ void adapter_set_discovering(struct btd_adapter *adapter,
adapter->discovering = discovering;
- emit_property_changed(connection, path,
+ emit_property_changed(path,
ADAPTER_INTERFACE, "Discovering",
DBUS_TYPE_BOOLEAN, &discovering);
@@ -3063,11 +3063,11 @@ void adapter_mode_changed(struct btd_adapter *adapter, uint8_t scan_mode)
/* If page scanning gets toggled emit the Pairable property */
if ((adapter->scan_mode & SCAN_PAGE) != (scan_mode & SCAN_PAGE))
- emit_property_changed(connection, adapter->path,
+ emit_property_changed(adapter->path,
ADAPTER_INTERFACE, "Pairable",
DBUS_TYPE_BOOLEAN, &pairable);
- emit_property_changed(connection, path,
+ emit_property_changed(path,
ADAPTER_INTERFACE, "Discoverable",
DBUS_TYPE_BOOLEAN, &discoverable);
diff --git a/src/dbus-common.c b/src/dbus-common.c
index f7e9e8fe1..21395d9d7 100644
--- a/src/dbus-common.c
+++ b/src/dbus-common.c
@@ -118,8 +118,7 @@ void dict_append_array(DBusMessageIter *dict, const char *key, int type,
dbus_message_iter_close_container(dict, &entry);
}
-dbus_bool_t emit_property_changed(DBusConnection *conn,
- const char *path,
+dbus_bool_t emit_property_changed(const char *path,
const char *interface,
const char *name,
int type, void *value)
@@ -141,7 +140,7 @@ dbus_bool_t emit_property_changed(DBusConnection *conn,
append_variant(&iter, type, value);
- return g_dbus_send_message(conn, signal);
+ return g_dbus_send_message(connection, signal);
}
dbus_bool_t emit_array_property_changed(DBusConnection *conn,
diff --git a/src/dbus-common.h b/src/dbus-common.h
index 127cf9c61..ff130ffb1 100644
--- a/src/dbus-common.h
+++ b/src/dbus-common.h
@@ -29,8 +29,7 @@ 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 emit_property_changed(DBusConnection *conn,
- const char *path,
+dbus_bool_t emit_property_changed(const char *path,
const char *interface,
const char *name,
int type, void *value);
diff --git a/src/device.c b/src/device.c
index a5b9e7a2f..dd5dcc240 100644
--- a/src/device.c
+++ b/src/device.c
@@ -461,7 +461,7 @@ static DBusMessage *set_alias(DBusConnection *conn, DBusMessage *msg,
g_free(device->alias);
device->alias = g_str_equal(alias, "") ? NULL : g_strdup(alias);
- emit_property_changed(conn, dbus_message_get_path(msg),
+ emit_property_changed(dbus_message_get_path(msg),
DEVICE_INTERFACE, "Alias",
DBUS_TYPE_STRING, &alias);
@@ -490,7 +490,7 @@ static DBusMessage *set_trust(DBusConnection *conn, DBusMessage *msg,
device->trusted = value;
- emit_property_changed(conn, dbus_message_get_path(msg),
+ emit_property_changed(dbus_message_get_path(msg),
DEVICE_INTERFACE, "Trusted",
DBUS_TYPE_BOOLEAN, &value);
@@ -548,8 +548,9 @@ int device_block(DBusConnection *conn, struct btd_device *device,
device_set_temporary(device, FALSE);
- emit_property_changed(conn, device->path, DEVICE_INTERFACE, "Blocked",
- DBUS_TYPE_BOOLEAN, &device->blocked);
+ emit_property_changed(device->path,
+ DEVICE_INTERFACE, "Blocked",
+ DBUS_TYPE_BOOLEAN, &device->blocked);
return 0;
}
@@ -579,7 +580,7 @@ int device_unblock(DBusConnection *conn, struct btd_device *device,
error("write_blocked(): %s (%d)", strerror(-err), -err);
if (!silent) {
- emit_property_changed(conn, device->path,
+ emit_property_changed(device->path,
DEVICE_INTERFACE, "Blocked",
DBUS_TYPE_BOOLEAN, &device->blocked);
device_probe_profiles(device, device->uuids);
@@ -912,7 +913,7 @@ void device_add_connection(struct btd_device *device, DBusConnection *conn)
device->connected = TRUE;
- emit_property_changed(conn, device->path,
+ emit_property_changed(device->path,
DEVICE_INTERFACE, "Connected",
DBUS_TYPE_BOOLEAN, &device->connected);
}
@@ -943,9 +944,9 @@ void device_remove_connection(struct btd_device *device, DBusConnection *conn)
if (device_is_paired(device) && !device_is_bonded(device))
device_set_paired(device, FALSE);
- emit_property_changed(conn, device->path,
- DEVICE_INTERFACE, "Connected",
- DBUS_TYPE_BOOLEAN, &device->connected);
+ emit_property_changed(device->path,
+ DEVICE_INTERFACE, "Connected",
+ DBUS_TYPE_BOOLEAN, &device->connected);
}
guint device_add_disconnect_watch(struct btd_device *device,
@@ -986,53 +987,49 @@ void device_remove_disconnect_watch(struct btd_device *device, guint id)
static void device_set_vendor(struct btd_device *device, uint16_t value)
{
- DBusConnection *conn = btd_get_dbus_connection();
-
if (device->vendor == value)
return;
device->vendor = value;
- emit_property_changed(conn, device->path, DEVICE_INTERFACE, "Vendor",
+ emit_property_changed(device->path,
+ DEVICE_INTERFACE, "Vendor",
DBUS_TYPE_UINT16, &value);
}
static void device_set_vendor_src(struct btd_device *device, uint16_t value)
{
- DBusConnection *conn = btd_get_dbus_connection();
-
if (device->vendor_src == value)
return;
device->vendor_src = value;
- emit_property_changed(conn, device->path, DEVICE_INTERFACE,
- "VendorSource", DBUS_TYPE_UINT16, &value);
+ emit_property_changed(device->path,
+ DEVICE_INTERFACE, "VendorSource",
+ DBUS_TYPE_UINT16, &value);
}
static void device_set_product(struct btd_device *device, uint16_t value)
{
- DBusConnection *conn = btd_get_dbus_connection();
-
if (device->product == value)
return;
device->product = value;
- emit_property_changed(conn, device->path, DEVICE_INTERFACE, "Product",
+ emit_property_changed(device->path,
+ DEVICE_INTERFACE, "Product",
DBUS_TYPE_UINT16, &value);
}
static void device_set_version(struct btd_device *device, uint16_t value)
{
- DBusConnection *conn = btd_get_dbus_connection();
-
if (device->version == value)
return;
device->version = value;
- emit_property_changed(conn, device->path, DEVICE_INTERFACE, "Version",
+ emit_property_changed(device->path,
+ DEVICE_INTERFACE, "Version",
DBUS_TYPE_UINT16, &value);
}
@@ -1104,21 +1101,19 @@ struct btd_device *device_create(DBusConnection *conn,
void device_set_name(struct btd_device *device, const char *name)
{
- DBusConnection *conn = btd_get_dbus_connection();
-
if (strncmp(name, device->name, MAX_NAME_LENGTH) == 0)
return;
strncpy(device->name, name, MAX_NAME_LENGTH);
- emit_property_changed(conn, device->path,
+ emit_property_changed(device->path,
DEVICE_INTERFACE, "Name",
DBUS_TYPE_STRING, &name);
if (device->alias != NULL)
return;
- emit_property_changed(conn, device->path,
+ emit_property_changed(device->path,
DEVICE_INTERFACE, "Alias",
DBUS_TYPE_STRING, &name);
}
@@ -2324,8 +2319,6 @@ static void bonding_request_free(struct bonding_req *bonding)
void device_set_paired(struct btd_device *device, gboolean value)
{
- DBusConnection *conn = btd_get_dbus_connection();
-
if (device->paired == value)
return;
@@ -2335,7 +2328,8 @@ void device_set_paired(struct btd_device *device, gboolean value)
device->paired = value;
- emit_property_changed(conn, device->path, DEVICE_INTERFACE, "Paired",
+ emit_property_changed(device->path,
+ DEVICE_INTERFACE, "Paired",
DBUS_TYPE_BOOLEAN, &value);
}
@@ -3055,15 +3049,16 @@ void btd_device_unref(struct btd_device *device)
void device_set_class(struct btd_device *device, uint32_t value)
{
- DBusConnection *conn = btd_get_dbus_connection();
const char *icon = class_to_icon(value);
- emit_property_changed(conn, device->path, DEVICE_INTERFACE, "Class",
+ emit_property_changed(device->path,
+ DEVICE_INTERFACE, "Class",
DBUS_TYPE_UINT32, &value);
if (icon)
- emit_property_changed(conn, device->path, DEVICE_INTERFACE,
- "Icon", DBUS_TYPE_STRING, &icon);
+ emit_property_changed(device->path,
+ DEVICE_INTERFACE, "Icon",
+ DBUS_TYPE_STRING, &icon);
}
int device_get_appearance(struct btd_device *device, uint16_t *value)
@@ -3087,16 +3082,17 @@ int device_get_appearance(struct btd_device *device, uint16_t *value)
void device_set_appearance(struct btd_device *device, uint16_t value)
{
- DBusConnection *conn = btd_get_dbus_connection();
const char *icon = gap_appearance_to_icon(value);
bdaddr_t src;
- emit_property_changed(conn, device->path, DEVICE_INTERFACE,
- "Appearance", DBUS_TYPE_UINT16, &value);
+ emit_property_changed(device->path,
+ DEVICE_INTERFACE, "Appearance",
+ DBUS_TYPE_UINT16, &value);
if (icon)
- emit_property_changed(conn, device->path, DEVICE_INTERFACE,
- "Icon", DBUS_TYPE_STRING, &icon);
+ emit_property_changed(device->path,
+ DEVICE_INTERFACE, "Icon",
+ DBUS_TYPE_STRING, &icon);
adapter_get_address(device_get_adapter(device), &src);
write_remote_appearance(&src, &device->bdaddr, device->bdaddr_type,