Solid

frontend/deviceinterface.h
1/*
2 SPDX-FileCopyrightText: 2006-2007 Kevin Ottens <ervin@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5*/
6
7#ifndef SOLID_DEVICEINTERFACE_H
8#define SOLID_DEVICEINTERFACE_H
9
10#include <QObject>
11
12#include <solid/solid_export.h>
13
14namespace Solid
15{
16class Device;
17class DevicePrivate;
18class Predicate;
19class DeviceInterfacePrivate;
20
21/**
22 * @class Solid::DeviceInterface deviceinterface.h <Solid/DeviceInterface>
23 *
24 * Base class of all the device interfaces.
25 *
26 * A device interface describes what a device can do. A device generally has
27 * a set of device interfaces.
28 */
29class SOLID_EXPORT DeviceInterface : public QObject
30{
32 Q_DECLARE_PRIVATE(DeviceInterface)
33
34public:
35 /**
36 * This enum type defines the type of device interface that a Device can have.
37 *
38 * - Unknown : An undetermined device interface
39 * - Processor : A processor
40 * - Block : A block device
41 * - StorageAccess : A mechanism to access data on a storage device
42 * - StorageDrive : A storage drive
43 * - OpticalDrive : An optical drive (CD-ROM, DVD, ...)
44 * - StorageVolume : A volume
45 * - OpticalDisc : An optical disc
46 * - Camera : A digital camera
47 * - PortableMediaPlayer: A portable media player
48 * - NetworkShare: A network share interface
49 */
50 enum Type {
51 Unknown = 0,
52 GenericInterface = 1,
53 Processor = 2,
54 Block = 3,
55 StorageAccess = 4,
56 StorageDrive = 5,
57 OpticalDrive = 6,
58 StorageVolume = 7,
59 OpticalDisc = 8,
60 Camera = 9,
61 PortableMediaPlayer = 10,
62 Battery = 12,
63 NetworkShare = 14,
64 Last = 0xffff,
65 };
66 Q_ENUM(Type)
67
68 /**
69 * Destroys a DeviceInterface object.
70 */
71 ~DeviceInterface() override;
72
73 /**
74 * Indicates if this device interface is valid.
75 * A device interface is considered valid if the device it is referring is available in the system.
76 *
77 * @return true if this device interface's device is available, false otherwise
78 */
79 bool isValid() const;
80
81 /**
82 *
83 * @return the class name of the device interface type
84 */
85 static QString typeToString(Type type);
86
87 /**
88 *
89 * @return the device interface type for the given class name
90 */
91 static Type stringToType(const QString &type);
92
93 /**
94 *
95 * @return a description suitable to display in the UI of the device interface type
96 * @since 4.4
97 */
98 static QString typeDescription(Type type);
99
100protected:
101 /**
102 * @internal
103 * Creates a new DeviceInterface object.
104 *
105 * @param dd the private d member. It will take care of deleting it upon destruction.
106 * @param backendObject the device interface object provided by the backend
107 */
108 SOLID_NO_EXPORT DeviceInterface(DeviceInterfacePrivate &dd, QObject *backendObject);
109
110 DeviceInterfacePrivate *d_ptr;
111
112private:
113 friend class Device;
114 friend class DevicePrivate;
115};
116}
117
118#endif
Base class of all the device interfaces.
Type
This enum type defines the type of device interface that a Device can have.
SOLID_NO_EXPORT DeviceInterface(DeviceInterfacePrivate &dd, QObject *backendObject)
This class allows applications to deal with devices available in the underlying system.
This class implements predicates for devices.
Definition predicate.h:67
QObject(QObject *parent)
Q_OBJECTQ_OBJECT
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Feb 21 2025 11:55:36 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.