JohnHind
March 17th, 2003, 04:59 AM
Scenario: I have a serial device (actually a HomeVision home automation controller) which I want to control using Girder most of the time, but it also has its own windows application which I need to use occasionally to program it. Secondly, I use Windows XP and want this to work from multiple user accounts with “fast user switching”. Only one program can have the serial port open at a time.
Part 1 (one account, all Windows Versions): The solution requires Mark Fiechtner’s Generic Serial Support plugin and Ron’s AlarmTimer. Having got the device set up and running with Girder via Mark’s plugin, I did the following: Firstly I replaced the shortcut that normally runs the devices PC client with one that runs Girder’s “event.exe” program specifying my own event string and –silent. You can even change the icon to the one in the original client program so it is indistinguishable from the original! In Girder I added a MultiGroup which responds to my new event string by first doing a “disable device” in the Generic Serial Support, then uses OS Execute to start the client program, then starts an AlarmTimer with 10 seconds timeout and repeat. On End, this timer runs a Window Exists command targeted on the client programs main window. If the window does not exist, it runs another multigroup which first stops the timer and then does Enable Device in Generic Serial Support.
With this setup, Girder has the con by default, but when I start the client program, Girder backs off until it sees that the client has been exited whence it takes the con again. From the users point of view it looks exactly as before.
Part 2 (multiple accounts in Windows XP): this solution additionally requires Ron’s SessionSwitch plugin (or my forthcoming re-write of this). I added a command which responds to CONSOLE_DISCONNECT by doing a Disable Device. A MultiGroup responds to CONSOLE_CONNECT by waiting 5 seconds (Wait on the Window tab) and then Enable Device. I found that the wait was necessary for reliable operation, presumably because sometimes the CONSOLE_CONNECT is processed before the CONSOLE_DISCONNECT otherwise. Using Ron’s plugin, I had to edit the GML file to get these session switch events, prompting my own re-write which adds a UI. Also, the shipping version of “event.exe” did not work with multiple sessions. Ron kindly did a quick fix for me which I assume will be shipped with the next version (but you could ask him nicely!).
Writing this down, it occurs that the above will fail if I do a session switch while the client program is running – best fix will probably be to close this on CONSOLE_DISCONNECT.
Part 1 (one account, all Windows Versions): The solution requires Mark Fiechtner’s Generic Serial Support plugin and Ron’s AlarmTimer. Having got the device set up and running with Girder via Mark’s plugin, I did the following: Firstly I replaced the shortcut that normally runs the devices PC client with one that runs Girder’s “event.exe” program specifying my own event string and –silent. You can even change the icon to the one in the original client program so it is indistinguishable from the original! In Girder I added a MultiGroup which responds to my new event string by first doing a “disable device” in the Generic Serial Support, then uses OS Execute to start the client program, then starts an AlarmTimer with 10 seconds timeout and repeat. On End, this timer runs a Window Exists command targeted on the client programs main window. If the window does not exist, it runs another multigroup which first stops the timer and then does Enable Device in Generic Serial Support.
With this setup, Girder has the con by default, but when I start the client program, Girder backs off until it sees that the client has been exited whence it takes the con again. From the users point of view it looks exactly as before.
Part 2 (multiple accounts in Windows XP): this solution additionally requires Ron’s SessionSwitch plugin (or my forthcoming re-write of this). I added a command which responds to CONSOLE_DISCONNECT by doing a Disable Device. A MultiGroup responds to CONSOLE_CONNECT by waiting 5 seconds (Wait on the Window tab) and then Enable Device. I found that the wait was necessary for reliable operation, presumably because sometimes the CONSOLE_CONNECT is processed before the CONSOLE_DISCONNECT otherwise. Using Ron’s plugin, I had to edit the GML file to get these session switch events, prompting my own re-write which adds a UI. Also, the shipping version of “event.exe” did not work with multiple sessions. Ron kindly did a quick fix for me which I assume will be shipped with the next version (but you could ask him nicely!).
Writing this down, it occurs that the above will fail if I do a session switch while the client program is running – best fix will probably be to close this on CONSOLE_DISCONNECT.