I have read the example on creating custom GATT services, which shows how to set up a read and write characteristic, and it creates update functions e.g. :
void updatePercentage(uint8_t percentageFill) {
valueBytes.updatePercentage(percentageFill);
ble.gattServer().write(PercentageFill.getValueAttribute().getHandle(), valueBytes.getPointer(), valueBytes.getNumValueBytes());
}
So what would be the best way to manage having multiple characteristics, all of which would be updated at the same time.
I think I have 3 options:
-
I could have loads of helper functions and call them one by one for each characteristic
-
I could have one “update all function” which I pass all values to
-
I could have a generic update characteristic function and pass the char ID and it’s new value to
Does anyone have an opinion about which approach is better suited to my needs, or if I have missed anything out?