-
Notifications
You must be signed in to change notification settings - Fork 283
XPC Developer Information
Quick Links: Plugin | Network | Client | Troubleshooting
- 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.
- Compatibility: XPC should be compatible across many OSs (Windows, Mac, Linux), programming languages, and X-Plane Versions (9+).
- Consistency: XPC Clients should be as consistent as possible across programming languages
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.
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.
An XCode project is provided. As with Windows, the expectation is that this should "just work".
The linux build environment is currently the least developed. Contributions streamlining the process described below would be greatly appreciated.x
- Open a terminal instance and cd to
[X-Plane Connect Repo/xpcPlugin]
- (Optional) create a build directory to contain the files generated by cmake
- Run the cmake command (either
cmake ..
orcmake .
) depending on whether you run the command from a build directory. - Run
make
in the same directory - Copy the resulting
xpc32.xpl
toxpcPlugin/XPlaneConnect/lin.xpl
- Copy the resulting
xpc64.xpl
toxpcPlugin/XPlaneConnect/64/lin.xpl
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.
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.
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.
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 forselect
in thereadUDP
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.