Example #1
0
func getProperty(obj *dbus.Object, iface string, prop string) dbus.Variant {
	result := dbus.Variant{}
	err := obj.Call(getPropertyMethod, 0, iface, prop).Store(&result)
	if err != nil {
		log.Println("Warning: could not get dbus property:", iface, prop, err)
		return dbus.Variant{}
	}
	return result
}
Example #2
0
func (a *AccountService) SetUserProperty(user *dbus.Object, propName string, propValue interface{}) error {
	methodName := a.propMethodMap[propName]
	if methodName == "" {
		return ErrInvalidProperty
	}

	if call := user.Call(fmt.Sprintf("org.freedesktop.Accounts.User.%v", methodName), 0, propValue); call.Err != nil {
		return call.Err
	}
	return nil
}
Example #3
0
File: call.go Project: 98pm/docker
// Call calls org.freedesktop.Introspectable.Introspect on a remote object
// and returns the introspection data.
func Call(o *dbus.Object) (*Node, error) {
	var xmldata string
	var node Node

	err := o.Call("org.freedesktop.DBus.Introspectable.Introspect", 0).Store(&xmldata)
	if err != nil {
		return nil, err
	}
	err = xml.NewDecoder(strings.NewReader(xmldata)).Decode(&node)
	if err != nil {
		return nil, err
	}
	if node.Name == "" {
		node.Name = string(o.Path())
	}
	return &node, nil
}
Example #4
0
func setProperty(obj *dbus.Object, iface string, prop string, val interface{}) {
	call := obj.Call(setPropertyMethod, 0, prop, val)
	if call.Err != nil {
		log.Println("Warning: could not set dbus property:", iface, prop, call.Err)
	}
}