Hi list,

Sorry for the delay I got dragged to other duties and didn't have time to 
finalize a revised patch until now. Find a cleaned up patch attached, it 
basically takes care of Stefan's comments (more on this below) and integrates 
better in the source tree (removed the Net namespace).

Le dimanche 6 août 2006 17:34, Stefan Winter a écrit :
> [...]
> BTW, IPv6 will (as always) save the world: you get an automatic
> notification of subnet and router change because routers send Router
> Advertisement messages. But we can't wait for decades until IPv6 is the
> default for client device connections.
> This functionality is not a big thing (after all, just a ping) but is
> lacking pretty much everywhere. It would move us ahead of MS, OS X etc.

That's definitely something that could be addressed in the backends (the 
NetworkManager backend for example). As you probably noticed the interfaces 
exposed through Solid are too abstract for this.

> [...]
> Oh, and my earlier comment still is valid in this regard:
> QStringList ...addresses, instead of QString ...address;

Ok, I just put an extra comment regarding this one because I admit I'm a bit 
split on this issue. I tend to think that for the average desktop usage you 
have only one address on the network not several of them. That looks more 
like a setup used for servers, so the questions are:
1) Is such a setup common on desktop systems?
2) Do we want to support a feature like this one more server oriented?

> --------------------------------------------------------------------------
>
> +        enum OperationMode { Adhoc, Managed };
>
> See my comment about Master and Repeater. Unassociated went away. Why? I
> thought that is a valid state...

I agree, hence why the enum got extended (Unassociated is back, Master and 
Repeater are now in).

> --------------------------------------------------------------------------
>
> +        enum Capabilities { WEP = 0x1, WPA = 0x2, WPA2 = 0x4, PSK = 0x8,
> IEEE8021X = 0x10, WEP40 = 0x20, WEP104 = 0x40, TKIP = 0x80, CCMP = 0x100 };
> [...]

Added a comment for this one. It can probably get simplified a lot (or simply 
disappear) thanks to the Encryption classes. It also addresses Christopher's 
comment regarding the fact that it's pretty much tied to NetworkManager, and 
I'd dislike to have something that backend specific in the libs.

> --------------------------------------------------------------------------
>
> +        /**
> +         * List of access points making up the network,
> +         * or ad hoc network nodes
> +         */
> +        virtual MacAddressList bssList() const;
>
> Um. This list is inherently incomplete, and thereby worthless. You can only
> add those MACs that you _see_ belonging to the same network. There may well
> be other APs that make up the same network but your client can not see.
> Same goes for Ad-Hoc, here this is commonly called the "hidden station
> problem". I'd suggest to just drop this function.

Well, I think you missed the point here (hence why I ignored your comment). 
It's here to allow us to determine that two networks with the same ESSID but 
different APs are probably different (think about the "netgear" SSID). Two 
networks (same ssid, different aps) could then be merged if we know (for 
example we asked the user) that they're really the same network.

> --------------------------------------------------------------------------
>
> +    signals:
> +        virtual void signalStrengthChanged( int );
>
> Fine, just keep in mind that the strength reported by the card is _almost
> never_  constant, even if you don't move. So this signal will basically
> almost always be emitted when you poll the device info.

Yep and that's fine IMHO.

> --------------------------------------------------------------------------
>
> I didn't see outOfRange() in the diff. If it's still in the code, see my
> remarks on its reliability.

No it's not there anymore.

> Having it in the repository would be great!

I'd like to commit it soon, the problem is that the Encryption and 
NetworkManager classes are missing. So maybe it'd be nice to wait for Will 
first.

> I expect my cookies to be delivered at aKademy :-)

Sure! <mental_note>Bring cookies for Stefan.</mental_note>
That said you know that it'll probably be easier to find beer than cookies in 
Dublin. ;-)

Looking forward to meet you there.

