File: qdltpluginmanager.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 (97 lines) | stat: -rw-r--r-- 2,887 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
#ifndef QDLTPLUGINMANAGER_H
#define QDLTPLUGINMANAGER_H

#include "plugininterface.h"

#include <QDir>

#include "export_rules.h"

//! Manage all DLT Plugins
/*!
  This class loads all DLT Viewer Plugins and provides access to them.
*/

class QDltPlugin;
class QMutex;

class QDLT_EXPORT QDltPluginManager : public QDltMessageDecoder
{
public:

    //! Constructor
    QDltPluginManager();
    ~QDltPluginManager();

    //! The number of plugins
    /*!
      \return the number of loaded plugins.
    */
    int size() const;

    //! Loads all plugins from three directories.current working sub directory /plugin
    /*!
      The three directories:
      - ./plugin
      - settingsPluginPath
      - /usr/share/dlt-viewer/plugins
      \param settingsPluginPath Full path name.
    */
    QStringList loadPlugins(const QString &settingsPluginPath);

    //! Loads the configuration of the plugin with the pluginName
    /*!
      \param pluginName The name of the plugin to load the configuration.
      \param filename The file to be loaded.
    */
    void loadConfig(QString pluginName,QString filename);

    //! Implementation of QDltMessageDecoder's pure virtual method.
    //! Decode message by decoding through all loaded an activated decoder plugins.
    /*!
      \param msg The message to be decoded.
      \param triggeredByUser Whether decode operation was triggered by the user or not
    */
    void decodeMsg(QDltMsg &msg,int triggeredByUser) override;

    //! Get the list of pointers to all loaded plugins
    QList<QDltPlugin*> getPlugins() { return plugins; }

    //! Get the list of pointers to all enabled decoder plugins
    QList<QDltPlugin*> getDecoderPlugins();

    //! Get the list of pointers to all enabled viewer plugins
    QList<QDltPlugin*> getViewerPlugins();

    //! Find a plugin with the specific name
    /*!
      \param name The name of the plugin to be searched for.
      \return pinter to plugin or zero if no plugin with the name is found
    */
    QDltPlugin* findPlugin(QString &name);

    //control plugin interface
    bool stateChanged(int index, QDltConnection::QDltConnectionState connectionState, QString hostname);
    bool autoscrollStateChanged(bool enabled);
    bool initControl(QDltControl *control);
    bool initConnections(QStringList list);

    //control plugin execution order
    void initPluginPriority(const QStringList &desiredPrio);
    bool decreasePluginPriority(const QString &name);
    bool raisePluginPriority(const QString &name);
    bool setPluginPriority(const QString& name, int prio);
    QStringList getPluginPriorities() const;

private:
    mutable QMutex* pMutex_pluginList;

    //! The list of pointers to all loaded plugins
    QList<QDltPlugin*> plugins;

    //! Loads all plugins from a special directory
    QStringList loadPluginsPath(QDir &dir);

};

#endif // QDLTPLUGINMANAGER_H