Commit Graph

2434 Commits

Author SHA1 Message Date
Lyle Zhu
af42036ca6 Bluetooth: Classic: SDP: Improve UUID 128 support
In current implementation, the UUID 128 is not well supported. The
found issue includes,
Issue 1: No clear byte order of the UUID 128 in local SDP record.
Issue 2: No clear byte order of the UUID 128 of the SDP discover
parameter.

For issue 1,
Add the description to note that if the SDP attribute type is
`BT_SDP_UINT128`, `BT_SDP_INT128`, and `BT_SDP_UUID128`, the byte
order should be little-endian.

And swap the 128bit from little-endian to big-endian when responding
the peer SDP discovery request.

For issue 2,
Add the description to note that if the SDP discovery type is
`Service Search` and `Service Search Attribute`, and UUID is UUID 128,
the passed UUID data of the discovery request parameter should be
represented as the little-endian byte-order sequence.

And swap the 128bit from little-endian to big-endian when packing the
SDP discovery packet.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-07-29 11:21:37 +01:00
Emil Gydesen
220571efcb Bluetooth: CCP: Check conn type before access by index
Ensure that the connection type of the provided bt_conn is
an LE connection.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-07-28 16:45:17 -04:00
Sean Madigan
3adae8bd9a bluetooth: host: Add support for extended feature set feature
This commit adds support for the extended feature set
feature. This includes:
- hci boilerplate
- kconfigs, including one for a max local feature page
- reading remote features is done by a command and callback
- this is not linked into the auto feature request on
connection as this procedure can take quite a few connection
events, and we do not want to delay the user
- added the commands to the bt shell

Signed-off-by: Sean Madigan <sean.madigan@nordicsemi.no>
2025-07-28 08:48:30 -04:00
Anas Nashif
87917a1087 tests: bt: host: mock k_heap_aligned_alloc
unit tests needs mocking for k_heap_aligned_alloc.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-07-20 23:25:14 -04:00
Gaetan Perrot
76260d0eb8 tests: bluetooth: audio: vocs: fix null dereference
Avoid possible null pointer dereference by moving 'vocs->conn = conn'
after null check on 'vocs' in bt_vocs_discover().

Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
2025-07-19 15:42:32 -04:00
Gaetan Perrot
771d3f0dc2 tests: bluetooth: audio: aics: fix null dereference
Move assignment 'aics->conn = conn' after null check on 'aics' to avoid
undefined behavior.

Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
2025-07-19 15:42:32 -04:00
Gaetan Perrot
2e6ac4d8a7 tests: bluetooth: audio: bap_unicast_client: fix null dereference
Move 'printk' call after null checks on 'stream' and 'stream->ep' to avoid
potential null pointer dereference.

Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
2025-07-19 15:42:32 -04:00
Emil Gydesen
d0958995a3 tests: Bluetooth: Tester: Handle BIGInfo after sync request
In the BAP Broadcast Sink implementation the sync request,
the BIGInfo and the broadcast code can come in any other.
Currently the btp_bap_broadcast_sink_bis_sync would reject
the request if it came before the BIGInfo, but will now
instead store the request and then apply it once the BIGInfo
has been received, as there is not BIGInfo BTP event that the
caller can use.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-07-19 10:17:11 +02:00
Cheng Chang
419cb3da69 tests: bluetooth: classic: Add test suite l2cap.
IUT works as a l2cap server with basic mode. The peer device,
l2cap client with basic mode, is a PC with running `bumble` on it.
This test only performs the function of L2CAP basic mode.
Support multiple l2cap enerties in new shell l2cap_br,
which may support more test function.

In the test suite , there are two groups in test cases.
Group 1 Including case1-case8 focuses on connection and
disconnection around l2cap. The impact of active and passive
acl connectivity, disconnectivity and authentication as well as
disconnection from ACL without l2cap disconnect is tested.

Group2 Including case9-case14 revolves around the basic
 parameters of L2CAPserver configuration, data transfer.
