BLE - Cleanup CordioGattServer conditional directives.

pull/9790/head
Vincent Coubard 2019-02-28 11:34:35 +00:00
parent 831241df12
commit dedc204daa
2 changed files with 8 additions and 20 deletions

View File

@ -51,10 +51,8 @@ class BLE;
/**
* Cordio implementation of ::GattServer
*/
class GattServer : public ::ble::interface::GattServer<GattServer>
#if BLE_FEATURE_SIGNING
, public pal::SigningEventMonitor<GattServer, impl::SigningEventHandler>
#endif
class GattServer : public ::ble::interface::GattServer<GattServer>,
public pal::SigningEventMonitor<GattServer, impl::SigningEventHandler>
{
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];

View File

@ -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 <algorithm>
#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