Merge #48 into develop
This commit is contained in:
commit
804e7f8bb9
4
LICENSE
4
LICENSE
|
@ -1,6 +1,6 @@
|
||||||
Many of the files in this module have been inherited from the Nordic SDK for
|
Many of the files in this module have been inherited from the Nordic SDK for
|
||||||
nRF51822; they come with a BSD-like license offered by Nordic for use with mbed.
|
nRF51822; they come with a BSD-like license offered by Nordic for use in mbed.
|
||||||
Others come from the mbed SDK, and are licensed under Apache-2.0.
|
Some other files come from the mbed SDK, and are licensed under Apache-2.0.
|
||||||
Unless specifically indicated otherwise in a file, files are licensed
|
Unless specifically indicated otherwise in a file, files are licensed
|
||||||
under the Apache 2.0 license, as can be found in: apache-2.0.txt.
|
under the Apache 2.0 license, as can be found in: apache-2.0.txt.
|
||||||
The BSD-like Nordic license can be found in BSD-3clause-Nordic.txt
|
The BSD-like Nordic license can be found in BSD-3clause-Nordic.txt
|
||||||
|
|
|
@ -45,7 +45,6 @@ nRF5xGattServer &nRF5xGattServer::getInstance(void) {
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
ble_error_t nRF5xGattServer::addService(GattService &service)
|
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: Make sure this service UUID doesn't already exist (?) */
|
||||||
/* ToDo: Basic validation */
|
/* ToDo: Basic validation */
|
||||||
|
|
||||||
|
@ -63,6 +62,9 @@ ble_error_t nRF5xGattServer::addService(GattService &service)
|
||||||
|
|
||||||
/* Add characteristics to the service */
|
/* Add characteristics to the service */
|
||||||
for (uint8_t i = 0; i < service.getCharacteristicCount(); i++) {
|
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);
|
GattCharacteristic *p_char = service.getCharacteristic(i);
|
||||||
|
|
||||||
/* Skip any incompletely defined, read-only characteristics. */
|
/* Skip any incompletely defined, read-only characteristics. */
|
||||||
|
@ -108,8 +110,11 @@ ble_error_t nRF5xGattServer::addService(GattService &service)
|
||||||
characteristicCount++;
|
characteristicCount++;
|
||||||
|
|
||||||
/* Add optional descriptors if any */
|
/* Add optional descriptors if any */
|
||||||
/* ToDo: Make sure we don't overflow the array */
|
|
||||||
for (uint8_t j = 0; j < p_char->getDescriptorCount(); j++) {
|
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);
|
GattAttribute *p_desc = p_char->getDescriptor(j);
|
||||||
/* skip the user-description-descriptor here; this has already been handled when adding the characteristic (above). */
|
/* 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) {
|
if (p_desc->getUUID() == BLE_UUID_DESCRIPTOR_CHAR_USER_DESC) {
|
||||||
|
|
Loading…
Reference in New Issue