doc.go 2.6 KB

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