fhub: diallaow A2DP multistream and change avrcp version 38/281338/1
authorAyush Garg <ayush.garg@samsung.com>
Wed, 14 Sep 2022 04:48:52 +0000 (10:18 +0530)
committerAyush Garg <ayush.garg@samsung.com>
Thu, 15 Sep 2022 06:27:03 +0000 (11:57 +0530)
Change-Id: I4f89fe9e46689fc7854b2f7313aca46f41226bc3
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
plugins/policy.c
profiles/audio/avdtp.c
profiles/audio/avrcp.c

index 1187e89..46bbb85 100755 (executable)
 #include "src/shared/timeout.h"
 
 #ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+#include "../profile.h"
+#endif
+
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
 #define CONTROL_CONNECT_TIMEOUT 4
 #define TARGET_CONNECT_TIMEOUT 1
 #else
@@ -70,6 +74,12 @@ static const char *default_reconnect[] = {
                        HSP_AG_UUID, HFP_AG_UUID, A2DP_SOURCE_UUID
                        A2DP_SINK_UUID, NULL };
 #endif
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+static const char *fhub_default_reconnect[] = {
+                       HSP_AG_UUID, HFP_AG_UUID, A2DP_SOURCE_UUID
+                       A2DP_SINK_UUID, NULL };
+#endif
+
 static char **reconnect_uuids = NULL;
 
 static const size_t default_attempts = 7;
