You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Which is incorrect, it should be ActiveConnection I believe.
Example code
package main
import (
"fmt"
nm "github.com/Wifx/gonetworkmanager"
)
funcmain() {
// https://pkg.go.dev/github.com/Wifx/gonetworkmanager#NetworkManagernmManager, err:=nm.NewNetworkManager()
iferr!=nil {
panic(err)
}
// Returns https://pkg.go.dev/github.com/Wifx/gonetworkmanager#Connectionp, err:=nmManager.GetPropertyPrimaryConnection()
iferr!=nil {
panic(err)
}
// This fails with "No such interface" because the underlying object is an "ActiveConnection" but we try to treat it as a "Connection"ifs, err:=p.GetSettings(); err!=nil {
// No such interface “org.freedesktop.NetworkManager.Settings.Connection” on object at path /org/freedesktop/NetworkManager/ActiveConnection/330fmt.Printf("GetSettings: %v\n", err)
} else {
fmt.Printf("GetSettings: settings has %d keys\n", len(s))
}
// Convert to a https://pkg.go.dev/github.com/Wifx/gonetworkmanager#ActiveConnectionac, err:=nm.NewActiveConnection(p.GetPath())
iferr!=nil {
panic(err)
}
ift, err:=ac.GetPropertyType(); err!=nil {
panic(err)
} else {
fmt.Printf("GetPropertyType: %v\n", t)
}
p, err=ac.GetPropertyConnection()
iferr!=nil {
panic(err)
}
ifs, err:=p.GetSettings(); err!=nil {
// No such interface “org.freedesktop.NetworkManager.Settings.Connection” on object at path /org/freedesktop/NetworkManager/ActiveConnection/330fmt.Printf("GetSettings: %v\n", err)
} else {
fmt.Printf("GetSettings: settings has %d keys\n", len(s))
}
}
The output is:
$ go run ./GetSettings: No such interface “org.freedesktop.NetworkManager.Settings.Connection” on object at path /org/freedesktop/NetworkManager/ActiveConnection/330GetPropertyType: 802-3-ethernetGetSettings: settings has 5 keys
The first p.GetSettings() (line 23) fails with "No such interface" but after conversion to a ActiveConnection methods work and we can then obtain an actual connection from it and the second p.GetSettings() (line 47) on the right object type works.
The text was updated successfully, but these errors were encountered:
The
NetworkManager.PrimaryConnect
property contains:However the
NetworkManager.GetPropertyPrimaryConnection
binding is:Which is incorrect, it should be
ActiveConnection
I believe.Example code
The output is:
The first
p.GetSettings()
(line 23) fails with "No such interface" but after conversion to aActiveConnection
methods work and we can then obtain an actual connection from it and the secondp.GetSettings()
(line 47) on the right object type works.The text was updated successfully, but these errors were encountered: