kpmcore/src/core/smartparser.h

54 lines
1.0 KiB
C
Raw Normal View History

/*
SPDX-FileCopyrightText: 2018 Caio Jordão Carvalho <caiojcarvalho@gmail.com>
SPDX-License-Identifier: GPL-3.0-or-later
*/
2018-01-08 20:59:48 +00:00
#ifndef KPMCORE_SMARTPARSER_H
2018-01-08 20:59:48 +00:00
#define KPMCORE_SMARTPARSER_H
#include <QJsonDocument>
#include <QString>
class SmartDiskInformation;
/** A parser to SMART JSON output.
2018-01-11 20:59:18 +00:00
Responsible to execute smartctl and parse its output.
@author Caio Jordão Carvalho <caiojcarvalho@gmail.com>
*/
class SmartParser
2018-01-08 20:59:48 +00:00
{
public:
2019-12-09 16:09:53 +00:00
explicit SmartParser(const QString &device_path);
~SmartParser();
2018-01-08 20:59:48 +00:00
public:
bool init();
public:
const QString &devicePath() const
{
2019-11-22 13:39:14 +00:00
return m_DevicePath; /**< @return the device path that SMART must analyze */
2018-01-08 20:59:48 +00:00
}
SmartDiskInformation *diskInformation() const
{
return m_DiskInformation; /**< @return a reference to parsed disk information */
2018-01-08 20:59:48 +00:00
}
protected:
void loadSmartOutput();
void loadAttributes();
private:
const QString m_DevicePath;
QJsonDocument m_SmartOutput;
SmartDiskInformation *m_DiskInformation;
};
#endif // SMARTPARSER_H