For GAP/CONN/DCON/BV-05-C PTS expects IUT to fail operation
if the peer does not support Central Address Resolution.
In Test Set there is ALT to start undirected advertising instead
but PTS interpretation is that IUT shall reject directed request
regardless and may then later on follow up with underected
advertising (which PTS doesn't validate). To keep this simple
just reject here.
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
Modify foreach functions in LE Audio to follow the same pattern:
Return true to continue iterating.
Return false to stop iterating.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
TF-PSA-Crypto's bignum module includes some assembly optimization for
x86, x86_64 and ARM64 platforms. When building for "native_sim/native"
on a 64 bit platform the compiler tries to set 32 bit compatibility mode,
but of course assembly functions between 32 and 64 bits architectures
don't match and therefore the build fails.
Disabling optimizations prevents TF-PSA-Crypto from trying to use
assembly and the test passes.
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
These tests directly reference Mbed TLS/TF-PSA-Crypto include path in
their CMakeLists file. This commits adjust the path with new values.
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
bt_uuid_from_str() uses hex2bin() from lib/utils/hex.c and
uuid_from_string() from lib/uuid/uuid.c. Add both dependencies
to each test CMakeLists.txt that compiles
subsys/bluetooth/host/uuid.c, fixing link failures on the
unit_testing platform.
Signed-off-by: Kai Cheng <chengkai@xiaomi.com>
Add comprehensive unit tests for bt_uuid_from_str and bt_uuid_compress
functions to ensure proper conversion of string representations to
Bluetooth UUID structures. Tests cover:
- 16-bit UUID string conversion (e.g., "180d")
- 32-bit UUID string conversion (e.g., "abcdef12")
- 128-bit UUID string conversion with standard format
- Invalid input cases (malformed strings, empty strings, wrong lengths)
- bt_uuid_compress: 128-bit base UUID to 16-bit and 32-bit
- bt_uuid_compress: non-base 128-bit UUID returns -ENOTSUP
- bt_uuid_compress: 16-bit passthrough
Includes proper validation of converted UUID values against
expected results using bt_uuid_cmp().
Signed-off-by: Kai Cheng <chengkai@xiaomi.com>
Replaces usage of these deprecated macros with ones that support
fixed and mapped partition compatibles. Also includes an update to
hal_espressif which also (rightly or wrongly) has zephyr specific
code in it
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Adding subrating request BTP CMD to tester. Since ZLL does not
support subrating, it is not enabled by default in tester config.
Subrating request is already supported by AutoPTS GAP.
Signed-off-by: alperen sener <alperen.sener@nordicsemi.no>
Remove the Kconfig option BT_TBS_SUPPORTED_FEATURES as it was
not used by the subsystem, but only by applications.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Modify bt_ccp_call_control_server_get_bearer_uci to
store the bearer UCI in an output buffer, instead of just
providing the pointer.
The reason for this is to make the result thread safe, and
avoid the user/application having a direct pointer to
internal storage.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Set the CONFIG_BT_CTLR_SYNC_ISO_STREAM_MAX and
CONFIG_BT_CTLR_ADV_ISO_STREAM_MAX to match the
CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT and
CONFIG_BT_BAP_BROADCAST_SNK_STREAM_COUNT count.
This also fixes a compile issue since
CONFIG_BT_ISO_MAX_CHAN=2 and the controller configs
cannot be higher than this.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
IUT works as a a2dp source. The peer device, a2dp sink is
a PC with running bumble on it.
The test content are follows:
case 1: test API register_ep. The api is used to register endpoint.
The case tests it when the parameters is correct or incorrect.
case 2: test API a2dp connect. This case repeats the a2dp connect
operation to verify its correctness
case 3: test API a2dp disconnect.This case repeats the a2dp connect
operation to verify its correctness
case 4: test API a2dp discover. The case send discover and get
(all)capabilities cmd to a2dp source.
case 5: This case will complete the execution process of the test a2dp,
including connect,discover,get cap, open, start,suspend,close.
All cmd are send from sink to source.
case 6: This case will complete the execution process of the test a2dp,
including connect,discover,get cap, open, start,suspend,close.
All cmd are send from source to sink.
Signed-off-by: Cheng Chang <cheng.chang@nxp.com>
IUT works as a a2dp sink. The peer device, a2dp source is
a PC with running bumble on it.
The test content are follows:
case 1: test API register_ep. The api is used to register endpoint.
The case tests it when the parameters is correct or incorrect.
case 2: test API a2dp connect. This case repeats the a2dp connect
operation to verify its correctness
case 3: test API a2dp disconnect.This case repeats the a2dp connect
operation to verify its correctness
case 4: test API a2dp discover. The case send discover and get
(all)capabilities cmd to a2dp source.
case 5: This case will complete the execution process of the test a2dp,
including connect,discover,get cap, open, start,suspend,close.
All cmd are send from source to sink.
case 6: This case will complete the execution process of the test a2dp,
including connect,discover,get cap, open, start,suspend,close.
All cmd are send from sink to source.
Signed-off-by: Cheng Chang <cheng.chang@nxp.com>
The registered_services bitmap was incorrectly sized using
BTP_SERVICE_ID_MAX, which is the last valid service ID (starting
from 0). This caused the bitmap to be one element too small.
Fix by defining BTP_SERVICE_ID_COUNT as (BTP_SERVICE_ID_MAX + 1)
and using it for the ATOMIC_DEFINE size to properly accommodate
all service IDs from 0 to BTP_SERVICE_ID_MAX inclusive.
Add comment explaining the service ID indexing and count calculation.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Instead of reading the CCID and then using
bt_tbs_client_get_by_ccid to get the instance to provide the handles
event, we can now just use bt_tbs_client_get_by_index directly.
This also changes so that the upper tester will receive a
handles event for each instance, and not just for GTBS.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Several places used CONFIG_BT_TBS_MAX_PROVIDER_NAME_LENGTH
instead of
CONFIG_BT_CCP_CALL_CONTROL_SERVER_PROVIDER_NAME_MAX_LENGTH.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Modify bt_ccp_call_control_server_get_bearer_provider_name to
store the bearer provider name in an output buffer, instead of just
providing the pointer.
The reason for this is to make the result thread safe, and
avoid the user/application having a direct pointer to
internal storage.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Increase the Bluetooth RX stack size from the default to 2048 bytes in
the BR/EDR shell test configuration. This provides additional stack
space needed for processing complex Bluetooth Classic operations,
particularly when handling nested SDP attribute parsing.
The increased stack size ensures:
- Sufficient space for recursive SDP attribute parsing
- Prevention of stack overflow during BR/EDR operations
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
No test currently builds Zephyr with CONFIG_BT_DID set, meaning errors
in that feature are not caught by CI.
Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>
Refactor bt_tbs_set_uri_scheme_list to take a single string instead
of an array of URIs. This should not affect applications much
in any way (and may actually be easier to use), but simplifies
the implementation significantly, and reduces memory footprint.
Additionally it also make the client and server more similar
as bt_tbs_client_read_uri_list just returns it as a single
string as well.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
After the switch to the native_sim board instead of
the unit_testing board, we no longer need or use these
mocks.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Disable the GATT GAP service validation for the test.
This test mocks bluetooth modules beside of conn and net_buf.
The mock does not contain functionality required by the validation module.
Signed-off-by: Radosław Koppel <r.koppel@k-el.com>
Add RFCOMM service implementation to the Bluetooth tester framework,
enabling testing of RFCOMM protocol functionality over Bluetooth
Classic connections.
The implementation includes:
- RFCOMM DLC (Data Link Connection) management with support for up to
10 concurrent channels and 5 server instances
- BTP (Bluetooth Test Protocol) command handlers for connect,
disconnect, send data, listen, send RPN, and get DLC info operations
- Event notifications for connection state changes and data transfer
- Integration with the existing BTP service infrastructure
Enable RFCOMM support in the Bluetooth Classic test configuration.
Co-Author: Jiawei Yang <jiawei.yang_1@nxp.com>
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Add check in valid_unicast_audio_start_param to verify
that the ep connection matches the member_conn.
Instead of declaring the endpoints in the unit tests, we
not define them in the mock unicast client and use the
discover function to get pointers.
This allows for a proper implementation of
bt_bap_unicast_client_has_ep as well as makes the tests more similar
to a normal application.
This change required a significant change in the unicast_stop
unit tests as well, which uncovered a small bug in the implementation.
The bug was fixed as part of this commit.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
There's no use of k_poll in the host stack anymore, so remove leftovers
and related definitions.
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
On Windows, using the UNDEFINED device class
and terminal types in the devicetree resulted
in the USB Audio device not being selectable as
input/output sound device.
Changing to HEADSET makes it work.
Signed-off-by: Lars Knudsen <LAKD@demant.com>
The current way of setting the public address using
`bt_hci_driver_api::setup` does not work well in split builds
where host and controller runs on different cores/socs/boards.
This approach requires each HCI driver and each `hci_<transport>`
application to implement the setup and pass the information on
to the next layer.
Zephyr already defines a vendor-specific command that can be used
to set the public address (`bt_hci_cp_vs_write_bd_addr`).
Use this in `bt_enable` after opening the HCI transport and before
initializing the id module. This makes the setup independent of
hci transport and only depends on a controller that implements the
Zephyr HCI VS commands.
Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
Replaces the previous static bearer registration with a dynamic
runtime registration flow driven by Auto-PTS. This allows the
tester to create GTBS and TBS instances at runtime with complete
metadata in the correct registration orders.
Signed-off-by: Alex Ciascai <ciascai.alexandru@gmail.com>
Configure the HAS tester to advertise preset synchronization support by
setting preset_sync_support=true in bt_has_register(). This passing the
PTS tests, even if we fake the synchronization. The test does not require
an additional lower tester, so there is no other IUT to synchronize with.
Additional any actual inter-device synchronization is expected to be
implemented by the application..
Signed-off-by: Alex Ciascai <alexandru.ciascai@nordicsemi.no>
Add a user_data field to bt_ccp_call_control_client_cb. The
field is optional to enable via Kconfig. The field can be used
to provide additional context from the owner of the callback
structure, to the callbacks themselves.
This solves a memory use-after-free issue in the unit tests
where the values from the callback was accessed after they
were released, as the values were just stack allocated.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Snippets in zephyr should be globally usable for general purpose,
snippets for a single application are not a valid use-case (that
is intended for user applications in their own repositories),
therefore remove these
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
When this test is built with CONFIG_NO_OPTIMIZATIONS (which is the case
when building with CONFIG_COVERAGE) or when building with debug logging,
it fails to link due to lacking bt_uuid_str().
Let's include the corresponding file so it can link.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
The bonding information of classic can be deleted by calling the
function `bt_br_unpair()`.
The BTP command `unpair` does not support the case. Calling the
function `bt_br_unpair()` to delete classic bonding information if
the address is BR type when the BTP command `unpair` is received.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Add a callback mechanism to allow applications to handle incoming
BR/EDR connection requests and decide whether to accept or reject
them, as well as specify the desired role (central/peripheral).
Update bt_br_set_connectable() to accept an optional callback function
parameter. When provided, callback is invoked on incoming connection
requests, allowing the application to inspect the remote device address
and Class of Device before accepting or rejecting the connection.
If no callback is provided, the connection request is accepted
internally with the default behavior based on the
`CONFIG_BT_ACCEPT_CONN_AS_CENTRAL` configuration option.
The accept_conn() function is updated to:
- Call the registered callback if available
- Pass the remote device address and Class of Device to the callback
- Accept the connection if the callback returns BT_BR_CONN_REQ_ACCEPT_*
- If the returned value is BT_BR_CONN_REQ_ACCEPT_CENTRAL, the role
switch will be requested.
- Reject the connection if the callback returns BT_BR_CONN_REQ_REJECT_*
- Add error handling and logging for failed connection acceptance
Update all existing callers of bt_br_set_connectable() to pass NULL
for the callback parameter to maintain backward compatibility.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Add a new test case for the Bluetooth shell to verify the
BT_ACCEPT_CONN_AS_CENTRAL configuration option.
The test uses the BR/EDR configuration and enables the option to
accept incoming ACL connections as central role.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Some of the BAP broadcast functions was missing a check for
allocated.
Adding the checks exposed a bug in the CAP commands where
the broadcasts were never actually allocated. Since there
is not a command for that in CAP, a workaround has been
implemented to use the first command (setup_stream) to
allocate a BAP broadcast with a dummy broadcast ID.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Fix the missing use of remainder value in the sync_offset_us
calculations. Also, Periodic Sync reception is relative to
Peripheral event hence ticks_anchor does not require the
ticker margin and event jitter to be subtracted.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Add a dependency for UTF8 for LE Audio. Since (nearly?) all
string in LE Audio are UTF8 and that the stack wants to be
able to check and validate strings coming both from remove
deviecs and from the application, it will depend on the utf8
API that is guarded by CONFIG_UTF8.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
cmd_blob_target() always returned 0 even when the target list was
full, making error checks at call sites unreachable.
Return a proper error code when no more targets can be added so
callers can correctly detect and handle the failure.
Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
CAR characteristic read process was incomplete, CAR status was not
actually stored.
Added a new BTP_GAP_EV_PEER_CAR_RECEIVED to tester. This is to
prevent disconnect events before IUT successfully reads CAR from
central.
Updated start_directed_advertising() so that if the central has
no CAR support we must not send directed advertisements. IUT
might enter another connectable mode according to specification,
thus IUT starts sending connectable undirected advertisements with
resovable address.
Signed-off-by: alperen sener <alperen.sener@nordicsemi.no>