5 years, 6 months ago.

Why GattService.h restrict Characteristics to 5

I opened GaatService.h and noticed

 #define BLE_SERVICE_MAX_CHARACTERISTICS (5)
//Some other code
GattCharacteristic* characteristics[BLE_SERVICE_MAX_CHARACTERISTICS];

Why characteristics are limited max to 5?

I am using nordic nRF51822 mbed mkit board. I also searched on nordic forum.

https://devzone.nordicsemi.com/index.php/sd-characteristics-per-service-limit

Which clearly indicates that there is no limit characteristics per service.

Question relating to:

High level Bluetooth Low Energy API and radio abstraction layer
Comment on this question

1 Answer

5 years, 6 months ago.

It's an arbitrary limit to cap memory usage, but with some trial and error you are free to change the number depending on how much SRAM the rest of your program uses.

I didn't want to change API code. This would obstruct any future updates of the library in my project. I wish mBed BLE team could implement something like this in the GattService constructor.

GattService::GattService(uint8_t base_uuid[16], GattCharacteristic[] charArray)

posted by Jigar Patel 21 May 2014

Just my two cents:

I think it's better to put this as comment on code itself, to avoid confusion.

Thanks

posted by devsar devsar 21 May 2014