1package main
2
3import (
4	"fmt"
5	"os"
6
7	"github.com/godbus/dbus/v5"
8)
9
10func main() {
11	conn, err := dbus.ConnectSessionBus()
12	if err != nil {
13		fmt.Fprintln(os.Stderr, "Failed to connect to session bus:", err)
14		os.Exit(1)
15	}
16	defer conn.Close()
17
18	var s string
19	obj := conn.Object("com.github.guelfey.Demo", "/com/github/guelfey/Demo")
20	err = obj.Call("com.github.guelfey.Demo.Foo", 0).Store(&s)
21	if err != nil {
22		fmt.Fprintln(os.Stderr, "Failed to call Foo function (is the server example running?):", err)
23		os.Exit(1)
24	}
25
26	fmt.Println("Result from calling Foo function on com.github.guelfey.Demo interface:")
27	fmt.Println(s)
28}
29