
Paul Henty
Members-
Posts
1,728 -
Joined
-
Days Won
78
Content Type
Profiles
Forums
Events
Gallery
Downloads
Everything posted by Paul Henty
-
Vb.NET Closest NAVAIDS SQlite
Paul Henty replied to Frédéric-O DUCHEMIN's topic in FSUIPC Client DLL for .NET
There should only be one place where you call Open(). It should be when your application starts. If you have added these two lines somewhere else then you should remove them. Find the original place where you call Open() and add the Load() after it. Paul -
Vb.NET Closest NAVAIDS SQlite
Paul Henty replied to Frédéric-O DUCHEMIN's topic in FSUIPC Client DLL for .NET
I can't see how the disconnection would be related to reading the surface for the runway. You'll need to trace the code and set break points to see how and why the disconnection is happening. Paul -
Yes, I'm quite sure it's possible. I don't have VB6 any more, so I can only tell you the method, I can't give you any working code. 1. You'll need to use two offsets: &H3114 - This should be 4 bytes and an integer (Long in VB6) - This is the 'Parameter Value' &H3110 - This should also be 4 bytes and an Integer - This is the 'Control (or Event) Number' You MUST write 3114 first, then 3110. You can write both in the same process() call, just make sure 3114 goes first. To send an event to PMDG, you need the list of events from the .h file in the SDK. (PMDG_NGX_SDK.h I think) 2. If I remember correctly, the parameter is set to one of the codes for the mouse buttons. Here is an example line from the .h file #define MOUSE_FLAG_LEFTSINGLE 0x20000000 So, to send a single left mouse click you set the value of 3114 to &H20000000 3. The control (or Event) number is also in the .h file: To get the full number you need to add the event number to the value of THIRD_PARTY_EVENT_ID_MIN (69632) Here is another example line from that file... #define EVT_MCP_CMD_A_SWITCH (THIRD_PARTY_EVENT_ID_MIN + 402) To send the event for the MCP autopilot CMD A switch you need 69632 + 402 = 70034 In summary: To send a single left mouse click to the CMD A autopilot button on the MCP: Write &H20000000 to offset &H3114 Write 70034 to offset &H3110 Process(). Paul
-
Vb.NET Closest NAVAIDS SQlite
Paul Henty replied to Frédéric-O DUCHEMIN's topic in FSUIPC Client DLL for .NET
The code looks okay. Please check the following: a. The airport code must be all upper case. So maybe use this: Dim surfaceType As FsSurface = db.Airports(lblArrival.Text.ToUpper()).Runways(Getrunaway(lblDeparture.Text)).Surface b. The runway code must be two digits e.g. "09". "9" will not work. Plus an optional suffix of L, C or R (capitals). e.g. 09L. No spaces. These will NOT work: 9 (only one digit) 9L (only one digit) 09 L (space between 9 and L) 09l (Lower case L) These WILL work 09 36 27L 09R If you can't get it working I'll need to know more information: 1. What is the problem? Is there an error? Does it return the wrong surface, or nothing? 2. Which airport and runway are you trying? 3. What's being returned from the GetRunway() function? 4. Maybe show me the GetRunway() function. I can't really help any more with that. I can write code for something that complicated that you can just paste directly into your application. The code I wrote there is just an example or how it could be done. It shows you a strategy for achieving what you want. I've no idea how to integrate it into your application because I don't know your application. I can give general advice but you need to write your own code. Paul -
C# Get correct pitch and bank values
Paul Henty replied to sirbenson's topic in FSUIPC Client DLL for .NET
These offsets are 4-byte integers so should be declared as 'int' Offset<int> playerPitch = new Offset<int>(0x0578); Offset<int> playerBank = new Offset<int>(0x057C); Here's the conversion that I use in the DLL to calculate the pitch/roll in degrees. This works fine. snapshot.PitchDegrees = ((double)playerPitch.Value * 360d) / (65536d * 65536d); snapshot.BankDegrees = ((double)playerBank.Value * 360d) / (65536d * 65536d); Paul -
You should really ask Dovetail (or ask on their support forums if they have any). I don't know anything about FSW. But, looking at the files you've listed, none of them look like managed libraries. Certainly .lib and .h files are for C or C++. I can't see anything there that would be any use to .NET programmers. Paul
- 4 replies
-
- fsw
- fsuipcclient rc7
-
(and 2 more)
Tagged with:
-
Hi Gilles, My DLL doesn't use simconnect at all. It's only an interface to FSUIPC. If FSUIPC5 ever becomes compatible with FSW then my DLL will work with that new version of FSUIPC5 without any changes. If FSUIPC5 is never compatible then my DLL will never be compatible either. I have no plans to add direct SimConnect features to the DLL. The Flight Sim developers already provide managed .NET libraries for SimConnect. Paul
- 4 replies
-
- fsw
- fsuipcclient rc7
-
(and 2 more)
Tagged with:
-
How can I used a C# code to read PMDG_737_NGX_Control?
Paul Henty replied to Primo's topic in FSUIPC Client DLL for .NET
Reading the documentation again, I see there is sometimes a problem after reloading the 737. It's fixed by forcing FSUIPC to reconnect to SimConnect. You can do this from your code by calling: FSUIPCConnection.SendControlToFS(FSUIPCControl.ReSimConnect, 0); Try calling this after loading the 737. Other than that I have no more ideas. I've tested your code with normal offsets and it's fine. It seems the problem is with the link to PMDG, but I can't help you with that. Pete might have some suggestions if you ask up in the main forum. Or maybe he'll see this. Paul -
How can I used a C# code to read PMDG_737_NGX_Control?
Paul Henty replied to Primo's topic in FSUIPC Client DLL for .NET
The codes look okay to me. I can't test it though because I don't have any PMDG aircraft. Have you followed these instructions in the docs to enable the interface? Paul -
How can I used a C# code to read PMDG_737_NGX_Control?
Paul Henty replied to Primo's topic in FSUIPC Client DLL for .NET
You cannot read controls. They are write-only. To read data from the PMDG 737 you need to use the offsets provided. See the document called "Offset Mapping for PMDG 737NGX.pdf" in "Modules\FSUIPC Documents". This has a list of PMDG offsets with instructions for enabling the interface. These offsets are used just like any other. Paul -
Vb.NET Closest NAVAIDS SQlite
Paul Henty replied to Frédéric-O DUCHEMIN's topic in FSUIPC Client DLL for .NET
Hi Fred, I can't think of any other ways than those I've already suggested: 1. Get back the Lon/Lat of the navaids in the flight plan from your server. 2. Get the Lon/Lat of the navaids from a database. 3. Get the Lon/Lat of the vor/adf beacon tuned on the radios. 4. Get the distance to the next navaid from the GPS offsets (but this requires a flight plan loaded). Paul -
It's meant to be 0x8336, but the documentation says that SimConnect doesn't provide that information so it's not available. I've checked and it's not working with FSX:SE. You can however set a new zoom value using a 'control' if that's any use: FSUIPCConnection.SendControlToFS(FsControl.MAP_ZOOM_SET, 64); This will set the map zoom to 64. The values match the zoom readout on the screen when zooming the top-down view. Note that the other zoom controls have different units. For example, in the normal view you send 64 for 1x; 128 for 2x; 32 for 0.5x etc. Paul
-
Vb.NET Closest NAVAIDS SQlite
Paul Henty replied to Frédéric-O DUCHEMIN's topic in FSUIPC Client DLL for .NET
You can get the surface type (asphalt, grass etc) from the airports database: example is for Runway 09 at EGJJ. Dim db As AirportsDatabase = FSUIPCConnection.AirportsDatabase Dim surfaceType As FsSurface = db.Airports("EGJJ").Runways("09").Surface Me.txtSurface.Text = surfaceType.ToString() Dim db As AirportsDatabase = FSUIPCConnection.AirportsDatabase Dim surfaceType As FsSurface = db.Airports("EGJJ").Runways("09").Surface Me.txtSurface.Text = surfaceType.ToString() The surface wet/dry/icy/snow is available from offset 0x346, BUT it only updates when on the runway. Not in the air. Paul -
Vb.NET Closest NAVAIDS SQlite
Paul Henty replied to Frédéric-O DUCHEMIN's topic in FSUIPC Client DLL for .NET
If you make your users load a flight plan (pln) in FS it will be much easier. There is lots of data available from the 'GPS' offsets starting at 0x6000. See the offsets list. e.g. there is distance to next way point (0x60EC). In this case there is no need to track the offsets yourself, it's all done by the Flight Sim. So just access the required offsets directly and display the result. What do you mean by the 'status' of a runway? Paul -
Vb.NET Closest NAVAIDS SQlite
Paul Henty replied to Frédéric-O DUCHEMIN's topic in FSUIPC Client DLL for .NET
The flight plan does not need to be loaded into the simulator. Does your program have access to the lat/lat for the Navaids? Or are they are only on the server? If so, you'll need to rely on the radios being tuned and get the lat/lon from offsets 1124/1128 etc. See post #4 earlier in this thread. Otherwise just take them directly from the flight plan. Any time between the user entering the flight plan and starting the flight. If you send the flight plan to a server then that would be a good time to count the number of waypoints and set this variable. Paul -
System.AccessViolationException on Fsuipc.FSUIPC_Process()
Paul Henty replied to Primo's topic in FSUIPC Client DLL for .NET
Thanks for the project. I found the problem. The FSUIPCConnection.Close() method was not synchronised with the Process() method. So, while Process() was running on one thread, another thread sometimes ran Close() at the same time and unallocated the memory Process() was using. I've ran your example, connecting and disconnecting many times, and I couldn't get the error any more. Attached is version 3.0.18009.241 Let me know how it goes... Paul FSUIPCClient3.0_RC7.zip -
System.AccessViolationException on Fsuipc.FSUIPC_Process()
Paul Henty replied to Primo's topic in FSUIPC Client DLL for .NET
I think that's what I did: 1. I pressed Connect 2. I pressed Start UDP Then in the cockpit of the plane in FSX I switched the autoplot on. Your program turned it off. I clicked the Autopilot button quickly and it still worked with no problems. I can't make it error. Is there anything else I should do? Can you check the DLL being used with: FSUIPC.FSUIPCConnection.DLLVersion.ToString(); in the code. Make sure it returns 3.0.18004.210 Paul -
System.AccessViolationException on Fsuipc.FSUIPC_Process()
Paul Henty replied to Primo's topic in FSUIPC Client DLL for .NET
Hi Primo, I got it to run. I had to comment out the UDP receive code because I don't have Matlab or time to write a UDP server program. However, the multi-threaded code was still active. I stopped the code waiting for receive from UDP and just had this instead: private void XpcValueDataProcessing() { if (commDataFSUIPC.airPlaneAutoPilot_Read == "1") { commDataFSUIPC.WriteFSUIPC(0); } } It ran fine for a good few minutes. Every time I turned the autopilot on, your program turned it off again instantly. I wonder if it's the version of the DLL you are using. I've attached the latest version (the one that I tested with). Maybe this will fix things. (Note that it targets the full 4.0 framework). If you still have problems, I think you'll need to get some simpler code that shows the problem so I can reproduce it here. Paul FSUIPCClient3.0_RC7.zip -
System.AccessViolationException on Fsuipc.FSUIPC_Process()
Paul Henty replied to Primo's topic in FSUIPC Client DLL for .NET
Hi Primo, I can't run this code because I don't have a serial port with anything connected. I see you're using a background worker thread. It's likely that this is causing the problem. I'm not sure exactly how. If you can give me some example code that I can run that shows the problem I might be able to find what's going wrong and offer a solution. Just one comment about your code... you should not have separate offsets for reading and writing. You can use the same offset. Paul -
Vb.NET Closest NAVAIDS SQlite
Paul Henty replied to Frédéric-O DUCHEMIN's topic in FSUIPC Client DLL for .NET
Okay, I understand. You need to just keep track of which navaid is next. Then monitor the distance and show the user. When the distance is under a certain number (maybe 0.5nm) then move to the next navaid. I can't write the exact code because I don't know about your flight plans. But this is a framework that you can adapt: Form level variables: Public playerLatitude As Offset(Of FsLatitude) = New Offset(Of FsLatitude)("playerPos", &H560, 8) Public playerLongitude As Offset(Of FsLongitude) = New Offset(Of FsLongitude)("playerPos", &H568, 8) Dim nextNavaidIndex As Integer = -1 Dim numberOfNavaids As Integer ' SET THIS WHEN THE FLIGHT PLAN IS LOADED Dim nextNavaidLocation As FsLatLonPoint Dim nextNavaidID As String Subs: Private Sub displayNextNavaid() If nextNavaidIndex = -1 Then getNextNavaid() End If If nextNavaidIndex < numberOfNavaids Then FSUIPCConnection.Process("playerPos") Dim playerPos As FsLatLonPoint = New FsLatLonPoint(playerLatitude.Value, playerLongitude.Value) Dim distanceNM = playerPos.DistanceFromInNauticalMiles(nextNavaidLocation) ' display on the form Me.txtNextNavaid.Text = nextNavaidID Me.txtNextNavaidDistance.Text = distanceNM.ToString("F2") ' check is player is overhead If distanceNM < 0.5 Then ' You might need to adjust this distance ' player is overhead, move to the next navaid getNextNavaid() End If Else ' No more navaids left End If End Sub Private Sub getNextNavaid() nextNavaidIndex = nextNavaidIndex + 1 ' REPLACE NEXT THREE LINES - I don't know how your flight plan is stored ' You need to get the ID and Lon/Lat of the navaid from your flight plan. ' You should use the nextNavAidIndex to tell you which navaid to get. nextNavaidID = "ID" ' Dim navaidLat As Double = "45.123456" Dim navaidLon As Double = "-2.123456" nextNavaidLocation = New FsLatLonPoint(navaidLat, navaidLon) End Sub You need to call displayNextNavaid whenever you want this information to be updated. Every 1 second (1000ms) should be fine. Paul -
Vb.NET Closest NAVAIDS SQlite
Paul Henty replied to Frédéric-O DUCHEMIN's topic in FSUIPC Client DLL for .NET
Thanks. What information does the flight plan contain for the navaids? -
Vb.NET Closest NAVAIDS SQlite
Paul Henty replied to Frédéric-O DUCHEMIN's topic in FSUIPC Client DLL for .NET
Yes, but what information is already in the flight plan? I don't think I understand what you want to do. Can you confirm the following is correct? Your software has a flight plan loaded. The flight plan has a list of navaids to follow While flying, you want to show the user the next navaid and the distance to it. If that's wrong please explain what you need. Do mean mean the millisecond value? 10000 Paul -
System.AccessViolationException on Fsuipc.FSUIPC_Process()
Paul Henty replied to Primo's topic in FSUIPC Client DLL for .NET
Pete, can you move this into my subforum? Either way I'll take a look at it... Thanks, Paul -
Vb.NET Closest NAVAIDS SQlite
Paul Henty replied to Frédéric-O DUCHEMIN's topic in FSUIPC Client DLL for .NET
Okay. What information does it have for each navaid? Does it have the Lon/Lat for the navaid? Or just frequency and name? It doesn't need to be quick. I would think every 10 seconds would be fine. Paul -
Vb.NET Closest NAVAIDS SQlite
Paul Henty replied to Frédéric-O DUCHEMIN's topic in FSUIPC Client DLL for .NET
I'm not sure what you are trying to do. It looks like you want to show the distances to way points (beacons) in a flight plan. Does your software have a flight plan? Or do your users load a flight plan in Flight Sim? No need for a timer. You only need to call this once, just after the connection is open. It takes about 2-3 seconds. You don't need to call this again. FSUIPCConnection.Open() FSUIPCConnection.AirportsDatabase.Load() Paul