Case 9:   Test l2cap connection with max MTU(0xffff).But the max mtu
which the stack supports is (CONFIG_BT_BUF_ACL_RX_SIZE - 4U = 196).
Case 10: Test l2cap connection with min MTU(0x30),set server mtu = 48,
client mtu = 0xffff, l2cap connect successfully,
client mtu = 0xffff, server mtu = 48.
Case 11: Test l2cap connection with min MTU(0x30),set server mtu < 48,
client mtu = 0xffff, l2cap connect fail.
Case 12: Test l2cap connection with min MTU(0x30),set server mtu = 48,
client mtu<48,l2cap connect successfully,
client mtu=48,server mtu=48.
Case 13: Test l2cap connection with invaild PSM.
Case 14: Test l2cap multi_channel connection and data tranfer.
Case 15: Stress Test. Repeat l2cap connect, disconnect operation.
Case 16: Stress Test. Repeat data transfer in a single connection.
In Case 15 and 16, if enlarging STRESS_TEST_MAX_COUNT and test fail,
you can enlarge timeout in  testcase.yml.

test_l2cap_server.py is a file containing real test cases.
test_l2cap_common.py is a common file. It encapsulates some
test function functions that are commonly used for test cases.

Signed-off-by: Cheng Chang <cheng.chang@nxp.com>
2025-07-19 09:51:31 +02:00
Jiawei Yang
ff112b5e05 tests: Bluetooth: BR: Add test suite RFCOMM_client
IUT works as an RFCOMM Client. The peer device, RFCOMM server, is a PC
running bumble.

Add following test cases:

Case 6, RFCOMM MTU Size Data Send/Receive Test. To verify that the RFCOMM
client can correctly send and receive data packets that are exactly equal
to the negotiated MTU size.

Case 7, RFCOMM Data Transfer Exceeding MTU Size Test. To verify that the
RFCOMM client can reject sending and receiving data packets that exceed
the negotiated MTU size.

Case 8, RFCOMM Disconnect and Reconnect Test. To verify that the RFCOMM
client can properly handle a normal RFCOMM disconnection and successfully
reestablish the connection.

Case 9, RFCOMM Recovery After ACL Disconnection Test. To verify that the
RFCOMM client can properly recover when the underlying ACL connection is
abruptly disconnected, by reestablishing both ACL and RFCOMM connections.

Signed-off-by: Jiawei Yang <jiawei.yang_1@nxp.com>
2025-07-10 10:12:20 -05:00
Mark Wang
a7822079dc tests: bluetooth: add test case that sdp client l2cap connecting fail
test the sdp request callback is called when sdp l2cap connecting fail.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2025-07-10 10:11:59 -05:00
Can Wang
d56f1e018d tests: Bluetooth: BR: Add test suite of bonding for SMP
IUT works as an SM Initiator/Responder. The peer device,
SM Responder/Initiator, is a PC running bumble on it.

Add shell commands to create and manage L2CAP server and channel with
different security level.

In the test suite, there are 5 test cases. The test matrix combines
each bonding flag:
| Test Case ID | Initiator | Responder | Expected Result |
|--------------|-----------|-----------|-----------------|
| BR_SM_Bonding_INIT_001 | Non-bondable | Non-bondable | Pass |
| BR_SM_Bonding_INIT_005 | General Bonding | General Bonding | Pass |
| BR_SM_Bonding_RSP_010 | Non-bondable | Non-bondable | Pass |
| BR_SM_Bonding_RSP_011 | General Bonding | Non-bondable | Fail |
| BR_SM_Bonding_RSP_014 | General Bonding | General Bonding | Pass |

Signed-off-by: Can Wang <can.wang@nxp.com>
2025-07-10 10:11:38 -05:00
Can Wang
9937be7c30 tests: Bluetooth: BR: Add general test suite for SMP
IUT works as an SM Initiator/Responder. The peer device,
SM Responder/Initiator, is a PC running bumble on it.

Add shell commands to create and manage L2CAP server and channel with
different security level, reboot the board, and transfer data on the
SDP channel.

