Skip to content

Commit 5fff7e1

Browse files
authored
Merge pull request #4356 from ARMmbed/release-candidate
Release candidate for mbed-os-5.4.6
2 parents 8d21974 + 3e78459 commit 5fff7e1

File tree

860 files changed

+127645
-23464
lines changed

Some content is hidden

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

860 files changed

+127645
-23464
lines changed

TESTS/events/timing/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ void semaphore_timing_test() {
104104

105105
// Test setup
106106
utest::v1::status_t test_setup(const size_t number_of_cases) {
107-
GREENTEA_SETUP((number_of_cases+1)*TEST_EVENTS_TIMING_TIME, "default_auto");
107+
GREENTEA_SETUP((number_of_cases+1)*TEST_EVENTS_TIMING_TIME/1000, "default_auto");
108108
return verbose_test_setup_handler(number_of_cases);
109109
}
110110

features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/btle/btle.cpp

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#include "ble_conn_params.h"
2525

2626
#include "btle_gap.h"
27-
#include "btle_advertising.h"
2827
#include "custom/custom_helper.h"
2928

3029
#include "ble/GapEvents.h"
@@ -165,13 +164,22 @@ error_t btle_init(void)
165164
return ERROR_INVALID_PARAM;
166165
}
167166

167+
// Peer Manger must been initialised prior any other call to its API (this file and btle_security_pm.cpp)
168+
pm_init();
169+
170+
#if (NRF_SD_BLE_API_VERSION <= 2)
168171
ble_gap_addr_t addr;
169172
if (sd_ble_gap_address_get(&addr) != NRF_SUCCESS) {
170173
return ERROR_INVALID_PARAM;
171174
}
172175
if (sd_ble_gap_address_set(BLE_GAP_ADDR_CYCLE_MODE_NONE, &addr) != NRF_SUCCESS) {
173176
return ERROR_INVALID_PARAM;
174177
}
178+
#else
179+
ble_gap_privacy_params_t privacy_params = {0};
180+
privacy_params.privacy_mode = BLE_GAP_PRIVACY_MODE_OFF;
181+
pm_privacy_set(&privacy_params);
182+
#endif
175183

176184
ASSERT_STATUS( softdevice_ble_evt_handler_set(btle_handler));
177185
ASSERT_STATUS( softdevice_sys_evt_handler_set(sys_evt_dispatch));
@@ -219,12 +227,25 @@ static void btle_handler(ble_evt_t *p_ble_evt)
219227
gap.setConnectionHandle(handle);
220228
const Gap::ConnectionParams_t *params = reinterpret_cast<Gap::ConnectionParams_t *>(&(p_ble_evt->evt.gap_evt.params.connected.conn_params));
221229
const ble_gap_addr_t *peer = &p_ble_evt->evt.gap_evt.params.connected.peer_addr;
230+
#if (NRF_SD_BLE_API_VERSION <= 2)
222231
const ble_gap_addr_t *own = &p_ble_evt->evt.gap_evt.params.connected.own_addr;
232+
223233
gap.processConnectionEvent(handle,
224-
role,
225-
static_cast<BLEProtocol::AddressType_t>(peer->addr_type), peer->addr,
226-
static_cast<BLEProtocol::AddressType_t>(own->addr_type), own->addr,
227-
params);
234+
role,
235+
static_cast<BLEProtocol::AddressType_t>(peer->addr_type), peer->addr,
236+
static_cast<BLEProtocol::AddressType_t>(own->addr_type), own->addr,
237+
params);
238+
#else
239+
Gap::AddressType_t addr_type;
240+
Gap::Address_t own_address;
241+
gap.getAddress(&addr_type, own_address);
242+
243+
gap.processConnectionEvent(handle,
244+
role,
245+
static_cast<BLEProtocol::AddressType_t>(peer->addr_type), peer->addr,
246+
addr_type, own_address,
247+
params);
248+
#endif
228249
break;
229250
}
230251

