Skip to content

Commit

Permalink
bluetooth: tester: Add TBS server tests
Browse files Browse the repository at this point in the history
Adding support for TBS server tests.

Signed-off-by: Piotr Narajowski <[email protected]>
  • Loading branch information
piotrnarajowski authored and fabiobaltieri committed Feb 26, 2024
1 parent e9a5834 commit 69381b1
Show file tree
Hide file tree
Showing 7 changed files with 401 additions and 2 deletions.
4 changes: 4 additions & 0 deletions tests/bluetooth/tester/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,7 @@ endif()
if(CONFIG_BT_CAP_INITIATOR)
target_sources(app PRIVATE src/btp_cap.c)
endif()

if(CONFIG_BT_TBS OR CONFIG_BT_GTBS)
target_sources(app PRIVATE src/btp_ccp.c)
endif()
8 changes: 7 additions & 1 deletion tests/bluetooth/tester/overlay-le-audio.conf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ CONFIG_BT_BUF_CMD_TX_SIZE=255

# When initiating Codec Config by server for 3 ASEs one by one, MTU buffers
# were freed too slow. The bt_bap_stream_ops.configured callback comes earlier.
CONFIG_BT_L2CAP_TX_BUF_COUNT=4
CONFIG_BT_L2CAP_TX_BUF_COUNT=10

# CAP
CONFIG_BT_CAP_INITIATOR=y
Expand Down Expand Up @@ -134,3 +134,9 @@ CONFIG_MCTL_REMOTE_PLAYER_CONTROL_OBJECTS=y
CONFIG_MCTL_REMOTE_PLAYER_CONTROL=y
CONFIG_BT_MPL=y
CONFIG_UTF8=y

#TBS
CONFIG_BT_GTBS=y
CONFIG_BT_TBS=y
CONFIG_BT_TBS_MAX_CALLS=10
CONFIG_BT_TBS_SUPPORTED_FEATURES=3
4 changes: 3 additions & 1 deletion tests/bluetooth/tester/src/btp/btp.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include "btp_hap.h"
#include "btp_csip.h"
#include "btp_cap.h"
#include "btp_tbs.h"

#define BTP_MTU 1024
#define BTP_DATA_MAX_SIZE (BTP_MTU - sizeof(struct btp_hdr))
Expand Down Expand Up @@ -69,8 +70,9 @@
#define BTP_SERVICE_ID_HAP 24
#define BTP_SERVICE_ID_CSIP 25
#define BTP_SERVICE_ID_CAP 26
#define BTP_SERVICE_ID_TBS 27

#define BTP_SERVICE_ID_MAX BTP_SERVICE_ID_CAP
#define BTP_SERVICE_ID_MAX BTP_SERVICE_ID_TBS

#define BTP_STATUS_SUCCESS 0x00
#define BTP_STATUS_FAILED 0x01
Expand Down
73 changes: 73 additions & 0 deletions tests/bluetooth/tester/src/btp/btp_tbs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/* btp_mics.h - Bluetooth tester headers */

/*
* Copyright (c) 2024 Codecoup
*
* SPDX-License-Identifier: Apache-2.0
*/

/* TBS commands */
#define BTP_TBS_READ_SUPPORTED_COMMANDS 0x01
struct btp_tbs_read_supported_commands_rp {
uint8_t data[0];
} __packed;

#define BTP_TBS_REMOTE_INCOMING 0x02
struct btp_tbs_remote_incoming_cmd {
uint8_t index;
uint8_t recv_len;
uint8_t caller_len;
uint8_t fn_len;
uint8_t data_len;
uint8_t data[0];
} __packed;

#define BTP_TBS_HOLD 0x03
struct btp_tbs_hold_cmd {
uint8_t index;
} __packed;

#define BTP_TBS_SET_BEARER_NAME 0x04
struct btp_tbs_set_bearer_name_cmd {
uint8_t index;
uint8_t name_len;
uint8_t name[0];
} __packed;

#define BTP_TBS_SET_TECHNOLOGY 0x05
struct btp_tbs_set_technology_cmd {
uint8_t index;
uint8_t tech;
} __packed;

#define BTP_TBS_SET_URI_SCHEME 0x06
struct btp_tbs_set_uri_schemes_list_cmd {
uint8_t index;
uint8_t uri_len;
uint8_t uri_count;
uint8_t uri_list[0];
} __packed;

#define BTP_TBS_SET_STATUS_FLAGS 0x07
struct btp_tbs_set_status_flags_cmd {
uint8_t index;
uint16_t flags;
} __packed;

#define BTP_TBS_REMOTE_HOLD 0x08
struct btp_tbs_remote_hold_cmd {
uint8_t index;
} __packed;

#define BTP_TBS_ORIGINATE 0x09
struct btp_tbs_originate_cmd {
uint8_t index;
uint8_t uri_len;
uint8_t uri[0];
} __packed;

#define BTP_TBS_SET_SIGNAL_STRENGTH 0x0a
struct btp_tbs_set_signal_strength_cmd {
uint8_t index;
uint8_t strength;
} __packed;
3 changes: 3 additions & 0 deletions tests/bluetooth/tester/src/btp/bttester.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,6 @@ uint8_t tester_unregister_mcs(void);

uint8_t tester_init_hap(void);
uint8_t tester_unregister_hap(void);

uint8_t tester_init_tbs(void);
uint8_t tester_unregister_tbs(void);
Loading

0 comments on commit 69381b1

Please sign in to comment.