static gboolean auto_config(gpointer data) { struct a2dp_setup *setup = data; /* Check if configuration was aborted */ if (setup->sep->stream == NULL) return FALSE; if (setup->err != NULL) goto done; avdtp_stream_add_cb(setup->session, setup->stream, stream_state_changed, setup->sep); if (setup->sep->type == AVDTP_SEP_TYPE_SOURCE) sink_new_stream(setup->dev, setup->session, setup->stream); else source_new_stream(setup->dev, setup->session, setup->stream); done: if (setup->setconf_cb) setup->setconf_cb(setup->session, setup->stream, setup->err); finalize_config(setup); if (setup->err) { g_free(setup->err); setup->err = NULL; } setup_unref(setup); return FALSE; }
static void setconf_cfm(struct avdtp *session, struct avdtp_local_sep *sep, struct avdtp_stream *stream, struct avdtp_error *err, void *user_data) { struct a2dp_sep *a2dp_sep = user_data; struct a2dp_setup *setup; struct audio_device *dev; int ret; if (a2dp_sep->type == AVDTP_SEP_TYPE_SINK) DBG("Sink %p: Set_Configuration_Cfm", sep); else DBG("Source %p: Set_Configuration_Cfm", sep); setup = find_setup_by_session(session); if (err) { if (setup) { setup->err = err; finalize_config(setup); } return; } avdtp_stream_add_cb(session, stream, stream_state_changed, a2dp_sep); a2dp_sep->stream = stream; if (!setup) return; dev = a2dp_get_dev(session); /* Notify D-Bus interface of the new stream */ if (a2dp_sep->type == AVDTP_SEP_TYPE_SOURCE) sink_new_stream(dev, session, setup->stream); else source_new_stream(dev, session, setup->stream); ret = avdtp_open(session, stream); if (ret < 0) { error("Error on avdtp_open %s (%d)", strerror(-ret), -ret); setup->stream = NULL; finalize_config_errno(setup, ret); } }
static gboolean auto_config(gpointer data) { struct a2dp_setup *setup = data; struct btd_device *dev = avdtp_get_device(setup->session); struct btd_service *service; /* Check if configuration was aborted */ if (setup->sep->stream == NULL) return FALSE; if (setup->err != NULL) goto done; avdtp_stream_add_cb(setup->session, setup->stream, stream_state_changed, setup->sep); if (setup->sep->type == AVDTP_SEP_TYPE_SOURCE) { service = btd_device_get_service(dev, A2DP_SINK_UUID); sink_new_stream(service, setup->session, setup->stream); } else { service = btd_device_get_service(dev, A2DP_SOURCE_UUID); source_new_stream(service, setup->session, setup->stream); } done: if (setup->setconf_cb) setup->setconf_cb(setup->session, setup->stream, setup->err); finalize_config(setup); if (setup->err) { g_free(setup->err); setup->err = NULL; } setup_unref(setup); return FALSE; }