Experimental Physics and
| |||||||||||||||
|
Your example code and videos are great. The device has these attributes: 1. typical command/reply + unsolicited messages (unsolicited messages are much higher priority than the command/reply ones) I really want to get unsolicited messages processed ASAP. 2. all unsolicited commands require acknowledgement (the sooner the better, otherwise device will hang) 3. sometimes messages from device are space delimited, though usually they come one at a time I was thinking of taking the following approach, but was wondering if my logic and design choices are reasonable: Have a while(1) loop thread (setup just like the PollerThread in the XPS example except read only) always reading input. (similar to what you suggested back in 2010 http://www.aps.anl.gov/epics/tech-talk/2010/msg01203.php) If spaces are found in the input, break up the messages into an array and use a for loop to process them one by one with a separate function which is just a series of if/else statements to match input. In the separate function: If input matches an unsolicited message: send reply back to the machine acknowledging it and setParam according to the message. Otherwise just run relevant setparam function according to the received message. Have all other "writes" to device occur in the main thread and don't worry about reading because the reading thread will catch the response. Thanks for your help again. -Andrew
| ||||||||||||||
ANJ, 16 Dec 2015 |
·
Home
·
News
·
About
·
Base
·
Modules
·
Extensions
·
Distributions
·
Download
·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing · |