On 04/17/2017 10:12 PM, Denis Kenzior wrote:
Hi Jonas,
No, please don't do this, the notification callback and the query
callback should be different functions. If you need to perform some
common operations, then just extract those into a common function and
call it from both.
drivers/rilmodem/gprs-context.c, as one example, uses this pattern.
Personally, I find it rather elegant!
I don't see an example of such in there, but I didn't look hard
enough. Do you mean the use of ril_gprs_context_deactivate_primary
inside ril_gprs_context_deactivate_primary?
Line 706... but no worries, I'll expand to separate functions since
that's the preference.
/Jonas
Regardless, we really prefer unsolicited notification and command
execution result callbacks to be different. Generally because the
callback data is different and there's no nice way to hide the
differences besides a bunch of if statements. We prefer the code to
be easier to read, even if longer. Lots of if-else statements make
the code harder to read.
Regards,
-Denis
_______________________________________________
ofono mailing list
[email protected]
https://lists.ofono.org/mailman/listinfo/ofono