Le dimanche 6 août 2006 06:17, Will Stephenson a écrit :
> I've also been hacking on a version of the NM api as a Solid module.  What
> I would like to do is get Christopher's new code up as well so we can merge
> it all together (I'll have a word with the NM team about IPV6 too) and get
> something into SVN and usable soon.

I'd like to take this opportunity to thanks Christopher and Will for the work 
they put into this. We lacked some coordination on this though, but from now 
I want to see this improve.

> I've mailed the diff earlier to Kévin, can't post it from this computer (I
> am off on my holidays for a week).  Kévin, can you mail it here for me?

Sure, here it is, see the attached file. Note that it seems that the 
encryption related class is not in the patch, but some more work in this area 
is still required anyway.

Stefan, could you please review this patch and make a second round of 
comments? This kind of input is very valuable. This patch is based on 
Christopher's work, so you'll get extra cookies if you could also point which 
of your previous comments are still valid and which one are obsoleted. I'll 
do a similar check on my side but this way we'll reduce chances to miss one.

Christopher, does the current patch look ok to you? Personally I like it, I 
think it is an improvement on your previous work while keeping the best ideas 
in what you've sent so far.

From here, I'm planning to work on a revised patch that would be suitable for 
a merge, even if still incomplete (since encryption class, fixes for stefan 
upcoming comments, and some of the work Christopher has probably done in his 
own branch will be missing). This way we'll have a sync point to work in a 
more coordinated fashion and we'll be able to put all this in the repository 
soon.

Regards.
-- 
Kévin 'ervin' Ottens, http://ervin.ipsquad.net
"Ni le maître sans disciple, Ni le disciple sans maître,
Ne font reculer l'ignorance."
Index: solid/Net/network.h
===================================================================
--- solid/Net/network.h	(revision 0)
+++ solid/Net/network.h	(revision 0)
@@ -0,0 +1,61 @@
+/*  This file is part of the KDE project
+    Copyright (C) 2006 Will Stephenson <[EMAIL PROTECTED]>
+
+    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_NET_NETWORK_H
+#define SOLID_NET_NETWORK_H
+
+#include <solid/Net/ifaces/network.h>
+
+#include <QObject>
+
+namespace Solid
+{
+namespace Net
+{
+
+class Network : public QObject
+{
+Q_OBJECT
+    public:
+        Network( Ifaces::Network *, QObject * parent );
+        virtual ~Network();
+        // TODO ask Thiago whether to use QHostAddress or KIPAddress for these 
+        virtual QString ipV4Address();
+        // virtual QString ipV6Address();
+        
+        virtual QString subnetMask();
+        virtual QString broadcastAddress();
+        // wtf does NM use this for?
+        virtual QString route();
+        
+        virtual QString primaryDNS();
+        virtual QString secondaryDNS();
+        
+    signals:
+        void ipDetailsChanged();
+    private:
+        class Private;
+        Private * d;
+};
+
+} //Net
+} //Solid
+
+#endif
+
Index: solid/Net/device.cpp
===================================================================
--- solid/Net/device.cpp	(revision 0)
+++ solid/Net/device.cpp	(revision 0)
@@ -0,0 +1,84 @@
+/*  This file is part of the KDE project
+    Copyright (C) 2006 Will Stephenson <[EMAIL PROTECTED]>
+
+    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 "device.h"
+
+namespace Solid
+{
+namespace Net
+{
+    class Device::Private
+    {
+        public:
+            Ifaces::Device * iface;
+    };
+}
+}
+
+Solid::Net::Device::Device( Solid::Net::Ifaces::Device * iface, QObject * parent ) : QObject( parent ), d( new Private )
+{
+    d->iface = iface;
+    connect( d->iface, SIGNAL( activeChanged( bool ) ), this, SIGNAL( activeChanged( bool ) ) );
+    connect( d->iface, SIGNAL( linkUpChanged( bool ) ), this, SIGNAL( linkUpChanged( bool ) ) );
+    connect( d->iface, SIGNAL( signalStrengthChanged( int ) ), this, SIGNAL( signalStrengthChanged( int ) ) );
+    connect( d->iface, SIGNAL( connectionStateChanged( ConnectionState ) ), this, SIGNAL( connectionStateChanged( ConnectionState ) ) );
+}
+
+Solid::Net::Device::~Device()
+{
+    delete d;
+}
+
+bool Solid::Net::Device::isActive()
+{
+    return d->iface->isActive();
+}
+
+Solid::Net::Ifaces::Enums::Device::Type Solid::Net::Device::type()
+{
+    return d->iface->type();
+
+}
+Solid::Net::Ifaces::Enums::Device::ConnectionState Solid::Net::Device::connectionState()
+{
+    return d->iface->connectionState();
+}
+
+int Solid::Net::Device::signalStrength()
+{
+    return d->iface->signalStrength();
+}
+
+int Solid::Net::Device::speed()
+{
+    return d->iface->speed();
+}
+
+bool Solid::Net::Device::isLinkUp()
+{
+    return d->iface->isLinkUp();
+}
+
+Solid::Net::Ifaces::Enums::Device::Capabilities Solid::Net::Device::capabilities()
+{
+    return d->iface->capabilities();
+}
+
+#include "device.moc"
+
Index: solid/Net/device.h
===================================================================
--- solid/Net/device.h	(revision 0)
+++ solid/Net/device.h	(revision 0)
@@ -0,0 +1,65 @@
+/*  This file is part of the KDE project
+    Copyright (C) 2006 Will Stephenson <[EMAIL PROTECTED]>
+
+    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_NET_DEVICE_H
+#define SOLID_NET_DEVICE_H
+
+#include <solid/Net/ifaces/device.h>
+
+#include <QObject>
+
+namespace Solid
+{
+namespace Net
+{
+
+class Device : public QObject
+{
+Q_OBJECT
+    public:
+        Device( Ifaces::Device *, QObject * parent );
+        virtual ~Device();
+
+        virtual bool isActive();
+
+        virtual Ifaces::Enums::Device::Type type();
+        
+        virtual Ifaces::Enums::Device::ConnectionState connectionState();
+        
+        virtual int signalStrength();
+        
+        virtual int speed();
+        
+        virtual bool isLinkUp();
+        
+        virtual Ifaces::Device::Capabilities capabilities();
+    signals:
+        virtual void activeChanged( bool );
+        virtual void linkUpChanged( bool );
+        virtual void signalStrengthChanged( int );
+        virtual void connectionStateChanged( Ifaces::Enums::Device::ConnectionState );
+    private:
+        class Private;
+        Private * d;
+};
+
+} //Net
+} //Solid
+
+#endif
Index: solid/Net/wirelessnetwork.cpp
===================================================================
--- solid/Net/wirelessnetwork.cpp	(revision 0)
+++ solid/Net/wirelessnetwork.cpp	(revision 0)
@@ -0,0 +1,114 @@
+/*  This file is part of the KDE project
+    Copyright (C) 2006 Will Stephenson <[EMAIL PROTECTED]>
+
+    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 "wirelessnetwork.h"
+
+namespace Solid
+{
+namespace Net
+{
+    class WirelessNetwork::Private
+    {
+        public:
+            Ifaces::WirelessNetwork * iface;
+    };
+}
+}
+
+Solid::Net::WirelessNetwork::WirelessNetwork( Ifaces::Network * networkIface, Ifaces::WirelessNetwork * wirelessNetIface, QObject * parent ) : Network( networkIface, parent ), d( new Private )
+{
+    d->iface = wirelessNetIface;
+    connect( d->iface, SIGNAL( signalStrengthChanged( int ) ), this, SIGNAL( signalStrengthChanged( int ) ) );
+    connect( d->iface, SIGNAL( bitrateChanged( int ) ), this, SIGNAL( lbitrateChanged( int ) ) );
+    connect( d->iface, SIGNAL( associationChanged( bool ) ), this, SIGNAL( associationChanged( bool ) ) );
+    connect( d->iface, SIGNAL( activeChanged( bool ) ), this, SIGNAL( activeChanged( bool ) ) );
+}
+
+Solid::Net::WirelessNetwork::~WirelessNetwork()
+{
+    delete d;
+}
+
+bool Solid::Net::WirelessNetwork::isSameAs( const WirelessNetwork & other) const
+{
+    return ( other.essid() == essid() &&
+        other.bssList() == /*intersects*/ bssList() );
+}
+
+int Solid::Net::WirelessNetwork::signalStrength() const
+{
+    return d->iface->signalStrength();
+}
+
+int Solid::Net::WirelessNetwork::bitRate() const
+{
+    return d->iface->bitRate();
+}
+
+int Solid::Net::WirelessNetwork::frequency() const
+{
+    return d->iface->frequency();
+}
+
+MacAddressList Solid::Net::WirelessNetwork::bssList() const
+{
+    return d->iface->bssList();
+}
+
+Solid::Net::Ifaces::Encryption * Solid::Net::WirelessNetwork::encryption() const
+{
+    return d->iface->encryption();
+}
+
+Solid::Net::Ifaces::WirelessNetwork::Capabilities Solid::Net::WirelessNetwork::capabilities() const
+{
+    return d->iface->capabilities();
+}
+
+QString Solid::Net::WirelessNetwork::essid() const
+{
+    return d->iface->essid();
+}
+
+Solid::Net::Ifaces::WirelessNetwork::OperationMode Solid::Net::WirelessNetwork::mode() const
+{
+    return d->iface->mode();
+}
+
+bool Solid::Net::WirelessNetwork::isAssociated() const
+{
+    return d->iface->isAssociated();
+}
+
+bool Solid::Net::WirelessNetwork::isEncrypted() const
+{
+    return d->iface->isEncrypted();
+}
+
+bool Solid::Net::WirelessNetwork::isHidden() const
+{
+    return d->iface->isHidden();
+}
+
+bool Solid::Net::WirelessNetwork::isActive() const
+{
+    return d->iface->isActive();
+}
+
+#include "wirelessnetwork.moc"
Index: solid/Net/network.cpp
===================================================================
--- solid/Net/network.cpp	(revision 0)
+++ solid/Net/network.cpp	(revision 0)
@@ -0,0 +1,77 @@
+/*  This file is part of the KDE project
+    Copyright (C) 2006 Will Stephenson <[EMAIL PROTECTED]>
+
+    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 "network.h"
+
+namespace Solid
+{
+namespace Net
+{
+    class Network::Private
+    {
+        public:
+            Ifaces::Network * iface;
+    };
+}
+}
+
+Solid::Net::Network::Network( Ifaces::Network * iface, QObject * parent ) : QObject( parent ), d( new Private )
+{
+    d->iface = iface;
+
+    connect( d->iface, SIGNAL( ipDetailsChanged() ), this, SIGNAL( ipDetailsChanged() ) );
+}
+
+Solid::Net::Network::~Network()
+{
+    delete d;
+}
+
+QString Solid::Net::Network::ipV4Address()
+{
+    return d->iface->ipV4Address();
+}
+
+QString Solid::Net::Network::subnetMask()
+{
+    return d->iface->subnetMask();
+
+}
+
+QString Solid::Net::Network::broadcastAddress()
+{
+    return d->iface->broadcastAddress();
+}
+
+QString Solid::Net::Network::route()
+{
+    return d->iface->route();
+}
+
+QString Solid::Net::Network::primaryDNS()
+{
+    return d->iface->primaryDNS();
+}
+
+QString Solid::Net::Network::secondaryDNS()
+{
+    return d->iface->secondaryDNS();
+}
+
+#include "network.moc"
Index: solid/Net/ifaces/network.h
===================================================================
--- solid/Net/ifaces/network.h	(revision 0)
+++ solid/Net/ifaces/network.h	(revision 0)
@@ -0,0 +1,64 @@
+/*  This file is part of the KDE project
+    Copyright (C) 2006 Will Stephenson <[EMAIL PROTECTED]>
+
+    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_NET_IFACES_NETWORK_H
+#define SOLID_NET_IFACES_NETWORK_H
+
+#include <kdelibs_export.h>
+
+#include <solid/Net/ifaces/enums.h>
+
+#include <QObject>
+
+namespace Solid
+{
+namespace Net
+{
+namespace Ifaces
+{
+    /**
+     * Represents a generic IP network which we may be connected to
+     * TODO what about QNetworkAddressEntry
+     */
+    class KDE_EXPORT Network : public QObject, public Enums::Network
+    {
+        Q_OBJECT
+        public:
+            virtual ~Network();
+            // TODO ask Thiago whether to use QHostAddress or KIPAddress for these 
+            virtual QString ipV4Address() = 0;
+            // virtual QString ipV6Address() = 0;
+            
+            virtual QString subnetMask() = 0;
+            virtual QString broadcastAddress() = 0;
+            // wtf does NM use this for?
+            virtual QString route() = 0;
+            
+            virtual QString primaryDNS() = 0;
+            virtual QString secondaryDNS() = 0;
+            
+            // signals: // we are not a qobject yet
+        signals:
+        void ipDetailsChanged();
+    };
+} //Ifaces
+} //Net
+} //Solid
+
+#endif
Index: solid/Net/ifaces/device.cpp
===================================================================
--- solid/Net/ifaces/device.cpp	(revision 0)
+++ solid/Net/ifaces/device.cpp	(revision 0)
@@ -0,0 +1,27 @@
+/*  This file is part of the KDE project
+    Copyright (C) 2006 Will Stephenson <[EMAIL PROTECTED]>
+
+    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 "device.h"
+
+Solid::Net::Ifaces::Device::~Device()
+{
+
+}
+
+#include "device.moc"
Index: solid/Net/ifaces/device.h
===================================================================
--- solid/Net/ifaces/device.h	(revision 0)
+++ solid/Net/ifaces/device.h	(revision 0)
@@ -0,0 +1,72 @@
+/*  This file is part of the KDE project
+    Copyright (C) 2006 Will Stephenson <[EMAIL PROTECTED]>
+
+    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_NET_IFACES_DEVICE_H
+#define SOLID_NET_IFACES_DEVICE_H
+
+#include <kdelibs_export.h>
+
+#include <solid/Net/ifaces/enums.h>
+
+#include <QObject>
+
+namespace Solid
+{
+namespace Net
+{
+namespace Ifaces
+{
+    /**
+     * Represents a network device as seen by the networking subsystem.
+     * For non network specific hardware details, 
+     * @see Solid::Ifaces::NetworkIface
+     */
+     // TODO talk to Ervin about how to cleanly combine this with NetworkIface, perhaps a union class elsewhere
+    class KDE_EXPORT Device : public QObject, public Enums::Device
+    {
+        Q_OBJECT
+        public:
+            virtual ~Device();
+    
+            virtual bool isActive() = 0;
+    
+            virtual Type type() = 0;
+            
+            virtual ConnectionState connectionState() = 0;
+            
+            virtual int signalStrength() = 0;
+            
+            virtual int speed() = 0;
+            
+            virtual bool isLinkUp() = 0;
+            
+            virtual Capabilities capabilities() = 0;
+            
+            // signals:
+        signals:
+            virtual void activeChanged( bool ) = 0;
+            virtual void linkUpChanged( bool ) = 0;
+            virtual void signalStrengthChanged( int ) = 0;
+            virtual void connectionStateChanged( ConnectionState ) = 0;
+    };
+} //Ifaces
+} // Net
+} //Solid
+
+#endif
Index: solid/Net/ifaces/wirelessnetwork.cpp
===================================================================
--- solid/Net/ifaces/wirelessnetwork.cpp	(revision 0)
+++ solid/Net/ifaces/wirelessnetwork.cpp	(revision 0)
@@ -0,0 +1,29 @@
+/*  This file is part of the KDE project
+    Copyright (C) 2006 Will Stephenson <[EMAIL PROTECTED]>
+
+    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 "wirelessnetwork.h"
+
+Solid::Net::Ifaces::WirelessNetwork::~WirelessNetwork()
+{
+
+}
+
+#include "wirelessnetwork.moc"
+
+
Index: solid/Net/ifaces/network.cpp
===================================================================
--- solid/Net/ifaces/network.cpp	(revision 0)
+++ solid/Net/ifaces/network.cpp	(revision 0)
@@ -0,0 +1,27 @@
+/*  This file is part of the KDE project
+    Copyright (C) 2006 Will Stephenson <[EMAIL PROTECTED]>
+
+    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 "network.h"
+
+Solid::Net::Ifaces::Network::~Network()
+{
+
+}
+
+#include "network.moc"
Index: solid/Net/ifaces/wirelessnetwork.h
===================================================================
--- solid/Net/ifaces/wirelessnetwork.h	(revision 0)
+++ solid/Net/ifaces/wirelessnetwork.h	(revision 0)
@@ -0,0 +1,99 @@
+/*  This file is part of the KDE project
+    Copyright (C) 2006 Will Stephenson <[EMAIL PROTECTED]>
+
+    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_NET_IFACES_WIRELESSNETWORK_H
+#define SOLID_NET_IFACES_WIRELESSNETWORK_H
+
+#include <kdelibs_export.h>
+
+#include <QStringList>
+
+#include <solid/Net/ifaces/enums.h>
+
+#include "network.h"
+
+
+typedef QString MacAddress;
+typedef QStringList MacAddressList;
+
+namespace Solid
+{
+namespace Net
+{
+namespace Ifaces
+{
+    class Encryption;
+    /**
+     * A Wifi wireless network
+     */
+    class KDE_EXPORT WirelessNetwork : public Network, public Enums::WirelessNetwork
+    {
+        Q_OBJECT
+        public:
+            virtual ~WirelessNetwork();
+            
+            //TODO compare method would look for identical ESSID and at least one AP in common
+            virtual bool isSameAs( const WirelessNetwork & ) const = 0;
+            
+            // PHY stuff
+            virtual int signalStrength() = 0;
+            
+            virtual int bitRate() = 0;
+            
+            virtual int frequency() = 0;
+            
+            virtual Enums::WirelessNetwork::Capabilities capabilities() = 0;
+            
+            // Service Set stuff
+            virtual QString essid() = 0;
+            
+            virtual OperationMode mode() = 0;
+            
+            virtual bool isAssociated() = 0;
+            
+            virtual bool isEncrypted() = 0;
+            
+            virtual bool isHidden() = 0;
+            
+            virtual bool isActive() = 0;
+            
+            /**
+            * List of access points making up the network,
+            * or ad hoc network nodes
+            */
+            virtual MacAddressList bssList() = 0;
+            
+            /**
+            * TODO decide how to handle these objects - pass by value with implicit sharing?
+            */
+            virtual Encryption * encryption() = 0;
+            
+            // TODO SIGNALS!!!
+            //signals:
+        protected:
+            virtual void signalStrengthChanged( int ) = 0;
+            virtual void bitrateChanged( int ) = 0;
+            virtual void associationChanged( bool ) = 0;
+            virtual void activeChanged( bool ) = 0;
+    };
+} //Ifaces
+} //Net
+} //Solid
+
+#endif
Index: solid/Net/ifaces/CMakeLists.txt
===================================================================
--- solid/Net/ifaces/CMakeLists.txt	(revision 0)
+++ solid/Net/ifaces/CMakeLists.txt	(revision 0)
@@ -0,0 +1,27 @@
+
+
+include_directories( ${CMAKE_SOURCE_DIR} ${KDE4_INCLUDE_DIR} ${QT_INCLUDES} )
+
+########### next target ###############
+
+set(solidnetifaces_LIB_SRCS
+   device.cpp
+   network.cpp
+   wirelessnetwork.cpp
+)
+
+kde4_automoc(${solidnetifaces_LIB_SRCS})
+
+kde4_add_library(solidnetifaces SHARED ${solidnetifaces_LIB_SRCS})
+
+target_link_libraries(solidnetifaces  ${KDE4_KDECORE_LIBS} )
+
+set_target_properties(solidnetifaces PROPERTIES VERSION 4.2.0 SOVERSION 4 )
+install_targets(${LIB_INSTALL_DIR} solidnetifaces )
+
+
+########### install files ###############
+
+install( FILES device.h enums.h network.h wirelessnetwork.h DESTINATION include/solid/net/ifaces )
+
+
Index: solid/Net/ifaces/enums.h
===================================================================
--- solid/Net/ifaces/enums.h	(revision 0)
+++ solid/Net/ifaces/enums.h	(revision 0)
@@ -0,0 +1,60 @@
+/*  This file is part of the KDE project
+    Copyright (C) 2006 Will Stephenson <[EMAIL PROTECTED]>
+
+    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_NET_IFACES_ENUMS_H
+#define SOLID_NET_IFACES_ENUMS_H
+
+namespace Solid
+{
+namespace Net
+{
+namespace Ifaces
+{
+namespace Enums
+{
+    struct Device
+    {
+        // == NM ActivationStage
+        /**
+         * Device connection states describe the possible states of a
+         * network connection from the user's point of view.  For
+         * simplicity, states from several different layers are present -
+         * this is a high level view
+         */
+        enum ConnectionState{ Unknown, Prepare, Configure, NeedUserKey, IPStart, IPGet, IPCommit, Activated, Failed, Cancelled };
+        enum Capabilities { NetworkManager = 0x1, CarrierDetect = 0x2, WirelessScan = 0x4 };
+        enum Type { IEEE802_3, IEEE802_11 };
+    };
+
+    struct Network
+    {
+    };
+
+    struct WirelessNetwork
+    {
+        enum OperationMode { Adhoc, Managed };
+        // corresponding to 802.11 capabilities defined in NetworkManager.h
+        enum Capabilities { WEP = 0x1, WPA = 0x2, WPA2 = 0x4, PSK = 0x8, IEEE8021X = 0x10, WEP40 = 0x20, WEP104 = 0x40, TKIP = 0x80, CCMP = 0x100 };
+    };
+} // Enums
+} // Ifaces
+} // Net
+} // Solid
+
+#endif
Index: solid/Net/wirelessnetwork.h
===================================================================
--- solid/Net/wirelessnetwork.h	(revision 0)
+++ solid/Net/wirelessnetwork.h	(revision 0)
@@ -0,0 +1,89 @@
+/*  This file is part of the KDE project
+    Copyright (C) 2006 Will Stephenson <[EMAIL PROTECTED]>
+
+    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_NET_WIRELESSNETWORK_H
+#define SOLID_NET_WIRELESSNETWORK_H
+
+#include <solid/Net/ifaces/network.h>
+#include <solid/Net/ifaces/wirelessnetwork.h>
+
+#include "network.h"
+
+namespace Solid
+{
+namespace Net
+{
+
+class WirelessNetwork : public Network
+{
+Q_OBJECT
+    public:
+        WirelessNetwork( Ifaces::Network *, Ifaces::WirelessNetwork *, QObject * );
+        virtual ~WirelessNetwork();
+        
+        //TODO compare method would look for identical ESSID and at least one AP in common
+        virtual bool isSameAs( const WirelessNetwork & ) const;
+        
+        // PHY stuff
+        virtual int signalStrength() const;
+        
+        virtual int bitRate() const;
+        
+        virtual int frequency() const;
+        
+        virtual Ifaces::Enums::WirelessNetwork::Capabilities capabilities() const;
+        
+        // Service Set stuff
+        virtual QString essid() const;
+        
+        virtual Ifaces::Enums::WirelessNetwork::OperationMode mode() const;
+        
+        virtual bool isAssociated() const;
+        
+        virtual bool isEncrypted() const;
+        
+        virtual bool isHidden() const;
+        
+        virtual bool isActive() const;
+        
+        /**
+         * List of access points making up the network,
+         * or ad hoc network nodes
+         */
+        virtual MacAddressList bssList() const;
+        
+        /**
+         * TODO decide how to handle these objects - pass by value with implicit sharing?
+         */
+        virtual Solid::Net::Ifaces::Encryption * encryption() const;
+        
+    signals:
+        virtual void signalStrengthChanged( int );
+        virtual void bitrateChanged( int );
+        virtual void associationChanged( bool );
+        virtual void activeChanged( bool );
+    private:
+        class Private;
+        Private * d;
+};
+
+} //Net
+} //Solid
+
+#endif
Index: solid/Net/CMakeLists.txt
===================================================================
--- solid/Net/CMakeLists.txt	(revision 0)
+++ solid/Net/CMakeLists.txt	(revision 0)
@@ -0,0 +1,20 @@
+add_subdirectory( ifaces )
+
+include_directories( ${CMAKE_SOURCE_DIR} ${KDE4_INCLUDE_DIR} ${QT_INCLUDES} )
+
+set( solidnet_LIB_SRCS
+    device.cpp
+    network.cpp
+    wirelessnetwork.cpp
+)
+
+kde4_automoc( ${solidnet_LIB_SRCS} )
+
+kde4_add_library( solidnet SHARED ${solidnet_LIB_SRCS} )
+
+target_link_libraries( solidnet ${KDE4_KDECORE_LIBS} solidnetifaces )
+
+set_target_properties(solidnet PROPERTIES VERSION 4.2.0 SOVERSION 4 )
+install_targets(${LIB_INSTALL_DIR} solidnet )
+
+install( FILES device.h network.h wirelessnetwork.h DESTINATION include/solid/net/ifaces )

Attachment: pgpVmAJBR89yQ.pgp
Description: PGP signature

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

Reply via email to