summaryrefslogtreecommitdiffhomepage
path: root/proto-flightgear
diff options
context:
space:
mode:
Diffstat (limited to 'proto-flightgear')
-rw-r--r--proto-flightgear/ftnoir_protocol_fg.cpp9
-rw-r--r--proto-flightgear/ftnoir_protocol_fg.h6
2 files changed, 9 insertions, 6 deletions
diff --git a/proto-flightgear/ftnoir_protocol_fg.cpp b/proto-flightgear/ftnoir_protocol_fg.cpp
index 3e0f955c..e1101c0f 100644
--- a/proto-flightgear/ftnoir_protocol_fg.cpp
+++ b/proto-flightgear/ftnoir_protocol_fg.cpp
@@ -25,9 +25,14 @@ void flightgear::pose(const double* headpose) {
(void) outSocket.writeDatagram(reinterpret_cast<const char*>(&FlightData), sizeof(FlightData), destIP, static_cast<quint16>(s.port));
}
-bool flightgear::correct()
+module_status flightgear::check_status()
{
- return outSocket.bind(QHostAddress::Any, 0, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint);
+ if (outSocket.bind(QHostAddress::Any, 0, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint))
+ return status_ok();
+ else
+ return error(QCoreApplication::translate("flightgear", "Can't bind to [%1.%2.%3.%4]:%5")
+ .arg(s.ip1).arg(s.ip2).arg(s.ip3).arg(s.ip4)
+ .arg(s.port));
}
OPENTRACK_DECLARE_PROTOCOL(flightgear, FGControls, flightgearDll)
diff --git a/proto-flightgear/ftnoir_protocol_fg.h b/proto-flightgear/ftnoir_protocol_fg.h
index 48e5f1c1..31a7660c 100644
--- a/proto-flightgear/ftnoir_protocol_fg.h
+++ b/proto-flightgear/ftnoir_protocol_fg.h
@@ -41,11 +41,9 @@ struct settings : opts {
class flightgear : public IProtocol
{
public:
- bool correct();
void pose(const double *headpose);
- QString game_name() {
- return QCoreApplication::translate("flightgear", "FlightGear");
- }
+ QString game_name() { return QCoreApplication::translate("flightgear", "FlightGear"); }
+ module_status check_status() override;
private:
settings s;
flightgear_datagram FlightData;