Jump to content
The simFlight Network Forums

Paul Henty

Members
  • Posts

    1,724
  • Joined

  • Days Won

    77

Everything posted by Paul Henty

  1. Yeah that would be for .NET 2. Attached is 2.3 but compiled for the .Net 4 runtime. Let me know if this doesn't work and I'll see if I can tweak anything. Paul FSUIPCClientBeta2.3_Net4.zip
  2. The normal one available at the start of this thread targets the .NET 2 framework. In December 2011 I sent you a DLL (version 2.2) via PM that targets the .NET 4.0 framework. I don't know which one you are using. I can make you another for .NET 4 if you like (will be 2.3). Looking at my system, the version info for the System.DLL will be: Version = 4.0.0.0 Runtime Version = v4.0.30319 Specific Version = False Paul
  3. I don't know the answer to this. You'll be better of posting in the main support forum for Pete to answer.
  4. I'm not sure this is possible. The .NET Client DLL must be x86 or it will not be able to communicate with FSUIPC. The communication process uses windows messages and shared memory. Because FSUIPC is running inside Flight Sim which is a 32-bit process, my understanding is that only another 32-bit process can send windows messages to it and access the same memory. This makes sense because 32-bit software is running inside a virtual machine on the 64-bit windows so it has it's own separate virtual memory. I think the only communication possible would be those than can cross machine boundaries like DCOM and TCP/IP etc. But FSUIPC doesn't use these. Paul
  5. I guess you'll need to wait for Pete's return next week then. In the mean time you could post the contents of your FSUIPC.log file (from your flight sim modules folder) here. It might point you or someone in the right direction and Pete usually asks to see it anyway. Paul
  6. Check the date on your PC is set correctly. A common cause for this problem is that the date on the PC is set earlier than your purchase date. Paul
  7. You've slightly misunderstood about the OnGround flag. You don't set this yourself. It's updated by FS when the aircraft is on the ground. The 030C is constantly updated while in the air. As soon as the plane touches down this value gets 'frozen'. So this value will be the last vertical speed as the wheels touched down. When the plane takes off again this offset gets updated again. What you need to do is READ the OnGround flag until it's 1 (plane has touched down). Then you can read the 030C. This will now contain the Vertical Speed at touch down. so something like this in your timer... if (this.onGround.Value == 1) { double TouchdownRate = ((double)touchdown_rate.Value * 60D * 3.28084D / 256D); this.txttouchdown.Text = TouchdownRate.ToString(); } else { this.txttouchdown.Text = "Airborne"; } Let me know if you need any more help. Paul
  8. ADF1 IDENTITY is at 303E. Paul
  9. To use any offset you need to follow this procedure: (This example will use Pitch) 1. Look in the "FSUIPC4 Offsets Status.pdf" (from the SDK) for the offset address. A search for "Pitch" finds 0578. 2. Get the size from the size column (in this case 4 bytes). 3. Read the description to see if a data type is mentioned and if the data is signed. (There is no data type mentioned in this case so we assume some kind of integer type. We can also read that the data is signed). 4. From the table on page 7 of my UserGuide.pdf we read that an integer type of size 4 that is signed corresponds to the VB.NET type of 'Integer'. Thus we declare the offset: Dim Pitch As Offset(Of Integer) = New Offset(Of Integer)(&H578)[/CODE] 5. After the Process() call, when we want to use the data, we use the conversion described in the "FSUIPC4 Offsets Status.pdf" document to get the data into human readable format. [CODE] Dim PitchDegrees As Double PitchDegrees = Pitch.Value * 360.0# / (65536.0# * 65536.0#)[/CODE] (The # signs are appended to the values to tell the compiler that these are to be Doubles and not Integers.) You can now apply this process to any offset you want and know how to use it. Roll (also called Bank) is at 057C. Paul
  10. The other tabs are only available after you register. Paul
  11. For a motion platform the data you need will be accelerations relative to the body of the aircraft. How many pieces of data you take will depend on how complicated you want to make the algorithm to determine the position of the motion platform. The most basic data I would use for 2 degrees of freedom (roll and pitch only) is: 3070 for the longitudinal accelerations (e.g. takeoff/braking) 3078 for the pitch accelerations 3080 for the roll accelerations If you have 3 degrees of freedom (up/down as well) then you need to add: 3068 for the vertical accelerations Paul
  12. Firstly, programming with FSUIPC is quite advanced. It's not a good place to learn about programming. I would advise you learn a bit about Visual Basic programming in general before you try to use FSUIPC. Everything you need to program with FSUIPC in Visual Basic 2010 is contained in two downloads: 1. The file called "FSUIPC4 Offsets Status.pdf" from FSUIPC SDK. This lists all the offsets available and gives important information about how to deal with the data from each offset. 2. My FSUIPC Client DLL package from here: http://forum.simflig...net-version-20/ This contains the DLL, an extensive user guide that explains how to get data from FSUIPC, a reference manual and a sample project (in VB and C#). The sample project contains many examples of reading and writing data to/from FSUIPC and has lots of comments telling you what each line in doing. I suggest reading the "getting started" section of the user guide and then run the sample project. Then look at the code in the sample project and see how it's done. Most of the code examples in the user guide are taken from the sample project. If you need any more help with my DLL or getting data from FSUIPC feel free to ask. It's always helpful when asking questions to paste in any error messages and the code that's failing. Without these it's almost impossible to offer any help. Paul
  13. Hi, The VB6 stuff won't work in .NET, that's why I wrote my .NET DLL from scratch. What are the errors you are getting with the DLL? Have you tried building the project or running it? Until you build it at least once there will be errors reported by the code editor because the zip file doesn't include any binaries. If you can't run the project then let me know what the errors are and I'll help you get it working. Paul
  14. I recommend that you use my FSUIPC Client DLL for .NET languages. It's much more suited to the way things are usually done in .NET. The package also includes a sample project in Visual Basic. You can download it from here: http://forum.simflight.com/topic/40989-fsuipc-client-dll-for-net-version-20/ Paul
  15. As Graham says, some paid aircraft do not use the underlying Flight Sim systems, they write their own. With these kind of aircraft it's not possible to use FSUIPC and therefore my DLL to access the data. You'll need to investigate how to access the lights for each paid aircraft individually. This could be through their own SDK or using L:VARS etc. There are many ways that can be used but each plane is different. With some planes it may not be possible at all. It's probably best to ask in the support forums of makers of the aircraft. Paul
  16. Hi Dave, What's going wrong is that you're declaring the offset variables every time the timer ticks in Poll_Timer_Tick. This is bad because you're creating new instances of the offset requests every time the timer ticks. Even though your variables go out of scope after the method ends they are still registered with the FSUIPCClient DLL, So each tick adds 4 new offsets to the list of offsets being requested by the DLL. After 30 seconds your program is actually requesting 400 offsets. After a while you'll exceed the total amount of data that can be handled by FSUIPC and you get the FSUIPC_ERR_SIZE exception. When working with the DLL only declare (Dim) the offsets once during the lifetime of the application. The easiest way to do this is to place the declarations at the form or class level, rather than in the timer loop. Like this: Dim airSpeed As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&H2BC) Dim altAltitude As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&H7D4) Dim altRate As Offset(Of Short) = New FSUIPC.Offset(Of Short)(&H7F2) Dim altHead As Offset(Of Short) = New FSUIPC.Offset(Of Short)(&H7CC) Private Sub Poll_Timer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Poll_Timer.Tick FSUIPCConnection.Process() Dim altALT As Double = (altAltitude.Value / 65536D) * 3.28084D Dim altHDG As Double = (altHead.Value / 65536D) * 360D Me.TxtAPALT.Text = altALT.ToString("f0") Me.TxtAPRate.Text = altRate.Value.ToString("f0") Me.TxtAPHDG.Text = altHDG.ToString("f0") End Sub I've just had a look at the manual and it doesn't really make this clear which is my fault. I'll have to amend it in future releases. Sorry to dash your expectations but it turns you are not an idiot after all. :smile: Paul
  17. Hi, You need to write every plane to 0x1F80. You don't add sizeof(TCAS_DATA) every time. You can write multiple planes to 0x1F80 before calling Process(). Even though they all have the same offset they won't overwrite each other because offsets do not refer to real memory locations. They are just tokens that tell FSUIPC what to do with the data. Paul
  18. That's fair enough Pete. It's very clear, I just didn't think to look anywhere other than the .h file for these values. Now I know where this info is likely to be I'll be able to find it in the future. Thanks, Paul
  19. You're right. Attached is a new DLL (version 2.3) with the new enum value for Prepar3d. It also has extra overloads on Open() to pass an integer. You need to copy over your existing DLL and XML files. (Make backups first in case you need to go back). Paul FSUIPCClient.Beta2.3.zip
  20. OK I understand. How do you know Prepar3d is 10? If I look at the current FSUIPC SDK (February 2012) the FSUIPC_User.h file only goes up to ESP (9). I can only keep my DLL in line with the current SDK. If you can point me to an official source that says Prepar3d = 10 then I'll happy to amend my DLL. At the moment you can just pass 'Any' for the enum, or just don't pass any parameters into Open() and it will connect. You cannot pass an integer at the moment, but I'll think about adding that. Paul
  21. I don't think there would be anything special or different about connecting to FSUIPC running inside Pepar3d. It should be the same as connecting to FSUIPC running in FSX or FS9. The FSUIPC interface is the same. If you've tried to connect to Prepar3d but cannot, then please describe the problem. Are there any error messages? Paul
  22. Here is the code to read and display the vertical speed and height. I've included the conversions for metres and feet. Declare the offsets as follows: private Offset<int> verticalSpeed = new Offset<int>(0x02C8); private Offset<long> altitude = new Offset<long>(0x0570); Get the values (after the Process()) like this: double verticalSpeed_MetresPerSecond = (double)verticalSpeed.Value / 256d; double verticalSpeed_FeetPerMinute = (double)verticalSpeed.Value * 60d * 3.28084d / 256d; double altitude_Metres = (double)altitude.Value / (65536d * 65536d); double altitude_Feet = (double)altitude.Value / (65536d * 65536d) * 3.28084d; The first thing to look at would be the interval for 'timer1'. This sets how often the timer1_Tick() method runs. If you want it smooth you need something like 20 ticks per second. This is an interval of 50ms. So set the timer1.Interval property to 50. If you used my example application as a starting point, the interval is set to 200 in the method openFSUIPC(). This is only 5 times per second so it will be jerky. This is the line you should change. Paul
  23. The code looks good to me. The only mistake I can see is that turbRpm (0x0896) is only 2 bytes and should therefore be declared as 'short' not 'int'. private Offset<short> turbRpm = new Offset<short>(0x0896); I'm not sure if you had a problem you want help with. If you do, please be more specific about what the problem is. Regards, Paul
  24. It's not easy in C# because my DLL doesn't support reading and writing structures. I've also never tried using the NWI myself, but this might work... You need to convert your structure to a byte array before assigning it to the offset. Here is a method that will do that: You'll need to add the following using statement: using System.Runtime.InteropServices private byte [] StructureToByteArray(object obj) { int len = Marshal.SizeOf(obj); byte [] arr = new byte[len]; IntPtr ptr = Marshal.AllocHGlobal(len); Marshal.StructureToPtr(obj, ptr, true); Marshal.Copy(ptr, arr, 0, len); Marshal.FreeHGlobal(ptr); return arr; } Now you can use this to give the offset the byte array, rather than the structure itself: NewWeather weather = new NewWeather(); weather.uCommand = 3; NWICommand.Value = StructureToByteArray(weather); // pressure.Value = 1024; FSUIPCConnection.Process(); I don't know if this will work but it's certainly a step in the right direction. If you want to read from the NWI, you'll need to convert the byte array back into a structure using this method: private void ByteArrayToStructure(byte [] bytearray, ref object obj) { int len = Marshal.SizeOf(obj); IntPtr i = Marshal.AllocHGlobal(len); Marshal.Copy(bytearray,0, i,len); obj = Marshal.PtrToStructure(i, obj.GetType()); Marshal.FreeHGlobal(i); } Paul
  25. Do you mean Visual Basic by Microsoft? If so, it's fairly simple. Let me know which version (VB6? VB.NET 2012?) and I'll tell you what you need and where to find it. If you mean a different language called Vbasic, there is no FSUIPC SDK for it. You'd have to write one yourself by translating the C SDK, Paul
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.