-
Notifications
You must be signed in to change notification settings - Fork 0
/
dbus-wrapper.go
51 lines (39 loc) · 1.09 KB
/
dbus-wrapper.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package mpris
import "github.com/godbus/dbus/v5"
type dbusConnWrapper struct {
conn *dbus.Conn
}
func (w dbusConnWrapper) Object(dest string, path dbus.ObjectPath) dbusBusObject {
return dbusBusObjectWrapper{
obj: w.conn.Object(dest, path),
}
}
func (w dbusConnWrapper) AddMatchSignal(options ...dbus.MatchOption) error {
return w.conn.AddMatchSignal(options...)
}
func (w dbusConnWrapper) Signal(ch chan<- *dbus.Signal) {
w.conn.Signal(ch)
}
type dbusBusObjectWrapper struct {
obj dbus.BusObject
}
func (w dbusBusObjectWrapper) Call(method string, flags dbus.Flags, args ...interface{}) dbusCall {
return dbusCallWrapper{
call: w.obj.Call(method, flags, args),
}
}
func (w dbusBusObjectWrapper) GetProperty(p string) (dbus.Variant, error) {
return w.obj.GetProperty(p)
}
func (w dbusBusObjectWrapper) SetProperty(p string, v interface{}) error {
return w.obj.SetProperty(p, v)
}
type dbusCallWrapper struct {
call *dbus.Call
}
func (w dbusCallWrapper) Store(retvalues ...interface{}) error {
return w.call.Store(retvalues)
}
func (w dbusConnWrapper) Close() error {
return w.conn.Close()
}