diff --git a/audio/control.c b/audio/control.c
index 5477c2d..02aea33 100644
--- a/audio/control.c
+++ b/audio/control.c
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);
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 4952b57..b93a294 100644
--- a/audio/device.c
+++ b/audio/device.c
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 53094af..0fe29d1 100644
--- a/audio/gateway.c
+++ b/audio/gateway.c
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 1ef6c49..3ded18e 100644
--- a/audio/headset.c
+++ b/audio/headset.c
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);
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,
"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);
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) {
"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);
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);
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);
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 53a0b80..6201d85 100644
--- a/audio/sink.c
+++ b/audio/sink.c
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);
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);
}
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);
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);
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 e4ba211..8e01666 100644
--- a/audio/source.c
+++ b/audio/source.c
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 281895e..6541fc1 100644
--- a/audio/transport.c
+++ b/audio/transport.c
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);
}
DBG("");
- emit_property_changed(transport->conn, transport->path,
+ emit_property_changed(transport->path,
MEDIA_TRANSPORT_INTERFACE, "NREC",
DBUS_TYPE_BOOLEAN, &nrec);
}
a2dp->delay = delay;
- emit_property_changed(transport->conn, transport->path,
+ emit_property_changed(transport->path,
MEDIA_TRANSPORT_INTERFACE, "Delay",
DBUS_TYPE_UINT16, &a2dp->delay);
}
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 5d62d35..351fe1e 100644
--- a/profiles/health/hdp.c
+++ b/profiles/health/hdp.c
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);
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 1954b34..dc3da80 100644
--- a/profiles/input/device.c
+++ b/profiles/input/device.c
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;
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 b81d5b5..178f51f 100644
--- a/profiles/network/connection.c
+++ b/profiles/network/connection.c
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);
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 ebd788a..59e4f12 100644
--- a/profiles/proximity/immalert.c
+++ b/profiles/proximity/immalert.c
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 37d1f86..659eaa8 100644
--- a/profiles/proximity/linkloss.c
+++ b/profiles/proximity/linkloss.c
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 a9de85b..a791916 100644
--- a/profiles/proximity/monitor.c
+++ b/profiles/proximity/monitor.c
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);
}
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;
}
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,
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 78a63bf..fc3d83c 100644
--- a/profiles/sap/server.c
+++ b/profiles/sap/server.c
{
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;
}
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 f58e558..44043e8 100644
--- a/profiles/thermometer/thermometer.c
+++ b/profiles/thermometer/thermometer.c
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) {
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) {
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) {
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 06ba78c..4f27b35 100644
--- a/src/adapter.c
+++ b/src/adapter.c
write_device_pairable(&adapter->bdaddr, pairable);
- emit_property_changed(connection, adapter->path,
+ emit_property_changed(adapter->path,
ADAPTER_INTERFACE, "Pairable",
DBUS_TYPE_BOOLEAN, &pairable);
path = dbus_message_get_path(msg);
- emit_property_changed(conn, path,
+ emit_property_changed(path,
ADAPTER_INTERFACE, "DiscoverableTimeout",
DBUS_TYPE_UINT32, &timeout);
path = dbus_message_get_path(msg);
- emit_property_changed(conn, path,
+ emit_property_changed(path,
ADAPTER_INTERFACE, "PairableTimeout",
DBUS_TYPE_UINT32, &timeout);
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);
}
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);
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);
}
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;
adapter->discovering = discovering;
- emit_property_changed(connection, path,
+ emit_property_changed(path,
ADAPTER_INTERFACE, "Discovering",
DBUS_TYPE_BOOLEAN, &discovering);
/* 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 f7e9e8f..21395d9 100644
--- a/src/dbus-common.c
+++ b/src/dbus-common.c
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)
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 127cf9c..ff130ff 100644
--- a/src/dbus-common.h
+++ b/src/dbus-common.h
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 a5b9e7a..dd5dcc2 100644
--- a/src/device.c
+++ b/src/device.c
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);
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);
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;
}
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);
device->connected = TRUE;
- emit_property_changed(conn, device->path,
+ emit_property_changed(device->path,
DEVICE_INTERFACE, "Connected",
DBUS_TYPE_BOOLEAN, &device->connected);
}
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,
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);
}
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);
}
void device_set_paired(struct btd_device *device, gboolean value)
{
- DBusConnection *conn = btd_get_dbus_connection();
-
if (device->paired == value)
return;
device->paired = value;
- emit_property_changed(conn, device->path, DEVICE_INTERFACE, "Paired",
+ emit_property_changed(device->path,
+ DEVICE_INTERFACE, "Paired",
DBUS_TYPE_BOOLEAN, &value);
}
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)
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,