/*This file is automatically generated by pkg.deepin.io/dbus-generator. Don't edit it*/
package bluez

import "pkg.deepin.io/lib/dbus"
import "pkg.deepin.io/lib/dbus/property"
import "reflect"
import "sync"
import "runtime"
import "fmt"
import "errors"

/*prevent compile error*/
var _ = fmt.Println
var _ = runtime.SetFinalizer
var _ = sync.NewCond
var _ = reflect.TypeOf
var _ = property.BaseObserver{}

type AgentManager1 struct {
	Path     dbus.ObjectPath
	DestName string
	core     *dbus.Object
}

func (obj *AgentManager1) RegisterAgent(agent dbus.ObjectPath, capability string) (_err error) {
	_err = obj.core.Call("org.bluez.AgentManager1.RegisterAgent", 0, agent, capability).Store()
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func (obj *AgentManager1) UnregisterAgent(agent dbus.ObjectPath) (_err error) {
	_err = obj.core.Call("org.bluez.AgentManager1.UnregisterAgent", 0, agent).Store()
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func (obj *AgentManager1) RequestDefaultAgent(agent dbus.ObjectPath) (_err error) {
	_err = obj.core.Call("org.bluez.AgentManager1.RequestDefaultAgent", 0, agent).Store()
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func NewAgentManager1(destName string, path dbus.ObjectPath) (*AgentManager1, error) {
	if !path.IsValid() {
		return nil, errors.New("The path of '" + string(path) + "' is invalid.")
	}

	core := getBus().Object(destName, path)

	obj := &AgentManager1{Path: path, DestName: destName, core: core}

	return obj, nil
}
