SIde-Channel Analysis toolKit (SICAK)
Software toolkit for side-channel analysis
visu.h
Go to the documentation of this file.
1 /*
2 * SICAK - SIde-Channel Analysis toolKit
3 * Copyright (C) 2018 Petr Socha, FIT, CTU in Prague
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
18 
29 #ifndef VISU_H
30 #define VISU_H
31 
32 #include <QObject>
33 #include <QCommandLineParser>
34 #include <QtCharts/QChartView>
35 #include <QtCharts/QLineSeries>
36 #include <QtCharts/QValueAxis>
37 
38 QT_CHARTS_USE_NAMESPACE
39 
40 #include "blockprocess.h"
41 #include "tracesprocess.h"
42 
50 class Visu: public QObject {
51 
52 Q_OBJECT
53 
54 public:
55 
56  enum CommandLineParseResult {
57  CommandLineProcessChart,
58  CommandLineNOP,
59  CommandLineError,
60  CommandLineVersionRequested,
61  CommandLineHelpRequested
62  };
63 
65  size_t traceNo;
66  QString color;
67  };
68 
70  size_t matrixNo;
71  size_t candidateNo;
72  QString color;
73  };
74 
75  Visu(QObject *parent = 0) : QObject(parent), m_display(false), m_save(false), m_filepath(""), m_width(800), m_height(400), m_title(""), m_tracesSet(false), m_traces(""), m_tracesN(0), m_tracesRangeSet(false), m_tracesRange(0), m_tValsSet(false), m_tValues(""), m_correlationsSet(false), m_correlations(""), m_correlationsSetsQ(0), m_correlationsCandidatesK(0), m_samplesPerTrace(0), m_samplesRangeSet(false), m_samplesRange(0.0f), m_plotTVals(false), m_tValsColor("auto"), m_chart(nullptr), m_axisX(nullptr), m_axisYtraces(nullptr), m_axisYcorrs(nullptr), m_axisYtvals(nullptr) {}
76 
78  CommandLineParseResult parseCommandLineParams(QCommandLineParser & parser);
79 
80 protected:
81 
82  // Command line arguments
83  bool m_display;
84  bool m_save;
85  QString m_filepath;
86  size_t m_width;
87  size_t m_height;
88  QString m_title;
89 
90  bool m_tracesSet;
91  QString m_traces;
92  size_t m_tracesN;
93  bool m_tracesRangeSet;
94  double m_tracesRange;
95 
96  bool m_tValsSet;
97  QString m_tValues;
98 
99  bool m_correlationsSet;
100  QString m_correlations;
101  size_t m_correlationsSetsQ;
102  size_t m_correlationsCandidatesK;
103 
104  size_t m_samplesPerTrace;
105  bool m_samplesRangeSet;
106  double m_samplesRange;
107 
108  // Series arguments
109  bool m_plotTVals;
110  QString m_tValsColor;
111 
112  QList<PowerTraceSeries> m_powerTracesToPlot;
113  QList<CorrelationTraceSeries> m_correlationTracesToPlot;
114 
115  // Chart
116  QChart * m_chart;
117  QValueAxis * m_axisX;
118  QValueAxis * m_axisYtraces;
119  QValueAxis * m_axisYcorrs;
120  QValueAxis * m_axisYtvals;
121 
122 public slots:
123 
125  bool createChart();
127  bool saveChart() const;
128  size_t getWidth() const { return m_width; }
129  size_t getHeight() const { return m_height; }
130  bool shouldDisplay() const { return m_display; }
131  bool shouldSave() const { return m_save; }
132  QChartView * getChartView() const;
133 
134 signals:
135 
136  void finished();
137 
138 };
139 
140 #endif /* VISU_H */
141 
bool saveChart() const
Save created chart to the specified file.
Definition: visu.cpp:519
Definition: visu.h:64
CommandLineParseResult parseCommandLineParams(QCommandLineParser &parser)
Parse parameters from the command line and configuration files.
Definition: visu.cpp:46
Block processing plugin interface for use e.g. in prep.
Definition: visu.h:69
bool createChart()
Creates a chart based on the parameters set by parseCommandLineParams.
Definition: visu.cpp:288
Class providing text-based UI allowing to plot power traces, correlation traces or t-value traces.
Definition: visu.h:50
Traces processing plugin interface for use e.g. in prep.