Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2941772rdh; Wed, 27 Sep 2023 19:06:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFIIUupRpr2v7hgZ6YPnI2HbCOE3ifmgqyRCTVN437ykqtBQsFhEqNCxHtM6PqjKx3FdjJS X-Received: by 2002:a17:90a:4f48:b0:268:93d:b936 with SMTP id w8-20020a17090a4f4800b00268093db936mr3025250pjl.18.1695866773281; Wed, 27 Sep 2023 19:06:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695866773; cv=none; d=google.com; s=arc-20160816; b=Uo3FY6suiaqyA9t4f7VyFNU8yh4gvU/UnW1sc/HnRgXnbR68FXSE8DtIctlSL7GU7C kGI5q8Rn3YP41rBBpgp9vBYViUdn3BP8IOCglZhIXCNU2H7a/yctvehsL9XftYHnb/OH 50BNgfFsG656ie6SCKuSVFc+8pjoznnbMlHCOBu8Tt6WvZilQkyOEtnxu577Lnfrm3h0 O2CsqgEwpn/N0j/dX0AU8g3tLB3KY3Y1yD3JFrJyT7KN8xGf3zfhQFSB7aOnwulVMK/h 8JCdfjqgOT2M6BCMfuR91g4iTh2JplgtR6v4wt6P/5rARLzwNr7a3alS76oMFrSySHF+ mDyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=X07wSkLYOjKxHCw/p4ZSA9t+KzQYCv6DrtWZMUPxG3M=; fh=4lGQI6056MBa4/oovMyIYaKLn+Wz/24RGvUivMmQP8E=; b=X87CPORRbOnbS5EDAd/AcVoHpA9rl4JpxL6jhfd2MJzmY8+u6gq0F1mRudmEXM0ELJ zOrqF9kRPLZoXEf6tmFe0qaXuGfeTOT7vBCkUAz3WZu9N8djcBsi9kNNJ8xvZHCdFQiN HO2Uhc5kVyO3Mjo2YqaTP+Q+eVBhhkpOJlTxNY81vLDYpr0mpQ9wH43ouY67rYbTK6zf Ryw34Qcf6VeMgUOAvNs1qYCZtDfQzMmamIh8FUvF9E134/V5pi1riuvPdvnH4UWls4WW TUaqA5kGyUHCa+htnWmIk4c9PW/1YDtzCATU4SzuJq18qBc4w+9kEhocuNZt+vR99WaG NDPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="ZDlD86O/"; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id v14-20020a17090a7c0e00b002748712d225si19576661pjf.1.2023.09.27.19.06.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 19:06:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="ZDlD86O/"; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 651DD829327B; Wed, 27 Sep 2023 14:54:24 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229711AbjI0VyR (ORCPT + 99 others); Wed, 27 Sep 2023 17:54:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229464AbjI0VyP (ORCPT ); Wed, 27 Sep 2023 17:54:15 -0400 Received: from mail-il1-x12f.google.com (mail-il1-x12f.google.com [IPv6:2607:f8b0:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EF45102 for ; Wed, 27 Sep 2023 14:54:13 -0700 (PDT) Received: by mail-il1-x12f.google.com with SMTP id e9e14a558f8ab-3512b425662so30401305ab.0 for ; Wed, 27 Sep 2023 14:54:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695851651; x=1696456451; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=X07wSkLYOjKxHCw/p4ZSA9t+KzQYCv6DrtWZMUPxG3M=; b=ZDlD86O/aNfTsk9Ms9PYDlBctRI8f7k7F7byoMbiuMDNBSqTjDiRgKsGQG0rsW+5GJ pKMdMNAwXHPp/xsv8A0VTLDES+t4JrT6y0bczKITCXsLhqOB4mijSndvxs6SSqzajHnA 0RetFxbHcoZV39fhMxOhH3gDlDCKseZWwNXfm5u3mTWfp9m0NtDTdAMOb/F2BwCq9AjX tJDxV+WKjoyJACBo9m3zUYAMNlMItXdoPKCdQufjta0umUk79yK+VsC00Joy8Ux49C7X lY8QvekDMwgii2sFqP/ZzS62vtr7YYNrZ1zx5Ec/H9at+aFffOsZkG/726m04m4UP4Gl 2gQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695851651; x=1696456451; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=X07wSkLYOjKxHCw/p4ZSA9t+KzQYCv6DrtWZMUPxG3M=; b=OJ/z40RamzNY+GW89DyQPIQewJ/HMVbhc8Y+VH5vxM0NyFucOQYHA9oygvpZsHxeO9 cSN6ZSrU3JU/AmjzNXobGDbNUqmbJ3bJLMZsucwggWcERPOfuY2vU8kxO1Iq2fL0uWG4 e44iKp8Hlj+rLJUM8PzvGFA5j5Z5hhMZVVuywhJ+d6p5xxvx2gcDR1vs2Wr+l8g79H2b xjGplsLgAMjxHGHQ81Uh0jJTfOkh0Ld1uakxS2vKTJvjdZGTok7EGO0FbL1e4WuUnW1o yU3r2nlhPRt4J5EnCyFte9uYigVrcnpfccAzoK3pgaTLRp2PKQBI4SD1gr/FHEGOlSz5 81RQ== X-Gm-Message-State: AOJu0YwgykYPwZ5t8y1/cuvnOCHciMQorLnggBtqwhX6QpnIhEtcGL6Q Xn0jzxvjKkBr/Nfppm1VnOQFEeI1Cqn0VoXs X-Received: by 2002:a05:6e02:1a88:b0:34f:203c:2432 with SMTP id k8-20020a056e021a8800b0034f203c2432mr4094729ilv.12.1695851651674; Wed, 27 Sep 2023 14:54:11 -0700 (PDT) Received: from lvondent-mobl4.. (c-98-232-221-87.hsd1.or.comcast.net. [98.232.221.87]) by smtp.gmail.com with ESMTPSA id g15-20020a02cd0f000000b0042bbfe3dc42sm4225331jaq.173.2023.09.27.14.54.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 14:54:10 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH v4 09/12] shared/bap: Add support for location and contexts to bt_bap_pac_qos Date: Wed, 27 Sep 2023 14:53:51 -0700 Message-ID: <20230927215354.1874835-9-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230927215354.1874835-1-luiz.dentz@gmail.com> References: <20230927215354.1874835-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Wed, 27 Sep 2023 14:54:25 -0700 (PDT) From: Luiz Augusto von Dentz This adds support for location and contexts to bt_bap_pac_qos and function to read them. --- src/shared/bap.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++- src/shared/bap.h | 6 ++++++ 2 files changed, 58 insertions(+), 1 deletion(-) diff --git a/src/shared/bap.c b/src/shared/bap.c index 6400d1d69221..9e9ea1472029 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -2740,7 +2740,12 @@ uint8_t bt_bap_pac_get_type(struct bt_bap_pac *pac) uint32_t bt_bap_pac_get_locations(struct bt_bap_pac *pac) { - struct bt_pacs *pacs = pac->bdb->pacs; + struct bt_pacs *pacs; + + if (!pac) + return 0; + + pacs = pac->bdb->pacs; switch (pac->type) { case BT_BAP_SOURCE: @@ -2752,6 +2757,52 @@ uint32_t bt_bap_pac_get_locations(struct bt_bap_pac *pac) } } +uint16_t bt_bap_pac_get_supported_context(struct bt_bap_pac *pac) +{ + struct bt_pacs *pacs; + + if (!pac) + return 0; + + pacs = pac->bdb->pacs; + + switch (pac->type) { + case BT_BAP_SOURCE: + return pacs->supported_source_context_value; + case BT_BAP_SINK: + return pacs->supported_sink_context_value; + default: + return 0; + } +} + +uint16_t bt_bap_pac_get_context(struct bt_bap_pac *pac) +{ + struct bt_pacs *pacs; + + if (!pac) + return 0; + + pacs = pac->bdb->pacs; + + switch (pac->type) { + case BT_BAP_SOURCE: + return pacs->source_context_value; + case BT_BAP_SINK: + return pacs->sink_context_value; + default: + return 0; + } +} + +struct bt_bap_pac_qos *bt_bap_pac_get_qos(struct bt_bap_pac *pac) +{ + if (!pac || !pac->qos.phy) + return NULL; + + return &pac->qos; +} + uint8_t bt_bap_stream_get_type(struct bt_bap_stream *stream) { if (!stream) diff --git a/src/shared/bap.h b/src/shared/bap.h index 72d6022a32ec..ebe4dbf7d858 100644 --- a/src/shared/bap.h +++ b/src/shared/bap.h @@ -168,6 +168,12 @@ uint8_t bt_bap_pac_get_type(struct bt_bap_pac *pac); uint32_t bt_bap_pac_get_locations(struct bt_bap_pac *pac); +uint16_t bt_bap_pac_get_supported_context(struct bt_bap_pac *pac); + +uint16_t bt_bap_pac_get_context(struct bt_bap_pac *pac); + +struct bt_bap_pac_qos *bt_bap_pac_get_qos(struct bt_bap_pac *pac); + uint8_t bt_bap_stream_get_type(struct bt_bap_stream *stream); struct bt_bap_stream *bt_bap_pac_get_stream(struct bt_bap_pac *pac); -- 2.41.0