Closed GermanSheepDog closed 5 years ago
This improvement will be welcome for me.
Ok, I have implemented a new getter/setter API. Characteristics now have three new fields:
getter_ex
/setter_ex
are function pointers that take characteristic pointer as first argument. You can use characteristic to distinguish between characteristics.
Alternatively, you can use context
field (void*) to store pointer to any other data and you can use that data inside getter_ex
/setter_ex
callbacks.
Hello,
I like to control some LED or some other actors of same service-type. For example I used the HOMEKIT_SERVICE_LIGHTBULB:
For the second bulb, I use led_on_get2 and led_on_set2 and so on. It would be a great deal, if I can give with a parameter called 'getter_arg':
I think that was the need to expand "types.h":
The new 'getter_arg' will be used for getter and setter call! So I can use the same functions for many bulbs or other actors.
With some more stuff you can implement such functions in app_main: