Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NetworkManager and Qt Problem

Tags:

c++

qt

qt4

dbus

I am still new to using Qt4/Dbus, and i am trying to get a list of acccess points with Qt API to send/receive Dbus messeges. I got the following error:

org.freedesktop.DBus.Error.UnknownMethod
Method "GetAccessPoint" with signature "" on interface "org.freedesktop.NetworkManager.Device.Wireless" doesn't exist

The code is:

QStringList *netList = new QStringList();
    QDBusConnection sysbus = QDBusConnection::systemBus();
    QDBusInterface callNM("org.freedesktop.NetworkManager","/org/freedesktop/NetworkManager","org.freedesktop.NetworkManager.Device.Wireless",sysbus);
    if(callNM.isValid())
    {
        QDBusMessage query= callNM.call("GetAccessPoints");
        if(query.type() == QDBusMessage::ReplyMessage)
        {

            QDBusArgument arg = query.arguments().at(0).value<QDBusArgument>();
            arg.beginArray();
            while(!arg.atEnd())
            {                
                QString element = qdbus_cast<QString>(arg);
                netList->append(element);
            }
            arg.endArray();
        }else{
            std::cout<< query.errorName().toStdString() << std::endl;
            std::cout<< query.errorMessage().toStdString() << std::endl;
        }
        int x= netList->size();
        for(int y=0; y< x ;y++)
        {
            widget.avail_nets->addItem(netList->at(y)); // just print it to my gui from the stringlist array
        }

    }else{
            std::cout<<"fail" << std::endl;
    }

Whats wrong?My naming was correct and I am following the exact specs from here

like image 387
user542966 Avatar asked Mar 06 '26 17:03

user542966


1 Answers

The method name is GetAccessPoints.

While your error is:

org.freedesktop.DBus.Error.UnknownMethod Method "GetAccessPoint" with signature "" on interface "org.freedesktop.NetworkManager.Device.Wireless" doesn't exist

Highlight on "GetAccessPoint". Thus you might have misspelled the method name in the code, although the code you pasted here uses the correct method name, maybe you fixed it and forgot to rebuild or clean the project?

like image 181
Shinnok Avatar answered Mar 09 '26 07:03

Shinnok