From b6c86be4d3be1b8bf425a9af6c06af29c3926d23 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Mon, 6 Jan 2014 11:38:37 +0200 Subject: core: Make device_get_path public This renames device_get_path to btd_device_get_path so external plugin can use of it as well. --- plugins/policy.c | 6 +++--- profiles/audio/a2dp.c | 12 ++++++------ profiles/audio/avrcp.c | 10 +++++----- profiles/audio/control.c | 12 ++++++------ profiles/audio/sink.c | 6 +++--- profiles/audio/source.c | 6 +++--- profiles/audio/transport.c | 7 ++++--- profiles/cyclingspeed/cyclingspeed.c | 10 +++++----- profiles/health/hdp.c | 38 ++++++++++++++++++------------------ profiles/heartrate/heartrate.c | 7 ++++--- profiles/input/device.c | 6 +++--- profiles/input/hog.c | 4 ++-- profiles/network/connection.c | 16 +++++++-------- profiles/proximity/immalert.c | 2 +- profiles/proximity/linkloss.c | 2 +- profiles/proximity/monitor.c | 12 ++++++------ profiles/proximity/reporter.c | 4 ++-- profiles/thermometer/thermometer.c | 9 +++++---- src/adapter.c | 23 +++++++++++----------- src/agent.c | 12 ++++++------ src/device.c | 2 +- src/device.h | 2 +- src/gatt-client.c | 4 ++-- src/profile.c | 4 ++-- 24 files changed, 110 insertions(+), 106 deletions(-) diff --git a/plugins/policy.c b/plugins/policy.c index 218a3ed25..80f1732d8 100644 --- a/plugins/policy.c +++ b/plugins/policy.c @@ -100,7 +100,7 @@ static void policy_connect(struct policy_data *data, { struct btd_profile *profile = btd_service_get_profile(service); - DBG("%s profile %s", device_get_path(data->dev), profile->name); + DBG("%s profile %s", btd_device_get_path(data->dev), profile->name); btd_service_connect(service); } @@ -110,7 +110,7 @@ static void policy_disconnect(struct policy_data *data, { struct btd_profile *profile = btd_service_get_profile(service); - DBG("%s profile %s", device_get_path(data->dev), profile->name); + DBG("%s profile %s", btd_device_get_path(data->dev), profile->name); btd_service_disconnect(service); } @@ -710,7 +710,7 @@ static void disconnect_cb(struct btd_device *dev, uint8_t reason) return; DBG("Device %s identified for auto-reconnection", - device_get_path(dev)); + btd_device_get_path(dev)); reconnect_set_timer(reconnect); } diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c index b0fea7c4e..65255693d 100644 --- a/profiles/audio/a2dp.c +++ b/profiles/audio/a2dp.c @@ -2228,7 +2228,7 @@ static int a2dp_source_probe(struct btd_service *service) { struct btd_device *dev = btd_service_get_device(service); - DBG("path %s", device_get_path(dev)); + DBG("path %s", btd_device_get_path(dev)); source_init(service); @@ -2244,7 +2244,7 @@ static int a2dp_sink_probe(struct btd_service *service) { struct btd_device *dev = btd_service_get_device(service); - DBG("path %s", device_get_path(dev)); + DBG("path %s", btd_device_get_path(dev)); return sink_init(service); } @@ -2259,7 +2259,7 @@ static int a2dp_source_connect(struct btd_service *service) struct btd_device *dev = btd_service_get_device(service); struct btd_adapter *adapter = device_get_adapter(dev); struct a2dp_server *server; - const char *path = device_get_path(dev); + const char *path = btd_device_get_path(dev); DBG("path %s", path); @@ -2279,7 +2279,7 @@ static int a2dp_source_connect(struct btd_service *service) static int a2dp_source_disconnect(struct btd_service *service) { struct btd_device *dev = btd_service_get_device(service); - const char *path = device_get_path(dev); + const char *path = btd_device_get_path(dev); DBG("path %s", path); @@ -2291,7 +2291,7 @@ static int a2dp_sink_connect(struct btd_service *service) struct btd_device *dev = btd_service_get_device(service); struct btd_adapter *adapter = device_get_adapter(dev); struct a2dp_server *server; - const char *path = device_get_path(dev); + const char *path = btd_device_get_path(dev); DBG("path %s", path); @@ -2311,7 +2311,7 @@ static int a2dp_sink_connect(struct btd_service *service) static int a2dp_sink_disconnect(struct btd_service *service) { struct btd_device *dev = btd_service_get_device(service); - const char *path = device_get_path(dev); + const char *path = btd_device_get_path(dev); DBG("path %s", path); diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c index 7b6001241..994550aee 100644 --- a/profiles/audio/avrcp.c +++ b/profiles/audio/avrcp.c @@ -3210,7 +3210,7 @@ static struct avrcp_player *create_ct_player(struct avrcp *session, player = g_new0(struct avrcp_player, 1); player->sessions = g_slist_prepend(player->sessions, session); - path = device_get_path(session->dev); + path = btd_device_get_path(session->dev); mp = media_player_controller_create(path, id); if (mp == NULL) @@ -4234,7 +4234,7 @@ int avrcp_set_volume(struct btd_device *dev, uint8_t volume, bool notify) static int avrcp_connect(struct btd_service *service) { struct btd_device *dev = btd_service_get_device(service); - const char *path = device_get_path(dev); + const char *path = btd_device_get_path(dev); DBG("path %s", path); @@ -4244,7 +4244,7 @@ static int avrcp_connect(struct btd_service *service) static int avrcp_disconnect(struct btd_service *service) { struct btd_device *dev = btd_service_get_device(service); - const char *path = device_get_path(dev); + const char *path = btd_device_get_path(dev); DBG("path %s", path); @@ -4255,7 +4255,7 @@ static int avrcp_target_probe(struct btd_service *service) { struct btd_device *dev = btd_service_get_device(service); - DBG("path %s", device_get_path(dev)); + DBG("path %s", btd_device_get_path(dev)); return control_init_target(service); } @@ -4338,7 +4338,7 @@ static int avrcp_controller_probe(struct btd_service *service) { struct btd_device *dev = btd_service_get_device(service); - DBG("path %s", device_get_path(dev)); + DBG("path %s", btd_device_get_path(dev)); return control_init_remote(service); } diff --git a/profiles/audio/control.c b/profiles/audio/control.c index edc4a98ce..e50c927ab 100644 --- a/profiles/audio/control.c +++ b/profiles/audio/control.c @@ -78,7 +78,7 @@ static void state_changed(struct btd_device *dev, avctp_state_t old_state, { struct control *control = user_data; DBusConnection *conn = btd_get_dbus_connection(); - const char *path = device_get_path(dev); + const char *path = btd_device_get_path(dev); switch (new_state) { case AVCTP_STATE_DISCONNECTED: @@ -268,7 +268,7 @@ static void path_unregister(void *data) struct control *control = data; DBG("Unregistered interface %s on path %s", AUDIO_CONTROL_INTERFACE, - device_get_path(control->dev)); + btd_device_get_path(control->dev)); if (control->session) avctp_disconnect(control->session); @@ -290,7 +290,7 @@ void control_unregister(struct btd_service *service) struct btd_device *dev = btd_service_get_device(service); g_dbus_unregister_interface(btd_get_dbus_connection(), - device_get_path(dev), + btd_device_get_path(dev), AUDIO_CONTROL_INTERFACE); } @@ -320,7 +320,7 @@ static struct control *control_init(struct btd_service *service) control = g_new0(struct control, 1); if (!g_dbus_register_interface(btd_get_dbus_connection(), - device_get_path(dev), + btd_device_get_path(dev), AUDIO_CONTROL_INTERFACE, control_methods, NULL, control_properties, control, @@ -330,7 +330,7 @@ static struct control *control_init(struct btd_service *service) } DBG("Registered interface %s on path %s", AUDIO_CONTROL_INTERFACE, - device_get_path(dev)); + btd_device_get_path(dev)); control->dev = dev; control->avctp_id = avctp_add_state_cb(dev, state_changed, control); @@ -382,7 +382,7 @@ int control_set_player(struct btd_service *service, const char *path) control->player = path; g_dbus_emit_property_changed(btd_get_dbus_connection(), - device_get_path(control->dev), + btd_device_get_path(control->dev), AUDIO_CONTROL_INTERFACE, "Player"); return 0; diff --git a/profiles/audio/sink.c b/profiles/audio/sink.c index ac7237bd8..92a5242c6 100644 --- a/profiles/audio/sink.c +++ b/profiles/audio/sink.c @@ -91,7 +91,7 @@ static void sink_set_state(struct sink *sink, sink_state_t new_state) sink->state = new_state; - DBG("State changed %s: %s -> %s", device_get_path(dev), + DBG("State changed %s: %s -> %s", btd_device_get_path(dev), str_state[old_state], str_state[new_state]); for (l = sink_callbacks; l != NULL; l = l->next) { @@ -346,7 +346,7 @@ void sink_unregister(struct btd_service *service) { struct btd_device *dev = btd_service_get_device(service); - DBG("%s", device_get_path(dev)); + DBG("%s", btd_device_get_path(dev)); sink_free(service); } @@ -356,7 +356,7 @@ int sink_init(struct btd_service *service) struct btd_device *dev = btd_service_get_device(service); struct sink *sink; - DBG("%s", device_get_path(dev)); + DBG("%s", btd_device_get_path(dev)); sink = g_new0(struct sink, 1); diff --git a/profiles/audio/source.c b/profiles/audio/source.c index 372b13202..912927d39 100644 --- a/profiles/audio/source.c +++ b/profiles/audio/source.c @@ -89,7 +89,7 @@ static void source_set_state(struct source *source, source_state_t new_state) source->state = new_state; - DBG("State changed %s: %s -> %s", device_get_path(dev), + DBG("State changed %s: %s -> %s", btd_device_get_path(dev), str_state[old_state], str_state[new_state]); for (l = source_callbacks; l != NULL; l = l->next) { @@ -347,7 +347,7 @@ void source_unregister(struct btd_service *service) { struct btd_device *dev = btd_service_get_device(service); - DBG("%s", device_get_path(dev)); + DBG("%s", btd_device_get_path(dev)); source_free(service); } @@ -357,7 +357,7 @@ int source_init(struct btd_service *service) struct btd_device *dev = btd_service_get_device(service); struct source *source; - DBG("%s", device_get_path(dev)); + DBG("%s", btd_device_get_path(dev)); source = g_new0(struct source, 1); diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c index 4121e52c4..91f463cdc 100644 --- a/profiles/audio/transport.c +++ b/profiles/audio/transport.c @@ -550,7 +550,7 @@ static gboolean get_device(const GDBusPropertyTable *property, DBusMessageIter *iter, void *data) { struct media_transport *transport = data; - const char *path = device_get_path(transport->device); + const char *path = btd_device_get_path(transport->device); dbus_message_iter_append_basic(iter, DBUS_TYPE_OBJECT_PATH, &path); @@ -849,8 +849,9 @@ struct media_transport *media_transport_create(struct btd_device *device, transport->configuration = g_new(uint8_t, size); memcpy(transport->configuration, configuration, size); transport->size = size; - transport->path = g_strdup_printf("%s/fd%d", device_get_path(device), - fd++); + transport->path = g_strdup_printf("%s/fd%d", + btd_device_get_path(device), + fd++); transport->fd = -1; uuid = media_endpoint_get_uuid(endpoint); diff --git a/profiles/cyclingspeed/cyclingspeed.c b/profiles/cyclingspeed/cyclingspeed.c index e44772560..88c24616a 100644 --- a/profiles/cyclingspeed/cyclingspeed.c +++ b/profiles/cyclingspeed/cyclingspeed.c @@ -420,7 +420,7 @@ static void read_location_cb(guint8 status, const guint8 *pdu, csc->location = value; g_dbus_emit_property_changed(btd_get_dbus_connection(), - device_get_path(csc->dev), + btd_device_get_path(csc->dev), CYCLINGSPEED_INTERFACE, "Location"); } @@ -499,7 +499,7 @@ static void update_watcher(gpointer data, gpointer user_data) struct watcher *w = data; struct measurement *m = user_data; struct csc *csc = m->csc; - const char *path = device_get_path(csc->dev); + const char *path = btd_device_get_path(csc->dev); DBusMessageIter iter; DBusMessageIter dict; DBusMessage *msg; @@ -728,7 +728,7 @@ static void controlpoint_ind_handler(const uint8_t *pdu, uint16_t len, controlpoint_property_reply(req, rsp_code); g_dbus_emit_property_changed(btd_get_dbus_connection(), - device_get_path(csc->dev), + btd_device_get_path(csc->dev), CYCLINGSPEED_INTERFACE, "Location"); break; } @@ -1189,7 +1189,7 @@ static int csc_device_probe(struct btd_service *service) csc->cadapter = cadapter; if (!g_dbus_register_interface(btd_get_dbus_connection(), - device_get_path(device), + btd_device_get_path(device), CYCLINGSPEED_INTERFACE, cyclingspeed_device_methods, NULL, @@ -1236,7 +1236,7 @@ static void csc_device_remove(struct btd_service *service) cadapter->devices = g_slist_remove(cadapter->devices, csc); g_dbus_unregister_interface(btd_get_dbus_connection(), - device_get_path(device), + btd_device_get_path(device), CYCLINGSPEED_INTERFACE); } diff --git a/profiles/health/hdp.c b/profiles/health/hdp.c index bc3b38ad8..e17c4a444 100644 --- a/profiles/health/hdp.c +++ b/profiles/health/hdp.c @@ -429,7 +429,7 @@ static gboolean channel_property_get_device(const GDBusPropertyTable *property, DBusMessageIter *iter, void *data) { struct hdp_channel *chan = data; - const char *path = device_get_path(chan->dev->dev); + const char *path = btd_device_get_path(chan->dev->dev); dbus_message_iter_append_basic(iter, DBUS_TYPE_OBJECT_PATH, &path); @@ -517,7 +517,7 @@ static void hdp_mdl_reconn_cb(struct mcap_mdl *mdl, GError *err, gpointer data) &fd, DBUS_TYPE_INVALID); g_dbus_send_message(conn, reply); - g_dbus_emit_signal(conn, device_get_path(dc_data->hdp_chann->dev->dev), + g_dbus_emit_signal(conn, btd_device_get_path(dc_data->hdp_chann->dev->dev), HEALTH_DEVICE, "ChannelConnected", DBUS_TYPE_OBJECT_PATH, &dc_data->hdp_chann->path, DBUS_TYPE_INVALID); @@ -711,7 +711,7 @@ static void health_channel_destroy(void *data) if (hdp_chan->mdep != HDP_MDEP_ECHO) g_dbus_emit_signal(btd_get_dbus_connection(), - device_get_path(dev->dev), + btd_device_get_path(dev->dev), HEALTH_DEVICE, "ChannelDeleted", DBUS_TYPE_OBJECT_PATH, &hdp_chan->path, DBUS_TYPE_INVALID); @@ -770,7 +770,7 @@ static struct hdp_channel *create_channel(struct hdp_device *dev, hdp_chann->edata = g_new0(struct hdp_echo_data, 1); hdp_chann->path = g_strdup_printf("%s/chan%d", - device_get_path(hdp_chann->dev->dev), + btd_device_get_path(hdp_chann->dev->dev), hdp_chann->mdlid); dev->channels = g_slist_append(dev->channels, @@ -826,7 +826,7 @@ static void close_device_con(struct hdp_device *dev, gboolean cache) if (!dev->sdp_present) { const char *path; - path = device_get_path(dev->dev); + path = btd_device_get_path(dev->dev); g_dbus_unregister_interface(btd_get_dbus_connection(), path, HEALTH_DEVICE); } @@ -972,7 +972,7 @@ static void hdp_mcap_mdl_connected_cb(struct mcap_mdl *mdl, void *data) goto end; } - g_dbus_emit_signal(btd_get_dbus_connection(), device_get_path(dev->dev), + g_dbus_emit_signal(btd_get_dbus_connection(), btd_device_get_path(dev->dev), HEALTH_DEVICE, "ChannelConnected", DBUS_TYPE_OBJECT_PATH, &chan->path, DBUS_TYPE_INVALID); @@ -983,7 +983,7 @@ static void hdp_mcap_mdl_connected_cb(struct mcap_mdl *mdl, void *data) dev->fr = hdp_channel_ref(chan); g_dbus_emit_property_changed(btd_get_dbus_connection(), - device_get_path(dev->dev), HEALTH_DEVICE, + btd_device_get_path(dev->dev), HEALTH_DEVICE, "MainChannel"); end: @@ -1039,7 +1039,7 @@ static void hdp_mcap_mdl_aborted_cb(struct mcap_mdl *mdl, void *data) if (dev->ndc->mdep != HDP_MDEP_ECHO) g_dbus_emit_signal(btd_get_dbus_connection(), - device_get_path(dev->dev), + btd_device_get_path(dev->dev), HEALTH_DEVICE, "ChannelConnected", DBUS_TYPE_OBJECT_PATH, &dev->ndc->path, DBUS_TYPE_INVALID); @@ -1232,7 +1232,7 @@ static void mcl_connected(struct mcap_mcl *mcl, gpointer data) hdp_device->mcl = mcap_mcl_ref(mcl); hdp_device->mcl_conn = TRUE; - DBG("New mcl connected from %s", device_get_path(hdp_device->dev)); + DBG("New mcl connected from %s", btd_device_get_path(hdp_device->dev)); hdp_set_mcl_cb(hdp_device, NULL); } @@ -1249,7 +1249,7 @@ static void mcl_reconnected(struct mcap_mcl *mcl, gpointer data) hdp_device = l->data; hdp_device->mcl_conn = TRUE; - DBG("MCL reconnected %s", device_get_path(hdp_device->dev)); + DBG("MCL reconnected %s", btd_device_get_path(hdp_device->dev)); hdp_set_mcl_cb(hdp_device, NULL); } @@ -1266,7 +1266,7 @@ static void mcl_disconnected(struct mcap_mcl *mcl, gpointer data) hdp_device = l->data; hdp_device->mcl_conn = FALSE; - DBG("Mcl disconnected %s", device_get_path(hdp_device->dev)); + DBG("Mcl disconnected %s", btd_device_get_path(hdp_device->dev)); } static void mcl_uncached(struct mcap_mcl *mcl, gpointer data) @@ -1289,7 +1289,7 @@ static void mcl_uncached(struct mcap_mcl *mcl, gpointer data) /* the Bluetooth daemon won't notify when the device shall */ /* be removed. Then we have to remove the HealthDevice */ /* interface manually */ - path = device_get_path(hdp_device->dev); + path = btd_device_get_path(hdp_device->dev); g_dbus_unregister_interface(btd_get_dbus_connection(), path, HEALTH_DEVICE); DBG("Mcl uncached %s", path); @@ -1313,7 +1313,7 @@ static void check_devices_mcl(void) for (l = to_delete; l; l = l->next) { const char *path; - path = device_get_path(dev->dev); + path = btd_device_get_path(dev->dev); g_dbus_unregister_interface(btd_get_dbus_connection(), path, HEALTH_DEVICE); } @@ -1653,7 +1653,7 @@ static void abort_mdl_connection_cb(GError *err, gpointer data) /* notify the channel created at MCAP level */ if (hdp_chann->mdep != HDP_MDEP_ECHO) g_dbus_emit_signal(btd_get_dbus_connection(), - device_get_path(hdp_chann->dev->dev), + btd_device_get_path(hdp_chann->dev->dev), HEALTH_DEVICE, "ChannelConnected", DBUS_TYPE_OBJECT_PATH, &hdp_chann->path, DBUS_TYPE_INVALID); @@ -1692,7 +1692,7 @@ static void hdp_mdl_conn_cb(struct mcap_mdl *mdl, GError *err, gpointer data) DBUS_TYPE_INVALID); g_dbus_send_message(conn, reply); - g_dbus_emit_signal(conn, device_get_path(hdp_chann->dev->dev), + g_dbus_emit_signal(conn, btd_device_get_path(hdp_chann->dev->dev), HEALTH_DEVICE, "ChannelConnected", DBUS_TYPE_OBJECT_PATH, &hdp_chann->path, DBUS_TYPE_INVALID); @@ -1708,7 +1708,7 @@ static void hdp_mdl_conn_cb(struct mcap_mdl *mdl, GError *err, gpointer data) dev->fr = hdp_channel_ref(hdp_chann); g_dbus_emit_property_changed(btd_get_dbus_connection(), - device_get_path(dev->dev), HEALTH_DEVICE, + btd_device_get_path(dev->dev), HEALTH_DEVICE, "MainChannel"); } @@ -2093,7 +2093,7 @@ static void health_device_destroy(void *data) struct hdp_device *device = data; DBG("Unregistered interface %s on path %s", HEALTH_DEVICE, - device_get_path(device->dev)); + btd_device_get_path(device->dev)); remove_channels(device); if (device->ndc != NULL) { @@ -2136,7 +2136,7 @@ static const GDBusPropertyTable health_device_properties[] = { static struct hdp_device *create_health_device(struct btd_device *device) { struct btd_adapter *adapter = device_get_adapter(device); - const char *path = device_get_path(device); + const char *path = btd_device_get_path(device); struct hdp_device *dev; GSList *l; @@ -2204,7 +2204,7 @@ void hdp_device_unregister(struct btd_device *device) return; hdp_dev = l->data; - path = device_get_path(hdp_dev->dev); + path = btd_device_get_path(hdp_dev->dev); g_dbus_unregister_interface(btd_get_dbus_connection(), path, HEALTH_DEVICE); } diff --git a/profiles/heartrate/heartrate.c b/profiles/heartrate/heartrate.c index 9e8c49931..ea125c9bc 100644 --- a/profiles/heartrate/heartrate.c +++ b/profiles/heartrate/heartrate.c @@ -271,7 +271,7 @@ static void update_watcher(gpointer data, gpointer user_data) struct watcher *w = data; struct measurement *m = user_data; struct heartrate *hr = m->hr; - const char *path = device_get_path(hr->dev); + const char *path = btd_device_get_path(hr->dev); DBusMessageIter iter; DBusMessageIter dict; DBusMessage *msg; @@ -765,7 +765,7 @@ static int heartrate_device_register(struct btd_device *device, hr->hradapter = hradapter; if (!g_dbus_register_interface(btd_get_dbus_connection(), - device_get_path(device), + btd_device_get_path(device), HEART_RATE_INTERFACE, heartrate_device_methods, NULL, @@ -811,7 +811,8 @@ static void heartrate_device_unregister(struct btd_device *device) hradapter->devices = g_slist_remove(hradapter->devices, hr); g_dbus_unregister_interface(btd_get_dbus_connection(), - device_get_path(device), HEART_RATE_INTERFACE); + btd_device_get_path(device), + HEART_RATE_INTERFACE); } static int heartrate_adapter_probe(struct btd_profile *p, diff --git a/profiles/input/device.c b/profiles/input/device.c index a494ea2e3..f2cfd08bb 100644 --- a/profiles/input/device.c +++ b/profiles/input/device.c @@ -1305,7 +1305,7 @@ static struct input_device *input_device_new(struct btd_service *service) { struct btd_device *device = btd_service_get_device(service); struct btd_profile *p = btd_service_get_profile(service); - const char *path = device_get_path(device); + const char *path = btd_device_get_path(device); const sdp_record_t *rec = btd_device_get_record(device, p->remote_uuid); struct btd_adapter *adapter = device_get_adapter(device); struct input_device *idev; @@ -1348,7 +1348,7 @@ static const GDBusPropertyTable input_properties[] = { int input_device_register(struct btd_service *service) { struct btd_device *device = btd_service_get_device(service); - const char *path = device_get_path(device); + const char *path = btd_device_get_path(device); struct input_device *idev; DBG("%s", path); @@ -1401,7 +1401,7 @@ static struct input_device *find_device(const bdaddr_t *src, void input_device_unregister(struct btd_service *service) { struct btd_device *device = btd_service_get_device(service); - const char *path = device_get_path(device); + const char *path = btd_device_get_path(device); struct input_device *idev = btd_service_get_user_data(service); DBG("%s", path); diff --git a/profiles/input/hog.c b/profiles/input/hog.c index 4dba83f71..57b8adc37 100644 --- a/profiles/input/hog.c +++ b/profiles/input/hog.c @@ -172,7 +172,7 @@ static void resume_callback(void) static int hog_probe(struct btd_service *service) { struct btd_device *device = btd_service_get_device(service); - const char *path = device_get_path(device); + const char *path = btd_device_get_path(device); GSList *primaries, *l; DBG("path %s", path); @@ -200,7 +200,7 @@ static void hog_remove(struct btd_service *service) { struct hog_device *dev = btd_service_get_user_data(service); struct btd_device *device = btd_service_get_device(service); - const char *path = device_get_path(device); + const char *path = btd_device_get_path(device); DBG("path %s", path); diff --git a/profiles/network/connection.c b/profiles/network/connection.c index 5305ace80..2446501d1 100644 --- a/profiles/network/connection.c +++ b/profiles/network/connection.c @@ -121,7 +121,7 @@ static void bnep_disconn_cb(gpointer data) { struct network_conn *nc = data; DBusConnection *conn = btd_get_dbus_connection(); - const char *path = device_get_path(nc->peer->device); + const char *path = btd_device_get_path(nc->peer->device); g_dbus_emit_property_changed(conn, path, NETWORK_PEER_INTERFACE, "Connected"); @@ -197,7 +197,7 @@ static void disconnect_cb(struct btd_device *device, gboolean removal, { struct network_conn *nc = user_data; - info("Network: disconnect %s", device_get_path(nc->peer->device)); + info("Network: disconnect %s", btd_device_get_path(nc->peer->device)); connection_destroy(NULL, user_data); } @@ -224,7 +224,7 @@ static void bnep_conn_cb(char *iface, int err, void *data) local_connect_cb(nc, 0); conn = btd_get_dbus_connection(); - path = device_get_path(nc->peer->device); + path = btd_device_get_path(nc->peer->device); g_dbus_emit_property_changed(conn, path, NETWORK_PEER_INTERFACE, "Connected"); @@ -484,7 +484,7 @@ static void path_unregister(void *data) struct network_peer *peer = data; DBG("Unregistered interface %s on path %s", - NETWORK_PEER_INTERFACE, device_get_path(peer->device)); + NETWORK_PEER_INTERFACE, btd_device_get_path(peer->device)); peers = g_slist_remove(peers, peer); peer_free(peer); @@ -516,7 +516,7 @@ void connection_unregister(struct btd_service *svc) struct network_peer *peer = conn->peer; uint16_t id = get_pan_srv_id(btd_service_get_profile(svc)->remote_uuid); - DBG("%s id %u", device_get_path(device), id); + DBG("%s id %u", btd_device_get_path(device), id); peer->connections = g_slist_remove(peer->connections, conn); connection_free(conn); @@ -525,7 +525,7 @@ void connection_unregister(struct btd_service *svc) return; g_dbus_unregister_interface(btd_get_dbus_connection(), - device_get_path(device), + btd_device_get_path(device), NETWORK_PEER_INTERFACE); } @@ -537,7 +537,7 @@ static struct network_peer *create_peer(struct btd_device *device) peer = g_new0(struct network_peer, 1); peer->device = btd_device_ref(device); - path = device_get_path(device); + path = btd_device_get_path(device); if (g_dbus_register_interface(btd_get_dbus_connection(), path, NETWORK_PEER_INTERFACE, @@ -563,7 +563,7 @@ int connection_register(struct btd_service *svc) struct network_conn *nc; uint16_t id = get_pan_srv_id(btd_service_get_profile(svc)->remote_uuid); - DBG("%s id %u", device_get_path(device), id); + DBG("%s id %u", btd_device_get_path(device), id); peer = find_peer(peers, device); if (!peer) { diff --git a/profiles/proximity/immalert.c b/profiles/proximity/immalert.c index 26a0ac941..e88fd9b72 100644 --- a/profiles/proximity/immalert.c +++ b/profiles/proximity/immalert.c @@ -137,7 +137,7 @@ static void imm_alert_emit_alert_signal(struct connected_device *condev, if (!condev) return; - path = device_get_path(condev->device); + path = btd_device_get_path(condev->device); alert_level_str = get_alert_level_string(alert_level); DBG("alert %s remote %s", alert_level_str, path); diff --git a/profiles/proximity/linkloss.c b/profiles/proximity/linkloss.c index 2f1ab13c3..61c4577af 100644 --- a/profiles/proximity/linkloss.c +++ b/profiles/proximity/linkloss.c @@ -139,7 +139,7 @@ static void link_loss_emit_alert_signal(struct connected_device *condev) if (!condev->device) return; - path = device_get_path(condev->device); + path = btd_device_get_path(condev->device); alert_level_str = get_alert_level_string(condev->alert_level); DBG("alert %s remote %s", alert_level_str, path); diff --git a/profiles/proximity/monitor.c b/profiles/proximity/monitor.c index a583eb7da..6348b10e2 100644 --- a/profiles/proximity/monitor.c +++ b/profiles/proximity/monitor.c @@ -175,7 +175,7 @@ static void linkloss_written(guint8 status, const guint8 *pdu, guint16 plen, { struct monitor *monitor = user_data; struct btd_device *device = monitor->device; - const char *path = device_get_path(device); + const char *path = btd_device_get_path(device); if (status != 0) { error("Link Loss Write Request failed: %s", @@ -303,7 +303,7 @@ static void read_tx_power(struct monitor *monitor) static gboolean immediate_timeout(gpointer user_data) { struct monitor *monitor = user_data; - const char *path = device_get_path(monitor->device); + const char *path = btd_device_get_path(monitor->device); monitor->immediateto = 0; @@ -329,7 +329,7 @@ static gboolean immediate_timeout(gpointer user_data) static void immediate_written(gpointer user_data) { struct monitor *monitor = user_data; - const char *path = device_get_path(monitor->device); + const char *path = btd_device_get_path(monitor->device); g_free(monitor->fallbacklevel); monitor->fallbacklevel = NULL; @@ -404,7 +404,7 @@ static void attio_connected_cb(GAttrib *attrib, gpointer user_data) static void attio_disconnected_cb(gpointer user_data) { struct monitor *monitor = user_data; - const char *path = device_get_path(monitor->device); + const char *path = btd_device_get_path(monitor->device); g_attrib_unref(monitor->attrib); monitor->attrib = NULL; @@ -620,7 +620,7 @@ static void monitor_destroy(gpointer user_data) static struct monitor *register_monitor(struct btd_device *device) { - const char *path = device_get_path(device); + const char *path = btd_device_get_path(device); struct monitor *monitor; char *level; @@ -748,7 +748,7 @@ int monitor_register_immediate(struct btd_device *device, static void cleanup_monitor(struct monitor *monitor) { struct btd_device *device = monitor->device; - const char *path = device_get_path(device); + const char *path = btd_device_get_path(device); if (monitor->immediate != NULL || monitor->txpower != NULL) return; diff --git a/profiles/proximity/reporter.c b/profiles/proximity/reporter.c index 366d96bb3..10f28e173 100644 --- a/profiles/proximity/reporter.c +++ b/profiles/proximity/reporter.c @@ -180,7 +180,7 @@ static void unregister_reporter_device(gpointer data, gpointer user_data) { struct btd_device *device = data; struct reporter_adapter *radapter = user_data; - const char *path = device_get_path(device); + const char *path = btd_device_get_path(device); DBG("unregister on device %s", path); @@ -194,7 +194,7 @@ static void unregister_reporter_device(gpointer data, gpointer user_data) static void register_reporter_device(struct btd_device *device, struct reporter_adapter *radapter) { - const char *path = device_get_path(device); + const char *path = btd_device_get_path(device); DBG("register on device %s", path); diff --git a/profiles/thermometer/thermometer.c b/profiles/thermometer/thermometer.c index b0fc3e005..3a93a689f 100644 --- a/profiles/thermometer/thermometer.c +++ b/profiles/thermometer/thermometer.c @@ -273,7 +273,7 @@ static void change_property(struct thermometer *t, const char *name, } g_dbus_emit_property_changed(btd_get_dbus_connection(), - device_get_path(t->dev), + btd_device_get_path(t->dev), THERMOMETER_INTERFACE, name); } @@ -281,7 +281,7 @@ static void update_watcher(gpointer data, gpointer user_data) { struct watcher *w = data; struct measurement *m = user_data; - const char *path = device_get_path(m->t->dev); + const char *path = btd_device_get_path(m->t->dev); DBusMessageIter iter; DBusMessageIter dict; DBusMessage *msg; @@ -1150,7 +1150,7 @@ static void attio_disconnected_cb(gpointer user_data) static int thermometer_register(struct btd_device *device, struct gatt_primary *tattr) { - const char *path = device_get_path(device); + const char *path = btd_device_get_path(device); struct thermometer *t; struct btd_adapter *adapter; struct thermometer_adapter *tadapter; @@ -1209,7 +1209,8 @@ static void thermometer_unregister(struct btd_device *device) tadapter->devices = g_slist_remove(tadapter->devices, t); g_dbus_unregister_interface(btd_get_dbus_connection(), - device_get_path(t->dev), THERMOMETER_INTERFACE); + btd_device_get_path(t->dev), + THERMOMETER_INTERFACE); } static const GDBusMethodTable thermometer_manager_methods[] = { diff --git a/src/adapter.c b/src/adapter.c index ea306e415..eaf1f5efc 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -2876,7 +2876,7 @@ static int device_path_cmp(gconstpointer a, gconstpointer b) { const struct btd_device *device = a; const char *path = b; - const char *dev_path = device_get_path(device); + const char *dev_path = btd_device_get_path(device); return strcasecmp(dev_path, path); } @@ -3870,19 +3870,19 @@ int adapter_connect_list_add(struct btd_adapter *adapter, if (g_slist_find(adapter->connect_list, device)) { DBG("ignoring already added device %s", - device_get_path(device)); + btd_device_get_path(device)); goto done; } if (!(adapter->supported_settings & MGMT_SETTING_LE)) { btd_error(adapter->dev_id, "Can't add %s to non-LE capable adapter connect list", - device_get_path(device)); + btd_device_get_path(device)); return -ENOTSUP; } adapter->connect_list = g_slist_append(adapter->connect_list, device); - DBG("%s added to %s's connect_list", device_get_path(device), + DBG("%s added to %s's connect_list", btd_device_get_path(device), adapter->system_name); done: @@ -3910,13 +3910,13 @@ void adapter_connect_list_remove(struct btd_adapter *adapter, if (!g_slist_find(adapter->connect_list, device)) { DBG("device %s is not on the list, ignoring", - device_get_path(device)); + btd_device_get_path(device)); return; } adapter->connect_list = g_slist_remove(adapter->connect_list, device); - DBG("%s removed from %s's connect_list", device_get_path(device), - adapter->system_name); + DBG("%s removed from %s's connect_list", + btd_device_get_path(device), adapter->system_name); if (!adapter->connect_list) { stop_passive_scanning(adapter); @@ -4067,7 +4067,7 @@ void adapter_auto_connect_add(struct btd_adapter *adapter, if (g_slist_find(adapter->connect_list, device)) { DBG("ignoring already added device %s", - device_get_path(device)); + btd_device_get_path(device)); return; } @@ -4127,7 +4127,8 @@ void adapter_auto_connect_remove(struct btd_adapter *adapter, return; if (!g_slist_find(adapter->connect_list, device)) { - DBG("ignoring not added device %s", device_get_path(device)); + DBG("ignoring not added device %s", + btd_device_get_path(device)); return; } @@ -5674,7 +5675,7 @@ static void adapter_remove_connection(struct btd_adapter *adapter, adapter->connections = g_slist_remove(adapter->connections, device); if (device_is_temporary(device) && !device_is_retrying(device)) { - const char *path = device_get_path(device); + const char *path = btd_device_get_path(device); DBG("Removing temporary device %s", path); btd_adapter_remove_device(adapter, device); @@ -5841,7 +5842,7 @@ static gboolean process_auth_queue(gpointer user_data) goto next; } - dev_path = device_get_path(device); + dev_path = btd_device_get_path(device); if (agent_authorize_service(auth->agent, dev_path, auth->uuid, agent_auth_cb, adapter, NULL) < 0) { diff --git a/src/agent.c b/src/agent.c index ff44d5755..97658d2b2 100644 --- a/src/agent.c +++ b/src/agent.c @@ -529,7 +529,7 @@ int agent_request_pincode(struct agent *agent, struct btd_device *device, void *user_data, GDestroyNotify destroy) { struct agent_request *req; - const char *dev_path = device_get_path(device); + const char *dev_path = btd_device_get_path(device); int err; if (agent->request) @@ -623,7 +623,7 @@ int agent_request_passkey(struct agent *agent, struct btd_device *device, GDestroyNotify destroy) { struct agent_request *req; - const char *dev_path = device_get_path(device); + const char *dev_path = btd_device_get_path(device); int err; if (agent->request) @@ -682,7 +682,7 @@ int agent_request_confirmation(struct agent *agent, struct btd_device *device, void *user_data, GDestroyNotify destroy) { struct agent_request *req; - const char *dev_path = device_get_path(device); + const char *dev_path = btd_device_get_path(device); int err; if (agent->request) @@ -739,7 +739,7 @@ int agent_request_authorization(struct agent *agent, struct btd_device *device, GDestroyNotify destroy) { struct agent_request *req; - const char *dev_path = device_get_path(device); + const char *dev_path = btd_device_get_path(device); int err; if (agent->request) @@ -768,7 +768,7 @@ int agent_display_passkey(struct agent *agent, struct btd_device *device, uint32_t passkey, uint16_t entered) { DBusMessage *message; - const char *dev_path = device_get_path(device); + const char *dev_path = btd_device_get_path(device); message = dbus_message_new_method_call(agent->owner, agent->path, AGENT_INTERFACE, "DisplayPasskey"); @@ -874,7 +874,7 @@ int agent_display_pincode(struct agent *agent, struct btd_device *device, void *user_data, GDestroyNotify destroy) { struct agent_request *req; - const char *dev_path = device_get_path(device); + const char *dev_path = btd_device_get_path(device); int err; if (agent->request) diff --git a/src/device.c b/src/device.c index 1f7c89565..57c441bcf 100644 --- a/src/device.c +++ b/src/device.c @@ -5059,7 +5059,7 @@ const bdaddr_t *device_get_address(struct btd_device *device) return &device->bdaddr; } -const char *device_get_path(const struct btd_device *device) +const char *btd_device_get_path(const struct btd_device *device) { if (!device) return NULL; diff --git a/src/device.h b/src/device.h index db108278a..323a09f82 100644 --- a/src/device.h +++ b/src/device.h @@ -81,7 +81,7 @@ void device_probe_profile(gpointer a, gpointer b); void device_remove_profile(gpointer a, gpointer b); struct btd_adapter *device_get_adapter(struct btd_device *device); const bdaddr_t *device_get_address(struct btd_device *device); -const char *device_get_path(const struct btd_device *device); +const char *btd_device_get_path(const struct btd_device *device); gboolean device_is_temporary(struct btd_device *device); bool device_is_paired(struct btd_device *device, uint8_t bdaddr_type); bool device_is_bonded(struct btd_device *device, uint8_t bdaddr_type); diff --git a/src/gatt-client.c b/src/gatt-client.c index 39f664652..c8a0565a5 100644 --- a/src/gatt-client.c +++ b/src/gatt-client.c @@ -1384,7 +1384,7 @@ static gboolean service_get_device(const GDBusPropertyTable *property, DBusMessageIter *iter, void *data) { struct service *service = data; - const char *str = device_get_path(service->client->device); + const char *str = btd_device_get_path(service->client->device); dbus_message_iter_append_basic(iter, DBUS_TYPE_OBJECT_PATH, &str); @@ -1455,7 +1455,7 @@ static struct service *service_create(struct gatt_db_attribute *attr, struct btd_gatt_client *client) { struct service *service; - const char *device_path = device_get_path(client->device); + const char *device_path = btd_device_get_path(client->device); bt_uuid_t uuid; service = new0(struct service, 1); diff --git a/src/profile.c b/src/profile.c index 5a4f09ce9..8bfd38dde 100644 --- a/src/profile.c +++ b/src/profile.c @@ -978,7 +978,7 @@ static bool send_new_connection(struct ext_profile *ext, struct ext_io *conn) dbus_message_iter_init_append(msg, &iter); - path = device_get_path(conn->device); + path = btd_device_get_path(conn->device); dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH, &path); fd = g_io_channel_unix_get_fd(conn->io); @@ -1701,7 +1701,7 @@ static int send_disconn_req(struct ext_profile *ext, struct ext_io *conn) return -ENOMEM; } - path = device_get_path(conn->device); + path = btd_device_get_path(conn->device); dbus_message_append_args(msg, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID); -- cgit v1.2.1