features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/btle/btle.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ extern "C" {
2424
#include "common/common.h"
2525

2626
#include "ble_srv_common.h"
27-
#include "nrf_ble.h"
27+
#include "headers/nrf_ble.h"
2828

2929
error_t btle_init(void);
3030

features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/btle/btle_advertising.cpp

Lines changed: 0 additions & 46 deletions
This file was deleted.

features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/btle/btle_discovery.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ void bleGattcEventHandler(const ble_evt_t *p_ble_evt)
5757

5858
case BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP:
5959
if (sdSingleton.isActive()) {
60-
sdSingleton.processDiscoverUUIDResponse(&p_ble_evt->evt.gattc_evt.params.char_val_by_uuid_read_rsp);
60+
sdSingleton.processDiscoverUUIDResponse(&p_ble_evt->evt.gattc_evt);
6161
}
6262
break;
6363

features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/btle/btle_gap.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616
#include "common/common.h"
1717

18-
#include "nrf_ble_gap.h"
18+
#include "headers/nrf_ble_gap.h"
1919
#include "ble_conn_params.h"
2020

2121
static inline uint32_t msec_to_1_25msec(uint32_t interval_ms) ATTR_ALWAYS_INLINE ATTR_CONST;

features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/btle/btle_security.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ ble_error_t btle_setLinkSecurity(Gap::Handle_t connectionHandle, SecurityManager
8484
*/
8585
ble_error_t btle_purgeAllBondingState(void);
8686

87+
#if (NRF_SD_BLE_API_VERSION <= 2)
8788
/**
8889
* Query the SoftDevice bond table to extract a whitelist containing the BLE
8990
* addresses and IRKs of bonded devices.
@@ -98,6 +99,7 @@ ble_error_t btle_purgeAllBondingState(void);
9899
* @return BLE_ERROR_NONE Or appropriate error code indicating reason for failure.
99100
*/
100101
ble_error_t btle_createWhitelistFromBondTable(ble_gap_whitelist_t *p_whitelist);
102+
#endif
101103

102104
/**
103105
* Function to test whether a BLE address is generated using an IRK.

features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/btle/btle_security_pm.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
#if defined(S130) || defined(S132)
17+
#if defined(S130) || defined(S132) || defined(S140)
1818
#include "btle.h"
1919

2020
#include "nRF5xn.h"
@@ -94,10 +94,6 @@ btle_initializeSecurity(bool enableBonding,
9494
}
9595
}
9696

97-
if (pm_init() != NRF_SUCCESS) {
98-
return BLE_ERROR_UNSPECIFIED;
99-
}
100-
10197
// update default security parameters with function call parameters
10298
securityParameters.bond = enableBonding;
10399
securityParameters.mitm = requireMITM;
@@ -393,6 +389,7 @@ void pm_handler(pm_evt_t const *p_event)
393389
}
394390
}
395391

392+
#if (NRF_SD_BLE_API_VERSION <= 2)
396393
ble_error_t
397394
btle_createWhitelistFromBondTable(ble_gap_whitelist_t *p_whitelist)
398395
{
@@ -408,7 +405,7 @@ btle_createWhitelistFromBondTable(ble_gap_whitelist_t *p_whitelist)
408405
return BLE_ERROR_INVALID_STATE;
409406
}
410407
}
411-
408+
#endif
412409

413410
bool
414411
btle_matchAddressAndIrk(ble_gap_addr_t const * p_addr, ble_gap_irk_t const * p_irk)

features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/btle/custom/custom_helper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#define _CUSTOM_HELPER_H_
1919

2020
#include "common/common.h"
21-
#include "nrf_ble.h"
21+
#include "headers/nrf_ble.h"
2222
#include "ble/UUID.h"
2323
#include "ble/GattCharacteristic.h"
2424

features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/nRF5xCharacteristicDescriptorDiscoverer.cpp

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616
#include "nRF5xCharacteristicDescriptorDiscoverer.h"
17-
#include "nrf_ble_err.h"
17+
#include "headers/nrf_ble_err.h"
1818
#include "ble/DiscoveredCharacteristicDescriptor.h"
1919

2020
nRF5xCharacteristicDescriptorDiscoverer::nRF5xCharacteristicDescriptorDiscoverer() :
@@ -136,6 +136,7 @@ void nRF5xCharacteristicDescriptorDiscoverer::processAttributeInformation(
136136
return;
137137
}
138138

139+
#if (NRF_SD_BLE_API_VERSION <= 2)
139140
// for all UUIDS found, process the discovery
140141
for (uint16_t i = 0; i < infos.count; ++i) {
141142
bool use_16bits_uuids = infos.format == BLE_GATTC_ATTR_INFO_FORMAT_16BIT;
@@ -146,6 +147,27 @@ void nRF5xCharacteristicDescriptorDiscoverer::processAttributeInformation(
146147

147148
// prepare the next round of descriptors discovery
148149
uint16_t startHandle = infos.attr_info[infos.count - 1].handle + 1;
150+
#else
151+
uint16_t startHandle;
152+
// for all UUIDS found, process the discovery
153+
if (infos.format == BLE_GATTC_ATTR_INFO_FORMAT_16BIT) {
154+
for (uint16_t i = 0; i < infos.count; ++i) {
155+
UUID uuid = UUID(infos.info.attr_info16[i].uuid.uuid);
156+
discovery->process(infos.info.attr_info16[i].handle, uuid);
157+
}
158+
159+
// prepare the next round of descriptors discovery
160+
startHandle = infos.info.attr_info16[infos.count - 1].handle + 1;
161+
} else {
162+
for (uint16_t i = 0; i < infos.count; ++i) {
163+
UUID uuid = UUID(infos.info.attr_info128[i].uuid.uuid128, UUID::LSB);
164+
discovery->process(infos.info.attr_info128[i].handle, uuid);
165+
}
166+
167+
// prepare the next round of descriptors discovery
168+
startHandle = infos.info.attr_info128[infos.count - 1].handle + 1;
169+
}
170+
#endif
149171
uint16_t endHandle = discovery->getCharacteristic().getLastHandle();
150172

151173
if(startHandle > endHandle) {

features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/nRF5xCharacteristicDescriptorDiscoverer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include "ble/DiscoveredCharacteristic.h"
2222
#include "ble/CharacteristicDescriptorDiscovery.h"
2323
#include "ble/GattClient.h"
24-
#include "nrf_ble_gattc.h"
24+
#include "headers/nrf_ble_gattc.h"
2525

2626
/**
2727
* @brief Manage the discovery of Characteristic descriptors

features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/nRF5xDiscoveredCharacteristic.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
#include "nRF5xDiscoveredCharacteristic.h"
1818
#include "nRF5xGattClient.h"
19-
#include "nrf_ble_gatt.h"
19+
#include "headers/nrf_ble_gatt.h"
2020

2121
void
2222
nRF5xDiscoveredCharacteristic::setup(nRF5xGattClient *gattcIn,

features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/nRF5xDiscoveredCharacteristic.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#define __NRF_DISCOVERED_CHARACTERISTIC_H__
1919

2020
#include "ble/DiscoveredCharacteristic.h"
21-
#include "nrf_ble_gatt.h"
21+
#include "headers/nrf_ble_gatt.h"
2222

2323
class nRF5xGattClient; /* forward declaration */
2424

0 commit comments

Comments
 (0)