├── .github └── workflows │ ├── build.yml │ ├── linux.yml │ ├── macos.yml │ └── windows.yml ├── .gitignore ├── .gitmodules ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── client ├── CMakeLists.txt ├── Info.plist ├── Resources │ ├── Components │ │ ├── ConfigRequiredDialog.qml │ │ ├── DisconnectDialog.qml │ │ ├── DownloadCSLModels │ │ │ ├── DownloadModels.qml │ │ │ ├── ExtractModels.qml │ │ │ └── SetXplanePath.qml │ │ ├── InvalidTypeCodeDialog.qml │ │ ├── MicrophoneCalibrationRequired.qml │ │ ├── NearbyAtc.qml │ │ ├── NearbyAtcGroup.qml │ │ ├── RadioStack.qml │ │ ├── Toolbar.qml │ │ └── VersionCheck │ │ │ ├── DownloadingUpdate.qml │ │ │ └── NewVersionAvailable.qml │ ├── Controls │ │ ├── BlueButton.qml │ │ ├── CustomBorder.qml │ │ ├── CustomCheckBox.qml │ │ ├── CustomComboBox.qml │ │ ├── CustomSwitch.qml │ │ ├── CustomTextField.qml │ │ ├── GrayButton.qml │ │ ├── PeakLevelControl.qml │ │ ├── RadioStackIndicator.qml │ │ ├── StandardButton.qml │ │ ├── TabControl.qml │ │ ├── ToolbarButton.qml │ │ ├── TransparentButton.qml │ │ ├── TransponderButton.qml │ │ ├── VerticalTabBar.qml │ │ ├── VerticalTabButton.qml │ │ └── VolumeSlider.qml │ ├── Fonts │ │ ├── OpenSans.ttf │ │ ├── Roboto-Mono.ttf │ │ └── Ubuntu-Regular.ttf │ ├── Icons │ │ ├── AppIcon.ico │ │ ├── AppIcon.png │ │ ├── ChevronDown.svg │ │ ├── CloseIcon.svg │ │ ├── HeadsetIcon.svg │ │ ├── MaximizeIcon.svg │ │ ├── MinimizeIcon.svg │ │ └── SpeakerIcon.svg │ ├── Samples │ │ ├── AC_Bus.wav │ │ ├── Click.wav │ │ ├── Crackle.wav │ │ ├── HF_WhiteNoise.wav │ │ └── WhiteNoise.wav │ ├── Scripts │ │ ├── FrequencyUtils.js │ │ ├── StringUtils.js │ │ └── TimestampUtils.js │ ├── Sounds │ │ ├── Alert.wav │ │ ├── Broadcast.wav │ │ ├── DirectRadioMessage.wav │ │ ├── Error.wav │ │ ├── NewMessage.wav │ │ ├── PrivateMessage.wav │ │ ├── RadioMessage.wav │ │ └── SELCAL.wav │ ├── Ui │ │ └── Colors.js │ └── Views │ │ ├── ConnectWindow.qml │ │ ├── MainWindow.qml │ │ ├── Settings │ │ ├── SettingsAudio.qml │ │ ├── SettingsMiscellaneous.qml │ │ ├── SettingsNetwork.qml │ │ └── SettingsNotifications.qml │ │ └── SettingsWindow.qml ├── entitlements.plist ├── icon.icns ├── icon.ico ├── qml.qrc ├── src │ ├── aircrafts │ │ ├── aircraft_configuration.cpp │ │ ├── aircraft_configuration.h │ │ ├── aircraft_visual_state.h │ │ ├── network_aircraft.h │ │ ├── network_aircraft_manager.cpp │ │ ├── network_aircraft_manager.h │ │ ├── radio_stack_state.h │ │ ├── user_aircraft_config_data.h │ │ ├── user_aircraft_data.h │ │ ├── user_aircraft_manager.cpp │ │ ├── user_aircraft_manager.h │ │ └── velocity_vector.h │ ├── appcore.cpp │ ├── appcore.h │ ├── audio │ │ ├── afv.cpp │ │ ├── afv.h │ │ ├── audiodeviceinfo.h │ │ ├── notification_sound_engine.cpp │ │ └── notification_sound_engine.h │ ├── common │ │ ├── build_config.cpp.in │ │ ├── build_config.h │ │ ├── build_config.inc │ │ ├── clipboardadapter.h │ │ ├── enums.h │ │ ├── frequency_utils.h │ │ ├── installmodels.cpp │ │ ├── installmodels.h │ │ ├── libzippp.cpp │ │ ├── libzippp.h │ │ ├── notificationtype.h │ │ ├── runguard.cpp │ │ ├── runguard.h │ │ ├── simplecrypt.cpp │ │ ├── simplecrypt.h │ │ ├── typecodedatabase.cpp │ │ ├── typecodedatabase.h │ │ ├── utils.h │ │ ├── versioncheck.cpp │ │ └── versioncheck.h │ ├── config │ │ ├── appconfig.cpp │ │ ├── appconfig.h │ │ └── windowconfig.h │ ├── controllers │ │ ├── controller.h │ │ ├── controller_manager.cpp │ │ └── controller_manager.h │ ├── fsd │ │ ├── client_properties.h │ │ ├── enums.h │ │ ├── fsd_client.cpp │ │ ├── fsd_client.h │ │ ├── pdu │ │ │ ├── pdu_add_atc.cpp │ │ │ ├── pdu_add_atc.h │ │ │ ├── pdu_add_pilot.cpp │ │ │ ├── pdu_add_pilot.h │ │ │ ├── pdu_atc_position.cpp │ │ │ ├── pdu_atc_position.h │ │ │ ├── pdu_auth_challenge.cpp │ │ │ ├── pdu_auth_challenge.h │ │ │ ├── pdu_auth_response.cpp │ │ │ ├── pdu_auth_response.h │ │ │ ├── pdu_base.cpp │ │ │ ├── pdu_base.h │ │ │ ├── pdu_broadcast_message.cpp │ │ │ ├── pdu_broadcast_message.h │ │ │ ├── pdu_change_server.cpp │ │ │ ├── pdu_change_server.h │ │ │ ├── pdu_client_identification.cpp │ │ │ ├── pdu_client_identification.h │ │ │ ├── pdu_client_query.cpp │ │ │ ├── pdu_client_query.h │ │ │ ├── pdu_client_query_response.cpp │ │ │ ├── pdu_client_query_response.h │ │ │ ├── pdu_delete_atc.cpp │ │ │ ├── pdu_delete_atc.h │ │ │ ├── pdu_delete_pilot.cpp │ │ │ ├── pdu_delete_pilot.h │ │ │ ├── pdu_fast_pilot_position.cpp │ │ │ ├── pdu_fast_pilot_position.h │ │ │ ├── pdu_format_exception.h │ │ │ ├── pdu_kill_request.cpp │ │ │ ├── pdu_kill_request.h │ │ │ ├── pdu_metar_request.cpp │ │ │ ├── pdu_metar_request.h │ │ │ ├── pdu_metar_response.cpp │ │ │ ├── pdu_metar_response.h │ │ │ ├── pdu_mute.cpp │ │ │ ├── pdu_mute.h │ │ │ ├── pdu_pilot_position.cpp │ │ │ ├── pdu_pilot_position.h │ │ │ ├── pdu_ping.cpp │ │ │ ├── pdu_ping.h │ │ │ ├── pdu_plane_info_request.cpp │ │ │ ├── pdu_plane_info_request.h │ │ │ ├── pdu_plane_info_response.cpp │ │ │ ├── pdu_plane_info_response.h │ │ │ ├── pdu_pong.cpp │ │ │ ├── pdu_pong.h │ │ │ ├── pdu_protocol_error.cpp │ │ │ ├── pdu_protocol_error.h │ │ │ ├── pdu_radio_message.cpp │ │ │ ├── pdu_radio_message.h │ │ │ ├── pdu_send_fast.cpp │ │ │ ├── pdu_send_fast.h │ │ │ ├── pdu_server_identification.cpp │ │ │ ├── pdu_server_identification.h │ │ │ ├── pdu_text_message.cpp │ │ │ ├── pdu_text_message.h │ │ │ ├── pdu_wallop.cpp │ │ │ └── pdu_wallop.h │ │ ├── serializer.cpp │ │ └── serializer.h │ ├── main.cpp │ ├── network │ │ ├── connectinfo.h │ │ ├── events │ │ │ └── radio_message_received.h │ │ ├── nearbyatc.h │ │ ├── networkmanager.cpp │ │ ├── networkmanager.h │ │ ├── serverlistmanager.cpp │ │ ├── serverlistmanager.h │ │ └── vatsim_auth.h │ ├── qinjection │ │ ├── dependencycreator.cpp │ │ ├── dependencycreator.h │ │ ├── dependencyinjector.cpp │ │ ├── dependencyinjector.h │ │ ├── dependencypointer.cpp │ │ ├── dependencypointer.h │ │ ├── dependencypool.cpp │ │ └── dependencypool.h │ └── simulator │ │ ├── dto.h │ │ ├── xplane_adapter.cpp │ │ └── xplane_adapter.h ├── xpilot.desktop ├── xpilot.png └── xpilot.rc.in ├── installer ├── linux.xml ├── macos.xml └── windows.xml ├── plugin ├── 3rdparty │ ├── fmod │ │ ├── fmod.dll │ │ ├── fmod_vc.lib │ │ ├── include │ │ │ ├── fmod.h │ │ │ ├── fmod.hpp │ │ │ ├── fmod_codec.h │ │ │ ├── fmod_common.h │ │ │ ├── fmod_dsp.h │ │ │ ├── fmod_dsp_effects.h │ │ │ ├── fmod_errors.h │ │ │ └── fmod_output.h │ │ ├── libfmod.dylib │ │ └── libfmod.so │ ├── font │ │ ├── IconsFontAwesome5.h │ │ ├── LICENSE_Font-Awesome.txt │ │ └── fa-solid-900.inc │ ├── gl │ │ ├── glext.h │ │ └── khrplatform.h │ ├── imgui-stdlib │ │ ├── filesystem.hpp │ │ ├── imfilebrowser.h │ │ ├── imgui_stdlib.cpp │ │ └── imgui_stdlib.h │ ├── imgwindow │ │ ├── img_font_atlas.cpp │ │ ├── img_font_atlas.h │ │ ├── img_window.cpp │ │ ├── img_window.h │ │ ├── system_gl.h │ │ ├── xp_img_window.cpp │ │ └── xp_img_window.h │ └── sdk │ │ ├── CHeaders │ │ ├── Widgets │ │ │ ├── XPStandardWidgets.h │ │ │ ├── XPUIGraphics.h │ │ │ ├── XPWidgetDefs.h │ │ │ ├── XPWidgetUtils.h │ │ │ └── XPWidgets.h │ │ ├── Wrappers │ │ │ ├── XPCBroadcaster.cpp │ │ │ ├── XPCBroadcaster.h │ │ │ ├── XPCDisplay.cpp │ │ │ ├── XPCDisplay.h │ │ │ ├── XPCListener.cpp │ │ │ ├── XPCListener.h │ │ │ ├── XPCProcessing.cpp │ │ │ ├── XPCProcessing.h │ │ │ ├── XPCWidget.cpp │ │ │ ├── XPCWidget.h │ │ │ ├── XPCWidgetAttachments.cpp │ │ │ └── XPCWidgetAttachments.h │ │ └── XPLM │ │ │ ├── XPLMCamera.h │ │ │ ├── XPLMDataAccess.h │ │ │ ├── XPLMDefs.h │ │ │ ├── XPLMDisplay.h │ │ │ ├── XPLMGraphics.h │ │ │ ├── XPLMInstance.h │ │ │ ├── XPLMMap.h │ │ │ ├── XPLMMenus.h │ │ │ ├── XPLMNavigation.h │ │ │ ├── XPLMPlanes.h │ │ │ ├── XPLMPlugin.h │ │ │ ├── XPLMProcessing.h │ │ │ ├── XPLMScenery.h │ │ │ └── XPLMUtilities.h │ │ ├── Delphi │ │ ├── Widgets │ │ │ ├── XPStandardWidgets.pas │ │ │ ├── XPUIGraphics.pas │ │ │ ├── XPWidgetDefs.pas │ │ │ ├── XPWidgetUtils.pas │ │ │ └── XPWidgets.pas │ │ └── XPLM │ │ │ ├── XPLMCamera.pas │ │ │ ├── XPLMDataAccess.pas │ │ │ ├── XPLMDefs.pas │ │ │ ├── XPLMDisplay.pas │ │ │ ├── XPLMGraphics.pas │ │ │ ├── XPLMInstance.pas │ │ │ ├── XPLMMap.pas │ │ │ ├── XPLMMenus.pas │ │ │ ├── XPLMNavigation.pas │ │ │ ├── XPLMPlanes.pas │ │ │ ├── XPLMPlugin.pas │ │ │ ├── XPLMProcessing.pas │ │ │ ├── XPLMScenery.pas │ │ │ └── XPLMUtilities.pas │ │ ├── Libraries │ │ ├── Mac │ │ │ ├── XPLM.framework │ │ │ │ └── XPLM │ │ │ └── XPWidgets.framework │ │ │ │ └── XPWidgets │ │ └── Win │ │ │ ├── XPLM_64.lib │ │ │ └── XPWidgets_64.lib │ │ ├── README.txt │ │ └── license.txt ├── CMakeLists.txt ├── Resources │ ├── CSL │ │ └── PlaceCSLPackagesHere.html │ ├── Contrail │ │ ├── Contrail.obj │ │ ├── Contrail.png │ │ └── Contrail.pss │ ├── Doc8643.txt │ ├── MapIcons.png │ ├── Obj8Datarefs.txt │ └── related.txt ├── include │ ├── abacus.hpp │ ├── aircraft_manager.h │ ├── config.h │ ├── constants.h.in │ ├── data_ref_access.h │ ├── dto.h │ ├── frame_rate_monitor.h │ ├── geo_calc.hpp │ ├── nearby_atc_window.h │ ├── network_aircraft.h │ ├── notification_panel.h │ ├── owned_data_ref.h │ ├── plugin.h │ ├── settings_window.h │ ├── stdafx.h │ ├── stopwatch.h │ ├── terrain_probe.h │ ├── text_message_console.h │ ├── utilities.h │ ├── vector3.hpp │ ├── xpilot.h │ ├── xpilot_api.h │ └── xplane_command.h └── src │ ├── aircraft_manager.cpp │ ├── config.cpp │ ├── data_ref_access.cpp │ ├── frame_rate_monitor.cpp │ ├── nearby_atc_window.cpp │ ├── network_aircraft.cpp │ ├── notification_panel.cpp │ ├── owned_data_ref.cpp │ ├── plugin.cpp │ ├── settings_window.cpp │ ├── stopwatch.cpp │ ├── terrain_probe.cpp │ ├── text_message_console.cpp │ ├── xpilot.cpp │ ├── xpilot.sym │ └── xpilot.sym_mac ├── scripts ├── AppRun-x86_64 ├── appimage.sh ├── appimagetool-x86_64.AppImage └── make_keychain.sh └── xpilot.json /.gitignore: -------------------------------------------------------------------------------- 1 | # Qt-es 2 | object_script.*.Release 3 | object_script.*.Debug 4 | *_plugin_import.cpp 5 | /.qmake.cache 6 | /.qmake.stash 7 | *.pro.user 8 | *.pro.user.* 9 | *.qbs.user 10 | *.qbs.user.* 11 | *.moc 12 | moc_*.cpp 13 | moc_*.h 14 | qrc_*.cpp 15 | ui_*.h 16 | *.qmlc 17 | *.jsc 18 | Makefile* 19 | *build-* 20 | *.qm 21 | *.prl 22 | 23 | # Qt unit tests 24 | target_wrapper.* 25 | 26 | # QtCreator 27 | *.autosave 28 | 29 | # QtCreator Qml 30 | *.qmlproject.user 31 | *.qmlproject.user.* 32 | 33 | # QtCreator CMake 34 | CMakeLists.txt.user* 35 | 36 | # QtCreator 4.8< compilation database 37 | compile_commands.json 38 | 39 | # QtCreator local machine specific files for imported projects 40 | *creator.user* 41 | 42 | *_qmlcache.qrc 43 | .DS_Store 44 | 45 | *.rc 46 | 47 | plugin/include/Constants.h 48 | plugin/build/* -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "client/afv-native"] 2 | path = client/afv-native 3 | url = git@github.com:xpilot-project/afv-native.git 4 | [submodule "plugin/3rdparty/XPMP2"] 5 | path = plugin/3rdparty/XPMP2 6 | url = git@github.com:xpilot-project/XPMP2.git 7 | [submodule "plugin/3rdparty/imgui"] 8 | path = plugin/3rdparty/imgui 9 | url = git@github.com:ocornut/imgui.git 10 | [submodule "dependencies"] 11 | path = dependencies 12 | url = git@github.com:xpilot-project/dependencies.git 13 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to xPilot 2 | Thank you for your interest in contributing to the xPilot project! 3 | 4 | ## Contributions 5 | All contributions to this project should be made in the form of a GitHub pull request. Each pull request will be reviewed by the project owner. If the contribution is deemed to be beneficial, it will either be merged in or presented with feedback for changes that would be required. All accepted contributions will be licensed under [GPLv3](LICENSE). 6 | 7 | ## Getting started 8 | The first thing you should do is search through the [issues](https://github.com/xpilot-project/xpilot/issues) and [pull requests](https://github.com/xpilot-project/xpilot/pulls) to see if someone else had a similar idea or question. 9 | 10 | Pull requests are the easiest (and most preferred) way to contribute changes because they offer a clean way for commenting and revising of proposed changes. 11 | 12 | 1. Create a [GitHub account](https://github.com/join) if you don't already have one. 13 | 2. `Fork` the project repository by clicking the **Fork** button on top right of the repository page. ![fork](https://docs.github.com/assets/cb-23088/images/help/repository/fork_button.png) 14 | 3. `Clone` your forked repository `git clone https://github.com/xpilot-project/xpilot.git` 15 | 4. Add a new feature branch `git checkout -b my-feature-branch` 16 | 5. Make changes to the code and commit them locally (your commit message should describe what the changes are) 17 | 6. Push your new branch to your fork on GitHub `git push -u origin my-feature-branch` 18 | 7. From your forked GitHub repository, open a pull request in the branch that contains your contributions. If you need to add additional commits to your pull request, you can commit the changes to your local branch and then use the `git push` command to automatically update your pull request. 19 | 8. At this point, your contribution has been submitted for review. Any comments about your contribution will be posted in the pull request. 20 | 9. If your contributions are approved, your pull request will be merged into the main project. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # About 2 | xPilot is a cross-platform X-Plane pilot client for VATSIM, supporting Windows, Linux and macOS. 3 | 4 | # Download 5 | [![Release](https://img.shields.io/github/v/release/xpilot-project/xpilot?include_prereleases&style=for-the-badge)][1] 6 | 7 | [1]: https://github.com/xpilot-project/xpilot/releases/latest 8 | 9 | # Resources 10 | :globe_with_meridians: [Documentation](https://docs.xpilot-project.org) 11 | 12 | :wave: [Discord](https://vats.im/xpilot-discord) 13 | 14 | # Contributing 15 | xPilot is written in C++ using the [Qt framework](https://www.qt.io/). Please read the [Contribution Guide](CONTRIBUTING.md) for details on how to contribute to the project. 16 | 17 | If you enjoy using xPilot, please considering donating to support the future development of the project. Thank you for your support. 18 | 19 | 20 | 21 | # Licensing 22 | xPilot is licensed under the [GPLv3 open-source license](LICENSE). 23 | 24 | # Acknowledgments 25 | * [Qt](https://www.qt.io) cross platform C++ development kit 26 | * [AFV-Native](https://github.com/xpilot-project/afv-native) cross platform Audio for VATSIM client implementation 27 | * [miniaudio](https://github.com/mackron/miniaudio) audio playback and capture library 28 | * [XPMP2](https://github.com/TwinFan/XPMP2) X-Plane multiplayer library 29 | * [MessagePack](https://msgpack.org/index.html) lightweight binary serialization format used for IPC messages 30 | * [nanomsg-NG](https://nng.nanomsg.org/) lightweight messaging library (used for IPC between xPilot and X-Plane) 31 | * [ImGui](https://github.com/ocornut/imgui) graphical user interface, used for the X-Plane plugin windows 32 | * Application icon created by [Freepik](https://www.flaticon.com/authors/freepik) 33 | * Cloud-based Mac hardware for testing and development sponsored by MacStadium 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /client/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleName 6 | xPilot 7 | CFBundleDisplayName 8 | xPilot 9 | CFBundleGetInfoString 10 | X-Plane pilot client for VATSIM 11 | CFBundleIconFile 12 | icon.icns 13 | CFBundleIdentifier 14 | org.vatsim.xpilot 15 | CFBundlePackageType 16 | APPL 17 | NSPrincipalClass 18 | NSApplication 19 | NSHighResolutionCapable 20 | 21 | NSMicrophoneUsageDescription 22 | Audio for VATSIM requires access to your microphone. 23 | 24 | -------------------------------------------------------------------------------- /client/Resources/Components/ConfigRequiredDialog.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2 | import QtQuick.Controls 3 | import QtQuick.Controls.Basic 4 | import QtQuick.Window 5 | import QtQuick.Layouts 6 | import "../Controls" 7 | 8 | Popup { 9 | id: popup 10 | width: 550 11 | height: 160 12 | x: (parent.width - width) / 2 13 | y: (parent.height - height) / 2 14 | modal: true 15 | focus: true 16 | closePolicy: Popup.NoAutoClose 17 | background: Rectangle { 18 | color: "white" 19 | border.color: "black" 20 | } 21 | 22 | Text { 23 | id: labelAskDownload 24 | text: "It looks like this may be the first time you've run xPilot on this computer. Some configuration items are required before you can connect to the network. Would you like to configure xPilot now?" 25 | width: 500 26 | wrapMode: Text.Wrap 27 | font.pixelSize: 14 28 | renderType: Text.NativeRendering 29 | x: 20 30 | y: 20 31 | } 32 | 33 | BlueButton { 34 | id: btnYes 35 | text: "Yes" 36 | width: 50 37 | height: 30 38 | font.pixelSize: 14 39 | anchors.top: labelAskDownload.bottom 40 | anchors.left: labelAskDownload.left 41 | anchors.topMargin: 15 42 | MouseArea { 43 | anchors.fill: parent 44 | cursorShape: Qt.PointingHandCursor 45 | onClicked: { 46 | popup.close() 47 | createSettingsWindow() 48 | } 49 | } 50 | } 51 | 52 | GrayButton { 53 | id: btnNo 54 | text: "No" 55 | width: 50 56 | height: 30 57 | font.pixelSize: 14 58 | anchors.top: labelAskDownload.bottom 59 | anchors.left: btnYes.right 60 | anchors.topMargin: 15 61 | anchors.leftMargin: 10 62 | MouseArea { 63 | anchors.fill: parent 64 | cursorShape: Qt.PointingHandCursor 65 | onClicked: { 66 | popup.close() 67 | } 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /client/Resources/Components/DisconnectDialog.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2 | import QtQuick.Controls 3 | import QtQuick.Controls.Basic 4 | import QtQuick.Window 5 | import QtQuick.Layouts 6 | import "../Controls" 7 | 8 | Popup { 9 | id: popup 10 | width: 550 11 | height: 150 12 | x: (parent.width - width) / 2 13 | y: (parent.height - height) / 2 14 | modal: true 15 | focus: true 16 | closePolicy: Popup.NoAutoClose 17 | background: Rectangle { 18 | color: "white" 19 | border.color: "black" 20 | } 21 | 22 | signal exitApplication() 23 | 24 | Text { 25 | id: lblAskDisconnect 26 | text: "You are still connected to the network. Are you sure you want to close xPilot?" 27 | width: 500 28 | wrapMode: Text.Wrap 29 | font.pixelSize: 14 30 | renderType: Text.NativeRendering 31 | x: 20 32 | y: 20 33 | } 34 | 35 | BlueButton { 36 | id: btnYes 37 | text: "Yes" 38 | width: 50 39 | height: 30 40 | font.pixelSize: 14 41 | anchors.top: lblAskDisconnect.bottom 42 | anchors.left: lblAskDisconnect.left 43 | anchors.topMargin: 15 44 | MouseArea { 45 | anchors.fill: parent 46 | cursorShape: Qt.PointingHandCursor 47 | onClicked: { 48 | exitApplication() 49 | } 50 | } 51 | } 52 | 53 | GrayButton { 54 | id: btnNo 55 | text: "No" 56 | width: 50 57 | height: 30 58 | font.pixelSize: 14 59 | anchors.top: lblAskDisconnect.bottom 60 | anchors.left: btnYes.right 61 | anchors.topMargin: 15 62 | anchors.leftMargin: 10 63 | MouseArea { 64 | anchors.fill: parent 65 | cursorShape: Qt.PointingHandCursor 66 | onClicked: { 67 | popup.close() 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /client/Resources/Components/InvalidTypeCodeDialog.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2 | import QtQuick.Controls 3 | import QtQuick.Controls.Basic 4 | import QtQuick.Window 5 | import QtQuick.Layouts 6 | import "../Controls" 7 | 8 | Popup { 9 | id: popup 10 | width: 550 11 | height: 180 12 | x: (parent.width - width) / 2 13 | y: (parent.height - height) / 2 14 | modal: true 15 | focus: true 16 | closePolicy: Popup.NoAutoClose 17 | 18 | background: Rectangle { 19 | color: "white" 20 | border.color: "black" 21 | } 22 | 23 | Overlay.modal: Rectangle { 24 | color: "transparent" 25 | } 26 | 27 | signal useInvalidTypeCode() 28 | 29 | Text { 30 | id: lblAskDisconnect 31 | text: "The aircraft type code you entered appears to be invalid. Using an invalid type code can make your aircraft render incorrectly for other users.\n\nAre you sure you want to connect using an invalid type code?" 32 | width: 500 33 | wrapMode: Text.Wrap 34 | font.pixelSize: 14 35 | renderType: Text.NativeRendering 36 | x: 20 37 | y: 20 38 | } 39 | 40 | BlueButton { 41 | id: btnYes 42 | text: "Yes" 43 | width: 50 44 | height: 30 45 | font.pixelSize: 14 46 | anchors.top: lblAskDisconnect.bottom 47 | anchors.left: lblAskDisconnect.left 48 | anchors.topMargin: 15 49 | MouseArea { 50 | anchors.fill: parent 51 | cursorShape: Qt.PointingHandCursor 52 | onClicked: { 53 | useInvalidTypeCode() 54 | popup.close() 55 | } 56 | } 57 | } 58 | 59 | GrayButton { 60 | id: btnNo 61 | text: "No" 62 | width: 50 63 | height: 30 64 | font.pixelSize: 14 65 | anchors.top: lblAskDisconnect.bottom 66 | anchors.left: btnYes.right 67 | anchors.topMargin: 15 68 | anchors.leftMargin: 10 69 | MouseArea { 70 | anchors.fill: parent 71 | cursorShape: Qt.PointingHandCursor 72 | onClicked: { 73 | popup.close() 74 | } 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /client/Resources/Components/MicrophoneCalibrationRequired.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2 | import QtQuick.Controls 3 | import QtQuick.Controls.Basic 4 | import QtQuick.Window 5 | import QtQuick.Layouts 6 | import "../Controls" 7 | 8 | Popup { 9 | id: popup 10 | width: 550 11 | height: 240 12 | x: (parent.width - width) / 2 13 | y: (parent.height - height) / 2 14 | focus: true 15 | closePolicy: Popup.NoAutoClose 16 | background: Rectangle { 17 | color: "white" 18 | border.color: "black" 19 | } 20 | 21 | Text { 22 | id: popupText 23 | text: "Microphone Calibration Required

