| 1 | /* This file is part of the KDE project |
| 2 | SPDX-FileCopyrightText: 2006 Kevin Ottens <ervin@kde.org> |
| 3 | SPDX-FileCopyrightText: 2014 Alejandro Fiestas Olivares <afiestas@kde.org> |
| 4 | |
| 5 | SPDX-License-Identifier: LGPL-2.1-or-later |
| 6 | */ |
| 7 | |
| 8 | #ifndef SOLID_HARDWARE_H |
| 9 | #define SOLID_HARDWARE_H |
| 10 | |
| 11 | #include <QCoreApplication> |
| 12 | #include <QEventLoop> |
| 13 | |
| 14 | #include <solid/storageaccess.h> |
| 15 | |
| 16 | class QCommandLineParser; |
| 17 | class SolidHardware : public QCoreApplication |
| 18 | { |
| 19 | Q_OBJECT |
| 20 | public: |
| 21 | SolidHardware(int &argc, char **argv) |
| 22 | : QCoreApplication(argc, argv) |
| 23 | , m_error(0) |
| 24 | { |
| 25 | } |
| 26 | |
| 27 | bool hwList(bool interfaces, bool system); |
| 28 | bool hwCapabilities(const QString &udi); |
| 29 | bool hwProperties(const QString &udi); |
| 30 | bool hwQuery(const QString &parentUdi, const QString &query); |
| 31 | bool listen(); |
| 32 | bool monitor(const QString &udi); |
| 33 | |
| 34 | enum VolumeCallType { Mount, Unmount, Eject, CanCheck, Check, CanRepair, Repair }; |
| 35 | bool hwVolumeCall(VolumeCallType type, const QString &udi); |
| 36 | |
| 37 | private: |
| 38 | QEventLoop m_loop; |
| 39 | int m_error; |
| 40 | QString m_errorString; |
| 41 | |
| 42 | private Q_SLOTS: |
| 43 | void slotStorageResult(Solid::ErrorType error, const QVariant &errorData); |
| 44 | void deviceAdded(const QString &udi); |
| 45 | void deviceRemoved(const QString &udi); |
| 46 | void slotStorageCheckResult(Solid::ErrorType error, const QVariant &errorData, const QString &udi); |
| 47 | }; |
| 48 | |
| 49 | #endif // SOLID_HARDWARE_H |
| 50 | |