library for BLE_GAP_backpack

Dependencies:   nrf51-sdk

Fork of nRF51822 by Nordic Semiconductor

Revision:
453:38a41862ab4c
Parent:
451:87e7f14a3fa1
Child:
455:e33de7c4574c
--- a/source/nRF5xGattServer.cpp	Mon Nov 02 09:05:10 2015 +0000
+++ b/source/nRF5xGattServer.cpp	Mon Nov 02 09:05:10 2015 +0000
@@ -45,6 +45,7 @@
 /**************************************************************************/
 ble_error_t nRF5xGattServer::addService(GattService &service)
 {
+    /* ToDo: Make sure we don't overflow the array, etc. */
     /* ToDo: Make sure this service UUID doesn't already exist (?) */
     /* ToDo: Basic validation */
 
@@ -62,9 +63,6 @@
 
     /* Add characteristics to the service */
     for (uint8_t i = 0; i < service.getCharacteristicCount(); i++) {
-        if (characteristicCount >= BLE_TOTAL_CHARACTERISTICS) {
-            return BLE_ERROR_NO_MEM;
-        }
         GattCharacteristic *p_char = service.getCharacteristic(i);
 
         /* Skip any incompletely defined, read-only characteristics. */
@@ -110,11 +108,8 @@
         characteristicCount++;
 
         /* Add optional descriptors if any */
+        /* ToDo: Make sure we don't overflow the array */
         for (uint8_t j = 0; j < p_char->getDescriptorCount(); j++) {
-            if (descriptorCount >= BLE_TOTAL_DESCRIPTORS) {
-                return BLE_ERROR_NO_MEM;
-            }
-
             GattAttribute *p_desc = p_char->getDescriptor(j);
             /* skip the user-description-descriptor here; this has already been handled when adding the characteristic (above). */
             if (p_desc->getUUID() == BLE_UUID_DESCRIPTOR_CHAR_USER_DESC) {