File: dummyviewerplugin.cpp

package info (click to toggle)
dlt-viewer 2.23.0%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 7,432 kB
  • sloc: cpp: 27,832; ansic: 4,454; xml: 491; sh: 154; makefile: 75
file content (183 lines) | stat: -rw-r--r-- 3,748 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
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
/**
 * @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 dummyviewerplugin.cpp
 * For further information see http://www.covesa.global/.
 * @licence end@
 */

#include <QtGui>

#include "dummyviewerplugin.h"

DummyViewerPlugin::DummyViewerPlugin()
{
    form = NULL;
    dltFile = NULL;
    counterMessages = 0;
    counterNonVerboseMessages = 0;
    counterVerboseMessages = 0;
}

DummyViewerPlugin::~DummyViewerPlugin()
{

}

QString DummyViewerPlugin::name()
{
    return QString("Dummy Viewer Plugin");
}

QString DummyViewerPlugin::pluginVersion(){
    return DUMMY_VIEWER_PLUGIN_VERSION;
}

QString DummyViewerPlugin::pluginInterfaceVersion(){
    return PLUGIN_INTERFACE_VERSION;
}

QString DummyViewerPlugin::description()
{
    return QString();
}

QString DummyViewerPlugin::error()
{
    return QString();
}

bool DummyViewerPlugin::loadConfig(QString /* filename */)
{
    return true;
}

bool DummyViewerPlugin::saveConfig(QString /* filename */)
{
    return true;
}

QStringList DummyViewerPlugin::infoConfig()
{
    return QStringList();
}

QWidget* DummyViewerPlugin::initViewer()
{
    form = new DummyViewer::Form();
    return form;
}


void DummyViewerPlugin::updateCounters(int , QDltMsg &msg)
{
    if(!dltFile)
        return;



            if(msg.getMode() == QDltMsg::DltModeVerbose)
            {
                counterVerboseMessages++;
            }
            if(msg.getMode() == QDltMsg::DltModeNonVerbose)
            {
                counterNonVerboseMessages++;
            }
}


void DummyViewerPlugin::selectedIdxMsg(int index, QDltMsg &/*msg*/) {
    if(!dltFile)
        return;

    //qDebug() << "undecoded: " << msg.toStringPayload();

    form->setSelectedMessage(index);
}

void DummyViewerPlugin::selectedIdxMsgDecoded(int , QDltMsg &/*msg*/){

    //qDebug() << "decoded: " << msg.toStringPayload();

}

void DummyViewerPlugin::initFileStart(QDltFile *file){
if(nullptr == file)
        return;

    dltFile = file;

   if (form)
   {
    form->setMessages(dltFile->size());
   }

    counterMessages = dltFile->size();

    counterNonVerboseMessages = 0;
    counterVerboseMessages = 0;
}

void DummyViewerPlugin::initMsg(int index, QDltMsg &msg){

    updateCounters(index, msg);
}

void DummyViewerPlugin::initMsgDecoded(int , QDltMsg &){
//empty. Implemented because derived plugin interface functions are virtual.
}

void DummyViewerPlugin::initFileFinish(){
   if(nullptr == dltFile)
        return;
   if (form)
   {
    form->setMessages(dltFile->size());
    form->setVerboseMessages(counterVerboseMessages);
    form->setNonVerboseMessages(counterNonVerboseMessages);
   }
}

void DummyViewerPlugin::updateFileStart(){

}

void DummyViewerPlugin::updateMsg(int index, QDltMsg &msg){
        if(!dltFile)
            return;

        updateCounters(index,msg);

        counterMessages = dltFile->size();
}

void DummyViewerPlugin::updateMsgDecoded(int , QDltMsg &){
//empty. Implemented because derived plugin interface functions are virtual.
}

void DummyViewerPlugin::updateFileFinish(){
   if(nullptr == dltFile)
        return;
    if (form)
   {
    form->setMessages(dltFile->size());
    form->setVerboseMessages(counterVerboseMessages);
    form->setNonVerboseMessages(counterNonVerboseMessages);
   }
}

#ifndef QT5
Q_EXPORT_PLUGIN2(dummyviewerplugin, DummyViewerPlugin);
#endif