Hello Mantas,
Thanks for the quick response, Here is what I get for GetLinkByName
//busctl call org.freedesktop.network1 /org/freedesktop/network1
org.freedesktop.network1.Manager GetLinkByName s wlan0
//io 4 "/org/freedesktop/network1/link/_34"
1. I am subscribing to signal like below, Does that work?
2. how can I add another like link "eth0" for signals? subscribe separately?
g_dbus_connection_signal_subscribe (connection,// GDBusConnection
/*"org.freedesktop.network1"*/ NULL,//sender name to match on (unique or
well-known name) or NULL to listen from all senders
"org.freedesktop.DBus.Properties",//D-Bus interface name to match on or
NULL to match on all interfaces
"PropertiesChanged",//D-Bus signal name to match on or NULL to match on all
signals
"*/org/freedesktop**/network1/link/_34*",//object path to match on or NULL
to match on all object paths
NULL,//contents of first string argument to match on or NULL to match on
all kinds of arguments
G_DBUS_SIGNAL_FLAGS_NONE,//GDBusSignalFlags describing how arg0 is used in
subscribing to the signal
linkStatusMonitorCallBack,//callback to invoke when there is a signal
matching the requested data
nullptr,//user data to pass to callback
NULL);//function to free user_data with when subscription is removed or
NULL
Thanks,
Ashok
On Tue, Feb 6, 2024 at 5:11 PM Mantas Mikulėnas wrote:
> /org/freedesktop/network1 is the toplevel object that represents the
> networkd daemon as a whole. Interface-specific signals would be sent for
> the object paths of the individual interfaces, so you need to either:
>
> a) call *GetLinkByName()* on the toplevel object to find the interface
> object, and then subscribe for signals on that;
>
> or b) instead of filtering by path='/xx', filter by *path_namespace='/xx'
> *so that it will also match child objects.
>
> On Tue, Feb 6, 2024 at 10:30 AM ashok athukuri
> wrote:
>
>> Hello All,
>>
>>
>> I'm trying to use DBUS signal "PropertiesChanged" of
>> org.freedesktop.network1 /org/freedesktop/network1 *to detect network
>> interface is up or down OR the speed of the interface is changed.*
>>
>> Is it possible? using a subscription to "PropertiesChanged" signal via
>> the below interface or PATH ?
>> If yes, how to test those, Currently I don't see any anything on my
>> dbus-monitor.
>>
>> Here is how I am testing :
>>
>> *# dbus-monitor --system "type='signal',path='/org/freede*
>>
>>
>> *sktop/network1'"#ifconfig wlan0 down*
>>
>> # busctl introspect org.freedesktop.network1 /org/freedesktop/network1
>> NAMETYPE SIGNATURE RESULT/VALUE FLAGS
>> org.freedesktop.DBus.Introspectable interface - --
>> .Introspect method- s-
>> org.freedesktop.DBus.Peer interface - --
>> .GetMachineId method- s-
>> .Ping method- --
>> org.freedesktop.DBus.Properties interface - --
>> .Getmethodssv-
>> .GetAll methods a{sv}-
>> .Setmethodssv --
>> .PropertiesChanged signalsa{sv}as --
>> org.freedesktop.network1.Managerinterface - --
>> .Describe method- s-
>> .DescribeLink methodi s-
>> .ForceRenewLink methodi --
>> .GetLinkByIndex methodi so -
>> .GetLinkByName methods io -
>> .ListLinks method- a(iso) -
>> .ReconfigureLinkmethodi --
>> .Reload method- --
>> .RenewLink methodi --
>> .RevertLinkDNS methodi --
>> .RevertLinkNTP methodi --
>> .SetLinkDNS methodia(iay) --
>> .SetLinkDNSEx methodia(iayqs) --
>> .SetLinkDNSOverTLS methodis--
>> .SetLinkDNSSEC methodis--