increase max connections to 20 (central + prph)

This commit is contained in:
hathach committed 2019-01-21 23:13:59 +07:00
1 parent 5cdded82e9
commit d15b196fe6
7 files changed
+26 -32

No files matched your search

+1 -1
View File
@@ -104,7 +104,7 @@ bool BLECentral::connected(uint16_t conn_hdl)
uint8_t BLECentral::connected(void)
{
uint8_t count = 0;
for (uint16_t c=0; c<BLE_MAX_CONN; c++)
for (uint16_t c=0; c<BLE_MAX_CONNECTION; c++)
{
if ( this->connected(c) ) count++;
}
+1 -1
View File
@@ -241,7 +241,7 @@ void BLEGap::_eventHandler(ble_evt_t* evt)
_connection[conn_hdl] = NULL;
bool still_connected = false;
for (uint8_t i=0; i<BLE_MAX_CONN; i++)
for (uint8_t i=0; i<BLE_MAX_CONNECTION; i++)
{
if ( _connection[i] )
{
+1 -1
View File
@@ -114,7 +114,7 @@ class BLEGap
ble_gap_sec_params_t _sec_param;
BLEConnection* _connection[BLE_MAX_CONN];
BLEConnection* _connection[BLE_MAX_CONNECTION];
friend class AdafruitBluefruit;
};
+5 -5
View File
@@ -314,8 +314,8 @@ err_t AdafruitBluefruit::begin(uint8_t prph_count, uint8_t central_count)
// Roles
varclr(&blecfg);
blecfg.gap_cfg.role_count_cfg.periph_role_count = _prph_count;
blecfg.gap_cfg.role_count_cfg.central_role_count = _central_count; // ? BLE_CENTRAL_MAX_CONN : 0);
blecfg.gap_cfg.role_count_cfg.central_sec_count = (_central_count ? 1 : 0); // should be enough
blecfg.gap_cfg.role_count_cfg.central_role_count = _central_count;
blecfg.gap_cfg.role_count_cfg.central_sec_count = (_central_count ? 1 : 0); // 1 should be enough
VERIFY_STATUS( sd_ble_cfg_set(BLE_GAP_CFG_ROLE_COUNT, &blecfg, ram_start) );
// Device Name
@@ -541,7 +541,7 @@ uint8_t AdafruitBluefruit::connected(void)
return ( _conn_hdl != BLE_CONN_HANDLE_INVALID );
uint8_t count = 0;
for (uint16_t c=0; c<BLE_MAX_CONN; c++)
for (uint16_t c=0; c<BLE_MAX_CONNECTION; c++)
{
// skip Peripheral Role handle
if ( this->connected(c) ) count++;
@@ -977,8 +977,8 @@ void AdafruitBluefruit::printInfo(void)
// Max Connections
Serial.printf(title_fmt, "Max Connections");
Serial.printf("Peripheral = %d, ", _prph_count ? 1 : 0);
Serial.printf("Central = %d ", _central_count ? BLE_CENTRAL_MAX_CONN : 0);
Serial.printf("Peripheral = %d, ", _prph_count);
Serial.printf("Central = %d ", _central_count);
Serial.println();
// Address
+3 -7
View File
@@ -39,18 +39,14 @@
#include <Arduino.h>
#include "bluefruit_common.h"
#define CFG_ADV_BLINKY_INTERVAL 500
#define CFG_ADV_BLINKY_INTERVAL 500
/* Note changing these parameters will affect APP_RAM_BASE
* --> need to update RAM region in linker file
* - BLE_GATT_ATT_MTU_MAX from 23 (default) to 247
*/
#define BLE_GATT_ATT_MTU_MAX 247
#define BLE_PRPH_MAX_CONN 1
#define BLE_CENTRAL_MAX_CONN 4
#define BLE_CENTRAL_MAX_SECURE_CONN 1 // should be enough
#define BLE_MAX_CONN (BLE_CENTRAL_MAX_CONN+BLE_PRPH_MAX_CONN)
#define BLE_GATT_ATT_MTU_MAX 247
#define BLE_MAX_CONNECTION 20 // SD support up to 20 connections
#include "BLEUuid.h"
#include "BLEAdvertising.h"