forked from muka/go-bluetooth
/
bluez.go
84 lines (77 loc) · 2.13 KB
/
bluez.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package bluez
import "github.com/godbus/dbus/introspect"
const (
OrgBluezPath = "/org/bluez"
OrgBluezInterface = "org.bluez"
//ObjectManagerInterface the dbus object manager interface
ObjectManagerInterface = "org.freedesktop.DBus.ObjectManager"
//InterfacesRemoved the DBus signal member for InterfacesRemoved
InterfacesRemoved = "org.freedesktop.DBus.ObjectManager.InterfacesRemoved"
//InterfacesAdded the DBus signal member for InterfacesAdded
InterfacesAdded = "org.freedesktop.DBus.ObjectManager.InterfacesAdded"
//PropertiesInterface the DBus properties interface
PropertiesInterface = "org.freedesktop.DBus.Properties"
//PropertiesChanged the DBus properties interface and member
PropertiesChanged = "org.freedesktop.DBus.Properties.PropertiesChanged"
// Introspectable introspectable interface
Introspectable = "org.freedesktop.DBus.Introspectable"
)
// ObjectManagerIntrospectDataString introspect ObjectManager description
const ObjectManagerIntrospectDataString = `
<interface name="org.freedesktop.DBus.ObjectManager">
<method name="GetManagedObjects">
<arg name="objects" type="a{oa{sa{sv}}}" direction="out" />
</method>
<signal name="InterfacesAdded">
<arg name="object" type="o"/>
<arg name="interfaces" type="a{sa{sv}}"/>
</signal>
<signal name="InterfacesRemoved">
<arg name="object" type="o"/>
<arg name="interfaces" type="as"/>
</signal>
</interface>`
// ObjectManagerIntrospectData introspect ObjectManager description
var ObjectManagerIntrospectData = introspect.Interface{
Name: "org.freedesktop.DBus.ObjectManager",
Methods: []introspect.Method{
{
Name: "GetManagedObjects",
Args: []introspect.Arg{
{
Name: "objects",
Type: "a{oa{sa{sv}}}",
Direction: "out",
},
},
},
},
Signals: []introspect.Signal{
{
Name: "InterfacesAdded",
Args: []introspect.Arg{
{
Name: "object",
Type: "o",
},
{
Name: "interfaces",
Type: "a{sa{sv}}",
},
},
},
{
Name: "InterfacesRemoved",
Args: []introspect.Arg{
{
Name: "object",
Type: "o",
},
{
Name: "interfaces",
Type: "as",
},
},
},
},
}