iwd.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: "clement.legoffic@kelio.com" <clement.legoffic@kelio.com>
To: James Prestwood <prestwoj@gmail.com>,
	"iwd@lists.linux.dev" <iwd@lists.linux.dev>
Subject: RE: Object path last number
Date: Tue, 9 May 2023 14:40:16 +0000	[thread overview]
Message-ID: <671256a4ba9b4d00bf25ed303953a515@kelio.com> (raw)
In-Reply-To: <a6870e4e-ed1c-980e-d551-322910e6ac50@gmail.com>

Thank you !

> Hi Clement,
> 
> On 5/9/23 7:16 AM, clement.legoffic@kelio.com wrote:
> >
> > Thank you for your response.
> >
> >> Hi Clement,
> >>
> >> On 5/9/23 6:15 AM, clement.legoffic@kelio.com wrote:
> >>> Hi,
> >>>
> >>> I am trying to interface a dynamic dbus client to the IWD dbus
> >>> interface
> >> for simple commands such as GetOrderedNetworks() or Scan().
> >>> The thing is that the object path of those methods starts with
> >> "/net/connman/iwd/" followed by the phy (I only have one interface so
> >> I guess it will be 0) and then a number.
> >>> As I want to be dynamic I try to restart iwd to try to observe a
> >>> specific
> >> pattern in the last number of this object path. I have observe that
> >> this number is incremented by one at each restart of the iwd service.
> >>> But I saw this number jumping  (by 5 sometimes).
> >>>
> >>> So I was wondering If I want to call the Scan method, how can I get
> >>> the
> >> correct number for the object path dynamically ?
> >>
> >> The last number is actually the interface index, but the path itself
> >> isn't something you need to worry about deriving yourself. Instead
> >> you can use the org.freedesktop.DBus.ObjectManager interface and
> >> GetManagedObjects() method. This returns all the object paths and
> >> interfaces for IWD.
> >>
> >> If your working with Python you can check out IWD's test framework as
> >> a
> >> guide:
> >> https://git.kernel.org/pub/scm/network/wireless/iwd.git/tree/autotest
> >> s/ut
> >> il/iwd.py#n1143
> >
> > I am working with C and glib and haven't found this interface. I use 1.26
> version.
> > https://git.kernel.org/pub/scm/network/wireless/iwd.git/tree/autotests
> > /util/iwd.py?h=1.26#n1034 There is the same call at
> > GetManagedObjects() in 1.26 but I cannot find an equivalent method in C.
> >
> > But :
> > By calling Introspect() on interface
> > org.freedesktop.DBus.Introspectable() (object iwd/connman/iwd) I have
> found that it replies me with an XML that have the "under nodes" at the
> end of it So by iterating on it I will be able to get all the managed object
> from iwd.
> > Is this the only solution using C ?
> 
> You shouldn't need to call Introspect(). You can just get the object manager
> interface under the root path '/' and that should have the
> GetManagedObjects() method. We do this in iwctl using ELL, but it should
> be somewhat similar to GLib:
> 
> https://git.kernel.org/pub/scm/network/wireless/iwd.git/tree/client/dbus-
> proxy.c#n770
> 
> Thanks,
> James
> >
> > Clément
> >
> >>
> >> Thanks,
> >> James
> >>
> >>>
> >>> Thanks
> >>>
> >>> Clément

Clément

      reply	other threads:[~2023-05-09 14:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-09 13:15 Object path last number clement.legoffic
2023-05-09 13:57 ` James Prestwood
2023-05-09 14:16   ` clement.legoffic
2023-05-09 14:25     ` James Prestwood
2023-05-09 14:40       ` clement.legoffic [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=671256a4ba9b4d00bf25ed303953a515@kelio.com \
    --to=clement.legoffic@kelio.com \
    --cc=iwd@lists.linux.dev \
    --cc=prestwoj@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).