Re: org.freedesktop.NetworkManager.Settings.PropertiesChanged deprecated



On 14.07.2021 19:30, mh mike franken de wrote:
Hi,

On Mittwoch, 14. Juli 2021 16:52:15 CEST Thomas Haller wrote:
[...]
so how can I use org.freedesktop.DBus.Properties.PropertiesChanged
then?
What would be the correct way instead?
Using
  my $busobjpath = "/org/freedesktop/NetworkManager/Settings";
as before?
This doesn't work either, though.

Probably there is a fundamental misunderstanding regaring the concept
on my
side.

Hi,

I am not familiar with this Perl's Net::DBus, but in general:


On D-Bus, you have the well-known name
("org.freedesktop.NetworkManager") where you find NetworkManager's D-
Bus API.


There, you find many D-Bus objects, at paths that start with
"/org/freedesktop/NetworkManager". You see them with `busctl tree
org.freedesktop.NetworkManager`.

All of these objects also implement the standard D-Bus interface
"org.freedesktop.DBus.Properties" -- as documented at
https://dbus.freedesktop.org/doc/dbus-specification.html
That interface, has (among) others a signal "PropertiesChanged".


This "org.freedesktop.DBus.Properties.PropertiesChanged" signal works
very similar to the earlier "PropertiesChanged" signals from the NM
specific interfaces ( "org.freedesktop.NetworkManager*").

So, yes, there should be not much to do except replace the interface
name "org.freedesktop.NetworkManager*" with
"org.freedesktop.DBus.Properties".


you mention specifically

  my $busobjpath = "/org/freedesktop/NetworkManager/Settings";

In `d-feet` you'll see that this object only has three properties. So
you'll see few PropertiesChanged signals on that object...

Yeah, my fault, I meant
my $busobjpath = "/org/freedesktop/NetworkManager";

8-(



Does that help? Otherwise, please share a working, minimal example.

Ok.
This is the working example I used before - btw. it stems from a suggestion 
you made back in 2016/2017 :)

#!/usr/bin/perl -w

use strict;

use Data::Dumper;
$Data::Dumper::Sortkeys = 1;
$Data::Dumper::Indent = 1;
use Net::DBus;
use Net::DBus::Dumper;
use Net::DBus::Reactor;

my $oBUS = Net::DBus->system || die $!;
my $nm = "org.freedesktop.NetworkManager";
my $oNM = $oBUS->get_service( $nm ) || die $!;
my $nmobjpath = "/org/freedesktop/NetworkManager";
my $nmif = "org.freedesktop.NetworkManager";
my $oNMIF = $oNM->get_object( $nmobjpath, $nmif ) || die $!;

$nmobjpath = "/org/freedesktop/NetworkManager/Settings";
$nmif = "org.freedesktop.NetworkManager.Settings";
my $oNMIFS = $oNM->get_object( $nmobjpath, $nmif ) || die $!;

$oNMIF->connect_to_signal(
  "PropertiesChanged", sub {
    &{ \&dbnm_onNMPropertiesChanged }( $oNM, $oNMIF, $oNMIFS, @_ );
  }
);
my $reactor = Net::DBus::Reactor->main() || die $!;
$reactor->run() || die $!;

sub dbnm_onNMPropertiesChanged {
  my( $oNM, $oNMIF, $oNMIFS, $props ) = @_;
  print "\n- props -\n", Dumper( $props ), "\n--\n";
}



NM PropertiesChanged and D-Bus
org.freedesktop.DBus.Properties.PropertiesChanged have different
signatures. You are dumping interface name, not properties dictionary.


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