Skip to content

Commit dedc204

Browse files
committed
BLE - Cleanup CordioGattServer conditional directives.
1 parent 831241d commit dedc204

File tree

2 files changed

+8
-20
lines changed

2 files changed

+8
-20
lines changed

features/FEATURE_BLE/targets/TARGET_CORDIO/CordioGattServer.h

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,8 @@ class BLE;
5151
/**
5252
* Cordio implementation of ::GattServer
5353
*/
54-
class GattServer : public ::ble::interface::GattServer<GattServer>
55-
#if BLE_FEATURE_SIGNING
56-
, public pal::SigningEventMonitor<GattServer, impl::SigningEventHandler>
57-
#endif
54+
class GattServer : public ::ble::interface::GattServer<GattServer>,
55+
public pal::SigningEventMonitor<GattServer, impl::SigningEventHandler>
5856
{
5957
friend ble::vendor::cordio::BLE;
6058
friend ble::pal::vendor::cordio::CordioAttClient;
@@ -176,7 +174,6 @@ class GattServer : public ::ble::interface::GattServer<GattServer>
176174
*/
177175
ble_error_t reset_(void);
178176

179-
#if BLE_FEATURE_SIGNING
180177
/**
181178
* @see pal::SigningEventMonitor::set_signing_event_handler
182179
*/
@@ -185,8 +182,6 @@ class GattServer : public ::ble::interface::GattServer<GattServer>
185182
) {
186183
_signing_event_handler = signing_event_handler;
187184
}
188-
#endif // BLE_FEATURE_SIGNING
189-
190185

191186
private:
192187
static uint16_t compute_attributes_count(GattService& service);
@@ -229,9 +224,7 @@ class GattServer : public ::ble::interface::GattServer<GattServer>
229224
static void att_cb(const attEvt_t *pEvt);
230225
static uint8_t atts_read_cb(dmConnId_t connId, uint16_t handle, uint8_t operation, uint16_t offset, attsAttr_t *pAttr);
231226
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);
232-
#if BLE_FEATURE_SECURITY
233227
static uint8_t atts_auth_cb(dmConnId_t connId, uint8_t permit, uint16_t handle);
234-
#endif // BLE_FEATURE_SECURITY
235228
void add_generic_access_service();
236229
void add_generic_attribute_service();
237230
void* alloc_block(size_t block_size);
@@ -250,9 +243,7 @@ class GattServer : public ::ble::interface::GattServer<GattServer>
250243
internal_service_t *next;
251244
};
252245

253-
#if BLE_FEATURE_SIGNING
254246
impl::SigningEventHandler *_signing_event_handler;
255-
#endif
256247

257248
attsCccSet_t cccds[MAX_CCCD_CNT];
258249
uint16_t cccd_values[MAX_CCCD_CNT];

features/FEATURE_BLE/targets/TARGET_CORDIO/source/CordioGattServer.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,8 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
1716
#include "BLERoles.h"
1817

19-
#if BLE_FEATURE_GATT_SERVER
20-
2118
#include <algorithm>
2219
#include "CordioBLE.h"
2320
#include "CordioGattServer.h"
@@ -1010,9 +1007,10 @@ uint8_t GattServer::atts_write_cb(
10101007
return ATT_SUCCESS;
10111008
}
10121009

1013-
#if BLE_FEATURE_SECURITY
1010+
10141011
uint8_t GattServer::atts_auth_cb(dmConnId_t connId, uint8_t permit, uint16_t handle)
10151012
{
1013+
#if BLE_FEATURE_SECURITY
10161014
// this CB is triggered when read or write of an attribute (either a value
10171015
// handle or a descriptor) requires secure connection security.
10181016
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
10281026
}
10291027

10301028
return ATT_SUCCESS;
1029+
#else
1030+
return ATT_ERR_AUTH;
1031+
#endif
10311032
}
1032-
#endif // BLE_FEATURE_SECURITY
1033+
10331034

10341035
void GattServer::add_generic_access_service()
10351036
{
@@ -1314,9 +1315,7 @@ bool GattServer::is_update_authorized(
13141315
}
13151316

13161317
GattServer::GattServer() :
1317-
#if BLE_FEATURE_SIGNING
13181318
_signing_event_handler(NULL),
1319-
#endif
13201319
cccds(),
13211320
cccd_values(),
13221321
cccd_handles(),
@@ -1334,5 +1333,3 @@ GattServer::GattServer() :
13341333
} // namespace cordio
13351334
} // namespace vendor
13361335
} // namespace ble
1337-
1338-
#endif // BLE_FEATURE_GATT_SERVER

0 commit comments

Comments
 (0)