Commit Graph

298 Commits

Author SHA1 Message Date
Sumeet Singh 7d06b1c8ca feat(nimble): Added some fixes to pass PTS cases 2025-05-07 15:26:02 +05:30
Roshan Bangar cd5a88be94 Nimble: Migration changes for nimble-1.5 2024-02-20 11:18:09 +05:30
isha.pardikar@espressif.com 4ae124d1cd NimBLE : Change GATT notify/indicate from gattc to gatts 2024-02-14 18:24:30 +05:30
Anton Maklakov aed041f6e7 fix -Wstrict-prototypes issues 2024-02-14 12:44:44 +05:30
Krzysztof Kopyściński 4cf74c3bf5 apps/bttester: remove unstalled_cb from btp_l2cap.c
Response to BTP_L2CAP_SEND_DATA command is already sent in command
handler (`send_data()`). Sending further responses to already answered
command is confusing - we cannot fail successful procedure
retroactively. Data sending is already confirmed to be started
successfully and no further responses are expected - more so, it appears
to break `available_queue` management and further commands cannot be
processed correctly.

Similar callback may be proposed in the future if confirmation of
sending data is needed, but not in form of BTP response, but BTP event.
2023-08-03 15:39:23 +02:00
Krzysztof Kopyściński 338cb747f0 apps/bttester: fix check for address type in advertising_start()
Encapsulated cases in correct configuration check
(BTTESTER_PRIVACY_MODE). Used simple bit comparison, as glue module was
dropped.
2023-08-02 21:26:06 +02:00
Krzysztof Kopyściński 3c4bc60cae apps/bttester: copy whole buffer to response of get_attr_val
Characteristic values can be long and not fit into single os_mbuf - copy
whole chain instead.
2023-08-02 21:25:26 +02:00
Krzysztof Kopyściński 8da39bc40e apps/bttester: fix start_direct_adv command
high_duty_cycle is defined in flags field that is 2 octet long, as first
bit.
2023-08-01 08:54:02 +02:00
Krzysztof Kopyściński b4cf7fe978 apps/bttester: fix preprocessor directive for registering Mesh service
If statements encapsulates GATT_CL too.
2023-08-01 08:50:28 +02:00
Krzysztof Kopyściński 7585a01e43 apps/bttester: copy whole mbuf chain in get_attrs
Whole GATT database can be big and data may be missing from rsp.
2023-07-28 14:04:44 +02:00
Krzysztof Kopyściński c8743c683a apps/bttester: fix get_attrs response buffer
Assigning rsp pointer to new value caused wrong behavior and corrupted
response. Data should be copied into buffer instead.
2023-07-27 17:41:18 +02:00
Krzysztof Kopyściński e2065a6016 bluetooth: tester: Use define for variable length BTP commands
This makes code a bit easier to follow.
2023-07-26 19:38:24 +02:00
Krzysztof Kopyściński 6871cec5f6 bluetooth: tester: Add explicit functions for event and response
This make is easier to verify if proper use of BTP is maintained.
tester_rsp and tester_rsp_full will be removed eventually when
BTP is fully async.
2023-07-26 19:38:24 +02:00
Krzysztof Kopyściński e88212a5da apps/bttester: Keep BTP command in buffer for delayed response
This allows to avoid copying data for async callbacks.
2023-07-26 19:38:24 +02:00
Krzysztof Kopyściński 7d25c1c718 apps/bttester: refactor GATT Client service
Accomodated to new API.
2023-07-26 19:38:24 +02:00
Krzysztof Kopyściński 8abb2ecef8 apps/bttester: refactor Mesh service
Accomodate to new API.
2023-07-26 19:38:24 +02:00
Krzysztof Kopyściński 2210018c04 apps/bttester: refactor L2CAP service
Accomodated to new API.
2023-07-26 19:38:24 +02:00
Krzysztof Kopyściński 6f34f7c923 apps/bttester: refactor GATT service
Accomodated to new API.
2023-07-26 19:38:24 +02:00
Krzysztof Kopyściński acf9f156fe apps/bttester: use ble_addr_t whenever possible
We should use ble_addr_t instead of pair {address_type, address}
whenever possible, as suggested in 35c71a4dcd

This simplifies code to single memcpy.
2023-07-26 19:38:24 +02:00
Krzysztof Kopyściński d878934794 apps/bttester: drop atomic.h
There is no need of porting extra atomic API in tester.
2023-07-26 19:38:24 +02:00
Krzysztof Kopyściński ba8a946fba apps/bttester: drop glue module
There is no need to be dependent on `glue` module and it can be dropped
from application. Mesh part of bttester can still use one from
`"mesh/glue.h"`
2023-07-26 19:38:24 +02:00
Krzysztof Kopyściński 2d4c591e27 apps/bttester: refactor BTP handling
This commit refactors BTP handling to new model, where API is provided for
registration of handlers for BTP commands as callbacks. New API provides also
size check and common buffer for response.

