Re: Trying to use the DBus API with QtDBus - does the example work?



Em Wednesday 21 December 2011, devine-mlist ddevnet net escreveu:

> On Wed, 21 Dec 2011 10:21:45 -0200, Lamarque V. Souza wrote:

>

>

> You should use the Settings path to get the settings for a

> connection:

>

> I figured that out minutes before I saw your reply :S

>

>

> DBUS Service: "org.freedesktop.NetworkManager"

> DBUS Object Path:

> "/org/freedesktop/NetworkManager"

> DBUS Interface:

> "org.freedesktop.NetworkManager"

>

> This little snippet made me think.

> Depending which Object you're working with you have different Interfaces

> available to manipulate the object. I found the Settings object,

> eventually. Initially I was trying to work with a Devices object.

>

> Now

> that I know this, I went over the example again and did see

> getConnection was indeed returning a settings path.

>

> > You should try

>

> QtNetworkManager instead of creating your program from scratch:

>

>

> https://projects.kde.org/projects/kdereview/libnm-qt

>

>

> QtNetworkManager make those details transparent. Unfortunately there is

> not small example of how to use it. I use it in Plasma

> NetworkManagement, but Plasma NM is a big program. If you want to try

> take a look at manager.h and connection.h, those probably contain the

> methods you are looking for.

>

> This is great news. The bad news is that I

> am very new to Qt and C++ so it may be too tricky for me to get started

> without examples.

>

> The functionality I need is the basic set: getting

> interfaces, IP addresses, default gateway, setting an IP addresses...

> Not much past that. Do you think you could put together a small example

> that lists interfaces and sets an IP address on an interface?

 

I added one example of how to list interfaces and retrieve the IP configuration (for static and dhcp). Git pull the repository and look at the examples directory. I still need to create the example for setting a IP address, which is not that simple since with NM you have to create a connection with the IP configuration first.

> The

> GObject and Python APIs look so simple :(

 

Well, QtNetworkManager is a working in progress and as so it is not finished yet.

 

--

Lamarque V. Souza

KDE's Network Management maintainer

http://planetkde.org/pt-br



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