doc.go 2.4 KB

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