Please make sure you have calibrated your microphone volume in the xPilot Settings. Click Settings and verify the microphone level indicator stays green when you speak normally. Use the Mic Volume slider to adjust the microphone volume if necessary.

After you've calibrated your microphone (or if you already have), click Connect again." 24 | width: 500 25 | wrapMode: Text.Wrap 26 | font.pixelSize: 14 27 | renderType: Text.NativeRendering 28 | x: 10 29 | y: 10 30 | } 31 | 32 | BlueButton { 33 | id: btnOk 34 | text: "OK" 35 | width: 50 36 | height: 30 37 | font.pixelSize: 14 38 | anchors.top: popupText.bottom 39 | anchors.left: popupText.left 40 | anchors.topMargin: 10 41 | MouseArea { 42 | anchors.fill: parent 43 | cursorShape: Qt.PointingHandCursor 44 | onClicked: { 45 | popup.close() 46 | } 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /client/Resources/Components/VersionCheck/NewVersionAvailable.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2 | import QtQuick.Controls 3 | import QtQuick.Controls.Basic 4 | import QtQuick.Window 5 | import QtQuick.Layouts 6 | import "../../Controls" 7 | 8 | Popup { 9 | id: popup 10 | width: 550 11 | height: 150 12 | x: (parent.width - width) / 2 13 | y: (parent.height - height) / 2 14 | modal: true 15 | focus: true 16 | closePolicy: Popup.NoAutoClose 17 | background: Rectangle { 18 | color: "white" 19 | border.color: "black" 20 | } 21 | 22 | Text { 23 | id: labelAskDownload 24 | text: "A new version of xPilot is available. Would you like to download and install it now?" 25 | width: 500 26 | wrapMode: Text.Wrap 27 | font.pixelSize: 14 28 | renderType: Text.NativeRendering 29 | x: 20 30 | y: 20 31 | } 32 | 33 | BlueButton { 34 | id: btnYes 35 | text: "Yes" 36 | width: 50 37 | height: 30 38 | font.pixelSize: 14 39 | anchors.top: labelAskDownload.bottom 40 | anchors.left: labelAskDownload.left 41 | anchors.topMargin: 15 42 | MouseArea { 43 | anchors.fill: parent 44 | cursorShape: Qt.PointingHandCursor 45 | onClicked: { 46 | versionCheck.downloadInstaller() 47 | popup.close() 48 | } 49 | } 50 | } 51 | 52 | GrayButton { 53 | id: btnNo 54 | text: "No" 55 | width: 50 56 | height: 30 57 | font.pixelSize: 14 58 | anchors.top: labelAskDownload.bottom 59 | anchors.left: btnYes.right 60 | anchors.topMargin: 15 61 | anchors.leftMargin: 10 62 | MouseArea { 63 | anchors.fill: parent 64 | cursorShape: Qt.PointingHandCursor 65 | onClicked: { 66 | popup.close() 67 | } 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /client/Resources/Controls/BlueButton.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2 | import QtQuick.Controls 3 | import QtQuick.Controls.Basic 4 | 5 | Button { 6 | id: btn 7 | height: 35 8 | contentItem: Text { 9 | color: '#ffffff' 10 | text: btn.text 11 | font.pixelSize: btn.font.pixelSize 12 | horizontalAlignment: Text.AlignHCenter 13 | verticalAlignment: Text.AlignVCenter 14 | renderType: Text.NativeRendering 15 | } 16 | MouseArea { 17 | id: btnMouseArea 18 | hoverEnabled: true 19 | anchors.fill: parent 20 | cursorShape: Qt.PointingHandCursor 21 | } 22 | background: Rectangle { 23 | color: btnMouseArea.pressed ? '#013257' : btnMouseArea.containsMouse ? '#01508a' : '#0164ad' 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /client/Resources/Controls/CustomBorder.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2 | 3 | Rectangle { 4 | id: control 5 | 6 | property bool commonBorder: true 7 | 8 | property int leftBorderWidth: 1 9 | property int rightBorderWidth: 1 10 | property int topBorderWidth: 1 11 | property int bottomBorderWidth: 1 12 | 13 | property int commonBorderWidth: 1 14 | property string borderColor: "black" 15 | 16 | z: -1 17 | color: borderColor 18 | 19 | anchors { 20 | left: parent.left 21 | right: parent.right 22 | top: parent.top 23 | bottom: parent.bottom 24 | 25 | topMargin: commonBorder ? -commonBorderWidth : -topBorderWidth 26 | bottomMargin: commonBorder ? -commonBorderWidth : -bottomBorderWidth 27 | leftMargin: commonBorder ? -commonBorderWidth : -leftBorderWidth 28 | rightMargin: commonBorder ? -commonBorderWidth : -rightBorderWidth 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /client/Resources/Controls/CustomCheckBox.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2 | import QtQuick.Controls 3 | import QtQuick.Controls.Basic 4 | 5 | CheckBox { 6 | id: control 7 | indicator.height: 15 8 | indicator.width: 15 9 | padding: 0 10 | contentItem: Text { 11 | text: control.text 12 | font.pixelSize: 13 13 | opacity: enabled ? 1.0 : 0.3 14 | color: "#0164AD" 15 | verticalAlignment: Text.AlignVCenter 16 | leftPadding: control.indicator.width + control.spacing 17 | renderType: Text.NativeRendering 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /client/Resources/Controls/CustomSwitch.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2 | import QtQuick.Controls 3 | import QtQuick.Controls.Basic 4 | 5 | Switch { 6 | id: control 7 | 8 | property string tooltipText: "" 9 | 10 | indicator: Rectangle { 11 | implicitWidth: 30 12 | implicitHeight: 15 13 | x: control.leftPadding 14 | y: parent.height / 2 - height / 2 15 | radius: 18 16 | color: control.checked ? "#0164AD" : "#ffffff" 17 | border.color: control.checked ? "#0164AD" : "#ADB5BD" 18 | z: 100 19 | 20 | Rectangle { 21 | x: control.checked ? parent.width - width : 0 22 | width: 15 23 | height: 15 24 | radius: 18 25 | color: control.checked ? "#ffffff" : "#ADB5BD" 26 | border.color: control.checked ? "#0164AD" : "#ADB5BD" 27 | } 28 | } 29 | 30 | contentItem: Text { 31 | id: label 32 | text: control.text 33 | font.pixelSize: 13 34 | opacity: enabled ? 1.0 : 0.3 35 | color: "#000000" 36 | verticalAlignment: Text.AlignVCenter 37 | leftPadding: control.indicator.width + control.spacing 38 | wrapMode: Text.WordWrap 39 | renderType: Text.NativeRendering 40 | 41 | MouseArea { 42 | anchors.fill: parent 43 | hoverEnabled: tooltipText !== "" 44 | propagateComposedEvents: true 45 | 46 | onEntered: { 47 | label.ToolTip.visible = true 48 | } 49 | 50 | onExited: { 51 | label.ToolTip.visible = false 52 | } 53 | 54 | onClicked: (mouse) => mouse.accepted = false 55 | onPressed: (mouse) => mouse.accepted = false 56 | onReleased: (mouse) => mouse.accepted = false 57 | onDoubleClicked: (mouse) => mouse.accepted = false 58 | onPositionChanged: (mouse) => mouse.accepted = false 59 | onPressAndHold: (mouse) => mouse.accepted = false 60 | } 61 | 62 | ToolTip.visible: false 63 | ToolTip.text: tooltipText 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /client/Resources/Controls/GrayButton.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2 | import QtQuick.Controls 3 | import QtQuick.Controls.Basic 4 | 5 | Button { 6 | id: btn 7 | height: 35 8 | contentItem: Text { 9 | color: '#ffffff' 10 | text: btn.text 11 | font.pixelSize: btn.font.pixelSize 12 | horizontalAlignment: Text.AlignHCenter 13 | verticalAlignment: Text.AlignVCenter 14 | renderType: Text.NativeRendering 15 | } 16 | MouseArea { 17 | id: btnMouseArea 18 | hoverEnabled: true 19 | anchors.fill: parent 20 | cursorShape: Qt.PointingHandCursor 21 | } 22 | background: Rectangle { 23 | color: btnMouseArea.pressed ? '#363b3f' : btnMouseArea.containsMouse ? '#565e64' : btn.enabled ? '#6c757d' : '#c1c1c1' 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /client/Resources/Controls/PeakLevelControl.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2 | import QtQuick.Controls 3 | import QtQuick.Controls.Basic 4 | 5 | Rectangle { 6 | id: root 7 | 8 | property double minimum: 0 9 | property double maximum: 1 10 | property double value: 0 11 | 12 | width: parent.width 13 | height: 15 14 | color: '#ced0d2' 15 | radius: 20 16 | 17 | Rectangle { 18 | visible: value > minimum 19 | x: 0.1 * root.height 20 | y: 0.1 * root.height 21 | width: Math.max(height, Math.min((value - minimum) / (maximum - minimum) * (parent.width - 0.2 * root.height), parent.width - 0.2 * root.height)) 22 | height: 0.8 * root.height 23 | color: (value < 0.70) ? '#0164AD' : (value >= 0.70 && value < 0.90) ? '#28A745' : '#DC3545' 24 | radius: parent.radius 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /client/Resources/Controls/RadioStackIndicator.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2 | 3 | Rectangle { 4 | property bool isEnabled: false 5 | property bool isActive: false 6 | property string label: "XX" 7 | 8 | id: indicator 9 | width: 25 10 | height: 20 11 | color: isEnabled ? (isActive ? '#27ae60' : '#015a9b') : '#0162A9' 12 | anchors.verticalCenter: parent.verticalCenter 13 | border { 14 | color: isEnabled ? '#00080e' : '#01528D' 15 | } 16 | Text { 17 | id: txLabel 18 | text: label 19 | anchors.fill: parent 20 | font.pixelSize: 10 21 | font.family: robotoMono.name 22 | font.bold: true 23 | horizontalAlignment: Text.AlignHCenter 24 | verticalAlignment: Text.AlignVCenter 25 | opacity: isEnabled ? 1 : 0.2 26 | color: "#ffffff" 27 | renderType: Text.NativeRendering 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /client/Resources/Controls/StandardButton.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2 | import QtQuick.Controls 3 | import QtQuick.Controls.Basic 4 | 5 | Button { 6 | id: control 7 | 8 | implicitWidth: Math.max(implicitContentWidth + 20, 80) 9 | implicitHeight: 24 10 | 11 | signal clicked() 12 | 13 | contentItem: Text { 14 | color: control.enabled ? "#000000" : "#bababa" 15 | text: control.text 16 | font.pixelSize: 13 17 | horizontalAlignment: Text.AlignHCenter 18 | verticalAlignment: Text.AlignVCenter 19 | renderType: Text.NativeRendering 20 | } 21 | 22 | MouseArea { 23 | id: mouseArea 24 | hoverEnabled: true 25 | anchors.fill: parent 26 | cursorShape: Qt.PointingHandCursor 27 | onClicked: control.clicked() 28 | } 29 | 30 | background: Rectangle { 31 | border.color: control.enabled ? (mouseArea.containsMouse ? "#006bbe" : "#bababa") : "#dcdcdc" 32 | color: control.enabled ? (mouseArea.pressed ? "#cce4f7" : mouseArea.containsMouse ? "#e0eef9" : "#ffffff") : "#f9f9f9" 33 | border.width: 1 34 | radius: 4 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /client/Resources/Controls/ToolbarButton.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2 | import QtQuick.Controls 3 | import QtQuick.Controls.Basic 4 | 5 | Button { 6 | id: button 7 | x: 20 8 | checked: false 9 | checkable: false 10 | text: qsTr("BUTTON") 11 | font.pixelSize: 13 12 | anchors.verticalCenter: parent.verticalCenter 13 | anchors.verticalCenterOffset: 0 14 | width: text.contentWidth 15 | height: 30 16 | 17 | property bool active: false 18 | 19 | MouseArea { 20 | id: btnMouseArea 21 | hoverEnabled: true 22 | anchors.fill: parent 23 | cursorShape: Qt.PointingHandCursor 24 | } 25 | 26 | background: Rectangle { 27 | color: active ? "#0164AD" : (btnMouseArea.pressed ? "#a7acb1" : button.enabled && btnMouseArea.containsMouse ? "#565e64" : "transparent") 28 | opacity: button.enabled ? 1 : 0.5 29 | border.color: active ? '#0078CE' : '#6c757d' 30 | } 31 | 32 | contentItem: Text { 33 | color: (active || enabled) ? "#ffffff" : "#6c757d" 34 | text: button.text.toUpperCase() 35 | font.pixelSize: button.font.pixelSize 36 | horizontalAlignment: Text.AlignHCenter 37 | verticalAlignment: Text.AlignVCenter 38 | fontSizeMode: Text.FixedSize 39 | opacity: button.enabled ? 1 : 0.5 40 | font.styleName: Font.Normal 41 | font.family: robotoMono.name 42 | renderType: Text.NativeRendering 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /client/Resources/Controls/TransparentButton.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2 | import QtQuick.Controls 3 | import QtQuick.Controls.Basic 4 | 5 | Button { 6 | id: button 7 | anchors.verticalCenter: parent.verticalCenter 8 | checked: false 9 | checkable: false 10 | background: Rectangle { 11 | color: "transparent" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /client/Resources/Controls/TransponderButton.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2 | import QtQuick.Controls 3 | import QtQuick.Controls.Basic 4 | 5 | Button { 6 | property bool isActive: false 7 | 8 | id: button 9 | text: qsTr("Button") 10 | checked: false 11 | checkable: false 12 | font.pixelSize: 13 13 | anchors.verticalCenter: parent.verticalCenter 14 | anchors.verticalCenterOffset: 0 15 | width: text.contentWidth 16 | height: 30 17 | x: 20 18 | 19 | MouseArea { 20 | id: mouseArea 21 | hoverEnabled: true 22 | anchors.fill: parent 23 | cursorShape: Qt.PointingHandCursor 24 | } 25 | 26 | background: Rectangle { 27 | color: isActive ? (mouseArea.pressed ? "#145423" : button.enabled && mouseArea.containsMouse ? "#208637" : "#28a745") : button.enabled && mouseArea.containsMouse ? "#565e64" : "transparent" 28 | opacity: button.enabled ? 1 : 0.5 29 | border.color: isActive ? (mouseArea.pressed ? "#145423" : "#28a745") : "#6c757d" 30 | } 31 | 32 | contentItem: Text { 33 | id: label 34 | color: button.enabled || (button.enabled && isActive) || (button.enabled && mouseArea.pressed) || (button.enabled && mouseArea.containsMouse) ? "#ffffff" : "#6c757d" 35 | text: button.text.toUpperCase() 36 | font.pixelSize: button.font.pixelSize 37 | font.family: robotoMono.name 38 | font.styleName: Font.Normal 39 | opacity: button.enabled ? 1 : 0.5 40 | horizontalAlignment: Text.AlignHCenter 41 | verticalAlignment: Text.AlignVCenter 42 | renderType: Text.NativeRendering 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /client/Resources/Controls/VerticalTabBar.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2 | import QtQuick.Controls 3 | import QtQuick.Layouts 4 | import QtQuick.Window 5 | 6 | TabBar { 7 | id: control 8 | width: parent.width 9 | background: Rectangle { 10 | color: "#f0f0f0" 11 | } 12 | 13 | contentItem: ListView { 14 | width: control.width 15 | height: control.height 16 | model: control.contentModel 17 | currentIndex: control.currentIndex 18 | 19 | spacing: control.spacing 20 | orientation: ListView.Vertical 21 | boundsBehavior: Flickable.StopAtBounds 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /client/Resources/Controls/VerticalTabButton.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2 | import QtQuick.Controls 3 | 4 | TabButton { 5 | id: control 6 | width: parent.width 7 | padding: 0 8 | font.pixelSize: 13 9 | 10 | contentItem: Text { 11 | text: control.text 12 | font: control.font 13 | color: control.checked ? "#ffffff" : "#000000" 14 | horizontalAlignment: Text.AlignLeft 15 | verticalAlignment: Text.AlignVCenter 16 | elide: Text.ElideRight 17 | renderType: Text.NativeRendering 18 | leftPadding: 8 19 | } 20 | 21 | background: Rectangle { 22 | implicitHeight: 30 23 | color: control.checked ? "#0164AC" : "transparent" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /client/Resources/Fonts/OpenSans.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xpilot-project/xpilot/20e1d45c152151805430ed190ec5478fccfcf7d9/client/Resources/Fonts/OpenSans.ttf -------------------------------------------------------------------------------- /client/Resources/Fonts/Roboto-Mono.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xpilot-project/xpilot/20e1d45c152151805430ed190ec5478fccfcf7d9/client/Resources/Fonts/Roboto-Mono.ttf -------------------------------------------------------------------------------- /client/Resources/Fonts/Ubuntu-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xpilot-project/xpilot/20e1d45c152151805430ed190ec5478fccfcf7d9/client/Resources/Fonts/Ubuntu-Regular.ttf -------------------------------------------------------------------------------- /client/Resources/Icons/AppIcon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xpilot-project/xpilot/20e1d45c152151805430ed190ec5478fccfcf7d9/client/Resources/Icons/AppIcon.ico -------------------------------------------------------------------------------- /client/Resources/Icons/AppIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xpilot-project/xpilot/20e1d45c152151805430ed190ec5478fccfcf7d9/client/Resources/Icons/AppIcon.png -------------------------------------------------------------------------------- /client/Resources/Icons/ChevronDown.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /client/Resources/Icons/CloseIcon.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /client/Resources/Icons/HeadsetIcon.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /client/Resources/Icons/MaximizeIcon.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /client/Resources/Icons/MinimizeIcon.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /client/Resources/Icons/SpeakerIcon.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /client/Resources/Samples/AC_Bus.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xpilot-project/xpilot/20e1d45c152151805430ed190ec5478fccfcf7d9/client/Resources/Samples/AC_Bus.wav -------------------------------------------------------------------------------- /client/Resources/Samples/Click.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xpilot-project/xpilot/20e1d45c152151805430ed190ec5478fccfcf7d9/client/Resources/Samples/Click.wav -------------------------------------------------------------------------------- /client/Resources/Samples/Crackle.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xpilot-project/xpilot/20e1d45c152151805430ed190ec5478fccfcf7d9/client/Resources/Samples/Crackle.wav -------------------------------------------------------------------------------- /client/Resources/Samples/HF_WhiteNoise.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xpilot-project/xpilot/20e1d45c152151805430ed190ec5478fccfcf7d9/client/Resources/Samples/HF_WhiteNoise.wav -------------------------------------------------------------------------------- /client/Resources/Samples/WhiteNoise.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xpilot-project/xpilot/20e1d45c152151805430ed190ec5478fccfcf7d9/client/Resources/Samples/WhiteNoise.wav -------------------------------------------------------------------------------- /client/Resources/Scripts/FrequencyUtils.js: -------------------------------------------------------------------------------- 1 | .pragma library 2 | 3 | function checkFrequencyValid(frequency) { 4 | if (frequency < 118000000 || frequency > 136975000) { 5 | throw "Invalid frequency range." 6 | } 7 | return frequency 8 | } 9 | 10 | function normalize25KhzFrequency(freq) { 11 | if(!isNaN(freq)) { 12 | if(freq > 1000000) { 13 | freq /= 1000.0 14 | } 15 | if (freq % 100 == 20 || freq % 100 == 70) { 16 | freq += 5 17 | } 18 | return freq 19 | } 20 | else { 21 | if (String(freq).indexOf(".") < 3) { 22 | return freq 23 | } 24 | let freq2 = parseInt(String(freq).replace(".", "")) * Math.pow(10.0, 9 - (String(freq).length - 1)) 25 | let text = normalize25KhzFrequency(freq2).toString() 26 | return text.substring(0, 3) + "." + text.substring(3) 27 | } 28 | } 29 | 30 | function frequencyToInt(freq) { 31 | let num = Math.round(parseFloat(freq.trim()) * 1000000.0) 32 | num = checkFrequencyValid(num) 33 | return toXplaneFormat(normalize25KhzFrequency(num)) 34 | } 35 | 36 | function toXplaneFormat(freq) { 37 | if(freq < 1000000) { 38 | return freq 39 | } 40 | return freq / 1000 41 | } 42 | 43 | function printFrequency(frequency) { 44 | if(frequency > 0) { 45 | return (normalize25KhzFrequency(frequency) / 1000.0).toFixed(3) 46 | } 47 | return "---.---" 48 | } 49 | 50 | function fromNetworkFormat(freq) { 51 | return (normalize25KhzFrequency(freq + 100000.0) / 1000.0).toFixed(3) 52 | } 53 | -------------------------------------------------------------------------------- /client/Resources/Scripts/StringUtils.js: -------------------------------------------------------------------------------- 1 | String.prototype.linkify = function() { 2 | 3 | // http://, https://, ftp:// 4 | var urlPattern = /\b(?:https?|ftp):\/\/[a-z0-9-+&@#\/%?=~_|!:,.;]*[a-z0-9-+&@#\/%=~_|]/gim 5 | 6 | // www. sans http:// or https:// 7 | var pseudoUrlPattern = /(^|[^\/])(www\.[\S]+(\b|$))/gim 8 | 9 | // Email addresses 10 | var emailAddressPattern = /[\w.]+@[a-zA-Z_-]+?(?:\.[a-zA-Z]{2,6})+/gim 11 | 12 | return this 13 | .replace(urlPattern, '$&') 14 | .replace(pseudoUrlPattern, '$1$2') 15 | .replace(emailAddressPattern, '$&') 16 | } 17 | -------------------------------------------------------------------------------- /client/Resources/Scripts/TimestampUtils.js: -------------------------------------------------------------------------------- 1 | .pragma library 2 | 3 | function currentTimestamp() { 4 | var dt = new Date() 5 | const h = dt.getUTCHours() < 10 ? "0" + dt.getUTCHours() : dt.getUTCHours() 6 | const m = dt.getUTCMinutes() < 10 ? "0" + dt.getUTCMinutes() : dt.getUTCMinutes() 7 | const s = dt.getUTCSeconds() < 10 ? "0" + dt.getUTCSeconds() : dt.getUTCSeconds() 8 | return `${h}:${m}:${s}` 9 | } 10 | -------------------------------------------------------------------------------- /client/Resources/Sounds/Alert.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xpilot-project/xpilot/20e1d45c152151805430ed190ec5478fccfcf7d9/client/Resources/Sounds/Alert.wav -------------------------------------------------------------------------------- /client/Resources/Sounds/Broadcast.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xpilot-project/xpilot/20e1d45c152151805430ed190ec5478fccfcf7d9/client/Resources/Sounds/Broadcast.wav -------------------------------------------------------------------------------- /client/Resources/Sounds/DirectRadioMessage.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xpilot-project/xpilot/20e1d45c152151805430ed190ec5478fccfcf7d9/client/Resources/Sounds/DirectRadioMessage.wav -------------------------------------------------------------------------------- /client/Resources/Sounds/Error.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xpilot-project/xpilot/20e1d45c152151805430ed190ec5478fccfcf7d9/client/Resources/Sounds/Error.wav -------------------------------------------------------------------------------- /client/Resources/Sounds/NewMessage.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xpilot-project/xpilot/20e1d45c152151805430ed190ec5478fccfcf7d9/client/Resources/Sounds/NewMessage.wav -------------------------------------------------------------------------------- /client/Resources/Sounds/PrivateMessage.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xpilot-project/xpilot/20e1d45c152151805430ed190ec5478fccfcf7d9/client/Resources/Sounds/PrivateMessage.wav -------------------------------------------------------------------------------- /client/Resources/Sounds/RadioMessage.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xpilot-project/xpilot/20e1d45c152151805430ed190ec5478fccfcf7d9/client/Resources/Sounds/RadioMessage.wav -------------------------------------------------------------------------------- /client/Resources/Sounds/SELCAL.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xpilot-project/xpilot/20e1d45c152151805430ed190ec5478fccfcf7d9/client/Resources/Sounds/SELCAL.wav -------------------------------------------------------------------------------- /client/Resources/Ui/Colors.js: -------------------------------------------------------------------------------- 1 | .pragma library 2 | 3 | var Green = "#85A664" 4 | var Orange = "#FFA500" 5 | var White = "#FFFFFF" 6 | var Gray = "#C0C0C0" 7 | var Yellow = "#FFFF00" 8 | var Red = "#FF0000" 9 | var Cyan = "#00FFFF" 10 | var LimeGreen = "#00C000" 11 | var Magenta = "#FF00FF" 12 | var Plum = "#DDA0DD" 13 | var LightGray = "#E0E0E0" 14 | var IndianRed = "#CD5C5C" 15 | -------------------------------------------------------------------------------- /client/Resources/Views/Settings/SettingsMiscellaneous.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2 | import QtQuick.Controls 3 | import QtQuick.Layouts 4 | 5 | import org.vatsim.xpilot 6 | import "../../Controls" 7 | 8 | Item { 9 | 10 | signal applyChanges() 11 | 12 | Component.onCompleted: { 13 | switchAutoModeC.checked = AppConfig.AutoModeC 14 | switchKeepWindowVisible.checked = AppConfig.KeepWindowVisible 15 | } 16 | 17 | ColumnLayout { 18 | spacing: 10 19 | width: parent.width 20 | 21 | CustomSwitch { 22 | id: switchAutoModeC 23 | text: "Automatically set transponder to Mode C on takeoff" 24 | font.pixelSize: 13 25 | onCheckedChanged: { 26 | AppConfig.AutoModeC = switchAutoModeC.checked 27 | applyChanges() 28 | } 29 | } 30 | 31 | CustomSwitch { 32 | id: switchKeepWindowVisible 33 | text: "Keep xPilot window visible" 34 | font.pixelSize: 13 35 | onCheckedChanged: { 36 | AppConfig.KeepWindowVisible = switchKeepWindowVisible.checked 37 | applyChanges() 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /client/entitlements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.device.microphone 6 | 7 | com.apple.security.device.audio-input 8 | 9 | com.apple.security.cs.allow-dyld-environment-variables 10 | 11 | com.apple.security.cs.allow-unsigned-executable-memory 12 | 13 | 14 | -------------------------------------------------------------------------------- /client/icon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xpilot-project/xpilot/20e1d45c152151805430ed190ec5478fccfcf7d9/client/icon.icns -------------------------------------------------------------------------------- /client/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xpilot-project/xpilot/20e1d45c152151805430ed190ec5478fccfcf7d9/client/icon.ico -------------------------------------------------------------------------------- /client/src/aircrafts/aircraft_visual_state.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef AIRCRAFT_VISUAL_STATE_H 20 | #define AIRCRAFT_VISUAL_STATE_H 21 | 22 | struct AircraftVisualState 23 | { 24 | double Latitude; 25 | double Longitude; 26 | double Altitude; 27 | double AltitudeAgl; 28 | double Pitch; 29 | double Heading; 30 | double Bank; 31 | double NoseWheelAngle; 32 | 33 | bool operator==(const AircraftVisualState& rhs) const 34 | { 35 | return Latitude == rhs.Latitude && Longitude == rhs.Longitude && Altitude == rhs.Altitude && AltitudeAgl == rhs.AltitudeAgl 36 | && Pitch == rhs.Pitch && Heading == rhs.Heading && Bank == rhs.Bank && NoseWheelAngle == rhs.NoseWheelAngle; 37 | } 38 | 39 | bool operator!=(const AircraftVisualState& rhs) const 40 | { 41 | return Latitude != rhs.Latitude || Longitude != rhs.Longitude || Altitude != rhs.Altitude || AltitudeAgl != rhs.AltitudeAgl 42 | || Pitch != rhs.Pitch || Heading != rhs.Heading || Bank != rhs.Bank || NoseWheelAngle != rhs.NoseWheelAngle; 43 | } 44 | }; 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /client/src/aircrafts/network_aircraft.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef AIRCRAFT_H 20 | #define AIRCRAFT_H 21 | 22 | #include 23 | 24 | #include 25 | #include 26 | 27 | #include "aircraft_visual_state.h" 28 | #include "aircraft_configuration.h" 29 | 30 | enum class AircraftStatus 31 | { 32 | New, 33 | Active, 34 | Ignored, 35 | Pending 36 | }; 37 | 38 | struct NetworkAircraft 39 | { 40 | QString Callsign; 41 | QString Airline; 42 | QString TypeCode; 43 | AircraftVisualState RemoteVisualState; 44 | std::optional Configuration; 45 | QDateTime LastUpdated; 46 | QDateTime LastSyncTime; 47 | AircraftStatus Status; 48 | bool HaveVelocities; 49 | double Speed; 50 | 51 | bool operator==(const NetworkAircraft& rhs) const 52 | { 53 | return Callsign == rhs.Callsign 54 | && Airline == rhs.Airline 55 | && TypeCode == rhs.TypeCode 56 | && RemoteVisualState == rhs.RemoteVisualState 57 | && LastUpdated == rhs.LastUpdated 58 | && Status == rhs.Status 59 | && HaveVelocities == rhs.HaveVelocities 60 | && Speed == rhs.Speed; 61 | } 62 | }; 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /client/src/aircrafts/user_aircraft_manager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef USER_AIRCRAFT_MANAGER_H 20 | #define USER_AIRCRAFT_MANAGER_H 21 | 22 | #include 23 | 24 | #include 25 | #include 26 | 27 | #include "network/networkmanager.h" 28 | #include "simulator/xplane_adapter.h" 29 | #include "aircrafts/user_aircraft_data.h" 30 | #include "aircrafts/user_aircraft_config_data.h" 31 | #include "aircrafts/radio_stack_state.h" 32 | #include "aircrafts/aircraft_configuration.h" 33 | #include "qinjection/dependencypointer.h" 34 | 35 | using namespace xpilot; 36 | 37 | class UserAircraftManager : public QObject 38 | { 39 | Q_OBJECT 40 | public: 41 | UserAircraftManager(QObject* parent = nullptr); 42 | 43 | private: 44 | void OnUserAircraftConfigDataUpdated(UserAircraftConfigData data); 45 | void OnRadioStackUpdated(RadioStackState radioStack); 46 | void OnAircraftConfigurationInfoReceived(QString from, QString json); 47 | 48 | private: 49 | NetworkManager& m_networkManager; 50 | XplaneAdapter& m_xplaneAdapter; 51 | 52 | QTimer m_tokenRefreshTimer; 53 | const int AcconfigTokenRefreshInterval = 5000; 54 | const int AcconfigMaxTokens = 10; 55 | int m_tokensAvailable = AcconfigMaxTokens; 56 | 57 | UserAircraftConfigData m_userAircraftConfigData; 58 | RadioStackState m_radioStackState; 59 | std::optional m_lastBroadcastConfig; 60 | bool m_airborne = false; 61 | bool m_simConnected = false; 62 | bool m_initialAircraftDataReceived = false; 63 | }; 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /client/src/aircrafts/velocity_vector.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef VELOCITY_VECTOR_H 20 | #define VELOCITY_VECTOR_H 21 | 22 | struct VelocityVector 23 | { 24 | double X; 25 | double Y; 26 | double Z; 27 | }; 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /client/src/appcore.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #pragma once 20 | 21 | namespace xpilot 22 | { 23 | int Main(int argc, char* argv[]); 24 | } 25 | -------------------------------------------------------------------------------- /client/src/audio/audiodeviceinfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef AUDIODEVICEINFO_H 20 | #define AUDIODEVICEINFO_H 21 | 22 | #include 23 | #include 24 | 25 | struct AudioDeviceInfo 26 | { 27 | Q_GADGET 28 | 29 | Q_PROPERTY(QString DeviceName MEMBER DeviceName) 30 | Q_PROPERTY(QString Id MEMBER Id) 31 | 32 | public: 33 | QString DeviceName; 34 | QString Id; 35 | 36 | bool operator==(const AudioDeviceInfo& b) const { 37 | return DeviceName == b.DeviceName && Id == b.Id; 38 | } 39 | bool operator!=(const AudioDeviceInfo& b) const { 40 | return DeviceName != b.DeviceName || Id != b.Id; 41 | } 42 | }; 43 | Q_DECLARE_METATYPE(AudioDeviceInfo) 44 | 45 | #endif // AUDIODEVICEINFO_H 46 | -------------------------------------------------------------------------------- /client/src/audio/notification_sound_engine.h: -------------------------------------------------------------------------------- 1 | #ifndef NOTIFICATION_SOUND_ENGINE_H 2 | #define NOTIFICATION_SOUND_ENGINE_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | namespace xpilot { 13 | 14 | enum SoundType { 15 | Alert, 16 | Broadcast, 17 | DirectRadioMessage, 18 | Error, 19 | NewMessage, 20 | PrivateMessage, 21 | RadioMessage, 22 | SELCAL 23 | }; 24 | 25 | class NotificationSoundEngine : public QObject 26 | { 27 | Q_OBJECT 28 | Q_PROPERTY(QVariant AudioDevices READ getOutputDevices NOTIFY outputDevicesChanged) 29 | 30 | public: 31 | explicit NotificationSoundEngine(QObject *parent = nullptr); 32 | ~NotificationSoundEngine(); 33 | 34 | Q_INVOKABLE void playAlert(); 35 | Q_INVOKABLE void playBroadcast(); 36 | Q_INVOKABLE void playDirectRadioMessage(); 37 | Q_INVOKABLE void playError(); 38 | Q_INVOKABLE void playNewMessage(); 39 | Q_INVOKABLE void playPrivateMessage(); 40 | Q_INVOKABLE void playRadioMessage(); 41 | Q_INVOKABLE void playSelcal(); 42 | 43 | Q_INVOKABLE void setNotificationAudioDevice(QString deviceName); 44 | 45 | QVariant getOutputDevices() const 46 | { 47 | QVariantList itemList; 48 | 49 | for(const auto&device : QMediaDevices::audioOutputs()) { 50 | QVariantMap itemMap; 51 | itemMap.insert("id", device.id()); 52 | itemMap.insert("name", device.description()); 53 | itemList.append(itemMap); 54 | } 55 | 56 | return QVariant::fromValue(itemList); 57 | } 58 | 59 | private: 60 | std::shared_ptr m_media_player; 61 | QString getSoundFilePath(SoundType sound); 62 | QAudioDevice getAudioDevice(QString deviceName); 63 | void playSound(SoundType sound); 64 | QAudioOutput m_audioOutput; 65 | QMediaDevices m_mediaDevices; 66 | 67 | signals: 68 | void outputDevicesChanged(); 69 | }; 70 | 71 | } 72 | 73 | #endif // NOTIFICATION_SOUND_ENGINE_H 74 | -------------------------------------------------------------------------------- /client/src/common/build_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef VATSIM_CONFIG_H 20 | #define VATSIM_CONFIG_H 21 | 22 | #include 23 | #include 24 | 25 | namespace xpilot 26 | { 27 | class BuildConfig 28 | { 29 | public: 30 | static const ushort TowerviewClientId(); 31 | static const ushort VatsimClientId(); 32 | static const QString VatsimClientKey(); 33 | static const quint64 ConfigEncryptionKey(); 34 | 35 | static constexpr bool isRunningOnMacOSPlatform(); 36 | static constexpr bool isRunningOnLinuxPlatform(); 37 | static constexpr bool isRunningOnWindowsPlatform(); 38 | static const QString getPlatformString(); 39 | 40 | static const QString versionCheckUrl(); 41 | 42 | static const QVersionNumber getVersion(); 43 | static const int getVersionInt(); 44 | static const QString getVersionString(); 45 | static const QString getShortVersionString(); 46 | static const QString getVersionStringPlatform(); 47 | 48 | static constexpr int versionMajor(); 49 | static constexpr int versionMinor(); 50 | static constexpr int versionPatch(); 51 | 52 | static bool isBetaVersion(); 53 | static const int versionBeta(); 54 | 55 | static const QString getSentryDsn(); 56 | }; 57 | } 58 | 59 | #define IN_BUILDCONFIG_H 60 | #include "build_config.inc" 61 | #undef IN_BUILDCONFIG_H 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /client/src/common/build_config.inc: -------------------------------------------------------------------------------- 1 | namespace xpilot 2 | { 3 | constexpr bool BuildConfig::isRunningOnWindowsPlatform() 4 | { 5 | #ifdef Q_OS_WIN 6 | return true; 7 | #else 8 | return false; 9 | #endif 10 | } 11 | 12 | constexpr bool BuildConfig::isRunningOnMacOSPlatform() 13 | { 14 | #ifdef Q_OS_MACOS 15 | return true; 16 | #else 17 | return false; 18 | #endif 19 | } 20 | 21 | constexpr bool BuildConfig::isRunningOnLinuxPlatform() 22 | { 23 | #ifdef Q_OS_LINUX 24 | return true; 25 | #else 26 | return false; 27 | #endif 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /client/src/common/clipboardadapter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef CLIPBOARDADAPTER_H 20 | #define CLIPBOARDADAPTER_H 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | class ClipboardAdapter : public QObject 28 | { 29 | Q_OBJECT 30 | 31 | public: 32 | explicit ClipboardAdapter(QObject *parent = 0) : QObject(parent) { 33 | clipboard = QGuiApplication::clipboard(); 34 | } 35 | 36 | Q_INVOKABLE void setText(QString text){ 37 | static QRegularExpression htmlTags("<[^>]*>"); 38 | text.remove(htmlTags); 39 | clipboard->setText(text, QClipboard::Clipboard); 40 | } 41 | Q_INVOKABLE QString getText(){ 42 | return clipboard->text(); 43 | } 44 | 45 | private: 46 | QClipboard* clipboard; 47 | }; 48 | 49 | #endif // CLIPBOARDADAPTER_H 50 | -------------------------------------------------------------------------------- /client/src/common/enums.h: -------------------------------------------------------------------------------- 1 | #ifndef ENUMS_H 2 | #define ENUMS_H 3 | 4 | #include 5 | 6 | namespace enums { 7 | 8 | Q_NAMESPACE 9 | 10 | enum class MessageType { 11 | Server, 12 | IncomingPrivate, 13 | OutgoingPrivate, 14 | TextOverride, 15 | IncomingRadioPrimary, 16 | IncomingRadioSecondary, 17 | OutgoingRadio, 18 | Broadcast, 19 | Wallop, 20 | Info, 21 | Error 22 | }; 23 | Q_ENUM_NS(MessageType) 24 | 25 | } 26 | 27 | #endif // ENUMS_H 28 | -------------------------------------------------------------------------------- /client/src/common/frequency_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef FREQUENCY_UTILS_H 20 | #define FREQUENCY_UTILS_H 21 | 22 | #include 23 | #include 24 | 25 | static uint Normalize25KhzFsdFrequency(uint freq) 26 | { 27 | if(freq % 100 == 20 || freq % 100 == 70) 28 | { 29 | freq += 5; 30 | } 31 | return freq; 32 | } 33 | 34 | static uint FromNetworkFormat(uint freq) 35 | { 36 | return (freq + 100000); 37 | } 38 | 39 | static uint Denormalize25KhzFsdFrequency(uint freq) 40 | { 41 | if((freq % 100) == 25 || (freq % 100) == 75) 42 | { 43 | freq -= 5; 44 | } 45 | return freq; 46 | } 47 | 48 | static uint MatchFsdFormat(uint freq) 49 | { 50 | QString tmp = QString::number(freq); 51 | tmp = tmp.mid(1, tmp.length() - 1); 52 | return tmp.toUInt(); 53 | } 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /client/src/common/installmodels.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef INSTALLMODELS_H 20 | #define INSTALLMODELS_H 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | class InstallModels : public QObject 30 | { 31 | Q_OBJECT 32 | 33 | public: 34 | InstallModels(QObject *parent = nullptr); 35 | ~InstallModels(); 36 | 37 | QtPromise::QPromise GetAuthToken(); 38 | QtPromise::QPromise ValidateAuthToken(const QString& token); 39 | QtPromise::QPromise DownloadModels(const QString& url); 40 | QtPromise::QPromise UnzipModels(const QString &path); 41 | void CreatePluginConfig(const QString &path); 42 | void DeleteTempDownload(); 43 | Q_INVOKABLE void downloadModels(); 44 | Q_INVOKABLE void validatePath(const QString path); 45 | Q_INVOKABLE void cancel(); 46 | 47 | signals: 48 | void downloadProgressChanged(double value); 49 | void setXplanePath(); 50 | void invalidXplanePath(QString errorText); 51 | void validXplanePath(); 52 | void unzipProgressChanged(double value); 53 | void unzipFinished(); 54 | void errorEncountered(QString error); 55 | void tokenValidationError(QString error); 56 | void downloadStarted(); 57 | 58 | private: 59 | QNetworkAccessManager *nam = nullptr; 60 | QPointer m_reply = nullptr; 61 | QPointer m_file = nullptr; 62 | bool m_stopExtract = false; 63 | }; 64 | 65 | #endif // INSTALLMODELS_H 66 | -------------------------------------------------------------------------------- /client/src/common/notificationtype.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef NOTIFICATIONTYPE_H 20 | #define NOTIFICATIONTYPE_H 21 | 22 | enum class NotificationType 23 | { 24 | Info, 25 | Warning, 26 | Error, 27 | TextMessage, 28 | ServerMessage, 29 | RadioMessageSent, 30 | RadioMessageReceived 31 | }; 32 | 33 | #endif // NOTIFICATIONTYPE_H 34 | -------------------------------------------------------------------------------- /client/src/common/runguard.cpp: -------------------------------------------------------------------------------- 1 | #include "runguard.h" 2 | 3 | #include 4 | 5 | QString generateKeyHash(const QString &key, const QString &salt) 6 | { 7 | QByteArray data; 8 | 9 | data.append(key.toUtf8()); 10 | data.append(salt.toUtf8()); 11 | data = QCryptographicHash::hash(data, QCryptographicHash::Sha1).toHex(); 12 | 13 | return data; 14 | } 15 | 16 | RunGuard::RunGuard(const QString &key) : 17 | key(key), 18 | memLockKey(generateKeyHash(key, "_memLockKey")), 19 | sharedmemKey(generateKeyHash(key, "_sharedmemKey")), 20 | sharedMem(sharedmemKey), 21 | memLock(memLockKey, 1) 22 | { 23 | memLock.acquire(); 24 | { 25 | QSharedMemory fix(sharedmemKey); 26 | fix.attach(); 27 | } 28 | memLock.release(); 29 | } 30 | 31 | RunGuard::~RunGuard() 32 | { 33 | release(); 34 | } 35 | 36 | bool RunGuard::isAnotherRunning() 37 | { 38 | if(sharedMem.isAttached()) { 39 | return false; 40 | } 41 | 42 | memLock.acquire(); 43 | const bool isRunning = sharedMem.attach(); 44 | if(isRunning) { 45 | sharedMem.detach(); 46 | } 47 | memLock.release(); 48 | 49 | return isRunning; 50 | } 51 | 52 | bool RunGuard::tryToRun() 53 | { 54 | if(isAnotherRunning()) { 55 | return false; 56 | } 57 | 58 | memLock.acquire(); 59 | const bool result = sharedMem.create(sizeof(quint64)); 60 | memLock.release(); 61 | 62 | if(!result) { 63 | release(); 64 | return false; 65 | } 66 | 67 | return true; 68 | } 69 | 70 | void RunGuard::release() 71 | { 72 | memLock.acquire(); 73 | if(sharedMem.isAttached()) { 74 | sharedMem.detach(); 75 | } 76 | memLock.release(); 77 | } 78 | -------------------------------------------------------------------------------- /client/src/common/runguard.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNGUARD_H 2 | #define RUNGUARD_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | class RunGuard 9 | { 10 | public: 11 | RunGuard(const QString &key); 12 | ~RunGuard(); 13 | 14 | bool isAnotherRunning(); 15 | bool tryToRun(); 16 | void release(); 17 | 18 | private: 19 | const QString key; 20 | const QString memLockKey; 21 | const QString sharedmemKey; 22 | 23 | QSharedMemory sharedMem; 24 | QSystemSemaphore memLock; 25 | 26 | Q_DISABLE_COPY(RunGuard) 27 | }; 28 | 29 | #endif // RUNGUARD_H 30 | -------------------------------------------------------------------------------- /client/src/common/typecodedatabase.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef TYPECODEDATABASE_H 20 | #define TYPECODEDATABASE_H 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | using namespace QtPromise; 34 | 35 | struct TypeCodeInfo 36 | { 37 | QString TypeCode; 38 | QString Name; 39 | QString Manufacturer; 40 | }; 41 | 42 | Q_DECLARE_METATYPE(TypeCodeInfo) 43 | 44 | class TypeCodeDatabase : public QObject 45 | { 46 | Q_OBJECT 47 | 48 | public: 49 | TypeCodeDatabase(QObject *parent = nullptr); 50 | 51 | void PerformTypeCodeDownload(); 52 | QtPromise::QPromise GetTypeCodeUrl(); 53 | QtPromise::QPromise DownloadTypeCodes(QString url); 54 | Q_INVOKABLE void searchTypeCodes(QString predicate); 55 | Q_INVOKABLE void validateTypeCodeBeforeConnect(QString typeCode); 56 | 57 | signals: 58 | void typeCodeDownloadError(QString error); 59 | void typeCodeResults(QVariantList typeCodes); 60 | void validateTypeCode(bool valid); 61 | 62 | private: 63 | QNetworkAccessManager *nam = nullptr; 64 | QPointer m_reply; 65 | QPointer m_file; 66 | QList m_typeCodes; 67 | }; 68 | 69 | #endif // TYPECODEDATABASE_H 70 | -------------------------------------------------------------------------------- /client/src/common/versioncheck.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef VERSIONCHECK_H 20 | #define VERSIONCHECK_H 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | using namespace QtPromise; 34 | 35 | class VersionCheck : public QObject 36 | { 37 | Q_OBJECT 38 | 39 | public: 40 | VersionCheck(QObject *parent = nullptr); 41 | 42 | void PerformVersionCheck(); 43 | void DeleteOlderInstallers(); 44 | QtPromise::QPromise CheckForUpdates(); 45 | QtPromise::QPromise DownloadInstaller(); 46 | Q_INVOKABLE void downloadInstaller(); 47 | Q_INVOKABLE void cancelDownload(); 48 | void LaunchInstaller(); 49 | 50 | signals: 51 | void newVersionAvailable(); 52 | void noUpdatesAvailable(); 53 | void downloadStarted(); 54 | void downloadPercentChanged(double pct); 55 | void downloadFinished(); 56 | void errorEncountered(QString error); 57 | 58 | private: 59 | QNetworkAccessManager *nam = nullptr; 60 | QPointer m_reply; 61 | QPointer m_file; 62 | QString m_fileName; 63 | QString m_downloadUrl; 64 | }; 65 | 66 | #endif // VERSIONCHECK_H 67 | -------------------------------------------------------------------------------- /client/src/config/windowconfig.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef WINDOW_CONFIG_H 20 | #define WINDOW_CONFIG_H 21 | 22 | #include 23 | 24 | namespace xpilot 25 | { 26 | struct ClientWindowConfig 27 | { 28 | Q_GADGET 29 | 30 | Q_PROPERTY(int X MEMBER X) 31 | Q_PROPERTY(int Y MEMBER Y) 32 | Q_PROPERTY(int Width MEMBER Width) 33 | Q_PROPERTY(int Height MEMBER Height) 34 | Q_PROPERTY(bool Maximized MEMBER Maximized) 35 | 36 | public: 37 | int X = 10; 38 | int Y = 10; 39 | int Width = 800; 40 | int Height = 250; 41 | bool Maximized = false; 42 | 43 | bool operator==(ClientWindowConfig& rhs) const 44 | { 45 | return X == rhs.X && Y == rhs.Y && Width == rhs.Width && Height == rhs.Height && Maximized == rhs.Maximized; 46 | } 47 | bool operator!=(ClientWindowConfig& rhs) const 48 | { 49 | return X != rhs.X || Y != rhs.Y || Width != rhs.Width || Height != rhs.Height || Maximized != rhs.Maximized; 50 | } 51 | }; 52 | } 53 | 54 | Q_DECLARE_METATYPE(xpilot::ClientWindowConfig) 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /client/src/controllers/controller_manager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef CONTROLLER_MANAGER_H 20 | #define CONTROLLER_MANAGER_H 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | #include "controller.h" 27 | #include "network/networkmanager.h" 28 | #include "simulator/xplane_adapter.h" 29 | #include "qinjection/dependencypointer.h" 30 | #include "common/frequency_utils.h" 31 | 32 | namespace xpilot 33 | { 34 | class ControllerManager : public QObject 35 | { 36 | Q_OBJECT 37 | 38 | public: 39 | ControllerManager(QObject* parent = nullptr); 40 | 41 | signals: 42 | void controllerAdded(Controller controller); 43 | void controllerDeleted(Controller controller); 44 | void controllerUpdated(Controller controller); 45 | 46 | private: 47 | void OnControllerUpdateReceived(QString from, uint frequency, double lat, double lon); 48 | void IsValidATCReceived(QString callsign); 49 | void OnRealNameReceived(QString callsign, QString realName); 50 | void RefreshController(Controller controller); 51 | void OnControllerDeleted(QString callsign); 52 | void OnRadioStackStateChanged(RadioStackState radioStack); 53 | void UpdateStationCallsigns(); 54 | 55 | private: 56 | NetworkManager& m_networkManager; 57 | XplaneAdapter& m_xplaneAdapter; 58 | QList m_controllers; 59 | QTimer m_nearbyAtcTimer; 60 | RadioStackState m_radioStackState; 61 | }; 62 | } 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /client/src/fsd/client_properties.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef CLIENT_PROPERTIES_H 20 | #define CLIENT_PROPERTIES_H 21 | 22 | #include 23 | 24 | class ClientProperties 25 | { 26 | public: 27 | ClientProperties(){} 28 | ClientProperties(QString name, int versionMajor, int versionMinor, ushort clientId, QString key) 29 | { 30 | Name = name; 31 | VersionMajor = versionMajor; 32 | VersionMinor = versionMinor; 33 | ClientID = clientId; 34 | PrivateKey = key; 35 | } 36 | 37 | QString Name; 38 | int VersionMajor; 39 | int VersionMinor; 40 | ushort ClientID; 41 | QString PrivateKey; 42 | }; 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_add_atc.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #include "pdu_add_atc.h" 20 | 21 | PDUAddATC::PDUAddATC() : PDUBase() {} 22 | 23 | PDUAddATC::PDUAddATC(QString callsign, QString realName, QString cid, QString password, NetworkRating rating, ProtocolRevision proto) : PDUBase(callsign, "") 24 | { 25 | RealName = realName; 26 | CID = cid; 27 | Password = password; 28 | Rating = rating; 29 | Protocol = proto; 30 | } 31 | 32 | QStringList PDUAddATC::toTokens() const 33 | { 34 | QStringList tokens; 35 | tokens.append(From); 36 | tokens.append(PDUBase::ServerCallsign); 37 | tokens.append(RealName); 38 | tokens.append(CID); 39 | tokens.append(Password); 40 | tokens.append(toQString(Rating)); 41 | tokens.append(toQString(Protocol)); 42 | return tokens; 43 | } 44 | 45 | PDUAddATC PDUAddATC::fromTokens(const QStringList &tokens) 46 | { 47 | if(tokens.size() < 6) { 48 | throw PDUFormatException("Invalid field count.", Reassemble(tokens)); 49 | } 50 | 51 | return PDUAddATC(tokens[0], tokens[2], tokens[3], tokens[4], fromQString(tokens[5]), fromQString(tokens[6])); 52 | } 53 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_add_atc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef PDU_ADDATC_H 20 | #define PDU_ADDATC_H 21 | 22 | #include "pdu_base.h" 23 | 24 | class PDUAddATC : public PDUBase 25 | { 26 | public: 27 | PDUAddATC(QString callsign, QString realName, QString cid, QString password, NetworkRating rating, ProtocolRevision proto); 28 | 29 | QStringList toTokens() const; 30 | 31 | static PDUAddATC fromTokens(const QStringList& fields); 32 | 33 | static QString pdu() { return "#AA"; } 34 | 35 | QString RealName; 36 | QString CID; 37 | QString Password; 38 | NetworkRating Rating; 39 | ProtocolRevision Protocol; 40 | 41 | private: 42 | PDUAddATC(); 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_add_pilot.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #include "pdu_add_pilot.h" 20 | 21 | PDUAddPilot::PDUAddPilot() : PDUBase() {} 22 | 23 | PDUAddPilot::PDUAddPilot(QString callsign, QString cid, QString password, NetworkRating rating, ProtocolRevision proto, SimulatorType simType, QString realName) : 24 | PDUBase(callsign, "") 25 | { 26 | CID = cid; 27 | Password = password; 28 | Rating = rating; 29 | Protocol = proto; 30 | SimType = simType; 31 | RealName = realName; 32 | } 33 | 34 | QStringList PDUAddPilot::toTokens() const 35 | { 36 | QStringList tokens; 37 | 38 | tokens.append(From); 39 | tokens.append(PDUBase::ServerCallsign); 40 | tokens.append(CID); 41 | tokens.append(Password); 42 | tokens.append(toQString(Rating)); 43 | tokens.append(toQString(Protocol)); 44 | tokens.append(toQString(SimType)); 45 | tokens.append(RealName); 46 | 47 | return tokens; 48 | } 49 | 50 | PDUAddPilot PDUAddPilot::fromTokens(const QStringList &tokens) 51 | { 52 | if(tokens.size() < 8) { 53 | throw PDUFormatException("Invalid field count.", Reassemble(tokens)); 54 | } 55 | 56 | return PDUAddPilot(tokens[0], tokens[2], tokens[3], fromQString(tokens[4]), 57 | fromQString(tokens[5]), fromQString(tokens[6]), tokens[7]); 58 | } 59 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_add_pilot.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef PDU_ADDPILOT_H 20 | #define PDU_ADDPILOT_H 21 | 22 | #include "pdu_base.h" 23 | 24 | class PDUAddPilot : public PDUBase 25 | { 26 | public: 27 | PDUAddPilot(QString callsign, QString cid, QString password, NetworkRating rating, ProtocolRevision proto, SimulatorType simType, QString realName); 28 | 29 | QStringList toTokens() const; 30 | 31 | static PDUAddPilot fromTokens(const QStringList& fields); 32 | 33 | static QString pdu() { return "#AP"; } 34 | 35 | QString CID; 36 | QString Password; 37 | NetworkRating Rating; 38 | ProtocolRevision Protocol; 39 | SimulatorType SimType; 40 | QString RealName; 41 | 42 | private: 43 | PDUAddPilot(); 44 | }; 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_atc_position.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef PDU_ATCPOSITION_H 20 | #define PDU_ATCPOSITION_H 21 | 22 | #include "pdu_base.h" 23 | 24 | class PDUATCPosition : public PDUBase 25 | { 26 | public: 27 | PDUATCPosition(QString from, QList freqs, NetworkFacility facility, int visRange, NetworkRating rating, double lat, double lon); 28 | 29 | QStringList toTokens() const; 30 | 31 | static PDUATCPosition fromTokens(const QStringList& fields); 32 | 33 | static QString pdu() { return "%"; } 34 | 35 | QList Frequencies; 36 | NetworkFacility Facility; 37 | int VisibilityRange; 38 | NetworkRating Rating; 39 | double Lat; 40 | double Lon; 41 | 42 | private: 43 | PDUATCPosition(); 44 | }; 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_auth_challenge.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #include "pdu_auth_challenge.h" 20 | 21 | PDUAuthChallenge::PDUAuthChallenge() : PDUBase() {} 22 | 23 | PDUAuthChallenge::PDUAuthChallenge(QString from, QString to, QString challenge) : 24 | PDUBase(from, to) 25 | { 26 | ChallengeKey = challenge; 27 | } 28 | 29 | QStringList PDUAuthChallenge::toTokens() const 30 | { 31 | QStringList tokens; 32 | tokens.append(From); 33 | tokens.append(To); 34 | tokens.append(ChallengeKey); 35 | return tokens; 36 | } 37 | 38 | PDUAuthChallenge PDUAuthChallenge::fromTokens(const QStringList &tokens) 39 | { 40 | if(tokens.length() < 3) { 41 | throw PDUFormatException("Invalid field count.", Reassemble(tokens)); 42 | } 43 | 44 | return PDUAuthChallenge(tokens[0], tokens[1], tokens[2]); 45 | } 46 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_auth_challenge.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef PDU_AUTHCHALLENGE_H 20 | #define PDU_AUTHCHALLENGE_H 21 | 22 | #include "pdu_base.h" 23 | 24 | class PDUAuthChallenge : public PDUBase 25 | { 26 | public: 27 | PDUAuthChallenge(QString from, QString to, QString challenge); 28 | 29 | QStringList toTokens() const; 30 | 31 | static PDUAuthChallenge fromTokens(const QStringList& fields); 32 | 33 | static QString pdu() { return "$ZC"; } 34 | 35 | QString ChallengeKey; 36 | 37 | private: 38 | PDUAuthChallenge(); 39 | }; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_auth_response.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #include "pdu_auth_response.h" 20 | 21 | PDUAuthResponse::PDUAuthResponse() : PDUBase() {} 22 | 23 | PDUAuthResponse::PDUAuthResponse(QString from, QString to, QString response) : 24 | PDUBase(from, to) 25 | { 26 | Response = response; 27 | } 28 | 29 | QStringList PDUAuthResponse::toTokens() const 30 | { 31 | QStringList tokens; 32 | tokens.append(From); 33 | tokens.append(To); 34 | tokens.append(Response); 35 | return tokens; 36 | } 37 | 38 | PDUAuthResponse PDUAuthResponse::fromTokens(const QStringList &tokens) 39 | { 40 | if(tokens.length() < 3) { 41 | throw PDUFormatException("Invalid field count.", Reassemble(tokens)); 42 | } 43 | 44 | return PDUAuthResponse(tokens[0], tokens[1], tokens[2]); 45 | } 46 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_auth_response.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef PDU_AUTHRESPONSE_H 20 | #define PDU_AUTHRESPONSE_H 21 | 22 | #include "pdu_base.h" 23 | 24 | class PDUAuthResponse : public PDUBase 25 | { 26 | public: 27 | PDUAuthResponse(QString from, QString to, QString response); 28 | 29 | QStringList toTokens() const; 30 | 31 | static PDUAuthResponse fromTokens(const QStringList& fields); 32 | 33 | static QString pdu() { return "$ZR"; } 34 | 35 | QString Response; 36 | 37 | private: 38 | PDUAuthResponse(); 39 | }; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_base.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #include "pdu_base.h" 20 | 21 | PDUBase::PDUBase(QString from, QString to) : 22 | From(from), 23 | To(to) 24 | { 25 | 26 | } 27 | 28 | uint PDUBase::PackPitchBankHeading(double pitch, double bank, double heading) 29 | { 30 | double p = pitch / -360.0; 31 | if(p < 0) 32 | { 33 | p += 1.0; 34 | } 35 | p *= 1024.0; 36 | 37 | double b = bank / -360.0; 38 | if(b < 0) 39 | { 40 | b += 1.0; 41 | } 42 | b *= 1024.0; 43 | 44 | double h = heading / 360.0 * 1024.0; 45 | 46 | return ((uint)p << 22) | ((uint)b << 12) | ((uint)h << 2); 47 | } 48 | 49 | void PDUBase::UnpackPitchBankHeading(uint pbh, double &pitch, double &bank, double &heading) 50 | { 51 | uint pitchInt = pbh >> 22; 52 | pitch = pitchInt / 1024.0 * -360.0; 53 | if(pitch > 180.0) 54 | { 55 | pitch -= 360.0; 56 | } 57 | else if (pitch <= -180.0) 58 | { 59 | pitch += 360.0; 60 | } 61 | 62 | uint bankInt = (pbh >> 12) & 0x3FF; 63 | bank = bankInt / 1024.0 * -360.0; 64 | if (bank > 180.0) 65 | { 66 | bank -= 360.0; 67 | } 68 | else if (bank <= -180.0) 69 | { 70 | bank += 360.0; 71 | } 72 | 73 | uint hdgInt = (pbh >> 2) & 0x3FF; 74 | heading = hdgInt / 1024.0 * 360.0; 75 | if (heading < 0.0) 76 | { 77 | heading += 360.0; 78 | } 79 | else if (heading >= 360.0) 80 | { 81 | heading -= 360.0; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_base.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef PDUBASE_H 20 | #define PDUBASE_H 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #include "pdu_format_exception.h" 30 | #include "../serializer.h" 31 | 32 | class PDUBase 33 | { 34 | public: 35 | PDUBase() {} 36 | PDUBase(QString from, QString to); 37 | 38 | static uint PackPitchBankHeading(double pitch, double bank, double heading); 39 | static void UnpackPitchBankHeading(uint pbh, double &pitch, double& bank, double& heading); 40 | 41 | inline static const QString ClientQueryBroadcastRecipient = "@94835"; 42 | inline static const QString ClientQueryBroadcastRecipientPilots = "@94386"; 43 | inline static const QChar Delimeter = ':'; 44 | inline static const QString PacketDelimeter = "\r\n"; 45 | inline static const QString ServerCallsign = "SERVER"; 46 | 47 | static QString Reassemble(QStringList fields) 48 | { 49 | return fields.join(Delimeter); 50 | } 51 | 52 | QString From; 53 | QString To; 54 | }; 55 | 56 | template 57 | QString Serialize(const T &message) 58 | { 59 | return message.pdu() % message.toTokens().join(':') % QStringLiteral("\r\n"); 60 | } 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_broadcast_message.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #include "pdu_broadcast_message.h" 20 | 21 | PDUBroadcastMessage::PDUBroadcastMessage() : PDUBase() {} 22 | 23 | PDUBroadcastMessage::PDUBroadcastMessage(QString from, QString message) : 24 | PDUBase(from, "*") 25 | { 26 | Message = message; 27 | } 28 | 29 | QStringList PDUBroadcastMessage::toTokens() const 30 | { 31 | QStringList tokens; 32 | tokens.append(From); 33 | tokens.append(To); 34 | tokens.append(Message); 35 | return tokens; 36 | } 37 | 38 | PDUBroadcastMessage PDUBroadcastMessage::fromTokens(const QStringList &tokens) 39 | { 40 | if(tokens.length() < 3) { 41 | throw PDUFormatException("Invalid field count.", Reassemble(tokens)); 42 | } 43 | 44 | QStringList messageTokens = tokens.mid(2); 45 | return PDUBroadcastMessage(tokens[0], messageTokens.join(":")); 46 | } 47 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_broadcast_message.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef PDU_BROADCASTMESSGE_H 20 | #define PDU_BROADCASTMESSGE_H 21 | 22 | #include "pdu_base.h" 23 | 24 | class PDUBroadcastMessage : public PDUBase 25 | { 26 | public: 27 | PDUBroadcastMessage(QString from, QString message); 28 | 29 | QStringList toTokens() const; 30 | 31 | static PDUBroadcastMessage fromTokens(const QStringList& fields); 32 | 33 | static QString pdu() { return "#TM"; } 34 | 35 | QString Message; 36 | 37 | private: 38 | PDUBroadcastMessage(); 39 | }; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_change_server.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #include "pdu_change_server.h" 20 | 21 | PDUChangeServer::PDUChangeServer() : PDUBase() {} 22 | 23 | PDUChangeServer::PDUChangeServer(QString from, QString to, QString newServer) : 24 | PDUBase(from, to) 25 | { 26 | NewServer = newServer; 27 | } 28 | 29 | QStringList PDUChangeServer::toTokens() const 30 | { 31 | QStringList tokens; 32 | tokens.append(From); 33 | tokens.append(To); 34 | tokens.append(NewServer); 35 | return tokens; 36 | } 37 | 38 | PDUChangeServer PDUChangeServer::fromTokens(const QStringList &fields) 39 | { 40 | if(fields.size() < 3) { 41 | throw PDUFormatException("Invalid field count.", Reassemble(fields)); 42 | } 43 | 44 | return PDUChangeServer(fields[0], fields[1], fields[2]); 45 | } 46 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_change_server.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef PDU_CHANGE_SERVER_H 20 | #define PDU_CHANGE_SERVER_H 21 | 22 | #include "pdu_base.h" 23 | 24 | class PDUChangeServer : public PDUBase 25 | { 26 | public: 27 | PDUChangeServer(QString from, QString to, QString newServer); 28 | 29 | QStringList toTokens() const; 30 | 31 | static PDUChangeServer fromTokens(const QStringList& fields); 32 | 33 | static QString pdu() { return "$XX"; } 34 | 35 | QString NewServer; 36 | 37 | private: 38 | PDUChangeServer(); 39 | }; 40 | 41 | 42 | #endif // PDU_CHANGE_SERVER_H 43 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_client_identification.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #include "pdu_client_identification.h" 20 | 21 | PDUClientIdentification::PDUClientIdentification() : PDUBase() {} 22 | 23 | PDUClientIdentification::PDUClientIdentification(QString from, ushort clientID, QString clientName, int majorVersion, int minorVersion, QString cid, QString sysUID, QString initialChallenge) : PDUBase(from, ServerCallsign) 24 | { 25 | ClientId = clientID; 26 | ClientName = clientName; 27 | MajorVersion = majorVersion; 28 | MinorVersion = minorVersion; 29 | CID = cid; 30 | SystemUID = sysUID; 31 | InitialChallenge = initialChallenge; 32 | } 33 | 34 | QStringList PDUClientIdentification::toTokens() const 35 | { 36 | QStringList tokens; 37 | tokens.append(From); 38 | tokens.append(To); 39 | tokens.append(QString::number(ClientId, 16).toLower()); 40 | tokens.append(ClientName); 41 | tokens.append(QString::number(MajorVersion)); 42 | tokens.append(QString::number(MinorVersion)); 43 | tokens.append(CID); 44 | tokens.append(SystemUID); 45 | if(!InitialChallenge.isEmpty()) { 46 | tokens.append(InitialChallenge); 47 | } 48 | return tokens; 49 | } 50 | 51 | PDUClientIdentification PDUClientIdentification::fromTokens(const QStringList &tokens) 52 | { 53 | if(tokens.length() < 8) { 54 | throw PDUFormatException("Invalid field count.", Reassemble(tokens)); 55 | } 56 | 57 | return PDUClientIdentification(tokens[0],tokens[2].toUShort(nullptr, 16),tokens[3], tokens[4].toInt(), 58 | tokens[5].toInt(), tokens[6], tokens[7], tokens.size() > 8 ? tokens[8] : QString()); 59 | } 60 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_client_identification.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef PDU_CLIENTIDENTIFICATION_H 20 | #define PDU_CLIENTIDENTIFICATION_H 21 | 22 | #include "pdu_base.h" 23 | 24 | class PDUClientIdentification: public PDUBase 25 | { 26 | public: 27 | PDUClientIdentification(QString from, ushort clientID, QString clientName, int majorVersion, int minorVersion, QString cid, QString sysUID, QString initialChallenge); 28 | 29 | QStringList toTokens() const; 30 | 31 | static PDUClientIdentification fromTokens(const QStringList& fields); 32 | 33 | static QString pdu() { return "$ID"; } 34 | 35 | ushort ClientId; 36 | QString ClientName; 37 | int MajorVersion; 38 | int MinorVersion; 39 | QString CID; 40 | QString SystemUID; 41 | QString InitialChallenge; 42 | 43 | private: 44 | PDUClientIdentification(); 45 | }; 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_client_query.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #include "pdu_client_query.h" 20 | 21 | PDUClientQuery::PDUClientQuery() : PDUBase() {} 22 | 23 | PDUClientQuery::PDUClientQuery(QString from, QString to, ClientQueryType queryType, QStringList payload) : 24 | PDUBase(from, to) 25 | { 26 | QueryType = queryType; 27 | Payload = payload; 28 | } 29 | 30 | QStringList PDUClientQuery::toTokens() const 31 | { 32 | QStringList tokens; 33 | tokens.append(From); 34 | tokens.append(To); 35 | tokens.append(toQString(QueryType)); 36 | tokens.append(Payload); 37 | return tokens; 38 | } 39 | 40 | PDUClientQuery PDUClientQuery::fromTokens(const QStringList &tokens) 41 | { 42 | if(tokens.length() < 3) { 43 | throw PDUFormatException("Invalid field count.", Reassemble(tokens)); 44 | } 45 | 46 | QStringList payload; 47 | if (tokens.size() > 3) { payload = tokens.mid(3); } 48 | return PDUClientQuery(tokens[0], tokens[1], fromQString(tokens[2]), payload); 49 | } 50 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_client_query.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef PDU_CLIENTQUERY_H 20 | #define PDU_CLIENTQUERY_H 21 | 22 | #include "pdu_base.h" 23 | 24 | class PDUClientQuery : public PDUBase 25 | { 26 | public: 27 | PDUClientQuery(QString from, QString to, ClientQueryType queryType, QStringList payload = {}); 28 | 29 | QStringList toTokens() const; 30 | 31 | static PDUClientQuery fromTokens(const QStringList& fields); 32 | 33 | static QString pdu() { return "$CQ"; } 34 | 35 | ClientQueryType QueryType; 36 | QStringList Payload; 37 | 38 | private: 39 | PDUClientQuery(); 40 | }; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_client_query_response.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #include "pdu_client_query_response.h" 20 | 21 | PDUClientQueryResponse::PDUClientQueryResponse() : PDUBase() {} 22 | 23 | PDUClientQueryResponse::PDUClientQueryResponse(QString from, QString to, ClientQueryType queryType, QStringList payload) : 24 | PDUBase(from, to) 25 | { 26 | QueryType = queryType; 27 | Payload = payload; 28 | } 29 | 30 | QStringList PDUClientQueryResponse::toTokens() const 31 | { 32 | QStringList tokens; 33 | tokens.append(From); 34 | tokens.append(To); 35 | tokens.append(toQString(QueryType)); 36 | tokens.append(Payload); 37 | return tokens; 38 | } 39 | 40 | PDUClientQueryResponse PDUClientQueryResponse::fromTokens(const QStringList &tokens) 41 | { 42 | if(tokens.length() < 3) { 43 | throw PDUFormatException("Invalid field count.", Reassemble(tokens)); 44 | } 45 | 46 | QStringList responseData; 47 | if (tokens.size() > 3) { responseData = tokens.mid(3); } 48 | return PDUClientQueryResponse(tokens[0], tokens[1], fromQString(tokens[2]), responseData); 49 | } 50 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_client_query_response.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef PDU_CLIENTQUERYRESPONSE_H 20 | #define PDU_CLIENTQUERYRESPONSE_H 21 | 22 | #include "pdu_base.h" 23 | 24 | class PDUClientQueryResponse : public PDUBase 25 | { 26 | public: 27 | PDUClientQueryResponse(QString from, QString to, ClientQueryType queryType, QStringList payload); 28 | 29 | QStringList toTokens() const; 30 | 31 | static PDUClientQueryResponse fromTokens(const QStringList& fields); 32 | 33 | static QString pdu() { return "$CR"; } 34 | 35 | ClientQueryType QueryType; 36 | QStringList Payload; 37 | 38 | private: 39 | PDUClientQueryResponse(); 40 | }; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_delete_atc.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #include "pdu_delete_atc.h" 20 | 21 | PDUDeleteATC::PDUDeleteATC() : PDUBase() {} 22 | 23 | PDUDeleteATC::PDUDeleteATC(QString from, QString cid) : PDUBase(from, "") 24 | { 25 | CID = cid; 26 | } 27 | 28 | QStringList PDUDeleteATC::toTokens() const 29 | { 30 | QStringList tokens; 31 | tokens.append(From); 32 | tokens.append(CID); 33 | return tokens; 34 | } 35 | 36 | PDUDeleteATC PDUDeleteATC::fromTokens(const QStringList &tokens) 37 | { 38 | if(tokens.length() < 1) { 39 | throw PDUFormatException("Invalid field count.", Reassemble(tokens)); 40 | } 41 | 42 | return PDUDeleteATC(tokens[0], tokens.length() >= 2 ? tokens[1] : ""); 43 | } 44 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_delete_atc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef PDU_DELETEATC_H 20 | #define PDU_DELETEATC_H 21 | 22 | #include "pdu_base.h" 23 | 24 | class PDUDeleteATC : public PDUBase 25 | { 26 | public: 27 | PDUDeleteATC(QString from, QString cid); 28 | 29 | QStringList toTokens() const; 30 | 31 | static PDUDeleteATC fromTokens(const QStringList& fields); 32 | 33 | static QString pdu() { return "#DA"; } 34 | 35 | QString CID; 36 | 37 | private: 38 | PDUDeleteATC(); 39 | }; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_delete_pilot.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #include "pdu_delete_pilot.h" 20 | 21 | PDUDeletePilot::PDUDeletePilot() : PDUBase() {} 22 | 23 | PDUDeletePilot::PDUDeletePilot(QString from, QString cid) : 24 | PDUBase(from, "") 25 | { 26 | CID = cid; 27 | } 28 | 29 | QStringList PDUDeletePilot::toTokens() const 30 | { 31 | QStringList tokens; 32 | tokens.append(From); 33 | tokens.append(CID); 34 | return tokens; 35 | } 36 | 37 | PDUDeletePilot PDUDeletePilot::fromTokens(const QStringList &tokens) 38 | { 39 | if(tokens.length() < 1) { 40 | throw PDUFormatException("Invalid field count.", Reassemble(tokens)); 41 | } 42 | 43 | return PDUDeletePilot(tokens[0], tokens.length() >= 2 ? tokens[1] : ""); 44 | } 45 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_delete_pilot.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef PDU_DELETEPILOT_H 20 | #define PDU_DELETEPILOT_H 21 | 22 | #include "pdu_base.h" 23 | 24 | class PDUDeletePilot : public PDUBase 25 | { 26 | public: 27 | PDUDeletePilot(QString from, QString cid); 28 | 29 | QStringList toTokens() const; 30 | 31 | static PDUDeletePilot fromTokens(const QStringList& fields); 32 | 33 | static QString pdu() { return "#DP"; } 34 | 35 | QString CID; 36 | 37 | private: 38 | PDUDeletePilot(); 39 | }; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_format_exception.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef PDU_FORMAT_EXCEPTION_H 20 | #define PDU_FORMAT_EXCEPTION_H 21 | 22 | #include 23 | #include 24 | 25 | class PDUFormatException : public QException 26 | { 27 | public: 28 | PDUFormatException(QString const &error, QString const &rawMessage) : error(error), rawMessage(rawMessage) {} 29 | virtual ~PDUFormatException() {} 30 | 31 | void raise() const override { throw *this; } 32 | PDUFormatException * clone() const override { return new PDUFormatException(*this); } 33 | 34 | QString getError() const { return error; } 35 | QString getRawMessage() const { return rawMessage; } 36 | private: 37 | QString error; 38 | QString rawMessage; 39 | }; 40 | 41 | #endif // PDU_FORMAT_EXCEPTION_H 42 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_kill_request.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #include "pdu_kill_request.h" 20 | 21 | PDUKillRequest::PDUKillRequest() : PDUBase() {} 22 | 23 | PDUKillRequest::PDUKillRequest(QString from, QString victim, QString reason) : 24 | PDUBase(from, victim) 25 | { 26 | Reason = reason; 27 | } 28 | 29 | QStringList PDUKillRequest::toTokens() const 30 | { 31 | QStringList tokens; 32 | tokens.append(From); 33 | tokens.append(To); 34 | tokens.append(Reason); 35 | return tokens; 36 | } 37 | 38 | PDUKillRequest PDUKillRequest::fromTokens(const QStringList &tokens) 39 | { 40 | if(tokens.length() < 2) { 41 | throw PDUFormatException("Invalid field count.", Reassemble(tokens)); 42 | } 43 | 44 | return PDUKillRequest(tokens[0], tokens[1], tokens.length() > 2 ? tokens[2] : ""); 45 | } 46 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_kill_request.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef PDU_KILLREQUEST_H 20 | #define PDU_KILLREQUEST_H 21 | 22 | #include "pdu_base.h" 23 | 24 | class PDUKillRequest: public PDUBase 25 | { 26 | public: 27 | PDUKillRequest(QString from, QString victim, QString reason); 28 | 29 | QStringList toTokens() const; 30 | 31 | static PDUKillRequest fromTokens(const QStringList& fields); 32 | 33 | static QString pdu() { return "$!!"; } 34 | 35 | QString Reason; 36 | 37 | private: 38 | PDUKillRequest(); 39 | }; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_metar_request.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #include "pdu_metar_request.h" 20 | 21 | PDUMetarRequest::PDUMetarRequest() : PDUBase() {} 22 | 23 | PDUMetarRequest::PDUMetarRequest(QString from, QString station) : 24 | PDUBase(from, PDUBase::ServerCallsign) 25 | { 26 | Station = station; 27 | } 28 | 29 | QStringList PDUMetarRequest::toTokens() const 30 | { 31 | QStringList tokens; 32 | tokens.append(From); 33 | tokens.append(To); 34 | tokens.append("METAR"); 35 | tokens.append(Station); 36 | return tokens; 37 | } 38 | 39 | PDUMetarRequest PDUMetarRequest::fromTokens(const QStringList &tokens) 40 | { 41 | if(tokens.length() < 4) { 42 | throw PDUFormatException("Invalid field count.", Reassemble(tokens)); 43 | } 44 | 45 | return PDUMetarRequest(tokens[0], tokens[3]); 46 | } 47 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_metar_request.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef PDU_METARREQUEST_H 20 | #define PDU_METARREQUEST_H 21 | 22 | #include "pdu_base.h" 23 | 24 | class PDUMetarRequest: public PDUBase 25 | { 26 | public: 27 | PDUMetarRequest(QString from, QString station); 28 | 29 | QStringList toTokens() const; 30 | 31 | static PDUMetarRequest fromTokens(const QStringList& fields); 32 | 33 | static QString pdu() { return "$AX"; } 34 | 35 | QString Station; 36 | 37 | private: 38 | PDUMetarRequest(); 39 | }; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_metar_response.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #include "pdu_metar_response.h" 20 | 21 | PDUMetarResponse::PDUMetarResponse() : PDUBase() {} 22 | 23 | PDUMetarResponse::PDUMetarResponse(QString to, QString metar) : 24 | PDUBase(ServerCallsign, to) 25 | { 26 | Metar = metar; 27 | } 28 | 29 | QStringList PDUMetarResponse::toTokens() const 30 | { 31 | QStringList tokens; 32 | tokens.append(From); 33 | tokens.append(To); 34 | tokens.append(Metar); 35 | return tokens; 36 | } 37 | 38 | PDUMetarResponse PDUMetarResponse::fromTokens(const QStringList &tokens) 39 | { 40 | if(tokens.length() < 4) { 41 | throw PDUFormatException("Invalid field count.", Reassemble(tokens)); 42 | } 43 | 44 | return PDUMetarResponse(tokens[1], tokens[3]); 45 | } 46 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_metar_response.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef PDU_METARRESPONSE_H 20 | #define PDU_METARRESPONSE_H 21 | 22 | #include "pdu_base.h" 23 | 24 | class PDUMetarResponse: public PDUBase 25 | { 26 | public: 27 | PDUMetarResponse(QString to, QString metar); 28 | 29 | QStringList toTokens() const; 30 | 31 | static PDUMetarResponse fromTokens(const QStringList& fields); 32 | 33 | static QString pdu() { return "$AR"; } 34 | 35 | QString Metar; 36 | 37 | private: 38 | PDUMetarResponse(); 39 | }; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_mute.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2023 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #include "pdu_mute.h" 20 | 21 | PDUMute::PDUMute() : PDUBase() {} 22 | 23 | PDUMute::PDUMute(QString from, QString to, bool mute) : 24 | PDUBase(from, to) 25 | { 26 | Mute = mute; 27 | } 28 | 29 | QStringList PDUMute::toTokens() const 30 | { 31 | QStringList tokens; 32 | tokens.append("#MU"); 33 | tokens.append(From); 34 | tokens.append(To); 35 | tokens.append(Mute ? "1" : "0"); 36 | return tokens; 37 | } 38 | 39 | PDUMute PDUMute::fromTokens(const QStringList &tokens) 40 | { 41 | if(tokens.length() < 3) { 42 | throw PDUFormatException("Invalid field count.", Reassemble(tokens)); 43 | } 44 | 45 | return PDUMute(tokens[0], tokens[1], tokens[2] == "1"); 46 | } 47 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_mute.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2023 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef PDU_MUTE_H 20 | #define PDU_MUTE_H 21 | 22 | #include "pdu_base.h" 23 | 24 | class PDUMute: public PDUBase 25 | { 26 | public: 27 | PDUMute(QString from, QString to, bool mute); 28 | 29 | QStringList toTokens() const; 30 | 31 | static PDUMute fromTokens(const QStringList& fields); 32 | 33 | static QString pdu() { return "#MU"; } 34 | 35 | bool Mute; 36 | 37 | private: 38 | PDUMute(); 39 | }; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_pilot_position.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef PDU_PILOTPOS_H 20 | #define PDU_PILOTPOS_H 21 | 22 | #include "pdu_base.h" 23 | 24 | class PDUPilotPosition: public PDUBase 25 | { 26 | public: 27 | PDUPilotPosition(QString from, int txCode, bool squawkingModeC, bool identing, NetworkRating rating, double lat, double lon, int trueAlt, int pressureAlt, int gs, double pitch, double heading, double bank); 28 | 29 | QStringList toTokens() const; 30 | 31 | static PDUPilotPosition fromTokens(const QStringList& fields); 32 | 33 | static QString pdu() { return "@"; } 34 | 35 | int SquawkCode; 36 | bool SquawkingModeC; 37 | bool Identing; 38 | NetworkRating Rating; 39 | double Lat; 40 | double Lon; 41 | int TrueAltitude; 42 | int PressureAltitude; 43 | int GroundSpeed; 44 | double Pitch; 45 | double Heading; 46 | double Bank; 47 | 48 | private: 49 | PDUPilotPosition(); 50 | }; 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_ping.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #include "pdu_ping.h" 20 | 21 | PDUPing::PDUPing() : PDUBase() {} 22 | 23 | PDUPing::PDUPing(QString from, QString to, QString timeStamp) : 24 | PDUBase(from, to) 25 | { 26 | Timestamp = timeStamp; 27 | } 28 | 29 | QStringList PDUPing::toTokens() const 30 | { 31 | QStringList tokens; 32 | tokens.append("$PI"); 33 | tokens.append(From); 34 | tokens.append(To); 35 | tokens.append(Timestamp); 36 | return tokens; 37 | } 38 | 39 | PDUPing PDUPing::fromTokens(const QStringList &tokens) 40 | { 41 | if(tokens.length() < 3) { 42 | throw PDUFormatException("Invalid field count.", Reassemble(tokens)); 43 | } 44 | 45 | return PDUPing(tokens[0], tokens[1], tokens[2]); 46 | } 47 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_ping.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef PDU_PING_H 20 | #define PDU_PING_H 21 | 22 | #include "pdu_base.h" 23 | 24 | class PDUPing: public PDUBase 25 | { 26 | public: 27 | PDUPing(QString from, QString to, QString timeStamp); 28 | 29 | QStringList toTokens() const; 30 | 31 | static PDUPing fromTokens(const QStringList& fields); 32 | 33 | static QString pdu() { return "$PI"; } 34 | 35 | QString Timestamp; 36 | 37 | private: 38 | PDUPing(); 39 | }; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_plane_info_request.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #include "pdu_plane_info_request.h" 20 | 21 | PDUPlaneInfoRequest::PDUPlaneInfoRequest() : PDUBase() {} 22 | 23 | PDUPlaneInfoRequest::PDUPlaneInfoRequest(QString from, QString to) : 24 | PDUBase(from, to) 25 | { 26 | 27 | } 28 | 29 | QStringList PDUPlaneInfoRequest::toTokens() const 30 | { 31 | QStringList tokens; 32 | tokens.append(From); 33 | tokens.append(To); 34 | tokens.append("PIR"); 35 | return tokens; 36 | } 37 | 38 | PDUPlaneInfoRequest PDUPlaneInfoRequest::fromTokens(const QStringList &tokens) 39 | { 40 | if(tokens.length() < 3) { 41 | throw PDUFormatException("Invalid field count.", Reassemble(tokens)); 42 | } 43 | 44 | return PDUPlaneInfoRequest(tokens[0], tokens[1]); 45 | } 46 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_plane_info_request.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef PDU_PLANEINFOREQ_H 20 | #define PDU_PLANEINFOREQ_H 21 | 22 | #include "pdu_base.h" 23 | 24 | class PDUPlaneInfoRequest: public PDUBase 25 | { 26 | public: 27 | PDUPlaneInfoRequest(QString from, QString to); 28 | 29 | QStringList toTokens() const; 30 | 31 | static PDUPlaneInfoRequest fromTokens(const QStringList& fields); 32 | 33 | static QString pdu() { return "#SB"; } 34 | 35 | private: 36 | PDUPlaneInfoRequest(); 37 | }; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_plane_info_response.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #include "pdu_plane_info_response.h" 20 | 21 | PDUPlaneInfoResponse::PDUPlaneInfoResponse() : PDUBase() {} 22 | 23 | PDUPlaneInfoResponse::PDUPlaneInfoResponse(QString from, QString to, QString equipment, QString airline, QString livery, QString csl) : 24 | PDUBase(from, to) 25 | { 26 | Equipment = equipment; 27 | Airline = airline; 28 | Livery = livery; 29 | CSL = csl; 30 | } 31 | 32 | QStringList PDUPlaneInfoResponse::toTokens() const 33 | { 34 | QStringList tokens; 35 | tokens.append(From); 36 | tokens.append(To); 37 | tokens.append("PI"); 38 | tokens.append("GEN"); 39 | tokens.append("EQUIPMENT=" + Equipment); 40 | if(!Airline.isEmpty()) { 41 | tokens.append("AIRLINE=" + Airline); 42 | } 43 | if(!Livery.isEmpty()) { 44 | tokens.append("LIVERY=" + Livery); 45 | } 46 | if(!CSL.isEmpty()) { 47 | tokens.append("CSL=" + CSL); 48 | } 49 | return tokens; 50 | } 51 | 52 | PDUPlaneInfoResponse PDUPlaneInfoResponse::fromTokens(const QStringList &tokens) 53 | { 54 | if(tokens.length() < 5) { 55 | throw PDUFormatException("Invalid field count.", Reassemble(tokens)); 56 | } 57 | 58 | return PDUPlaneInfoResponse(tokens[0], tokens[1], FindValue(tokens, "EQUIPMENT"), 59 | FindValue(tokens, "AIRLINE"), FindValue(tokens, "LIVERY"), FindValue(tokens, "CSL")); 60 | } 61 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_plane_info_response.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef PDU_PLANEINFORESPONSE_H 20 | #define PDU_PLANEINFORESPONSE_H 21 | 22 | #include "pdu_base.h" 23 | 24 | class PDUPlaneInfoResponse: public PDUBase 25 | { 26 | public: 27 | PDUPlaneInfoResponse(QString from, QString to, QString equipment, QString airline, QString livery, QString csl); 28 | 29 | QStringList toTokens() const; 30 | 31 | static PDUPlaneInfoResponse fromTokens(const QStringList& fields); 32 | 33 | static QString pdu() { return "#SB"; } 34 | 35 | static inline QString FindValue(const QStringList& fields, const QString& key) 36 | { 37 | const QString upperKey = key.toUpper() + "="; 38 | for (const auto& field : fields) { 39 | if (field.startsWith(upperKey, Qt::CaseInsensitive)) { 40 | return field.mid(upperKey.length()); 41 | } 42 | } 43 | return QString(); 44 | } 45 | 46 | QString Equipment; 47 | QString Airline; 48 | QString Livery; 49 | QString CSL; 50 | 51 | private: 52 | PDUPlaneInfoResponse(); 53 | }; 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_pong.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #include "pdu_pong.h" 20 | 21 | PDUPong::PDUPong() : PDUBase() {} 22 | 23 | PDUPong::PDUPong(QString from, QString to, QString timeStamp) : 24 | PDUBase(from, to) 25 | { 26 | Timestamp = timeStamp; 27 | } 28 | 29 | QStringList PDUPong::toTokens() const 30 | { 31 | QStringList tokens; 32 | tokens.append(From); 33 | tokens.append(To); 34 | tokens.append(Timestamp); 35 | return tokens; 36 | } 37 | 38 | PDUPong PDUPong::fromTokens(const QStringList &tokens) 39 | { 40 | if(tokens.length() < 3) { 41 | throw PDUFormatException("Invalid field count.", Reassemble(tokens)); 42 | } 43 | 44 | return PDUPong(tokens[0], tokens[1], tokens[2]); 45 | } 46 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_pong.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef PDU_PONG_H 20 | #define PDU_PONG_H 21 | 22 | #include "pdu_base.h" 23 | 24 | class PDUPong: public PDUBase 25 | { 26 | public: 27 | PDUPong(QString from, QString to, QString timeStamp); 28 | 29 | QStringList toTokens() const; 30 | 31 | static PDUPong fromTokens(const QStringList& fields); 32 | 33 | static QString pdu() { return "$PO"; } 34 | 35 | QString Timestamp; 36 | 37 | private: 38 | PDUPong(); 39 | }; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_protocol_error.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef PDU_PROTOCOL_ERROR_H 20 | #define PDU_PROTOCOL_ERROR_H 21 | 22 | #include "pdu_base.h" 23 | 24 | class PDUProtocolError: public PDUBase 25 | { 26 | public: 27 | PDUProtocolError(QString from, QString to, NetworkError type, QString param, QString msg, bool fatal); 28 | 29 | QStringList toTokens() const; 30 | 31 | static PDUProtocolError fromTokens(const QStringList& fields); 32 | 33 | static QString pdu() { return "$ER"; } 34 | 35 | NetworkError ErrorType; 36 | QString Param; 37 | QString Message; 38 | bool Fatal; 39 | 40 | private: 41 | PDUProtocolError(); 42 | }; 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_radio_message.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #include "pdu_radio_message.h" 20 | 21 | PDURadioMessage::PDURadioMessage() : PDUBase() {} 22 | 23 | PDURadioMessage::PDURadioMessage(QString from, QList freqs, QString message) : 24 | PDUBase(from, "") 25 | { 26 | Frequencies = freqs; 27 | Messages = message; 28 | } 29 | 30 | QStringList PDURadioMessage::toTokens() const 31 | { 32 | QStringList freqs; 33 | for(auto & freq : Frequencies) { 34 | if(freqs.length() > 0) { 35 | freqs.append("&"); 36 | } 37 | freqs.append("@" + QString::number(freq)); 38 | } 39 | 40 | QStringList tokens; 41 | tokens.append(From); 42 | tokens.append(freqs.join("")); 43 | tokens.append(Messages); 44 | return tokens; 45 | } 46 | 47 | PDURadioMessage PDURadioMessage::fromTokens(const QStringList &tokens) 48 | { 49 | if(tokens.length() < 3) { 50 | throw PDUFormatException("Invalid field count.", Reassemble(tokens)); 51 | } 52 | 53 | QStringList freqs = tokens[1].split("&"); 54 | QList freqInts; 55 | for(int i = 0; i < freqs.size(); i++) { 56 | freqInts.push_back(freqs[i].mid(1, freqs[i].length() - 1).toUInt()); 57 | } 58 | 59 | QStringList messageTokens = tokens.mid(2); 60 | return PDURadioMessage(tokens[0], freqInts, messageTokens.join(":")); 61 | } 62 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_radio_message.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef PDU_RADIO_MESSAGE_H 20 | #define PDU_RADIO_MESSAGE_H 21 | 22 | #include "pdu_base.h" 23 | 24 | class PDURadioMessage: public PDUBase 25 | { 26 | public: 27 | PDURadioMessage(QString from, QList freqs, QString message); 28 | 29 | QStringList toTokens() const; 30 | 31 | static PDURadioMessage fromTokens(const QStringList& fields); 32 | 33 | static QString pdu() { return "#TM"; } 34 | 35 | QList Frequencies; 36 | QString Messages; 37 | 38 | private: 39 | PDURadioMessage(); 40 | }; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_send_fast.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #include "pdu_send_fast.h" 20 | 21 | PDUSendFast::PDUSendFast() : PDUBase() {} 22 | 23 | PDUSendFast::PDUSendFast(QString from, QString to, bool sendFast) : PDUBase(from, to) 24 | { 25 | DoSendFast = sendFast; 26 | } 27 | 28 | QStringList PDUSendFast::toTokens() const 29 | { 30 | QStringList tokens; 31 | tokens.append(From); 32 | tokens.append(To); 33 | tokens.append(QString::number((int)DoSendFast)); 34 | return tokens; 35 | } 36 | 37 | PDUSendFast PDUSendFast::fromTokens(const QStringList &tokens) 38 | { 39 | if(tokens.length() < 3) { 40 | throw PDUFormatException("Invalid field count.", Reassemble(tokens)); 41 | } 42 | 43 | return PDUSendFast(tokens[0], tokens[1], static_cast(tokens[2].toInt())); 44 | } 45 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_send_fast.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef PDU_SEND_FAST_H 20 | #define PDU_SEND_FAST_H 21 | 22 | #include "pdu_base.h" 23 | 24 | class PDUSendFast : public PDUBase 25 | { 26 | public: 27 | PDUSendFast(QString from, QString to, bool sendFast); 28 | 29 | QStringList toTokens() const; 30 | 31 | static PDUSendFast fromTokens(const QStringList& tokens); 32 | 33 | static QString pdu() { return "$SF"; } 34 | 35 | bool DoSendFast; 36 | 37 | private: 38 | PDUSendFast(); 39 | }; 40 | 41 | #endif // PDU_SEND_FAST_H 42 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_server_identification.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #include "pdu_server_identification.h" 20 | 21 | PDUServerIdentification::PDUServerIdentification() : PDUBase() {} 22 | 23 | PDUServerIdentification::PDUServerIdentification(QString from, QString to, QString version, QString initialChallengeKey) 24 | : PDUBase(from, to) 25 | { 26 | Version = version; 27 | InitialChallengeKey = initialChallengeKey; 28 | } 29 | 30 | QStringList PDUServerIdentification::toTokens() const 31 | { 32 | QStringList tokens; 33 | tokens.append(From); 34 | tokens.append(To); 35 | tokens.append(Version); 36 | tokens.append(InitialChallengeKey); 37 | return tokens; 38 | } 39 | 40 | PDUServerIdentification PDUServerIdentification::fromTokens(const QStringList &tokens) 41 | { 42 | if(tokens.length() < 4) { 43 | throw PDUFormatException("Invalid field count.", Reassemble(tokens)); 44 | } 45 | 46 | return PDUServerIdentification(tokens[0], tokens[1], tokens[2], tokens[3]); 47 | } 48 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_server_identification.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef PDU_SERVERIDENTIFICATION_H 20 | #define PDU_SERVERIDENTIFICATION_H 21 | 22 | #include "pdu_base.h" 23 | 24 | class PDUServerIdentification: public PDUBase 25 | { 26 | public: 27 | PDUServerIdentification(QString from, QString to, QString version, QString initialChallengeKey); 28 | 29 | QStringList toTokens() const; 30 | 31 | static PDUServerIdentification fromTokens(const QStringList& fields); 32 | 33 | static QString pdu() { return "$DI"; } 34 | 35 | QString Version; 36 | QString InitialChallengeKey; 37 | 38 | private: 39 | PDUServerIdentification(); 40 | }; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_text_message.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #include "pdu_text_message.h" 20 | 21 | PDUTextMessage::PDUTextMessage() : PDUBase() {} 22 | 23 | PDUTextMessage::PDUTextMessage(QString from, QString to, QString message) : 24 | PDUBase(from, to), 25 | Message(message) 26 | { 27 | 28 | } 29 | 30 | QStringList PDUTextMessage::toTokens() const 31 | { 32 | QStringList tokens; 33 | tokens.push_back(From); 34 | tokens.push_back(To); 35 | tokens.push_back(Message); 36 | return tokens; 37 | } 38 | 39 | PDUTextMessage PDUTextMessage::fromTokens(const QStringList &tokens) 40 | { 41 | if(tokens.size() < 3) { 42 | throw PDUFormatException("Invalid field count.", Reassemble(tokens)); 43 | } 44 | 45 | QStringList msgTokens = tokens.mid(2); 46 | return PDUTextMessage(tokens[0], tokens[1], msgTokens.join(":")); 47 | } 48 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_text_message.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef PDU_TEXT_MESSAGE_H 20 | #define PDU_TEXT_MESSAGE_H 21 | 22 | #include "pdu_base.h" 23 | 24 | class PDUTextMessage: public PDUBase 25 | { 26 | public: 27 | PDUTextMessage(QString from, QString to, QString message); 28 | 29 | QStringList toTokens() const; 30 | 31 | static PDUTextMessage fromTokens(const QStringList& fields); 32 | 33 | static QString pdu() { return "#TM"; } 34 | 35 | QString Message; 36 | 37 | private: 38 | PDUTextMessage(); 39 | }; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_wallop.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #include "pdu_wallop.h" 20 | 21 | PDUWallop::PDUWallop() : PDUBase() {} 22 | 23 | PDUWallop::PDUWallop(QString from, QString message) : 24 | PDUBase(from, "*S") 25 | { 26 | Message = message; 27 | } 28 | 29 | QStringList PDUWallop::toTokens() const 30 | { 31 | QStringList tokens; 32 | tokens.append(From); 33 | tokens.append(To); 34 | tokens.append(Message); 35 | return tokens; 36 | } 37 | 38 | PDUWallop PDUWallop::fromTokens(const QStringList &tokens) 39 | { 40 | if(tokens.length() > 3) { 41 | throw PDUFormatException("Invalid field count.", Reassemble(tokens)); 42 | } 43 | 44 | QStringList msgTokens = tokens.mid(2); 45 | return PDUWallop(tokens[0], msgTokens.join(":")); 46 | } 47 | -------------------------------------------------------------------------------- /client/src/fsd/pdu/pdu_wallop.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef PDU_WALLOP_H 20 | #define PDU_WALLOP_H 21 | 22 | #include "pdu_base.h" 23 | 24 | class PDUWallop: public PDUBase 25 | { 26 | public: 27 | PDUWallop(QString from, QString message); 28 | 29 | QStringList toTokens() const; 30 | 31 | static PDUWallop fromTokens(const QStringList& fields); 32 | 33 | static QString pdu() { return "#TM"; } 34 | 35 | QString Message; 36 | 37 | private: 38 | PDUWallop(); 39 | }; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /client/src/fsd/serializer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef FSD_SERIALIZER_H 20 | #define FSD_SERIALIZER_H 21 | 22 | #include 23 | #include 24 | 25 | #include "enums.h" 26 | 27 | template 28 | inline QString toQString(const T& value); 29 | 30 | template 31 | T fromQString(const QString &str); 32 | 33 | template<> 34 | QString toQString(const NetworkRating& value); 35 | 36 | template<> 37 | NetworkRating fromQString(const QString& str); 38 | 39 | template<> 40 | QString toQString(const NetworkFacility& value); 41 | 42 | template<> 43 | NetworkFacility fromQString(const QString& str); 44 | 45 | template<> 46 | QString toQString(const ProtocolRevision& value); 47 | 48 | template<> 49 | ProtocolRevision fromQString(const QString& str); 50 | 51 | template<> 52 | QString toQString(const SimulatorType& value); 53 | 54 | template<> 55 | SimulatorType fromQString(const QString& str); 56 | 57 | template<> 58 | QString toQString(const ClientQueryType& value); 59 | 60 | template<> 61 | ClientQueryType fromQString(const QString& str); 62 | 63 | template<> 64 | QString toQString(const FlightRules& value); 65 | 66 | template<> 67 | FlightRules fromQString(const QString& str); 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /client/src/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #include "appcore.h" 20 | 21 | int main(int argc, char *argv[]) 22 | { 23 | return xpilot::Main(argc, argv); 24 | } 25 | -------------------------------------------------------------------------------- /client/src/network/connectinfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef CONNECT_INFO_H 20 | #define CONNECT_INFO_H 21 | 22 | #include 23 | #include 24 | 25 | namespace xpilot 26 | { 27 | struct ConnectInfo 28 | { 29 | Q_GADGET 30 | 31 | Q_PROPERTY(QString Callsign MEMBER Callsign) 32 | Q_PROPERTY(QString TypeCode MEMBER TypeCode) 33 | Q_PROPERTY(QString SelcalCode MEMBER SelcalCode) 34 | Q_PROPERTY(bool ObserverMode MEMBER ObserverMode) 35 | Q_PROPERTY(bool TowerViewMode MEMBER TowerViewMode) 36 | 37 | public: 38 | QString Callsign; 39 | QString TypeCode; 40 | QString SelcalCode; 41 | bool ObserverMode; 42 | bool TowerViewMode; 43 | 44 | bool operator==(ConnectInfo& rhs) const 45 | { 46 | return Callsign == rhs.Callsign && TypeCode == rhs.TypeCode && SelcalCode == rhs.SelcalCode 47 | && ObserverMode == rhs.ObserverMode && TowerViewMode == rhs.TowerViewMode; 48 | } 49 | 50 | bool operator!=(ConnectInfo& rhs) const 51 | { 52 | return Callsign != rhs.Callsign || TypeCode != rhs.TypeCode || SelcalCode != rhs.SelcalCode 53 | || ObserverMode != rhs.ObserverMode || TowerViewMode != rhs.TowerViewMode; 54 | } 55 | }; 56 | } 57 | 58 | Q_DECLARE_METATYPE(xpilot::ConnectInfo) 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /client/src/network/events/radio_message_received.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef RADIO_MESSAGE_RECEIVED_H 20 | #define RADIO_MESSAGE_RECEIVED_H 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | struct RadioMessageReceived 29 | { 30 | Q_GADGET 31 | 32 | Q_PROPERTY(QString From MEMBER From) 33 | Q_PROPERTY(QString Message MEMBER Message) 34 | Q_PROPERTY(QVariant Frequencies MEMBER Frequencies) 35 | Q_PROPERTY(bool IsDirect MEMBER IsDirect) 36 | Q_PROPERTY(bool DualReceiver MEMBER DualReceiver) 37 | 38 | public: 39 | QString From; 40 | QString Message; 41 | QVariant Frequencies; 42 | bool IsDirect; 43 | bool DualReceiver; 44 | }; 45 | 46 | Q_DECLARE_METATYPE(RadioMessageReceived) 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /client/src/network/nearbyatc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef NEARBYATC_H 20 | #define NEARBYATC_H 21 | 22 | #include 23 | 24 | struct NearbyAtc { 25 | Q_GADGET 26 | Q_PROPERTY(QString callsign MEMBER callsign) 27 | Q_PROPERTY(QString realname MEMBER realname) 28 | Q_PROPERTY(QString frequency MEMBER frequency) 29 | Q_PROPERTY(int sim_frequency MEMBER sim_frequency) 30 | public: 31 | QString callsign; 32 | QString realname; 33 | QString frequency; 34 | int sim_frequency; 35 | }; 36 | Q_DECLARE_METATYPE(NearbyAtc) 37 | 38 | #endif // NEARBYATC_H 39 | -------------------------------------------------------------------------------- /client/src/network/serverlistmanager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef NETWORK_INFO_H 20 | #define NETWORK_INFO_H 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | namespace xpilot 33 | { 34 | struct NetworkServerInfo 35 | { 36 | Q_GADGET 37 | public: 38 | QString Name; 39 | QString Address; 40 | QString Location; 41 | QString Description; 42 | Q_PROPERTY(QString Name MEMBER Name) 43 | Q_PROPERTY(QString Address MEMBER Address) 44 | }; 45 | 46 | class ServerListManager : public QObject 47 | { 48 | Q_OBJECT 49 | public: 50 | ServerListManager(QObject * parent = nullptr); 51 | void PerformServerListDownload(const QString &url); 52 | QtPromise::QPromise DownloadStatusInfo(const QString &url); 53 | QtPromise::QPromise> DownloadServerList(const QString &url); 54 | 55 | signals: 56 | void serverListDownloaded(int count); 57 | void serverListDownloadError(QString error); 58 | 59 | private: 60 | QNetworkAccessManager *nam = nullptr; 61 | QPointer m_reply; 62 | }; 63 | } 64 | 65 | Q_DECLARE_METATYPE(xpilot::NetworkServerInfo) 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /client/src/network/vatsim_auth.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #ifndef VatsimAuth_h 20 | #define VatsimAuth_h 21 | 22 | #include 23 | 24 | std::string GenerateAuthResponse(const std::string& challenge, const unsigned short publicKey, const std::string& privateKey); 25 | 26 | #endif // !VatsimAuth_h 27 | -------------------------------------------------------------------------------- /client/src/qinjection/dependencycreator.cpp: -------------------------------------------------------------------------------- 1 | #include "dependencycreator.h" 2 | 3 | -------------------------------------------------------------------------------- /client/src/qinjection/dependencyinjector.cpp: -------------------------------------------------------------------------------- 1 | #include "dependencyinjector.h" 2 | 3 | namespace QInjection { 4 | 5 | Injecter Inject; 6 | 7 | Injecter::Injecter() : _key{nullptr} {} 8 | 9 | Injecter::Injecter(const char *key) : _key(key) {} 10 | 11 | } // namespace QInjection 12 | -------------------------------------------------------------------------------- /client/src/qinjection/dependencyinjector.h: -------------------------------------------------------------------------------- 1 | #ifndef DEPENDENCYINJECTOR_H 2 | #define DEPENDENCYINJECTOR_H 3 | 4 | #include "dependencypool.h" 5 | 6 | namespace QInjection { 7 | 8 | class Injecter 9 | { 10 | const char *_key{nullptr}; 11 | 12 | public: 13 | Injecter(); 14 | Injecter(const char *key); 15 | 16 | Injecter(const Injecter &) = delete; 17 | Injecter(Injecter &&) = delete; 18 | 19 | template 20 | operator T *() 21 | { 22 | T *tmp = nullptr; 23 | if (_key) { 24 | tmp = qobject_cast(Private::create(_key)); 25 | } 26 | else { 27 | tmp = create(); 28 | } 29 | if (tmp && Private::typeForKey(CLASS_NAME(T)) == CreatorType::Scopped) { 30 | tmp->deleteLater(); 31 | } 32 | return tmp; 33 | } 34 | }; 35 | 36 | extern Injecter Inject; 37 | } // namespace QInjection 38 | 39 | #endif // DEPENDENCYINJECTOR_H 40 | -------------------------------------------------------------------------------- /client/src/qinjection/dependencypointer.cpp: -------------------------------------------------------------------------------- 1 | #include "dependencypointer.h" 2 | 3 | /*! 4 | * \class DependencyPointer 5 | 6 | */ 7 | -------------------------------------------------------------------------------- /client/xpilot.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=xPilot 3 | GenericName=xPilot 4 | Comment=xPilot for VATSIM 5 | Icon=xpilot 6 | Exec=xpilot 7 | Terminal=false 8 | Type=Application 9 | Categories=Game; -------------------------------------------------------------------------------- /client/xpilot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xpilot-project/xpilot/20e1d45c152151805430ed190ec5478fccfcf7d9/client/xpilot.png -------------------------------------------------------------------------------- /client/xpilot.rc.in: -------------------------------------------------------------------------------- 1 | xpilot ICON "Resources/Icons/AppIcon.ico" 2 | 3 | #include 4 | 5 | VS_VERSION_INFO VERSIONINFO 6 | FILEVERSION @VERSION_MAJOR@,@VERSION_MINOR@,@VERSION_PATCH@ 7 | PRODUCTVERSION @VERSION_MAJOR@,@VERSION_MINOR@,@VERSION_PATCH@ 8 | BEGIN 9 | BLOCK "StringFileInfo" 10 | BEGIN 11 | BLOCK "040904E4" 12 | BEGIN 13 | VALUE "CompanyName", "Justin Shannon" 14 | VALUE "FileDescription", "xPilot" 15 | VALUE "FileVersion", @VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@ 16 | VALUE "ProductName", "xPilot" 17 | VALUE "ProductVersion", "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@" 18 | END 19 | END 20 | 21 | BLOCK "VarFileInfo" 22 | BEGIN 23 | VALUE "Translation", 0x409, 1252 24 | END 25 | END 26 | -------------------------------------------------------------------------------- /plugin/3rdparty/fmod/fmod.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xpilot-project/xpilot/20e1d45c152151805430ed190ec5478fccfcf7d9/plugin/3rdparty/fmod/fmod.dll -------------------------------------------------------------------------------- /plugin/3rdparty/fmod/fmod_vc.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xpilot-project/xpilot/20e1d45c152151805430ed190ec5478fccfcf7d9/plugin/3rdparty/fmod/fmod_vc.lib -------------------------------------------------------------------------------- /plugin/3rdparty/fmod/libfmod.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xpilot-project/xpilot/20e1d45c152151805430ed190ec5478fccfcf7d9/plugin/3rdparty/fmod/libfmod.dylib -------------------------------------------------------------------------------- /plugin/3rdparty/fmod/libfmod.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xpilot-project/xpilot/20e1d45c152151805430ed190ec5478fccfcf7d9/plugin/3rdparty/fmod/libfmod.so -------------------------------------------------------------------------------- /plugin/3rdparty/font/LICENSE_Font-Awesome.txt: -------------------------------------------------------------------------------- 1 | Font Awesome Free License 2 | ------------------------- 3 | 4 | Font Awesome Free is free, open source, and GPL friendly. You can use it for 5 | commercial projects, open source projects, or really almost whatever you want. 6 | Full Font Awesome Free license: https://fontawesome.com/license/free. 7 | 8 | # Icons: CC BY 4.0 License (https://creativecommons.org/licenses/by/4.0/) 9 | In the Font Awesome Free download, the CC BY 4.0 license applies to all icons 10 | packaged as SVG and JS file types. 11 | 12 | # Fonts: SIL OFL 1.1 License (https://scripts.sil.org/OFL) 13 | In the Font Awesome Free download, the SIL OFL license applies to all icons 14 | packaged as web and desktop font files. 15 | 16 | # Code: MIT License (https://opensource.org/licenses/MIT) 17 | In the Font Awesome Free download, the MIT license applies to all non-font and 18 | non-icon files. 19 | 20 | # Attribution 21 | Attribution is required by MIT, SIL OFL, and CC BY licenses. Downloaded Font 22 | Awesome Free files already contain embedded comments with sufficient 23 | attribution, so you shouldn't need to do anything additional when using these 24 | files normally. 25 | 26 | We've kept attribution comments terse, so we ask that you do not actively work 27 | to remove them from files, especially code. They're a great way for folks to 28 | learn about Font Awesome. 29 | 30 | # Brand Icons 31 | All brand icons are trademarks of their respective owners. The use of these 32 | trademarks does not indicate endorsement of the trademark holder by Font 33 | Awesome, nor vice versa. **Please do not use brand logos for any purpose except 34 | to represent the company, product, or service to which they refer.** 35 | -------------------------------------------------------------------------------- /plugin/3rdparty/imgui-stdlib/imgui_stdlib.h: -------------------------------------------------------------------------------- 1 | // imgui_stdlib.h 2 | // Wrappers for C++ standard library (STL) types (std::string, etc.) 3 | // This is also an example of how you may wrap your own similar types. 4 | 5 | // Compatibility: 6 | // - std::string support is only guaranteed to work from C++11. 7 | // If you try to use it pre-C++11, please share your findings (w/ info about compiler/architecture) 8 | 9 | // Changelog: 10 | // - v0.10: Initial version. Added InputText() / InputTextMultiline() calls with std::string 11 | 12 | #pragma once 13 | 14 | #include 15 | 16 | namespace ImGui 17 | { 18 | // ImGui::InputText() with std::string 19 | // Because text input needs dynamic resizing, we need to setup a callback to grow the capacity 20 | IMGUI_API bool InputTextStd(const char* label, std::string* str, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL); 21 | IMGUI_API bool InputTextMultilineStd(const char* label, std::string* str, const ImVec2& size = ImVec2(0, 0), ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL); 22 | IMGUI_API bool InputTextWithHintStd(const char* label, const char* hint, std::string* str, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL); 23 | } -------------------------------------------------------------------------------- /plugin/3rdparty/imgwindow/system_gl.h: -------------------------------------------------------------------------------- 1 | #if _MSC_VER // compiling via MS Visual Studio 2 | #include // need to make sure this is read first 3 | #endif 4 | 5 | #ifdef __APPLE__ 6 | #define GL_SILENCE_DEPRECATION 7 | #include 8 | #else 9 | #include 10 | #include 11 | #endif 12 | -------------------------------------------------------------------------------- /plugin/3rdparty/sdk/CHeaders/Wrappers/XPCBroadcaster.cpp: -------------------------------------------------------------------------------- 1 | #include "XPCBroadcaster.h" 2 | #include "XPCListener.h" 3 | 4 | XPCBroadcaster::XPCBroadcaster() : 5 | mIterator(NULL) 6 | { 7 | } 8 | 9 | XPCBroadcaster::~XPCBroadcaster() 10 | { 11 | ListenerVector::iterator iter; 12 | mIterator = &iter; 13 | for (iter = mListeners.begin(); iter != mListeners.end(); ++iter) 14 | { 15 | (*iter)->BroadcasterRemoved(this); 16 | } 17 | } 18 | 19 | void XPCBroadcaster::AddListener( 20 | XPCListener * inListener) 21 | { 22 | mListeners.push_back(inListener); 23 | inListener->BroadcasterAdded(this); 24 | } 25 | 26 | void XPCBroadcaster::RemoveListener( 27 | XPCListener * inListener) 28 | { 29 | ListenerVector::iterator iter = std::find 30 | (mListeners.begin(), mListeners.end(), inListener); 31 | if (iter == mListeners.end()) 32 | return; 33 | 34 | if (mIterator != NULL) 35 | { 36 | if (*mIterator >= iter) 37 | (*mIterator)--; 38 | } 39 | 40 | mListeners.erase(iter); 41 | inListener->BroadcasterRemoved(this); 42 | } 43 | 44 | void XPCBroadcaster::BroadcastMessage( 45 | int inMessage, 46 | void * inParam) 47 | { 48 | ListenerVector::iterator iter; 49 | mIterator = &iter; 50 | for (iter = mListeners.begin(); iter != mListeners.end(); ++iter) 51 | { 52 | (*iter)->ListenToMessage(inMessage, inParam); 53 | } 54 | mIterator = NULL; 55 | } 56 | 57 | -------------------------------------------------------------------------------- /plugin/3rdparty/sdk/CHeaders/Wrappers/XPCBroadcaster.h: -------------------------------------------------------------------------------- 1 | #ifndef _XPCBroadcaster_h_ 2 | #define _XPCBroadcaster_h_ 3 | 4 | #include 5 | #include 6 | 7 | class XPCListener; 8 | 9 | class XPCBroadcaster { 10 | public: 11 | 12 | XPCBroadcaster(); 13 | virtual ~XPCBroadcaster(); 14 | 15 | void AddListener( 16 | XPCListener * inListener); 17 | void RemoveListener( 18 | XPCListener * inListener); 19 | 20 | protected: 21 | 22 | void BroadcastMessage( 23 | int inMessage, 24 | void * inParam=0); 25 | 26 | private: 27 | 28 | typedef std::vector ListenerVector; 29 | 30 | ListenerVector mListeners; 31 | 32 | // Reentrancy support 33 | 34 | ListenerVector::iterator * mIterator; 35 | 36 | }; 37 | 38 | #endif -------------------------------------------------------------------------------- /plugin/3rdparty/sdk/CHeaders/Wrappers/XPCDisplay.h: -------------------------------------------------------------------------------- 1 | #ifndef _XPCDisplay_h_ 2 | #define _XPCDisplay_h_ 3 | 4 | #include "XPLMDisplay.h" 5 | 6 | class XPCKeySniffer { 7 | public: 8 | 9 | XPCKeySniffer(int inBeforeWindows); 10 | virtual ~XPCKeySniffer(); 11 | 12 | virtual int HandleKeyStroke( 13 | char inCharKey, 14 | XPLMKeyFlags inFlags, 15 | char inVirtualKey)=0; 16 | 17 | private: 18 | 19 | int mBeforeWindows; 20 | 21 | static int KeySnifferCB( 22 | char inCharKey, 23 | XPLMKeyFlags inFlags, 24 | char inVirtualKey, 25 | void * inRefCon); 26 | }; 27 | 28 | 29 | 30 | class XPCWindow { 31 | public: 32 | 33 | XPCWindow( 34 | int inLeft, 35 | int inTop, 36 | int inRight, 37 | int inBottom, 38 | int inIsVisible); 39 | virtual ~XPCWindow(); 40 | 41 | virtual void DoDraw(void)=0; 42 | virtual void HandleKey(char inKey, XPLMKeyFlags inFlags, char inVirtualKey)=0; 43 | virtual void LoseFocus(void)=0; 44 | virtual int HandleClick(int x, int y, XPLMMouseStatus inMouse)=0; 45 | 46 | void GetWindowGeometry( 47 | int * outLeft, 48 | int * outTop, 49 | int * outRight, 50 | int * outBottom); 51 | void SetWindowGeometry( 52 | int inLeft, 53 | int inTop, 54 | int inRight, 55 | int inBottom); 56 | int GetWindowIsVisible(void); 57 | void SetWindowIsVisible( 58 | int inIsVisible); 59 | void TakeKeyboardFocus(void); 60 | void BringWindowToFront(void); 61 | int IsWindowInFront(void); 62 | 63 | private: 64 | 65 | XPLMWindowID mWindow; 66 | 67 | static void DrawCB(XPLMWindowID inWindowID, void * inRefcon); 68 | static void HandleKeyCB(XPLMWindowID inWindowID, char inKey, XPLMKeyFlags inFlags, char inVirtualKey, void * inRefcon, int losingFocus); 69 | static int MouseClickCB(XPLMWindowID inWindowID, int x, int y, XPLMMouseStatus inMouse, void * inRefcon); 70 | 71 | }; 72 | 73 | #endif -------------------------------------------------------------------------------- /plugin/3rdparty/sdk/CHeaders/Wrappers/XPCListener.cpp: -------------------------------------------------------------------------------- 1 | #include "XPCListener.h" 2 | #include "XPCBroadcaster.h" 3 | 4 | XPCListener::XPCListener() 5 | { 6 | } 7 | 8 | XPCListener::~XPCListener() 9 | { 10 | while (!mBroadcasters.empty()) 11 | mBroadcasters.front()->RemoveListener(this); 12 | } 13 | 14 | void XPCListener::BroadcasterAdded( 15 | XPCBroadcaster * inBroadcaster) 16 | { 17 | mBroadcasters.push_back(inBroadcaster); 18 | } 19 | 20 | void XPCListener::BroadcasterRemoved( 21 | XPCBroadcaster * inBroadcaster) 22 | { 23 | BroadcastVector::iterator iter = std::find(mBroadcasters.begin(), 24 | mBroadcasters.end(), inBroadcaster); 25 | if (iter != mBroadcasters.end()) 26 | mBroadcasters.erase(iter); 27 | } 28 | -------------------------------------------------------------------------------- /plugin/3rdparty/sdk/CHeaders/Wrappers/XPCListener.h: -------------------------------------------------------------------------------- 1 | #ifndef _XPCListener_h_ 2 | #define _XPCListener_h_ 3 | 4 | #include 5 | #include 6 | 7 | class XPCBroadcaster; 8 | 9 | 10 | class XPCListener { 11 | public: 12 | 13 | XPCListener(); 14 | virtual ~XPCListener(); 15 | 16 | virtual void ListenToMessage( 17 | int inMessage, 18 | void * inParam)=0; 19 | 20 | private: 21 | 22 | typedef std::vector BroadcastVector; 23 | 24 | BroadcastVector mBroadcasters; 25 | 26 | friend class XPCBroadcaster; 27 | 28 | void BroadcasterAdded( 29 | XPCBroadcaster * inBroadcaster); 30 | 31 | void BroadcasterRemoved( 32 | XPCBroadcaster * inBroadcaster); 33 | 34 | }; 35 | 36 | #endif -------------------------------------------------------------------------------- /plugin/3rdparty/sdk/CHeaders/Wrappers/XPCProcessing.cpp: -------------------------------------------------------------------------------- 1 | #include "XPCProcessing.h" 2 | #include "XPLMUtilities.h" 3 | 4 | XPCProcess::XPCProcess() : 5 | mInCallback(false), 6 | mCallbackTime(0) 7 | { 8 | XPLMRegisterFlightLoopCallback(FlightLoopCB, 0, reinterpret_cast(this)); 9 | } 10 | 11 | XPCProcess::~XPCProcess() 12 | { 13 | XPLMUnregisterFlightLoopCallback(FlightLoopCB, reinterpret_cast(this)); 14 | } 15 | 16 | void XPCProcess::StartProcessTime(float inSeconds) 17 | { 18 | mCallbackTime = inSeconds; 19 | if (!mInCallback) 20 | XPLMSetFlightLoopCallbackInterval( 21 | FlightLoopCB, mCallbackTime, 1/*relative to now*/, reinterpret_cast(this)); 22 | } 23 | 24 | void XPCProcess::StartProcessCycles(int inCycles) 25 | { 26 | mCallbackTime = -inCycles; 27 | if (!mInCallback) 28 | XPLMSetFlightLoopCallbackInterval( 29 | FlightLoopCB, mCallbackTime, 1/*relative to now*/, reinterpret_cast(this)); 30 | } 31 | 32 | void XPCProcess::StopProcess(void) 33 | { 34 | mCallbackTime = 0; 35 | if (!mInCallback) 36 | XPLMSetFlightLoopCallbackInterval( 37 | FlightLoopCB, mCallbackTime, 1/*relative to now*/, reinterpret_cast(this)); 38 | } 39 | 40 | 41 | float XPCProcess::FlightLoopCB( 42 | float inElapsedSinceLastCall, 43 | float inElapsedTimeSinceLastFlightLoop, 44 | int inCounter, 45 | void * inRefcon) 46 | { 47 | XPCProcess * me = reinterpret_cast(inRefcon); 48 | me->mInCallback = true; 49 | me->DoProcessing(inElapsedSinceLastCall, inElapsedTimeSinceLastFlightLoop, inCounter); 50 | me->mInCallback = false; 51 | return me->mCallbackTime; 52 | } -------------------------------------------------------------------------------- /plugin/3rdparty/sdk/CHeaders/Wrappers/XPCProcessing.h: -------------------------------------------------------------------------------- 1 | #ifndef _XPCProcessing_h_ 2 | #define _XPCProcessing_h_ 3 | 4 | #include "XPLMProcessing.h" 5 | 6 | class XPCProcess { 7 | public: 8 | 9 | XPCProcess(); 10 | virtual ~XPCProcess(); 11 | 12 | void StartProcessTime(float inSeconds); 13 | void StartProcessCycles(int inCycles); 14 | void StopProcess(void); 15 | 16 | virtual void DoProcessing( 17 | float inElapsedSinceLastCall, 18 | float inElapsedTimeSinceLastFlightLoop, 19 | int inCounter)=0; 20 | 21 | private: 22 | 23 | static float FlightLoopCB( 24 | float inElapsedSinceLastCall, 25 | float inElapsedTimeSinceLastFlightLoop, 26 | int inCounter, 27 | void * inRefcon); 28 | 29 | bool mInCallback; 30 | float mCallbackTime; 31 | 32 | XPCProcess(const XPCProcess&); 33 | XPCProcess& operator=(const XPCProcess&); 34 | 35 | }; 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /plugin/3rdparty/sdk/CHeaders/Wrappers/XPCWidget.h: -------------------------------------------------------------------------------- 1 | #ifndef _XPCWidget_h_ 2 | #define _XPCWidget_h_ 3 | 4 | #include 5 | #include 6 | #include "XPWidgets.h" 7 | 8 | class XPCWidget; 9 | 10 | class XPCWidgetAttachment { 11 | public: 12 | 13 | virtual int HandleWidgetMessage( 14 | XPCWidget * inObject, 15 | XPWidgetMessage inMessage, 16 | XPWidgetID inWidget, 17 | intptr_t inParam1, 18 | intptr_t inParam2)=0; 19 | 20 | }; 21 | 22 | class XPCWidget { 23 | public: 24 | 25 | XPCWidget( 26 | int inLeft, 27 | int inTop, 28 | int inRight, 29 | int inBottom, 30 | bool inVisible, 31 | const char * inDescriptor, 32 | bool inIsRoot, 33 | XPWidgetID inParent, 34 | XPWidgetClass inClass); 35 | XPCWidget( 36 | XPWidgetID inWidget, 37 | bool inOwnsWidget); 38 | virtual ~XPCWidget(); 39 | 40 | void SetOwnsWidget( 41 | bool inOwnsWidget); 42 | void SetOwnsChildren( 43 | bool inOwnsChildren); 44 | 45 | operator XPWidgetID () const; 46 | 47 | XPWidgetID Get(void) const; 48 | 49 | void AddAttachment( 50 | XPCWidgetAttachment * inAttachment, 51 | bool inOwnsAttachment, 52 | bool inPrefilter); 53 | void RemoveAttachment( 54 | XPCWidgetAttachment * inAttachment); 55 | 56 | virtual int HandleWidgetMessage( 57 | XPWidgetMessage inMessage, 58 | XPWidgetID inWidget, 59 | intptr_t inParam1, 60 | intptr_t inParam2); 61 | 62 | private: 63 | 64 | static int WidgetCallback( 65 | XPWidgetMessage inMessage, 66 | XPWidgetID inWidget, 67 | intptr_t inParam1, 68 | intptr_t inParam2); 69 | 70 | typedef std::pair AttachmentInfo; 71 | typedef std::vector AttachmentVector; 72 | 73 | AttachmentVector mAttachments; 74 | XPWidgetID mWidget; 75 | bool mOwnsChildren; 76 | bool mOwnsWidget; 77 | 78 | XPCWidget(); 79 | XPCWidget(const XPCWidget&); 80 | XPCWidget& operator=(const XPCWidget&); 81 | 82 | }; 83 | 84 | #endif -------------------------------------------------------------------------------- /plugin/3rdparty/sdk/Libraries/Mac/XPLM.framework/XPLM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xpilot-project/xpilot/20e1d45c152151805430ed190ec5478fccfcf7d9/plugin/3rdparty/sdk/Libraries/Mac/XPLM.framework/XPLM -------------------------------------------------------------------------------- /plugin/3rdparty/sdk/Libraries/Mac/XPWidgets.framework/XPWidgets: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xpilot-project/xpilot/20e1d45c152151805430ed190ec5478fccfcf7d9/plugin/3rdparty/sdk/Libraries/Mac/XPWidgets.framework/XPWidgets -------------------------------------------------------------------------------- /plugin/3rdparty/sdk/Libraries/Win/XPLM_64.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xpilot-project/xpilot/20e1d45c152151805430ed190ec5478fccfcf7d9/plugin/3rdparty/sdk/Libraries/Win/XPLM_64.lib -------------------------------------------------------------------------------- /plugin/3rdparty/sdk/Libraries/Win/XPWidgets_64.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xpilot-project/xpilot/20e1d45c152151805430ed190ec5478fccfcf7d9/plugin/3rdparty/sdk/Libraries/Win/XPWidgets_64.lib -------------------------------------------------------------------------------- /plugin/3rdparty/sdk/license.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2008, Sandy Barbour and Ben Supnik 2 | All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights to 7 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 8 | of the Software, and to permit persons to whom the Software is furnished to do 9 | so, subject to the following conditions: 10 | 11 | * Redistributions of source code must retain the above copyright notice, 12 | this list of conditions and the following disclaimer. 13 | * Neither the names of the authors nor that of X-Plane or Laminar Research 14 | may be used to endorse or promote products derived from this software 15 | without specific prior written permission from the authors or 16 | Laminar Research, respectively. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 22 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 25 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /plugin/Resources/CSL/PlaceCSLPackagesHere.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | xPilot - CSL directory 7 | 8 | 9 | 10 | 11 | 12 |

