Documentation ¶
Overview ¶
Package dbuscommon provides a common dbus server and client base to extend.
Index ¶
- func EavesDrop(match string) (chan *dbus.Message, error)
- func NewError(msg string) *dbus.Error
- func SessionBus() (*dbus.Conn, chan *dbus.Signal, error)
- func ToMapInterface(input map[string]dbus.Variant) map[string]interface{}
- func ToMapVariant(input map[string]interface{}) map[string]dbus.Variant
- type Client
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SessionBus ¶
SessionBus creates a Dbus session with a listening chan.
func ToMapInterface ¶
ToMapInterface recasts a map of dbus.Variant to a map of interface.
Types ¶
type Client ¶
Client is a Dbus client to connect to the internal Dbus server.
func GetClient ¶
GetClient return a connection to the active instance of the internal Dbus service if any. Return nil, nil if none found. InterfacePath is an optional string to provide if the object use an interface path different from SrvObj
func (*Client) Get ¶
Get calls a method on a Dbus object with returned values. The list of answers has to be provided before the command arguments. The type of each field in answer must be a pointer to a value of the same type as expected to be returned by the Dbus method called (its go version).
func (*Client) SetTestErr ¶
SetTestErr sets a test error function.
type Server ¶
type Server struct { Conn *dbus.Conn // Dbus connection. Events <-chan *dbus.Signal // Dbus incoming signals channel. Log cdtype.Logger // contains filtered or unexported fields }
Server is a Dbus server with applets service management.
func (*Server) Introspect ¶
func (load *Server) Introspect(obj interface{}, propsSpec map[string]map[string]*prop.Prop) *introspect.Node
Introspect provides introspection data for the DBus service to start.
propsSpec example:
var propsSpec = map[string]map[string]*prop.Prop{ SrvObj: { "Restart": { int32(0), true, prop.EmitTrue, func(c *prop.Change) *dbus.Error { fmt.Println(c.Name, "changed to", c.Value) return nil }, }, }, }