diff mbox series

[BlueZ,1/7] shared/bass: Add API to send GATT write command

Message ID 20240805120429.67606-2-iulia.tanasescu@nxp.com (mailing list archive)
State Accepted
Commit a626ae163fd716932838477c5d9d1d6ff23f6b0e
Headers show
Series Implement the MediaAssistant "Push" command | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint success Gitlint PASS
tedd_an/BuildEll success Build ELL PASS
tedd_an/BluezMake success Bluez Make PASS
tedd_an/MakeCheck success Bluez Make Check PASS
tedd_an/MakeDistcheck success Make Distcheck PASS
tedd_an/CheckValgrind success Check Valgrind PASS
tedd_an/CheckSmatch success CheckSparse PASS
tedd_an/bluezmakeextell success Make External ELL PASS
tedd_an/IncrementalBuild success Incremental Build PASS
tedd_an/ScanBuild success Scan Build PASS

Commit Message

Iulia Tanasescu Aug. 5, 2024, 12:04 p.m. UTC
This adds a BASS API to send a GATT write command for the
Broadcast Audio Scan Control Point characteristic.
---
 src/shared/bass.c | 38 +++++++++++++++++++++++++++++++++++++-
 src/shared/bass.h |  5 ++++-
 2 files changed, 41 insertions(+), 2 deletions(-)

Comments

bluez.test.bot@gmail.com Aug. 5, 2024, 4:39 p.m. UTC | #1
This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=876697

---Test result---

Test Summary:
CheckPatch                    PASS      4.44 seconds
GitLint                       PASS      3.63 seconds
BuildEll                      PASS      24.73 seconds
BluezMake                     PASS      1713.09 seconds
MakeCheck                     PASS      13.55 seconds
MakeDistcheck                 PASS      181.30 seconds
CheckValgrind                 PASS      253.21 seconds
CheckSmatch                   PASS      357.08 seconds
bluezmakeextell               PASS      120.23 seconds
IncrementalBuild              PASS      11308.49 seconds
ScanBuild                     PASS      1006.70 seconds



---
Regards,
Linux Bluetooth
diff mbox series

Patch

diff --git a/src/shared/bass.c b/src/shared/bass.c
index 268e3bd86..d9ab210b7 100644
--- a/src/shared/bass.c
+++ b/src/shared/bass.c
@@ -3,7 +3,7 @@ 
  *
  *  BlueZ - Bluetooth protocol stack for Linux
  *
- *  Copyright 2023 NXP
+ *  Copyright 2023-2024 NXP
  *
  */
 
@@ -1754,3 +1754,39 @@  void bt_bass_add_db(struct gatt_db *db, const bdaddr_t *adapter_bdaddr)
 {
 	bass_db_new(db, adapter_bdaddr);
 }
+
+int bt_bass_send(struct bt_bass *bass,
+		struct bt_bass_bcast_audio_scan_cp_hdr *hdr,
+		struct iovec *params)
+{
+	struct iovec req = {0};
+	uint16_t handle;
+	int err = 0;
+
+	if (!bass || !bass->client || !bass->rdb)
+		return -EINVAL;
+
+	DBG(bass, "bass %p", bass);
+
+	req.iov_base = malloc0(sizeof(*hdr) + params->iov_len);
+	if (!req.iov_base)
+		return -EINVAL;
+
+	util_iov_push_mem(&req, sizeof(*hdr), hdr);
+	util_iov_push_mem(&req, params->iov_len, params->iov_base);
+
+	if (!gatt_db_attribute_get_char_data(bass->rdb->bcast_audio_scan_cp,
+			NULL, &handle, NULL, NULL, NULL)) {
+		err = -EINVAL;
+		goto done;
+	}
+
+	if (!bt_gatt_client_write_without_response(bass->client, handle,
+					false, req.iov_base, req.iov_len))
+		err = -EINVAL;
+
+done:
+	free(req.iov_base);
+
+	return err;
+}
diff --git a/src/shared/bass.h b/src/shared/bass.h
index 1674146bc..864b01637 100644
--- a/src/shared/bass.h
+++ b/src/shared/bass.h
@@ -3,7 +3,7 @@ 
  *
  *  BlueZ - Bluetooth protocol stack for Linux
  *
- *  Copyright 2023 NXP
+ *  Copyright 2023-2024 NXP
  *
  */
 
@@ -135,3 +135,6 @@  bool bt_bass_attach(struct bt_bass *bass, struct bt_gatt_client *client);
 bool bt_bass_set_att(struct bt_bass *bass, struct bt_att *att);
 void bt_bass_detach(struct bt_bass *bass);
 void bt_bass_add_db(struct gatt_db *db, const bdaddr_t *adapter_bdaddr);
+int bt_bass_send(struct bt_bass *bass,
+		struct bt_bass_bcast_audio_scan_cp_hdr *hdr,
+		struct iovec *params);