In the test suite, there are 28 test cases to verify SMP functions.
The test case list is:
- BR_SM_INIT_001: Basic Pairing with No Input No Output Capability
- BR_SM_INIT_002: Pairing with Display Only Capability
- BR_SM_INIT_003: Pairing with Keyboard Only Capability
- BR_SM_INIT_005: L2CAP Connection Failure After Successful Pairing
- BR_SM_INIT_006: L2CAP Server with Incoming Connection
- BR_SM_INIT_008: ACL Disconnection During Pairing
- BR_SM_INIT_011: Repeated Pairing Between Same Devices
- BR_SM_INIT_012: Security Level Escalation
- BR_SM_INIT_013: Multiple Channel Establishment
- BR_SM_INIT_017: Pairing Rejection by Remote Device
- BR_SM_INIT_018: Pairing Timeout
- BR_SM_INIT_021: Authentication Failure during Pairing
- BR_SM_INIT_022: Secure Connection vs. Legacy Pairing Fallback
- BR_SM_INIT_025: Rejection of Weak Pairing Methods
- BR_SM_INIT_028: Reconnection After Key Deletion
- BR_SM_INIT_029: Pairing with Delayed Response
- BR_SM_INIT_030: Stress Testing with Multiple Connect/Disconnect Cycles
- BR_SM_INIT_032: Power Loss Recovery
- BR_SM_INIT_034: Pairing During Active Data Transfer
- BR_SM_INIT_035: Pairing with Very Long PIN/Passkey
- BR_SM_INIT_037: Pairing with Peripheral Requesting Maximum Key Size
- BR_SM_INIT_039: Security Level Downgrade Attempt
- BR_SM_RSP_001: Basic Non-bondable Pairing with No Input No Output
- BR_SM_RSP_002: Display Only with Secure Connection
- BR_SM_RSP_003: Keyboard Only with Dedicated Bonding
- BR_SM_RSP_006: Security Level Enforcement
- BR_SM_RSP_008: L2CAP Connection with Security Level 1
- BR_SM_RSP_009: L2CAP Server with Security Level 2

Signed-off-by: Can Wang <can.wang@nxp.com>
2025-07-10 10:11:22 -05:00
Can Wang
f4257e1318 tests: Bluetooth: BR: Add test suite of SC Only Mode for SMP
IUT works as an SM Initiator/Responder. The peer device,
SM Responder/Initiator, is a PC running bumble on it.

Add shell commands to create and manage L2CAP server and channel with
different security level.

In the test suite, there are 10 test cases. IUT is configured
with Secure Connections Only Mode. The peer device is configured with
Secure Connections Mode or Legacy Mode. The test matrix is:
| Case ID | Secure Connection Option | Security Level | Expected Result |
|---------|--------------------------|----------------|-----------------|
| BR_SM_SC_INIT_005 | SC Only with SC | Level 4 | Pass |
| BR_SM_SC_INIT_006 | SC Only with SC | Level 1 | Fail |
| BR_SM_SC_INIT_007 | SC Only with SC | Level 2 | Fail |
| BR_SM_SC_INIT_008 | SC Only with SC | Level 3 | Fail |
| BR_SM_SC_INIT_009 | SC Only with Legacy | Level 3 | Fail |
| BR_SM_SC_RSP_005 | SC Only with SC | Level 1 | Fail |
| BR_SM_SC_RSP_006 | SC Only with SC | Level 2 | Fail |
| BR_SM_SC_RSP_007 | SC Only with SC | Level 3 | Fail |
| BR_SM_SC_RSP_008 | SC Only with SC | Level 4 | Pass |
| BR_SM_SC_RSP_009 | SC Only with Legacy | Level 3 | Fail |

Signed-off-by: Can Wang <can.wang@nxp.com>
2025-07-10 10:11:01 -05:00
Can Wang
5e8046df2e tests: Bluetooth: BR: Add test suite of IO Capability for SMP
IUT works as an SM Initiator/Responder. The peer device,
SM Responder/Initiator, is a PC running bumble on it.

Add shell commands to create and manage L2CAP server and channel with
different security level.