Removes Controlle Index validation from BTP handlers, as these are always 0.

Corrected some formatting for variable declarations.

This refactors only core and GAP service into new API, rest of services will
not work but are compiled. They will be refactored in following commits.
2023-07-26 19:38:24 +02:00
Krzysztof Kopyściński 32e39750d6 apps/bttester: split bttester.h and add btp_ prefixes
Splits `bttester.h` into seperate files, one for each BTP
service. Adds BTP_ prefix for defines and btp_ prefix for
structs.
2023-07-26 19:38:24 +02:00
Szymon Janc 3bd6e5b15b apps: Add DTM shell application
This application provides shell interface for Bluetooth DTM. It also
provides few extra commands useful for testing (TX power configuration,
antenna selection, unmodulated carrier).
2023-07-10 17:05:46 +02:00
Krzysztof Kopyściński 841fa4c7e6 apps: bttester: reject L2CAP connections basing on PSM only
PSM on which Lower Tester requests connection fully defines
what are requirements for request to be accepted. That means
that `response` parameter should not be used to return errors
from `tester_l2cap_event`, and is not needed.
2023-06-19 16:14:06 +02:00
Krzysztof Kopyściński dce1a41a7d apps/bttester: do not fail pairing if it's already active
Sometimes it's simpler to call pair() even when procedure is already
active. Do not fail command in this case, as it doesn't influence
already ongoing procedure.
2023-06-16 15:14:21 +02:00
Krzysztof Kopyściński 160e4332ce apps/bttester: fix retrieving app included services
Local Included Service(s) values are retrieved using
`ble_att_svr_read_handle`, which will lead to calling `entry->ha_cb`
for Included Service. This will be `ble_gatts_inc_access`, which will
not add UUID if it's not of 16 bit type. Use 16 bit UUID for included
service.

`out_att_err` is now set to 0 by default - it may be not overwritten if
no error occured. This will lead to undefined behavior and incorrect
data in BTP response.
2023-06-15 00:42:31 +02:00
Krzysztof Kopyściński a974bbc0a7 apps: bttester: fix attribute reporting in read by UUID
There is no need to call `gatt_buf_add` when `gatt_buf` if filled using
pointer `chr` from `gatt_buf_reserve`. This caused sending malformed
data to BTP reposnse event.
2023-06-15 00:41:32 +02:00
Rahul Tank 4c0096fa80 apps/blecent: Fix incorrect return value handling in
blecent_should_connect.
2023-06-06 12:14:30 +02:00
Krzysztof Kopyściński 7f17076cc2 apps: bttester: make bttester code compliant with Mynewt code style
bttester was initially ported from Zephyr. This app is independent now
and should follow Mynewt Coding Standards.
2023-06-05 16:22:16 +02:00
Krzysztof Kopyściński 9ae4f9d278 apps/bttester: configure for Core Specification v5.3
Bump bttester version up so BLE 5.3 features can be used.
2023-06-03 02:04:12 +02:00
Jerzy Kasenberg d1c2cf5250 apps/blestress: Fix nrfx include path
This fixes include path after nrfx was switched
to used github repository
2023-05-08 15:53:09 +02:00
Michal Gorecki 7cc8c08d67 nimble/host: Update existing bond while re-pairing
While re-pairing ble_store_config_find_sec function was checking peer address,
ediv and random number. Even if peer address was the same, the bond could be
recognized as not the one we was looking for, because ediv and random number
could be different. This was causting issues when the BLE_STORE_MAX_BONDS syscfg val
was used. Re-pairing to the same device was treated as pairing to the
new device and if current number of bonds was the same as BLE_STORE_MAX_BONDS,
the re-pairing was failing.
2023-03-20 10:05:01 +01:00
Michal Gorecki 8a01f72db5 apps: Allow stub/full implementation of packages in syscfg
Packages console, log and stats allow to choose stub or full
implementation. All apps had either stub or full implementation
hardwired in pkg.yml file. Now it can be easily overriden in target.
This also changes defunct setting
of CONSOLE_MODE to CONSOLE_IMPLEMENTATION in all apps.
2023-02-06 14:37:48 +01:00
Andrzej Kaczmarek e7006a8e78 nimble/ll: Add API to read random data from controller
This may be useful to get some random if MCU does not support trng, e.g.
as on nRF5340 app core.
2022-10-12 20:38:08 +02:00
Jakub Rotkiewicz 154bdd46ac btshell and blestress: update l2cap coc rx buffers
Updated apps to support setting the RX SDU buffers number.
2022-09-26 14:51:29 +02:00
Michal Gorecki 3de15c9615 apps/peripheral: Fix not saving conn_handle after connection
Even though conn_handle is defined and later used in
connection params update request event callback, it was
never initialized with a proper value.
2022-08-31 17:22:04 +02:00
Krzysztof Kopyściński f7ebfaf95b apps/bttester: handle GAP Pairing Complete event
Send event when peer fails pairing procedure with reason code.
This is required by SM/CEN/KDU/BI-02-C.
2022-08-25 15:17:51 +02:00
FanHang 9bd8b5b78c apps/blehr: Fix blehr notify stopped incorrectly
Don't stop blehr notity if other handles subscribed

Signed-off-by: Hang Fan <fanhang@xiaomi.com>
2022-08-11 15:24:52 +02:00
Michal Gorecki f722d93661 apps/btshell: Add "off" param to "scan" command.
Substitute parameter for "cancel".
2022-08-11 14:47:04 +02:00
Michal Gorecki 6e345d0c88 apps/btshell: Add default own_addr_type check
On default the application has taken "public" as own address type. Now the application checks if public addres is available on the device and if not, on default it uses "random" as own addres type.
It prevents advertising, scanning and connecting errors if the user won't change own address type in console, while working with a device, which has no public address available.
2022-07-27 14:13:42 +02:00
Krzysztof Kopyściński 5932b3c2dd apps/bttester: do not distribute CSRK
BLE_SM_OUR_KEY_DIST and BLE_SM_THEIR_KEY_DIST should be set to 3,
as we do not support security mode 2 - CSRK shall not be distributed.
2022-07-26 11:22:32 +02:00
Tim Gates 9883c2465c docs: Fix a few typos
There are small typos in:
- apps/blehr/src/main.c
- apps/ext_advertiser/src/main.c
- nimble/controller/src/ble_ll.c
- nimble/host/src/ble_att_svr.c
- nimble/host/src/ble_hs_mbuf.c
- nimble/host/src/ble_sm.c

Fixes:
- Should read `response` rather than `respose`.
- Should read `measurement` rather than `measurment`.
- Should read `largest` rather than `larget`.
- Should read `instance` rather than `nstance`.
- Should read `application` rather than `applicaiton`.
- Should read `always` rather than `alwyas`.
2022-07-04 08:55:19 +02:00
Jerzy Kasenberg f64535def1 apps/blehci: Allow log/full implementation in syscfg
blehci had log/stub hardwired in application.
Now it can be swtiched to log/full in target if needed.
2022-07-01 15:56:21 +02:00
Krzysztof Kopyściński 86c0a66542 apps/bttester: add lost bond event
When we receive GAP event BLE_GAP_EVENT_REPEAT_PAIRING it means
that we sent security request, but bond is lost - peer sent pair
request in return, which means it doesn't have keys anymore. Bond is
also lost when we sent encryption request and peer responded with
Ecnryption Change event with error 'PIN or Key Missing'. Inform
Upper tester about it.
2022-05-26 11:19:30 +02:00
Krzysztof Kopyściński c521bf5836 apps: bttester: add option to reject CPUP parameters
This is required by GAP/CONN/CPUP/BV-05-C
2022-04-21 13:47:57 +02:00
Krzysztof Kopyściński 02bb32fd1f apps/bttester: odd option to hold L2CAP credist and give back on command
L2CAP/ECFC/BI-02-C requires IUT to hold credits and give them back when
asked to do so. Let's use option defined in BTP to set manual credit
give-back procedure when L2CAP connection is created.
2022-04-19 10:19:42 +02:00
Krzysztof Kopyściński f8f10ab96a apps/bttester: add option to connect single ECFC channel
BTP specification was extended and we can decide weather or not
connect ECFC channel by specifying it in 'option' command argument.
This allows to connect single ECFC channel.
2022-04-19 10:19:42 +02:00
Szymon Janc 3c561218da apps/btshell: Add scan filtering based on device name
This allows to specify name prefix that is used to filter out devices
when scanning. Useful in busy environment.
2022-04-15 12:08:07 +02:00
Magdalena Kasenberg 3cc02b2b31 apps/btshell: Fix peer_addr_type argument parsing
The cmd parser expected a variable named peer_type instead of
peer_addr_type.
2022-04-14 09:51:35 +02:00