Skip to content

Ble extended advertising #8738

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 361 commits into from
Nov 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
361 commits
Select commit Hold shift + click to select a range
b983261
fix names
paul-szczepanek-arm Nov 11, 2018
519f755
ppm conversion
paul-szczepanek-arm Nov 11, 2018
62b38cf
connection complete event
paul-szczepanek-arm Nov 11, 2018
fd880d1
fix swapping
paul-szczepanek-arm Nov 12, 2018
565f1e0
fix first element of array selection
paul-szczepanek-arm Nov 12, 2018
87887cc
rename phy to index
paul-szczepanek-arm Nov 12, 2018
32c303d
missing return
paul-szczepanek-arm Nov 12, 2018
02d9b35
assert added
paul-szczepanek-arm Nov 12, 2018
a3820c8
removed impossible case
paul-szczepanek-arm Nov 12, 2018
216dd6d
we need clamping while we wait for c++17
paul-szczepanek-arm Nov 12, 2018
c0f4b86
clamp values
paul-szczepanek-arm Nov 12, 2018
365a6c8
set random address
paul-szczepanek-arm Nov 12, 2018
2cdff44
cancel connection
paul-szczepanek-arm Nov 12, 2018
8cc580d
only one connection event needed
paul-szczepanek-arm Nov 12, 2018
68b5aad
ppm case
paul-szczepanek-arm Nov 12, 2018
9b77f9d
default values and func names
paul-szczepanek-arm Nov 12, 2018
8733d52
event types fixed
paul-szczepanek-arm Nov 12, 2018
00da0e5
fix review comments
paul-szczepanek-arm Nov 12, 2018
b6c7bd7
Merge pull request #1 from paul-szczepanek-arm/vincent
pan- Nov 12, 2018
74c2def
BLE: Fix mutability in ble::advertising_event_t
pan- Nov 13, 2018
194e2cb
BLE: Move common type from pal to ble namespace.
pan- Nov 13, 2018
6a63948
BLE: Add phy in sync exstablished event.
pan- Nov 13, 2018
f136b0c
BLE: Rework Gap event handler.
pan- Nov 13, 2018
e04fd87
units
paul-szczepanek-arm Nov 12, 2018
8e18e19
new units
paul-szczepanek-arm Nov 12, 2018
7b44395
comparison operator
paul-szczepanek-arm Nov 12, 2018
57e4cdd
new units
paul-szczepanek-arm Nov 12, 2018
d01b4a5
docs
paul-szczepanek-arm Nov 13, 2018
cfde4ed
disallow removing the legacy handle
paul-szczepanek-arm Nov 13, 2018
bb8892a
more docs
paul-szczepanek-arm Nov 13, 2018
4f769df
merge fail
paul-szczepanek-arm Nov 13, 2018
642602c
merge cleanup
paul-szczepanek-arm Nov 13, 2018
9fc577d
docs
paul-szczepanek-arm Nov 13, 2018
360336c
docs
paul-szczepanek-arm Nov 13, 2018
8fe07b4
docs
paul-szczepanek-arm Nov 13, 2018
fa3869c
docs
paul-szczepanek-arm Nov 13, 2018
9604c01
BLE: Introduce Duration and Bounded classes.
pan- Nov 13, 2018
ff9b380
BLE: Use secure types in GapScanParameters.
pan- Nov 13, 2018
09d22a3
BLE: Address special case when advertising payload size is 0.
pan- Nov 13, 2018
6fccb11
BLE: Deal with random address rotation where appropriate.
pan- Nov 13, 2018
3e884a3
BLE: Initialisation of legacy advertising set.
pan- Nov 13, 2018
5ad50a2
BLE: Add PHY precondition check in setScanParameters.
pan- Nov 13, 2018
4de9a61
BLE: Add strict Duration type
pan- Nov 13, 2018
da22df7
docs and synchronise connection result with other events
paul-szczepanek-arm Nov 13, 2018
e9177fa
docs
paul-szczepanek-arm Nov 13, 2018
472e9ff
Update mbed-os/features/FEATURE_BLE/ble/Gap.h
pan- Nov 13, 2018
6eee528
Update mbed-os/features/FEATURE_BLE/ble/Gap.h
pan- Nov 13, 2018
0f4ac44
docs
paul-szczepanek-arm Nov 13, 2018
f7310a0
docs
paul-szczepanek-arm Nov 13, 2018
cf69013
docs
paul-szczepanek-arm Nov 13, 2018
2d1362c
BLE: Move GapScanParameters header into ble/gap/ScanParameters
pan- Nov 14, 2018
4d33540
BLE: rename GapExtendedConnectParameters_t into ConnectionParameters
pan- Nov 14, 2018
3737e38
BLE: Expose ble::pal::connection_role_t in ble namespace.
pan- Nov 14, 2018
6f21326
BLE: Move Gap event types in dedicated file.
pan- Nov 14, 2018
6870349
BLE: Extract types from GapAdvertisingConstant and add them into ble …
pan- Nov 14, 2018
20d5de7
BLE: Move ble::Duration in its own file.
pan- Nov 14, 2018
a1d464f
move ble::Bounded in its own file.
pan- Nov 14, 2018
1324116
BLE: rename duration type and extract them out of Gap.
pan- Nov 14, 2018
f0cbd9f
BLE: move GapAdvertisingParameters to ble::AdvertisingParameters
pan- Nov 14, 2018
07cf0f5
BLE: Move ConnectionParameters into ble namespace.
pan- Nov 14, 2018
5dc6c1d
BLE: move ScanParameters into ble namespace.
pan- Nov 14, 2018
f3c47f1
docs
paul-szczepanek-arm Nov 14, 2018
05fb66a
docs
paul-szczepanek-arm Nov 14, 2018
09f71d2
move feature support into user api
paul-szczepanek-arm Nov 14, 2018
65d84e4
fix case
paul-szczepanek-arm Nov 14, 2018
812b86a
BLE: cleanup ble::AdvertisingParameters
pan- Nov 14, 2018
a043f49
BLE: Use common ble::own_address_type_t in ble::ScanParameters.
pan- Nov 14, 2018
d659bc6
BLE: unwrap own_address_type value in GenericGap.
pan- Nov 14, 2018
184533a
BLE: Fix second time base.
pan- Nov 14, 2018
b34d09c
BLE: Fix AdvertisingParameters::getChannelXX functions.
pan- Nov 14, 2018
a255a79
BLE: Improve ble::AdvertisingParameters field declaration.
pan- Nov 15, 2018
47c4784
BLE: Rework ble::AdvertisingParameters
pan- Nov 15, 2018
2477d0e
BLE: Fix missing initialization in ble::phy_set_t.
pan- Nov 15, 2018
823825e
BLE: Fix ternary expression return type.
pan- Nov 15, 2018
b4fe04a
BLE: Improve readability of AdvertisingDataBuilder::appendField
pan- Nov 15, 2018
b8db58f
BLE: Move new gap types in ble/gap/Types.h
pan- Nov 15, 2018
b59b29b
reject conenct request if exteneded not enabled but required
paul-szczepanek-arm Nov 15, 2018
b4c704c
BLE: Move leftover target_peer_address_type_t in ble/gap/Types.h
pan- Nov 15, 2018
db55540
BLE: merge ble::advertising_type_t and pal::advertising_type_t.
pan- Nov 15, 2018
c6cdfd0
BLE: Merve ble::advertising_policy_mode and pal::advertising_filter_p…
pan- Nov 15, 2018
3b334b8
BLE: Revert space change in ble/GapAdvertisingParams.h
pan- Nov 15, 2018
07d73d5
BLE: merge ble::scanning_policy_mode_t and gap::scanning_filter_policy_t
pan- Nov 15, 2018
cc8b43f
update gap overview
paul-szczepanek-arm Nov 15, 2018
d1cb1e1
BLE: merge ble::scanning_filter_duplicates_t and pal::duplicate_filter_t
pan- Nov 15, 2018
ad127d7
BLE: merge ble::own_address_t and pal::own_address_type_t.
pan- Nov 15, 2018
33ab365
advertising data
paul-szczepanek-arm Nov 15, 2018
7ea560a
size clarification
paul-szczepanek-arm Nov 15, 2018
d8eb9de
fix names
paul-szczepanek-arm Nov 15, 2018
7aa1e95
BLE: merge ble::target_peer_address_type_t and advertising_peer_addre…
pan- Nov 15, 2018
3e72570
move values out of GAP
paul-szczepanek-arm Nov 15, 2018
493c858
BLE: cleanup of clock_accuracy_t
pan- Nov 15, 2018
c1cd5ed
BLE: Cleanup ble::connection_role_t.
pan- Nov 15, 2018
7123364
BLE: remove not required prefixes in ble::ConnectionParameters.
pan- Nov 15, 2018
6c75c53
BLE: Move gap events into ble namespace.
pan- Nov 15, 2018
46815cc
BLE: remove ble:: prefixes in ble::ScanParameters.
pan- Nov 15, 2018
5f435de
BLE: remove ble:: prefixes in ble::AdvertisingParameters.
pan- Nov 15, 2018
6de585f
BLE: rename Gap::IsFeatureSupported into Gap::isFeatureSupported
pan- Nov 15, 2018
d3c26f4
BLE: rename functions that trap concurrent use of incorect GAP APIs
pan- Nov 15, 2018
fa4aa8f
BLE: remove inner V2 typedef in Gap class.
pan- Nov 15, 2018
c165bd9
BLE: Add explicit constructor for Duration that accepts millisecond i…
pan- Nov 15, 2018
7d7ccea
BLE: clean separation between GAP v1 and GAP v2 API.
pan- Nov 15, 2018
da7d4a0
BLE: Introduce new disconnection API.
pan- Nov 16, 2018
862775d
extra data builder funcs
paul-szczepanek-arm Nov 16, 2018
6ef90b5
remove data instead of replace data
paul-szczepanek-arm Nov 16, 2018
838de80
flags no longer a safenum
paul-szczepanek-arm Nov 16, 2018
0d95ccb
fix enum values
paul-szczepanek-arm Nov 16, 2018
b6a0c8a
helper functinos
paul-szczepanek-arm Nov 16, 2018
869bb30
BLE: Add API to manage GAP connection parameter updates.
pan- Nov 16, 2018
4b6eede
UUID handling
paul-szczepanek-arm Nov 16, 2018
4a85020
remove redundant calulations
paul-szczepanek-arm Nov 16, 2018
0b1b07f
service data
paul-szczepanek-arm Nov 16, 2018
7ab45e4
individual operations
paul-szczepanek-arm Nov 16, 2018
656aa4f
CONNECTION INTERVAL HELPER
paul-szczepanek-arm Nov 16, 2018
aefd92a
docs
paul-szczepanek-arm Nov 16, 2018
91fa548
verify parameters
paul-szczepanek-arm Nov 19, 2018
92cbec3
requested services
paul-szczepanek-arm Nov 19, 2018
acd7ec3
check sizes, use memcpy
paul-szczepanek-arm Nov 19, 2018
e54c0ed
simplify UUID funcs
paul-szczepanek-arm Nov 19, 2018
062c301
check min size for custom data
paul-szczepanek-arm Nov 19, 2018
181ce00
fix size checks
paul-szczepanek-arm Nov 19, 2018
84dd169
allow long uuids in service data
paul-szczepanek-arm Nov 19, 2018
02d61cf
BLE: Move new version of ::GAP in a new class ::ble::Gap .
pan- Nov 19, 2018
79518ca
service data allows both types of UUIDs
paul-szczepanek-arm Nov 19, 2018
935444d
use correct type for service data based on uuid length
paul-szczepanek-arm Nov 19, 2018
e5e7f3e
pull in inherited overloads
paul-szczepanek-arm Nov 20, 2018
75e6128
solve link problems
paul-szczepanek-arm Nov 20, 2018
b0b6346
added extra constructor
paul-szczepanek-arm Nov 20, 2018
376cbd2
fixed index and default constructor in conn params
paul-szczepanek-arm Nov 20, 2018
2e6fefa
missing defaults
paul-szczepanek-arm Nov 20, 2018
0b746a7
BLE: prefix inclusion of Gap header with "ble/"
pan- Nov 20, 2018
1802909
BLE: Move Gap deprecated implementation in source/Gap.cpp .
pan- Nov 20, 2018
a9fd003
BLE: Move uses of deprecated Gap functions into isolated and warning …
pan- Nov 20, 2018
4fdb9c7
BLE: provide default implementation ::ble::Gap::isFeatureSupported
pan- Nov 20, 2018
bc6078e
BLE: prevent warning from deprecated API implementation in GenericGap.
pan- Nov 20, 2018
dd2c85d
BLE: Fix signeness warning in AdvertisingDataBuilder.
pan- Nov 20, 2018
c54e0d9
BLE: Move Gap::StopScan into ::ble::Gap::stopScan .
pan- Nov 20, 2018
586aea5
BLE: Move privacy subsystem to ::ble::Gap.
pan- Nov 20, 2018
0c2efc4
BLE: Fix return value of GenericGap::manageConnectionParametersUpdate…
pan- Nov 20, 2018
86dc6d7
BLE: Fix includes of ble/gap/AdvertisingDataBuilder.h ,
pan- Nov 20, 2018
dfa7749
BLE: Split ble/gap/AdvertisingDataBuilder.h into declaration and impl…
pan- Nov 20, 2018
87f3645
BLE: return immutable buffer from AdvertisingDataBuilder::getAdvertis…
pan- Nov 20, 2018
e49b523
fix missing index
paul-szczepanek-arm Nov 21, 2018
1bf5826
pull in more inherited overloads
paul-szczepanek-arm Nov 21, 2018
ed10543
missing virtual
paul-szczepanek-arm Nov 21, 2018
b293426
missing overloads
paul-szczepanek-arm Nov 21, 2018
e9c0f58
fix constness to match recent const changes
paul-szczepanek-arm Nov 21, 2018
80db38c
BLE: Cleanup bounded and document it.
pan- Nov 21, 2018
7fb863e
missing virtual
paul-szczepanek-arm Nov 21, 2018
7b0cb27
added type conversion for connection params
paul-szczepanek-arm Nov 21, 2018
07c0591
BLE: Add Duration::forever() function.
pan- Nov 21, 2018
49f5c7f
BLE: Fix Bounded constant declaration.
pan- Nov 21, 2018
62674e5
BLE: Handle forever value in ble::Duration operators.
pan- Nov 21, 2018
e602a5f
BLE: Improve static constant of Range and Duration.
pan- Nov 21, 2018
ba931f1
BLE: Document ble::Duration and satelite classes.
pan- Nov 21, 2018
02cf9ea
moved some funcs to cpp, moved cpp to source folder
paul-szczepanek-arm Nov 21, 2018
fea3ac8
BLE: Add forever information to ble::adv_duration_t and ble::scan_dur…
pan- Nov 21, 2018
9f39dba
BLE: Fix constant declaration of ble::AdvertisingParameters.
pan- Nov 21, 2018
c9dcef1
return func made const
paul-szczepanek-arm Nov 22, 2018
cd5dabf
duration added valueInMs
paul-szczepanek-arm Nov 22, 2018
2eaec28
simple scan paramater constructor
paul-szczepanek-arm Nov 22, 2018
52318e4
BLE: rename AdvertisingParameters::*PolicyMode into AdvertisingParame…
pan- Nov 22, 2018
8d03d67
BLE: Improve ble::AdvertisingParameters documentation.
pan- Nov 22, 2018
1841f4e
BLE: Document ble::ConnectionParameters.
pan- Nov 22, 2018
49455dc
BLE: set the phy as first parameter in ble::ConnectionParameters.
pan- Nov 23, 2018
6e4e733
BLE: Add code example for ble::ConnectionParameters.
pan- Nov 23, 2018
8fc62ef
BLE: Improve naming consistency of ble::Gap::EventHandler functions.
pan- Nov 23, 2018
430777e
BLE: Update documentation of Gap::Events.
pan- Nov 23, 2018
dea2ae9
BLE: Exclude Gap Event constructors from documentation.
pan- Nov 23, 2018
70ec1cf
BLE: Improve naming consistency of Gap event types.
pan- Nov 23, 2018
1b734a4
BLE: Improve ble::Gap::EventHandler documentation.
pan- Nov 23, 2018
f64b37b
BLE: Fix function braces opening in header files.
pan- Nov 23, 2018
b49870d
BLE: Fix code formating issues in Gap subsystem.
pan- Nov 23, 2018
e9637c4
BLE: Remove ble::clamp as it is not used anywhere.
pan- Nov 23, 2018
2a08549
BLE: rename ble::Forever into ble::Value.
pan- Nov 23, 2018
d32354a
BLE: Fix compiler warning about unused variable.
pan- Nov 23, 2018
27dd084
BLE: remove ble::pal::extended_advertising_report_event_type_t as it …
pan- Nov 23, 2018
76416b2
BLE: Improve implementation readability of ble::advertising_event_t
pan- Nov 23, 2018
30c6432
BLE: Address code formating issue in CordioPalGap implementation.
pan- Nov 23, 2018
eda3bfb
BLE: Explain magic constant in ble::Gap implementation.
pan- Nov 23, 2018
ce2460a
BLE: expose representation type and pointer to the inner storage in S…
pan- Nov 23, 2018
6c09b6c
BLE: Expose representation type in ble::Duration.
pan- Nov 23, 2018
643fad0
BLE: Improve code by explaining or textually defining constants
pan- Nov 23, 2018
6cb7645
BLE: Improve NULL check in ble::AdvertisingDataBuilder implementation.
pan- Nov 23, 2018
4058f09
BLE: Extract computation of minimumSupervisionTimeout.
pan- Nov 23, 2018
6b8b1d0
BLE: remove minimize fragmentation parameter in Gap.
pan- Nov 24, 2018
936f1c5
BLE: Update ble::Gap documentation.
pan- Nov 24, 2018
4db8ddf
BLE: fix name of functions in ble::ScanParameters.
pan- Nov 24, 2018
e130bec
BLE: rework ScanParameters::phy_configuration_t
pan- Nov 24, 2018
3119f94
BLE: Construct a phy_set_t from a phy_t.
pan- Nov 24, 2018
11b1e91
BLE: Rework ScanParameters construction.
pan- Nov 24, 2018
27011fd
BLE: Document ble::ScanParameters.
pan- Nov 24, 2018
9621b26
BLE: Reorganize ble::gap documentation group.
pan- Nov 25, 2018
884d870
BLE: Improve gap/Types.h documentation.
pan- Nov 25, 2018
78d4a9b
BLE: Cleanup enum duplicates in gap/Types.h
pan- Nov 25, 2018
dff8f25
BLE: Improve Duration documentation.
pan- Nov 25, 2018
0407ee8
BLE: move privacy configuration type in ble namespace.
pan- Nov 25, 2018
be7cc41
BLE: doxygen fixes.
pan- Nov 25, 2018
09ba26c
BLE: Move advertising data types in their own file.
pan- Nov 25, 2018
d4a66ae
BLE: Add an AdvertisingDataParser
pan- Nov 25, 2018
8cbc536
BLE: Add a simple builder for AdvertisingData.
pan- Nov 25, 2018
208b1bd
fix size calculation for UUID data payload
paul-szczepanek-arm Nov 26, 2018
528deb1
fix wrong variable being swapped
paul-szczepanek-arm Nov 26, 2018
e0e186c
replace consts with a private enum
paul-szczepanek-arm Nov 26, 2018
a03aaa2
simplify and explain swapping
paul-szczepanek-arm Nov 26, 2018
f3a64fe
replace magic numbers
paul-szczepanek-arm Nov 26, 2018
bee115c
replace magic numbers
paul-szczepanek-arm Nov 26, 2018
d3d93e1
BLE: Improve ble::Gap documentation.
pan- Nov 26, 2018
c9e8501
make PHY case consistent
paul-szczepanek-arm Nov 26, 2018
190b9bc
BLE: Fix address type in ::ble::Gap::connect
pan- Nov 26, 2018
a915748
BLE: Fallback to legacy connect when required.
pan- Nov 26, 2018
3aa91ec
BLE: return phy_set_t in ConnectionParameters::getPhySet
pan- Nov 26, 2018
93b6ecf
BLE: initialize properly deprecated and non deprecated flags.
pan- Nov 26, 2018
d1b5c8c
BLE: Mark LEGACY_ADVERTISING_HANDLE as active in initialization.
pan- Nov 26, 2018
89355b9
BLE: Check supervision timeout value in connect.
pan- Nov 26, 2018
2d63714
BLE: Implement connection parameter management in GAP.
pan- Nov 26, 2018
f71e08c
BLE: tag API uses in GenericGap.
pan- Nov 26, 2018
e54e3ea
cast no longer needed
paul-szczepanek-arm Nov 26, 2018
2b94b66
deprecate services that are not useless
paul-szczepanek-arm Nov 26, 2018
f4a560d
reset advertising sets on reset
paul-szczepanek-arm Nov 26, 2018
6f3a9ca
legacy handle starts off present in _existing_sets
paul-szczepanek-arm Nov 26, 2018
bed7677
stop advertising before reseting
paul-szczepanek-arm Nov 26, 2018
bf535af
check feature support before calling extended functnions
paul-szczepanek-arm Nov 26, 2018
ac47736
BLE: Enable cordio extended modules if available.
pan- Nov 26, 2018
7f33145
BLE: Fix extended advertising check.
pan- Nov 26, 2018
3ae38ac
always set existing set for legacy handle
paul-szczepanek-arm Nov 26, 2018
daf0f42
BLE: Fix advertising set issues on legacy controllers.
pan- Nov 26, 2018
0ef7a40
BLE: Fix set advertising paylaod dispatch.
pan- Nov 26, 2018
5618558
BLE: Report legacy advertising with new API.
pan- Nov 26, 2018
4d986bf
fix is feature enabled condition and made in consistent
paul-szczepanek-arm Nov 26, 2018
a14f143
set active set to false when stoping advertising
paul-szczepanek-arm Nov 26, 2018
ef1552a
BLE: report legacy connection event in new event handler.
pan- Nov 26, 2018
b552f8c
fix return code for implemented func
paul-szczepanek-arm Nov 26, 2018
0c9ce24
BLE: remove unwanted trace.
pan- Nov 26, 2018
66a9e63
BLE: report correct event type for legacy advertising report.
pan- Nov 26, 2018
7b1e225
BLE: Fix address name in NRF targets.
pan- Nov 26, 2018
a65296e
BLE: removed resolved TODO.
pan- Nov 26, 2018
ecf8c73
Edit Gap.h
Nov 26, 2018
451f9aa
Edit Bounded.h
Nov 27, 2018
7df90ba
Edit AdvertisingDataBuilder.h
Nov 27, 2018
5347a8a
Update Duration.h in consistent casing
Nov 27, 2018
31a73fc
Edit AdvertisitngDataSimpleBuilder.h
Nov 27, 2018
c904ac8
Edit AdvertisingParameters.h
Nov 27, 2018
2e02869
Edit ConnectionParameters.h
Nov 27, 2018
b4c3455
Edit Events.h
Nov 27, 2018
431402c
Edit Gap.h
Nov 27, 2018
08ef3f7
Edit iBeacon.h
Nov 27, 2018
fa784c2
Edit URIBeaconCOnfigService.h
Nov 27, 2018
d00ad8b
Edit ScanParameters.h
Nov 27, 2018
bbb67a6
Edit Types.h
Nov 27, 2018
6677fab
BLE: Move source/Gap.cpp -> source/LegacyGap.cpp
pan- Nov 27, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
330 changes: 160 additions & 170 deletions features/FEATURE_BLE/ble/BLE.h

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion features/FEATURE_BLE/ble/BLEInstanceBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#ifndef MBED_BLE_DEVICE_INSTANCE_BASE__
#define MBED_BLE_DEVICE_INSTANCE_BASE__