In the test suite, there are 32 test cases. The peer device is
configured with "Display YesNo" IO capability. The test matrix
combines each local IO capability with each security level requirement:

| Case ID | Local IO Capability | Security Level | Expected Outcome |
|---------|---------------------|----------------|------------------|
| BR_SM_IO_CAP_INIT_001 | No Input No Output | Level 1 | Success |
| BR_SM_IO_CAP_INIT_002 | No Input No Output | Level 2 | Success |
| BR_SM_IO_CAP_INIT_003 | No Input No Output | Level 3 | Failure |
| BR_SM_IO_CAP_INIT_004 | No Input No Output | Level 4 | Failure |
| BR_SM_IO_CAP_INIT_005 | Display Only | Level 1 | Success |
| BR_SM_IO_CAP_INIT_006 | Display Only | Level 2 | Success |
| BR_SM_IO_CAP_INIT_007 | Display Only | Level 3 | Failure |
| BR_SM_IO_CAP_INIT_008 | Display Only | Level 4 | Failure |
| BR_SM_IO_CAP_INIT_009 | Keyboard Only | Level 1 | Success |
| BR_SM_IO_CAP_INIT_010 | Keyboard Only | Level 2 | Success |
| BR_SM_IO_CAP_INIT_011 | Keyboard Only | Level 3 | Success |
| BR_SM_IO_CAP_INIT_012 | Keyboard Only | Level 4 | Success |
| BR_SM_IO_CAP_INIT_013 | Display YesNo | Level 1 | Success |
| BR_SM_IO_CAP_INIT_014 | Display YesNo | Level 2 | Success |
| BR_SM_IO_CAP_INIT_015 | Display YesNo | Level 3 | Success |
| BR_SM_IO_CAP_INIT_016 | Display YesNo | Level 4 | Success |
| BR_SM_IO_CAP_RSP_001 | No input No output | Level 1 | Success |
| BR_SM_IO_CAP_RSP_002 | No input No output | Level 2 | Success |
| BR_SM_IO_CAP_RSP_003 | No input No output | Level 3 | Failure |
| BR_SM_IO_CAP_RSP_004 | No input No output | Level 4 | Failure |
| BR_SM_IO_CAP_RSP_005 | Display Only | Level 1 | Success |
| BR_SM_IO_CAP_RSP_006 | Display Only | Level 2 | Success |
| BR_SM_IO_CAP_RSP_007 | Display Only | Level 3 | Failure |
| BR_SM_IO_CAP_RSP_008 | Display Only | Level 4 | Failure |
| BR_SM_IO_CAP_RSP_009 | Keyboard Only | Level 1 | Success |
| BR_SM_IO_CAP_RSP_010 | Keyboard Only | Level 2 | Success |
| BR_SM_IO_CAP_RSP_011 | Keyboard Only | Level 3 | Success |
| BR_SM_IO_CAP_RSP_012 | Keyboard Only | Level 4 | Success |
| BR_SM_IO_CAP_RSP_013 | Display YesOrNo | Level 1 | Success |
| BR_SM_IO_CAP_RSP_014 | Display YesOrNo | Level 2 | Success |
| BR_SM_IO_CAP_RSP_015 | Display YesOrNo | Level 3 | Success |
| BR_SM_IO_CAP_RSP_016 | Display YesOrNo | Level 4 | Success |

Signed-off-by: Can Wang <can.wang@nxp.com>
2025-07-10 10:10:30 -05:00
Jiawei Yang
bea02a639b tests: Bluetooth: BR: Add test suite RFCOMM_server
IUT works as an RFCOMM Server. The peer device, RFCOMM Client, is a PC
running bumble on it.

Add shell commands to create and manage RFCOMM server with different
flow control mechanisms.

