12-17-2009 03:01 AM
Hello,
I have a problem that i think is not complex, but i just cant figure out how to solve this. I have created a State machine (string based). This handles de gui, menu's, popup's, analyzing the received data etc. Now i want to implement data acquisition from a queue and later from a osciloscope. For testing and debugging i have created a queue that sends an 1D array of numbers(double). I now run into the problem of when i am in the menu, or popup screen, the program "freezes" in that state until i click the menu or popup away. To solve this i have been trying to seperate the queue from the state machine. This in order to have to possibility to receive the data while still in a menu or popup, so that no data is lost. However the problem im having is how to solve this. I have tried a producer/consumer design pattern but this does not work properly. So in short this is wat i want: I want to be able to receive data and process this eventhough i am in a popup or menu. What im thinking is to make two state machines. One for the popups etc. and one for the data acquisition and processing. And this needs to run simultaneously. But i want to be sure this will work before i rebuild my entire software.
I cant post creens because of the size and security of the software. but i hope that is not a problem.
If anyone has the golden idea how to solve this i will be verry happy.
12-17-2009 04:26 AM
Hi,
My suggestion would be to start with a event based design pattern using parallel loops (it's not really producer consumer). The loop containing the event structure to handel the UI inputs could be a statemachine, where as the eventhandling is a single state, if necessary. Another state would be gatthering the data from a Queue which will be filled in the second loop.
So the second loop contains your data acquisition and is just filling up the Queue which will be read in a certain state of your statemachine in the other loop.
Hope this helps,
Christian