Skip to content

Commit 3253b5c

Browse files
authored
Merge pull request #276 from facchinm/master_6.12
Rebuild on mbed-os 6.12
2 parents 3a3db88 + 9893c01 commit 3253b5c

File tree

507 files changed

+53612
-356936
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

507 files changed

+53612
-356936
lines changed

cores/arduino/mbed/connectivity/FEATURE_BLE/include/ble/Gap.h

+6-2
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,9 @@ class Gap {
747747
* @param handle Advertising set handle.
748748
* @param maxDuration Max duration for advertising (in units of 10ms) - 0 means no limit.
749749
* @param maxEvents Max number of events produced during advertising - 0 means no limit.
750-
* @return BLE_ERROR_NONE on success.
750+
* @return BLE_ERROR_NONE on success. This does not guarantee the set has started if
751+
* extended advertising is enabled. Register an event handler and wait for onAdvertisingStart
752+
* event. An (unlikely) failed start the status of the event will contain an error.
751753
*
752754
* @see EventHandler::onAdvertisingStart when the advertising starts.
753755
* @see EventHandler::onScanRequestReceived when a scan request is received.
@@ -765,7 +767,9 @@ class Gap {
765767
* which will not be affected.
766768
*
767769
* @param handle Advertising set handle.
768-
* @return BLE_ERROR_NONE on success.
770+
* @return BLE_ERROR_NONE on success. For extented advertising this does not guarantee
771+
* the set is stopped if. Register an event handler and wait for onAdvertisingEnd event.
772+
* An (unlikely) failed stop the event status will contain the error code.
769773
*/
770774
ble_error_t stopAdvertising(advertising_handle_t handle);
771775

cores/arduino/mbed/connectivity/FEATURE_BLE/include/ble/GattServer.h

+9-6
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,9 @@ class GattServer {
122122
}
123123

124124
/**
125-
* Function invoked when the server has sent data to a client as
126-
* part of a notification/indication.
125+
* Function invoked when the server has sent data to a client. For
126+
* notifications this is triggered when data is sent, for indications
127+
* it's only triggered when the confirmation has been received.
127128
*
128129
* @note params has a temporary scope and should be copied by the
129130
* application if needed later
@@ -188,12 +189,13 @@ class GattServer {
188189
}
189190

190191
/**
191-
* Function invoked when an ACK has been received for an
192-
* indication sent to the client.
192+
* Event not used.
193193
*
194194
* @note params has a temporary scope and should be copied by the
195195
* application if needed later
196196
*/
197+
MBED_DEPRECATED_SINCE("mbed-os-6.11.0", "This event is never triggered. Indication triggers onDataSent"
198+
"when confirmation is received.")
197199
virtual void onConfirmationReceived(const GattConfirmationReceivedCallbackParams &params) {
198200
(void)params;
199201
}
@@ -274,7 +276,7 @@ class GattServer {
274276
* Event handler that handles subscription to characteristic updates,
275277
* unsubscription from characteristic updates and notification confirmation.
276278
*
277-
* @see onUpdatesEnabled() onUpdateDisabled() onConfirmationReceived()
279+
* @see onUpdatesEnabled() onUpdateDisabled()
278280
*/
279281
typedef FunctionPointerWithContext<GattAttribute::Handle_t> EventCallback_t;
280282

@@ -705,7 +707,8 @@ class GattServer {
705707
* @param[in] callback Event handler being registered.
706708
*/
707709
MBED_DEPRECATED_SINCE("mbed-os-6.3.0", "Individual callback-registering functions have"
708-
"been replaced by GattServer::setEventHandler. Use that function instead.")
710+
"been replaced by an event handler. Indication confirmation triggers"
711+
"GattServer::onDataSent event instead.")
709712
void onConfirmationReceived(EventCallback_t callback);
710713

711714
#if !defined(DOXYGEN_ONLY)

cores/arduino/mbed/connectivity/FEATURE_BLE/include/ble/common/BLERoles.h

+44
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,50 @@
1919
#ifndef MBED_BLE_ROLES_H__
2020
#define MBED_BLE_ROLES_H__
2121

22+
/* we provide default values if no configuration is present (e.g. in unittests) */
23+
#if !defined(BLE_ROLE_OBSERVER)
24+
#define BLE_ROLE_OBSERVER 1
25+
#endif
26+
#if !defined(BLE_ROLE_BROADCASTER)
27+
#define BLE_ROLE_BROADCASTER 1
28+
#endif
29+
#if !defined(BLE_ROLE_CENTRAL)
30+
#define BLE_ROLE_CENTRAL 1
31+
#endif
32+
#if !defined(BLE_ROLE_PERIPHERAL)
33+
#define BLE_ROLE_PERIPHERAL 1
34+
#endif
35+
#if !defined(BLE_FEATURE_GATT_CLIENT)
36+
#define BLE_FEATURE_GATT_CLIENT 1
37+
#endif
38+
#if !defined(BLE_FEATURE_GATT_SERVER)
39+
#define BLE_FEATURE_GATT_SERVER 1
40+
#endif
41+
#if !defined(BLE_FEATURE_SECURITY)
42+
#define BLE_FEATURE_SECURITY 1
43+
#endif
44+
#if !defined(BLE_FEATURE_SECURE_CONNECTIONS)
45+
#define BLE_FEATURE_SECURE_CONNECTIONS 1
46+
#endif
47+
#if !defined(BLE_FEATURE_SIGNING)
48+
#define BLE_FEATURE_SIGNING 1
49+
#endif
50+
#if !defined(BLE_FEATURE_WHITELIST)
51+
#define BLE_FEATURE_WHITELIST 1
52+
#endif
53+
#if !defined(BLE_FEATURE_PRIVACY)
54+
#define BLE_FEATURE_PRIVACY 1
55+
#endif
56+
#if !defined(BLE_FEATURE_PHY_MANAGEMENT)
57+
#define BLE_FEATURE_PHY_MANAGEMENT 1
58+
#endif
59+
#if !defined(BLE_FEATURE_EXTENDED_ADVERTISING)
60+
#define BLE_FEATURE_EXTENDED_ADVERTISING 1
61+
#endif
62+
#if !defined(BLE_FEATURE_PERIODIC_ADVERTISING)
63+
#define BLE_FEATURE_PERIODIC_ADVERTISING 1
64+
#endif
65+
2266
#if !(BLE_ROLE_OBSERVER) && !(BLE_ROLE_BROADCASTER)
2367
#error "BLE requires at least one role 'BROADCASTER' or 'OBSERVER' to be enabled"
2468
#endif

cores/arduino/mbed/connectivity/FEATURE_BLE/include/ble/common/blecommon.h

+11-1
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,17 @@ enum ble_error_t {
216216
/**
217217
* Data not found or there is nothing to return.
218218
*/
219-
BLE_ERROR_NOT_FOUND = 13
219+
BLE_ERROR_NOT_FOUND = 13,
220+
221+
/**
222+
* Specified timeout expired.
223+
*/
224+
BLE_ERROR_TIMEOUT = 14,
225+
226+
/**
227+
* Specified limit expired.
228+
*/
229+
BLE_ERROR_LIMIT_REACHED = 15
220230
};
221231

222232
/**

cores/arduino/mbed/connectivity/FEATURE_BLE/include/ble/gap/Events.h

+34-8
Original file line numberDiff line numberDiff line change
@@ -586,9 +586,10 @@ struct AdvertisingStartEvent {
586586
/** Create an advertising start event.
587587
*
588588
* @param advHandle Advertising set handle.
589+
* @param status Advertising set start command status.
589590
*/
590-
AdvertisingStartEvent(advertising_handle_t advHandle) :
591-
advHandle(advHandle)
591+
AdvertisingStartEvent(advertising_handle_t advHandle, ble_error_t status = BLE_ERROR_NONE) :
592+
advHandle(advHandle), status(status)
592593
{
593594
}
594595

@@ -600,8 +601,15 @@ struct AdvertisingStartEvent {
600601
return advHandle;
601602
}
602603

604+
/** Get status of operation. */
605+
ble_error_t getStatus() const
606+
{
607+
return status;
608+
}
609+
603610
private:
604611
advertising_handle_t advHandle;
612+
ble_error_t status;
605613
};
606614

607615
/**
@@ -610,29 +618,38 @@ struct AdvertisingStartEvent {
610618
* @see ble::Gap::EventHandler::onAdvertisingEnd().
611619
*
612620
* @note The connection handle, connected flag and completed_event fields are
613-
* valid if the flag legacy is not set to true.
621+
* valid if the flag legacy is not set to true. If status is different from BLE_ERROR_NONE
622+
* the completed_events field is not valid and the set may still be active.
614623
*/
615624
struct AdvertisingEndEvent {
616625
#if !defined(DOXYGEN_ONLY)
617626

618627
/** Create an extended advertising end event.
619628
*
620629
* @param advHandle Advertising set handle.
621-
* @param connection Connection handle.
622-
* @param completed_events Number of events created during before advertising end.
630+
* @param connection Connection handle - only valid if connected is True.
631+
* @param completed_events Number of events created during before advertising end - only valid
632+
* if advertising end has been caused by BLE_ERROR_LIMIT_REACHED, not the local user.
633+
* Check getStatus().
623634
* @param connected True if connection has been established.
635+
* @param status Error code showing the reason for event. BLE_ERROR_LIMIT_REACHED if set number
636+
* of events have been reached. BLE_ERROR_TIMEOUT if set time has elapsed.
637+
* BLE_ERROR_SUCCESS if connection occurred or user ended the set. Check isConnected()
638+
* to determine which.
624639
*/
625640
AdvertisingEndEvent(
626641
advertising_handle_t advHandle,
627642
connection_handle_t connection,
628643
uint8_t completed_events,
629-
bool connected
644+
bool connected,
645+
ble_error_t status = BLE_ERROR_NONE
630646
) :
631647
advHandle(advHandle),
632648
connection(connection),
633649
completed_events(completed_events),
634650
connected(connected),
635-
legacy(false)
651+
legacy(false),
652+
status(status)
636653
{
637654
}
638655

@@ -643,7 +660,8 @@ struct AdvertisingEndEvent {
643660
connection(),
644661
completed_events(0),
645662
connected(false),
646-
legacy(true)
663+
legacy(true),
664+
status(BLE_ERROR_NONE)
647665
{
648666
}
649667

@@ -683,12 +701,20 @@ struct AdvertisingEndEvent {
683701
return legacy;
684702
}
685703

704+
/** Get the result of the stop advertising event. If the status is not BLE_ERROR_NONE the set
705+
* may still be active. */
706+
ble_error_t getStatus() const
707+
{
708+
return status;
709+
}
710+
686711
private:
687712
advertising_handle_t advHandle;
688713
connection_handle_t connection;
689714
uint8_t completed_events;
690715
bool connected;
691716
bool legacy;
717+
ble_error_t status;
692718
};
693719

694720
/**

cores/arduino/mbed/connectivity/FEATURE_BLE/include/ble/gatt/GattCharacteristic.h

+16-5
Original file line numberDiff line numberDiff line change
@@ -1672,19 +1672,30 @@ class GattCharacteristic {
16721672
*
16731673
* @attention This function is not meant to be called by user code.
16741674
*
1675-
* @param[in] params Context of the read-auth request; it contains an
1675+
* @param[in,out] params Context of the read-auth request; it contains an
16761676
* out-parameter used as a reply and the handler can fill it with outgoing
1677-
* data.
1677+
* data. The params->data provides a pointer to the data and params->len
1678+
* provides the length of this data. params->len is also used to pass the
1679+
* maximum size of data that the params->data can contain. If you set the
1680+
* params->len to a value larger than the passed in value the read operation
1681+
* will fail.
16781682
*
16791683
* @return A GattAuthCallbackReply_t value indicating whether authorization
16801684
* is granted.
16811685
*
1686+
* @note If the read is approved, the event handler can specify an outgoing
1687+
* value directly with the help of the fields params->data and params->len.
1688+
*
16821689
* @note If the read request is approved and params->data remains nullptr, then
16831690
* the current characteristic value is used in the read response payload.
16841691
*
1685-
* @note If the read is approved, the event handler can specify an outgoing
1686-
* value directly with the help of the fields
1687-
* GattReadAuthCallbackParams::data and GattReadAuthCallbackParams::len.
1692+
* @note The params->len parameter initially contains the maximum length of
1693+
* data that can be returned. Set it to the length of your data but it must
1694+
* not be larger than the original value.
1695+
*
1696+
* @note You must also take into account the offset provided in params->offset.
1697+
* The params->len you provide must be larger then the offset as the read operation
1698+
* will attempt to read at that offset.
16881699
*/
16891700
GattAuthCallbackReply_t authorizeRead(GattReadAuthCallbackParams *params)
16901701
{

cores/arduino/mbed/connectivity/FEATURE_BLE/source/cordio/source/BLEInstanceBaseImpl.h

+15-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,13 @@
4545
#include "source/PalPrivateAddressControllerImpl.h"
4646
#include "source/generic/PrivateAddressController.h"
4747

48+
#include "drivers/Timeout.h"
49+
#ifdef DEVICE_LPTICKER
50+
#include "drivers/LowPowerTimeout.h"
4851
#include "drivers/LowPowerTimer.h"
52+
#else
53+
#include "drivers/Timer.h"
54+
#endif
4955

5056
namespace ble {
5157

@@ -57,6 +63,14 @@ namespace impl {
5763
* @see BLEInstanceBase
5864
*/
5965
class BLEInstanceBase final : public ble::BLEInstanceBase {
66+
#ifdef DEVICE_LPTICKER
67+
using Timeout = mbed::LowPowerTimeout;
68+
using Timer = mbed::LowPowerTimer;
69+
#else
70+
using Timeout = mbed::Timeout;
71+
using Timer = mbed::Timer;
72+
#endif
73+
6074
friend PalSigningMonitor;
6175

6276
/**
@@ -200,7 +214,7 @@ class BLEInstanceBase final : public ble::BLEInstanceBase {
200214
} initialization_status;
201215

202216
mutable ble::impl::PalEventQueue _event_queue;
203-
mbed::LowPowerTimer _timer;
217+
Timer _timer;
204218
uint64_t _last_update_us;
205219
};
206220

0 commit comments

Comments
 (0)