0

I am trying to programmatically connect to a wireless network using the connman.service dbus interface.

When I call the connect method my "RequestInput" method is not being invoked.

I followed the solution provided by this question:

Catching and responding to the Connman 'RequestInput' method call with QtDBus

But I seem to be missing something. Can you see anything I did incorrectly?

conn_man.hpp

class ConnManAgent : public QObject 
{
    Q_OBJECT
    Q_CLASSINFO("D-Bus-Interface", "net.connman.Agent")

    public:

        /** Constructor */
        ConnManAgent(QObject *parent = nullptr) : QObject(parent) {};

        /** Interfaces */
        Q_INVOKABLE QVariantMap RequestInput(const QDBusObjectPath &path, const QVariantMap &fields);
};

wifi.hpp

class WIFI : public QObject
{
    Q_OBJECT
    
    private slots:
        void handleWifiConnect(const QString &objPath);
};

wifi.cpp

void WIFI::handleWifiConnect(const QString &objPath)
{

    // Initialize Variables //

    QDBusMessage response;
    QDBusConnection connection = QDBusConnection::systemBus();
    QDBusInterface manager("net.connman", "/", "net.connman.Manager", connection);

    response = _m_manager->call(QDBus::Block, 
                                "RegisterAgent", 
                                 QVariant::fromValue(QDBusObjectPath("/test/agent")));

    connection.registerObject(QStringLiteral("/test/agent"), 
                                             new ConnManAgent(this), 
                                             QDBusConnection::ExportAllInvokables);

    QDBusInterface service("net.connman", 
                              objPath, 
                             "net.connman.Service",
                              connection);


    QDBusMessage reply = service.call("Connect");


QVariantMap ConnManAgent::RequestInput(const QDBusObjectPath &path, const QVariantMap &fields)
{ 
    qDebug() << "I am here";
}

0 Answers0