File: dltdbusplugin.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 (830 lines) | stat: -rw-r--r-- 24,391 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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
/**

 * @licence app begin@
 * Copyright (C) 2011-2014  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 dltdbusplugin.cpp
 * For further information see http://www.covesa.global/.
 * @licence end@
 */
 /*  Change log
 *  12.04.2016 Gernot Wirschal added checking of APID in function checkIfDBusMsg
 *                             to avoid overwriting of SomeIP messages
 *  21.09.2016 Gernot Wirschal change loadConfig to parse xml file containing
 *                             APID/CTID pairs which are supposed to be decoded
 *                             as DBUS messages.
 */




#include <QtGui>
#include <QMessageBox>
#include "dltdbusplugin.h"
#include "dbus.h"
#include <dlt_user.h>
#include <QXmlStreamReader>


int DltDBusPlugin::check_logid( QString &tocheck, int index )
{
   if ( tocheck.size() > LOGIDMAXCHAR )
   {
       if ( dltControl->silentmode == true )
        {
         qDebug() << plugin_name_displayed << QString("XML file - LOGID error %1 with index %2 exceeds maximum of %3 characters !\nExit parsing file ...").arg(tocheck).arg(index).arg(LOGIDMAXCHAR);
        }
       else
        {
        QMessageBox::warning(0, QString("XML file - LOGID error"),
                                QString("%1 with index %2 exceeds maximum of %3 characters !\nExit parsing file ...")
                                .arg(tocheck).arg(index).arg(LOGIDMAXCHAR));
        }
     return 1;
   }
   else
   {
     return 0;
   }
}


DltDBusPlugin::DltDBusPlugin()
{
    dltFile = 0;
}

DltDBusPlugin::~DltDBusPlugin() {

}

QString DltDBusPlugin::name()
{
    return plugin_name_displayed;
}

QString DltDBusPlugin::pluginVersion()
{
    return DLT_DBUS_PLUGIN_VERSION;
}

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

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

QString DltDBusPlugin::error()
{
    return errorText;
}

bool DltDBusPlugin::loadConfig(QString filename)
{
 QFile file(filename);
 QXmlStreamReader xml(&file);
 QString temp1;
 config_is_loaded=false;
 int i=-1, j=0, xmlcontentinvalid=0;

 dbus_mesg_identifiers.clear();


 if ( filename.length() <= 0 )
 {
     // set the default config according to COVESA APID/CTID
     // as given in dlt-dbus.conf on the logging device
     //qDebug()<< "Set default configuration";
     logid[0].apid=QString("DBUS");
     logid[0].ctid=QString("ALL");
     dbus_mesg_identifiers << logid[0].apid << logid[0].ctid;
     numberof_valid_logids = 1;
     config_is_loaded = true;
     return true;
 }

  if (!file.open(QFile::ReadOnly | QFile::Text))
 {
     errorText = "Can not load configuration File: ";
     errorText.append(filename);
     return true;
 }

 while (!xml.atEnd())
 {
       xml.readNext();
       if(xml.isStartElement())
       {
           if(xml.name() == QString("logid"))
           {
              i++;
           }
           else if(xml.name() == QString("APID"))
           {
              if ( i>= 0)
               {
               temp1 = xml.readElementText();
               if ( check_logid( temp1, i ) == 0 )
                {
                   logid[i].apid = temp1;
                }
               else // logid is not correct
               {
                 //qDebug()<< "Something wrong with APID";
                 xmlcontentinvalid=1;
                 break;
               }
              }
           } // is APID
           else if(xml.name() == QString("CTID"))
           {
               if ( i>= 0)
                {
                temp1 = xml.readElementText();
                if ( check_logid( temp1, i ) == 0 )
                 {
                    logid[i].ctid = temp1;
                 }
                else // logid is not correct
                {
                  //qDebug()<< "Something wrong with CTID";
                  xmlcontentinvalid=1;
                  break;
                }
               }
           }
           if (xml.hasError())
            {
               if ( dltControl->silentmode == true )
                {
                 qDebug() << plugin_name_displayed  << "XML Parser error" << xml.errorString() << "at" << xml.lineNumber();
                }
               else
                {
                 QMessageBox::warning(0, QString("XML Parser error"),  QString("%1 %2").arg(xml.errorString()).arg(xml.lineNumber()));
                }

              xmlcontentinvalid=1;
            }

       }
       if (i >= MAX_LOGIDS)
       {
        i--;
        if ( dltControl->silentmode == true )
         {
          qDebug() << plugin_name_displayed << "Maximum number of logids exceeded in xml file ! Limiting logid list entries:" << MAX_LOGIDS;
         }
        else
         {
          QMessageBox::warning(0, QString("Warning"),  QString ( "Maximum number of logids exceeded in xml file !\nLimiting logid list to %1 entries").arg(MAX_LOGIDS));
         }


        break;        // so we stop loop if maxcount is reached
       }

 } // while
file.close();

 if (xml.hasError())
 {
    if ( dltControl->silentmode == true )
     {
     qDebug() << plugin_name_displayed << QString("XML Parser error %1 at line %2").arg(xml.errorString()).arg(xml.lineNumber());
     }
    else
     {
      QMessageBox::warning(0, QString("XML Parser error"),  QString("%1 %2").arg(xml.errorString()).arg(xml.lineNumber()));
     }
     xmlcontentinvalid=1;
 }


if ( xmlcontentinvalid == 0 )
{
 for (j=0;j<=i;j++)
 {
     dbus_mesg_identifiers << logid[j].apid << logid[j].ctid;
     numberof_valid_logids = j;
 }
}
else
{
  return false;
}

config_is_loaded = true;
return true;

}


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

QStringList DltDBusPlugin::infoConfig()
{
    //qDebug()<< "return dbus_mesg_identifiers";
    return dbus_mesg_identifiers;
}

QWidget* DltDBusPlugin::initViewer()
{
    // also called when plugin not activated

    form = new DltDbus::Form();
    return form;
}

void DltDBusPlugin::selectedIdxMsgDecoded(int , QDltMsg &/*msg*/)
{
    /* Show Decoded output */
}

void DltDBusPlugin::selectedIdxMsg(int /*index*/, QDltMsg &msg)
{
    QString text;
    QDltArgument argument;

    if(!checkIfDBusMsg(msg))
    {
        form->setTextBrowserDBus("no DBus message!");
        form->setTextBrowserHeader("no DBus message!");
        form->setTextBrowserPayload("no DBus message!");
        form->setTextBrowserPayloadHex("no DBus message!");

        return;
    }

    /* decode DBus message */
    msg.getArgument(1,argument);
    QByteArray data = argument.getData();
    DltDBusDecoder dbusMsg;
    if(!dbusMsg.decodeHeader(data))
    {
        form->setTextBrowserDBus(QString("Decoder error: ") + dbusMsg.getLastError());
        form->setTextBrowserHeader(QString("Decoder error: ") + dbusMsg.getLastError());
        form->setTextBrowserPayload(QString("Decoder error: ") + dbusMsg.getLastError());
        form->setTextBrowserPayloadHex(QString("Decoder error: ") + dbusMsg.getLastError());
        return;
    }

    /* DBus message header */
    text += QString("<table border=\"1\" cellspacing=\"0\" cellheader=\"0\">");
    text += QString("<tr><th>Header</th><th>Value</th></tr>");

    text += QString("<tr><td>Endianess</td><td>%1</td></tr>").arg(dbusMsg.getEndianessString());
    text += QString("<tr><td>Message Type</td><td>%1</td></tr>").arg(dbusMsg.getMessageTypeString());
    text += QString("<tr><td>Flags</td><td>%1</td></tr>").arg(dbusMsg.getFlagsString());
    text += QString("<tr><td>Version</td><td>%1</td></tr>").arg(dbusMsg.getVersion());
    text += QString("<tr><td>Length</td><td>%1</td></tr>").arg(dbusMsg.getPayloadLength());
    text += QString("<tr><td>Serial</td><td>%1</td></tr>").arg(dbusMsg.getSerial());
    text += QString("<tr><td>ArrayLength</td><td>%1</td></tr>").arg(dbusMsg.getArrayLength());
    text += QString("<tr><td>Path</td><td>%1</td></tr>").arg(dbusMsg.getPath());
    text += QString("<tr><td>Interface</td><td>%1</td></tr>").arg(dbusMsg.getInterface());
    text += QString("<tr><td>Member</td><td>%1</td></tr>").arg(dbusMsg.getMember());
    text += QString("<tr><td>ErrorName</td><td>%1</td></tr>").arg(dbusMsg.getErrorName());
    text += QString("<tr><td>ReplySerial</td><td>%1</td></tr>").arg(dbusMsg.getReplySerial());
    text += QString("<tr><td>Destination</td><td>%1</td></tr>").arg(dbusMsg.getDestination());
    text += QString("<tr><td>Sender</td><td>%1</td></tr>").arg(dbusMsg.getSender());
    QByteArray signature = dbusMsg.getSignature();
    text += QString("<tr><td>Signature</td><td>%1</td></tr>").arg(msg.toAsciiTable(signature,false,false,true,256,256,false));
    text += QString("<tr><td>UnixFds</td><td>%1</td></tr>").arg(dbusMsg.getUnixFds());

    text += QString("</table>");

    form->setTextBrowserHeader(text);

    /* DBus message payload Hex*/
    QByteArray payload = dbusMsg.getPayload();
    text = QString("<h3>Size: %1</h3>").arg(payload.size());
    text += msg.toAsciiTable(payload,true,true,false);
    form->setTextBrowserPayloadHex(text);

    /* decode DBus payload */
    if(!dbusMsg.decodePayload())
    {
        form->setTextBrowserDBus(QString("Decoder error: ") + dbusMsg.getLastError());
        form->setTextBrowserPayload(QString("Decoder error: ") + dbusMsg.getLastError());
        return;
    }

    /* DBus message payload */
    text = QString("<table border=\"1\" cellspacing=\"0\" cellheader=\"0\">");
    text += QString("<tr><th>Type</th><th>Value</th></tr>");

    QList<DltDBusParameter> parameters = dbusMsg.getParameters();
    for(int num=0;num<parameters.size();num++)
    {
        DltDBusParameter parameter = parameters[num];
        text += QString("<tr><td>%1</td><td>%2</td></tr>").arg(parameter.getTypeString()).arg(parameter.getValue().toString());
    }

    text += QString("</table>");

    form->setTextBrowserPayload(text);

    /* DBus message overview */
    text = decodeMessageToString(dbusMsg);
    form->setTextBrowserDBus(text);
}


