File indexing completed on 2024-05-05 04:01:21

0001 /*  This file is part of the KDE project
0002     SPDX-FileCopyrightText: 2006 Kevin Ottens <ervin@kde.org>
0003     SPDX-FileCopyrightText: 2014 Alejandro Fiestas Olivares <afiestas@kde.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.1-or-later
0006 */
0007 
0008 #ifndef SOLID_HARDWARE_H
0009 #define SOLID_HARDWARE_H
0010 
0011 #include <QCoreApplication>
0012 #include <QEventLoop>
0013 
0014 #include <solid/storageaccess.h>
0015 
0016 class QCommandLineParser;
0017 class SolidHardware : public QCoreApplication
0018 {
0019     Q_OBJECT
0020 public:
0021     SolidHardware(int &argc, char **argv)
0022         : QCoreApplication(argc, argv)
0023         , m_error(0)
0024     {
0025     }
0026 
0027     bool hwList(bool interfaces, bool system);
0028     bool hwCapabilities(const QString &udi);
0029     bool hwProperties(const QString &udi);
0030     bool hwQuery(const QString &parentUdi, const QString &query);
0031     bool listen();
0032     bool monitor(const QString &udi);
0033 
0034     enum VolumeCallType { Mount, Unmount, Eject };
0035     bool hwVolumeCall(VolumeCallType type, const QString &udi);
0036 
0037 private:
0038     QEventLoop m_loop;
0039     int m_error;
0040     QString m_errorString;
0041 
0042 private Q_SLOTS:
0043     void slotStorageResult(Solid::ErrorType error, const QVariant &errorData);
0044     void deviceAdded(const QString &udi);
0045     void deviceRemoved(const QString &udi);
0046 };
0047 
0048 #endif // SOLID_HARDWARE_H