From cef3cb479863237b25fbf4347e0842166efcfb61 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Mon, 6 Jan 2014 11:38:37 +0200 Subject: [PATCH] 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 | 10 +++++----- 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 | 18 ++++++++--------- src/agent.c | 12 ++++++------ src/device.c | 2 +- src/device.h | 2 +- src/profile.c | 4 ++-- 23 files changed, 104 insertions(+), 101 deletions(-) diff --git a/plugins/policy.c b/plugins/policy.c index 6fb0729..7d35495 100644 --- a/plugins/policy.c +++ b/plugins/policy.c @@ -87,7 +87,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); } @@ -97,7 +97,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); } @@ -633,7 +633,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->timer = g_timeout_add_seconds(reconnect->timeout, reconnect_timeout, diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c index cabdd66..c1a9304 100644 --- a/profiles/audio/a2dp.c +++ b/profiles/audio/a2dp.c @@ -1832,7 +1832,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); @@ -1848,7 +1848,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); } @@ -1863,7 +1863,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); @@ -1883,7 +1883,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); @@ -1895,7 +1895,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); @@ -1915,7 +1915,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 da2a746..055acc3 100644 --- a/profiles/audio/avrcp.c +++ b/profiles/audio/avrcp.c @@ -2841,7 +2841,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) @@ -3766,7 +3766,7 @@ int avrcp_set_volume(struct btd_device *dev, uint8_t volume) 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); @@ -3776,7 +3776,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); @@ -3787,7 +3787,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); } @@ -3870,7 +3870,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 ab94a57..14f7021 100644 --- a/profiles/audio/control.c +++ b/profiles/audio/control.c @@ -75,7 +75,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: @@ -235,7 +235,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); @@ -257,7 +257,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); } @@ -287,7 +287,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, @@ -297,7 +297,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); diff --git a/profiles/audio/sink.c b/profiles/audio/sink.c index da8992e..eab4735 100644 --- a/profiles/audio/sink.c +++ b/profiles/audio/sink.c @@ -90,7 +90,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) { @@ -338,7 +338,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); } @@ -348,7 +348,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 b0abaa3..13db14b 100644 --- a/profiles/audio/source.c +++ b/profiles/audio/source.c @@ -88,7 +88,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) { @@ -339,7 +339,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); } @@ -349,7 +349,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 c82fbb5..955bed0 100644 --- a/profiles/audio/transport.c +++ b/profiles/audio/transport.c @@ -545,7 +545,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); @@ -835,8 +835,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 6b00da7..a8b0b37 100644 --- a/profiles/cyclingspeed/cyclingspeed.c +++ b/profiles/cyclingspeed/cyclingspeed.c @@ -415,7 +415,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"); } @@ -494,7 +494,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; @@ -723,7 +723,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; } @@ -1184,7 +1184,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, @@ -1231,7 +1231,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 48dad52..eb952e0 100644 --- a/profiles/health/hdp.c +++ b/profiles/health/hdp.c @@ -427,7 +427,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); @@ -515,7 +515,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); @@ -709,7 +709,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); @@ -765,7 +765,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, @@ -821,7 +821,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); } @@ -963,7 +963,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); @@ -974,7 +974,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: @@ -1028,7 +1028,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); @@ -1220,7 +1220,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); } @@ -1237,7 +1237,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); } @@ -1254,7 +1254,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) @@ -1277,7 +1277,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); @@ -1301,7 +1301,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); } @@ -1642,7 +1642,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); @@ -1681,7 +1681,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); @@ -1697,7 +1697,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"); } @@ -2082,7 +2082,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) { @@ -2125,7 +2125,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; @@ -2193,7 +2193,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 287ea72..9807ef6 100644 --- a/profiles/heartrate/heartrate.c +++ b/profiles/heartrate/heartrate.c @@ -267,7 +267,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; @@ -761,7 +761,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, @@ -807,7 +807,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 5f4bc45..a7cb3f4 100644 --- a/profiles/input/device.c +++ b/profiles/input/device.c @@ -1425,7 +1425,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; @@ -1490,7 +1490,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; int err; GIOChannel *io; @@ -1554,7 +1554,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); struct uhid_event ev; diff --git a/profiles/input/hog.c b/profiles/input/hog.c index e82e827..1824155 100644 --- a/profiles/input/hog.c +++ b/profiles/input/hog.c @@ -910,7 +910,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); @@ -951,7 +951,7 @@ static void remove_device(gpointer a, gpointer b) static void hog_remove(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); DBG("path %s", path); diff --git a/profiles/network/connection.c b/profiles/network/connection.c index cc73989..66af8e8 100644 --- a/profiles/network/connection.c +++ b/profiles/network/connection.c @@ -112,7 +112,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"); @@ -188,7 +188,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); } @@ -215,7 +215,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"); @@ -471,7 +471,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); @@ -503,7 +503,7 @@ void connection_unregister(struct btd_service *service) struct network_peer *peer = conn->peer; uint16_t id = get_service_id(service); - 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); @@ -512,7 +512,7 @@ void connection_unregister(struct btd_service *service) return; g_dbus_unregister_interface(btd_get_dbus_connection(), - device_get_path(device), + btd_device_get_path(device), NETWORK_PEER_INTERFACE); } @@ -524,7 +524,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, @@ -550,7 +550,7 @@ int connection_register(struct btd_service *service) struct network_conn *nc; uint16_t id = get_service_id(service); - 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 3d50b8d..312eb7f 100644 --- a/profiles/proximity/immalert.c +++ b/profiles/proximity/immalert.c @@ -133,7 +133,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 476803a..0c6f7e6 100644 --- a/profiles/proximity/linkloss.c +++ b/profiles/proximity/linkloss.c @@ -135,7 +135,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 f2e0739..48eb56c 100644 --- a/profiles/proximity/monitor.c +++ b/profiles/proximity/monitor.c @@ -172,7 +172,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", @@ -300,7 +300,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; @@ -326,7 +326,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; @@ -401,7 +401,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; @@ -617,7 +617,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; @@ -745,7 +745,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 fb91bc1..6deb944 100644 --- a/profiles/proximity/reporter.c +++ b/profiles/proximity/reporter.c @@ -177,7 +177,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); @@ -191,7 +191,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 e3ab923..16cc971 100644 --- a/profiles/thermometer/thermometer.c +++ b/profiles/thermometer/thermometer.c @@ -270,7 +270,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); } @@ -278,7 +278,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; @@ -1147,7 +1147,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; @@ -1206,7 +1206,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 f5f8c8c..18c91f5 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -2175,7 +2175,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); } @@ -3018,18 +3018,18 @@ 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)); return 0; } if (!(adapter->supported_settings & MGMT_SETTING_LE)) { error("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); if (!(adapter->current_settings & MGMT_SETTING_POWERED)) @@ -3053,13 +3053,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); @@ -4504,7 +4504,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); @@ -4639,7 +4639,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 8c1211c..ded59a3 100644 --- a/src/agent.c +++ b/src/agent.c @@ -522,7 +522,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) @@ -616,7 +616,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) @@ -675,7 +675,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) @@ -732,7 +732,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) @@ -761,7 +761,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"); @@ -867,7 +867,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 a9b644b..2c2223d 100644 --- a/src/device.c +++ b/src/device.c @@ -3934,7 +3934,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 2e0473e..51ee29f 100644 --- a/src/device.h +++ b/src/device.h @@ -76,7 +76,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/profile.c b/src/profile.c index f30f4f6..91167bc 100644 --- a/src/profile.c +++ b/src/profile.c @@ -922,7 +922,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); @@ -1645,7 +1645,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); -- 2.7.4