Files
qt5-legatus-legacy/Lts/Services/EffectShowManagement/handler_effect_show_vehicle_status.h
T
2026-08-13 18:33:10 +02:00

103 lines
3.3 KiB
C++
Executable File

/**
* Handler for all Language HMI objects
* $Id$
* $HeadURL$
* $Author$
* Created by Hanna E. Rathje, SLSE, 2015-09-03
*/
#pragma once
#include <QMap>
#include <QTimer>
#include <QObject>
#include "dds_handler.h"
#include "esm_convert_from_tab.h"
#include "handler_ppm_data.h"
#include "logger.h"
namespace EffectShowManagement
{
class Initialization;
class ObjectEffectShowVehicleStatus;
/**
* @brief Handler for the status of the effect show vehicle.
*
* (1)Receives the status from the effect show vehicle.\n
* (2)Adds name and ID of the allocated effect show actor to the status.\n
* (3)Updates both informations into the data base.\n
* (4)In case of obsolete data base entries at start time,
* a sequential status request will be sent to the effect
* show vehicles in time intervals of 5 seconds in succession.\n
* (5)It is expected that an effect show vehicle sends its
* status every 10 minutes. If any status information is
* older than 30 minutes, its status will be set to
* "not operational" by the handler.\n
*/
class HandlerEffectShowVehicleStatus : public QObject
{
Q_OBJECT
public:
explicit HandlerEffectShowVehicleStatus(Initialization *mainHandler,
QObject *parent = nullptr);
~HandlerEffectShowVehicleStatus();
/**
* @brief Update of member variables after start.
*/
bool init();
/**
* @brief Returns the number of operational effect show actors
* @return Number of operational effect show actors
*/
int getNumOfEffectShowActors() const;
/**
* @brief Returns the ID of the effect show actor with the sequential number #seq
* @param[in] seq ID's are numbered from [0..*]
* @return ID of the effect show actor with the sequential number #seq
*/
int getIdOfEffectShowActor(int seq);
/**
* @brief Requests, if the effect show vehicle is operational
* @param[in] id ID of the allocated effect show actor
* @return (true)The effect show vehicle is operational
*/
bool isOperational(int id) const;
/**
* @brief Updates the handler with the new status received from effect show vehicle
* @param[in] vehicleStatus Status receied from effect show vehicle
*/
void vehicleStatusReceived(const ConvertFromTab::VehicleStatus_t &vehicleStatus);
/**
* @brief Updates Name and Id of effect show acter
* @param[in] data Name and Id of effect show actor
* @param[in] modType Type of modification
*/
void effectShowActorChanged(const HandlerPpmData::Participant_t &data, DataModification modType);
public Q_SLOTS:
void onStatusRequest();
void onTimeoutVehicleStatus();
private:
static const qint64 statusTimeout = 1800000; // 30 min timeout effect show vehicle status
static const qint64 delayAfterStart = 20000; // 20 seconds delay for status requests after service start
static const qint64 statusRequestInterval = 5000; // Status request time interval of 5 seconds
private:
QMap<int, ObjectEffectShowVehicleStatus *> m_effectShowVehicleStatusObjMap; // key = equipment number
QVector<int> m_statusRequest; // List of equipment numbers; Order List for request of vehicle status.
QTimer m_timerVehicleStatus;
Initialization *m_mainHandler;
NGL::INGLLogger &m_logger;
};
}