Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -0,0 +1,122 @@
|
||||
/**
|
||||
* FrequencyPlanningHandler
|
||||
* $Id: combat_net_radio_handler.h 34915 2017-08-18 07:26:31Z baeuerle_h $
|
||||
* $HeadURL: svn://slssvn/TDS/branches/product/devel/trunk/Lts/Services/AudioVideoManagement/combat_net_radio_handler.h $
|
||||
* $Author: baeuerle_h $
|
||||
* Created by Hannes Baeuerle, SLSE, 2017-07-25
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <avm_fts.h>
|
||||
#include <avm_db.h>
|
||||
#include <avm.hpp>
|
||||
#include <logger.h>
|
||||
#include <QtCore/QObject>
|
||||
#include <QMap>
|
||||
#include <vector>
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
namespace Interface
|
||||
{
|
||||
class Dts;
|
||||
}
|
||||
|
||||
class FrequencySetHandler;
|
||||
class ActiveExercises;
|
||||
class CnrHandler;
|
||||
|
||||
class FrequencyPlanningHandler
|
||||
: public QObject
|
||||
, protected Interface::Fts::ModifyFrequencyPlanningRequestHandler
|
||||
, protected Interface::Fts::RemoveFrequencyPlanningRequestHandler
|
||||
, protected Interface::Fts::ModifyActiveFrequencyPlanningRequestHandler
|
||||
, protected Interface::Fts::RemoveActiveFrequencyPlanningRequestHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit FrequencyPlanningHandler(Interface::Dts *dts, Interface::Fts *fts, DatabaseInterface *db, FrequencySetHandler *frequencySetHandler, ActiveExercises *activeExercises);
|
||||
~FrequencyPlanningHandler() override;
|
||||
|
||||
/**
|
||||
* The cnrHandler is not given via constructor as the CnrHandler itself has a dependency to the FrequencyPlanningHandler.
|
||||
*/
|
||||
void setCnrHandler(CnrHandler *cnrHandler);
|
||||
|
||||
bool init();
|
||||
|
||||
void onModifyFrequencyPlanningRequest(const rti::core::SampleIdentity &cookie,
|
||||
const ModifyFrequencyPlanningRequest &request) override;
|
||||
void onRemoveFrequencyPlanningRequest(const rti::core::SampleIdentity &cookie,
|
||||
const Core::RemoveElementRequest &request) override;
|
||||
void onModifyActiveFrequencyPlanningRequest(const rti::core::SampleIdentity &cookie,
|
||||
const ModifyActiveFrequencyPlanningRequest &request) override;
|
||||
void onRemoveActiveFrequencyPlanningRequest(const rti::core::SampleIdentity &cookie,
|
||||
const RemoveActiveFrequencyPlanningRequest &request) override;
|
||||
|
||||
bool hasActivePlan(int32_t exerciseId) const;
|
||||
|
||||
/**
|
||||
* Check whether the given Exercise's active FrequencyPlan references the given CnrConfig.
|
||||
* Returns false in case the Exercise does not have an active FrequencyPlan.
|
||||
*/
|
||||
bool isReferencedByActivePlan(int32_t exerciseId, int32_t cnrConfigId) const;
|
||||
|
||||
signals:
|
||||
/**
|
||||
* Signal that a FrequencyPlan was added, removed or changed or when the active FrequencyPlan for a given Exercise changed.
|
||||
* The CnrHandler connects to this signal as changes in the FrequencyPlans affect which CnrConfigs are active.
|
||||
*/
|
||||
void planningChanged();
|
||||
|
||||
private slots:
|
||||
void onCnrConfigRemoved(int cnrConfigId);
|
||||
|
||||
private:
|
||||
Core::FunctionReplyObject handleCreate(const ModifyFrequencyPlanningRequest &request);
|
||||
Core::FunctionReplyObject handleModify(const ModifyFrequencyPlanningRequest &request);
|
||||
Core::FunctionReplyObject handleRemove(const Core::RemoveElementRequest &request);
|
||||
|
||||
Core::FunctionReplyObject validateRequest(const ModifyFrequencyPlanningRequest &request) const;
|
||||
Core::FunctionReplyObject validateModifyRequest(const ModifyFrequencyPlanningRequest &request) const;
|
||||
Core::FunctionReplyObject validateRequest(const Core::RemoveElementRequest &request) const;
|
||||
|
||||
std::vector<Database::AvmFrequencyPlanningData> insert(const std::vector<AudioVideoManagement::FrequencyPlanningData>& ddsEntries, qint64 planId, bool &status);
|
||||
|
||||
Core::FunctionReplyObject modifyActiveFrequencyPlanningRequest(const ModifyActiveFrequencyPlanningRequest &request);
|
||||
Core::FunctionReplyObject removeActiveFrequencyPlanningRequest(const RemoveActiveFrequencyPlanningRequest &request);
|
||||
|
||||
Core::FunctionReplyObject validateRequest(const ModifyActiveFrequencyPlanningRequest &request) const;
|
||||
|
||||
Core::FunctionReplyObject testActivation(const std::vector<FrequencyPlanningData> &entries, const std::vector<int> &activePlans, int requestId) const;
|
||||
|
||||
std::vector<int> otherActiveExercises(int withoutThisExercise) const;
|
||||
std::vector<int> otherActivePlans(int withoutThisExercise) const;
|
||||
std::vector<int> takenGlobalCnrConfigs(const std::vector<int> &plans) const;
|
||||
QSet<int> takenFrequencySetEntries(const std::vector<int> &plans) const;
|
||||
bool hasSameFrequencySet(const FrequencyPlanning &plan1, const FrequencyPlanning &plan2) const;
|
||||
|
||||
bool collectAndPublish(const Database::AvmFrequencyPlanning &planDb, bool isReload = false);
|
||||
|
||||
void addPlan(const FrequencyPlanning &plan);
|
||||
void updatePlan(const FrequencyPlanning &plan);
|
||||
void removePlan(int32_t planId);
|
||||
|
||||
void onDbDeletedFrequencyPlanningData(const QVariant &planId);
|
||||
|
||||
|
||||
private:
|
||||
Interface::Dts *m_dts;
|
||||
Interface::Fts *m_fts;
|
||||
DatabaseInterface *m_db;
|
||||
FrequencySetHandler *m_frequencySetHandler;
|
||||
ActiveExercises *m_activeExercises;
|
||||
CnrHandler *m_cnrHandler{nullptr};
|
||||
|
||||
QMap<int32_t, FrequencyPlanning> m_cache;
|
||||
QMap<qint64, Database::AvmActiveFrequencyPlanning> m_activePlannings; // exerciseId -> AvmActiveFrequencyPlanning
|
||||
LOGGER_T &m_logger;
|
||||
};
|
||||
|
||||
} // namespace AudioVideoManagement
|
||||
Reference in new issue
Block a user