Number of services in BLE

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.wsdof.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
2 posts / 0 new
Last post
mahmed106
Offline
Last seen:4 weeks 1 day ago
加入:2019-05-03 17:28
Number of services in BLE

Hi dialog

I am working on a custom board based on DA14681, and in firmware i am using around 7-8 services. They are working fine. I want to add 5 more services. Is there any limit for number of services? If yes then how many? And do they affect performace of overall setup?

Thanks

Device:
MHv_Dialog
Offline
Last seen:1 month 1 week ago
工作人员
加入:2013-12-06 15:10
Hi mahmed106,

Hi mahmed106,

There is no meaningful limit to the number of services you can implement, but the number of services and characteristics has a negative impact on user friendlyness because service discovery during connection will take a long time. A lot of services also require a lot of memory, so you will have to be mindful of this.

If you are implementing support for a lot of standard BT SIG adopted profiles, you really have no choice, but if you are implementing your own custom services, you can improve your design by limiting these to one custom service with just a few characteristics. This is done by using one characteristic as a command field - often referred to as a control point. You can write various commands to this characteristic and even implement support for arguments. Your firmware would then interpret the command and arguments into some meaningful action and send the response to the command back to the client via GATT notify. There are several advantages to this approach (and no disadvantages comes to mind!)

  1. It reduces the service discovery time (and energy spend during that time)
  2. It limits the memory usage dramatically
  3. It is easy to expand the functionality of your implementation (firmware and phone app)
  4. The implementation is simpler and cleaner (On the firmware side as well as the phone app side)
  5. Less UUIDs to keep track of
  6. Much easier to add and remove various debugging functionality

You can have a look at how our CodeLess (DA14585) is implemented. One characteristic receives a number of different commands with various number of arguments as described above.

/MHv