OT: You weren't at previous aKademies, were you?

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/ifaces/networkdevice.cpp
===================================================================
--- solid/ifaces/networkdevice.cpp	(révision 0)
+++ solid/ifaces/networkdevice.cpp	(révision 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 "networkdevice.h"
+
+Solid::Ifaces::NetworkDevice::~NetworkDevice()
+{
+
+}
+
+#include "networkdevice.moc"
Index: solid/ifaces/wirelessnetwork.h
===================================================================
--- solid/ifaces/wirelessnetwork.h	(révision 0)
+++ solid/ifaces/wirelessnetwork.h	(révision 0)
@@ -0,0 +1,95 @@
+/*  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_IFACES_WIRELESSNETWORK_H
+#define SOLID_IFACES_WIRELESSNETWORK_H
+
+#include <kdelibs_export.h>
+
+#include <QStringList>
+
+#include <solid/ifaces/enums.h>
+#include <solid/ifaces/network.h>
+
+
+namespace Solid
+{
+namespace Ifaces
+{
+    class NetworkEncryption;
+
+    /**
+     * A Wifi wireless network
+     */
+    class KDE_EXPORT WirelessNetwork : public Network, public Enums::WirelessNetwork
+    {
+        Q_OBJECT
+    public:
+        typedef QString MacAddress;
+        typedef QStringList MacAddressList;
+
+        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 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 NetworkEncryption * encryption() = 0;
+
+    Q_SIGNALS:
+        virtual void signalStrengthChanged( int ) = 0;
+        virtual void bitrateChanged( int ) = 0;
+        virtual void associationChanged( bool ) = 0;
+        virtual void activeChanged( bool ) = 0;
+    };
+
+} //Ifaces
+} //Solid
+
+#endif
Index: solid/ifaces/enums.h
===================================================================
--- solid/ifaces/enums.h	(révision 570865)
+++ solid/ifaces/enums.h	(copie de travail)
@@ -422,6 +422,42 @@
     };
     Q_DECLARE_OPERATORS_FOR_FLAGS( PowerManager::SuspendMethods )
     Q_DECLARE_OPERATORS_FOR_FLAGS( PowerManager::CpuFreqPolicies )
+
+
+
+
+    struct NetworkDevice
+    {
+        // == 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 Capability { NetworkManager = 0x1, CarrierDetect = 0x2, WirelessScan = 0x4 };
+        enum Type { IEEE802_3, IEEE802_11 };
+
+        Q_DECLARE_FLAGS( Capabilities, Capability )
+    };
+    Q_DECLARE_OPERATORS_FOR_FLAGS( NetworkDevice::Capabilities )
+
+    struct WirelessNetwork
+    {
+        enum OperationMode { Unassociated, Adhoc, Managed, Master, Repeater };
+
+        // corresponding to 802.11 capabilities defined in NetworkManager.h
+        // TODO: make this more neutral, we probably don't want to expose something backend
+        // dependant here, the Encryption class might help to solve this
+        enum Capability { WEP = 0x1, WPA = 0x2, WPA2 = 0x4, PSK = 0x8, IEEE8021X = 0x10,
+                          WEP40 = 0x20, WEP104 = 0x40, TKIP = 0x80, CCMP = 0x100 };
+
+        Q_DECLARE_FLAGS( Capabilities, Capability )
+    };
+    Q_DECLARE_OPERATORS_FOR_FLAGS( WirelessNetwork::Capabilities )
+
 }
 }
 }
Index: solid/ifaces/CMakeLists.txt
===================================================================
--- solid/ifaces/CMakeLists.txt	(révision 570865)
+++ solid/ifaces/CMakeLists.txt	(copie de travail)
@@ -23,7 +23,10 @@
    display.cpp 
    audioiface.cpp 
    abstractcapability.cpp
-   powermanager.cpp )
+   powermanager.cpp
+   networkdevice.cpp
+   network.cpp
+   wirelessnetwork.cpp )
 
 kde4_automoc(${solidifaces_LIB_SRCS})
 
@@ -37,6 +40,6 @@
 
 ########### install files ###############
 
