From dedc204daaf2755c441162fd966f626433cbd382 Mon Sep 17 00:00:00 2001 From: Vincent Coubard Date: Thu, 28 Feb 2019 11:34:35 +0000 Subject: [PATCH] BLE - Cleanup CordioGattServer conditional directives. --- .../targets/TARGET_CORDIO/CordioGattServer.h | 13 ++----------- .../TARGET_CORDIO/source/CordioGattServer.cpp | 15 ++++++--------- 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/features/FEATURE_BLE/targets/TARGET_CORDIO/CordioGattServer.h b/features/FEATURE_BLE/targets/TARGET_CORDIO/CordioGattServer.h index 484b0803a6..33edc08e60 100644 --- a/features/FEATURE_BLE/targets/TARGET_CORDIO/CordioGattServer.h +++ b/features/FEATURE_BLE/targets/TARGET_CORDIO/CordioGattServer.h @@ -51,10 +51,8 @@ class BLE; /** * Cordio implementation of ::GattServer */ -class GattServer : public ::ble::interface::GattServer -#if BLE_FEATURE_SIGNING - , public pal::SigningEventMonitor -#endif +class GattServer : public ::ble::interface::GattServer, + public pal::SigningEventMonitor { friend ble::vendor::cordio::BLE; friend ble::pal::vendor::cordio::CordioAttClient; @@ -176,7 +174,6 @@ public: */ ble_error_t reset_(void); -#if BLE_FEATURE_SIGNING /** * @see pal::SigningEventMonitor::set_signing_event_handler */ @@ -185,8 +182,6 @@ public: ) { _signing_event_handler = signing_event_handler; } -#endif // BLE_FEATURE_SIGNING - private: static uint16_t compute_attributes_count(GattService& service); @@ -229,9 +224,7 @@ private: static void att_cb(const attEvt_t *pEvt); static uint8_t atts_read_cb(dmConnId_t connId, uint16_t handle, uint8_t operation, uint16_t offset, attsAttr_t *pAttr); static uint8_t atts_write_cb(dmConnId_t connId, uint16_t handle, uint8_t operation, uint16_t offset, uint16_t len, uint8_t *pValue, attsAttr_t *pAttr); -#if BLE_FEATURE_SECURITY static uint8_t atts_auth_cb(dmConnId_t connId, uint8_t permit, uint16_t handle); -#endif // BLE_FEATURE_SECURITY void add_generic_access_service(); void add_generic_attribute_service(); void* alloc_block(size_t block_size); @@ -250,9 +243,7 @@ private: internal_service_t *next; }; -#if BLE_FEATURE_SIGNING impl::SigningEventHandler *_signing_event_handler; -#endif attsCccSet_t cccds[MAX_CCCD_CNT]; uint16_t cccd_values[MAX_CCCD_CNT]; diff --git a/features/FEATURE_BLE/targets/TARGET_CORDIO/source/CordioGattServer.cpp b/features/FEATURE_BLE/targets/TARGET_CORDIO/source/CordioGattServer.cpp index d632d43a98..1bde34b3a7 100644 --- a/features/FEATURE_BLE/targets/TARGET_CORDIO/source/CordioGattServer.cpp +++ b/features/FEATURE_BLE/targets/TARGET_CORDIO/source/CordioGattServer.cpp @@ -13,11 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - #include "BLERoles.h" -#if BLE_FEATURE_GATT_SERVER - #include #include "CordioBLE.h" #include "CordioGattServer.h" @@ -1010,9 +1007,10 @@ uint8_t GattServer::atts_write_cb( return ATT_SUCCESS; } -#if BLE_FEATURE_SECURITY + uint8_t GattServer::atts_auth_cb(dmConnId_t connId, uint8_t permit, uint16_t handle) { +#if BLE_FEATURE_SECURITY // this CB is triggered when read or write of an attribute (either a value // handle or a descriptor) requires secure connection security. SecurityManager& security_manager = BLE::deviceInstance().getSecurityManager(); @@ -1028,8 +1026,11 @@ uint8_t GattServer::atts_auth_cb(dmConnId_t connId, uint8_t permit, uint16_t han } return ATT_SUCCESS; +#else + return ATT_ERR_AUTH; +#endif } -#endif // BLE_FEATURE_SECURITY + void GattServer::add_generic_access_service() { @@ -1314,9 +1315,7 @@ bool GattServer::is_update_authorized( } GattServer::GattServer() : -#if BLE_FEATURE_SIGNING _signing_event_handler(NULL), -#endif cccds(), cccd_values(), cccd_handles(), @@ -1334,5 +1333,3 @@ GattServer::GattServer() : } // namespace cordio } // namespace vendor } // namespace ble - -#endif // BLE_FEATURE_GATT_SERVER