#include "Gap.h"
#include "ble/Gap.h"
#include "ble/SecurityManager.h"
#include "ble/BLE.h"

Expand Down
93 changes: 86 additions & 7 deletions features/FEATURE_BLE/ble/BLETypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <string.h>
#include "ble/SafeEnum.h"
#include "ble/ArrayView.h"
#include "ble/gap/Types.h"

/**
* @addtogroup ble
Expand All @@ -32,6 +33,43 @@

namespace ble {

/** Special advertising set handle used for the legacy advertising set. */
static const advertising_handle_t LEGACY_ADVERTISING_HANDLE = 0x00;

/** Special advertising set handle used as return or parameter to signify an invalid handle. */
static const advertising_handle_t INVALID_ADVERTISING_HANDLE = 0xFF;

/** Maximum advertising data length that can fit in a legacy PDU. */
static const uint8_t LEGACY_ADVERTISING_MAX_SIZE = 0x1F;

/** Features supported by the controller.
* @see BLUETOOTH SPECIFICATION Version 5.0 | Vol 6, Part B - 4.6 */
struct controller_supported_features_t : SafeEnum<controller_supported_features_t, uint8_t> {
enum type {
LE_ENCRYPTION = 0,
CONNECTION_PARAMETERS_REQUEST_PROCEDURE,
EXTENDED_REJECT_INDICATION,
SLAVE_INITIATED_FEATURES_EXCHANGE,
LE_PING,
LE_DATA_PACKET_LENGTH_EXTENSION,
LL_PRIVACY,
EXTENDED_SCANNER_FILTER_POLICIES,
LE_2M_PHY,
STABLE_MODULATION_INDEX_TRANSMITTER,
STABLE_MODULATION_INDEX_RECEIVER,
LE_CODED_PHY,
LE_EXTENDED_ADVERTISING,
LE_PERIODIC_ADVERTISING,
CHANNEL_SELECTION_ALGORITHM_2,
LE_POWER_CLASS
};

/**
* Construct a new instance of ControllerSupportedFeatures_t.
*/
controller_supported_features_t(type value) : SafeEnum(value) { }
};

