From: Hyuk Lee Date: Wed, 28 Mar 2018 02:38:21 +0000 (+0900) Subject: Add the delay report property X-Git-Tag: accepted/tizen/unified/20180411.065612~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f49ea2302e2ebc48a4536ed8d4612a3cf7746ea0;p=platform%2Fupstream%2Fbluez.git Add the delay report property Change-Id: I3abe8e8b71bb39027c2f0c29e326fc8acc3b6cdb Signed-off-by: Hyuk Lee --- diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c index 05c4c6c..b52816d 100644 --- a/profiles/audio/avdtp.c +++ b/profiles/audio/avdtp.c @@ -105,6 +105,11 @@ static unsigned int seids; #define DISCONNECT_TIMEOUT 1 #define START_TIMEOUT 1 +#ifdef TIZEN_FEATURE_BLUEZ_MODIFY +struct avdtp *configured_session; +struct avdtp_stream *configured_stream; +#endif + #if __BYTE_ORDER == __LITTLE_ENDIAN struct avdtp_common_header { @@ -1163,8 +1168,13 @@ static void avdtp_sep_set_state(struct avdtp *session, switch (state) { case AVDTP_STATE_CONFIGURED: - if (sep->info.type == AVDTP_SEP_TYPE_SINK) + if (sep->info.type == AVDTP_SEP_TYPE_SINK) { +#ifdef TIZEN_FEATURE_BLUEZ_MODIFY + configured_session = session; + configured_stream = stream; +#endif avdtp_delay_report(session, stream, stream->delay); + } break; case AVDTP_STATE_OPEN: stream->starting = FALSE; @@ -3981,6 +3991,19 @@ int avdtp_delay_report(struct avdtp *session, struct avdtp_stream *stream, &req, sizeof(req)); } +#ifdef TIZEN_FEATURE_BLUEZ_MODIFY +int delay_report_req(uint16_t delay) +{ + if (!configured_session) + return -EINVAL; + + if (!configured_stream) + return -EINVAL; + + return avdtp_delay_report(configured_session, configured_stream, delay); +} +#endif + struct avdtp_local_sep *avdtp_register_sep(struct queue *lseps, uint8_t type, uint8_t media_type, uint8_t codec_type, diff --git a/profiles/audio/avdtp.h b/profiles/audio/avdtp.h index 54591aa..8281a2b 100755 --- a/profiles/audio/avdtp.h +++ b/profiles/audio/avdtp.h @@ -275,6 +275,9 @@ int avdtp_close(struct avdtp *session, struct avdtp_stream *stream, int avdtp_abort(struct avdtp *session, struct avdtp_stream *stream); int avdtp_delay_report(struct avdtp *session, struct avdtp_stream *stream, uint16_t delay); +#ifdef TIZEN_FEATURE_BLUEZ_MODIFY +int delay_report_req(uint16_t delay); +#endif struct avdtp_local_sep *avdtp_register_sep(struct queue *lseps, uint8_t type, uint8_t media_type, diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c index 26a7f74..5cdcd5c 100755 --- a/profiles/audio/transport.c +++ b/profiles/audio/transport.c @@ -633,6 +633,41 @@ static gboolean get_delay(const GDBusPropertyTable *property, return TRUE; } +#ifdef TIZEN_FEATURE_BLUEZ_MODIFY +static void delay_report(const GDBusPropertyTable *property, + DBusMessageIter *iter, GDBusPendingPropertySet id, + void *data) +{ + struct media_transport *transport = data; + struct a2dp_transport *a2dp = transport->data; + uint16_t delay; + bool notify; + + if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_UINT16) { + g_dbus_pending_property_error(id, + ERROR_INTERFACE ".InvalidArguments", + "Invalid arguments in method call"); + return; + } + + dbus_message_iter_get_basic(iter, &delay); + DBG("Delay : %d", delay); + + g_dbus_pending_property_success(id); + + a2dp->delay = delay; + + notify = transport->source_watch ? true : false; + if (notify) + g_dbus_emit_property_changed(btd_get_dbus_connection(), + transport->path, + MEDIA_TRANSPORT_INTERFACE, + "Delay"); + + delay_report_req(delay); +} +#endif + static gboolean volume_exists(const GDBusPropertyTable *property, void *data) { struct media_transport *transport = data; @@ -715,7 +750,11 @@ static const GDBusPropertyTable transport_properties[] = { { "Codec", "y", get_codec }, { "Configuration", "ay", get_configuration }, { "State", "s", get_state }, +#ifdef TIZEN_FEATURE_BLUEZ_MODIFY + { "Delay", "q", get_delay, delay_report, delay_exists }, +#else { "Delay", "q", get_delay, NULL, delay_exists }, +#endif { "Volume", "q", get_volume, set_volume, volume_exists }, { } };