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