/**
* Opaque reference to a connection.
*
Expand All @@ -48,7 +86,6 @@ typedef uintptr_t connection_handle_t;
*/
typedef uint16_t attribute_handle_t;


/**
* Inclusive range of GATT attributes handles.
*
Expand Down Expand Up @@ -284,6 +321,10 @@ void set_all_zeros(byte_array_class &byte_array) {
memset(&byte_array[0], 0x00, byte_array.size());
}

/**
* Model fixed size array values.
* @tparam array_size The size of the array.
*/
template <size_t array_size>
struct byte_array_t {
/**
Expand Down Expand Up @@ -556,7 +597,12 @@ struct peer_address_type_t :SafeEnum<peer_address_type_t, uint8_t> {
/**
* A Random static address used as a device identity address.
*/
RANDOM_STATIC_IDENTITY
RANDOM_STATIC_IDENTITY,

/**
* No address provided (anonymous advertisement).
*/
ANONYMOUS = 0xFF
};

/**
Expand All @@ -578,6 +624,13 @@ struct peer_address_type_t :SafeEnum<peer_address_type_t, uint8_t> {
struct phy_t : SafeEnum<phy_t, uint8_t> {
/** struct scoped enum wrapped by the class */
enum type {
/**
* No phy selected.
*
* @note This value can be used to indicate the absence of phy
*/
NONE = 0,

/**
* 1Mbit/s LE.
*
Expand Down Expand Up @@ -625,6 +678,8 @@ struct phy_t : SafeEnum<phy_t, uint8_t> {
*/
phy_t(type value) :
SafeEnum<phy_t, uint8_t>(value) { }

explicit phy_t(uint8_t raw_value) : SafeEnum(raw_value) { }
};

