diff options
| author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2014-01-06 11:38:37 +0200 |
|---|---|---|
| committer | Pedro Alvarez <pedro.alvarez@codethink.co.uk> | 2014-04-10 14:15:09 +0000 |
| commit | d9a384a32032e8dd34ab69c99c4f31950790910a (patch) | |
| tree | a813ff6e3faa76e80c7baff304784c1f2898d493 | |
| parent | 9e483337a42f0ddef06cc9ad146c8523f2b08888 (diff) | |
| download | bluez-d9a384a32032e8dd34ab69c99c4f31950790910a.tar.gz | |
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.
| -rw-r--r-- | plugins/policy.c | 4 | ||||
| -rw-r--r-- | profiles/audio/a2dp.c | 12 | ||||
| -rw-r--r-- | profiles/audio/avrcp.c | 10 | ||||
| -rw-r--r-- | profiles/audio/control.c | 10 | ||||
| -rw-r--r-- | profiles/audio/sink.c | 6 | ||||
| -rw-r--r-- | profiles/audio/source.c | 6 | ||||
| -rw-r--r-- | profiles/audio/transport.c | 7 | ||||
| -rw-r--r-- | profiles/cyclingspeed/cyclingspeed.c | 10 | ||||
| -rw-r--r-- | profiles/health/hdp.c | 38 | ||||
| -rw-r--r-- | profiles/heartrate/heartrate.c | 7 | ||||
| -rw-r--r-- | profiles/input/device.c | 6 | ||||
| -rw-r--r-- | profiles/input/hog.c | 4 | ||||
| -rw-r--r-- | profiles/network/connection.c | 16 | ||||
| -rw-r--r-- | profiles/proximity/immalert.c | 2 | ||||
| -rw-r--r-- | profiles/proximity/linkloss.c | 2 | ||||
| -rw-r--r-- | profiles/proximity/monitor.c | 12 | ||||
| -rw-r--r-- | profiles/proximity/reporter.c | 4 | ||||
| -rw-r--r-- | profiles/thermometer/thermometer.c | 9 | ||||
| -rw-r--r-- | src/adapter.c | 16 | ||||
| -rw-r--r-- | src/agent.c | 12 | ||||
| -rw-r--r-- | src/device.c | 2 | ||||
| -rw-r--r-- | src/device.h | 4 | ||||
| -rw-r--r-- | src/profile.c | 4 |
23 files changed, 104 insertions, 99 deletions
diff --git a/plugins/policy.c b/plugins/policy.c index 0292482c3..4e04489bb 100644 --- a/plugins/policy.c +++ b/plugins/policy.c @@ -64,7 +64,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); } @@ -74,7 +74,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); } diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c index cabdd666e..c1a93044a 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 da2a7464f..055acc3c8 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 ab94a5719..14f702135 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 d16af23e9..c3bb6140c 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) { @@ -335,7 +335,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); } @@ -345,7 +345,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 843b3e8cb..9c34f9bad 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) { @@ -336,7 +336,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); } @@ -346,7 +346,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 c82fbb575..955bed0dd 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 2f80bca18..0dc661c5f 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"); } @@ -515,7 +515,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; @@ -744,7 +744,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; } @@ -1205,7 +1205,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, @@ -1252,7 +1252,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 48dad52c8..eb952e044 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 1dcbdf4a4..9c06ec005 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; @@ -782,7 +782,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, @@ -828,7 +828,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 a2329c614..0dea41144 100644 --- a/profiles/input/device.c +++ b/profiles/input/device.c @@ -802,7 +802,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; @@ -845,7 +845,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); @@ -889,7 +889,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 a11e04e46..287bfeec4 100644 --- a/profiles/input/hog.c +++ b/profiles/input/hog.c @@ -869,7 +869,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); @@ -910,7 +910,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 cc73989ff..66af8e822 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 3d50b8d63..312eb7f93 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 476803ac4..0c6f7e690 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 f2e073969..48eb56c53 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 3e4c74196..38816fb1d 100644 --- a/profiles/proximity/reporter.c +++ b/profiles/proximity/reporter.c @@ -179,7 +179,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); @@ -193,7 +193,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 20575c055..5e9c94cf0 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; @@ -1165,7 +1165,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; @@ -1224,7 +1224,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 e396a3d9f..d82b14511 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -2162,7 +2162,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); } @@ -3005,18 +3005,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)) @@ -3040,12 +3040,12 @@ 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), + DBG("%s removed from %s's connect_list", btd_device_get_path(device), adapter->system_name); if (!adapter->connect_list) { @@ -4496,7 +4496,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); @@ -4631,7 +4631,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 4a2f606dd..cd976321d 100644 --- a/src/agent.c +++ b/src/agent.c @@ -502,7 +502,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) @@ -596,7 +596,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) @@ -655,7 +655,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) @@ -712,7 +712,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) @@ -741,7 +741,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"); @@ -847,7 +847,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 56b17800c..25c078aef 100644 --- a/src/device.c +++ b/src/device.c @@ -3878,7 +3878,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 30e2d5dd4..859e9e5ab 100644 --- a/src/device.h +++ b/src/device.h @@ -75,7 +75,9 @@ 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_bredr(struct btd_device *device); +gboolean device_is_le(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 f6aa97018..a11952478 100644 --- a/src/profile.c +++ b/src/profile.c @@ -913,7 +913,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); @@ -1621,7 +1621,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); |
