From b68e18cdb4207e9d011d46482af239588596a90d Mon Sep 17 00:00:00 2001 From: Vincent Coubard Date: Fri, 22 Jun 2018 09:35:34 +0100 Subject: [PATCH] Nordi BLE: Fix formatting --- .../TARGET_NRF51/source/nRF5xGap.cpp | 1 - .../TARGET_NRF52/source/nRF5xGap.cpp | 27 +++++++++---------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF51/source/nRF5xGap.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF51/source/nRF5xGap.cpp index 717e38da39..e441fd4717 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF51/source/nRF5xGap.cpp +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF51/source/nRF5xGap.cpp @@ -1389,7 +1389,6 @@ ble_error_t nRF5xGap::get_role(ble::connection_handle_t connection, Role_t& role if (c.is_allocated && c.connection == connection) { role = c.is_peripheral ? PERIPHERAL : CENTRAL; return BLE_ERROR_NONE; - } } diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF52/source/nRF5xGap.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF52/source/nRF5xGap.cpp index 1e96afa68b..3a772b2667 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF52/source/nRF5xGap.cpp +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF52/source/nRF5xGap.cpp @@ -244,7 +244,7 @@ ble_error_t nRF5xGap::startAdvertising(const GapAdvertisingParams ¶ms) { uint32_t err; ble_gap_adv_params_t adv_para = {0}; - + /* Make sure we support the advertising type */ if (params.getAdvertisingType() == GapAdvertisingParams::ADV_CONNECTABLE_DIRECTED) { /* ToDo: This requires a propery security implementation, etc. */ @@ -296,7 +296,7 @@ ble_error_t nRF5xGap::startAdvertising(const GapAdvertisingParams ¶ms) return error; } } - + if (_privacy_enabled) { if (_peripheral_privacy_configuration.resolution_strategy != PeripheralPrivacyConfiguration_t::DO_NOT_RESOLVE) { ArrayView entries = get_sm().get_resolving_list(); @@ -336,7 +336,7 @@ ble_error_t nRF5xGap::startAdvertising(const GapAdvertisingParams ¶ms) } #endif /* For NRF_SD_BLE_API_VERSION >= 3 nRF5xGap::setWhitelist setups the whitelist. */ - + /* Start Advertising */ @@ -345,7 +345,7 @@ ble_error_t nRF5xGap::startAdvertising(const GapAdvertisingParams ¶ms) adv_para.fp = advertisingPolicyMode; adv_para.interval = params.getIntervalInADVUnits(); // advertising interval (in units of 0.625 ms) adv_para.timeout = params.getTimeout(); - + #if (NRF_SD_BLE_API_VERSION >= 5) err = sd_ble_gap_adv_start(&adv_para, NRF_CONNECTION_TAG); #else @@ -365,9 +365,9 @@ ble_error_t nRF5xGap::startAdvertising(const GapAdvertisingParams ¶ms) #if !defined(TARGET_MCU_NRF51_16K_S110) && !defined(TARGET_MCU_NRF51_32K_S110) ble_error_t nRF5xGap::startRadioScan(const GapScanningParams &scanningParams) { - + ble_gap_scan_params_t scanParams; - + #if (NRF_SD_BLE_API_VERSION <= 2) /* Allocate the stack's whitelist statically */ ble_gap_whitelist_t whitelist; @@ -386,17 +386,17 @@ ble_error_t nRF5xGap::startRadioScan(const GapScanningParams &scanningParams) return error; } } - + // FIXME: fill the irk list once addresses are resolved by the softdevice. scanParams.selective = scanningPolicyMode; /**< If 1, ignore unknown devices (non whitelisted). */ scanParams.p_whitelist = &whitelist; /**< Pointer to whitelist, NULL if none is given. */ #else /* For NRF_SD_BLE_API_VERSION >= 3 nRF5xGap::setWhitelist setups the whitelist. */ - + scanParams.use_whitelist = scanningPolicyMode; scanParams.adv_dir_report = 0; #endif - + scanParams.active = scanningParams.getActiveScanning(); /**< If 1, perform active scanning (scan requests). */ scanParams.interval = scanningParams.getInterval(); /**< Scan interval between 0x0004 and 0x4000 in 0.625ms units (2.5ms to 10.24s). */ @@ -545,7 +545,7 @@ ble_error_t nRF5xGap::connect( } ble_gap_scan_params_t scanParams ={0}; - + #if (NRF_SD_BLE_API_VERSION <= 2) /* Allocate the stack's whitelist statically */ ble_gap_whitelist_t whitelist; @@ -564,7 +564,7 @@ ble_error_t nRF5xGap::connect( return error; } } - + scanParams.selective = scanningPolicyMode; /**< If 1, ignore unknown devices (non whitelisted). */ scanParams.p_whitelist = &whitelist; /**< Pointer to whitelist, NULL if none is given. */ if (_privacy_enabled) { @@ -597,7 +597,7 @@ ble_error_t nRF5xGap::connect( } #else /* For NRF_SD_BLE_API_VERSION >= 3 nRF5xGap::setWhitelist setups the whitelist. */ - + scanParams.use_whitelist = (whitelistAddressesSize) ? 1 : 0; if (_privacy_enabled) { @@ -797,7 +797,7 @@ ble_error_t nRF5xGap::setAddress(LegacyAddressType_t type, const Address_t addre if (_privacy_enabled) { return BLE_ERROR_INVALID_STATE; } - + ble_gap_addr_t dev_addr; memcpy(dev_addr.addr, address, ADDR_LEN); if (type == LegacyAddressType::PUBLIC) { @@ -1472,7 +1472,6 @@ ble_error_t nRF5xGap::get_role(ble::connection_handle_t connection, Role_t& role if (c.is_allocated && c.connection == connection) { role = c.is_peripheral ? PERIPHERAL : CENTRAL; return BLE_ERROR_NONE; - } }