summaryrefslogtreecommitdiffhomepage
path: root/proto-flightgear
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-12-03 22:23:08 +0100
committerStanislaw Halik <sthalik@misaki.pl>2017-12-04 12:19:26 +0100
commitb256886a5cb9f2ae3ebda70a2045b19ed9f4233e (patch)
tree4fa1e46de224cf834a05824dc1eb86001bdb3300 /proto-flightgear
parente89709a801e7874bc02c66848c638c6a0ccc85c1 (diff)
api: add status check for modules
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;