Change type of index to int (instead of uint8_t) to fix issue with adding more than 255 Characteristics (or Descriptors) (#101)

This commit is contained in:
Casey Smith 2022-09-11 21:54:15 -04:00 committed by GitHub
parent 6a2f558ea5
commit 6fb26e3809
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -161,7 +161,7 @@ bool NimBLEService::start() {
// of the characteristics for the service. We create 1 extra and set it to null // of the characteristics for the service. We create 1 extra and set it to null
// for this purpose. // for this purpose.
pChr_a = new ble_gatt_chr_def[numChrs + 1]; pChr_a = new ble_gatt_chr_def[numChrs + 1];
uint8_t i = 0; int i = 0;
for(auto chr_it = m_chrVec.begin(); chr_it != m_chrVec.end(); ++chr_it) { for(auto chr_it = m_chrVec.begin(); chr_it != m_chrVec.end(); ++chr_it) {
if((*chr_it)->m_removed > 0) { if((*chr_it)->m_removed > 0) {
continue; continue;
@ -190,7 +190,7 @@ bool NimBLEService::start() {
} else { } else {
// Must have last descriptor uuid = 0 so we have to create 1 extra // Must have last descriptor uuid = 0 so we have to create 1 extra
pDsc_a = new ble_gatt_dsc_def[numDscs+1]; pDsc_a = new ble_gatt_dsc_def[numDscs+1];
uint8_t d = 0; int d = 0;
for(auto dsc_it = (*chr_it)->m_dscVec.begin(); dsc_it != (*chr_it)->m_dscVec.end(); ++dsc_it ) { for(auto dsc_it = (*chr_it)->m_dscVec.begin(); dsc_it != (*chr_it)->m_dscVec.end(); ++dsc_it ) {
if((*dsc_it)->m_removed > 0) { if((*dsc_it)->m_removed > 0) {
continue; continue;