67 lines
1.6 KiB
C++
Executable File
67 lines
1.6 KiB
C++
Executable File
/**
|
|
* The BiteHandler class manages everything todo with bite requests.
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Hannes Baeuerle, SLSE, 2016-06-06
|
|
*/
|
|
#pragma once
|
|
|
|
#include <QSet>
|
|
#include <QMap>
|
|
|
|
#include "dds_handler.h"
|
|
#include "logger.h"
|
|
|
|
|
|
#include <TrainingAreaBase/tab_ftc.h>
|
|
|
|
#include <QtCore/QObject>
|
|
#include <QtCore/QPointer>
|
|
#include <QtCore/QVector>
|
|
|
|
class QTimer;
|
|
namespace ParticipantManagement
|
|
{
|
|
class MainHandler;
|
|
|
|
namespace BiteHandling
|
|
{
|
|
class BiteReplier;
|
|
class BiteHandler final : public QObject
|
|
, protected Interface::Fts::CallBiteRequestHandler
|
|
, protected TrainingAreaBase::Interface::Ftc::DemandBiteReplyHandler
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit BiteHandler(MainHandler *mainHandler);
|
|
|
|
bool init();
|
|
|
|
void onDemandBiteReply(const Core::FunctionReplyObject &replyObject) override;
|
|
|
|
void onCallBiteRequest(const rti::core::SampleIdentity &cookie,
|
|
const CallBiteRequest &request) override;
|
|
|
|
private:
|
|
Core::FunctionReplyObject callBiteRequest(const rti::core::SampleIdentity &cookie,
|
|
const CallBiteRequest &request);
|
|
void onBiteRequestTimeout(int requestId);
|
|
|
|
private:
|
|
MainHandler *m_mainHandler;
|
|
struct DemandedParticipants
|
|
{
|
|
QSet<int> demandedBiteParticipants;
|
|
rti::core::SampleIdentity cookie;
|
|
QPointer<QTimer> timer;
|
|
};
|
|
QMap<int, DemandedParticipants> m_demandedBiteParticipantRequests;
|
|
QSet<int32_t> m_demandedBiteParticipants; // participant IDs
|
|
|
|
LOGGER_T m_logger;
|
|
|
|
}; // class BiteHandler
|
|
} // namespace BiteHandling
|
|
} // namespace ParticipantManagement
|