Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2931396rdh; Wed, 27 Sep 2023 18:34:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGqPfD7Ghhj30wcz3fnjH9SESjwjEliDnNhQ/vPctwU1bn6LX3oQk53Ao7TPDjBhuvVISzf X-Received: by 2002:a17:90a:fd15:b0:267:f9c4:c0a8 with SMTP id cv21-20020a17090afd1500b00267f9c4c0a8mr3305696pjb.4.1695864845417; Wed, 27 Sep 2023 18:34:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695864845; cv=none; d=google.com; s=arc-20160816; b=fQ1dAm5xrEDyvgbpFn/AOhfNKS2b88ckcjOb0XYYQDiAhMzhncbgQg5Owl0oHs/7KX 3+25vEj2DqoN/J0zjMhoPyyLVGf5A+qO7mHRMC8A+eBBgucMKDXkFc8zXSXitmn4TgXo XE1y48xONHiN6XMbkq73sOJl8SvLWST3PMY41jmIFXXwKg/iywc/I7AXvtAYuF7l/Az3 uXTBCqxtjt/NYlYJVFwa9H8mrLF3HSRi7E1v0EUjjC+Ljcba4Wy3Ux+hlHLApPAcfdrE 36FKOUeE/gKZbox5Q2ekLrJ3cclfIrbsvTFrY4KexD65nERuifd/RirC0uCLMLvdhoti lRcA== 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=iclZY7JC9cTvw6sBmEcLboIzeNgsgFlMVvVa05P+hvnuUZohKeDuN9+wIBNqD5E9bb ExnwRSH70smAJjS7ptkfr7wOixMMBwkRlcc9NUV8cZ64BpV7/Nbml3l3MRGsTA69WopW 1E4xg2Z08d8G5QSb07f1eYO8eecMm65SuqFTw3/1fksIhB3adF3qo1gsE3D09/+WzvqK K3K3CV/eyftHhm7Ik5/R3bpfzP2tvNhr5BQ2yKBXGXtA/DGKhLZQdX3lIQcfn0k/PZs8 vKQRAzqZrrJPudR1OGECnQI+28gq7pg/scRSfVT9o/fn3q9BQJbn03g4vCb5NsudJ/m3 JMKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=gK9Cozod; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id e65-20020a17090a6fc700b00275cffed966si11068787pjk.57.2023.09.27.18.34.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 18:34:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=gK9Cozod; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (Postfix) with ESMTP id 8D4E2802DBA4; Wed, 27 Sep 2023 14:41:04 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229988AbjI0Vk2 (ORCPT + 99 others); Wed, 27 Sep 2023 17:40:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229955AbjI0Vk1 (ORCPT ); Wed, 27 Sep 2023 17:40:27 -0400 Received: from mail-oi1-x22b.google.com (mail-oi1-x22b.google.com [IPv6:2607:f8b0:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77DA4121 for ; Wed, 27 Sep 2023 14:40:25 -0700 (PDT) Received: by mail-oi1-x22b.google.com with SMTP id 5614622812f47-3af609c4dfeso662455b6e.1 for ; Wed, 27 Sep 2023 14:40:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695850824; x=1696455624; 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=gK9CozodnHxjR4pX0/r0xvnzcgNUwc7JTrqYXatltFWMhZq+fH0QOw9Avi2Z2jUeUz SVJ7OJ0/9GKxzKFO5kmhPIfm2PZKPS8OB31cUx5tqABTxRfgm7YShbtLRI/52Oo5UuoN Qt+PmWT/O2Xn25y1/4heF3exRC1mlQWD+f+cPy4pGZAI3kEtlzRougJdZI/IKI2ZTiTy BJYorN3X/lBpaQvGkvF8P3BdjvK8sr5kXmLfff7ppmTirJ5h1b/r1EkAA83nQQsc1KAp DbbnojV6QK9jaQVzYkXvfJvP95mWUE6TlnxGuhudtqHhf1B/yRohGXuJmweCUhv2CE0d m2Pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695850824; x=1696455624; 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=CKTMOoJ1aacWjEallOrV93slxvQaJsKbCWFTJtrqnsyY6d8gGS4TeTyVBsHsCbTGpB BMtGb4yW7OKivd/I1Z8BQfE0hQj3590mH4svfYGEU414PxZt1uqWZn1L9Q6fyoKvI7Mr GLxxozwyt6gjAd0zOYppthCLbwiC7GZKlSUrcl47RoJ4kt0HJcjDATGF5KYC5Pp0stbY NJeebNA6rWRH0tjVYLepUBap5yhUllHjvyq1SZ9eFdNWAJX4QnEgtFX+8jm7yv4pRcvS 4kePhP/EqYI6WG9EpWjY+lomKKHuHVsDrR4w2KpEy5ko3cZ1PYUfMAmnqv0NrRttWB92 126g== X-Gm-Message-State: AOJu0YwK4+eE938RrtcbXrERrDchRlFfwGSNmQroakbkMzL/qr8sXhCB e+s+rhKqKYkPFYGjpdH3FqomQacmcVlqGZnl X-Received: by 2002:a05:6808:1a24:b0:3a4:633:44d2 with SMTP id bk36-20020a0568081a2400b003a4063344d2mr3945719oib.18.1695850823796; Wed, 27 Sep 2023 14:40:23 -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 s26-20020aa78d5a000000b00672ea40b8a9sm12546004pfe.170.2023.09.27.14.40.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 14:40:22 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH v3 09/12] shared/bap: Add support for location and contexts to bt_bap_pac_qos Date: Wed, 27 Sep 2023 14:40:00 -0700 Message-ID: <20230927214003.1873224-10-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230927214003.1873224-1-luiz.dentz@gmail.com> References: <20230927214003.1873224-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 morse.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 (morse.vger.email [0.0.0.0]); Wed, 27 Sep 2023 14:41:04 -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