doc.go 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. The following types are directly encoded as their
  11. respective D-Bus equivalents:
  12. Go type | D-Bus type
  13. ------------+-----------
  14. byte | BYTE
  15. bool | BOOLEAN
  16. int16 | INT16
  17. uint16 | UINT16
  18. int32 | INT32
  19. uint32 | UINT32
  20. int64 | INT64
  21. uint64 | UINT64
  22. float64 | DOUBLE
  23. string | STRING
  24. ObjectPath | OBJECT_PATH
  25. Signature | SIGNATURE
  26. Variant | VARIANT
  27. UnixFDIndex | UNIX_FD
  28. Slices and arrays encode as ARRAYs of their element type.
  29. Maps encode as DICTs, provided that their key type can be used as a key for
  30. a DICT.
  31. Structs other than Variant and Signature encode as a STRUCT containing their
  32. exported fields. Fields whose tags contain `dbus:"-"` and unexported fields will
  33. be skipped.
  34. Pointers encode as the value they're pointed to.
  35. Trying to encode any other type or a slice, map or struct containing an
  36. unsupported type will result in an InvalidTypeError.
  37. For incoming messages, the inverse of these rules are used, with the exception
  38. of STRUCTs. Incoming STRUCTS are represented as a slice of empty interfaces
  39. containing the struct fields in the correct order. The Store function can be
  40. used to convert such values to Go structs.
  41. Unix FD passing
  42. Handling Unix file descriptors deserves special mention. To use them, you should
  43. first check that they are supported on a connection by calling SupportsUnixFDs.
  44. If it returns true, all method of Connection will translate messages containing
  45. UnixFD's to messages that are accompanied by the given file descriptors with the
  46. UnixFD values being substituted by the correct indices. Similarily, the indices
  47. of incoming messages are automatically resolved. It shouldn't be necessary to use
  48. UnixFDIndex.
  49. */
  50. package dbus