/**
Expand Down Expand Up @@ -658,16 +713,36 @@ class phy_set_t {
* @param phy_2m Prefer LE 2M if avaiable
* @param phy_coded Prefer coded modulation if avaiable
*/
phy_set_t(
bool phy_1m,
bool phy_2m,
bool phy_coded
) {
phy_set_t(bool phy_1m, bool phy_2m, bool phy_coded) :
_value()
{
set_1m(phy_1m);
set_2m(phy_2m);
set_coded(phy_coded);
}

/**
* Create a set from a single phy.
*
* @param phy The phy to add to the set.
*/
phy_set_t(phy_t phy) : _value()
{
switch (phy.value()) {
case phy_t::LE_1M:
set_1m(true);
break;
case phy_t::LE_2M:
set_2m(true);
break;
case phy_t::LE_CODED:
set_coded(true);
break;
default:
break;
}
}

/** Prefer 1M PHY. */
void set_1m(bool enabled = true) {
if (enabled) {
Expand Down Expand Up @@ -715,6 +790,10 @@ class phy_set_t {
return _value;
}

uint8_t count() const {
return (get_1m() ? 1 : 0) + (get_2m() ? 1 : 0) + (get_coded() ? 1 : 0);
}

private:
uint8_t _value;
};
Expand Down
2 changes: 1 addition & 1 deletion features/FEATURE_BLE/ble/DiscoveredCharacteristic.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#define MBED_DISCOVERED_CHARACTERISTIC_H__

#include "UUID.h"
#include "Gap.h"
#include "ble/Gap.h"
#include "GattAttribute.h"
#include "GattClient.h"
#include "CharacteristicDescriptorDiscovery.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#define MBED_DISCOVERED_CHARACTERISTIC_DESCRIPTOR_H__

#include "UUID.h"
#include "Gap.h"
#include "ble/Gap.h"
#include "GattAttribute.h"
#include "GattClient.h"
#include "CharacteristicDescriptorDiscovery.h"
Expand Down
Loading