- I have a test_task that repeatedly calls tester_function that in a switch with cases calls several test_A, test_B etc.
- delay_milliseconds is called in test_task with milliseconds returned from tester_function
- so tester_function does not call delay_milliseconds directly
- however, test_A, test_B etc. run through their own sequences, and also call delay_milliseconds
However, I have a t_button. When I press the button down it's told over channel c_button and sent to test_task. The new semantics is to let a button press run one test sequence, like test_A, then test_B etc. But I want no delay from the button click to the action. I need cancelable_delay_milliseconds task or server. What is most suited?
A. If cancelable_delay_milliseconds is a task and channels I can pass those channels around (c_delay, c_timeout) all the way to test_A, test_B that would use those channels with cancelable_delay_milliseconds task. I leave t_button to be connected to cancelable_delay_milliseconds at the highest caller. It is rather elegant, but has to be on different logical cores. When the button is pressed the ongoing delay will be cancelled, and the following "inner" delays will become zero until the code is returned to the top.
B. If cancelable_delay_milliseconds is a server like this:
interface delay_interface {
[[clears_notification]] void delay_iff (const unsigned milliseconds_iff);
[[notification]] slave void timeout (void);
void delay_control (const int enable);
};
then I need to pass the interface to test_A, test_B etc. I find this much more difficult since the interface cannot be cut in two, one for the button (disable) and one for the others (delay, timeout). I assume I could make two interfaces to the cancelable_delay_milliseconds server and then send away what I need to? But then, to pick up the notification in a following select at all the places where I use the interface doesn't seem elegant. cancelable_delay_milliseconds seems complex at this level.
I have not coded any of the them completely, I would know A from my occam experience, so I thought B would be most interesting, I have done some of it, but it's only cancelable at the topmost level by now.
Which direction would you advice me to persue? Make everything with channels, everything with interfaces or a mix?