Re: PropertiesChanged



On Mon, 2010-03-29 at 13:28 +0200, Marcin Klekot wrote:
> Hi Dan,
> 
> thanks for your answer. With the dbus-monitor I see the
> PropertiesChanged signal on the interface
> org.freedesktop.NetworkManager.AccessPoint, but not in my Qt Application.
> The dbus-monitor output is:
> 
> signal sender=:1.5 -> dest=(null destination) serial=3364
> path=/org/freedesktop/NetworkManager/AccessPoint/4;
> interface=org.freedesktop.NetworkManager.AccessPoint;
> member=PropertiesChanged
>    array [
>       dict entry(
>          string "Strength"
>          variant             byte 40
>       )
>    ]

So if the signal is coming across the bus, that means that
NetworkManager is working correctly.  Which  means that there's some
error in the application or in the Qt bindings for D-Bus.  I don't know
enough about the Qt D-Bus bindings to really be helpful here, but if you
asked this question on various Qt developer lists they would probably
know more.

I've had similar issues with the glib D-Bus bindings, and it always
boiled down to an error in my code not correctly registering for the
signal.

Sorry I can't be of more help :(  But the problem likely has a simple
solution as I *know* people have had this working for a long time.

Dan

> 
> Let me explain the steps i did to establish the DBus connection in my Qt
> App, maybe someone see a mistake.
> 
> First I created the interface class from the nm-access-point.xml
> introspection file. Because the qdbusxml2cpp compiler does not
> understand the type a{sv}, I added an annotation as follows:
>     <signal name="PropertiesChanged">
> 		<annotation name="com.trolltech.QtDBus.QtTypeName.In0" value="Dict"/>
>         <arg name="properties" type="a{sv}" tp:type="String_Variant_Map">
> 
> The created header file is:
> *
>  * This file was generated by qdbusxml2cpp version 0.7
>  * Command line was: qdbusxml2cpp nm-access-point.xml -p
> AccessPointInterface
>  *
>  * qdbusxml2cpp is Copyright (C) 2009 Nokia Corporation and/or its
> subsidiary(-ies).
>  *
>  * This is an auto-generated file.
>  * Do not edit! All changes made to it will be lost.
>  */
> 
> #ifndef ACCESSPOINTINTERFACE_H_1268036583
> #define ACCESSPOINTINTERFACE_H_1268036583
> 
> #include <QtCore/QObject>
> #include <QtCore/QByteArray>
> #include <QtCore/QList>
> #include <QtCore/QMap>
> #include <QtCore/QString>
> #include <QtCore/QStringList>
> #include <QtCore/QVariant>
> #include <QtDBus/QtDBus>
> typedef QMap<QString, QVariant > Dict; //added manualy
> Q_DECLARE_METATYPE (Dict)  //added manualy
> 
> /*
>  * Proxy class for interface org.freedesktop.NetworkManager.AccessPoint
>  */
> class OrgFreedesktopNetworkManagerAccessPointInterface: public
> QDBusAbstractInterface
> {
>     Q_OBJECT
> public:
>     static inline const char *staticInterfaceName()
>     { return "org.freedesktop.NetworkManager.AccessPoint"; }
> 
> public:
>     OrgFreedesktopNetworkManagerAccessPointInterface(const QString
> &service, const QString &path, const QDBusConnection &connection,
> QObject *parent = 0);
> 
>     ~OrgFreedesktopNetworkManagerAccessPointInterface();
> 
>     Q_PROPERTY(uint Flags READ flags)
>     inline uint flags() const
>     { return qvariant_cast< uint >(internalPropGet("Flags")); }
> 
> /* some loc throwed away */
> 
>     Q_PROPERTY(uint WpaFlags READ wpaFlags)
>     inline uint wpaFlags() const
>     { return qvariant_cast< uint >(internalPropGet("WpaFlags")); }
> 
> //public Q_SLOTS: // METHODS
> Q_SIGNALS: // SIGNALS
>     void PropertiesChanged(Dict properties);
> };
> #endif
> 
> In the source code I defined Dict as follows:
> typedef QMap<QString, QVariant > Dict;
> Q_DECLARE_METATYPE (Dict)
> 
> and registered it with qDBusRegisterMetaType<Dict>() in the constructor
> of the interface class.
> 
> After creating an instance of that class I connected the
> PropertiesChanged signal to an appropriate slot with:
> 
> connect(m_pAccesspointInterface, SIGNAL(PropertiesChanged(Dict)), this,
> SLOT(on_APPropertiesChanged(Dict)));
> 
> I can read the properties (for example with strength()) and the returned
> values corresponds to the values reported by dbus-monitor, but the
> signal PropertiesChanged is not signaled.
> 
> I did the same steps with nm-exported-connection.xml with the following
> annotation for the parameter in the Updated signal:
> <annotation name="com.trolltech.QtDBus.QtTypeName.In0" value="DictOfDicts"/>
> 
> and the appropriate typedef in my source code:
> typedef QMap<QString, QVariant > Dict;
> Q_DECLARE_METATYPE (Dict)
> typedef QMap<QString, Dict > DictOfDicts;
> Q_DECLARE_METATYPE (DictOfDicts)
> 
> On this interface my application gets the Updated signal correctly.
> Any suggestions?
> 
> Dan Williams schrieb:
> > On Fri, 2010-03-19 at 17:55 +0100, Marcin Klekot wrote:
> >> Hi All,
> >>
> >> i am writing a qt based NM applet to configure wireless connections.
> >> With qdbusxml2cpp I created all needed interface classes from the
> >> introspection xml files. With this classes i can now talk to
> >> networkmanager over dubs (adding and deleting connections, connecting
> >> and disconnecting, and so on)
> >> The problem I have is that on no interface PropertiesChanged is
> >> signaled. Other signals like 'NewConnection' on 'NetworkManagerSetting'
> >> or  'Updated' on 'NetworkManagerSettings.Connection' are signaled
> >> correctly.
> >> I assumed that PropertiesChanged would be signaled on
> >> NetworkManager.Connection. Active if the connection state changes but
> >> this is not the case. PropertiesChanged is also not signaled on
> >> NetworkManager.Device.Wireless when the appropriate device connects or
> >> disconnects. On the other hand AccessPointAdded is signaled correctly.
> >>
> >> Any suggestions why  PropertiesChanged is not signaled?
> > 
> > I'm very sure you should be getting these signals.  I've verified that
> > the Bitrate property of the the Device.Wireless interface does get a
> > PropertiesChanged signal emitted when it changes.
> > 
> > Run "dbus-monitor --system" and walk away from your AP, for example.
> > The bitrate should drop the farther away you get.
> > 
> > Dan
> > 
> > 
> > 
> 




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]