diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2017-12-03 22:23:08 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2017-12-04 12:19:26 +0100 |
commit | b256886a5cb9f2ae3ebda70a2045b19ed9f4233e (patch) | |
tree | 4fa1e46de224cf834a05824dc1eb86001bdb3300 /proto-flightgear/ftnoir_protocol_fg.cpp | |
parent | e89709a801e7874bc02c66848c638c6a0ccc85c1 (diff) |
api: add status check for modules
Diffstat (limited to 'proto-flightgear/ftnoir_protocol_fg.cpp')
-rw-r--r-- | proto-flightgear/ftnoir_protocol_fg.cpp | 9 |
1 files changed, 7 insertions, 2 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) |