01-14-2013 04:38 PM - edited 01-14-2013 04:39 PM
I have borrowed heavily against the OOP Command Pattern exercise but with a hidden tab control instead of the sub-panel and plug-ins. Commands from the UI (producer) to the user interface process (consumer) work fine. But I also need to have a timed data acquisition task that can receive parameters sent by the user via the UI. So it's a matter of determining how best to communicate the parameters to the aquisition task.
I was thinking of continuing the Command pattern and creating another consumer loop that includes the data acquisition. Reading the command object from the queue in this case would instead be timed (rather than infinite as with the user interface process loop). If no command is received within the time period, the dynamic dispatch Execute is skipped. If a command is received, it is executed and the state data updated. In either case the acquisition always goes through another cycle. See below for an example (not yet implemented in earnest).
Sound reasonable?
01-14-2013 04:51 PM
That seems like a reasonable approach provided your don't require precise timing.
01-14-2013 04:57 PM - edited 01-14-2013 04:57 PM
This particular application is acquiring data at a maximum rate of once per second so precise timing/jitter are not a concern.
Thanks.