Buffort
-
Posts
7 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Gallery
Downloads
Posts posted by Buffort
-
-
Ok, it works, I can control GSX with Python and a scrip.
import pyuipc import time pyuipc.open(pyuipc.SIM_P3D64) pyuipc.write([(0x3114, 'u', 2939), (0x3110, 'u', 1070)]) time.sleep(2) pyuipc.write([(0x3114, 'u', 2098), (0x3110, 'u', 1070)]) time.sleep(2) pyuipc.write([(0x3114, 'u', 2097), (0x3110, 'u', 1070)]) pyuipc.close()
With this script, and the aircraft positioned at the threshold of 04R (LFMN), I open GSX window, select the option 2 (Runway 04R) and select option 1 (ask for Follow me car). I included pauses in the script (time.sleep()) to let FSUIPC and P3D handle the different commands before sending the next one.
I have now materials to discuss with Humberto about ProsimUtils. In the mean time I can code a small program to handle keystrokes sent to FSUIPC from the CDU, I just have to understand how to add a small HTTP server in my script ...
-
Dear Pete,
I just tested my script following your suggestion. And ... indeed, writing first the offset 3114 and then the offset 3110 is definitely better ! By using Q, I could switch the sound on and off as I wished, several times. I included the log in my post for reference.
To answer your question about ProsimUtils, I am sure it uses WideClient/FSUIPC. It works if I don't run Prosim, and it simply doesn't work if WideClient is not running.
Olivier
-
Thanks, Pete, for your analysis. I will contact Humberto and direct him to our discussion. In the mean time, I will try to control GSX from my small script.
Olivier
-
Pete, if I may, I would like to add my small contribution to the discussion.
I tested ProsimUtils in two cases :
- I try to open the GSX menu and select the option 2 in the menu (several times),
- I try to open the GSX menu, let it close itself after a certain amount of time (10-15s), and try to open it again (several times).
In both cases, I didn't touch the keyboard (only to exit P3D), I only triggered ProsimUtils using Firefox to send an HTTP POST request (it's the way it works with the CDU), all request has been well received by ProsimUtils and are written in log files.
You will find attached two FSUIPC6 log files :
- FSUIPC6_GSX_menu_and_selection.log : the log for the first case
- FSUIPC6_GSX_menu_only.log : the log for the second case
From my opinion, it seems that the first command is well received and processed by FSUIPC6 (the GSX menu is opened), but the second command (to select an option or to open again the GSX menu) is not received ... And, at this time, I don't know if it has been sent by ProsimUtils.
For information, you can reproduce CDU commands for GSX by opening P3D, ProsimUtils and a web browser. In the web browser, just enter the following address : http://xxx.xxx.xxx.xxx:8085/fs?command=keystroke&key=F12&shift=2 , with xxx.xxx.xxx.xxx : the ip address of the computer running ProsimUtils.
Olivier
FSUIPC6_GSX_menu_and_selection.log FSUIPC6_GSX_menu_only.log
-
Thanks for your answers, Pete and John !
47 minutes ago, Pete Dowson said:What does it use to send the keystroke?
Unfortunately, I don't know ... All I can say is that ProsimUtils makes use of WideClient and then FSUIPC to interact with GSX menu. Apart from that, I don't know the library and the computer language used by Humberto.
50 minutes ago, Pete Dowson said:I don't know Python. What's the 'u'? Is that supposed to represent the keystroke for s?
John is right ^^ !
52 minutes ago, Pete Dowson said:Is it writing to 3110 first, then 3114? If so then the first write to 3110 will send whatever rubbish is in 3114.
You should write to 3114 first, or write all 8 bytes together.
And you need to enable button & key logging not just IPC writes so we can see the timing of the key press and key release operations.
In my opinion, as I put the tuple with 3110 first in the list, it should be the first one to be written, then the 3114. With your explanation, I must say that now I understand a bit more how it works ^^. I will try by writing to 3114 first (with the button & key logging option). I am not sure I can write both at the same time ... the Python module (pyuipc) is pretty limited in that way.
Olivier
-
Hi all,
Well, after a full day making white hairs, I think I need your help with FSUIPC and keystrokes sent from a program.
At this time I am trying to understand why ProsimUtils has issues to control GSX : commands are sent from the CDU to ProsimUtils, and then to P3D through FSUIPC/WideClient. Sometimes, the command CTRL+SHIFT+F12 opens the usual FSX window, but it's rare, and the command following the first one (1 or 2 to select an option) does nothing ... After that, if I want to open GSX window again, it simply doesn't work. All commands are registered in FSUIPC log, so they are well received but no event. It's pretty much the same issue than the one reported by Ramon here : https://forum.simflight.com/topic/91365-prosimutils-181-simconnect-window/I coded a small python script to send keystrokes to Prepar3D through FSUIPC and WideClient. And I noticed something really strange. I would be glad if someone can comment or point me to the right direction.
The keystroke used is simple : it's S to change the view. If I execute the script, the keystroke is registered by FSUIPC and I can see it in the log, but nothing happens. If I execute the script two times, and with around 0.5-1s between each execution, the keystroke is registered two times by FSUIPC, but this time (and unfortunately not each time), the view is changed (and only 1 time, which is fine in fact).I can't see what's wrong with my script. Here it is :
import pyuipc pyuipc.open(pyuipc.SIM_P3D64) pyuipc.write([(0x3110, 'u', 1070), (0x3114, 'u', 2131)]) pyuipc.close()
Pretty simple, isn't it ^^ ?
And the logging messages :
351906 WRITEex 330A, 2 bytes: D2 07 .. 352062 WRITEex 3110, 4 bytes: 2E 04 00 00 .... # first run 352062 WRITEex 3114, 4 bytes: 53 08 00 00 S... 352531 WRITEex 3110, 4 bytes: 2E 04 00 00 .... # second run after 0.5s-1s 352531 WRITEex 3114, 4 bytes: 53 08 00 00 S... 353718 *** EVENT: Cntrl= 65567 (0x0001001f), Param= 0 (0x00000000) VIEW_MODE
I use Prepar3D v5.1 HF1, with different sceneries and add-ons (UTLive2 beta, ASP3D, Prosim737, FSUIPC6.11). Python 3.7 is used with pyuipc installed from FSUIPC/SDK folder. I am experienced with Python, but not with FSUIPC SDK, so I probably do something wrong and can't see what it is ...
Thanks for your help !!
Olivier
FSUIPC and keystroke from a remote program
in FSUIPC Support Pete Dowson Modules
Posted
Oh ! I just discovered those checklists for the first time ! I didn't imagine that it could be integrated by Humberto.
I noticed an xml file in ProsimUtils/checklists folder ... I don't know if we can use it to tweak a bit those checklists, like reducing the number of items to be displayed ...
Olivier