diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2017-12-18 09:05:25 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2017-12-18 09:12:55 +0100 |
commit | c2f88ee8bec8cdd0ea573b54aee89a241c7d4deb (patch) | |
tree | 3b311ad8bec8c05bf82e4f7ef77ace6468798fb4 | |
parent | 6167effc23b8ca8a3034f1ab465565f92c621187 (diff) |
plugins: rename check_status -> initialize
It's a contract for plugin invocation that the particular function fills
the role of initialization. Rename accordingly.
23 files changed, 24 insertions, 26 deletions
diff --git a/api/plugin-api.hpp b/api/plugin-api.hpp index 15a2cc48..48a1f408 100644 --- a/api/plugin-api.hpp +++ b/api/plugin-api.hpp @@ -95,7 +95,7 @@ struct OTR_API_EXPORT module_status_mixin static module_status status_ok(); static module_status error(const QString& error); - virtual module_status check_status() = 0; + virtual module_status initialize() = 0; }; // implement this in filters diff --git a/ext-falcon-bms-linear-acc/falcon-bms-ext.hpp b/ext-falcon-bms-linear-acc/falcon-bms-ext.hpp index d5d5216f..6fee7a76 100644 --- a/ext-falcon-bms-linear-acc/falcon-bms-ext.hpp +++ b/ext-falcon-bms-linear-acc/falcon-bms-ext.hpp @@ -8,5 +8,5 @@ struct falcon_bms_acceleration_ext : IExtension event_mask hook_types() override; falcon_bms_acceleration_ext(); void process_finished(Pose&p) override; - module_status check_status() override { return status_ok(); } + module_status initialize() override { return status_ok(); } }; diff --git a/filter-accela/ftnoir_filter_accela.h b/filter-accela/ftnoir_filter_accela.h index e31def89..1d7925dc 100644 --- a/filter-accela/ftnoir_filter_accela.h +++ b/filter-accela/ftnoir_filter_accela.h @@ -24,7 +24,7 @@ public: void filter(const double* input, double *output) override; void center() override { first_run = true; } spline spline_rot, spline_pos; - module_status check_status() override { return status_ok(); } + module_status initialize() override { return status_ok(); } private: settings_accela s; double last_output[6], deltas[6]; diff --git a/filter-ewma2/ftnoir_filter_ewma2.h b/filter-ewma2/ftnoir_filter_ewma2.h index b53037f7..426af0c9 100644 --- a/filter-ewma2/ftnoir_filter_ewma2.h +++ b/filter-ewma2/ftnoir_filter_ewma2.h @@ -25,7 +25,7 @@ public: ewma(); void filter(const double *input, double *output) override; void center() override { first_run = true; } - module_status check_status() override { return status_ok(); } + module_status initialize() override { return status_ok(); } private: // Deltas are smoothed over the last 1/60sec. const double delta_RC = 1./60; diff --git a/filter-kalman/kalman.h b/filter-kalman/kalman.h index 8fa9e716..607c8ddf 100644 --- a/filter-kalman/kalman.h +++ b/filter-kalman/kalman.h @@ -141,6 +141,7 @@ public: void reset(); void filter(const double *input, double *output) override; void center() override { reset(); } + module_status initialize() { return status_ok(); } PoseVector last_input; Timer timer; bool first_run; diff --git a/logic/runtime-libraries.cpp b/logic/runtime-libraries.cpp index bfa7f2a4..46a90b86 100644 --- a/logic/runtime-libraries.cpp +++ b/logic/runtime-libraries.cpp @@ -17,7 +17,7 @@ runtime_libraries::runtime_libraries(QFrame* frame, dylibptr t, dylibptr p, dyli if (!pProtocol) goto end; - if(status = pProtocol->check_status(), !status.is_ok()) + if(status = pProtocol->initialize(), !status.is_ok()) { status = otr_tr("Error occured while loading protocol %1\n\n%2\n") .arg(p->name).arg(status.error); @@ -34,7 +34,7 @@ runtime_libraries::runtime_libraries(QFrame* frame, dylibptr t, dylibptr p, dyli } if (pFilter) - if(status = pFilter->check_status(), !status.is_ok()) + if(status = pFilter->initialize(), !status.is_ok()) { status = otr_tr("Error occured while loading filter %1\n\n%2\n") .arg(f->name).arg(status.error); diff --git a/proto-flightgear/ftnoir_protocol_fg.cpp b/proto-flightgear/ftnoir_protocol_fg.cpp index 5db12e03..b36a2f47 100644 --- a/proto-flightgear/ftnoir_protocol_fg.cpp +++ b/proto-flightgear/ftnoir_protocol_fg.cpp @@ -25,7 +25,7 @@ void flightgear::pose(const double* headpose) { (void) outSocket.writeDatagram(reinterpret_cast<const char*>(&FlightData), sizeof(FlightData), destIP, static_cast<quint16>(s.port)); } -module_status flightgear::check_status() +module_status flightgear::initialize() { if (outSocket.bind(QHostAddress::Any, 0, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint)) return status_ok(); diff --git a/proto-flightgear/ftnoir_protocol_fg.h b/proto-flightgear/ftnoir_protocol_fg.h index 8ba7c7c8..f92c3072 100644 --- a/proto-flightgear/ftnoir_protocol_fg.h +++ b/proto-flightgear/ftnoir_protocol_fg.h @@ -43,7 +43,7 @@ class flightgear : public IProtocol public: void pose(const double *headpose); QString game_name() { return otr_tr("FlightGear"); } - module_status check_status() override; + module_status initialize() override; private: settings s; flightgear_datagram FlightData; diff --git a/proto-fsuipc/ftnoir_protocol_fsuipc.cpp b/proto-fsuipc/ftnoir_protocol_fsuipc.cpp index fba893bc..90a75f52 100644 --- a/proto-fsuipc/ftnoir_protocol_fsuipc.cpp +++ b/proto-fsuipc/ftnoir_protocol_fsuipc.cpp @@ -144,7 +144,7 @@ void fsuipc::pose(const double *headpose ) { prevRotZ = virtRotZ; } -module_status fsuipc::check_status() +module_status fsuipc::initialize() { FSUIPCLib.setFileName( s.LocationOfDLL ); diff --git a/proto-fsuipc/ftnoir_protocol_fsuipc.h b/proto-fsuipc/ftnoir_protocol_fsuipc.h index bbfd265b..c0560efe 100644 --- a/proto-fsuipc/ftnoir_protocol_fsuipc.h +++ b/proto-fsuipc/ftnoir_protocol_fsuipc.h @@ -50,7 +50,7 @@ class fsuipc : public IProtocol public: fsuipc(); ~fsuipc() override; - module_status check_status() override; + module_status initialize() override; void pose(const double* headpose); QString game_name() { return otr_tr("Microsoft Flight Simulator X"); } private: diff --git a/proto-ft/ftnoir_protocol_ft.cpp b/proto-ft/ftnoir_protocol_ft.cpp index a0272115..08f6efb3 100644 --- a/proto-ft/ftnoir_protocol_ft.cpp +++ b/proto-ft/ftnoir_protocol_ft.cpp @@ -157,7 +157,7 @@ void freetrack::set_protocols(bool ft, bool npclient) settings_npclient.setValue("Path", ""); } -module_status freetrack::check_status() +module_status freetrack::initialize() { if (!shm.success()) return error("Can't load freetrack memory mapping"); diff --git a/proto-ft/ftnoir_protocol_ft.h b/proto-ft/ftnoir_protocol_ft.h index e01c08e2..56ad1b0b 100644 --- a/proto-ft/ftnoir_protocol_ft.h +++ b/proto-ft/ftnoir_protocol_ft.h @@ -38,7 +38,7 @@ class freetrack : public IProtocol public: freetrack(); ~freetrack() override; - module_status check_status() override; + module_status initialize() override; void pose( const double *headpose ); QString game_name() override { QMutexLocker foo(&game_name_mutex); diff --git a/proto-iokit-foohid/iokitprotocol.cpp b/proto-iokit-foohid/iokitprotocol.cpp index d3f0d2c9..b66aeb7b 100644 --- a/proto-iokit-foohid/iokitprotocol.cpp +++ b/proto-iokit-foohid/iokitprotocol.cpp @@ -22,7 +22,7 @@ IOKitProtocol::IOKitProtocol() qWarning("%s\n", qPrintable(joystick->errorMessage())); } -module_status IOKitProtocol::check_status() +module_status IOKitProtocol::initialize() { if (!joystick) return otr_tr("Load failure"); diff --git a/proto-iokit-foohid/iokitprotocol.h b/proto-iokit-foohid/iokitprotocol.h index 39bccf52..1282b3d2 100644 --- a/proto-iokit-foohid/iokitprotocol.h +++ b/proto-iokit-foohid/iokitprotocol.h @@ -18,7 +18,7 @@ class IOKitProtocol : public IProtocol public: IOKitProtocol(); - module_status check_status() override; + module_status initialize() override; void pose(const double *headpose) final; QString game_name() final; diff --git a/proto-mouse/ftnoir_protocol_mouse.h b/proto-mouse/ftnoir_protocol_mouse.h index a909c74a..7b55e3a0 100644 --- a/proto-mouse/ftnoir_protocol_mouse.h +++ b/proto-mouse/ftnoir_protocol_mouse.h @@ -29,7 +29,7 @@ class mouse : public IProtocol { public: mouse(); - module_status check_status() override { return status_ok(); } + module_status initialize() override { return status_ok(); } void pose( const double *headpose) override; QString game_name() override; diff --git a/proto-simconnect/ftnoir_protocol_sc.cpp b/proto-simconnect/ftnoir_protocol_sc.cpp index 787cf0e3..e84f85ec 100644 --- a/proto-simconnect/ftnoir_protocol_sc.cpp +++ b/proto-simconnect/ftnoir_protocol_sc.cpp @@ -161,7 +161,7 @@ private: bool ok; }; -module_status simconnect::check_status() +module_status simconnect::initialize() { if (!SCClientLib.isLoaded()) { diff --git a/proto-simconnect/ftnoir_protocol_sc.h b/proto-simconnect/ftnoir_protocol_sc.h index afea0d3d..7a4a9f5b 100644 --- a/proto-simconnect/ftnoir_protocol_sc.h +++ b/proto-simconnect/ftnoir_protocol_sc.h @@ -39,7 +39,7 @@ class simconnect : public IProtocol, private QThread public: simconnect(); ~simconnect() override; - module_status check_status() override; + module_status initialize() override; void pose(const double* headpose); void handle(); QString game_name() { diff --git a/proto-udp/ftnoir_protocol_ftn.cpp b/proto-udp/ftnoir_protocol_ftn.cpp index a1f445f0..a4a924b1 100644 --- a/proto-udp/ftnoir_protocol_ftn.cpp +++ b/proto-udp/ftnoir_protocol_ftn.cpp @@ -31,7 +31,7 @@ void udp::set_dest_address() (s.ip4.to<unsigned>() & 0xff) << 0 ); } -module_status udp::check_status() +module_status udp::initialize() { if (outSocket.bind(QHostAddress::Any, 0, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint)) return status_ok(); diff --git a/proto-udp/ftnoir_protocol_ftn.h b/proto-udp/ftnoir_protocol_ftn.h index a28097cb..3a5c820b 100644 --- a/proto-udp/ftnoir_protocol_ftn.h +++ b/proto-udp/ftnoir_protocol_ftn.h @@ -11,10 +11,7 @@ #pragma once #include "ui_ftnoir_ftncontrols.h" -#include <QThread> #include <QUdpSocket> -#include <QMessageBox> -#include <cmath> #include "api/plugin-api.hpp" #include "options/options.hpp" using namespace options; @@ -37,7 +34,7 @@ class udp : public QObject, public IProtocol public: udp(); - module_status check_status() override; + module_status initialize() override; void pose(const double *headpose); QString game_name() { return otr_tr("UDP over network"); diff --git a/proto-vjoystick/vjoystick.cpp b/proto-vjoystick/vjoystick.cpp index 1f849e11..3da748bd 100644 --- a/proto-vjoystick/vjoystick.cpp +++ b/proto-vjoystick/vjoystick.cpp @@ -125,7 +125,7 @@ vjoystick_proto::~vjoystick_proto() { } -module_status vjoystick_proto::check_status() +module_status vjoystick_proto::initialize() { switch (h.get_state()) { diff --git a/proto-vjoystick/vjoystick.h b/proto-vjoystick/vjoystick.h index 742d5b47..6469a4e6 100644 --- a/proto-vjoystick/vjoystick.h +++ b/proto-vjoystick/vjoystick.h @@ -54,7 +54,7 @@ class vjoystick_proto : public IProtocol public: vjoystick_proto(); ~vjoystick_proto() override; - module_status check_status() override; + module_status initialize() override; void pose( const double *headpose ) override; QString game_name() override { return otr_tr("Virtual joystick"); } private: diff --git a/proto-wine/ftnoir_protocol_wine.cpp b/proto-wine/ftnoir_protocol_wine.cpp index dd1370e2..07501632 100644 --- a/proto-wine/ftnoir_protocol_wine.cpp +++ b/proto-wine/ftnoir_protocol_wine.cpp @@ -55,7 +55,7 @@ void wine::pose( const double *headpose ) } } -module_status wine::check_status() +module_status wine::initialize() { if (lck_shm.success()) return status_ok(); diff --git a/proto-wine/ftnoir_protocol_wine.h b/proto-wine/ftnoir_protocol_wine.h index d435ffb6..0f300ff3 100644 --- a/proto-wine/ftnoir_protocol_wine.h +++ b/proto-wine/ftnoir_protocol_wine.h @@ -18,7 +18,7 @@ public: wine(); ~wine() override; - module_status check_status() override; + module_status initialize() override; void pose(const double* headpose) override; QString game_name() override |