77 lines
2.0 KiB
C++
Executable File
77 lines
2.0 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* ImportHandler
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Astrid Müller, Christian Fröbel, SLSE, 2017-12-12
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AudioVideoManagement/exercise_context.h>
|
|
#include <AudioVideoManagement/avm_db.h>
|
|
#include <QObject>
|
|
#include <map>
|
|
#include <cstdint>
|
|
|
|
enum class DataModification;
|
|
|
|
namespace AssetManagement
|
|
{
|
|
class Asset;
|
|
|
|
namespace Interface
|
|
{
|
|
class Dtc;
|
|
} // namespace Interface
|
|
} // namespace AssetManagement
|
|
|
|
namespace AudioVideoManagement
|
|
{
|
|
|
|
class ExerciseHandler;
|
|
|
|
/**
|
|
* The ImportHandler is responsible for the creation of the IMPORT_VIDEO_CHANNEL entries
|
|
* in avm.device_config for each Workstation for the given Exercise.
|
|
*
|
|
* @author Astrid Müller, Christian Fröbel
|
|
*/
|
|
class ImportHandler : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
/** Creates the instance *and* connects the relevant signals. */
|
|
static ImportHandler *create(ExerciseHandler *exerciseHandler, DatabaseInterface *db, AssetManagement::Interface::Dtc *asmDtc);
|
|
|
|
/** Don't use, use create() instead. Only provided for UnitTests. */
|
|
ImportHandler(const ExerciseContext &context, DatabaseInterface *db, AssetManagement::Interface::Dtc *asmDtc);
|
|
virtual ~ImportHandler() = default;
|
|
|
|
signals:
|
|
/** Signalled after device_config modifications. */
|
|
void avDbReloadNeeded();
|
|
|
|
private slots:
|
|
void onContextActivated();
|
|
void onContextDeactivated();
|
|
|
|
void onAssetChanged(const AssetManagement::Asset &asset, DataModification modType);
|
|
|
|
private:
|
|
void addToDb(const AssetManagement::Asset &asset);
|
|
void removeFromDb(const AssetManagement::Asset &asset);
|
|
|
|
ExerciseContext m_context;
|
|
bool m_isActive{false};
|
|
DatabaseInterface *m_db;
|
|
AssetManagement::Interface::Dtc *m_asmDtc;
|
|
using AssetId = int32_t;
|
|
std::map<AssetId, Database::AvmDeviceConfig> m_deviceConfigs;
|
|
};
|
|
|
|
} // namespace AudioVideoManagement
|
|
|