In the test suite, there are seven test cases:
Case 1: RFCOMM Server - Reject RFCOMM Session. IUT should properly
reject incoming RFCOMM session when BR connection is disconnected.
Case 2: RFCOMM Server - Forward compatible with Bluetooth devices that
do not send PN command. IUT should properly handle this case and use
FCON/FCOFF as flow control.
RPN, Test) and send NSC responses
Case 3: RFCOMM Server - Respond to Control Commands After DLC
Establishment. IUT should properly respond to control commands (RLS,
RPN, Test) and send NSC responses.
Case 4: RFCOMM Server - Information Transfer with Aggregate Flow
Control. IUT should handle information transfer with aggregate flow
control and properly issue flow control signals.
Case 5: RFCOMM Server - Information Transfer with Credit Based Flow
Control and Active Disconnection. IUT should handle credit-based flow
control and actively disconnect DLC.
Case 6: RFCOMM Server - Information Transfer with Credit Based Flow
Control and Passive Disconnection. IUT should handle credit-based flow
control and respond to DLC disconnection.

Signed-off-by: Jiawei Yang <jiawei.yang_1@nxp.com>
2025-07-10 10:09:13 -05:00
Olivier Lesage
ef7ede64cc bluetooth: host: Do not try to set NRPA when scanning with identity
Attempting this would fail (assuming the controller is implemented
correctly) because when using legacy commands it is not allowed to
change the device address while scanning.

It also did not make sense. If we have configured the scanner to use
the identity address as own_addr, because the advertiser and scanner
addresses are shared when using legacy commands, setting the adv NRPA
here would overwrite the identity address used by the scanner, which
I assume is not the intention.

Signed-off-by: Olivier Lesage <olivier.lesage@nordicsemi.no>
2025-07-08 13:37:26 -05:00
Olivier Lesage
43223a1661 bluetooth: host: Fix uninitialized own_addr_type for legacy scan+adv
In 25c993e5b7 a new case was introduced
where own_addr_type is not set by bt_id_set_scan_own_addr properly.

This led to issues for users where increasing their zephyr version
led to failures to start scanning after advertising in the case where
CONFIG_BT_SCAN_WITH_IDENTITY=n and legacy advertising commands are used.

Signed-off-by: Olivier Lesage <olivier.lesage@nordicsemi.no>
2025-07-08 13:37:26 -05:00
Emil Gydesen
e72e837971 tests: Bluetooth: Tester: VCP BSIM test
Adds BSIM testing of the VCP features of the BT Tester.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-07-01 10:54:09 -10:00
Johan Hedberg
b0bed23fd2 Bluetooth: tests: Use bt_hci_cmd_alloc()
Use bt_hci_cmd_alloc() instead of the soon to be deprecated
bt_hci_cmd_create().

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2025-06-23 12:44:53 -07:00
Jiawei Yang
c89441a90d tests: Bluetooth: BR: Add test suite RFCOMM_client
IUT works as an RFCOMM Client. The peer device, RFCOMM server, is a PC
running bumble.

In the test suite, there are five test cases:
Case 1, RFCOMM Client with Command Responses. Tests that the client can
establish a DLC, respond to various commands (RLS, RPN, Test), send NSC
responses, and properly handle DLC disconnection and RFCOMM session
shutdown.
Case 2, RFCOMM Client with Credit Based Flow Control. Tests that the
client can establish a DLC, perform information transfer with credit
based flow control, initiate disconnection, and shutdown the RFCOMM
session.
Case 3, RFCOMM Client with BR Connection Disconnection. Tests that the
client correctly handles scenarios where the BR connection is
disconnected during DLC establishment.
Case 4, RFCOMM Client with Aggregate Flow Control. Tests that the client
can establish a DLC, perform information transfer with aggregate flow
control, and properly handle disconnection and session shutdown.
Case 5, RFCOMM Client with Failed PN Response. Tests that the client
correctly handles scenarios where it fails to receive a PN response when
establishing a DLC.

Signed-off-by: Jiawei Yang <jiawei.yang_1@nxp.com>
2025-06-18 11:15:18 +01:00
Emil Gydesen
2ab5882e0b Bluetooth: CAP: Add cap_unicast_group API
Adds a new abstract struct for unicast group that is
specific for CAP. The difference between this and the BAP
unicast group, is that the parameters are CAP streams and
thus ensuring that the streams in the group adhere to the
additional requirements that CAP has on top of BAP.