void DltDBusPlugin::initFileStart(QDltFile *file)
{
   if (plugin_is_active == false )
   {
    plugin_is_active = true;
    dltFile = file;
    methods.clear();
    qDebug() << "Activate plugin" << plugin_name_displayed <<  DLT_DBUS_PLUGIN_VERSION;
    // clear old map
    QMapIterator<uint32_t, QDltSegmentedMsg*> i(segmentedMessages);
    while (i.hasNext())
     {
        i.next();
        delete i.value();
     }
    segmentedMessages.clear();
   }
}

void DltDBusPlugin::methodsAddMsg(QDltMsg &msg)
{
    QDltArgument argument1,argument2;

    msg.getArgument(0,argument1);
    msg.getArgument(1,argument2);

    // check if single network message
    if(msg.getNumberOfArguments()!=2 ||
       argument1.getTypeInfo()!=QDltArgument::DltTypeInfoRawd ||
       argument2.getTypeInfo()!=QDltArgument::DltTypeInfoRawd)
        return;

    /* Show DBus message Decoding */
    QByteArray data = argument1.getData()+argument2.getData();
    DltDBusDecoder dbusMsg;
    QString text;
    if(dbusMsg.decode(data))
    {
        if(dbusMsg.getMessageType()==DBUS_MESSAGE_TYPE_METHOD_CALL)
        {
           methods[DltDbusMethodKey(dbusMsg.getSender(),dbusMsg.getSerial())] = dbusMsg.getInterface() + "." + dbusMsg.getMember();
        }
    }
    else
    {

    }
}

void DltDBusPlugin::segmentedMsg(QDltMsg &msg)
{
    QDltArgument argument1,argument2;
    uint32_t handle;

    msg.getArgument(0,argument1);
    msg.getArgument(1,argument2);

    // get handle
    if(argument2.getTypeInfo()!=QDltArgument::DltTypeInfoUInt)
    {
         return;
    }
    handle = argument2.getValue().toUInt();

    // check if this is a segmented network message
    if(argument1.getTypeInfo()!=QDltArgument::DltTypeInfoStrg)
    {
        return;
    }

    if(argument1.getValue().toString()=="NWST")
    {
      if(segmentedMessages.contains(handle))
      {
          // message already exists, this should not happen
          return;
      }

      // add new segmented message
      QDltSegmentedMsg *seg = new QDltSegmentedMsg();
      segmentedMessages[handle] = seg;

      if(seg->add(msg))
      {
          // something went wrong
          qDebug() << plugin_name_displayed << seg->getError();
          return;
      }
    } // NWST
    else if(argument1.getValue().toString()=="NWCH")
    {
        if(segmentedMessages.contains(handle))
        {
            if(segmentedMessages[handle]->add(msg))
            {
                // something went wrong
                qDebug() << plugin_name_displayed << segmentedMessages[handle]->getError();
                return;
            }
        }
    } // NWCH
    else if(argument1.getValue().toString()=="NWEN")
    {
       if(segmentedMessages.contains(handle))
       {
           if(segmentedMessages[handle]->add(msg))
           {
               // something went wrong
               qDebug() << plugin_name_displayed << segmentedMessages[handle]->getError();
               return;
           }
           if(segmentedMessages[handle]->complete())
           {
               if(argument2.getTypeInfo()==QDltArgument::DltTypeInfoUInt)
               {
                   // decode message and add method call to list
                   uint32_t handle = argument2.getValue().toUInt();
                   if(segmentedMessages.contains(handle))
                   {
                       if(segmentedMessages[handle]->complete())
                       {
                           QByteArray data = segmentedMessages[handle]->getHeader() + segmentedMessages[handle]->getPayload() ;
                           DltDBusDecoder dbusMsg;
                           if(dbusMsg.decode(data))
                           {
                               if(dbusMsg.getMessageType()==DBUS_MESSAGE_TYPE_METHOD_CALL)
                               {
                                   methods[DltDbusMethodKey(dbusMsg.getSender(),dbusMsg.getSerial())] = dbusMsg.getInterface() + "." + dbusMsg.getMember();
                               }
                           }
                       }
                   }
               }
               //qDebug() << "Complete segemented message" << segmentedMessages[handle]->getPayload().size();
           }
           else
           {
                qDebug() << plugin_name_displayed <<"Incomplete segemented message" << handle;
           }
       }
    } // NWCN
}

void DltDBusPlugin::initMsg(int /*index*/, QDltMsg &msg)
{

    if(!checkIfDBusMsg(msg))
        return;

    // add method call
    methodsAddMsg(msg);

    // add segment
    segmentedMsg(msg);

}

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

void DltDBusPlugin::initFileFinish()
{
}

void DltDBusPlugin::updateFileStart()
{
//empty. Implemented because derived plugin interface functions are virtual.
}

void DltDBusPlugin::updateMsg(int /*index*/, QDltMsg &msg)
{
   //  qDebug () << "Activate plugin" << plugin_name_displayed << "Version" << DLT_DBUS_PLUGIN_VERSION;
    if(!checkIfDBusMsg(msg))
        return;

    // add method call
    methodsAddMsg(msg);

    // add segment
    segmentedMsg(msg);
}

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

void DltDBusPlugin::updateFileFinish()
{

}

bool DltDBusPlugin::isMsg(QDltMsg & msg, int triggeredByUser)
{
    Q_UNUSED(triggeredByUser);

    return checkIfDBusMsg(msg);
}

bool DltDBusPlugin::decodeMsg(QDltMsg &msg, int triggeredByUser)
{
    QDltArgument argument1,argument2,argument;
    QString text;
    Q_UNUSED(triggeredByUser);

    if(!checkIfDBusMsg(msg))
        return false;

    msg.getArgument(0,argument1);
    msg.getArgument(1,argument2);

    // check if it is a common network message
    if(msg.getNumberOfArguments()==2 &&
       argument1.getTypeInfo()==QDltArgument::DltTypeInfoRawd &&
       argument2.getTypeInfo()==QDltArgument::DltTypeInfoRawd)
    {
        // this is a single network message
        QByteArray data = argument1.getData() + argument2.getData();
        DltDBusDecoder dbusMsg;
        if(dbusMsg.decode(data))
        {
            text += decodeMessageToString(dbusMsg);
        }
        else
        {
            text += "DBus Decoder error: " + dbusMsg.getLastError();
        }
        msg.removeArgument(1);
        msg.removeArgument(0);
    }
    else if(argument1.getTypeInfo()==QDltArgument::DltTypeInfoStrg &&
       argument1.getValue().toString()=="NWTR")
    {
        // this is a truncated network message
        // decode header only
        // this is a single network message
        QByteArray data = argument1.getData() + argument2.getData();
        DltDBusDecoder dbusMsg;
        if(dbusMsg.decode(data,true))
        {
            text += decodeMessageToString(dbusMsg,true);
        }
        else
        {
            text += "DBus Decoder error: " + dbusMsg.getLastError();
        }
        msg.removeArgument(1);
        msg.removeArgument(0);
    }
    else if(argument1.getTypeInfo()==QDltArgument::DltTypeInfoStrg &&
            argument1.getValue().toString()=="NWEN")
    {
        // this is the end of a segmented message
        // decode now the whole message
        // get handle
        if(argument2.getTypeInfo()==QDltArgument::DltTypeInfoUInt)
        {
            uint32_t handle = argument2.getValue().toUInt();
            if(segmentedMessages.contains(handle))
            {
                if(segmentedMessages[handle]->complete())
                {
                    // show decoded message
                    QByteArray data = segmentedMessages[handle]->getHeader() + segmentedMessages[handle]->getPayload() ;
                    DltDBusDecoder dbusMsg;
                    if(dbusMsg.decode(data))
                    {
                        text += decodeMessageToString(dbusMsg);
                    }
                    else
                    {
                        text += "DBus Decoder error: " + dbusMsg.getLastError();
                    }
                }
                else
                {
                    text += "Incomplete segmented message " + QString("%1").arg(handle);
                }
            }
            else
            {
                text += "Unknown segmented message " + QString("%1").arg(handle);
            }
        }
        else
        {
            text += "Type error in segmented message";
        }
        msg.removeArgument(1);
        msg.removeArgument(0);
    }
    else
    {
        // nothing to do
        return true;
    }

    /* Add decoded parameter*/
    argument.setTypeInfo(QDltArgument::DltTypeInfoStrg);
    argument.setEndianness(msg.getEndianness());
    argument.setOffsetPayload(0);
    QByteArray dataText;
    dataText.append(text);
    argument.setData(dataText);
    msg.addArgument(argument);

    return true;
}

QString DltDBusPlugin::stringToHtml(QString str)
{
    str = str.replace("<","&#60;");
    str = str.replace(">","&#62;");

    return str;
}

bool DltDBusPlugin::checkIfDBusMsg(QDltMsg &msg)
{
    QDltArgument argument1,argument2;
    int hit=0, i=0;

    if ( config_is_loaded == false )
    {
        return false;
    }

    // going through the list of APID/CTID pairs to determine "DBUS messages"

    while ( i <= numberof_valid_logids )
    {
       if ((msg.getApid() == logid[i].apid) &&  (msg.getCtid() == logid[i].ctid) )
       {
          hit = 1;
          break;
       }
       i++;
    }
    if ( hit == 0)
        return false;

    // at least two arguments in network message
    if(msg.getType()!=QDltMsg::DltTypeNwTrace || msg.getSubtype()!=QDltMsg::DltNetworkTraceIpc || msg.getNumberOfArguments()<2)
        return false;

    msg.getArgument(0,argument1);
    msg.getArgument(1,argument2);

    // check if this is a segmented network message
    if(argument1.getTypeInfo()==QDltArgument::DltTypeInfoStrg && (
       argument1.getValue().toString()=="NWCH" ||
       argument1.getValue().toString()=="NWST" ||
       argument1.getValue().toString()=="NWEN" ||
       argument1.getValue().toString()=="NWTR"))
        return true;

    // check if it is a common network message
    if(msg.getNumberOfArguments()==2 &&
       argument1.getTypeInfo()==QDltArgument::DltTypeInfoRawd &&
       argument2.getTypeInfo()==QDltArgument::DltTypeInfoRawd)
        return true;

    // no known network message
    return false;
}