-install( FILES devicemanager.h device.h enums.h capability.h processor.h block.h storage.h cdrom.h volume.h opticaldisc.h camera.h portablemediaplayer.h networkiface.h acadapter.h battery.h button.h display.h audioiface.h abstractcapability.h powermanager.h DESTINATION ${INCLUDE_INSTALL_DIR}/solid/ifaces)
+install( FILES devicemanager.h device.h enums.h capability.h processor.h block.h storage.h cdrom.h volume.h opticaldisc.h camera.h portablemediaplayer.h networkiface.h acadapter.h battery.h button.h display.h audioiface.h abstractcapability.h powermanager.h networkdevice.h network.h wirelessnetwork.h DESTINATION ${INCLUDE_INSTALL_DIR}/solid/ifaces)
 
 
Index: solid/ifaces/network.h
===================================================================
--- solid/ifaces/network.h	(révision 0)
+++ solid/ifaces/network.h	(révision 0)
@@ -0,0 +1,63 @@
+/*  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_IFACES_NETWORK_H
+#define SOLID_IFACES_NETWORK_H
+
+#include <kdelibs_export.h>
+
+#include <solid/ifaces/enums.h>
+
+#include <QObject>
+
+namespace Solid
+{
+namespace Ifaces
+{
+
+    /**
+     * Represents a generic IP network which we may be connected to
+     * TODO what about QNetworkAddressEntry
+     */
+    class KDE_EXPORT Network : public QObject
+    {
+        Q_OBJECT
+    public:
+        virtual ~Network();
+        // TODO ask Thiago whether to use QHostAddress or KIPAddress for these
+        // TODO? return a list of adresses as suggested by swinter?
+        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;
+
+    Q_SIGNALS:
+        void ipDetailsChanged();
+    };
+
+} //Ifaces
+} //Solid
+
+#endif
Index: solid/ifaces/wirelessnetwork.cpp
===================================================================
--- solid/ifaces/wirelessnetwork.cpp	(révision 0)
+++ solid/ifaces/wirelessnetwork.cpp	(révision 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::Ifaces::WirelessNetwork::~WirelessNetwork()
+{
+
+}
+
+#include "wirelessnetwork.moc"
+
+
Index: solid/ifaces/networkdevice.h
===================================================================
--- solid/ifaces/networkdevice.h	(révision 0)
+++ solid/ifaces/networkdevice.h	(révision 0)
@@ -0,0 +1,69 @@
+/*  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_IFACES_NETWORKDEVICE_H
+#define SOLID_IFACES_NETWORKDEVICE_H
+
+#include <kdelibs_export.h>
+
+#include <solid/ifaces/enums.h>
+
+#include <QObject>
+
+namespace Solid
+{
+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 NetworkDevice : public QObject, public Enums::NetworkDevice
+    {
+        Q_OBJECT
+    public:
+        virtual ~NetworkDevice();
+
+        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;
+
+    Q_SIGNALS:
+        void activeChanged( bool );
+        void linkUpChanged( bool );
+        void signalStrengthChanged( int );
+        void connectionStateChanged( ConnectionState );
+    };
+
+} //Ifaces
+} //Solid
+
+#endif
Index: solid/ifaces/network.cpp
===================================================================
--- solid/ifaces/network.cpp	(révision 0)
+++ solid/ifaces/network.cpp	(révision 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::Ifaces::Network::~Network()
+{
+
+}
+
+#include "network.moc"
Index: solid/networkdevice.cpp
===================================================================
--- solid/networkdevice.cpp	(révision 0)
+++ solid/networkdevice.cpp	(révision 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.
+
+*/
+
+#include "networkdevice.h"
+
+#include <solid/ifaces/networkdevice.h>
+
+namespace Solid
+{
+    class NetworkDevice::Private
+    {
+    public:
+        Ifaces::NetworkDevice * iface;
+    };
+}
+
+Solid::NetworkDevice::NetworkDevice( Solid::Ifaces::NetworkDevice * 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( int ) ),
+             this, SIGNAL( connectionStateChanged( int ) ) );
+}
+
+Solid::NetworkDevice::~NetworkDevice()
+{
+    delete d;
+}
+
+bool Solid::NetworkDevice::isActive()
+{
+    return d->iface->isActive();
+}
+
+Solid::NetworkDevice::Type Solid::NetworkDevice::type()
+{
+    return d->iface->type();
+
+}
+Solid::NetworkDevice::ConnectionState Solid::NetworkDevice::connectionState()
+{
+    return d->iface->connectionState();
+}
+
+int Solid::NetworkDevice::signalStrength()
+{
+    return d->iface->signalStrength();
+}
+
+int Solid::NetworkDevice::speed()
+{
+    return d->iface->speed();
+}
+
+bool Solid::NetworkDevice::isLinkUp()
+{
+    return d->iface->isLinkUp();
+}
+
+Solid::NetworkDevice::Capabilities Solid::NetworkDevice::capabilities()
+{
+    return d->iface->capabilities();
+}
+
+#include "networkdevice.moc"
+
Index: solid/wirelessnetwork.h
===================================================================
--- solid/wirelessnetwork.h	(révision 0)
+++ solid/wirelessnetwork.h	(révision 0)
@@ -0,0 +1,94 @@
+/*  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_WIRELESSNETWORK_H
+#define SOLID_WIRELESSNETWORK_H
+
+#include <solid/network.h>
+#include <solid/ifaces/enums.h>
+
+#include <kdelibs_export.h>
+
+namespace Solid
+{
+    namespace Ifaces
+    {
+        class WirelessNetwork;
+        class NetworkEncryption;
+    }
+
+    class KDE_EXPORT WirelessNetwork : public Network, public Ifaces::Enums::WirelessNetwork
+    {
+        Q_OBJECT
+    public:
+        typedef QString MacAddress;
+        typedef QStringList MacAddressList;
+
+        WirelessNetwork( Ifaces::WirelessNetwork * iface, QObject * parent );
+        virtual ~WirelessNetwork();
+
+        //TODO compare method would look for identical ESSID and at least one AP in common
+        bool isSameAs( const WirelessNetwork & ) const;
+
+        // PHY stuff
+        int signalStrength() const;
+
+        int bitRate() const;
+
+        int frequency() const;
+
+        Capabilities capabilities() const;
+
+        // Service Set stuff
+        QString essid() const;
+
+        OperationMode mode() const;
+
+        bool isAssociated() const;
+
+        bool isEncrypted() const;
+
+        bool isHidden() const;
+
+        bool isActive() const;
+
+        /**
+         * List of access points making up the network,
+         * or ad hoc network nodes
+         */
+        MacAddressList bssList() const;
+
+        /**
+         * TODO decide how to handle these objects - pass by value with implicit sharing?
+         */
+        Ifaces::NetworkEncryption * encryption() const;
+
+    Q_SIGNALS:
+        void signalStrengthChanged( int );
+        void bitrateChanged( int );
+        void associationChanged( bool );
+        void activeChanged( bool );
+
+    private:
+        class Private;
+        Private * d;
+    };
+}
+
+#endif
Index: solid/CMakeLists.txt
===================================================================
--- solid/CMakeLists.txt	(révision 570865)
+++ solid/CMakeLists.txt	(copie de travail)
@@ -29,13 +29,16 @@
    predicateparse.cpp 
    predicate_lexer.c 
    predicate_parser.c
-   powermanager.cpp )
+   powermanager.cpp
+   networkdevice.cpp
+   network.cpp
+   wirelessnetwork.cpp )
 
 kde4_automoc(${solid_LIB_SRCS})
 
 kde4_add_library(solid SHARED ${solid_LIB_SRCS})
 
-target_link_libraries(solid  ${KDE4_KIO_LIBS} solidifaces )
+target_link_libraries(solid  ${KDE4_KDECORE_LIBS} solidifaces )
 
 set_target_properties(solid PROPERTIES VERSION 4.2.0 SOVERSION 4 )
 install(TARGETS solid DESTINATION ${LIB_INSTALL_DIR} )
@@ -43,8 +46,8 @@
 
 ########### install files ###############
 
-install( FILES  soliddevicemanager.desktop solidpowermanager.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR}  )
-install( FILES device.h devicemanager.h capability.h processor.h block.h storage.h cdrom.h volume.h opticaldisc.h camera.h portablemediaplayer.h networkiface.h acadapter.h battery.h button.h display.h audioiface.h predicate.h powermanager.h DESTINATION ${INCLUDE_INSTALL_DIR}/solid)
+install( FILES  soliddevicemanager.desktop solidpowermanager.desktop solidnetworkmanager.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR}  )
+install( FILES device.h devicemanager.h capability.h processor.h block.h storage.h cdrom.h volume.h opticaldisc.h camera.h portablemediaplayer.h networkiface.h acadapter.h battery.h button.h display.h audioiface.h predicate.h powermanager.h networkdevice.h network.h wirelessnetwork.h DESTINATION ${INCLUDE_INSTALL_DIR}/solid)
 
 ########### parser build ###############
 
Index: solid/network.h
===================================================================
--- solid/network.h	(révision 0)
+++ solid/network.h	(révision 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_NETWORK_H
+#define SOLID_NETWORK_H
+
+#include <QObject>
+
+#include <kdelibs_export.h>
+
+namespace Solid
+{
+
+namespace Ifaces
+{
+    class Network;
+}
+
+class KDE_EXPORT Network : public QObject
+{
+    Q_OBJECT
+public:
+    Network( Ifaces::Network * iface, QObject * parent );
+    virtual ~Network();
+    // TODO ask Thiago whether to use QHostAddress or KIPAddress for these
+    // TODO? return a list of adresses as suggested by swinter?
+    QString ipV4Address();
+    // QString ipV6Address();
+
+    QString subnetMask();
+    QString broadcastAddress();
+    // wtf does NM use this for?
+    QString route();
+
+    QString primaryDNS();
+    QString secondaryDNS();
+
+Q_SIGNALS:
+    void ipDetailsChanged();
+
+private:
+    class Private;
+    Private * d;
+};
+
+}
+
+#endif
+
Index: solid/solidnetworkmanager.desktop
===================================================================
--- solid/solidnetworkmanager.desktop	(révision 0)
+++ solid/solidnetworkmanager.desktop	(révision 0)
@@ -0,0 +1,5 @@
+[Desktop Entry]
+Encoding=UTF-8
+Type=ServiceType
+X-KDE-ServiceType=SolidNetworkManager
+Name=KDE Network Management Backend
Index: solid/wirelessnetwork.cpp
===================================================================
--- solid/wirelessnetwork.cpp	(révision 0)
+++ solid/wirelessnetwork.cpp	(révision 0)
@@ -0,0 +1,119 @@
+/*  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"
+
+#include <solid/ifaces/wirelessnetwork.h>
+
+namespace Solid
+{
+    class WirelessNetwork::Private
+    {
+    public:
+        Ifaces::WirelessNetwork * iface;
+    };
+}
+
+Solid::WirelessNetwork::WirelessNetwork( Ifaces::WirelessNetwork * iface, QObject * parent )
+    : Network( iface, parent ), d( new Private )
+{
+    d->iface = iface;
+
+    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::WirelessNetwork::~WirelessNetwork()
+{
+    delete d;
+}
+
+bool Solid::WirelessNetwork::isSameAs( const WirelessNetwork & other ) const
+{
+    return ( other.essid() == essid() &&
+             other.bssList() == /*intersects*/ bssList() );
+}
+
+int Solid::WirelessNetwork::signalStrength() const
+{
+    return d->iface->signalStrength();
+}
+
+int Solid::WirelessNetwork::bitRate() const
+{
+    return d->iface->bitRate();
+}
+
+int Solid::WirelessNetwork::frequency() const
+{
+    return d->iface->frequency();
+}
+
+Solid::WirelessNetwork::MacAddressList Solid::WirelessNetwork::bssList() const
+{
+    return d->iface->bssList();
+}
+
+Solid::Ifaces::NetworkEncryption * Solid::WirelessNetwork::encryption() const
+{
+    return d->iface->encryption();
+}
+
+Solid::WirelessNetwork::Capabilities Solid::WirelessNetwork::capabilities() const
+{
+    return d->iface->capabilities();
+}
+
+QString Solid::WirelessNetwork::essid() const
+{
+    return d->iface->essid();
+}
+
+Solid::WirelessNetwork::OperationMode Solid::WirelessNetwork::mode() const
+{
+    return d->iface->mode();
+}
+
+bool Solid::WirelessNetwork::isAssociated() const
+{
+    return d->iface->isAssociated();
+}
+
+bool Solid::WirelessNetwork::isEncrypted() const
+{
+    return d->iface->isEncrypted();
+}
+
+bool Solid::WirelessNetwork::isHidden() const
+{
+    return d->iface->isHidden();
+}
+
+bool Solid::WirelessNetwork::isActive() const
+{
+    return d->iface->isActive();
+}
+
+#include "wirelessnetwork.moc"
Index: solid/networkdevice.h
===================================================================
--- solid/networkdevice.h	(révision 0)
+++ solid/networkdevice.h	(révision 0)
@@ -0,0 +1,69 @@
+/*  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_NETWORKDEVICE_H
+#define SOLID_NETWORKDEVICE_H
+
+#include <QObject>
+
+#include <solid/ifaces/enums.h>
+
+#include <kdelibs_export.h>
+
+namespace Solid
+{
+    namespace Ifaces
+    {
+        class NetworkDevice;
+    }
+
+    class KDE_EXPORT NetworkDevice : public QObject, public Ifaces::Enums::NetworkDevice
+    {
+        Q_OBJECT
+    public:
+        NetworkDevice( Ifaces::NetworkDevice * iface, QObject * parent );
+        virtual ~NetworkDevice();
+
+        bool isActive();
+
+        Type type();
+
+        ConnectionState connectionState();
+
+        int signalStrength();
+
+        int speed();
+
+        bool isLinkUp();
+
+        Capabilities capabilities();
+
+    signals:
+        void activeChanged( bool );
+        void linkUpChanged( bool );
+        void signalStrengthChanged( int );
+        void connectionStateChanged( int );
+
+    private:
+        class Private;
+        Private * d;
+    };
+}
+
+#endif
Index: solid/network.cpp
===================================================================
--- solid/network.cpp	(révision 0)
+++ solid/network.cpp	(révision 0)
@@ -0,0 +1,78 @@
+/*  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"
+
+#include <solid/ifaces/network.h>
+
+namespace Solid
+{
+    class Network::Private
+    {
+    public:
+        Ifaces::Network * iface;
+    };
+}
+
+Solid::Network::Network( Ifaces::Network * iface, QObject * parent )
+    : QObject( parent ), d( new Private )
+{
+    d->iface = iface;
+
+    connect( d->iface, SIGNAL( ipDetailsChanged() ),
+             this, SIGNAL( ipDetailsChanged() ) );
+}
+
+Solid::Network::~Network()
+{
+    delete d;
+}
+
+QString Solid::Network::ipV4Address()
+{
+    return d->iface->ipV4Address();
+}
+
+QString Solid::Network::subnetMask()
+{
+    return d->iface->subnetMask();
+
+}
+
+QString Solid::Network::broadcastAddress()
+{
+    return d->iface->broadcastAddress();
+}
+
+QString Solid::Network::route()
+{
+    return d->iface->route();
+}
+
+QString Solid::Network::primaryDNS()
+{
+    return d->iface->primaryDNS();
+}
+
+QString Solid::Network::secondaryDNS()
+{
+    return d->iface->secondaryDNS();
+}
+
+#include "network.moc"

Attachment: pgpqMb3tVDb7m.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