Commit Graph

304 Commits (master)

Author SHA1 Message Date
Paul Szczepanek 4767b7e1ac fix missing observer ifdefs 2021-05-18 20:58:26 +01:00
Paul Szczepanek 910b7a6438 clear the pal gap queue on reset 2021-05-18 10:39:20 +01:00
Paul Szczepanek 30cd6071cf remove stopping sets since controller resets them 2021-05-18 10:24:16 +01:00
Paul Szczepanek ab123d3e22 advertising start queued up waiting for completion 2021-05-17 19:37:26 +01:00
Abbas Bracken Ziad 0ec4a57a6c Fix string buffer length in UUID trace helper 2021-05-13 11:56:23 +01:00
Martin Kojtal 26c6b75d3b
Merge pull request #14625 from paul-szczepanek-arm/fix-read-auth
BLE: Fix overwriting attribute data from read auth callback
2021-05-10 11:25:55 +02:00
Martin Kojtal acb43441bb
Merge pull request #14627 from pan-/fix-stop-periodic-advertising
Dispatch Gap::stopPeriodicAdvertising to the right function.
2021-05-07 12:41:29 +02:00
Martin Kojtal b7b4ca72cc
Merge pull request #14605 from paul-szczepanek-arm/tracix
BLE: Fix traces
2021-05-07 11:44:25 +02:00
Paul Szczepanek 2041cc6b57 don't copy data into attr if size too big 2021-05-05 19:01:13 +01:00
Paul Szczepanek 0155bce867 allow zero length attribute reads 2021-05-05 18:58:24 +01:00
Paul Szczepanek 17bf70989d ignore offset, replace whole value of attr in auth callback 2021-05-05 18:40:59 +01:00
Vincent Coubard cec8a9dc8c Dispatch Gap::stopPeriodicAdvertising to the right function. 2021-05-05 18:32:47 +01:00
Paul Szczepanek 55ffb176d5 Copy data from read auth callback 2021-05-05 14:31:35 +01:00
Martin Kojtal dace32aef6
Merge pull request #14602 from paul-szczepanek-arm/conf
Deprecate indications event onConfirmationReceived
2021-05-03 09:55:08 +02:00
Paul Szczepanek f872dfa5ca convert bitfield to bools 2021-04-29 19:07:31 +01:00
Paul Szczepanek 7211cd3e77 fix sm init trace to print string 2021-04-29 16:09:04 +01:00
Paul Szczepanek 52bc9e9f51 fix misleading privacy trace 2021-04-29 16:08:52 +01:00
Paul Szczepanek 172e9697da avoid init in header for compatibility 2021-04-28 16:29:26 +01:00
Paul Szczepanek b61fc6b639 Deprecate indications event onConfirmationReceived 2021-04-28 14:02:56 +01:00
Martin Kojtal 06a33d37f8
Merge pull request #14436 from paul-szczepanek-arm/remove-services
BLE: replace obsolete services with the new services repo
2021-04-13 16:00:58 +02:00
Paul Szczepanek d594aa2d4b add MBED_DEPRECATED comment for maintainers to find it 2021-04-08 09:53:23 +01:00
Martin Kojtal 9bbc8c914c
Merge pull request #14506 from noonfom/value-handle
Add GattUpdatesEnabledCallbackParams struct
2021-04-08 09:53:04 +02:00
Abbas Bracken Ziad 52483f3e30 Wrap call to value handle getter in MBED_ASSERT 2021-04-07 18:05:01 +01:00
Paul Szczepanek cc478b3896 add deprecation warning 2021-04-07 17:15:09 +01:00
Paul Szczepanek f34d31f350 remember if BLE scan paremeters are set 2021-04-07 16:40:46 +01:00
Abbas Bracken Ziad aaf9435f87 Use general name for POD 2021-04-07 12:34:25 +01:00
Abbas Bracken Ziad d42c0a7269 Add value handle field to callback params 2021-04-06 17:39:10 +01:00
Abbas Bracken Ziad 8b07e97e50 Add value handle getter to Gatt Server 2021-04-06 17:24:08 +01:00
Paul Szczepanek d43d4a0e7e fix cordio include path 2021-03-18 11:30:43 +00:00
Paul Szczepanek 1afbbebc96 fix include path for dm_api.h 2021-03-18 11:27:42 +00:00
Paul Szczepanek c6d2ca17d5 remove obsolete services and add information about the services repo 2021-03-17 13:05:25 +00:00
Paul Szczepanek dc6e9db067 add tracing to scan state (#14225) 2021-03-15 15:35:52 +00:00
Paul Szczepanek a62c1e1228 add missing include 2021-03-15 15:35:52 +00:00
Vincent Coubard cf33ed0668 BLE: Add MemorySecurityDb.cpp and SecurityDb.cpp to CMake. 2021-03-15 15:35:52 +00:00
Vincent Coubard d1672aaa64 BLE: Update level of traces in GattServer 2021-03-15 15:35:52 +00:00
Vincent Coubard 957486e0eb BLE: Move traces out of header file to avoid collisions.
This change required the creation of the implementation files of SecurityDb classes.
2021-03-15 15:35:52 +00:00
Vincent Coubard 6adaefd9f3 BLE: Fix traces parameter warnings 2021-03-15 15:35:52 +00:00
Vincent Coubard 65c61a1ca9 BLE: Remove uses of tr_as_array in favour of to_string. 2021-03-15 15:35:52 +00:00
Vincent Coubard c674990820 BLE: Fix sprintf overflow in trace helpers. 2021-03-15 15:35:52 +00:00
Vincent Coubard 52a3de6657 BLE: Move tracing helpers into implementation file. 2021-03-15 15:35:52 +00:00
Vincent Coubard c13e590723 BLE: Refactor UUID string helper to match mbed-os coding style. 2021-03-15 15:35:52 +00:00
Vincent Coubard e001098699 BLE: Fix out of range memory access in trace helper. 2021-03-15 15:35:52 +00:00
Abbas Bracken Ziad db9428f18f Add tracing to BLE Gatt Server (#14107)
* Add traces to GattServerImpl.cpp

* Update BLGS traces

* Add context to BLGS traces

* Set value of TRACE_WRITE_VALUES to 0

* Add param logs to BLGS traces

* Apply changes from code review

* Add trace helper for UUIDs

* C++ string library is not needed

* Update to_string function for UUIDs

The previous implementation had a memory leak and did not format 128-bit UUIDs

* Possibly faster ternary

* Add more context to adding/inserting of services/characteristic

* Add trace to events and event path

* Refactor to_string helper for UUIDs
2021-03-15 15:35:52 +00:00
Abbas Bracken Ziad f4febdcb9d Add tracing to BLE GAP (#14117)
* Add traces to GapImpl.cpp

* Add helpers and param logs

* Update GapImpl.cpp

* Move helpers to ble_trace_helpers.h

* Add traces to whitelist setter & getter functions

* Prepend parent dir. to ble_trace_helpers.h include line

* Resolve portability issue by using PRI* macro in place of %lu

* Add traces to PalGapImpl.cpp

* Complete PAL GAP traces

* Remove stray include

* Make 'echo' traces in PAL configurable

Some of the tr_info traces at the beginning of PAL functions  are duplicates ('echoes') of those in GAP functions. This commit enables including/excluding of these traces in mbed_app.json by writing 1/0, respectively to the MBED_CONF_CORDIO_TRACE_PAL_ECHOES config macro. The default is to exclude 'echo' traces.

* Add missing spaces in tr_info traces

* Clean-up param log for set_extended_advertising_parameters

* Remove "Failed: " from every tr_error trace

* Apply changes from PalGapImpl.cpp review

* Apply changes from GapImpl.cpp review

* Use binary for channel map trace

B0: ADVERTISING_CHANNEL_37
B1: ADVERTISING_CHANNEL_38
B2: ADVERTISING_CHANNEL_39

We're assuming that the user understands the above. This could be documented somewhere.

* Replace more %lu w/PRIu32

* Add tr_info to terminateSync for user call

* Make trace group for PAL traces BLDM

* Remove [PAL] prefix from every PAL trace

* Add trace to setPeripheralPrivacyConfiguration

* Make set scan params tr_info dependent on selected PHY

* Add trace to GAP events

* Other GAP events required traces
2021-03-15 15:35:52 +00:00
Paul Szczepanek 91d4b48989 BLE: add traces to gatt client (#14165)
* add traces to gatt client

* add files to cmakelists

Co-Authored-By: Vincent Coubard <vincent.coubard@arm.com>

* fixed tracing variable name

Co-Authored-By: Vincent Coubard <vincent.coubard@arm.com>

* add pal tracing

* add more traces for successfull actions

* put write and read as tr_debug in pal

Co-authored-by: Vincent Coubard <vincent.coubard@arm.com>
2021-03-15 15:35:52 +00:00
Paul Szczepanek 7b08388be6 Add traces to HCI, BLE instance, Security DB and WSF cordio traces (#14138)
* ble HCI tracing

* fix typo in SM trace

* add BLE instance tracing

* route wsf traces to mbed tr_debug

* Update connectivity/FEATURE_BLE/source/cordio/source/BLEInstanceBaseImpl.cpp

Co-authored-by: Vincent Coubard <vincent.coubard@arm.com>

* print hci on cordio side

* trace controller supported features

* log reset sequence

* include config for printing enums

* remove duplicate trace

* add tracing to security db

* workaround for macro error on use outside trace

Co-authored-by: Vincent Coubard <vincent.coubard@arm.com>
2021-03-15 15:35:52 +00:00
Vincent Coubard 5aa76e566a BLE: Add privacy trace (#14127)
Add traces to the Bluetooth Security Manager and Privacy controller.
The traces are made to be comprehensive to improve the ux when users submit bugs.
A centralized set of helpers has been created to convert BLE types to string.

* BLE: Add SM traces

* BLE: Add traces to Security Manager PAL

* BLE: Make SM traces consistent.
- Prefix with Connection <id> - when appropriate.
- Display parameters after `:`.
- If multiple parameters should be displayed name then and print the value after =. They are separated by a `,`.

* BLE: Fix SM random number generation.

Only the first 8 bytes were generated from the stack.

* BLE: Regenerate CSRK if it is all zeroes.

* BLE: Add trace into privacy modules

Address resolution is set at the debug level as it is a very common operation and may clutter the output.

* Address trace review for SM:

- Put privacy traces in BLPR
- Add missing traces in PALSecurityManagerImpl.cpp
- Add missing EventHandler null pointer check
- Typo and parameters order fix.
2021-03-15 15:34:34 +00:00
Paul Szczepanek 53cf06278a use the ccb instead of looking up the conn id 2021-02-22 11:31:25 +00:00
Paul Szczepanek 9a25b7b7cd use dmConnId_t for conn id 2021-02-19 12:52:47 +00:00
Paul Szczepanek b271ee853a fix Cordio attsCsfActClientState index parameter
instead of using a handle this should be conn id
there were two calls using it differently
2021-02-19 12:45:09 +00:00
Martin Kojtal 3174a4c6a5
Merge pull request #14264 from paul-szczepanek-arm/fix-terminate-sync
BLE: fix termination of periodic advertising sync
2021-02-12 09:16:55 +00:00
Martin Kojtal 8284807a00
Merge pull request #14239 from paul-szczepanek-arm/passkey-fix
BLE: fix passkey for display being returned reversed
2021-02-11 08:04:57 +00:00
Martin Kojtal 871522c929
Merge pull request #14256 from pan-/ble-chainable-event-handler-test
BLE: Add API to test the presence of an event handler in a chain.
2021-02-11 08:04:34 +00:00
Paul Szczepanek 938aedac91 use the correct id to identify sync 2021-02-10 11:57:30 +00:00
Vincent Coubard edd7678cfc BLE: Add API to test the presence of an event handler in a chain. 2021-02-10 11:18:59 +00:00
Vincent Coubard c099b859d7 BLE: Add APIs to get characteristic authorization callbacks. 2021-02-09 19:56:58 +00:00
Paul Szczepanek 94529508a5 include deprecation option for reversing passkey display 2021-02-08 13:36:28 +00:00
Martin Kojtal 733975220d
Merge pull request #14228 from ARMmbed/rename_greentea_test_macro
CMake: rename greentea test macro
2021-02-03 14:17:20 +00:00
Rajkumar Kanagaraj 6824b14e48 CMake: rename greentea test macro 2021-02-02 07:43:40 -08:00
Paul Szczepanek bd5f437896 return OK when stopping advertising that is not active 2021-01-27 16:32:57 +00:00
Hugues Kamba 51bd84ef7d CMake: Add support for CORDIO Greentea tests
The Cordio Greentea tests can now be built with CMake.
2021-01-11 16:30:29 +00:00
Vincent Coubard 4cfcadd9e9 BLE: Fix SM random number generation.
Ensure the more than 8 random bytes are fetched from the stack.
2021-01-07 12:38:47 +00:00
Vincent Coubard b28e11574a BLE: Regenerate CSRK if it is all zeroes. 2021-01-07 12:35:24 +00:00
Martin Kojtal e1d1753726
Merge pull request #14111 from paul-szczepanek-arm/ble-fix-ext
BLE: fix scanning/advertising when extended features are available but disabled on host
2021-01-05 13:28:13 +00:00
paul.szczepanek@arm.com 6746573b34 add missing guards for extended advertising feature 2021-01-04 18:05:50 +00:00
Paul Szczeanek 5e99ea8d7e correct the documentation for GattServer::addService 2021-01-04 17:11:03 +00:00
Paul Szczeanek cdc8845b3c copy authorsation callbacks to gattserver 2021-01-04 17:11:03 +00:00
Andrea Palmieri ae4a53e74a
Support to BlueNRG_2 BLE component (#13246)
Add support to BlueNRG_2 BLE component

Signed-off-by: Andrea Palmieri <andrea.palmieri@st.com>

Co-authored-by: Andrea Palmieri <andrea.palmieri@st.com>
Co-authored-by: Paul Szczeanek <paul.szczepanek@arm.com>
2020-12-17 14:37:21 +00:00
Martin Kojtal 14f3ce1edc
Merge pull request #14014 from pan-/ble-attribute-error-code
Update GattAuthCallbackReply_t enumeration.
2020-12-10 13:40:04 +00:00
Vincent Coubard 2eb77d607a Update GattAuthCallbackReply_t enumeration.
Add missing values that are present in pal::AttErrorResponse.
This allows applications to use correct ATT error codes.
2020-12-08 10:47:55 +00:00
Paul Szczeanek 5cc09f58f8 the adv bit is actually optional in aux_adv_ind so is not required for periodic sync 2020-11-30 16:00:14 +00:00
Martin Kojtal dd432a387e
Merge pull request #13942 from paul-szczepanek-arm/securitydb-fix
ble: Fix persistence in SecurityDB
2020-11-26 11:17:28 +00:00
Martin Kojtal 483db06a5f
Merge pull request #13948 from rajkan01/simplify_ble_lib_inclusion
CMake: Simplify BLE library inclusion
2020-11-25 13:37:11 +00:00
Martin Kojtal 57bbb4739b
Merge pull request #13085 from pea-pod/remove-deprecated-mbed-assert
Change MBED_STATIC_ASSERTs version for built-in
2020-11-24 13:38:07 +00:00
Rajkumar Kanagaraj a964453edf CMake: target_link_library the BLE with CORDIO stack
- Security manager uses some feature from wsf which is part of the mbed-ble-cordio library so added target_link_library to link the BLE library to cordio stack lib.
2020-11-23 16:06:53 +00:00
Paul Szczeanek e71f452e9d fix missing return 2020-11-23 09:06:42 +00:00
Paul Szczeanek 63887d19a8 update the peer address when LTK has been found in old entry 2020-11-23 09:06:30 +00:00
Paul Szczeanek 187ed98d82 update the connected status of db entry 2020-11-23 09:06:05 +00:00
Paul Szczeanek 6f844e1a71 fix indexing in ble security db 2020-11-23 09:02:56 +00:00
Marc Emmers 01e56f1f34 Fix missing newline 2020-11-16 17:03:23 +01:00
Marc Emmers afc42b8fb7 Update NRF ble configuration options 2020-11-16 16:43:43 +01:00
Martin Kojtal e725df7d07
Merge pull request #13833 from AGlass0fMilk/privacy-enabled-cb-patch
Add new Gap::EventHandler callbacks to ChainableGapEventHandler class
2020-11-12 08:43:35 +00:00
Hugues Kamba bf84a5b329 CMake: Rename CMake targets
* mbed-os renamed mbed-core
* mbed-os-<COMPONENT> renamed mbed-<COMPONENT>
2020-11-06 17:25:22 +00:00
Hugues Kamba 0ddc75a8f6 CMake: Fix BLE private address linker error
List newly added files in CMake input source files.
2020-11-06 17:25:22 +00:00
Hugues Kamba fa98689639 CMake: Componentize Mbed OS into multiple CMake targets (#13732)
Aside from the core mbed-os CMake target, a number of targets have been created so they can optionally be included by application executables that require them using `target_link_libraries()`.

Co-authored-by: Martin Kojtal <martin.kojtal@arm.com>
Co-authored-by: Rajkumar Kanagaraj <rajkumar.kanagaraj@arm.com>
2020-11-06 17:25:21 +00:00
Hugues Kamba e22b19d6db CMake: Fix build failure due to BLE dir changes 2020-11-06 17:25:21 +00:00
Hugues Kamba b3c614e921 CMake: Fix CORDIO_LL build failure
List missing CORDIO_LL source file in CMake source file.
2020-11-06 17:25:19 +00:00
Hugues Kamba 20e19de028 CMake: Fix breakage due to BLE dir move 2020-11-06 17:25:19 +00:00
Martin Kojtal c29a2e2338
Merge pull request #13811 from pan-/ble-conditional-compilation
Ble conditional compilation
2020-11-06 16:11:10 +00:00
Martin Kojtal eb6b53ac92
Merge pull request #13753 from AGlass0fMilk/rm-nordic-bsp
Remove Unneeded nordic-bsp Folder from Cordio
2020-11-02 14:14:33 +00:00
George Beckstein 911cee69f2 Add new Gap::EventHandler callbacks to ChainableGapEventHandler class 2020-10-29 15:39:41 -04:00
Paul Szczeanek 34c75ffb45 fix wrong advertising set handle being passed to handler 2020-10-28 08:42:58 +00:00
Paul Szczeanek 9e509f435b fix incorrect parameter check in periodic advertising 2020-10-27 15:09:30 +00:00
Vincent Coubard ad37f560c2 BLE: Set host default version to 5.1
Disable 5.2 event handling if not enabled.
2020-10-27 14:36:59 +00:00
Vincent Coubard 87ea47f211 BLE: Refactor Gap::reset to make it more readable 2020-10-27 14:22:54 +00:00
pea-pod 507181d262 Change MBED_STATIC_ASSERTs version for built-in 2020-10-27 08:30:40 -05:00
Vincent Coubard f3031da424 BLE: Disable handling of BT5.2 event in the controller.
These events are not used nor triggered by any of our APIs. It saves ~1.4k of flash
2020-10-23 16:44:29 +01:00
Vincent Coubard 557eac0617 BLE: Conditional compilation of the security manager
Depends on the role (central or peripheral), signing enabled and secure connection enabled.
2020-10-23 16:19:38 +01:00
Vincent Coubard 2e859cdab4 BLE: Conditionally compile PAL depending on the feature selected.
Previously (most) of the code was not pulled in because the pal interface was not virtual.
2020-10-23 12:17:31 +01:00
Vincent Coubard 26300912d3 BLE: Prevent code generation from GattClient when not used. 2020-10-23 10:37:28 +01:00