This also adds foreach functions for both CAP and BAP
to allow users to iterate on the streams in the
abstract groups.

Various samples, modules and tests have been updated
to use the CAP struct and API.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-06-17 08:20:25 +02:00
Szymon Janc
34e47f4040 tests: Bluetooth: Fix DFUM and MBTM in PTS ICS
Exporting tools is not yet fixed and those needs to be manually
adjusted.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2025-06-13 15:42:53 -07:00
Szymon Janc
2e32b009b3 tests: Bluetooth: Update ICS to TCRL 2025-2
Changes to features:
 - removed not supported GATT client reliable write support
 - enabled BAP Broadcast Assistant
 - enabled PBP Broadcast Assistant
 - enabled GMAP 1.0.1
 - PAST support enabled where applicable
 - minor consistency check fixes

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2025-06-12 13:40:49 +02:00
Szymon Janc
256401ed2b tests: Bluetooth: Tester: Add support for PAST
This adds support for BTP commands and events required for running
PAST tests.

struct btp_gap_ev_periodic_transfer_received_ev is also adjusted
to match BTP specification.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2025-06-10 13:28:31 +02:00
Mark Wang
263cc93827 tests: Bluetooth: Classic: Add uuid128 service test
add one sdp service that contains uuid128, improve test to save bumble
hci log.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2025-06-10 12:13:18 +02:00
Szymon Janc
ad37e04d17 test: Bluetooth: Tester: Fix build with EATT disabled
This allows to disable EATT when needed.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2025-06-10 12:13:01 +02:00
Szymon Czapracki
c91b98c829 tests: Bluetooth: tester: Instructions for btsnoop and RTT logging
Updated the tester README with configuration options required to
build with support for btsnoop and SEGGER RTT log backends. This
helps developers capture logs for debugging and analysis during
Bluetooth testing.

Signed-off-by: Szymon Czapracki <szymon.czapracki@codecoup.pl>
2025-06-06 08:45:23 +02:00
Aleksandr Khromykh
a046f25fe7 tests: bluetooth: tester: fix configuration to use max fwid length
Commit sets max possible number of tx and rx segments
to not adapt them anymore.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2025-06-05 15:14:35 -05:00
Jiawei Yang
b2340babdf tests: Bluetooth: BR: Add test suite gap_client
IUT works as a Bluetooth GAP Client. The peer device (tester) is
configured to respond to inquiries and process connection requests.

Add tests to verify GAP client functionality for inquiry, connection,
and disconnection scenarios.

In the test suite, there are six test cases:
Case 1: General Inquiry followed by Connection and Active Disconnection.
Verifies that DUT can perform general inquiry, establish connection, and
actively disconnect from tester.
Case 2: General Inquiry followed by Connection and Passive
Disconnection. Verifies that DUT can perform general inquiry, establish
connection, and handle disconnection initiated by tester.
Case 3: General Inquiry followed by Rejected Connection Request.
Verifies that DUT can perform general inquiry and handle connection
rejection from tester.
Case 4: Limited Inquiry followed by Connection and Active Disconnection.
Verifies that DUT can perform limited inquiry, establish connection, and
actively disconnect from tester.
Case 5: Limited Inquiry followed by Connection and Passive
Disconnection. Verifies that DUT can perform limited inquiry, establish
connection, and handle disconnection initiated by tester.
Case 6: Limited Inquiry followed by Rejected Connection Request.
Verifies that DUT can perform limited inquiry and handle connection
rejection from tester.

Signed-off-by: Jiawei Yang <jiawei.yang_1@nxp.com>
2025-05-29 20:21:50 -04:00
Jiawei Yang
38a6fc5e6f tests: Bluetooth: BR: Add GAP Server role test suite
IUT works as a GAP Server (Peripheral) in the Bluetooth system. The peer
device, GAP Client,
is a PC running Bumble as a test tool.

