Jump to content
The simFlight Network Forums

Paul Henty

Members
  • Content Count

    1,050
  • Joined

  • Last visited

  • Days Won

    34

Paul Henty last won the day on June 3 2019

Paul Henty had the most liked content!

Community Reputation

58 Excellent

4 Followers

About Paul Henty

  • Rank
    Advanced Member
  • Birthday 01/01/1970

Profile Information

  • Gender
    Male
  • Location
    Gloucestershire, UK

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Glad you got it sorted. To answer the above question... These kind of helper methods (getPositionSnapshot(), ReadLVAR() etc.) all do a Process() in the background. You only need to call Process() to handle your own Offsets. It's not required when you use any helper method or module (e.g PayloadServices). Paul
  2. You can't run two connections in the same application. It's not designed like that. It wouldn't help much as I think FSUIPC can only serve one client at a time anyway. The DLL is thread-safe however. So you can use it in a multi-threaded application. For example you can call Process() methods on a background worker thread. This is useful for not blocking the GUI thread and making it feel unresponsive. It's also useful if you have other processing that might slow down the Process() calls - you can put the other processing on its own thread too. Theoretically, you can call Process() and access Offsets from multiple parallel threads. However, I'd advise against this for two reasons: It's complicated to debug Only one Process() call can be communicating with FSUIPC at a time. If you call Process() on thread B before Process() on thread A is finished, thread B will be blocked until thread A completes. So, yes, you can have the Process() calls being made in their own thread, but keep it simple; don't have multiple threads firing off requests to FSUIPC all over the place unless you really know what you're doing. You only need to create the offsets and open the connection once (on any thread). The offsets and that connection can be accessed by any other thread you create. Paul
  3. These are not BitArrays, they are Byte Arrays. Two bytes long. Each byte is either 0 or 1. The BitArray type offsets list what each bit represents. These offsets don't say that, they say 'boolean' which is a single value: 1 or 0. The best way to handle these is to declare two offsets as bytes. Each byte offset will be one of the lights. You will need two offset addresses, one will be the address as stated, the next one will be that address + 1. For example for the FUEL_annunLOWPRESS_Fwd: private Offset<byte> fuelfwdL = new Offset<byte>("fuelfwd", 0x646A); private Offset<byte> fuelfwdR = new Offset<byte>("fuelfwd", 0x646B); The fuelFwdR offset the address is 0x646B which is (0x064A + 1). Then test for 1 or 0: string fuelfwdl = (this.fuelfwdL.Value == 1) ? "On" : "Off"; string fuelfwdr = (this.fuelfwdR.Value == 1) ? "On" : "Off"; Paul
  4. Those Offsets are marked in the document as 'FLT32'. Those are not integers but floating point values. You just need to declare those offsets as 'float', i.e. Offset<float>. No conversion should be required; the 'Value' should just contain the gauge value. Paul
  5. I can't see any way of switching the G1000 off alone. You can switch it off with the Avionics Master switch 0x2E80 but this might affect other things as well. Paul
  6. Please see my reply in the other thread you made.
  7. I also cannot find any offsets for a standby battery. I assume this picture is from a third-party add-on aircraft. If it is, the makers of the aircraft are simulating this switch themselves. There may not be a way to access this switch at all, but here are some things you can try: 1. Use the FSUIPC logging tab to log 'Events' to a console window. Operate the switch. You might see a control number being logged. You can use this to control the switch. 2. Use FSUIPC to bind a key (or joystick press) to log all the known LVars. Again, set the log to go to a console window in the logging tab. Press the key/button and look through the resulting LVars list. You might see something about the standby battery. If you do you can use the facilities in the DLL to read and write the LVar. 3. You might be able to use FSUIPC to set up a "mouse macro" to control this switch. If you can make one you can execute it via the DLL. Which method works will depend on how the author has made the aircraft. Maybe none of these will work. If you say which aircraft it is someone who knows it might be able to help. Paul
  8. Offset 0x0C4E is the OBS for Nav1. This returns 0 to 360. I think you are now talking about the autopilot heading at 0x07CC. This is also 2 bytes. But it returns the heading between 0 and 65535. This is allow for decimal heading like 132.2 degrees. You just need to convert the value like this: double crs1Degrees = (double)CRS1.Value / 65536d * 360d; This is explained in the "FSUIPC5 Offsets Status" PDF. Paul
  9. That number is very large. I think you have declared the Offset as 'int'. It is only 2 Bytes long so you need to declare it as 'ushort'. Paul
  10. Maybe you're using an old version. Try updating through the NuGet package manager. Instructions here: https://www.youtube.com/watch?v=MoppPMp31nc Paul
  11. Try deleting the line and typing it in by hand. (No copy and paste). Paul
  12. Yes, that all looks fine. Can you get a screenshot of the error in Visual Studio? Paul
  13. It's correct, but make sure you put it in the correct place. It goes at the class (or form) level. Next to any offsets you have declared. Not in any methods or functions. If you can't get it working show me a bit more of your code. Paul
  14. Yes, that's fine. Thanks. If you want to experiment with this, the CDU text is quite easy to get with the DLL. First, see the PMDG offsets document for an entry you need to add to your .INI file. And for the starting offset of the two CDU screens. Declare an instance of the CDU screen class: (Pass the starting offset): private PMDG_NGX_CDU_Screen CDU0 = new PMDG_NGX_CDU_Screen(0x5400); // CDU 0 in 737 Then use it like this: private void CDUExample() { this.CDU0.RefreshData(); // Call RefreshData to get the latest text string cduText = ""; // Powered property lets you know if it's on or off: if (CDU0.Powered) { // Get the entire screen in one string. // Delimiter passed as parameter. In this case, new line. cduText = this.CDU0.ToString("\r\n"); } else { cduText = "No Power"; } // OR, you can get a specific row of text, use the Rows collection: // (First row is row 0) string row3Text = this.CDU0.Rows[2].ToString(); // Use normal string functions to search in the row: if (row3Text.Substring(5,2) == "ON") { // do something } else { // do something else } } 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.