QString DltDBusPlugin::decodeMessageToString(DltDBusDecoder &dbusMsg,bool headerOnly)
{
    QList<DltDBusParameter> parameters = dbusMsg.getParameters();
    QString text;
    QString method;
    switch(dbusMsg.getMessageType())
    {
        case DBUS_MESSAGE_TYPE_METHOD_CALL:
            text = QString("C [%1,%2] ").arg(dbusMsg.getSender()).arg(dbusMsg.getSerial()) + " " + dbusMsg.getPath() + " " + dbusMsg.getInterface()+"."+dbusMsg.getMember()+" ";
            break;
        case DBUS_MESSAGE_TYPE_METHOD_RETURN:
            method = methods[DltDbusMethodKey(dbusMsg.getDestination(),dbusMsg.getReplySerial())];
            text = QString("R [%1,%2] ").arg(dbusMsg.getDestination()).arg(dbusMsg.getReplySerial()) + method + " ";
            break;
        case DBUS_MESSAGE_TYPE_SIGNAL:
            text = QString("S [%1] ").arg(dbusMsg.getSender()) + " " + dbusMsg.getPath() + " " + dbusMsg.getInterface() + "." + dbusMsg.getMember() + " ";
            break;
        default:
            text = dbusMsg.getMessageTypeStringShort() + " " + dbusMsg.getInterface() + "." + dbusMsg.getMember();
    }

    if(headerOnly)
    {
        return text;
    }

    text += " (";

    bool start = true;
    char lastType = 0;
    for(int num=0;num<parameters.size();num++)
    {
        DltDBusParameter parameter = parameters[num];
        if(start)
        {
            start = false;
        }
        else
        {
            if(parameter.getType()==DBUS_TYPE_ARRAY || parameter.getType()==DBUS_TYPE_STRUCT || parameter.getType()==DBUS_TYPE_STRUCT_BEGIN || parameter.getType()==DBUS_TYPE_STRUCT_END ||
               parameter.getType()==DBUS_TYPE_DICT_ENTRY || parameter.getType()==DBUS_TYPE_DICT_ENTRY_BEGIN || parameter.getType()==DBUS_TYPE_DICT_ENTRY_END)
                ;
            else if(lastType==DBUS_TYPE_ARRAY || lastType==DBUS_TYPE_STRUCT || lastType==DBUS_TYPE_STRUCT_BEGIN || lastType==DBUS_TYPE_STRUCT_END ||
                    lastType==DBUS_TYPE_DICT_ENTRY || lastType==DBUS_TYPE_DICT_ENTRY_BEGIN || lastType==DBUS_TYPE_DICT_ENTRY_END)
                ;
            else
                text += ",";
        }
        if(parameter.getType()==DBUS_TYPE_STRING ||parameter.getType()==DBUS_TYPE_OBJECT_PATH || parameter.getType()==DBUS_TYPE_SIGNATURE )
            text += "\"";
        text += parameter.getValue().toString();
        if(parameter.getType()==DBUS_TYPE_STRING ||parameter.getType()==DBUS_TYPE_OBJECT_PATH || parameter.getType()==DBUS_TYPE_SIGNATURE )
            text += "\"";
        lastType = parameter.getType();
    }
    text += ")";

    return text;
}



/* Control Plugin methods */

// these are only needed to get information about silent mode via
// dltcontrol
bool DltDBusPlugin::initControl(QDltControl *control)
{
    dltControl = control;
    return true;
}


bool DltDBusPlugin::initConnections(QStringList list)
{
	Q_UNUSED(list);
    return true;
}

bool DltDBusPlugin::controlMsg(int , QDltMsg &)
{
    return true;
}

bool DltDBusPlugin::stateChanged(int index, QDltConnection::QDltConnectionState connectionState,QString hostname)
{
    Q_UNUSED(index);
    Q_UNUSED(connectionState);
    Q_UNUSED(hostname);
    return true;
}

bool DltDBusPlugin::autoscrollStateChanged(bool enabled)
{
    Q_UNUSED(enabled);
    return true;
}

void DltDBusPlugin::initMessageDecoder(QDltMessageDecoder* pMessageDecoder)
{
    Q_UNUSED(pMessageDecoder);
}

void DltDBusPlugin::initMainTableView(QTableView* pTableView)
{
    Q_UNUSED(pTableView);
}

void DltDBusPlugin::configurationChanged()
{}

#ifndef QT5
Q_EXPORT_PLUGIN2(dltdbusplugin, DltDBusPlugin);
#endif