go-tg-screenshot-bot
71 строка · 2.6 Кб
1/*
2Package dbus implements bindings to the D-Bus message bus system.
3
4To use the message bus API, you first need to connect to a bus (usually the
5session or system bus). The acquired connection then can be used to call methods
6on remote objects and emit or receive signals. Using the Export method, you can
7arrange D-Bus methods calls to be directly translated to method calls on a Go
8value.
9
10Conversion Rules
11
12For outgoing messages, Go types are automatically converted to the
13corresponding D-Bus types. See the official specification at
14https://dbus.freedesktop.org/doc/dbus-specification.html#type-system for more
15information on the D-Bus type system. The following types are directly encoded
16as their respective D-Bus equivalents:
17
18Go type | D-Bus type
19------------+-----------
20byte | BYTE
21bool | BOOLEAN
22int16 | INT16
23uint16 | UINT16
24int | INT32
25uint | UINT32
26int32 | INT32
27uint32 | UINT32
28int64 | INT64
29uint64 | UINT64
30float64 | DOUBLE
31string | STRING
32ObjectPath | OBJECT_PATH
33Signature | SIGNATURE
34Variant | VARIANT
35interface{} | VARIANT
36UnixFDIndex | UNIX_FD
37
38Slices and arrays encode as ARRAYs of their element type.
39
40Maps encode as DICTs, provided that their key type can be used as a key for
41a DICT.
42
43Structs other than Variant and Signature encode as a STRUCT containing their
44exported fields in order. Fields whose tags contain `dbus:"-"` and unexported
45fields will be skipped.
46
47Pointers encode as the value they're pointed to.
48
49Types convertible to one of the base types above will be mapped as the
50base type.
51
52Trying to encode any other type or a slice, map or struct containing an
53unsupported type will result in an InvalidTypeError.
54
55For incoming messages, the inverse of these rules are used, with the exception
56of STRUCTs. Incoming STRUCTS are represented as a slice of empty interfaces
57containing the struct fields in the correct order. The Store function can be
58used to convert such values to Go structs.
59
60Unix FD passing
61
62Handling Unix file descriptors deserves special mention. To use them, you should
63first check that they are supported on a connection by calling SupportsUnixFDs.
64If it returns true, all method of Connection will translate messages containing
65UnixFD's to messages that are accompanied by the given file descriptors with the
66UnixFD values being substituted by the correct indices. Similarly, the indices
67of incoming messages are automatically resolved. It shouldn't be necessary to use
68UnixFDIndex.
69
70*/
71package dbus
72