1 /*!
2  * \brief Contains information collected by the diagnosis functionality.
3  *
4  * \copyright Copyright (c) 2014-2021 Governikus GmbH & Co. KG, Germany
5  */
6 
7 #pragma once
8 
9 #include "ReaderInfo.h"
10 
11 #include <QDateTime>
12 #include <QNetworkInterface>
13 #include <QObject>
14 #include <QStringList>
15 #include <QVector>
16 
17 namespace governikus
18 {
19 
20 class DiagnosisContext
21 	: public QObject
22 {
23 	Q_OBJECT
24 
25 	public:
26 		class ComponentInfo;
27 
28 	private:
29 		QString mPcscVersion;
30 		QVector<ComponentInfo> mPcscComponents;
31 		QVector<ComponentInfo> mPcscDrivers;
32 		QVector<ReaderInfo> mReaderInfos;
33 		QDateTime mTimestamp;
34 		QList<QNetworkInterface> mNetworkInterfaces;
35 
36 	public:
37 		DiagnosisContext();
38 
getPcscVersion()39 		[[nodiscard]] const QString& getPcscVersion() const
40 		{
41 			return mPcscVersion;
42 		}
43 
44 
getPcscComponents()45 		[[nodiscard]] const QVector<ComponentInfo>& getPcscComponents() const
46 		{
47 			return mPcscComponents;
48 		}
49 
50 
getPcscDrivers()51 		[[nodiscard]] const QVector<ComponentInfo>& getPcscDrivers() const
52 		{
53 			return mPcscDrivers;
54 		}
55 
56 
57 		void setPcscInfo(const QString& pVersion, const QVector<ComponentInfo>& pComponents, const QVector<ComponentInfo>& pDrivers);
58 
getReaderInfos()59 		[[nodiscard]] const QVector<ReaderInfo>& getReaderInfos() const
60 		{
61 			return mReaderInfos;
62 		}
63 
64 
65 		void setReaderInfos(const QVector<ReaderInfo>& mInfos);
66 
getTimestamp()67 		[[nodiscard]] const QDateTime& getTimestamp() const
68 		{
69 			return mTimestamp;
70 		}
71 
72 
73 		void setTimestamp(const QDateTime& pTimestamp);
74 
75 		void setNetworkInterfaces(const QList<QNetworkInterface>& pNetworkInterface);
76 		[[nodiscard]] const QList<QNetworkInterface>& getNetworkInterfaces() const;
77 
78 	Q_SIGNALS:
79 		void pcscVersionChanged();
80 		void readerInfosChanged();
81 		void timestampChanged();
82 		void pcscInfoChanged();
83 		void modelChanged();
84 		void fireDataChanged();
85 		void fireNetworkInfoChanged();
86 };
87 
88 
89 class DiagnosisContext::ComponentInfo
90 {
91 	QString mPath;
92 	QString mDescription;
93 	QString mVersion;
94 	QString mManufacturer;
95 
96 	public:
97 		ComponentInfo(const QString& pPath = QString(), const QString& pDescription = QString(),
98 				const QString& pVersion = QString(), const QString& pManufacturer = QString())
mPath(pPath)99 			: mPath(pPath)
100 			, mDescription(pDescription)
101 			, mVersion(pVersion)
102 			, mManufacturer(pManufacturer)
103 		{
104 		}
105 
106 
getPath()107 		[[nodiscard]] const QString& getPath() const
108 		{
109 			return mPath;
110 		}
111 
112 
getDescription()113 		[[nodiscard]] const QString& getDescription() const
114 		{
115 			return mDescription;
116 		}
117 
118 
getVersion()119 		[[nodiscard]] const QString& getVersion() const
120 		{
121 			return mVersion;
122 		}
123 
124 
getManufacturer()125 		[[nodiscard]] const QString& getManufacturer() const
126 		{
127 			return mManufacturer;
128 		}
129 
130 
131 };
132 
133 } // namespace governikus
134