Reinserts original comments
This commit is contained in:
112 files changed
+7113
-5131
No files matched your search
@@ -1,15 +1,15 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// **************************************************************************
|
||||
//
|
||||
// (C) Copyright 2009 Swiss SIMTEC AG
|
||||
//
|
||||
// **************************************************************************
|
||||
//
|
||||
// $HeadURL$
|
||||
// $LastChangedBy$
|
||||
// $LastChangedDate$
|
||||
// $LastChangedRevision$
|
||||
//
|
||||
// **************************************************************************
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -32,14 +32,29 @@ namespace N_LogView
|
||||
class LogViewTetraTelegramsParser;
|
||||
class LogViewXdrParser;
|
||||
class LogViewXdrType;
|
||||
|
||||
|
||||
/**
|
||||
* The header and the data of a logged or a edited telegram.
|
||||
*
|
||||
* Writing telegrams:
|
||||
* 1. allocate a telegram with the constructor LogViewTelegram(N_CoPrtCnv::
|
||||
* CoPrtCnvLogHeader::e_DestProtocolCentral, telegramId)
|
||||
* 2. prepare with resetOffset()
|
||||
* 3. write data with setUIntX()
|
||||
* 4. finish with setNewSize();
|
||||
*
|
||||
* @author alois.wismer
|
||||
* @version 1.0
|
||||
* @created 04-Feb-2010 13:15:43
|
||||
*/
|
||||
class LogViewTelegram final
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author alois.wismer
|
||||
* @version 1.0
|
||||
* @created 12-Mrz-2010 11:04:14
|
||||
*/
|
||||
enum E_Validity
|
||||
{
|
||||
e_NotYetEvaluated,
|
||||
@@ -47,8 +62,11 @@ namespace N_LogView
|
||||
e_Invalid
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author alois.wismer
|
||||
* @version 1.0
|
||||
* @created 05-Mai-2010 09:07:22
|
||||
*/
|
||||
enum E_Column
|
||||
{
|
||||
e_ColName,
|
||||
@@ -61,55 +79,88 @@ namespace N_LogView
|
||||
|
||||
~LogViewTelegram();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The size of the field which defines the size of the dyn. array for central-
|
||||
* telegrams
|
||||
*/
|
||||
static const uint16_t SIZE_CENTRAL_DYN_ARRAY_SIZE;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Copy ctor
|
||||
*/
|
||||
LogViewTelegram(const LogViewTelegram &o);
|
||||
|
||||
// no assignment (needed)
|
||||
LogViewTelegram &operator=(const LogViewTelegram &o) = delete;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor for new telegrams (only receive central-telegrams are allowd),
|
||||
* which will be edited
|
||||
*
|
||||
* @param a_destination
|
||||
* @param a_telId
|
||||
*/
|
||||
LogViewTelegram(const N_CoPrtCnv::CoPrtCnvLogHeader::E_CoPrtCnvProtocol a_destination,
|
||||
int telegramId);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructor for existing telegrams
|
||||
*
|
||||
* @param a_destination
|
||||
* @param a_unixTime
|
||||
* @param a_telegramData
|
||||
* @param a_telegramSize
|
||||
*/
|
||||
LogViewTelegram(const N_CoPrtCnv::CoPrtCnvLogHeader::E_CoPrtCnvProtocol a_destination,
|
||||
const quint64 a_unixTime,
|
||||
const QByteArray &a_telegramData);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Writes a_value with size a_size at actual position of m_Data (given with
|
||||
* m_ActOffset). m_ActOffset will be updated after writing data.
|
||||
* If the size of m_Data is not big enough, it will be made bigger.
|
||||
*
|
||||
* @param a_size
|
||||
* @param a_value
|
||||
* @param a_byteOrder
|
||||
*/
|
||||
void setUIntX(const uint8_t a_size,
|
||||
quint64 a_value,
|
||||
const LogViewXdrStandardType::E_ByteOrder a_byteOrder = LogViewXdrStandardType::e_ByteOrderBigEndian);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns true if a_data could be written.
|
||||
* Returns false if a_offset is outside of range and therefore a_data could not be
|
||||
* written.
|
||||
*
|
||||
* @param a_offset
|
||||
* @param a_data
|
||||
*/
|
||||
bool setData(const uint16_t a_offset, const uint8_t a_data);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the log-time of the telegram
|
||||
*/
|
||||
quint64 getLogTime() const { return m_LogTime; }
|
||||
quint64 getLogTimeMsec() const;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the log-time of the telegram as pretty formatted text
|
||||
*/
|
||||
QString getLogTimeText() const;
|
||||
|
||||
|
||||
QString getDestinationText() const;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the gps-time of the telegram
|
||||
*/
|
||||
quint64 getGpsTime() const { return m_GpsTime; }
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the GPS-time of the telegram as pretty formatted text. Only telegrams
|
||||
* from TETRA to central have a GPS-time, for all other telegrams an empty string
|
||||
* will be returned.
|
||||
*/
|
||||
QString getGpsTimeText() const;
|
||||
|
||||
|
||||
@@ -118,12 +169,19 @@ namespace N_LogView
|
||||
|
||||
int getParticipantId() const { return m_ParticipantId; }
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the difference between GPS-time and log-time in seconds. Only telegrams
|
||||
* from TETRA to central have a GPS-time (and therefore only for this telegrams a
|
||||
* time-difference can be calculated), for all other telegrams 0 will be returned.
|
||||
*/
|
||||
int32_t getDelay() const;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the tool-tip text for the with a_col defined column for this telegram.
|
||||
* Its content depends on the type and subtype of telegram.
|
||||
*
|
||||
* @param a_col
|
||||
*/
|
||||
QString getToolTipText(const E_Column a_col);
|
||||
|
||||
|
||||
@@ -172,20 +230,28 @@ namespace N_LogView
|
||||
|
||||
QByteArray getData(QJsonDocument::JsonFormat format = QJsonDocument::JsonFormat::Compact) const;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The time to wait after sending this telegram in milliseconds.
|
||||
*/
|
||||
uint32_t getWaitTime() const { return m_WaitTime; }
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The time to wait after sending this telegram in milliseconds.
|
||||
*
|
||||
* @param newVal
|
||||
*/
|
||||
void setWaitTime(uint32_t newVal) { m_WaitTime = newVal; }
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The name of the telegram, shown in edit-list
|
||||
*/
|
||||
QString getName() const { return m_Name; }
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The name of the telegram, shown in edit-list
|
||||
*
|
||||
* @param newVal
|
||||
*/
|
||||
void setName(const QString &newVal) { m_Name = newVal; }
|
||||
|
||||
|
||||
@@ -197,8 +263,9 @@ namespace N_LogView
|
||||
|
||||
void actualizeGpsTime();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Create the tooltip text for the column 'Name'
|
||||
*/
|
||||
void createToolTipTextForColName();
|
||||
|
||||
|
||||
@@ -209,31 +276,40 @@ namespace N_LogView
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The name of the telegram, shown in edit-list
|
||||
*/
|
||||
QString m_Name;
|
||||
|
||||
|
||||
/**
|
||||
* The tooltip text for caching purposes
|
||||
*/
|
||||
std::vector<QString> m_ToolTipText;
|
||||
|
||||
|
||||
/**
|
||||
* The time to wait after sending this telegram in milliseconds.
|
||||
*/
|
||||
uint32_t m_WaitTime;
|
||||
int m_ParticipantId;
|
||||
|
||||
|
||||
/**
|
||||
* The ISSI of TETRA-Protocol
|
||||
*/
|
||||
uint32_t m_ISSI;
|
||||
|
||||
|
||||
/**
|
||||
* The allocated size of m_Data. (Used for optimizing of speed)
|
||||
*/
|
||||
int m_AllocatedSize;
|
||||
static const LogViewXdrParser* m_Parser;
|
||||
uint16_t m_ActOffset;
|
||||
QVector<uint16_t> m_GpsFieldOffset;
|
||||
int m_TelId;
|
||||
|
||||
|
||||
/**
|
||||
* used for dyn. array in TETRA-Protocol
|
||||
*/
|
||||
uint32_t m_LastUnsignedValue;
|
||||
|
||||
|
||||
/**
|
||||
* This value will be used for the dyn-array-method e_DynArrayMsgLength. This
|
||||
* value will be subtracted from the message-length to get the size of the dynamic
|
||||
* array.
|
||||
*/
|
||||
uint16_t m_MaxArraySize;
|
||||
static const uint16_t START_OFFSET_CENTRAL;
|
||||
static const uint16_t POS_CENTRAL_COUNTER;
|
||||
@@ -302,55 +378,90 @@ namespace N_LogView
|
||||
static QString typeFromStructInformation(const StructInformation &si, const QString &name);
|
||||
static MemberInformation memberFromStructInformation(const StructInformation &si, const QString &name);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param a_offset
|
||||
*/
|
||||
uint16_t getUInt16(const uint16_t a_offset) const;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param a_offset
|
||||
*/
|
||||
uint32_t getUInt32(const uint16_t a_offset) const;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param a_offset
|
||||
*/
|
||||
int32_t getInt32(const uint16_t a_offset) const;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param a_offset
|
||||
* @param a_size
|
||||
* @param a_byteOrder
|
||||
*/
|
||||
quint64 getUIntX(const uint16_t a_offset, const uint8_t a_size, const LogViewXdrStandardType::E_ByteOrder a_byteOrder = LogViewXdrStandardType::e_ByteOrderBigEndian) const;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param a_offset
|
||||
* @param a_size
|
||||
* @param a_byteOrder
|
||||
*/
|
||||
int32_t getSIntX(const uint16_t a_offset, const uint8_t a_size, const LogViewXdrStandardType::E_ByteOrder a_byteOrder = LogViewXdrStandardType::e_ByteOrderBigEndian) const;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param a_offset
|
||||
* @param a_size
|
||||
*/
|
||||
char getChar(const uint16_t a_offset, const uint8_t a_size) const;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param a_standardType
|
||||
* @param a_offset
|
||||
* @param a_arraySize
|
||||
*/
|
||||
LogViewField* getContent(const LogViewXdrStandardType* a_standardType, uint16_t& a_offset, const uint16_t a_arraySize);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param a_xdrType
|
||||
*/
|
||||
bool isScalar(const LogViewXdrType* a_xdrType) const;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param a_errorText
|
||||
* @param a_title
|
||||
*/
|
||||
void showMessageBox(const QString& a_errorText, const QString& a_title = QObject::tr("Invalid telegram")) const;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param a_offset
|
||||
*/
|
||||
uint16_t getDynArraySize(uint16_t& a_offset) const;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param a_name
|
||||
* @param a_value
|
||||
*/
|
||||
static QString formatToolTipLine(const QString& a_name, const uint32_t a_value)
|
||||
{
|
||||
return formatToolTipLine(a_name, QString::number(a_value), a_value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param a_name
|
||||
* @param a_text
|
||||
* @param a_value
|
||||
*/
|
||||
static QString formatToolTipLine(const QString& a_name, const QString& a_text, const uint32_t a_value);
|
||||
|
||||
static QString formatToolTipLine(const QString& a_name, const std::string& a_text, const uint32_t a_value)
|
||||
@@ -358,8 +469,11 @@ namespace N_LogView
|
||||
return formatToolTipLine(a_name, QString::fromStdString(a_text), a_value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* returns the data-byte at a_offset. Returns 0 if a_offset is outside of range.
|
||||
*
|
||||
* @param a_offset
|
||||
*/
|
||||
uint8_t getData(const uint16_t a_offset) const;
|
||||
|
||||
private:
|
||||
|
||||
Reference in new issue
Block a user