// ************************************************************************** // // (C) Copyright 2009 Swiss SIMTEC AG // // ************************************************************************** // // $HeadURL$ // $LastChangedBy$ // $LastChangedDate$ // $LastChangedRevision$ // // ************************************************************************** #pragma once #include "PrtCnvThread.hpp" namespace N_CoPrtCnv { class CoPrtCnvCentralTelegram; } namespace TrainingAreaBase { namespace TetraIcd { struct TrainingAreaTelegram; } } namespace PrtCnv { /** * This thread is used to log telegrams in a log-file. This action is separated * from central/radio-thead because of 2 reasons: * * 1. An unwanted synchronisation of radio- and central thread will be avoided * 2. Storing to a file is very slow and would thwart the radio and central-thread * @author alois.wismer * @version 1.0 * @updated 03-Mai-2010 17:57:34 */ class PrtCnvTelegramLogThread final : public PrtCnvThread { Q_OBJECT public: /** * * @param a_parent */ explicit PrtCnvTelegramLogThread(PrtCnvThreadStarter* a_parent); int32_t create(NGL::Settings *settings) override; int32_t init() override; public slots: /** * Writes a received or sent central-telegram into log-file */ void writeCentralTelegramLog(N_CoPrtCnv::CoPrtCnvCentralTelegram *a_centralTelegram, bool a_isSend, int a_priority); /** * Writes a received or sent central-telegram into log-file */ void writeWlsTelegramLog(const TrainingAreaBase::TetraIcd::TrainingAreaTelegram *tele, bool a_isSend, int a_priority); /** * Writes a received or sent radio-telegram into log-file */ void writeRadioTelegramLog(const QByteArray &tele, bool a_isSend, int a_priority); private: signals: /** * This signal will be emitted when this thread receives a new telegram to log * * @param a_data * @param a_protocolType * @param a_isSend * @param a_priority */ void telegramLogReceived(const QByteArray &a_data, int a_protocolType, int a_priority); private slots: /** * Writes the telegram to the file * * @param a_data * @param a_protocolType * @param a_isSend * @param a_priority */ void writeTelegramLog(const QByteArray &a_data, int a_protocolType, int a_priority); protected: /** * The directory where we want to log the telegrams (configureable over parameter * file) */ QString m_LogTelegramPathWithPrefix; /** * True if we want to log central-telegrams (configureable over parameter file) */ bool m_DoLogCentralTelegram; /** * True if we want to log wls-telegrams (configureable over parameter file) */ bool m_DoLogWlsTelegram; /** * True if we want to log TETRA-telegrams (configureable over parameter file) */ bool m_DoLogRadioTelegram; }; }