solid: remove irrelevant interfaces

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2021-11-03 18:53:25 +02:00
parent ed06b22e60
commit 02960a899f
34 changed files with 8 additions and 1537 deletions

View file

@ -604,7 +604,6 @@ install(
Solid/Device
Solid/DeviceInterface
Solid/DeviceNotifier
Solid/DvbInterface
Solid/GenericInterface
Solid/NetworkInterface
Solid/NetworkShare

View file

@ -1 +0,0 @@
#include "../../solid/dvbinterface.h"

View file

@ -33,19 +33,16 @@ set(solid_LIB_SRCS
portablemediaplayer.cpp
networkinterface.cpp
networkshare.cpp
serialinterface.cpp
acadapter.cpp
battery.cpp
button.cpp
audiointerface.cpp
dvbinterface.cpp
predicate.cpp
predicateparse.cpp
predicate_lexer.c
predicate_parser.c
powermanagement.cpp
video.cpp
smartcardreader.cpp
graphic.cpp
ifaces/acadapter.cpp
@ -58,11 +55,9 @@ set(solid_LIB_SRCS
ifaces/device.cpp
ifaces/deviceinterface.cpp
ifaces/devicemanager.cpp
ifaces/dvbinterface.cpp
ifaces/genericinterface.cpp
ifaces/networkinterface.cpp
ifaces/networkshare.cpp
ifaces/serialinterface.cpp
ifaces/opticaldisc.cpp
ifaces/portablemediaplayer.cpp
ifaces/processor.cpp
@ -70,7 +65,6 @@ set(solid_LIB_SRCS
ifaces/storagevolume.cpp
ifaces/storageaccess.cpp
ifaces/video.cpp
ifaces/smartcardreader.cpp
ifaces/graphic.cpp
backends/shared/rootdevice.cpp
@ -99,7 +93,6 @@ if(ENABLE_TESTING)
backends/fakehw/fakecdrom.cpp
backends/fakehw/fakedevice.cpp
backends/fakehw/fakedeviceinterface.cpp
backends/fakehw/fakedvbinterface.cpp
backends/fakehw/fakegenericinterface.cpp
backends/fakehw/fakemanager.cpp
backends/fakehw/fakenetworkshare.cpp
@ -111,7 +104,6 @@ if(ENABLE_TESTING)
backends/fakehw/fakestorageaccess.cpp
backends/fakehw/fakevideo.cpp
backends/fakehw/fakevolume.cpp
backends/fakehw/fakesmartcardreader.cpp
backends/fakehw/fakegraphic.cpp
)
endif()
@ -129,10 +121,8 @@ if(UDEV_FOUND)
backends/udev/udevvideo.cpp
backends/udev/udevaudiointerface.cpp
backends/udev/udevnetworkinterface.cpp
backends/udev/udevserialinterface.cpp
backends/udev/udevaudiointerface_p.cpp
backends/udev/udevportablemediaplayer.cpp
backends/udev/udevdvbinterface.cpp
backends/udev/udevblock.cpp
backends/udev/udevbutton.cpp
backends/udev/udevstorageaccess.cpp
@ -261,13 +251,10 @@ install(
battery.h
button.h
audiointerface.h
dvbinterface.h
predicate.h
powermanagement.h
networking.h
video.h
serialinterface.h
smartcardreader.h
networkshare.h
graphic.h
DESTINATION ${KDE4_INCLUDE_INSTALL_DIR}/solid

View file

@ -580,24 +580,6 @@
<property key="macAddress">0x001AEBC96415</property>
</device>
<!-- PCI device #3 -->
<device udi="/org/kde/solid/fakehw/pci_8843_6a11">
<property key="name">VisioTNT</property>
<property key="vendor">DigitalVid Ltd</property>
<property key="parent">/org/kde/solid/fakehw/pci_8086_2448</property>
</device>
<!-- Digital video broadcasting interface -->
<device udi="/org/kde/solid/fakehw/pci_8843_6a11_dvb1">
<property key="name">DVB Interface</property>
<property key="interfaces">DvbInterface</property>
<property key="parent">/org/kde/solid/fakehw/pci_8843_6a11</property>
<property key="device">/dev/broadcast0/demux</property>
<property key="deviceAdapter">2</property>
<property key="deviceType">demux</property>
<property key="deviceIndex">1</property>
</device>
<!-- Integrated Audio Controller -->
<device udi="/org/kde/solid/fakehw/pci_8086_266e">

View file

@ -36,8 +36,7 @@
#include "fakebattery.h"
#include "fakebutton.h"
#include "fakeaudiointerface.h"
#include "fakedvbinterface.h"
#include "fakesmartcardreader.h"
#include "fakevideo.h"
#include "fakegraphic.h"
#include <QtCore/QStringList>
@ -306,15 +305,11 @@ QObject *FakeDevice::createDeviceInterface(const Solid::DeviceInterface::Type &t
case Solid::DeviceInterface::AudioInterface:
iface = new FakeAudioInterface(this);
break;
case Solid::DeviceInterface::DvbInterface:
iface = new FakeDvbInterface(this);
break;
case Solid::DeviceInterface::Video:
break;
case Solid::DeviceInterface::SmartCardReader:
iface = new FakeSmartCardReader(this);
break;
case Solid::DeviceInterface::SerialInterface:
#warning TODO: Solid::Video tests
#if 0
iface = new FakeVideo(this);
#endif
break;
case Solid::DeviceInterface::NetworkShare:
iface = new FakeNetworkShare(this);

View file

@ -1,77 +0,0 @@
/*
Copyright 2007 Kevin Ottens <ervin@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) version 3, or any
later version accepted by the membership of KDE e.V. (or its
successor approved by the membership of KDE e.V.), which shall
act as a proxy defined in Section 6 of version 3 of the license.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "fakedvbinterface.h"
using namespace Solid::Backends::Fake;
FakeDvbInterface::FakeDvbInterface(FakeDevice *device)
: FakeDeviceInterface(device)
{
}
FakeDvbInterface::~FakeDvbInterface()
{
}
QString FakeDvbInterface::device() const
{
return fakeDevice()->property("device").toString();
}
int FakeDvbInterface::deviceAdapter() const
{
return fakeDevice()->property("deviceAdapter").toInt();
}
Solid::DvbInterface::DeviceType FakeDvbInterface::deviceType() const
{
QString string = fakeDevice()->property("deviceType").toString();
if (string == "audio")
return Solid::DvbInterface::DvbAudio;
if (string == "ca")
return Solid::DvbInterface::DvbCa;
if (string == "demux")
return Solid::DvbInterface::DvbDemux;
if (string == "dvr")
return Solid::DvbInterface::DvbDvr;
if (string == "frontend")
return Solid::DvbInterface::DvbFrontend;
if (string == "net")
return Solid::DvbInterface::DvbNet;
if (string == "osd")
return Solid::DvbInterface::DvbOsd;
if (string == "sec")
return Solid::DvbInterface::DvbSec;
if (string == "video")
return Solid::DvbInterface::DvbVideo;
return Solid::DvbInterface::DvbUnknown;
}
int FakeDvbInterface::deviceIndex() const
{
return fakeDevice()->property("deviceIndex").toInt();
}
#include "backends/fakehw/moc_fakedvbinterface.cpp"

View file

@ -1,52 +0,0 @@
/*
Copyright 2007 Kevin Ottens <ervin@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) version 3, or any
later version accepted by the membership of KDE e.V. (or its
successor approved by the membership of KDE e.V.), which shall
act as a proxy defined in Section 6 of version 3 of the license.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SOLID_BACKENDS_FAKEHW_FAKEDVBINTERFACE_H
#define SOLID_BACKENDS_FAKEHW_FAKEDVBINTERFACE_H
#include "fakedeviceinterface.h"
#include <solid/ifaces/dvbinterface.h>
namespace Solid
{
namespace Backends
{
namespace Fake
{
class FakeDvbInterface : public FakeDeviceInterface, virtual public Solid::Ifaces::DvbInterface
{
Q_OBJECT
Q_INTERFACES(Solid::Ifaces::DvbInterface)
public:
explicit FakeDvbInterface(FakeDevice *device);
~FakeDvbInterface();
public Q_SLOTS:
virtual QString device() const;
virtual int deviceAdapter() const;
virtual Solid::DvbInterface::DeviceType deviceType() const;
virtual int deviceIndex() const;
};
}
}
}
#endif // SOLID_BACKENDS_FAKEHW_FAKEDVBINTERFACE_H

View file

@ -68,10 +68,7 @@ FakeManager::FakeManager(QObject *parent, const QString &xmlFile)
<< Solid::DeviceInterface::Battery
<< Solid::DeviceInterface::Button
<< Solid::DeviceInterface::AudioInterface
<< Solid::DeviceInterface::DvbInterface
<< Solid::DeviceInterface::Video
<< Solid::DeviceInterface::SerialInterface
<< Solid::DeviceInterface::SmartCardReader
<< Solid::DeviceInterface::NetworkShare
<< Solid::DeviceInterface::Graphic;
}

View file

@ -1,49 +0,0 @@
/*
Copyright 2009 Christopher Blauvelt <cblauvelt@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) version 3, or any
later version accepted by the membership of KDE e.V. (or its
successor approved by the membership of KDE e.V.), which shall
act as a proxy defined in Section 6 of version 3 of the license.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "fakesmartcardreader.h"
using namespace Solid::Backends::Fake;
FakeSmartCardReader::FakeSmartCardReader(FakeDevice *device)
: FakeDeviceInterface(device)
{
}
FakeSmartCardReader::~FakeSmartCardReader()
{
}
Solid::SmartCardReader::ReaderType FakeSmartCardReader::readerType() const
{
QString type = fakeDevice()->property("smartcardReaderType").toString();
if (type == "reader") {
return Solid::SmartCardReader::CardReader;
} else if (type == "cryptoToken") {
return Solid::SmartCardReader::CryptoToken;
} else {
return Solid::SmartCardReader::UnknownReaderType;
}
}
#include "backends/fakehw/moc_fakesmartcardreader.cpp"

View file

@ -1,50 +0,0 @@
/*
Copyright 2009 Christopher Blauvelt <cblauvelt@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) version 3, or any
later version accepted by the membership of KDE e.V. (or its
successor approved by the membership of KDE e.V.), which shall
act as a proxy defined in Section 6 of version 3 of the license.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SOLID_BACKENDS_FAKEHW_FAKESMARTCARDREADER_H
#define SOLID_BACKENDS_FAKEHW_FAKESMARTCARDREADER_H
#include "fakedeviceinterface.h"
#include <solid/ifaces/smartcardreader.h>
#include <solid/smartcardreader.h>
namespace Solid
{
namespace Backends
{
namespace Fake
{
class FakeSmartCardReader : public FakeDeviceInterface, virtual public Solid::Ifaces::SmartCardReader
{
Q_OBJECT
Q_INTERFACES(Solid::Ifaces::SmartCardReader)
public:
explicit FakeSmartCardReader(FakeDevice *device);
~FakeSmartCardReader();
virtual Solid::SmartCardReader::ReaderType readerType() const;
};
}
}
}
#endif // SOLID_BACKENDS_FAKEHW_FAKESMARTCARDREADER_H

View file

@ -29,10 +29,8 @@
#include "udevcamera.h"
#include "udevvideo.h"
#include "udevportablemediaplayer.h"
#include "udevdvbinterface.h"
#include "udevblock.h"
#include "udevaudiointerface.h"
#include "udevserialinterface.h"
#include "udevnetworkinterface.h"
#include "udevbutton.h"
#include "udevgraphic.h"
@ -137,13 +135,6 @@ QString UDevDevice::product() const
if (netIface.isLoopback()) {
product = QLatin1String("Loopback device Interface");
}
} else if(queryDeviceInterface(Solid::DeviceInterface::SerialInterface)) {
const SerialInterface serialIface(const_cast<UDevDevice *>(this));
if (serialIface.serialType() == Solid::SerialInterface::Platform) {
product = QLatin1String("Platform serial");
} else if (serialIface.serialType() == Solid::SerialInterface::Usb) {
product = QLatin1String("USB Serial Port");
}
}
if (product.isEmpty()) {
@ -283,10 +274,6 @@ QString UDevDevice::icon() const
case Solid::AudioInterface::Modem:
return QLatin1String("modem");
}
} else if (queryDeviceInterface(Solid::DeviceInterface::SerialInterface)) {
// TODO - a serial device can be a modem, or just
// a COM port - need a new icon?
return QLatin1String("modem");
} else if (queryDeviceInterface(Solid::DeviceInterface::Button)) {
return QLatin1String("insert-button");
} else if (queryDeviceInterface(Solid::DeviceInterface::Graphic)) {
@ -510,9 +497,6 @@ bool UDevDevice::queryDeviceInterface(const Solid::DeviceInterface::Type &type)
case Solid::DeviceInterface::PortableMediaPlayer:
return !deviceProperty("ID_MEDIA_PLAYER").isEmpty();
case Solid::DeviceInterface::DvbInterface:
return m_device.subsystem() == QLatin1String("dvb");
case Solid::DeviceInterface::Block:
return !deviceProperty("MAJOR").isEmpty();
@ -525,9 +509,6 @@ bool UDevDevice::queryDeviceInterface(const Solid::DeviceInterface::Type &type)
case Solid::DeviceInterface::NetworkInterface:
return m_device.subsystem() == QLatin1String("net");
case Solid::DeviceInterface::SerialInterface:
return m_device.subsystem() == QLatin1String("tty");
case Solid::DeviceInterface::Button:
return deviceProperty("ID_INPUT_KEY").toInt() == 1;
@ -577,9 +558,6 @@ QObject *UDevDevice::createDeviceInterface(const Solid::DeviceInterface::Type &t
case Solid::DeviceInterface::PortableMediaPlayer:
return new PortableMediaPlayer(this);
case Solid::DeviceInterface::DvbInterface:
return new DvbInterface(this);
case Solid::DeviceInterface::Block:
return new Block(this);
@ -592,9 +570,6 @@ QObject *UDevDevice::createDeviceInterface(const Solid::DeviceInterface::Type &t
case Solid::DeviceInterface::NetworkInterface:
return new NetworkInterface(this);
case Solid::DeviceInterface::SerialInterface:
return new SerialInterface(this);
case Solid::DeviceInterface::Button:
return new Button(this);

View file

@ -1,93 +0,0 @@
/*
Copyright 2007 Kevin Ottens <ervin@kde.org>
Copyright 2007 Christoph Pfister <christophpfister@gmail.com>
Copyright 2010 Pino Toscano <pino@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) version 3, or any
later version accepted by the membership of KDE e.V. (or its
successor approved by the membership of KDE e.V.), which shall
act as a proxy defined in Section 6 of version 3 of the license.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "udevdvbinterface.h"
#include "udevdevice.h"
using namespace Solid::Backends::UDev;
DvbInterface::DvbInterface(UDevDevice *device)
: DeviceInterface(device)
{
}
DvbInterface::~DvbInterface()
{
}
QString DvbInterface::device() const
{
return m_device->deviceProperty("DEVNAME");
}
int DvbInterface::deviceAdapter() const
{
bool ok;
int adapter = m_device->deviceProperty("DVB_ADAPTER_NUM").toInt(&ok, 10);
if (ok)
return adapter;
else
return -1;
}
Solid::DvbInterface::DeviceType DvbInterface::deviceType() const
{
Solid::DvbInterface::DeviceType type = Solid::DvbInterface::DvbUnknown;
const QString typeString(m_device->deviceProperty("DVB_DEVICE_TYPE"));
if (typeString == QLatin1String("audio")) {
type = Solid::DvbInterface::DvbAudio;
} else if (typeString == QLatin1String("ca")) {
type = Solid::DvbInterface::DvbCa;
} else if (typeString == QLatin1String("demux")) {
type = Solid::DvbInterface::DvbDemux;
} else if (typeString == QLatin1String("dvr")) {
type = Solid::DvbInterface::DvbDvr;
} else if (typeString == QLatin1String("frontend")) {
type = Solid::DvbInterface::DvbFrontend;
} else if (typeString == QLatin1String("net")) {
type = Solid::DvbInterface::DvbNet;
} else if (typeString == QLatin1String("osd")) {
type = Solid::DvbInterface::DvbOsd;
} else if (typeString == QLatin1String("sec")) {
type = Solid::DvbInterface::DvbSec;
} else if (typeString == QLatin1String("video")) {
type = Solid::DvbInterface::DvbVideo;
}
return type;
}
int DvbInterface::deviceIndex() const
{
bool ok;
int index = m_device->deviceProperty("DVB_DEVICE_NUM").toInt(&ok, 10);
if (ok)
return index;
else
return -1;
}
#include "backends/udev/moc_udevdvbinterface.cpp"

View file

@ -1,53 +0,0 @@
/*
Copyright 2007 Kevin Ottens <ervin@kde.org>
Copyright 2007 Christoph Pfister <christophpfister@gmail.com>
Copyright 2010 Pino Toscano <pino@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) version 3, or any
later version accepted by the membership of KDE e.V. (or its
successor approved by the membership of KDE e.V.), which shall
act as a proxy defined in Section 6 of version 3 of the license.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SOLID_BACKENDS_UDEV_UDEVDVBINTERFACE_H
#define SOLID_BACKENDS_UDEV_UDEVDVBINTERFACE_H
#include <solid/ifaces/dvbinterface.h>
#include "udevdeviceinterface.h"
namespace Solid
{
namespace Backends
{
namespace UDev
{
class DvbInterface : public DeviceInterface, virtual public Solid::Ifaces::DvbInterface
{
Q_OBJECT
Q_INTERFACES(Solid::Ifaces::DvbInterface)
public:
DvbInterface(UDevDevice *device);
virtual ~DvbInterface();
virtual QString device() const;
virtual int deviceAdapter() const;
virtual Solid::DvbInterface::DeviceType deviceType() const;
virtual int deviceIndex() const;
};
}
}
}
#endif // SOLID_BACKENDS_UDEV_UDEVDVBINTERFACE_H

View file

@ -55,8 +55,6 @@ UDevManager::Private::Private()
<< "processor"
<< "cpu"
<< "sound"
<< "tty"
<< "dvb"
<< "video4linux"
<< "net"
<< "usb"
@ -116,17 +114,6 @@ bool UDevManager::Private::checkOfInterest(const UdevQt::Device &device)
return true;
}
if (device.subsystem() == QLatin1String("tty")) {
QString path = device.deviceProperty("DEVPATH");
int lastSlash = path.length() - path.lastIndexOf(QLatin1String("/")) -1;
QByteArray lastElement = path.right(lastSlash).toLatin1();
if (lastElement.startsWith("tty") && !path.startsWith("/devices/virtual")) {
return true;
}
}
if (device.subsystem() == QLatin1String("pci")) {
const QString pciclass = device.deviceProperty("PCI_CLASS");
return (pciclass == QLatin1String("30000")); // VGA controller
@ -137,8 +124,7 @@ bool UDevManager::Private::checkOfInterest(const UdevQt::Device &device)
return (device.deviceProperty("ID_INPUT_KEY").toInt() == 1 && (deviceProperties.contains("KEY") || deviceProperties.contains("SW")));
}
return device.subsystem() == QLatin1String("dvb") ||
device.subsystem() == QLatin1String("video4linux") ||
return device.subsystem() == QLatin1String("video4linux") ||
device.subsystem() == QLatin1String("net") ||
device.deviceProperty("ID_MEDIA_PLAYER").isEmpty() == false || // media-player-info recognized devices
(device.deviceProperty("ID_GPHOTO2").toInt() == 1 && device.parent().deviceProperty("ID_GPHOTO2").toInt() != 1); // GPhoto2 cameras
@ -164,10 +150,8 @@ UDevManager::UDevManager(QObject *parent)
#endif
<< Solid::DeviceInterface::AudioInterface
<< Solid::DeviceInterface::NetworkInterface
<< Solid::DeviceInterface::SerialInterface
<< Solid::DeviceInterface::Camera
<< Solid::DeviceInterface::PortableMediaPlayer
<< Solid::DeviceInterface::DvbInterface
<< Solid::DeviceInterface::Block
<< Solid::DeviceInterface::Video
<< Solid::DeviceInterface::Button

View file

@ -1,74 +0,0 @@
/*
Copyright 2009 Harald Fernengel <harry@kdevelop.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) version 3, or any
later version accepted by the membership of KDE e.V. (or its
successor approved by the membership of KDE e.V.), which sudevl
act as a proxy defined in Section 6 of version 3 of the license.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "udevserialinterface.h"
#include "udevdevice.h"
#include <QString>
#include <stdio.h>
using namespace Solid::Backends::UDev;
SerialInterface::SerialInterface(UDevDevice *device)
: DeviceInterface(device),
m_portnum(-1),
m_type(Solid::SerialInterface::Unknown)
{
const QString path = m_device->deviceName();
const int lastSlash = path.length() - path.lastIndexOf(QLatin1String("/")) -1;
const QByteArray lastElement = path.right(lastSlash).toLatin1();
if (::sscanf(lastElement.constData(), "ttyS%d", &m_portnum) == 1) {
;
} else if (::sscanf(lastElement.constData(), "ttyUSB%d", &m_portnum) == 1) {
;
}
const QString idbus(m_device->deviceProperty("ID_BUS"));
if (idbus == "pci") {
m_type = Solid::SerialInterface::Pci;
} else if (idbus == "usb" || path.contains("ttyUSB")) {
m_type = Solid::SerialInterface::Usb;
} else {
m_type = Solid::SerialInterface::Platform;
}
}
SerialInterface::~SerialInterface()
{
}
QVariant SerialInterface::driverHandle() const
{
return m_device->deviceProperty("DEVNAME");
}
Solid::SerialInterface::SerialType SerialInterface::serialType() const
{
return m_type;
}
int SerialInterface::port() const
{
return m_portnum;
}
#include "backends/udev/moc_udevserialinterface.cpp"

View file

@ -1,55 +0,0 @@
/*
Copyright 2009 Harald Fernengel <harry@kdevelop.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) version 3, or any
later version accepted by the membership of KDE e.V. (or its
successor approved by the membership of KDE e.V.), which shall
act as a proxy defined in Section 6 of version 3 of the license.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SOLID_BACKENDS_UDEV_UDEVSERIALINTERFACE_H
#define SOLID_BACKENDS_UDEV_UDEVSERIALINTERFACE_H
#include <solid/ifaces/serialinterface.h>
#include "udevdeviceinterface.h"
namespace Solid
{
namespace Backends
{
namespace UDev
{
class SerialInterface : public DeviceInterface, virtual public Solid::Ifaces::SerialInterface
{
Q_OBJECT
Q_INTERFACES(Solid::Ifaces::SerialInterface)
public:
SerialInterface(UDevDevice *device);
virtual ~SerialInterface();
virtual QVariant driverHandle() const;
virtual Solid::SerialInterface::SerialType serialType() const;
virtual int port() const;
private:
int m_portnum;
Solid::SerialInterface::SerialType m_type;
};
}
}
}
#endif // SOLID_BACKENDS_UDEV_UDEVSERIALINTERFACE_H

View file

@ -60,14 +60,8 @@
#include <solid/ifaces/button.h>
#include <solid/audiointerface.h>
#include <solid/ifaces/audiointerface.h>
#include <solid/dvbinterface.h>
#include <solid/ifaces/dvbinterface.h>
#include <solid/video.h>
#include <solid/ifaces/video.h>
#include <solid/serialinterface.h>
#include <solid/ifaces/serialinterface.h>
#include <solid/smartcardreader.h>
#include <solid/ifaces/smartcardreader.h>
#include <solid/graphic.h>
#include <solid/ifaces/graphic.h>
@ -224,18 +218,9 @@ const Solid::DeviceInterface *Solid::Device::asDeviceInterface(const DeviceInter
case DeviceInterface::AudioInterface:
iface = deviceinterface_cast(Ifaces::AudioInterface, AudioInterface, dev_iface);
break;
case DeviceInterface::DvbInterface:
iface = deviceinterface_cast(Ifaces::DvbInterface, DvbInterface, dev_iface);
break;
case DeviceInterface::Video:
iface = deviceinterface_cast(Ifaces::Video, Video, dev_iface);
break;
case DeviceInterface::SerialInterface:
iface = deviceinterface_cast(Ifaces::SerialInterface, SerialInterface, dev_iface);
break;
case DeviceInterface::SmartCardReader:
iface = deviceinterface_cast(Ifaces::SmartCardReader, SmartCardReader, dev_iface);
break;
case DeviceInterface::NetworkShare:
iface = deviceinterface_cast(Ifaces::NetworkShare, NetworkShare, dev_iface);
break;

View file

@ -97,14 +97,8 @@ QString Solid::DeviceInterface::typeDescription(Type type)
return QObject::tr("Button");
case AudioInterface:
return QObject::tr("Audio Interface");
case DvbInterface:
return QObject::tr("Dvb Interface");
case Video:
return QObject::tr("Video");
case SerialInterface:
return QObject::tr("Serial Interface");
case SmartCardReader:
return QObject::tr("Smart Card Reader");
case NetworkShare:
return QObject::tr("Network Share");
case Graphic:

View file

@ -59,8 +59,6 @@ namespace Solid
* - Camera : A digital camera
* - PortableMediaPlayer: A portable media player
* - NetworkInterface: A network interface
* - SerialInterface: A serial interface
* - SmartCardReader: A smart card reader interface
* - NetworkShare: A network share interface
* - Graphic: A graphic interface
*/
@ -69,9 +67,8 @@ namespace Solid
OpticalDrive = 6, StorageVolume = 7, OpticalDisc = 8,
Camera = 9, PortableMediaPlayer = 10,
NetworkInterface = 11, AcAdapter = 12, Battery = 13,
Button = 14, AudioInterface = 15, DvbInterface = 16, Video = 17,
SerialInterface = 18, SmartCardReader = 19, NetworkShare = 20,
Graphic = 21, Last = 0xffff };
Button = 14, AudioInterface = 15, Video = 16,
NetworkShare = 17, Graphic = 18, Last = 0xffff };
/**
* Destroys a DeviceInterface object.

View file

@ -1,61 +0,0 @@
/*
Copyright 2007 Kevin Ottens <ervin@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) version 3, or any
later version accepted by the membership of KDE e.V. (or its
successor approved by the membership of KDE e.V.), which shall
act as a proxy defined in Section 6 of version 3 of the license.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "dvbinterface.h"
#include "dvbinterface_p.h"
#include "soliddefs_p.h"
#include <solid/ifaces/dvbinterface.h>
Solid::DvbInterface::DvbInterface(QObject *backendObject)
: DeviceInterface(*new DvbInterfacePrivate(), backendObject)
{
}
Solid::DvbInterface::~DvbInterface()
{
}
QString Solid::DvbInterface::device() const
{
Q_D(const DvbInterface);
return_SOLID_CALL(Ifaces::DvbInterface *, d->backendObject(), QString(), device());
}
int Solid::DvbInterface::deviceAdapter() const
{
Q_D(const DvbInterface);
return_SOLID_CALL(Ifaces::DvbInterface *, d->backendObject(), -1, deviceAdapter());
}
Solid::DvbInterface::DeviceType Solid::DvbInterface::deviceType() const
{
Q_D(const DvbInterface);
return_SOLID_CALL(Ifaces::DvbInterface *, d->backendObject(), DvbUnknown, deviceType());
}
int Solid::DvbInterface::deviceIndex() const
{
Q_D(const DvbInterface);
return_SOLID_CALL(Ifaces::DvbInterface *, d->backendObject(), -1, deviceIndex());
}
#include "moc_dvbinterface.cpp"

View file

@ -1,139 +0,0 @@
/*
Copyright 2007 Kevin Ottens <ervin@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) version 3, or any
later version accepted by the membership of KDE e.V. (or its
successor approved by the membership of KDE e.V.), which shall
act as a proxy defined in Section 6 of version 3 of the license.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SOLID_DVBINTERFACE_H
#define SOLID_DVBINTERFACE_H
#include <solid/solid_export.h>
#include <solid/deviceinterface.h>
namespace Solid
{
class DvbInterfacePrivate;
class Device;
/**
* This device interface is available on Digital Video Broadcast (DVB) devices.
*
* A DVB device is a device implementing the open standards for digital
* television maintained by the DVB Project
* It is possible to interact with such a device using a special device
* file in the system.
*/
class SOLID_EXPORT DvbInterface : public DeviceInterface
{
Q_OBJECT
Q_ENUMS(DeviceType)
Q_PROPERTY(QString device READ device)
Q_PROPERTY(int deviceAdapter READ deviceAdapter)
Q_PROPERTY(DeviceType deviceType READ deviceType)
Q_PROPERTY(int deviceIndex READ deviceIndex)
Q_DECLARE_PRIVATE(DvbInterface)
friend class Device;
public:
/**
* This enum type defines the type of a dvb device.
*
* - DvbAudio : An audio device.
* - DvbCa : A common access device.
* - DvbDemux : A demultiplexer device.
* - DvbDvr : A dvr device.
* - DvbFrontend : A frontend device.
* - DvbNet : A network device.
* - DvbOsd : An osd device.
* - DvbSec : A sec device.
* - DvbVideo : A video device.
* - DvbUnknown : An unidentified device.
*/
enum DeviceType { DvbUnknown, DvbAudio, DvbCa, DvbDemux, DvbDvr,
DvbFrontend, DvbNet, DvbOsd, DvbSec, DvbVideo };
private:
/**
* Creates a new DvbInterface object.
* You generally won't need this. It's created when necessary using
* Device::as().
*
* @param backendObject the device interface object provided by the backend
* @see Solid::Device::as()
*/
explicit DvbInterface(QObject *backendObject);
public:
/**
* Destroys a DvbInterface object.
*/
virtual ~DvbInterface();
/**
* Get the Solid::DeviceInterface::Type of the DvbInterface device interface.
*
* @return the DvbInterface device interface type
* @see Solid::Ifaces::Enums::DeviceInterface::Type
*/
static Type deviceInterfaceType() { return DeviceInterface::DvbInterface; }
/**
* Retrieves the absolute path of the special file to interact
* with the device.
*
* @return the absolute path of the special file to interact with
* the device
*/
QString device() const;
/**
* Retrieves the adapter number of this dvb device.
* Note that -1 is returned in the case the adapter couldn't be
* determined.
*
* @return the adapter number of this dvb device or -1
*/
int deviceAdapter() const;
/**
* Retrieves the type of this dvb device.
*
* @return the device type of this dvb device
* @see Solid::DvbInterface::DeviceType
*/
DeviceType deviceType() const;
/**
* Retrieves the index of this dvb device.
* Note that -1 is returned in the case the device couldn't be
* identified (deviceType() == DvbUnknown).
*
* @return the index of this dvb device or -1
* @see Solid::DvbInterface::deviceType
*/
int deviceIndex() const;
};
}
#endif // SOLID_DVBINTERFACE_H

View file

@ -1,36 +0,0 @@
/*
Copyright 2007 Kevin Ottens <ervin@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) version 3, or any
later version accepted by the membership of KDE e.V. (or its
successor approved by the membership of KDE e.V.), which shall
act as a proxy defined in Section 6 of version 3 of the license.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SOLID_DVBINTERFACE_P_H
#define SOLID_DVBINTERFACE_P_H
#include "deviceinterface_p.h"
namespace Solid
{
class DvbInterfacePrivate : public DeviceInterfacePrivate
{
public:
DvbInterfacePrivate()
: DeviceInterfacePrivate() { }
};
}
#endif // SOLID_DVBINTERFACE_P_H

View file

@ -1,26 +0,0 @@
/*
Copyright 2007 Kevin Ottens <ervin@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) version 3, or any
later version accepted by the membership of KDE e.V. (or its
successor approved by the membership of KDE e.V.), which shall
act as a proxy defined in Section 6 of version 3 of the license.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "dvbinterface.h"
Solid::Ifaces::DvbInterface::~DvbInterface()
{
}

View file

@ -1,89 +0,0 @@
/*
Copyright 2007 Kevin Ottens <ervin@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) version 3, or any
later version accepted by the membership of KDE e.V. (or its
successor approved by the membership of KDE e.V.), which shall
act as a proxy defined in Section 6 of version 3 of the license.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SOLID_IFACE_DVBINTERFACE_H
#define SOLID_IFACE_DVBINTERFACE_H
#include <solid/ifaces/deviceinterface.h>
#include <solid/dvbinterface.h>
namespace Solid
{
namespace Ifaces
{
/**
* This device interface is available on Digital Video Broadcast (DVB) devices.
*
* A DVB device is a device implementing the open standards for digital
* television maintained by the DVB Project
* It is possible to interact with such a device using a special device
* file in the system.
*/
class DvbInterface : virtual public DeviceInterface
{
public:
/**
* Destroys a DvbInterface object.
*/
virtual ~DvbInterface();
/**
* Retrieves the absolute path of the special file to interact
* with the device.
*
* @return the absolute path of the special file to interact with
* the device
*/
virtual QString device() const = 0;
/**
* Retrieves the adapter number of this dvb device.
* Note that -1 is returned in the case the adapter couldn't be
* determined.
*
* @return the adapter number of this dvb device or -1
*/
virtual int deviceAdapter() const = 0;
/**
* Retrieves the type of this dvb device.
*
* @return the device type of this dvb device
* @see Solid::DvbInterface::DeviceType
*/
virtual Solid::DvbInterface::DeviceType deviceType() const = 0;
/**
* Retrieves the index of this dvb device.
* Note that -1 is returned in the case the device couldn't be
* identified (deviceType() == DvbUnknown).
*
* @return the index of this dvb device or -1
* @see Solid::Ifaces::DvbInterface::deviceType
*/
virtual int deviceIndex() const = 0;
};
}
}
Q_DECLARE_INTERFACE(Solid::Ifaces::DvbInterface, "org.kde.Solid.Ifaces.DvbInterface/0.1")
#endif // SOLID_IFACE_DVBINTERFACE_H

View file

@ -1,26 +0,0 @@
/*
Copyright 2009 Harald Fernengel <harry@kdevelop.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) version 3, or any
later version accepted by the membership of KDE e.V. (or its
successor approved by the membership of KDE e.V.), which shall
act as a proxy defined in Section 6 of version 3 of the license.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "serialinterface.h"
Solid::Ifaces::SerialInterface::~SerialInterface()
{
}

View file

@ -1,79 +0,0 @@
/*
Copyright 2009 Harald Fernengel <harry@kdevelop.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) version 3, or any
later version accepted by the membership of KDE e.V. (or its
successor approved by the membership of KDE e.V.), which shall
act as a proxy defined in Section 6 of version 3 of the license.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SOLID_IFACE_SERIALINTERFACE_H
#define SOLID_IFACE_SERIALINTERFACE_H
#include <solid/ifaces/deviceinterface.h>
#include <solid/serialinterface.h>
namespace Solid
{
namespace Ifaces
{
/**
* This device interface is available on serial interfaces,
* like modems.
* @since 4.3
*/
class SerialInterface : virtual public DeviceInterface
{
public:
/**
* Destroys a SerialInterface object.
* @since 4.3
*/
virtual ~SerialInterface();
/**
* Retrieves the name of the interface in the system.
* This name is system dependent, it allows to identify the interface
* in the system. For example it can be of the form "/dev/ttyS0" under Linux.
*
* @return the interface name
* @since 4.3
*/
virtual QVariant driverHandle() const = 0;
/**
* Retrieves the type of the serial device.
* Examples for Linux are "usb" for USB based serial devices,
* or "platform" for built-in serial ports.
*
* @return the type of the serial device
* @since 4.3
*/
virtual Solid::SerialInterface::SerialType serialType() const = 0;
/**
* Retrieves the port number, e.g. 0 for the first COM port.
*
* @return The port number of the serial device, or -1 if unknown.
* @since 4.3
*/
virtual int port() const = 0;
};
}
}
Q_DECLARE_INTERFACE(Solid::Ifaces::SerialInterface, "org.kde.Solid.Ifaces.SerialInterface/0.1")
#endif // SOLID_IFACE_SERIALINTERFACE_H

View file

@ -1,26 +0,0 @@
/*
Copyright 2009 Christopher Blauvelt <cblauvelt@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) version 3, or any
later version accepted by the membership of KDE e.V. (or its
successor approved by the membership of KDE e.V.), which shall
act as a proxy defined in Section 6 of version 3 of the license.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "smartcardreader.h"
Solid::Ifaces::SmartCardReader::~SmartCardReader()
{
}

View file

@ -1,56 +0,0 @@
/*
Copyright 2009 Christopher Blauvelt <cblauvelt@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) version 3, or any
later version accepted by the membership of KDE e.V. (or its
successor approved by the membership of KDE e.V.), which shall
act as a proxy defined in Section 6 of version 3 of the license.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SOLID_IFACES_SMARTCARDREADER_H
#define SOLID_IFACES_SMARTCARDREADER_H
#include <solid/ifaces/deviceinterface.h>
#include <solid/smartcardreader.h>
namespace Solid
{
namespace Ifaces
{
/**
* This device interface is available on smart card readers.
*/
class SmartCardReader : virtual public DeviceInterface
{
public:
/**
* Destroys a SmartCardReader object.
*/
virtual ~SmartCardReader();
/**
* Retrieves the type of this smart card reader.
*
* @return the reader type
* @see Solid::SmartCardReader::ReaderType
*/
virtual Solid::SmartCardReader::ReaderType readerType() const = 0;
};
}
}
Q_DECLARE_INTERFACE(Solid::Ifaces::SmartCardReader, "org.kde.Solid.Ifaces.SmartCardReader/0.1")
#endif // SOLID_IFACES_SMARTCARDREADER_H

View file

@ -1,57 +0,0 @@
/*
Copyright 2009 Harald Fernengel <harry@kdevelop.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) version 3, or any
later version accepted by the membership of KDE e.V. (or its
successor approved by the membership of KDE e.V.), which shall
act as a proxy defined in Section 6 of version 3 of the license.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "serialinterface.h"
#include "serialinterface_p.h"
#include <QtCore/qvariant.h>
#include "soliddefs_p.h"
#include <solid/ifaces/serialinterface.h>
Solid::SerialInterface::SerialInterface(QObject *backendObject)
: DeviceInterface(*new SerialInterfacePrivate(), backendObject)
{
}
Solid::SerialInterface::~SerialInterface()
{
}
QVariant Solid::SerialInterface::driverHandle() const
{
Q_D(const SerialInterface);
return_SOLID_CALL(Ifaces::SerialInterface *, d->backendObject(), QVariant(), driverHandle());
}
Solid::SerialInterface::SerialType Solid::SerialInterface::serialType() const
{
Q_D(const SerialInterface);
return_SOLID_CALL(Ifaces::SerialInterface *, d->backendObject(), Unknown, serialType());
}
int Solid::SerialInterface::port() const
{
Q_D(const SerialInterface);
return_SOLID_CALL(Ifaces::SerialInterface *, d->backendObject(), -1, port());
}
#include "moc_serialinterface.cpp"

View file

@ -1,119 +0,0 @@
/*
Copyright 2009 Harald Fernengel <harry@kdevelop.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) version 3, or any
later version accepted by the membership of KDE e.V. (or its
successor approved by the membership of KDE e.V.), which shall
act as a proxy defined in Section 6 of version 3 of the license.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SOLID_SERIALINTERFACE_H
#define SOLID_SERIALINTERFACE_H
#include <solid/solid_export.h>
#include <solid/deviceinterface.h>
namespace Solid
{
class SerialInterfacePrivate;
class Device;
/**
* This device interface is available on serial interfaces.
* @since 4.3
*/
class SOLID_EXPORT SerialInterface : public DeviceInterface
{
Q_OBJECT
Q_ENUMS(SerialType)
Q_PROPERTY(QVariant driverHandle READ driverHandle)
Q_PROPERTY(SerialType serialType READ serialType)
Q_PROPERTY(int port READ port)
Q_DECLARE_PRIVATE(SerialInterface)
friend class Device;
private:
/**
* Creates a new SerialInterface object.
* You generally won't need this. It's created when necessary using
* Device::as().
*
* @param backendObject the device interface object provided by the backend
* @see Solid::Device::as()
* @since 4.3
*/
explicit SerialInterface(QObject *backendObject);
public:
/**
* Destroys a SerialInterface object.
* @since 4.3
*/
virtual ~SerialInterface();
/**
* Get the Solid::DeviceInterface::Type of the SerialInterface device interface.
*
* @return the SerialInterface device interface type
* @see Solid::Ifaces::Enums::DeviceInterface::Type
* @since 4.3
*/
static Type deviceInterfaceType() { return DeviceInterface::SerialInterface; }
/**
* Retrieves the name of the interface in the system.
* This name is system dependent, it allows to identify the interface
* in the system. For example it can be of the form "/dev/ttyS0" under Linux.
*
* @return the interface name
* @since 4.3
*/
virtual QVariant driverHandle() const;
/**
* This enum type defines the type of a serial interface.
*
* - Unknown : The type could not be determined
* - Platform : A built-in serial port
* - Usb : A USB serial port
* - Pci : A PCI serial port
*
* @since 4.3
*/
enum SerialType { Unknown = 0, Platform, Usb, Pci };
/**
* Retrieves the type of the serial device.
* Examples for Linux are "usb" for USB based serial devices,
* or "platform" for built-in serial ports.
*
* @return the type of the serial device
* @since 4.3
*/
virtual SerialType serialType() const;
/**
* Retrieves the port number, e.g. 0 for the first COM port.
*
* @return The port number of the serial device, or -1 if unknown.
* @since 4.3
*/
virtual int port() const;
};
}
#endif // SOLID_SERIALINTERFACE_H

View file

@ -1,36 +0,0 @@
/*
Copyright 2009 Harald Fernengel <harry@kdevelop.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) version 3, or any
later version accepted by the membership of KDE e.V. (or its
successor approved by the membership of KDE e.V.), which shall
act as a proxy defined in Section 6 of version 3 of the license.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SOLID_SERIALINTERFACE_P_H
#define SOLID_SERIALINTERFACE_P_H
#include "deviceinterface_p.h"
namespace Solid
{
class SerialInterfacePrivate : public DeviceInterfacePrivate
{
public:
SerialInterfacePrivate()
: DeviceInterfacePrivate() { }
};
}
#endif // SOLID_SERIALINTERFACE_P_H

View file

@ -1,44 +0,0 @@
/*
Copyright 2009 Christopher Blauvelt <cblauvelt@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) version 3, or any
later version accepted by the membership of KDE e.V. (or its
successor approved by the membership of KDE e.V.), which shall
act as a proxy defined in Section 6 of version 3 of the license.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "smartcardreader.h"
#include "smartcardreader_p.h"
#include "soliddefs_p.h"
#include <solid/ifaces/smartcardreader.h>
Solid::SmartCardReader::SmartCardReader(QObject *backendObject)
: DeviceInterface(*new SmartCardReaderPrivate(), backendObject)
{
}
Solid::SmartCardReader::~SmartCardReader()
{
}
Solid::SmartCardReader::ReaderType Solid::SmartCardReader::readerType() const
{
Q_D(const SmartCardReader);
return_SOLID_CALL(Ifaces::SmartCardReader *, d->backendObject(), CardReader, readerType());
}
#include "moc_smartcardreader.cpp"

View file

@ -1,90 +0,0 @@
/*
Copyright 2009 Christopher Blauvelt <cblauvelt@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) version 3, or any
later version accepted by the membership of KDE e.V. (or its
successor approved by the membership of KDE e.V.), which shall
act as a proxy defined in Section 6 of version 3 of the license.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SOLID_SMARTCARDREADER_H
#define SOLID_SMARTCARDREADER_H
#include <solid/solid_export.h>
#include <solid/deviceinterface.h>
namespace Solid
{
class SmartCardReaderPrivate;
class Device;
/**
* This device interface is available on smart card readers.
*/
class SOLID_EXPORT SmartCardReader : public DeviceInterface
{
Q_OBJECT
Q_ENUMS(ReaderType)
Q_PROPERTY(ReaderType readerType READ readerType)
Q_DECLARE_PRIVATE(SmartCardReader)
friend class Device;
public:
/**
* This enum type defines the type of smart card reader attached
*
* - CardReader : A generic smart card reader
* - CryptoToken : A smart card reader with a card built into the device
*/
enum ReaderType { UnknownReaderType = -1,
CardReader, CryptoToken };
private:
/**
* Creates a new SmartCardReader object.
* You generally won't need this. It's created when necessary using
* Device::as().
*
* @param backendObject the device interface object provided by the backend
* @see Solid::Device::as()
*/
explicit SmartCardReader(QObject *backendObject);
public:
/**
* Destroys a SmartCardReader object.
*/
virtual ~SmartCardReader();
/**
* Get the Solid::DeviceInterface::Type of the SmartCardReader device interface.
*
* @return the SmartCardReader device interface type
* @see Solid::DeviceInterface::Type
*/
static Type deviceInterfaceType() { return DeviceInterface::SmartCardReader; }
/**
* Retrieves the type of this smart card reader.
*
* @return the smart card reader type
* @see Solid::SmartCardReader::ReaderType
*/
ReaderType readerType() const;
};
}
#endif

View file

@ -1,36 +0,0 @@
/*
Copyright 2009 Christopher Blauvelt <cblauvelt@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) version 3, or any
later version accepted by the membership of KDE e.V. (or its
successor approved by the membership of KDE e.V.), which shall
act as a proxy defined in Section 6 of version 3 of the license.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SOLID_SMARTCARDREADER_P_H
#define SOLID_SMARTCARDREADER_P_H
#include "deviceinterface_p.h"
namespace Solid
{
class SmartCardReaderPrivate : public DeviceInterfacePrivate
{
public:
SmartCardReaderPrivate()
: DeviceInterfacePrivate() { }
};
}
#endif