@@ -897,7 +907,12 @@ static int policy_init(void)
 
        conf = btd_get_main_conf();
        if (!conf) {
-               reconnect_uuids = g_strdupv((char **) default_reconnect);
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+               if (TIZEN_FEATURE_BLUEZ_FHUB)
+                       reconnect_uuids = g_strdupv((char **) fhub_default_reconnect);
+               else
+#endif
+                       reconnect_uuids = g_strdupv((char **) default_reconnect);
                reconnect_attempts = default_attempts;
                reconnect_intervals_len = sizeof(default_intervals) /
                                                sizeof(*reconnect_intervals);
@@ -913,7 +928,12 @@ static int policy_init(void)
                                                        NULL, &gerr);
        if (gerr) {
                g_clear_error(&gerr);
-               reconnect_uuids = g_strdupv((char **) default_reconnect);
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+               if (TIZEN_FEATURE_BLUEZ_FHUB)
+                       reconnect_uuids = g_strdupv((char **) fhub_default_reconnect);
+               else
+#endif
+                       reconnect_uuids = g_strdupv((char **) default_reconnect);
        }
 
        reconnect_attempts = g_key_file_get_integer(conf, "Policy",
index ae96dfd..30e3d0b 100644 (file)
@@ -1409,8 +1409,10 @@ static void release_stream(struct avdtp_stream *stream, struct avdtp *session)
        struct avdtp_local_sep *sep = stream->lsep;
 
 #if defined(TIZEN_FEATURE_BLUEZ_MODIFY) && defined(TIZEN_FEATURE_BLUEZ_A2DP_MULTISTREAM)
-       /* Connection lost */
-       avdtp_remove_source_devce(session->device);
+       if (!TIZEN_FEATURE_BLUEZ_FHUB) {
+               /* Connection lost */
+               avdtp_remove_source_devce(session->device);
+       }
 #endif
 
        if (sep->cfm && sep->cfm->abort &&
@@ -2267,7 +2269,8 @@ static gboolean avdtp_start_cmd(struct avdtp *session, uint8_t transaction,
                avdtp_check_collision(session, AVDTP_START, stream);
 
 #if defined(TIZEN_FEATURE_BLUEZ_MODIFY) && defined(TIZEN_FEATURE_BLUEZ_A2DP_MULTISTREAM)
-               avdtp_add_source_device(session->device);
+               if (!TIZEN_FEATURE_BLUEZ_FHUB)
+                       avdtp_add_source_device(session->device);
 #endif
 
                avdtp_sep_set_state(session, sep, AVDTP_STATE_STREAMING);
@@ -2293,7 +2296,8 @@ static gboolean avdtp_close_cmd(struct avdtp *session, uint8_t transaction,
        uint8_t err;
 
 #if defined(TIZEN_FEATURE_BLUEZ_MODIFY) && defined(TIZEN_FEATURE_BLUEZ_A2DP_MULTISTREAM)
-       avdtp_remove_source_devce(session->device);
+       if (!TIZEN_FEATURE_BLUEZ_FHUB)
+               avdtp_remove_source_devce(session->device);
 #endif
 
        if (size < sizeof(struct seid_req)) {
@@ -2375,8 +2379,13 @@ static gboolean avdtp_suspend_cmd(struct avdtp *session, uint8_t transaction,
 #if defined(TIZEN_FEATURE_BLUEZ_MODIFY) && defined(TIZEN_FEATURE_BLUEZ_A2DP_MULTISTREAM)
                if (sep->state != AVDTP_STATE_STREAMING) {
                        DBG("Not streaming state: %d", sep->state);
-                       return avdtp_send(session, transaction, AVDTP_MSG_TYPE_ACCEPT,
-                                                               AVDTP_SUSPEND, NULL, 0);
+                       if (!TIZEN_FEATURE_BLUEZ_FHUB) {
+                               return avdtp_send(session, transaction, AVDTP_MSG_TYPE_ACCEPT,
+                                                                       AVDTP_SUSPEND, NULL, 0);
+                       } else {
+                               err = AVDTP_BAD_STATE;
+                               goto failed;
+                       }
                }
 #else
                if (sep->state != AVDTP_STATE_STREAMING) {
index 31c0e2c..387b1a0 100644 (file)
 #ifdef TIZEN_FEATURE_BLUEZ_MODIFY
 #define AVRCP_CT_VERSION               0x0104
 #define AVRCP_TG_VERSION               0x0103
+#define FHUB_AVRCP_CT_VERSION          0x0103
 #else
 #define AVRCP_CT_VERSION               0x0106
 #define AVRCP_TG_VERSION               0x0105
@@ -430,6 +431,7 @@ static sdp_record_t *avrcp_ct_record(bool browsing)
        sdp_data_t *psm[2], *version, *features;
        uint16_t lp = AVCTP_CONTROL_PSM;
 #ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+       uint16_t avrcp_ct_ver;
        uint16_t avctp_ver = 0x0104;
        uint16_t feat = 0;
 #ifdef ENABLE_AVRCP_CATEGORY1
@@ -485,9 +487,12 @@ static sdp_record_t *avrcp_ct_record(bool browsing)
 
        /* Bluetooth Profile Descriptor List */
        sdp_uuid16_create(&profile[0].uuid, AV_REMOTE_PROFILE_ID);
-       profile[0].version = AVRCP_CT_VERSION;
 #ifdef TIZEN_FEATURE_BLUEZ_MODIFY
-       adapter_avrcp_ct_ver = AVRCP_CT_VERSION;
+       avrcp_ct_ver = TIZEN_FEATURE_BLUEZ_FHUB ? FHUB_AVRCP_CT_VERSION : AVRCP_CT_VERSION;
+       profile[0].version = avrcp_ct_ver;
+       adapter_avrcp_ct_ver = avrcp_ct_ver;
+#else
+       profile[0].version = AVRCP_CT_VERSION;
 #endif
        pfseq = sdp_list_append(NULL, &profile[0]);
        sdp_set_profile_descs(record, pfseq);
@@ -4158,12 +4163,14 @@ static void avrcp_status_changed(struct avrcp *session,
        strval = status_to_string(value);
 
 #if defined(TIZEN_FEATURE_BLUEZ_MODIFY) && defined(TIZEN_FEATURE_BLUEZ_A2DP_MULTISTREAM)
-       DBG("AVRCP status changed to : %s", strval);
+       if (!TIZEN_FEATURE_BLUEZ_FHUB) {
+               DBG("AVRCP status changed to : %s", strval);
 
-       if (value == AVRCP_PLAY_STATUS_PAUSED)
-               media_transport_set_stream_status(session->dev, true);
-       else if ( value == AVRCP_PLAY_STATUS_PLAYING)
-               media_transport_set_stream_status(session->dev, false);
+               if (value == AVRCP_PLAY_STATUS_PAUSED)
+                       media_transport_set_stream_status(session->dev, true);
+               else if ( value == AVRCP_PLAY_STATUS_PLAYING)
+                       media_transport_set_stream_status(session->dev, false);
+       }
 #endif
 
        if (g_strcmp0(curval, strval) == 0)