CSL Packages

13 | 14 |

15 | You must install CSL packages here, otherwise there will be no 16 | aircraft models to display and xPilot will fail to 17 | start up. 18 |

19 | 20 |

21 | Recommended are 22 |

26 |

27 | 28 |

29 | You find detailed instructions in the 30 | xPilot documentation. 31 |

32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /plugin/Resources/Contrail/Contrail.obj: -------------------------------------------------------------------------------- 1 | I 2 | 800 3 | OBJ 4 | # Contrail object: An empty object that only refers to the particle/emitter definition 5 | 6 | PARTICLE_SYSTEM Contrail.pss 7 | POINT_COUNTS 0 0 0 0 8 | EMITTER engine_smoke 0 0 0 0 0 0 9 | -------------------------------------------------------------------------------- /plugin/Resources/Contrail/Contrail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xpilot-project/xpilot/20e1d45c152151805430ed190ec5478fccfcf7d9/plugin/Resources/Contrail/Contrail.png -------------------------------------------------------------------------------- /plugin/Resources/MapIcons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xpilot-project/xpilot/20e1d45c152151805430ed190ec5478fccfcf7d9/plugin/Resources/MapIcons.png -------------------------------------------------------------------------------- /plugin/include/constants.h.in: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #pragma once 20 | 21 | constexpr int COLOR_YELLOW = 0xFFFF00; 22 | constexpr int COLOR_RED = 0xFF0000; 23 | constexpr int COLOR_GREEN = 0x00FF00; 24 | constexpr int COLOR_BLUE = 0x00F0F0; 25 | 26 | #define PLUGIN_NAME "xPilot" 27 | #define PLUGIN_VERSION @VERSION_MAJOR@@VERSION_MINOR@@VERSION_PATCH@ 28 | #define PLUGIN_VERSION_STRING "@VERSION_STRING@" 29 | #define CONFIG_VERSION 3 30 | -------------------------------------------------------------------------------- /plugin/include/frame_rate_monitor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #pragma once 20 | 21 | #include "data_ref_access.h" 22 | #include "stopwatch.h" 23 | #include "xpilot.h" 24 | 25 | namespace xpilot 26 | { 27 | class XPilot; 28 | 29 | class FrameRateMonitor 30 | { 31 | public: 32 | FrameRateMonitor(XPilot* env); 33 | ~FrameRateMonitor(); 34 | void StopMonitoring(); 35 | void StartMonitoring(); 36 | protected: 37 | DataRefAccess m_frameRatePeriod; 38 | DataRefAccess m_groundSpeed; 39 | DataRefAccess m_isExternalVisual; 40 | DataRefAccess> m_overridePlanePath; 41 | DataRefAccess m_timePaused; 42 | private: 43 | bool SkipMonitoring(); 44 | void ResetFrameRateDetection(); 45 | static float FlightLoopCallback(float, float, int, void* ref); 46 | 47 | XPilot* m_environment; 48 | Stopwatch m_stopwatch; 49 | bool m_gaveFirstWarning; 50 | bool m_gaveSecondWarning; 51 | bool m_gaveDisconnectWarning; 52 | bool m_gaveHealthyWarning; 53 | }; 54 | } -------------------------------------------------------------------------------- /plugin/include/nearby_atc_window.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #pragma once 20 | 21 | #include "dto.h" 22 | #include "xpilot.h" 23 | #include "xp_img_window.h" 24 | 25 | namespace xpilot 26 | { 27 | class XPilot; 28 | 29 | class NearbyAtcList 30 | { 31 | public: 32 | std::string GetCallsign() const { return m_callsign; } 33 | std::string GetFrequency() const { return m_frequency; } 34 | std::string GetRealName() const { return m_realName; } 35 | int GetXplaneFrequency() const { return m_xplaneFrequency; } 36 | void SetCallsign(const std::string& value) { m_callsign = value; } 37 | void SetFrequency(const std::string& value) { m_frequency = value; } 38 | void SetRealName(const std::string& value) { m_realName = value; } 39 | void SetXplaneFrequency(const int value) { m_xplaneFrequency = value; } 40 | private: 41 | std::string m_callsign; 42 | std::string m_frequency; 43 | std::string m_realName; 44 | int m_xplaneFrequency = 0; 45 | }; 46 | 47 | class NearbyAtcWindow : public XPImgWindow 48 | { 49 | public: 50 | NearbyAtcWindow(XPilot* instance); 51 | ~NearbyAtcWindow() final = default; 52 | void UpdateList(const NearbyAtcDto& data); 53 | void ClearList(); 54 | protected: 55 | void buildInterface() override; 56 | void RenderAtcStationEntry(const NearbyAtcList& station); 57 | void RenderAtcTable(const std::string& headerText, const std::vector& callsignSuffixes); 58 | private: 59 | XPilot* m_env; 60 | std::mutex m_mutex; 61 | DataRefAccess m_com1Frequency; 62 | DataRefAccess m_com2Frequency; 63 | }; 64 | } -------------------------------------------------------------------------------- /plugin/include/notification_panel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #pragma once 20 | 21 | #include "img_window.h" 22 | #include "utilities.h" 23 | #include "xplane_command.h" 24 | 25 | namespace xpilot 26 | { 27 | class NotificationPanel : ImgWindow 28 | { 29 | public: 30 | NotificationPanel(int left, int top, int right, int bottom); 31 | ~NotificationPanel(); 32 | void AddMessage(const std::string& message, rgb color = { 255,255,255 }, bool showPanel = false); 33 | void Toggle(); 34 | bool IsAlwaysVisible()const { return m_alwaysVisible; } 35 | void SetAlwaysVisible(bool visible) { m_alwaysVisible = visible; } 36 | protected: 37 | void buildInterface()override; 38 | private: 39 | static float OnFlightLoop(float, float, int, void* refcon); 40 | XPLMFlightLoopID m_flightLoopId; 41 | std::chrono::system_clock::time_point m_disappearTime; 42 | XplaneCommand m_togglePanelCommand; 43 | bool m_scrollToBottom; 44 | bool m_alwaysVisible; 45 | }; 46 | } -------------------------------------------------------------------------------- /plugin/include/settings_window.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #pragma once 20 | 21 | #include "xp_img_window.h" 22 | 23 | namespace xpilot 24 | { 25 | class SettingsWindow : public XPImgWindow 26 | { 27 | public: 28 | SettingsWindow(WndMode _mode = WND_MODE_FLOAT_CENTERED); 29 | protected: 30 | void buildInterface() override; 31 | private: 32 | void LoadConfig(); 33 | }; 34 | } -------------------------------------------------------------------------------- /plugin/include/stdafx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Standard library headers 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | // External library headers 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | 44 | // XPLM SDK 45 | #include "XPLMDataAccess.h" 46 | #include "XPLMDisplay.h" 47 | #include "XPLMGraphics.h" 48 | #include "XPLMMenus.h" 49 | #include "XPLMPlugin.h" 50 | #include "XPLMProcessing.h" 51 | #include "XPLMScenery.h" 52 | #include "XPLMUtilities.h" -------------------------------------------------------------------------------- /plugin/include/terrain_probe.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #pragma once 20 | 21 | namespace xpilot 22 | { 23 | class TerrainProbe 24 | { 25 | public: 26 | TerrainProbe(); 27 | ~TerrainProbe(); 28 | double GetTerrainElevation(double degLat, double degLon)const; 29 | private: 30 | XPLMProbeRef m_probeRef = nullptr; 31 | }; 32 | } -------------------------------------------------------------------------------- /plugin/include/xplane_command.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #pragma once 20 | 21 | namespace xpilot 22 | { 23 | class XplaneCommand 24 | { 25 | public: 26 | XplaneCommand(const char* name, const char* description, std::function handler) : 27 | m_handler(handler), 28 | m_command(XPLMCreateCommand(name, description)) 29 | { 30 | XPLMRegisterCommandHandler(m_command, callback, false, static_cast(this)); 31 | } 32 | 33 | ~XplaneCommand() 34 | { 35 | XPLMUnregisterCommandHandler(m_command, callback, false, static_cast(this)); 36 | } 37 | 38 | XplaneCommand(const XplaneCommand&) = delete; 39 | XplaneCommand& operator =(const XplaneCommand&) = delete; 40 | private: 41 | static int callback(XPLMCommandRef, XPLMCommandPhase phase, void* refcon) 42 | { 43 | if (phase == xplm_CommandBegin) { (static_cast(refcon)->m_handler)(); } 44 | return 1; 45 | } 46 | std::function m_handler; 47 | XPLMCommandRef m_command; 48 | }; 49 | } -------------------------------------------------------------------------------- /plugin/src/terrain_probe.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * xPilot: X-Plane pilot client for VATSIM 3 | * Copyright (C) 2019-2024 Justin Shannon 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/. 17 | */ 18 | 19 | #include "terrain_probe.h" 20 | 21 | namespace xpilot 22 | { 23 | TerrainProbe::TerrainProbe() : 24 | m_probeRef(XPLMCreateProbe(xplm_ProbeY)) 25 | { 26 | 27 | } 28 | 29 | TerrainProbe::~TerrainProbe() 30 | { 31 | XPLMDestroyProbe(m_probeRef); 32 | } 33 | 34 | double TerrainProbe::GetTerrainElevation(double degLat, double degLon) const 35 | { 36 | double x, y, z, foo, alt; 37 | XPLMProbeInfo_t probeinfo; 38 | probeinfo.structSize = sizeof(XPLMProbeInfo_t); 39 | 40 | XPLMWorldToLocal(degLat, degLon, 0, &x, &y, &z); 41 | if (XPLMProbeTerrainXYZ(m_probeRef, x, y, z, &probeinfo) == xplm_ProbeHitTerrain) 42 | { 43 | XPLMLocalToWorld(probeinfo.locationX, probeinfo.locationY, probeinfo.locationZ, &foo, &foo, &alt); 44 | return alt * 3.28084; 45 | } 46 | 47 | return 0; 48 | } 49 | } -------------------------------------------------------------------------------- /plugin/src/xpilot.sym: -------------------------------------------------------------------------------- 1 | { global: 2 | XPluginDisable; 3 | XPluginEnable; 4 | XPluginReceiveMessage; 5 | XPluginStart; 6 | XPluginStop; 7 | local: *; }; 8 | -------------------------------------------------------------------------------- /plugin/src/xpilot.sym_mac: -------------------------------------------------------------------------------- 1 | _XPluginDisable 2 | _XPluginEnable 3 | _XPluginReceiveMessage 4 | _XPluginStart 5 | _XPluginStop 6 | -------------------------------------------------------------------------------- /scripts/AppRun-x86_64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xpilot-project/xpilot/20e1d45c152151805430ed190ec5478fccfcf7d9/scripts/AppRun-x86_64 -------------------------------------------------------------------------------- /scripts/appimage.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | APPIMAGE_PATH="xPilot.AppDir" 4 | 5 | rm -rf $APPIMAGE_PATH 6 | mkdir -p $APPIMAGE_PATH 7 | 8 | chmod +x ../scripts/appimagetool-x86_64.AppImage 9 | mkdir -p ${APPIMAGE_PATH}/usr/lib 10 | mkdir -p ${APPIMAGE_PATH}/usr/bin 11 | mv ../scripts/AppRun-x86_64 ${APPIMAGE_PATH}/AppRun 12 | chmod +x ${APPIMAGE_PATH}/AppRun 13 | 14 | # Copy icons 15 | cp xpilot.png ${APPIMAGE_PATH}/ 16 | { 17 | for size in 16 24 48 64 128 256 512; do 18 | ICON_PATH=${APPIMAGE_PATH}/usr/share/icons/hicolor/${size}x${size}/apps 19 | mkdir -p $ICON_PATH 20 | cp xpilot.png ${ICON_PATH}/xpilot.png 21 | done 22 | } 23 | 24 | cp xpilot.desktop ${APPIMAGE_PATH}/ 25 | cp xpilot.png ${APPIMAGE_PATH}/ 26 | cp build/xpilot ${APPIMAGE_PATH}/usr/bin/ 27 | chmod +x ${APPIMAGE_PATH}/usr/bin/xpilot 28 | 29 | ../scripts/appimagetool-x86_64.AppImage ${APPIMAGE_PATH} 30 | mkdir ../dist && mv xPilot*.AppImage* ../dist/xPilot.AppImage -------------------------------------------------------------------------------- /scripts/appimagetool-x86_64.AppImage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xpilot-project/xpilot/20e1d45c152151805430ed190ec5478fccfcf7d9/scripts/appimagetool-x86_64.AppImage -------------------------------------------------------------------------------- /scripts/make_keychain.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Largely based on the scripts in this: 4 | # https://github.com/marketplace/actions/import-code-signing-certificates 5 | # 6 | # Assumes the dev key and dev key password are stored in variables as 7 | # defined below, and the key is a base64 environment variable: 8 | # cat ~/dev_signing_certificate.p12 | openssl base64 -A| pbcopy 9 | set -e -u -x 10 | 11 | # CERTIFICATE=`cat ~/dev_signing_certificate.p12 | openssl base64 -A` 12 | # CERTIFICATE_PASSWORD="FIXME" 13 | 14 | KEYCHAIN_NAME="Signing keychain" 15 | KEYCHAIN_PASSWORD=`openssl rand -base64 12` 16 | 17 | # delete keychain 18 | # security delete-keychain "${KEYCHAIN_NAME}" 19 | 20 | # create keychain 21 | security create-keychain -p "${KEYCHAIN_PASSWORD}" "${KEYCHAIN_NAME}" 22 | security set-keychain-settings -lut 21600 "${KEYCHAIN_NAME}" 23 | 24 | # unlock keychain 25 | security unlock-keychain -p "${KEYCHAIN_PASSWORD}" "${KEYCHAIN_NAME}" 26 | 27 | # import certificate 28 | CERT_ON_DISK=/tmp/cert.p12 29 | echo ${CERTIFICATE} | openssl base64 -A -d >"${CERT_ON_DISK}" 30 | security import "${CERT_ON_DISK}" -k "${KEYCHAIN_NAME}" -f pkcs12 -A -T /usr/bin/codesign -T /usr/bin/security -P "${CERTIFICATE_PASSWORD}" 31 | 32 | # set partition list 33 | security set-key-partition-list -S apple-tool:,apple: -k "${KEYCHAIN_PASSWORD}" "${KEYCHAIN_NAME}" 34 | 35 | # update keychain list 36 | security list-keychains -d user -s "${KEYCHAIN_NAME}" login.keychain -------------------------------------------------------------------------------- /xpilot.json: -------------------------------------------------------------------------------- 1 | { 2 | "version_url": "https://xpilot-project.org/api/v3/VersionCheck", 3 | "is_beta": false, 4 | "beta_number": 0, 5 | "version": { 6 | "major": 3, 7 | "minor": 0, 8 | "patch": 1 9 | } 10 | } --------------------------------------------------------------------------------