[PATCH 1/3] android/health: Handle incoming streaming data channel request

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



First data channel should be reliable data channel when remote device
in sink role request data channel with option any.
---
 android/health.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/android/health.c b/android/health.c
index 1943ced..2d80365 100644
--- a/android/health.c
+++ b/android/health.c
@@ -1423,7 +1423,8 @@ static uint8_t mcap_mdl_conn_req_cb(struct mcap_mcl *mcl, uint8_t mdepid,
 	struct health_app *app;
 	struct mdep_cfg *mdep;
 
-	DBG("Data channel request: mdepid %u mdlid %u", mdepid, mdlid);
+	DBG("Data channel request: mdepid %u mdlid %u conf %u",
+							mdepid, mdlid, *conf);
 
 	if (mdepid == MDEP_ECHO)
 		/* For echo service take last app */
@@ -1478,10 +1479,14 @@ static uint8_t mcap_mdl_conn_req_cb(struct mcap_mcl *mcl, uint8_t mdepid,
 
 	switch (*conf) {
 	case CHANNEL_TYPE_ANY:
-		if (mdep->role == HAL_HEALTH_MDEP_ROLE_SINK)
+		if (mdep->role == HAL_HEALTH_MDEP_ROLE_SINK) {
 			return MCAP_CONFIGURATION_REJECTED;
-		else
-			*conf = CHANNEL_TYPE_RELIABLE;
+		} else {
+			if (queue_length(channel->dev->channels) <= 1)
+				*conf = CHANNEL_TYPE_RELIABLE;
+			else
+				*conf = CHANNEL_TYPE_STREAM;
+		}
 		break;
 	case CHANNEL_TYPE_STREAM:
 		if (mdep->role == HAL_HEALTH_MDEP_ROLE_SOURCE)
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux