[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-hardware-devel
Subject:    [Kde-hardware-devel] Initial Smart Card Support
From:       Christopher Blauvelt <cblauvelt () gmail ! com>
Date:       2009-04-07 4:22:45
Message-ID: ffa898c90904062122v322618f6k46e0fdbe3dc22542 () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Because I didn't want to add something to the feature list without code,
attached is the addition of a smart card interface for comments/concerns.
Chris

[Attachment #5 (text/html)]

Because I didn&#39;t want to add something to the feature list without code, attached \
is the addition of a smart card interface for comments/concerns.<br>Chris<br>

--0016362837a8eb06620466ef5d77--


["smartcardreader.diff" (text/x-patch)]

Index: smartcardreader.h
===================================================================
--- smartcardreader.h	(revision 0)
+++ smartcardreader.h	(revision 0)
@@ -0,0 +1,88 @@
+/*  This file is part of the KDE project
+    Copyright (C) 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 Library General Public
+    License version 2 as published by the Free Software Foundation.
+
+    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
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+
+*/
+
+#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 { 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::Ifaces::Enums::SmartCardReader::ReaderType
+         */
+        ReaderType readerType() const;
+    };
+}
+
+#endif
Index: smartcardreader.cpp
===================================================================
--- smartcardreader.cpp	(revision 0)
+++ smartcardreader.cpp	(revision 0)
@@ -0,0 +1,49 @@
+/*  This file is part of the KDE project
+    Copyright (C) 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 Library General Public
+    License version 2 as published by the Free Software Foundation.
+
+    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
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+
+*/
+
+#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(SmartCardReaderPrivate &dd, QObject *backendObject)
+    : DeviceInterface(dd, 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 "smartcardreader.moc"
+
Index: ifaces/smartcardreader.h
===================================================================
--- ifaces/smartcardreader.h	(revision 0)
+++ ifaces/smartcardreader.h	(revision 0)
@@ -0,0 +1,54 @@
+/*  This file is part of the KDE project
+    Copyright (C) 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 Library General Public
+    License version 2 as published by the Free Software Foundation.
+
+    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
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+
+*/
+
+#ifndef SOLID_IFACES_SMARTCARDREADER_H
+#define SOLID_IFACES_SMARTCARDREADER_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
Index: ifaces/smartcardreader.cpp
===================================================================
--- ifaces/smartcardreader.cpp	(revision 0)
+++ ifaces/smartcardreader.cpp	(revision 0)
@@ -0,0 +1,25 @@
+/*  This file is part of the KDE project
+    Copyright (C) 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 Library General Public
+    License version 2 as published by the Free Software Foundation.
+
+    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
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+
+*/
+
+#include "smartcardreader.h"
+
+Solid::Ifaces::SmartCardReader::~SmartCardReader()
+{
+}
+
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt	(revision 950404)
+++ CMakeLists.txt	(working copy)
@@ -5,7 +5,7 @@
 
 if(WIN32)
    include_directories( ${KDEWIN32_INCLUDES} )
-endif(WIN32) 
+endif(WIN32)
 
 configure_file(solid_export.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/solid_export.h)
 
@@ -21,7 +21,7 @@
 
 ########### next target ###############
 
-file(MAKE_DIRECTORY 
+file(MAKE_DIRECTORY
    ${CMAKE_CURRENT_BINARY_DIR}/backends/fakehw
    ${CMAKE_CURRENT_BINARY_DIR}/backends/hal
    ${CMAKE_CURRENT_BINARY_DIR}/backends/wmi
@@ -29,36 +29,37 @@
 
 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${KDE4_C_FLAGS}") # enable -fvisibility=hidden for C sources
 
-set(solid_LIB_SRCS 
-   solidnamespace.cpp 
-   managerbase.cpp 
-   device.cpp 
-   devicemanager.cpp 
-   deviceinterface.cpp 
-   genericinterface.cpp 
-   processor.cpp 
-   block.cpp 
-   storagedrive.cpp 
-   opticaldrive.cpp 
-   storagevolume.cpp 
-   opticaldisc.cpp 
-   storageaccess.cpp 
-   camera.cpp 
-   portablemediaplayer.cpp 
-   networkinterface.cpp 
+set(solid_LIB_SRCS
+   solidnamespace.cpp
+   managerbase.cpp
+   device.cpp
+   devicemanager.cpp
+   deviceinterface.cpp
+   genericinterface.cpp
+   processor.cpp
+   block.cpp
+   storagedrive.cpp
+   opticaldrive.cpp
+   storagevolume.cpp
+   opticaldisc.cpp
+   storageaccess.cpp
+   camera.cpp
+   portablemediaplayer.cpp
+   networkinterface.cpp
    serialinterface.cpp
-   acadapter.cpp 
-   battery.cpp 
+   acadapter.cpp
+   battery.cpp
    button.cpp
-   audiointerface.cpp 
+   audiointerface.cpp
    dvbinterface.cpp
-   predicate.cpp 
-   predicateparse.cpp 
-   predicate_lexer.c 
+   predicate.cpp
+   predicateparse.cpp
+   predicate_lexer.c
    predicate_parser.c
    powermanagement.cpp
    networking.cpp
    video.cpp
+   smartcardreader.cpp
 
    ifaces/acadapter.cpp
    ifaces/audiointerface.cpp
@@ -81,6 +82,7 @@
    ifaces/storagevolume.cpp
    ifaces/storageaccess.cpp
    ifaces/video.cpp
+   ifaces/smartcardreader.cpp
 
    backends/fakehw/fakeacadapter.cpp
    backends/fakehw/fakeaudiointerface.cpp
@@ -102,6 +104,7 @@
    backends/fakehw/fakestorageaccess.cpp
    backends/fakehw/fakevideo.cpp
    backends/fakehw/fakevolume.cpp
+#   backends/fakehw/fakesmartcardreader.cpp
 )
 
 if(NOT WIN32 AND NOT APPLE)
@@ -130,7 +133,8 @@
    backends/hal/halstorage.cpp
    backends/hal/halvideo.cpp
    backends/hal/halvolume.cpp
-   
+#   backends/hal/halsmartcardreader.cpp
+
    )
 endif(NOT WIN32 AND NOT APPLE)
 
@@ -177,8 +181,8 @@
    backends/wmi/wmivideo.cpp
    backends/wmi/wmivolume.cpp
 
-   )   
-endif(MSVC)	
+   )
+endif(MSVC)
 
 set_source_files_properties( org.freedesktop.PowerManagement.xml
                              org.freedesktop.PowerManagement.Inhibit.xml
@@ -226,11 +230,11 @@
 endif(WIN32)
 ########### install files ###############
 
-install( FILES ${CMAKE_CURRENT_BINARY_DIR}/solid_export.h solidnamespace.h device.h 
-               devicenotifier.h deviceinterface.h genericinterface.h processor.h block.h 
-               storageaccess.h storagedrive.h opticaldrive.h storagevolume.h opticaldisc.h 
-               camera.h portablemediaplayer.h networkinterface.h acadapter.h battery.h 
-               button.h audiointerface.h dvbinterface.h predicate.h powermanagement.h 
+install( FILES ${CMAKE_CURRENT_BINARY_DIR}/solid_export.h solidnamespace.h device.h
+               devicenotifier.h deviceinterface.h genericinterface.h processor.h block.h
+               storageaccess.h storagedrive.h opticaldrive.h storagevolume.h opticaldisc.h
+               camera.h portablemediaplayer.h networkinterface.h acadapter.h battery.h
+               button.h audiointerface.h dvbinterface.h predicate.h powermanagement.h
                networking.h video.h serialinterface.h
                DESTINATION ${INCLUDE_INSTALL_DIR}/solid COMPONENT Devel)
 
Index: smartcardreader_p.h
===================================================================
--- smartcardreader_p.h	(revision 0)
+++ smartcardreader_p.h	(revision 0)
@@ -0,0 +1,35 @@
+/*  This file is part of the KDE project
+    Copyright (C) 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 Library General Public
+    License version 2 as published by the Free Software Foundation.
+
+    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
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+
+*/
+
+#ifndef SOLID_SMARTCARDREADER_P_H
+#define SOLID_SMARTCARDREADER_P_H
+
+#include "deviceinterface_p.h"
+
+namespace Solid
+{
+    class SmartCardReaderPrivate : public DeviceInterfacePrivate
+    {
+    public:
+        SmartCardReaderPrivate()
+            : DeviceInterfacePrivate() { }
+    };
+}
+
+#endif


_______________________________________________
Kde-hardware-devel mailing list
Kde-hardware-devel@kde.org
https://mail.kde.org/mailman/listinfo/kde-hardware-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic