Add ISimulatorListener interface

This commit is contained in:
Michał Garapich
2015-01-10 02:28:01 +01:00
committed by Roland Winklmeier
parent 95829affe4
commit adc623f0e7
4 changed files with 107 additions and 31 deletions

View File

@@ -23,6 +23,10 @@ namespace BlackCore
{
emit simulatorStatusChanged(isConnected(), isSimulating(), isPaused());
}
ISimulatorListener::ISimulatorListener(QObject* parent) : QObject(parent)
{
}
CSimulatorCommon::CSimulatorCommon(const BlackSim::CSimulatorInfo &simInfo, BlackMisc::Simulation::IOwnAircraftProvider *ownAircraftProvider, BlackMisc::Simulation::IRemoteAircraftProvider *remoteAircraftProvider, QObject *parent)
: ISimulator(parent),
@@ -196,6 +200,7 @@ namespace BlackCore
{
this->m_debugMessages = driver;
Q_UNUSED(interpolator);
}
int CSimulatorCommon::getInstalledModelsCount() const

View File

@@ -192,7 +192,7 @@ namespace BlackCore
//! Simulator started
void simulatorStarted();
//! Simulator stopped;
//! Simulator stopped
void simulatorStopped();
//! A single model has been matched
@@ -210,6 +210,38 @@ namespace BlackCore
void emitSimulatorCombinedStatus();
};
/*!
* Interface to a simulator listener.
*
* The simulator listener is responsible for letting the core know when
* the corresponding simulator is started.
*/
class ISimulatorListener : public QObject
{
Q_OBJECT
public:
//! Constructor
//! \sa ISimulatorFactory::createListener().
ISimulatorListener(QObject* parent);
//! Destructor
virtual ~ISimulatorListener() = default;
//! Start listening for the simulator to start.
virtual void start() = 0;
//! Stops listening.
virtual void stop() = 0;
signals:
//! Emitted when the listener discovers the simulator running.
void simulatorStarted(BlackSim::CSimulatorInfo simulatorInfo);
};
//! Factory pattern class to create instances of ISimulator
class ISimulatorFactory
@@ -233,6 +265,9 @@ namespace BlackCore
//! Simulator info
virtual BlackSim::CSimulatorInfo getSimulatorInfo() const = 0;
//! Simulator listener instance
virtual ISimulatorListener *createListener(QObject *parent = nullptr) = 0;
};
//! Common base class with providers, interface and some base functionality