Solid

fakemanager.h
1/*
2 SPDX-FileCopyrightText: 2006 Michaël Larouche <michael.larouche@kdemail.net>
3
4 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5*/
6
7#ifndef SOLID_BACKENDS_FAKEHW_FAKEMANAGER_H
8#define SOLID_BACKENDS_FAKEHW_FAKEMANAGER_H
9
10#include <solid/devices/ifaces/devicemanager.h>
11
12class QDomElement;
13
14using namespace Solid::Ifaces;
15
16namespace Solid
17{
18namespace Backends
19{
20namespace Fake
21{
22class FakeDevice;
23
24/**
25 * @brief a Fake manager that read a device list from a XML file.
26 * This fake manager is used for unit tests and developers.
27 *
28 * @author Michaël Larouche <michael.larouche@kdemail.net>
29 */
31{
33public:
34 FakeManager(QObject *parent, const QString &xmlFile);
35 ~FakeManager() override;
36
37 QString udiPrefix() const override;
39
40 /**
41 * Return the list of UDI of all available devices.
42 */
43 QStringList allDevices() override;
44
46
47 QObject *createDevice(const QString &udi) override;
48 virtual FakeDevice *findDevice(const QString &udi);
49
50public Q_SLOTS:
51 void plug(const QString &udi);
52 void unplug(const QString &udi);
53
54private Q_SLOTS:
55 /**
56 * @internal
57 * Parse the XML file that represent the fake machine.
58 */
59 void parseMachineFile();
60 /**
61 * @internal
62 * Parse a device node and the return the device.
63 */
64 FakeDevice *parseDeviceElement(const QDomElement &element);
65
66private:
67 QStringList findDeviceStringMatch(const QString &key, const QString &value);
68 QStringList findDeviceByDeviceInterface(Solid::DeviceInterface::Type type);
69
70 class Private;
71 Private *d;
72};
73}
74}
75}
76
77#endif // SOLID_BACKENDS_FAKEHW_FAKEMANAGER_H
a Fake manager that read a device list from a XML file.
Definition fakemanager.h:31
QStringList devicesFromQuery(const QString &parentUdi, Solid::DeviceInterface::Type type) override
Retrieves the Universal Device Identifier (UDI) of all the devices matching the given constraints (pa...
QObject * createDevice(const QString &udi) override
Instantiates a new Device object from this backend given its UDI.
QStringList allDevices() override
Return the list of UDI of all available devices.
QString udiPrefix() const override
Retrieves the prefix used for the UDIs off all the devices reported by the device manager.
QSet< Solid::DeviceInterface::Type > supportedInterfaces() const override
Retrieves a set of interfaces the backend supports.
Type
This enum type defines the type of device interface that a Device can have.
This class specifies the interface a backend will have to implement in order to be used in the system...
Q_OBJECTQ_OBJECT
Q_SLOTSQ_SLOTS
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:03:23 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.