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 |
--------------------------------------------------------------------------------
/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 |
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