08-22-2017 09:03 AM
I'm still very new to LabVIEW, so please excuse any naive assumptions of mine.
I've decided to use a JKI state machine to handle my UI events and interpret these events with commands in different states, which then have to to be sent to a RTOS.
This leaves me with two questions.
1) Is ist advisable to use a network stream within the state machine?
The number of commands which would have to be sent is rather small, so I would assume the UI would stay responsive.
2) how do I create a reference to a network stream, so that I can add that to my data cluster?
08-22-2017 09:59 AM
To keep the UI responsive, don't use long running loops inside any of the states. If you need to use a loop, just call the same state over and over instead. Also you might want to add a call to the IDLE state before going back to your loop so that the event structure has a chance to execute and keep the UI responsive.
As far as adding a network stream to your data cluster, just create your network stream in the Data:Initialize state and close it in the Data:Cleanup state.
08-22-2017 10:45 AM
@aputman wrote:
To keep the UI responsive, don't use long running loops inside any of the states. If you need to use a loop, just call the same state over and over instead. Also you might want to add a call to the IDLE state before going back to your loop so that the event structure has a chance to execute and keep the UI responsive.
Yes, I do something very similar when running "loops". Part of my shift register data is a string called "timeout state" which runs if the event structure times out. When I start the loop, I set the timeout to a small value, say 100ms, and when I finish the loop, I set it back to -1, or just change the timeout state to an empty string. This works as long as you don't need your state to run every 100ms, because then a user interaction would screw it up.
08-24-2017 03:52 AM
I was just wondering if it is possible to create a reference of an uninitialized stream?
This way I could have a separate state like, "stream: Initialize" . But if that's not possible, then the initialization of the stream in the "Data: Initialize" must do.
And regarding the unresponsiveness I was mostly concerned with the stream locking up the interface in case of a disconnect. But in that case the User should probably not be able to send any commands.
08-24-2017 08:34 AM
From the Create Writer or Reader, you can create a constant from the endpoint output. You can wire this up to your data cluster and replace it with a valid reference at a later time. Is this what you mean?
08-27-2017 02:44 AM
Thanks, that was exactly what i was looking for.