
Paul Henty
Members-
Posts
1,724 -
Joined
-
Days Won
77
Content Type
Profiles
Forums
Events
Gallery
Downloads
Everything posted by Paul Henty
-
Lat and long offset from the flight plan
Paul Henty replied to hkhoanguyen's topic in FSUIPC Client DLL for .NET
Okay, that looks fine too - although the Javascript wants a space between the lon and lat, not a +. Presumably you change that somewhere else. The next thing to check would be how the objects are drawn on the map. Do you pass them as decimal degrees without further processing? Did you write the map control? If so check for rounding problems (rounding too early) when you're converting the degrees to screen coordinates. Also are you sure the plane is flying on the correct course? Can't really see anything wrong at the moment. The FSUIPC side of things is fine. I'll be happy to check more of the code if you want to post it. (Use PM if you don't want it public). Paul -
Lat and long offset from the flight plan
Paul Henty replied to hkhoanguyen's topic in FSUIPC Client DLL for .NET
Thanks - do you process this string first before sending it to the Javascript function? N44° 49' 43.001975",W0° 42' 55.000000",+000166.00 The Javascript won't work properly on that string. Paul -
Lat and long offset from the flight plan
Paul Henty replied to hkhoanguyen's topic in FSUIPC Client DLL for .NET
The javascript looks fine as long as the incoming format is correct. Do you have a sample of one of your .pln files? Paul -
Lat and long offset from the flight plan
Paul Henty replied to hkhoanguyen's topic in FSUIPC Client DLL for .NET
The code you posted looks good to me. I can see that the .pnl files store the lat/lon as degrees and decimal minutes (e.g. E45* 36.1'). Whereas you're asking for DecimalDegrees from FSUIPC. Are you sure you've converted these two different formats correctly? E45* 36.1' would be 45.6017 in decimal degrees. If you can share some more code it might be helpful. For example, the code that converts the coordinates from the .pln and from the playerData into the values used for the map drawing. Paul -
Flight Number is offset 0x3130 Aircraft Types is offset 0x3160 Tail number is offset 0x313C These can all be found by searching the offsets list called "FSUIPC4 Offset Status.pdf" found in the "FSUIPC Documents" folder under the modules folder. This document will also tell you what type data is stored in each offset (these are all strings) and the size. Paul
-
How to check if P3D is running
Paul Henty replied to hkhoanguyen's topic in FSUIPC Client DLL for .NET
You can use FSUIPCConnection.IsConnectionOpen() e.g.: if (FSUIPCConnection.IsConnectionOpen()) { FSUIPCConnection.Process(); // Process the request to FSUIPC FSUIPCConnection.Process("AircraftInfo"); // For aicraft type } However, you'll need version 3 of the DLL for this. It's not in the 2.4 version. I've attached it here. It requires .NET 4 or later, there is no build for earlier frameworks. If you don't want to upgrade then you'll need to keep track of the connection yourself. In the 2.4 download there is a sample application in C# which tracks the connection status by catching exceptions. Paul FSUIPCClient3.0_RC5.zip -
Hi Urs. I've checked this here and everything is returned correctly. I also ran the code that get the traffic on a separate thread. Here are some thoughts/comments... 1. trafficServices.UpdateExtendedPlaneIndentifiers() is badly named. This doesn't actually get the information. It tells the DLL to get this information when RefreshAITrafficInformation() is called. So you only need to call this once when your app starts. 2. If you have extended information turned on, it's only slow for the first time you call RefreshAITrafficInformation(). For subsequent calls the dll uses cached data. There will be a slight delay for any new AI that comes into range but it shouldn't be too bad. 3. If you are using a 3rd party traffic generator, try just using the default FS traffic and see if that's okay. Maybe its bad info from the traffic package? 4. For GA aircraft the Flight Number will be the same as the Tail Number. 5. Check the info coming from the DLL directly - maybe there's something going wrong in your code in CreateAiAircraftData(). 6. Try running the traffic update on the main thread. If that fixes it then you have some kind of timing issue or thread clashing that is messing things up. This is the code I used to check this: I have a timer on the form updating two sliders (trackbars) for pitch and bank: private Offset<int> pitch = new Offset<int>(0x0578); private Offset<int> bank = new Offset<int>(0x57C); private void timer1_Tick(object sender, EventArgs e) { FSUIPCConnection.Process(); this.tbPitch.Value = (int)((double)pitch.Value * 360d / (65536d * 65536d)); this.tbBank.Value = (int)((double)bank.Value * 360d / (65536d * 65536d)); } I also started a new thread for the AI traffic similar to yours: Thread newThread = new Thread(this.getAI); newThread.Start(FSUIPCConnection.AITrafficServices); private void getAI(object data) { AITrafficServices ts = (AITrafficServices)data; while (true) { Thread.Sleep(1000); ts.RefreshAITrafficInformation(); this.Invoke((Action)populateTraffic); } } private void populateTraffic() { traffic = FSUIPCConnection.AITrafficServices.AllTraffic; this.dataGridView1.Rows.Clear(); foreach (AIPlaneInfo nextPlane in traffic) { this.dataGridView1.Rows.Add(nextPlane.ID, nextPlane.ATCIdentifier.ToString(), nextPlane.TailNumber, nextPlane.Airline, nextPlane.FlightNumber, nextPlane.AircraftType, nextPlane.AircraftModel, nextPlane.AircraftTitle); } } Let me know if you need more help. Paul
-
It depends on the aircraft. Each will be different. Most are likely to hook into the FS control and act the same as the default aircraft, so those will work fine. However, if they don't then you need to research that particular aircraft and see what external access they provide, if any. Sometimes the manufacturer will provide 'custom controls' (aka Events) that can be sent to FS (e.g. PMDG's 737). Other times manufacturers will provide key presses to operate certain systems. Some use Local Panel Variables (aka L:VARs). Some provide no external access at all. All of these techniques can be accessed via FSUIPC, but the specifics (e.g. which control number, key and L:VAR) are different for each aircraft. You'll need to look at the documentation for the aircraft, research the forums if they have any or ask the developers directly. Paul
-
All the offsets are documented in "FSUIPC4 Offset Status.pdf". This can be found in the "FSUIPC Documents" folder under the Modules folder. FSinterrogate isn't kept up-to-date so always use this document to find offsets. It also has useful information and comments about each offset which is missing from FSInterrogate. Yes, 0 and 1. (Check the PDF) Paul
-
The seatbelt offset is 0x341D. Only available on FSUIPC4 & FSUIPC5. You can read and write to this offset. Dim seatbelts As Offset(Of Byte) = New Offset(Of Byte)("Seatbelts", &H341D) This will work with default aircraft but may not work with some 3rd party aircraft because they sometimes implement their own systems. Paul
-
Qualitywings 787 not recognized as aircraft...
Paul Henty replied to sniperfull's topic in FSUIPC Client DLL for .NET
The code looks fine. This offset brings back the 'atc_model' value from the [General] section of the aircraft.cfg file. e.g. the bold line in the example below for the default Cessna 172: [General] atc_type=Cessna atc_model=C172 editable=0 1. Check what this value is in the aircraft.cfg file for this 787. 2. Also put a breakpoint on this line: lblAircraft.Text = aircraftType.Value and see what the Value is. There may be some strange characters. Or maybe it starts with a line feed or something. Investigating those two things might lead you to see what the problem is. If you need more help please post what you find here. Paul -
I've checked here on FSX (I don't have XPlane) and everything seems to be correct. Cessna with left and right tanks only: (There is a slight discrepancy with the values because FSUIPC reports the tank capacity as an integer gallons. FSX however uses fractions so the maths doesn't quite some out the same). 747 with Left, Right, Centre and others: But they are not getting mixed up with FSUIPC. I can only suggest that either there is a bug in XPUIPC or something is wrong with the design of the aircraft. Paul
-
Hi Pepe, The 04A8 offset is a Double type holding the number of seconds. Declare like this: Public FuelFlightTime As Offset(Of Double) = New FSUIPC.Offset(Of Double)("FuelFlightTime", &H4A8) Then use like this: FSUIPCConnection.Process("FuelFlightTime") Dim flighttime As TimeSpan = TimeSpan.FromSeconds(FuelFlightTime.Value) frmMain.lblFlightTime.Text = flighttime.ToString("hh\:mm\:ss") This offset seems to be the time since the sim was started. If that's not suitable then you'll need to make your own timer as described in my previous post. Donations can be made by PayPal using this email address: paul.henty@unitysoftware.net Paul
-
Hi Pepe, The Fuel Tanks problem is caused by VB casting the FsFuelTanks enum into an integer automatically. Doing this in C# wouldn't compile so it was never an issue: If ps.FuelTanks(FSFuelTanks.Right_Tip).CapacityLitres = 0 Then Instead you would normally use the GetFuelTank method: ps.FuelTanks.GetFuelTank(FSFuelTanks.Right_Tip) However, because VB allows the syntax you've used (and VB programmers would expect that to work) I've changed the DLL so your code will now work the way you've written it. (New DLL attached). The MaxGrossWeight problem was a bug - it was returning the aircraft weight instead. This is also fixed in the new DLL. There isn't a code for XPUIPC (as far as I know), so 'Any' is the correct option for you. I expect XPUIPC just reports as FSX. The closest offset I can find is offset 04A8 (Elapsed Time). This might be what you want (if XPUIPC supports it). Otherwise you can: 1. Declare a form level variable to hold the start time: Private flightStartTime As DateTime 2. Set the start time when the flight starts: flightStartTime = DateTime.Now 3. Any time you want to know the current flight time just get the current time and subtract the start time: Dim flightTime As TimeSpan = DateTime.Now - flightStartTime Me.lblFlightTime.Text = flightTime.ToString("hh\:mm\:ss") Paul FSUIPCClient3.0_RC5.zip
-
Testing version 3 RC2 - occasional double entry required
Paul Henty replied to YukonAV8's topic in FSUIPC Client DLL for .NET
Looks very nice. The problem does sound like some kind of timing issue, so managing when the two operations happen is probably the best solution. Speeding up the CDU read should also help a lot. If that timer is executing on the UI thread (i.e. it's System.Windows.Forms.Timer) then it will block key/mouse events until it's done. I'm not clear if, when you get key drops, they show up in the FSUIPC write log. I suspect not as the UI event isn't running. If that's the case then I think you've identified the problem and the solution. Paul -
Testing version 3 RC2 - occasional double entry required
Paul Henty replied to YukonAV8's topic in FSUIPC Client DLL for .NET
Hi Andy, Please try the attached version. Should be much more reliable now. FSUIPCClient3.0_RC4.zip -
Testing version 3 RC2 - occasional double entry required
Paul Henty replied to YukonAV8's topic in FSUIPC Client DLL for .NET
Yes, it's a bug in my DLL. The order of the offsets is being mixed up by a Dictionary. I'll fix it today and post a new version. This is very likely what's causing your problem with your CDU presses. Paul -
Testing version 3 RC2 - occasional double entry required
Paul Henty replied to YukonAV8's topic in FSUIPC Client DLL for .NET
I don't like the sound of that. I'll test it here and see if I can reproduce this. It could be related to your problem if the DLL is sending in the wrong order sometimes. Paul -
Testing version 3 RC2 - occasional double entry required
Paul Henty replied to YukonAV8's topic in FSUIPC Client DLL for .NET
If you use the logging features in FSUIPC (maybe to log all IPC Writes) you will see when the controls (CDU button presses) are being received by FSUIPC. When you get a dropped button push, if it shows up in the FSUIPC log then the sim has received the instruction from your application. This would indicate the problem is likely on the PMDG side. If the dropped key presses are not shown in the FSUIPC logs then it's a problem with the DLL communicating with FSUIPC. I think you'll need to do the logging on when your app is running locally as opposed to running over WideFS. Paul -
Testing version 3 RC2 - occasional double entry required
Paul Henty replied to YukonAV8's topic in FSUIPC Client DLL for .NET
Hi Andy, Have you tried running it on the same machine as FS? This will tell you if it's a problem with WideFS or not. You could also have a look at the WideServer and WideClient logs to see if there's anything there that would suggest the network connection is being overloaded. If the same thing happens without WideFS being involved then I'll investigate further. Paul -
I've attached the latest version - RC6 A newer versions of the DLL is available later in this thread. If you want help with any of the new features let me know and I'll find you some sample code. (Maybe start your own thread in this sub-forum). Here's the change log since 2.4: Version 3.0 RC6 ================ * Added new constructor to the Airport Database. Takes in a Hashset<string> of the ICAO codes of the airports you are interested in. If your app only ever deals with a specific set of airports use this to save memory. * Added Clear() method to the Airport Database to unload it from the memory. * AITraffic now integrated with the Airports Database. If the database is loaded: a. AITrafficInfo now points to database entries for airports and runways b. AITraffic can now tell if it's on a runway or at a gate c. Database airports and runways will have a list of arriving and departing AI traffic d. A runway or gate will know if an AI Plane it on the runway/at the gate Version 3.0 RC5 ================ * BREAKING CHANGE: FsLatitude/FsLongitude base value is now stored in FS Units instead of Degrees. Don't expect the values to always be the exact lon/lat you passed to the contructor. * BREAKING CHANGE: FsLatitude and FsLongitude constructors now force the sign on degrees, minutes and seconds to be the same. If they are different the contructor will change the sign(s) internally to make them match. * BREAKING CHANGE: Changed struct FSRunway (Used for AI Traffic) to FsRunwayID. Apologies, but this struct was badly-named. There is a new class called FsRunway that is used by the airports database. * Added helper methods for reading and writing L:VARS. FSUIPCConecction.ReadLVAR() and FSUIPCConecction.WriteLVAR() * Added airports database that reads info from the output files of Pete's MakeRwys.exe. Gives you an in-memory list of airports that can be queried with LINQ. Contains basic data on all airports plus COM frequencies, runway info, gate info and helipad info. Runway info includes basic properties like length, heading etc plus lighting, ILS and pattern info. This class can be used to easily do things like: - Filter airports by country, state, runway length, ILS facilities etc - Find the nearest airports in range of the player, another airport or any lon/lat location - Find the distance and bearing to any airport/runway from player position, another airport or any lon/lat location - Tell if the player is on a runway or at a gate. * Added COM/NAV/ADF & Transponder helper classes to convert frequencies between string and FSUIPC's BCD format Version 3.0 RC2 ================ * Prepar3dx64 added to flight sim versions for 64 bit versions of P3D (V4 and above) * Global weather now uses the CC00 area, not C400. C400 has problems. * FsLongitude and FsLatitude can now be used as an Offset Type. Version 3.0 Beta ================ * BREAKING CHANGE: You cannot write to an offset than has never been read. (Not applicable to Write-Only offsets). * Connection will now automatically close if a process() fails because the connection to FSUIPC has been lost. * POSSIBLE BREAKING CHANGE: FsLatitude.ToString() now shows the degree symbol instead of an asterisk * Added property FSUIPCConnection.IsConnectedToWideClient * Added weather reading/writing via METAR string (SimConnect format) and the New Weather Interface * Added feature that records performance statisitcs about the data exchange between the DLL and FSUIPC. * Added IsConnectionOpen property + IsConnectionOpenForClass() method. * Added ability to read/write structures * Added ability to add sub menus under the FSX Add-ons menus UserInputServices.AddSubMenuItem() * Payload stations and fuel tanks are now reused between calls to PayloadServices.RefreshData(). This means you can now keep a reference to a fuel tank or payload station object rather than needing to get a new reference with .GetFuelTank() or from the PayloadStations[] list. * Added method for sending controls to Flight Sim (FSUIPCConnection.SendControlToFs()) Enums avilable for - FSX/P3D Controls - FSUIPC General Controls - FSUIPC Axes Controls - FSUIPC Autopilot Controls - PMDG 737 NGX Controls - Progect Magenta Controls * Added method for sending key presses to Flight Sim (FSUIPCConnection.SendKeyToFs()) * Fixed problems with UserInputServices when running over WideFS. * Added method on FsLonLatPoint to calculate a DME intersection. * Added an un-typed Offset class for users wanting to create offsets at runtime that are not known at design time. This allows collections of offsets to be stored and managed (e.g. List<Offset>). These untyped Offsets do not have a Value property. Instead they have a SetValue() method, GetValue<T>() method and GetValue(Type). * Overridden the ToString() method on Offset class to get back info: e.g. "Offset 0x1234 (Int32: 4 Bytes)". * Distance and bearing calculations in FSLatLonPoint now use 'great circle' calculations for greater accuracy. * Added FSUIPCVersion property to FSUIPCConnection * Added Max Gross Weight to PayloadServices * You no longer have to compile your .NET application as 32bit only. This version of the DLL is compiled to target 'Any CPU' (x86 or x64 depending on the host application) and will talk to FSUIPC/XPUIPC running in 32bit or 64bit versions of Flight Sims. * Adding and removing offsets and groups is now threadsafe. * Added property FSUIPCConnetion.GroupsIsolatedToThread. This specifies if offset groups are accessible from other threads. If false, all groups can be processed/removed from any thread. If true a group can only be processed/removed by the thread that created it. If true, a group with the same name can be created on a number of threads. Paul
-
The only place is this sub-forum. The official/supported release (at the moment 2.4) is always pinned to the top of the sub forum. That's the one people should use. If you've seen a new feature mentioned in the forum that's included in 3.0 and you want to help test it then I'm happy to make it available to you on request. Paul
-
Here is the relevant documentation: So you need to also declare another offset (before 0D70) of type int for 0x0D6C. In there you need to write the offset you'll be using to receive, along with the type code. In this case 0x366C0. (int at 66C0). Write this as a number obviously, not as a string. Then in 0D70 you just write the LVar name preceded by a single colon (meaning read): offset_sendlvar.Value = ":VC_GSLD_CP_EFIS_ND_Mode_Knob"; After processing, 0x66C0 will now contain the value. Paul
-
You should probably declare the offset as UInteger because the value is unsigned (it will never be -20 degrees for example). Dim HDG As Offset(Of UInteger) = New FSUIPC.Offset(Of UInteger)(&H580) ' aircraft heading When you say it's inaccurate, what are you comparing it to? This offset gives the True heading, not the magnetic heading shown on the aircraft instruments. Paul
-
UShort is an unsigned value so the values range from 0 to 65,535. Short is signed so the values are from -32,768 to 32,767 In this instance either UShort or Short will work because the values are only 0 to 12. Value 10 is for P3D v1/2/3. Value 11 has been reserved for Flight Sim World by Dovetail I think.