This test suite implements the following test cases:
Case 1, Non-connectable Mode Testing. Verifies DUT can operate in
non-connectable mode without allowing connections.
Case 2, Connectable Non-discoverable Mode with Active Disconnection.
Verifies DUT can accept connections and initiate disconnection.
Case 3, Connectable Non-discoverable Mode with Passive Disconnection.
Verifies DUT can accept connections and handle passive disconnection.
Case 4, Connectable Non-discoverable Mode with Connection Rejection.
Verifies DUT can reject connection requests.
Case 5, Limited Discoverable Mode with Active Disconnection. Verifies
DUT in limited discoverable mode can be discovered, accept connections
and initiate disconnection.
Case 6, Limited Discoverable Mode with Passive Disconnection. Verifies
DUT can be discovered, accept connections and handle passive
disconnection.
Case 7, Limited Discoverable Mode with Connection Rejection. Verifies
DUT can be discovered but reject connection requests.
Case 8, General Discoverable Mode with Active Disconnection. Verifies
DUT in general discoverable mode can be discovered, accept connections
and initiate disconnection.
Case 9, General Discoverable Mode with Passive Disconnection. Verifies
DUT can be discovered, accept connections and handle passive
disconnection.
Case 10, General Discoverable Mode with Connection Rejection. Verifies
DUT can be discovered but reject connection requests.

Signed-off-by: Jiawei Yang <jiawei.yang_1@nxp.com>
2025-05-29 20:21:40 -04:00
Mark Wang
38fce64e6a bluetooth: shell: the setting is forced as disabled for mimxrt1170_evkb
delete the default configs of disabling the setting on mimxrt1170_evkb.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2025-05-27 16:44:45 +02:00
Krzysztof Chruściński
5acd29e651 tests: all: Fix remaining issues reported by string validation
Fix issues reported by string validation which was added to strings
used in zassert macros.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2025-05-27 09:16:08 +02:00
Alberto Escolar Piedras
4d4f3728c9 tests/bluetooth & bsim: Fix code compliance issues
Fix issues detected by checkpatch

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-05-21 12:35:28 +02:00
Emil Gydesen
69b722566a tests: Bluetooth: Tester: Audio: Cleanup includes
Update the includes so that only what is actually used is included,
and so that everything is used is includes (IWYU).

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-05-19 16:48:53 +01:00
Emil Gydesen
615409b349 tests: Bluetooth: Audio: Remove dependency on host mocks
Removes the dependency on the host mocks for LE Audio tests.
This is done by copying the missing mocks for assert into
the audio mocks, and then always including ztest.h.

The inclusion of ztest.h is due to the fact that
arch/cpu.h does not have an appropriate header file for
ztest, and some header files depend on ARCH_STACK_PTR_ALIGN
which is usually defined by those headers in cpu.h. However
ztest.h does define this value as well, and thus needs
to be included always.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-05-14 14:10:02 +02:00
Pavel Vasilyev
14b4e30cdf bluetooth: host: Deprecated BT_CONN_TX_MAX
After https://github.com/zephyrproject-rtos/zephyr/pull/72090,
`conn_tx_alloc` no longer blocks, and each buffer always has a
corresponding `bt_conn_tx` object. This eliminates the need to configure
the number of `bt_conn_tx` objects via `CONFIG_BT_CONN_TX_MAX`, since
every buffer now carries its own context even when no callback is used.

This commit deprecates `CONFIG_BT_CONN_TX_MAX` as it is no longer
necessary. Instead, `CONFIG_BT_BUF_ACL_TX_COUNT` is used to allocate
`bt_conn_tx` objects for outgoing ACL data. ZLL already uses
`CONFIG_BT_BUF_ACL_TX_COUNT` to configure the number of outgoing ACL
packets. With this change, modifying the packet count will automatically
adjust the number of corresponding contexts, preventing both context
starvatoin and underutilization.

This approach also aligns with ISO, where the number of `bt_conn_tx`
objects for outgoing ISOdata matches `CONFIG_BT_ISO_TX_BUF_COUNT`.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2025-05-12 14:54:26 +02:00
Emil Gydesen
eeb1d92df4 tests: Bluetooth: Tester: Set controller ACL buffer size
Change the ACL buffer sizes to be a higher value than the
default, as that caused some issues with the CIS established
event.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-05-09 14:02:10 +02:00
Emil Gydesen
c8cb0426d2 tests: Bluetooth: Tester: Update supported_services
The supported bits were out of date and the response size
was incorrect.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-05-07 13:31:58 +02:00
Emil Gydesen
18193b86c3 tests: Bluetooth: Tester: Validate PBP features
Add validation of the PBP features in the
pbp_set_public_broadcast_announcement function.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-05-07 13:31:48 +02:00
Emil Gydesen
181a0238a2 tests: Bluetooth: Tester: Fix bad rsp len of CAP broadcast setup
The btp_cap_broadcast_source_setup_rp was reported with
an invalid length.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-05-07 13:31:39 +02:00
Emil Gydesen
228d89b433 tests: Bluetooth: Tester: Default to use overlay-bt_ll_sw_split.conf
Default the BT Tester to use the overlay-bt_ll_sw_split.conf for all
Zephyr based configurations.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-05-07 13:31:20 +02:00
Emil Gydesen
7f0c78210a tests: Bluetooth: Tester: Add new BT controller config
Adds a new BT controller configuration that can be applied
to multiple boards and not specific to the nRF5340 cpunet
as the existing setup uses from hci_ipc.

The config is based on nrf5340_cpunet_iso-bt_ll_sw_split.conf
from hci_ipc sample.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-05-07 13:31:20 +02:00
Emil Gydesen
b7a85a4ca5 tests: Bluetooth: Tester: Add missing checks for tx in bcast
The stream_started and stream_stopped callbacks are called for
both broadcast sink and source in the BT Tester, and thus
they should check if the stream can send before attempting
to register it for TX (which would otherwise fail).

This also guards the call to btp_send_bis_syced_ev so that
the event is only sent for broadcast sinks.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-05-07 13:31:09 +02:00
Emil Gydesen
ae4c6fe609 tests: Bluetooth: Tester: Refactor ACSC events for BAP unicast
This commit refactors when the BTP_ASCS_EV_OPERATION_COMPLETED
is sent to the upper tester. Previously it was send
in the stream changed callbacks, but that would send
the events to the BAP Unicast Server when it did not initiate
any changes, and would not properly match when the control
point operation was completed (which happens before the
ASE state changes).

This change makes it easier to determine when an operation was
actually completed, and easier to separate that from a
ASE state change which is another type of event.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-05-07 11:44:40 +02:00
Emil Gydesen
2263fb8ec7 tests: Bluetooth: tester: Send stream changed event for all states
The ase state changed event was only sent when entering the
streaming state, rather whenever there is a state change.

This commit sends the event for all ASE/stream state changes.
To make it clear that these are called in the callbacks,
the callbacks have all been suffixed with _cb.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-05-07 11:44:40 +02:00
Benjamin Cabé
38f822cff2 tests: Bluetooth: fix misspelling of brief in doxygen
Fixes trivial typo

Co-authored-by: Harry Martin <48959255+Harry-Martin@users.noreply.github.com>
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-05-07 11:44:33 +02:00
Emil Gydesen
c2178bc25e tests: Bluetooth: Tester: Update README to rst and add text
Update the README file to be .rst instead of (implied) .md
and update the text w.r.t. supported profiles and services,
and how to build for LE Audio.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-05-07 10:29:24 +02:00
Emil Gydesen
6ddc988c1e tests: Bluetooth: Audio: Fix includes
Updates the includes in a a few files to
avoid including unused header files and include the
ones that are used.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-05-01 13:42:37 +02:00
Johan Hedberg
6a24e6d152 Bluetooth: tests: Update to use new H:4 buffer encoding
Update the Bluetooth tests to assume the new H:4 encoding for data that's
passing between HCI drivers and their users (normally the host stack).

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2025-04-29 13:00:33 +02:00