Skip to content

XPC Developer Information

Jason Watkins edited this page Oct 20, 2018 · 19 revisions

Quick Links: Plugin | Network | Client | Troubleshooting

Development Focuses

  1. Usability: XPC should be very easy to use. Most users should be able to use the pre-compiled binaries. Users should be able to utilize the XPC Client with very little programming experience. Developers should limit the complexity of the functions and the number of functions.
  2. Compatibility: XPC should be compatible across many OSs (Windows, Mac, Linux), programming languages, and X-Plane Versions (9+).
  3. Consistency: XPC Clients should be as consistent as possible across programming languages

Plugin Information

A Note on binaries: We keep the binaries for the plugin in version control to keep track of all of them across platforms. However, it is very hard to keep all of the binaries in sync all of the time. Therefore, developers working on any branch other than master are advised to always build the plugin before use to ensure that the binary includes all of the latest changes.

Building the Plugin

Windows

A Visual Studio solution is provided in the xpcPlugin/xpcPlugin folder. The plugin has very few external dependencies, so it should build out of the box. Please report any issues on the issue tracker.

Mac

An XCode project is provided. As with Windows, the expectation is that this should "just work".

Linux

The linux build environment is currently the least developed. Contributions streamlining the process described below would be greatly appreciated.x

  1. Open a terminal instance and cd to [X-Plane Connect Repo/xpcPlugin]
  2. (Optional) create a build directory to contain the files generated by cmake
  3. Run the cmake command (either cmake .. or cmake .) depending on whether you run the command from a build directory.
  4. Run make in the same directory
  5. Copy the resulting xpc32.xpl to xpcPlugin/XPlaneConnect/lin.xpl
  6. Copy the resulting xpc64.xpl to xpcPlugin/XPlaneConnect/64/lin.xpl

Components

The following components make up the X-Plane Connect plugin. All components are written in C++. In general, there is a one-to-one correspondence between the components described below and a header file bearing the same name.

Dependency Graph

Contains the core functions called by the plugin manager to interact with the plugin.

Provides a wrapper around the XPLM data interface.

Provides functionality for rendering graphics in the X-Plane environment.

Provides functionality for logging various levels of information about the plugin's operation to a file.

###Message & Message Handlers The messaging component handles commands sent to the plugin. The Message class is primarily a data object containing the message data. The MessageHandlers class contains the core functionality of the plugin. It contains methods to operate on commands, and logic to dispatch incoming messages to the appropriate handler.

The UDPScocket component is a thin wrapper around the platform networking API. Its primary purpose is to abstract cross-platform differences.

The X-Plane Connect network protocol is designed to extend the UDP data protocol provided by X-Plane. XPC's protocol is a strict superset of the X-Plane protocol. For detailed information about commands added by X-Plane Connect, see the Network Information page.

Client Information

Troubleshooting

The following topics have been identified as frequent obstacles to correct operation of the XPC plugin. If you are having an issue that is not covered here, or if the troubleshooting steps listed here do not resolve your issue, please let us know by opening an issue.

Failing to read data

By default, the XPC clients all set a read timeout of 100ms. This timeout should work well for systems where the client and plugin are running on the same machine, but it may be too aggressive for systems where the client is running on another machine, or in situations where X-Plane is running at a low frame-rate.

Troubleshooting steps:

  • Increase the read timeout. This can be accomplished by calling the appropriate version of the client constructor or openUDP for all versions except the C client. For the C client, you can manually set the timeouts in in the aopenUDP function. For Windows users, you may also want to adjust the timeout for select in the readUDP function.
  • Lower X-Plane graphics settings. X-Plane Connect is structured to run once per iterations of the X-Plane flight simulation loop. If X-Plane is running at a low frame-rate, it will increase the time it takes X-Plane Connect to respond to requests. You can view the current frame-rate by following the steps described here.