To my very limited knowledge, it has something to do with an "attribute table" of some sort. So you will have an init function, where you get to write all your attributes inside so when an android phone connects to it, it can discover all the characteristics as well as services by reading this table.
My questions, 3 of them:
- Is my understanding correct?
- What function do you call to write that table? I've looked pretty hard at one example of many that provided, and found it quite confusing, because:
- How do you add them? By that I mean the amount of functions that are related to adding characteristics is not the same as the amount of characteristics that I saw on the android phone. A little bit detail follows:
There are 3 services, with the 1st one having 3 characteristics, one of them appears to be read-only, one read & write, one doesn't do anything.
The 2nd service has no characteristics whatsoever.
Like the 1st service, the 3rd service has one read-only and one read-write characteristic but no more.
Meanwhile, all the characteristics and the services are IDed by their UUID, which means there is no "name" associated with them (unless I specifically give them in my android java program), which makes the whole thing even more puzzling.
So how do you add all those characteristics anyway? It seems that you can add more than one by calling "sd_ble_gatts_characteristic_add()" only once. How does it work?