pull define out into json config

pull/13365/head
Paul Szczeanek 2020-08-07 11:58:42 +01:00
parent 98bb0f7e55
commit 72b7d97fba
3 changed files with 18 additions and 16 deletions

View File

@ -33,16 +33,9 @@
#include "att_api.h"
#include "SecurityManager.h"
#include "ble/BLE.h"
#include "ble/types/GattCallbackParamTypes.h"
#include "ble/internal/PalSigningMonitor.h"
/*! Maximum count of characteristics that can be stored for authorisation purposes */
#define MAX_CHARACTERISTIC_AUTHORIZATION_CNT 20
/*! client characteristic configuration descriptors settings */
#define MAX_CCCD_CNT 20
namespace ble {
// fwd declaration of PalAttClient and BLE
@ -346,12 +339,12 @@ private:
PalSigningMonitorEventHandler *_signing_event_handler;
attsCccSet_t cccds[MAX_CCCD_CNT];
uint16_t cccd_values[MAX_CCCD_CNT];
uint16_t cccd_handles[MAX_CCCD_CNT];
attsCccSet_t cccds[MBED_CONF_BLE_API_IMPLEMENTATION_MAX_CCCD_COUNT];
uint16_t cccd_values[MBED_CONF_BLE_API_IMPLEMENTATION_MAX_CCCD_COUNT];
uint16_t cccd_handles[MBED_CONF_BLE_API_IMPLEMENTATION_MAX_CCCD_COUNT];
uint8_t cccd_cnt;
GattCharacteristic *_auth_char[MAX_CHARACTERISTIC_AUTHORIZATION_CNT];
GattCharacteristic *_auth_char[MBED_CONF_BLE_API_IMPLEMENTATION_MAX_CHARACTERISTIC_AUTHORISATION_COUNT];
uint8_t _auth_char_count;
struct {

View File

@ -1,3 +1,13 @@
{
"name": "ble-api-implementation"
"name": "ble-api-implementation",
"config": {
"max-characteristic-authorisation-count": {
"help": "Maximum count of characteristics that can be stored for authorisation purposes.",
"value": 20
},
"max-cccd-count": {
"help": "Client characteristic configuration descriptors settings.",
"value": 20
}
}
}

View File

@ -20,7 +20,6 @@
#include <algorithm>
#include "ble/GattServer.h"
#include "ble/internal/BLEInstanceBase.h"
#include "mbed.h"
#include "wsf_types.h"
#include "att_api.h"
@ -407,7 +406,7 @@ ble_error_t GattServer::insert_characteristic_value_attribute(
characteristic->isReadAuthorizationEnabled() ||
characteristic->isWriteAuthorizationEnabled()
) {
if ( _auth_char_count >= MAX_CHARACTERISTIC_AUTHORIZATION_CNT) {
if ( _auth_char_count >= MBED_CONF_BLE_API_IMPLEMENTATION_MAX_CHARACTERISTIC_AUTHORISATION_COUNT) {
return BLE_ERROR_NO_MEM;
}
_auth_char[_auth_char_count] = characteristic;
@ -447,7 +446,7 @@ ble_error_t GattServer::insert_descriptor(
// handle the special case of a CCCD
if (descriptor->getUUID() == UUID(BLE_UUID_DESCRIPTOR_CLIENT_CHAR_CONFIG)) {
if (cccd_cnt >= MAX_CCCD_CNT) {
if (cccd_cnt >= MBED_CONF_BLE_API_IMPLEMENTATION_MAX_CCCD_COUNT) {
return BLE_ERROR_NO_MEM;
}
@ -553,7 +552,7 @@ ble_error_t GattServer::insert_cccd(
GattCharacteristic *characteristic,
attsAttr_t *&attribute_it
) {
if (cccd_cnt >= MAX_CCCD_CNT) {
if (cccd_cnt >= MBED_CONF_BLE_API_IMPLEMENTATION_MAX_CCCD_COUNT) {
return BLE_ERROR_NO_MEM;
}