1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
|
/**
* @licence app begin@
* Copyright (C) 2011-2012 BMW AG
*
* This file is part of COVESA Project Dlt Viewer.
*
* Contributions are licensed to the COVESA Alliance under one or more
* Contribution License Agreements.
*
* \copyright
* This Source Code Form is subject to the terms of the
* Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
* this file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* \file nonverboseplugin.h
* For further information see http://www.covesa.global/.
* @licence end@
*/
#ifndef NONVERBOSEPLUGIN_H
#define NONVERBOSEPLUGIN_H
#include <QObject>
#include <QHash>
#include "plugininterface.h"
#if defined(_MSC_VER)
#include <cstdint>
#else
#include <stdint.h>
#endif
#define NON_VERBOSE_PLUGIN_VERSION "1.0.0"
#define NON_VERBOSE_PLUGIN_NAME "Non Verbose Mode Plugin"
class DltFibexKey
{
public:
DltFibexKey(QString id,QString appid,QString ctid)
{
this->id = id;
this->appid = appid;
this->ctid = ctid;
}
friend bool operator==(const DltFibexKey &e1, const DltFibexKey &e2);
friend size_t qHash(const DltFibexKey &key);
QString id;
QString appid;
QString ctid;
};
inline bool operator==(const DltFibexKey &e1, const DltFibexKey &e2)
{
return (e1.id == e2.id)
&& (e1.appid == e2.appid) && (e1.ctid == e2.ctid);
}
inline size_t qHash(const DltFibexKey &key)
{
return qHash(key.id) ^ qHash(key.appid) ^ qHash(key.ctid);
}
/**
* The structure of a Fibex PDU information.
*/
class DltFibexPdu
{
public:
DltFibexPdu() { byteLength=0;typeInfo=0; }
QString id;
QString description;
int32_t byteLength;
uint32_t typeInfo;
};
class DltFibexPduRef
{
public:
DltFibexPduRef() { ref = 0; }
QString id;
DltFibexPdu *ref;
};
/**
* The structure of a Fibex Frame information.
*/
class DltFibexFrame
{
public:
DltFibexFrame() { byteLength=0;messageType=0;messageInfo=0;pduRefCounter=0; }
QString id;
QString filename;
int32_t byteLength;
uint8_t messageType;
int8_t messageInfo;
QString appid;
QString ctid;
QList<DltFibexPduRef*> pdureflist;
uint32_t pduRefCounter;
};
class NonverbosePlugin : public QObject, QDLTPluginInterface, QDLTPluginDecoderInterface, QDltPluginControlInterface
{
Q_OBJECT
Q_INTERFACES(QDLTPluginInterface)
Q_INTERFACES(QDLTPluginDecoderInterface)
Q_INTERFACES(QDltPluginControlInterface)
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
Q_PLUGIN_METADATA(IID "org.genivi.DLT.NonVerbosePlugin")
#endif
public:
NonverbosePlugin();
/* QDLTPluginInterface interface */
QString name();
QString pluginVersion();
QString pluginInterfaceVersion();
QString description();
QString error();
bool loadConfig(QString filename);
bool saveConfig(QString filename);
QStringList infoConfig();
/* QDltPluginDecoderInterface */
bool isMsg(QDltMsg &msg, int triggeredByUser);
bool decodeMsg(QDltMsg &msg, int triggeredByUser);
/* QDltPluginControlInterface */
bool initControl(QDltControl *control);
bool initConnections(QStringList list);
bool controlMsg(int index, QDltMsg &msg);
bool stateChanged(int index, QDltConnection::QDltConnectionState connectionState,QString hostname);
bool autoscrollStateChanged(bool enabled);
void initMessageDecoder(QDltMessageDecoder* pMessageDecoder);
void initMainTableView(QTableView* pTableView);
void configurationChanged();
/* Faster lookup */
//is it necessary that this is public?
QHash<QString, DltFibexPdu *> pdumap;
QHash<QString, DltFibexFrame *> framemap;
QHash<DltFibexKey, DltFibexFrame *> framemapwithkey;
private:
bool parseFile(QString filename);
void clear();
QDltControl *dltControl;
QString m_error_string;
};
#endif // NONVERBOSEPLUGIN_H
|