Which is incorrect, it should be ActiveConnection I believe.
Example code
```Go
package main
import (
"fmt"
nm "github.com/Wifx/gonetworkmanager"
)
func main() {
// https://pkg.go.dev/github.com/Wifx/gonetworkmanager#NetworkManager
nmManager, err := nm.NewNetworkManager()
if err != nil {
panic(err)
}
// Returns https://pkg.go.dev/github.com/Wifx/gonetworkmanager#Connection
p, err := nmManager.GetPropertyPrimaryConnection()
if err != 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"
if s, err := p.GetSettings(); err != nil {
// No such interface “org.freedesktop.NetworkManager.Settings.Connection” on object at path /org/freedesktop/NetworkManager/ActiveConnection/330
fmt.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#ActiveConnection
ac, err := nm.NewActiveConnection(p.GetPath())
if err != nil {
panic(err)
}
if t, err := ac.GetPropertyType(); err != nil {
panic(err)
} else {
fmt.Printf("GetPropertyType: %v\n", t)
}
p, err = ac.GetPropertyConnection()
if err != nil {
panic(err)
}
if s, err := p.GetSettings(); err != nil {
// No such interface “org.freedesktop.NetworkManager.Settings.Connection” on object at path /org/freedesktop/NetworkManager/ActiveConnection/330
fmt.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/330
GetPropertyType: 802-3-ethernet
GetSettings: 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
NetworkManager.PrimaryConnect
property contains:However the
NetworkManager.GetPropertyPrimaryConnection
binding is:Which is incorrect, it should be
ActiveConnection
I believe.Example code
```Go package main import ( "fmt" nm "github.com/Wifx/gonetworkmanager" ) func main() { // https://pkg.go.dev/github.com/Wifx/gonetworkmanager#NetworkManager nmManager, err := nm.NewNetworkManager() if err != nil { panic(err) } // Returns https://pkg.go.dev/github.com/Wifx/gonetworkmanager#Connection p, err := nmManager.GetPropertyPrimaryConnection() if err != 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" if s, err := p.GetSettings(); err != nil { // No such interface “org.freedesktop.NetworkManager.Settings.Connection” on object at path /org/freedesktop/NetworkManager/ActiveConnection/330 fmt.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#ActiveConnection ac, err := nm.NewActiveConnection(p.GetPath()) if err != nil { panic(err) } if t, err := ac.GetPropertyType(); err != nil { panic(err) } else { fmt.Printf("GetPropertyType: %v\n", t) } p, err = ac.GetPropertyConnection() if err != nil { panic(err) } if s, err := p.GetSettings(); err != nil { // No such interface “org.freedesktop.NetworkManager.Settings.Connection” on object at path /org/freedesktop/NetworkManager/ActiveConnection/330 fmt.Printf("GetSettings: %v\n", err) } else { fmt.Printf("GetSettings: settings has %d keys\n", len(s)) } } ```
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.