File: qdltplugin.h

package info (click to toggle)
dlt-viewer 2.27.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 9,196 kB
  • sloc: cpp: 31,376; ansic: 4,224; xml: 492; sh: 244; makefile: 81
file content (130 lines) | stat: -rw-r--r-- 3,580 bytes parent folder | download
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
#ifndef QDLTPLUGIN_H
#define QDLTPLUGIN_H

#include "plugininterface.h"

#include <QDir>

#include "export_rules.h"


//! Access class to a DLT Plugin to decode, view and control DLT messages
/*!
  This class loads a DLT Viewer Plugin library and provides functions to access the plugin.
*/
class QDLT_EXPORT QDltPlugin
{
public:

    //! Constructor
    QDltPlugin();

    //! Status of the plugin
    typedef enum { ModeDisable=0, ModeEnable, ModeShow } Mode;

    //! Plugin configuration type, file or directory
    enum { TypeFile, TypeDirectory };

    //! Load the plugin by attaching the interfaces
    void loadPlugin(QObject *plugin);

    //! Get the running status of the plugin
    /*!
      Plugin can be disabled, enabled and viewed.
    */
    int getMode();

    //! Set the running status of the plugin
    /*!
      Plugin can be disabled, enabled and viewed.
    */
    void setMode(QDltPlugin::Mode _mode);

    //! Get the complete filename of the plugin including path
    QString getFilename();

    //! Set the complete filename of the plugin including path and load the plugin configuration
    void setFilename(QString _filename);

    //! Check if this is a decoder plugin
    /*!
      \return True if it is a decoder plugin
    */
    bool isDecoder();

    //! Check if this is a viewer plugin
    /*!
      \return True if it is a viewer plugin
    */
    bool isViewer();

    //! Check if this is a control plugin
    /*!
      \return True if it is a control plugin
    */
    bool isControl();

    //! Check if this is a command plugin
    /*!
      \return True if it is a command plugin
    */
    bool isCommand();

    // generic plugin interfaces
    QString name();
    QString pluginVersion();
    QString pluginInterfaceVersion();
    QString error();
    bool loadConfig(QString filename);
    QStringList infoConfig();

    // viewer plugin interfaces
    QWidget* initViewer();
    void initFileStart(QDltFile *file);
    void initMsg(int index, QDltMsg &msg);
    void initMsgDecoded(int index, QDltMsg &msg);
    void initFileFinish();
    void updateFileStart();
    void updateMsg(int index, QDltMsg &msg);
    void updateMsgDecoded(int index, QDltMsg &msg);
    void updateFileFinish();
    void selectedIdxMsg(int index, QDltMsg &msg);
    void selectedIdxMsgDecoded(int index, QDltMsg &msg);

    // control plugin interfaces
    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* messageDecoder);
    void initMainTableView(QTableView* pTableView);
    void configurationChanged();

    // decoder plugin interfaces
    bool decodeMsg(QDltMsg &msg, int triggeredByUser);

    // command plugin interfaces
    bool command(QString cmd,QList<QString> params);

private:

    //! The complete filename of the plugin including path
    QString filename;

    //! The running status of the plugin
    Mode mode;

    //! Link to all the plugin interfaces, when plugin loaded
    /*!
      Pointers are zero, if plugin does not support the interface.
    */
    QDLTPluginInterface *plugininterface;
    QDLTPluginDecoderInterface *plugindecoderinterface;
    QDltPluginViewerInterface  *pluginviewerinterface;
    QDltPluginControlInterface *plugincontrolinterface;
    QDltPluginCommandInterface *plugincommandinterface;

};

#endif // QDLTPLUGIN_H