communication strategy between widget and background programs [message #41013] |
Thu, 16 September 2004 14:29 |
Benjamin Hornberger
Messages: 258 Registered: March 2004
|
Senior Member |
|
|
Hi all,
I was hoping the bright minds out there might have some useful comments
on the following problem:
We are writing control software for an X-ray microscope. The instrument
itself is controlled by software written in C++, while a GUI (including
some image processing features) is witten in IDL. The two are
communicating via an IDL client and a C++ server, who talk to each other
through TCP/IP sockets.
One important characteristic of our client/server scheme is that they
communicate asynchronously, meaning that the client sends request
without expecting an immediate reply. The server will send the reply
independently at some point later. This is already implemented and
unlikely to be changed, even though it is the cause of some big headaches.
We have the following types of situations:
1. The GUI wants to send a command to the server without expecting any
direct response.
2. The server wants to send something to the GUI without a prior request
from there.
3. The GUI wants to send a request to the server and should really wait
for the response (and not accept any input in the meantime).
Case 1 is easy, the GUI just has to call a procedure in the client. Case
2 I can probably handle by sending an event (via widget_control, id,
send_event=...) from the client to the GUI. For that, on startup the GUI
has to send a widget ID to the client, which the client has to store
somewhere. Of course I have to be careful that the events sent from the
outside can't confuse the GUI.
I haven't found a satisfying strategy for case 3 yet. Definitely I need
some visual clue for the user that the GUI is waiting for something. See
my two previous posts about keeping a button depressed or using the
hourglass cursor. Also, I have to make sure no input is possible while
waiting for the response. For that I could make the GUI insensitive, and
the client would make it sensitive again when he sends the response. But
that way, I have no way to cancel if the server doesn't respond -- the
GUI would be frozen. I am considering having a window pop up saying
something like "waiting for server response..." which disappears when
the server actually resonds, and which offers a cancel button.
Any hints on how to do that? Any general suggestions? Any comments are
appreciated!
Benjamin
|
|
|