cknipe
-
Posts
54 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Gallery
Downloads
Posts posted by cknipe
-
-
Found some other debugging code that interfered with this.
For the loop, this seems to work
Do Until myEventQueue.IsEmpty Dim mySimEvent As New Offset(Of Integer)("SendControl", &H3110, True) Dim mySimEventParams As New Offset(Of Integer)("SendControl", &H3114, True) Dim myEvent As SimEvents myEventQueue.TryDequeue(myEvent) mySimEventParams.SetValue(myEvent.MouseID) mySimEvent.SetValue(myEvent.EventID) SimLogger.Trace("Sending Control {0} with parameter {1}", myEvent.EventID, myEvent.MouseID) FSUIPCConnection.Process("SendControl") mySimEvent.Disconnect() mySimEventParams.Disconnect() FSUIPCConnection.DeleteGroup("SendControl") Loop
Don't think I need the Disconnect() and DeleteGroup() call, but I can't use the Offsets declared globally (threaded application). I must declare them at each use (which is strange).
-
10 hours ago, Paul Henty said:
The order of these offsets matters. FSUIPC sends the control to the sim as soon as you write 3110. So that's before you've written the new parameter - the offsets are written in the order they are declared.
9 hours ago, Paul Henty said:Turn on the Event (control) logging in FSUIPC and output to the console. Check that FSUIPC is receiving what you think the code is sending. And you'll be able to see if anything else is writing that control.
After a night's sleep... Those two statements solved it in a few seconds.
FSUIPC log window showed that it got the events twice, and that made me think. You said offsets are sent as soon as they are written to 3110. So I removed the Process() call, and then things started working correctly as the event is only sent once to the simulator. However, now it doesn't matter what I sent, the simulator keeps getting the same Event
For example, I sent via FSUIPCClient:
2023-08-30 08:37:11.0297 TRACE FSInterfaces.FSServer.FSUIPCRunnerElapsed, Sending Control 79693 with parameter 536870912
2023-08-30 08:37:11.0297 TRACE FSInterfaces.FSServer.FSUIPCRunnerElapsed, Sending Control 69693 with parameter 536870912FSUIPC Log window reports
36825016 *** EVENT: Cntrl= 79873 (0x00013801), Param= 536870912 (0x20000000) <79873>
36825016 *** EVENT: Cntrl= 69873 (0x000110f1), Param= 536870912 (0x20000000) <69873>Not sure what is going on here, but the Client DDL isn't doing what it is supposed to be doing.
1) If I don't call Process() the same event is sent over and over, irrespective of what the value of the Event Offsets are (so they don't update)
2) If I do call Process(), everything is sent twice to the simulator (and no, I am not calling Process() elsewhere) - which explains the unexpected results with the switch Guards as the guard is triggered twice
-
36 minutes ago, Paul Henty said:
The order of these offsets matters. FSUIPC sends the control to the sim as soon as you write 3110. So that's before you've written the new parameter - the offsets are written in the order they are declared.
If you reverse the order of these two lines (declare 3114 first, then 3110) it should work as expected.
Paul
Very useful to know, but it doesn't solve the issues.
Loop currently reads (simplified for debugging purposes):
' Process any queued events Do Until myEventQueue.IsEmpty Dim mySimEvent As New Offset(Of Integer)("SendControl", &H3110, True) Dim mySimEventParams As New Offset(Of Integer)("SendControl", &H3114, True) Dim myEvent As SimEvents myEventQueue.TryDequeue(myEvent) mySimEventParams.SetValue(myEvent.MouseID) mySimEvent.SetValue(myEvent.EventID) SimLogger.Trace("Sending Control {0} with parameter {1}", myEvent.EventID, myEvent.MouseID) FSUIPCConnection.Process("SendControl") FSUIPCConnection.DeleteGroup("SendControl") Thread.Sleep(1000) Loop
2023-08-29 22:38:55.7787 TRACE FSInterfaces.FSServer.FSUIPCRunnerElapsed, Sending Control 70481 with parameter 536870912 2023-08-29 22:38:56.7829 TRACE FSInterfaces.FSServer.FSUIPCRunnerElapsed, Sending Control 70482 with parameter 536870912 2023-08-29 22:39:10.7899 TRACE FSInterfaces.FSServer.FSUIPCRunnerElapsed, Sending Control 79873 with parameter 536870912 2023-08-29 22:39:11.8007 TRACE FSInterfaces.FSServer.FSUIPCRunnerElapsed, Sending Control 69873 with parameter 536870912
First two controls send EVT_CDU_L_A, and EVT_CDU_L_B. As expected, 1 second apart from each other an "A" and "B" character shows up on CDU-L.
Second two controls send EVT_OH_ELEC_GND_TESTS_GUARD and EVT_OH_ELEC_GND_TESTS_SWITCH. It seems that the Guard opens the switch toggles, but then the guard closes again (and disables the switch). This is not how it performs on the aircraft, the guard should stay open.
Tried with a few other switches with guards:
Battery Guard / Battery Press. Works as expected.
2023-08-29 22:46:08.2810 TRACE FSInterfaces.FSServer.FSUIPCRunnerElapsed, Sending Control 79650 with parameter 536870912 2023-08-29 22:46:09.3245 TRACE FSInterfaces.FSServer.FSUIPCRunnerElapsed, Sending Control 69650 with parameter 536870912 2023-08-29 22:46:10.3910 TRACE FSInterfaces.PMDGB74x.PowerMonitor, Battery Disconnected. ELEC_Battery_SW: 0 2023-08-29 22:46:10.3910 TRACE FSInterfaces.PMDGB74x.PowerMonitor, BUS B Off. ELEC_StanbyPowerSw: 1, ELEC_Battery_Sw_ON: 0
EMER Lights Guard Switch. Works as expected.
2023-08-29 22:51:14.7136 TRACE FSInterfaces.FSServer.FSUIPCRunnerElapsed, Sending Control 79693 with parameter 536870912 2023-08-29 22:51:15.7592 TRACE FSInterfaces.FSServer.FSUIPCRunnerElapsed, Sending Control 69693 with parameter 536870912
Guess I will have to test and verify each and every single one, but from what I can see yes - the code works fine after swapping the two requests around. There still are some switches with guards though, that doesn't want to play ball. -
Hi,
Tying to send two consecutive events to the PMDB74x. The events process, but the desired result in Sim is far from what I expect.
Code - processes the events from a FIFO queue (EventID & MouseID is Integers)
Private Shared ReadOnly mySimEvent As New Offset(Of Integer)("SendControl", &H3110, True) Private Shared ReadOnly mySimParams As New Offset(Of Integer)("SendControl", &H3114, True) Private Shared ReadOnly myEventQueue As New Concurrent.ConcurrentQueue(Of SimEvents) Private Structure SimEvents Public EventID As Integer Public MouseID As Integer End Structure <snip> Do Until myEventQueue.IsEmpty ' no other Process() call is made elsewhere when this loop is called Dim myEvent As SimEvents myEventQueue.TryDequeue(myEvent) mySimEvent.SetValue(myEvent.EventID) mySimParams.SetValue(myEvent.MouseID) SimLogger.Trace("Sending Control {0} with parameter {1}", myEvent.EventID, myEvent.MouseID) FSUIPCConnection.Process("SendControl") Thread.Sleep(1000) ' <- Time delay seems to be of no consequence Loop
Debug Log:2023-08-29 21:41:12.3958 TRACE FSInterfaces.FSServer.FSUIPCRunnerElapsed, Sending Control 79873 with parameter 536870912 2023-08-29 21:41:13.4351 TRACE FSInterfaces.FSServer.FSUIPCRunnerElapsed, Sending Control 69873 with parameter 536870912
Control 79873 (0x79873) is defined as EVT_OH_ELEC_GND_TESTS_GUARD in the PMDG_747QOTSII_SDK.h file (Mouse parameter is MOUSE_FLAG_LEFTSINGLE 0x20000000)
Control 69873 (0x110F1) is defined as EVT_OH_ELEC_GND_TESTS_SWITCH in the PMDG_747QOTSII_SDK.h file (Mouse parameter is MOUSE_FLAG_LEFTSINGLE 0x20000000)
I expect, the Guard to open on the switch, and the switch to be toggled. However, the Guard seems to open and then close again.
I can call both of these controls independently (outside of the loop) successfully.
Is there something that needs to happen here to 'reset' the Send Controls?
-
Thanks John & Paul.
Very insightful and useful feedback as always!
-
Hi,
Just two quick ones please....
1) Is there a reason why WebSocketServer is not included in FSUIPC6? Is it supported (P3D, etc?)
2) When using WebSocketServer (latest FSUIPC7), if I bind the application to an IP address other than 127.0.0.1 (localhost) - it requires Windows Admin rights to run? Surely this doesn't seem correct? PS - would be nice to bind to multiple IPs, or listen on any/all IPs.
-
PMDG has confirmed that this is an issue on their side. There is an issue in the SDK and they are isolating / fixing the problem.
I would expect a hotfix to be released for the queen that will fix this, and (quite a few) other issues too.
- 1
-
PMDG's looking at this - seems it is on their side.
Thnx,
-
Hi Pete,
I had a look at the .h files of the SDK, and there's no difference between the old version, and the new version released yesterday.
Using the exact same code however, the offsets seems to be completely off. I am not getting the desired results at all. I am specifically looking related to the FMC Annunciations, none of them work, and one seems to be tied to the parking brake?!?
EXEC below, should be all 0. I am getting exactly the opposite of what is expected.
It is more than likely a PMDG issue, but I thought I would just mention this. Perhaps you can 'easily' see whether things changed, or perhaps other members of the community can just post their experiences since the upgrade as well. From what I am seeing, it looks like the SDK has been horribly broken.
Thnx
Chris.
-
Nevermind - found the issue.
Simultaneous / duplicate process calls. it's sorted 🙂
-
Hi Paul,
Just a quick question - seeing some arb exceptions (group '0~~~GetSnapshot~~~' does not exist).
Quick question - does getpositionsnapshot do a process() call through FSUIPC on it's own, or does the update only occur once I call FSUIPCConnection.Process()? I think there's too many process() calls being executed, so just trying to determine what I can / need to slow down.
Thanks.
-
Oh, and the exception occurs when:
- Initialize Timer to fire every 10ms;
- While True; Loop (just to ensure the timer fires)
Every 10ms, we now call Open() and/or Process() via the timer
Start, close, restart, the sim while the code is running.
I *suspect*, either Open is executing, or Process is executing without the necessary variables in FSUIPCClient being initialized.
-
Can't reproduce it now for some reason 🤯 Typical Murphy.
I've added the necessary code for a full stack and will revert if it happens again. I think it may have been my PC though, but the exception should still be caught nonetheless.
I do believe it is your exception, as the source is your DLL and ~SystemOffsets~ aren't my variable.
I will revert back if / once it happens again and I have a full stack dump for you.
FYI, this is the code, fired by an Timer with a 10ms trigger
Private sub FSUIPCProcess(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs) ' If we are not connected to the simulator, try to re-connect Try If SimConnected = False FSUIPCConnection.Open() If FSUIPCConnection.IsOpen SimConnected = True Else SimConnected = False Exit Sub End If Else FSUIPCConnection.Process Debug.Write("a") End If Catch ex As FSUIPCException If ex.FSUIPCErrorCode = FSUIPCError.FSUIPC_ERR_NOFS ' Can not connect to FSUIPC or WideFS, not running? SimConnected = False ElseIf ex.FSUIPCErrorCode = FSUIPCError.FSUIPC_ERR_OPEN ' We are apparently already connected SimConnected = True ElseIf ex.FSUIPCErrorCode = FSUIPCError.FSUIPC_ERR_NOTOPEN Or ex.FSUIPCErrorCode = FSUIPCError.FSUIPC_ERR_SENDMSG SimConnected = False Else Debug.WriteLine("EXCEPTION: " & ex.Message.ToString) Debug.WriteLine(" STACK: " & ex.StackTrace.ToString) End If Catch ex As Exception ' This is where the exception is caught Dim st As New StackTrace(ex, True) Debug.WriteLine("EXCEPTION: " & ex.Message.ToString) Debug.WriteLine(" STACK: " & st.ToString) End Try End sub
-
-
Hi Pete,
We already know it's possible to inject AI aircraft to the TCAS, and display these aircraft on the TCAS by using FSUIPC.
We already know that FSUIPC uses SimConnect to communicate with FSX and Prepar3D.
We already know that FSUIPC is the preferred method of coding for many, many people as the requirements of SimConnect for unmanaged code make things a little difficult (sorry, I had to).
What's the chances of possibly looking at the possibility to use FSUIPC as a gateway interface to SimObjects in the future, and that those Objects can be placed and controlled through FSUIPC in the future? @Paul Henty I want to put the same question to you in terms of your .NET client please?
There are, very, very few (if any) publicly available class libraries for sim development especially in terms of multiplayer, and especially in terms of SimObjects. On the .NET side, I think it pretty much is FSUIPC and the associated .NET client and that is it TBH. Sorry if I am missing anyone else's work here.
Pete suggestion number two please. Going to take a while to get adopted, but can we please get a section in FSUIPC offsets, reserved for flight planning and storing of the flight plans? Instead of enjoying a flight from point A to point B, we ALL find ourselves, entering the same flight plan into this app, that app, this app, then that app... At the end of the day, it took you 30 minutes to just setup all the various applications that needs a copy of your flight plan.
Logic here is you enter the flight plan into one application, that application stores it in FSUIPC in a set data standard, and all other applications can then read the flight plan from there. Which ever application receives the flight plan first (by the user entering it) can populate it in FSUIPC, and the rest of the apps can just monitor the offset(s) for data to obtain it. Fairly simple process, plenty of space available in terms of offsets / memory, and if it takes by the community, definitely something that will save all of us a lot of effort moving forward.
Thnx,
Chris.
-
Added the below:
Console.WriteLine(FSUIPCConnection.Statistics().ConnectionOpenFor.ToString) Console.WriteLine(FSUIPCConnection.Statistics().ProcessCount.ToString) Console.WriteLine(FSUIPCConnection.Statistics().ProcessLast.FsuipcMemoryFilePercentFull.ToString)
I can clearly see the FsuipcMemoryFilePercentFull increasing gradually until it eventually reaches 100%.
Commenting out all references to taking the PositionSnapShot, and not calling the GetPositionSnapshot, I can see that the FsuipcMemoryFilePercentFull does not increase any more.
Is there a leak in GetPositionSnapshot perhaps?
-
Dim FSUIPCAirspeed As Offset(Of UInteger) = New Offset(Of UInteger)(&H2B4) Dim FSUIPCPositionSnapShot As FsPositionSnapshot Dim AirspeedKnots As Double While True And FSUIPCConnection.IsOpen = True FSUIPCPositionSnapShot = FSUIPCConnection.GetPositionSnapshot FSUIPCConnection.Process() AirspeedKnots = FSUIPCAirspeed.Value / 65536 * 3600 / 1852 Console.Clear() If FSUIPCConnection.IsConnectedToWideClient = True Then Console.WriteLine(String.Format("Connected to {0} via WideFS (Client {1}, FSUIPC {2})", FSUIPCConnection.FlightSimVersionConnected.ToString, FSUIPCConnection.DLLVersion.ToString, FSUIPCConnection.FSUIPCVersion.ToString)) Else Console.WriteLine(String.Format("Connected to {0} (Client {1}, FSUIPC {2})", FSUIPCConnection.FlightSimVersionConnected.ToString, FSUIPCConnection.DLLVersion.ToString, FSUIPCConnection.FSUIPCVersion.ToString)) End If Console.WriteLine(String.Format(" Position: {0},{1}", FSUIPCPositionSnapShot.Location.Latitude.DecimalDegrees.ToString("0.000000"), FSUIPCPositionSnapShot.Location.Longitude.DecimalDegrees.ToString("0.000000"))) Console.WriteLine(String.Format(" Altitude: {0} ft", FSUIPCPositionSnapShot.Altitude.Feet.ToString("0"))) Console.WriteLine(String.Format("Ground Speed: {0} kts", AirspeedKnots.ToString("0"))) Console.WriteLine(String.Format("True Heading: {0}" & Chr(176), FSUIPCPositionSnapShot.HeadingDegreesTrue.ToString("0"))) Threading.Thread.Sleep(125) End While FSUIPCAirspeed.Disconnect() FSUIPCPositionSnapShot = Nothing
After a while, I am getting a ERROR #15 calling FSUIPCConnection.Process(). I'm at a bit of a loss where the memory is going here...
FSUIPC = 5.131
FSUIPC Client DLL = 3.1.3.302
-
Hi,
I've had a look through the FSUIPC SDK, and from what I can gather, we can obtain the following for AI traffic...
Lat,Lon, Alt, hdg, gs, vs, com1, pitch, dep, des (and a few other bits and bobs - some FS2000 only, some FS2004 only)... Rather limited, and also mostly read-only...
What we do know, is that AI in FS2004 (and I'm sure FSX too), is rather limited. What are the options in terms of multiplayer sessions (DirectPlay / SimConnect)? How detailed can the information about multiplayer aircraft be?
If I were to expand on the above list in terms of what is available for AI traffic, would multiplayer give detailed access to lights, individual gear/flaps/slats/engine settings, etc? I am basically trying to determine, just HOW detailed (and animated) a multiplayer plane can be :smile:
Sorry, I know this is OT, but I also know that there are people on here with much more knowledge than I.
Thnx,
Chris.
-
Oh - Paul replied :)
Ya - just debugging / testing code Paul, will check it out. Thnx.
Had no idea that the order of the declares was important though - is this documented somewhere? I don't recall reading anything to that effect?
Anyways, made the changes and it still seems to be working. Will look into this some more in the morning after some sleep... Thnx Paul!
-
Don't know what was wrong, but it's working now... Must have been some other reason why the messages didn't make it to the sim.
-
lat.DecimalDegrees.ToString("F7") should do it :smile:
-
Hi All,
I can successfully display a message ONCE, but I'm failing to write multiple messages to the sim (not multiple lines - multiple messages)..
Let's say I have the following... (presume FSUIPC is connected)
' Inside my timer loop If SIMRate <> 256 Then Console.WriteLine("WARNING: SIM RATE IS AT " & SIMRate.ToString) SimulationRate.Value = 256 Dim fsuipc_TextDelay As Offset(Of Short) = New FSUIPC.Offset(Of Short)("SendMessage", &H32FA, True) Dim SimulationMessage As Offset(Of String) = New Offset(Of String)("SendMessage", &H3380, 128, True) ' Simulation Message SimulationMessage.Value = "SimRate is locked to 1X speeds" fsuipc_TextDelay.Value = 5 FSUIPCConnection.Process("SendMessage") End If
The first time I change the sim rate, it is correctly set back to 1X as it is supposed to, and the message is displayed in the sim. Any other time when I change the sim rate, the sim rate change is still detected and set back to 1X - but the message is not displayed again...
I would -expect- the message to be displayed each and every time that the if condition matches.
Am I missing something?
-
-
Hmm,
Thanks Pete. Did a repair installation and it seems to be fine again -shrugs-.
Did search the forums, didn't get anything on the event log errors, so I thought I'd just mention that. Thanks for explaining as always!
--
Chris.
Updates to FSUIPC?
in FSUIPC7 MSFS
Posted
Hi Pete & John,
Just a quick question. Is there any significant updates planned towards FSUIPC in terms of SimConnect / MSFS?
For me personally, the only one drawback that I have over using SimConnect vs. FSUIPC is injecting and controlling AI models. I am sure that there are a few other things that we can do with SimConnect where FSUIPC simply just does not have the functionality. By no means is this aimed as criticism, I prefer to use FSUIPC over SimConnect due to the ease of use and easy integration.
I guess I am just wondering, any possibility of seeing more advanced features in the future in FSUIPC? It's almost like FSUIPC is very good at a read only client from the Sim's perspective, but it's not doing a lot in terms of injecting data (AI Models or otherwise) into the Simulator.
Many thanks,
Chris.