...
1 package introspect
2
3 import (
4 "encoding/xml"
5 "strings"
6
7 "github.com/godbus/dbus/v5"
8 )
9
10
11
12 func Call(o dbus.BusObject) (*Node, error) {
13 var xmldata string
14 var node Node
15
16 err := o.Call("org.freedesktop.DBus.Introspectable.Introspect", 0).Store(&xmldata)
17 if err != nil {
18 return nil, err
19 }
20 err = xml.NewDecoder(strings.NewReader(xmldata)).Decode(&node)
21 if err != nil {
22 return nil, err
23 }
24 if node.Name == "" {
25 node.Name = string(o.Path())
26 }
27 return &node, nil
28 }
29
View as plain text