2017-12-20 14:54:05 +01:00
|
|
|
/*!
|
|
|
|
* \brief Remote dispatcher mock for tests.
|
|
|
|
*
|
2018-03-28 15:10:51 +02:00
|
|
|
* \copyright Copyright (c) 2017-2018 Governikus GmbH & Co. KG, Germany
|
2017-12-20 14:54:05 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "RemoteDispatcher.h"
|
|
|
|
|
|
|
|
namespace governikus
|
|
|
|
{
|
|
|
|
|
|
|
|
class MockRemoteDispatcher
|
|
|
|
: public RemoteDispatcher
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
enum class DispatcherState
|
|
|
|
{
|
|
|
|
WithoutReader,
|
|
|
|
ReaderWithoutCard,
|
|
|
|
ReaderWithCard,
|
|
|
|
ReaderWithCardError
|
|
|
|
};
|
|
|
|
|
|
|
|
private:
|
|
|
|
DispatcherState mState;
|
|
|
|
QString mId;
|
|
|
|
QString mContextHandle;
|
|
|
|
|
|
|
|
public:
|
|
|
|
MockRemoteDispatcher(DispatcherState pState = DispatcherState::WithoutReader);
|
|
|
|
virtual ~MockRemoteDispatcher() override = default;
|
|
|
|
|
|
|
|
virtual const QString& getId() const override;
|
|
|
|
virtual const QString& getContextHandle() const override;
|
|
|
|
virtual void send(const QSharedPointer<const RemoteMessage>& pMessage) override;
|
2018-03-28 15:10:51 +02:00
|
|
|
virtual void close() override;
|
2017-12-20 14:54:05 +01:00
|
|
|
|
|
|
|
DispatcherState getState() const;
|
|
|
|
void setState(DispatcherState pState);
|
|
|
|
void onClosed();
|
|
|
|
|
|
|
|
public Q_SLOTS:
|
|
|
|
void onReceived(const QSharedPointer<const RemoteMessage>& pMessage);
|
|
|
|
|
|
|
|
Q_SIGNALS:
|
|
|
|
void fireSend(const QSharedPointer<const RemoteMessage>& pMessage);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
} /* namespace governikus */
|