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

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 Power struct {
	Path     dbus.ObjectPath
	DestName string
	core     *dbus.Object

	signals       map[<-chan *dbus.Signal]struct{}
	signalsLocker sync.Mutex

	PowerButtonAction     *dbusPropertyPowerPowerButtonAction
	LidClosedAction       *dbusPropertyPowerLidClosedAction
	LockWhenActive        *dbusPropertyPowerLockWhenActive
	LidIsPresent          *dbusPropertyPowerLidIsPresent
	LinePowerPlan         *dbusPropertyPowerLinePowerPlan
	LinePowerSuspendDelay *dbusPropertyPowerLinePowerSuspendDelay
	LinePowerIdleDelay    *dbusPropertyPowerLinePowerIdleDelay
	BatteryPlan           *dbusPropertyPowerBatteryPlan
	BatterySuspendDelay   *dbusPropertyPowerBatterySuspendDelay
	BatteryIdleDelay      *dbusPropertyPowerBatteryIdleDelay
	BatteryPercentage     *dbusPropertyPowerBatteryPercentage
	BatteryState          *dbusPropertyPowerBatteryState
	BatteryIsPresent      *dbusPropertyPowerBatteryIsPresent
	OnBattery             *dbusPropertyPowerOnBattery
	PlanInfo              *dbusPropertyPowerPlanInfo
}

func (obj *Power) _createSignalChan() <-chan *dbus.Signal {
	obj.signalsLocker.Lock()
	ch := getBus().Signal()
	obj.signals[ch] = struct{}{}
	obj.signalsLocker.Unlock()
	return ch
}
func (obj *Power) _deleteSignalChan(ch <-chan *dbus.Signal) {
	obj.signalsLocker.Lock()
	delete(obj.signals, ch)
	getBus().DetachSignal(ch)
	obj.signalsLocker.Unlock()
}
func DestroyPower(obj *Power) {
	obj.signalsLocker.Lock()
	defer obj.signalsLocker.Unlock()
	if obj.signals == nil {
		return
	}
	for ch, _ := range obj.signals {
		getBus().DetachSignal(ch)
	}
	obj.signals = nil

	runtime.SetFinalizer(obj, nil)

	dbusRemoveMatch("type='signal',path='" + string(obj.Path) + "',interface='org.freedesktop.DBus.Properties',sender='" + obj.DestName + "',member='PropertiesChanged'")
	dbusRemoveMatch("type='signal',path='" + string(obj.Path) + "',interface='com.deepin.daemon.Power',sender='" + obj.DestName + "',member='PropertiesChanged'")

	obj.PowerButtonAction.Reset()
	obj.LidClosedAction.Reset()
	obj.LockWhenActive.Reset()
	obj.LidIsPresent.Reset()
	obj.LinePowerPlan.Reset()
	obj.LinePowerSuspendDelay.Reset()
	obj.LinePowerIdleDelay.Reset()
	obj.BatteryPlan.Reset()
	obj.BatterySuspendDelay.Reset()
	obj.BatteryIdleDelay.Reset()
	obj.BatteryPercentage.Reset()
	obj.BatteryState.Reset()
	obj.BatteryIsPresent.Reset()
	obj.OnBattery.Reset()
	obj.PlanInfo.Reset()
}

func (obj *Power) Reset() (_err error) {
	_err = obj.core.Call("com.deepin.daemon.Power.Reset", 0).Store()
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

type dbusPropertyPowerPowerButtonAction struct {
	*property.BaseObserver
	core *dbus.Object
}

func (this *dbusPropertyPowerPowerButtonAction) SetValue(v interface{} /*int32*/) {
	if reflect.TypeOf(v) == reflect.TypeOf((*int32)(nil)).Elem() {
		this.core.Call("org.freedesktop.DBus.Properties.Set", 0, "com.deepin.daemon.Power", "PowerButtonAction", dbus.MakeVariant(v))
	} else {
		fmt.Println("The property PowerButtonAction of com.deepin.daemon.Power is an int32 but Set with an ", reflect.TypeOf(v))
	}
}
func (this *dbusPropertyPowerPowerButtonAction) Set(v int32) {
	this.SetValue(v)
}

func (this *dbusPropertyPowerPowerButtonAction) Get() int32 {
	v, _ := this.GetValue()
	return v.(int32)
}
func (this *dbusPropertyPowerPowerButtonAction) GetValue() (interface{} /*int32*/, error) {
	var r dbus.Variant
	err := this.core.Call("org.freedesktop.DBus.Properties.Get", 0, "com.deepin.daemon.Power", "PowerButtonAction").Store(&r)
	if err == nil && r.Signature().String() == "i" {
		return r.Value().(int32), nil
	}
	return *new(int32), err
}
func (this *dbusPropertyPowerPowerButtonAction) GetType() reflect.Type {
	return reflect.TypeOf((*int32)(nil)).Elem()
}

type dbusPropertyPowerLidClosedAction struct {
	*property.BaseObserver
	core *dbus.Object
}

func (this *dbusPropertyPowerLidClosedAction) SetValue(v interface{} /*int32*/) {
	if reflect.TypeOf(v) == reflect.TypeOf((*int32)(nil)).Elem() {
		this.core.Call("org.freedesktop.DBus.Properties.Set", 0, "com.deepin.daemon.Power", "LidClosedAction", dbus.MakeVariant(v))
	} else {
		fmt.Println("The property LidClosedAction of com.deepin.daemon.Power is an int32 but Set with an ", reflect.TypeOf(v))
	}
}
func (this *dbusPropertyPowerLidClosedAction) Set(v int32) {
	this.SetValue(v)
}

func (this *dbusPropertyPowerLidClosedAction) Get() int32 {
	v, _ := this.GetValue()
	return v.(int32)
}
func (this *dbusPropertyPowerLidClosedAction) GetValue() (interface{} /*int32*/, error) {
	var r dbus.Variant
	err := this.core.Call("org.freedesktop.DBus.Properties.Get", 0, "com.deepin.daemon.Power", "LidClosedAction").Store(&r)
	if err == nil && r.Signature().String() == "i" {
		return r.Value().(int32), nil
	}
	return *new(int32), err
}
func (this *dbusPropertyPowerLidClosedAction) GetType() reflect.Type {
	return reflect.TypeOf((*int32)(nil)).Elem()
}

type dbusPropertyPowerLockWhenActive struct {
	*property.BaseObserver
	core *dbus.Object
}

func (this *dbusPropertyPowerLockWhenActive) SetValue(v interface{} /*bool*/) {
	if reflect.TypeOf(v) == reflect.TypeOf((*bool)(nil)).Elem() {
		this.core.Call("org.freedesktop.DBus.Properties.Set", 0, "com.deepin.daemon.Power", "LockWhenActive", dbus.MakeVariant(v))
	} else {
		fmt.Println("The property LockWhenActive of com.deepin.daemon.Power is an bool but Set with an ", reflect.TypeOf(v))
	}
}
func (this *dbusPropertyPowerLockWhenActive) Set(v bool) {
	this.SetValue(v)
}

func (this *dbusPropertyPowerLockWhenActive) Get() bool {
	v, _ := this.GetValue()
	return v.(bool)
}
func (this *dbusPropertyPowerLockWhenActive) GetValue() (interface{} /*bool*/, error) {
	var r dbus.Variant
	err := this.core.Call("org.freedesktop.DBus.Properties.Get", 0, "com.deepin.daemon.Power", "LockWhenActive").Store(&r)
	if err == nil && r.Signature().String() == "b" {
		return r.Value().(bool), nil
	}
	return *new(bool), err
}
func (this *dbusPropertyPowerLockWhenActive) GetType() reflect.Type {
	return reflect.TypeOf((*bool)(nil)).Elem()
}

type dbusPropertyPowerLidIsPresent struct {
	*property.BaseObserver
	core *dbus.Object
}

func (this *dbusPropertyPowerLidIsPresent) SetValue(notwritable interface{}) {
	fmt.Println("com.deepin.daemon.Power.LidIsPresent is not writable")
}

func (this *dbusPropertyPowerLidIsPresent) Get() bool {
	v, _ := this.GetValue()
	return v.(bool)
}
func (this *dbusPropertyPowerLidIsPresent) GetValue() (interface{} /*bool*/, error) {
	var r dbus.Variant
	err := this.core.Call("org.freedesktop.DBus.Properties.Get", 0, "com.deepin.daemon.Power", "LidIsPresent").Store(&r)
	if err == nil && r.Signature().String() == "b" {
		return r.Value().(bool), nil
	}
	return *new(bool), err
}
func (this *dbusPropertyPowerLidIsPresent) GetType() reflect.Type {
	return reflect.TypeOf((*bool)(nil)).Elem()
}

type dbusPropertyPowerLinePowerPlan struct {
	*property.BaseObserver
	core *dbus.Object
}

func (this *dbusPropertyPowerLinePowerPlan) SetValue(v interface{} /*int32*/) {
	if reflect.TypeOf(v) == reflect.TypeOf((*int32)(nil)).Elem() {
		this.core.Call("org.freedesktop.DBus.Properties.Set", 0, "com.deepin.daemon.Power", "LinePowerPlan", dbus.MakeVariant(v))
	} else {
		fmt.Println("The property LinePowerPlan of com.deepin.daemon.Power is an int32 but Set with an ", reflect.TypeOf(v))
	}
}
func (this *dbusPropertyPowerLinePowerPlan) Set(v int32) {
	this.SetValue(v)
}

func (this *dbusPropertyPowerLinePowerPlan) Get() int32 {
	v, _ := this.GetValue()
	return v.(int32)
}
func (this *dbusPropertyPowerLinePowerPlan) GetValue() (interface{} /*int32*/, error) {
	var r dbus.Variant
	err := this.core.Call("org.freedesktop.DBus.Properties.Get", 0, "com.deepin.daemon.Power", "LinePowerPlan").Store(&r)
	if err == nil && r.Signature().String() == "i" {
		return r.Value().(int32), nil
	}
	return *new(int32), err
}
func (this *dbusPropertyPowerLinePowerPlan) GetType() reflect.Type {
	return reflect.TypeOf((*int32)(nil)).Elem()
}

type dbusPropertyPowerLinePowerSuspendDelay struct {
	*property.BaseObserver
	core *dbus.Object
}

func (this *dbusPropertyPowerLinePowerSuspendDelay) SetValue(v interface{} /*int32*/) {
	if reflect.TypeOf(v) == reflect.TypeOf((*int32)(nil)).Elem() {
		this.core.Call("org.freedesktop.DBus.Properties.Set", 0, "com.deepin.daemon.Power", "LinePowerSuspendDelay", dbus.MakeVariant(v))
	} else {
		fmt.Println("The property LinePowerSuspendDelay of com.deepin.daemon.Power is an int32 but Set with an ", reflect.TypeOf(v))
	}
}
func (this *dbusPropertyPowerLinePowerSuspendDelay) Set(v int32) {
	this.SetValue(v)
}

func (this *dbusPropertyPowerLinePowerSuspendDelay) Get() int32 {
	v, _ := this.GetValue()
	return v.(int32)
}
func (this *dbusPropertyPowerLinePowerSuspendDelay) GetValue() (interface{} /*int32*/, error) {
	var r dbus.Variant
	err := this.core.Call("org.freedesktop.DBus.Properties.Get", 0, "com.deepin.daemon.Power", "LinePowerSuspendDelay").Store(&r)
	if err == nil && r.Signature().String() == "i" {
		return r.Value().(int32), nil
	}
	return *new(int32), err
}
func (this *dbusPropertyPowerLinePowerSuspendDelay) GetType() reflect.Type {
	return reflect.TypeOf((*int32)(nil)).Elem()
}

type dbusPropertyPowerLinePowerIdleDelay struct {
	*property.BaseObserver
	core *dbus.Object
}

func (this *dbusPropertyPowerLinePowerIdleDelay) SetValue(v interface{} /*int32*/) {
	if reflect.TypeOf(v) == reflect.TypeOf((*int32)(nil)).Elem() {
		this.core.Call("org.freedesktop.DBus.Properties.Set", 0, "com.deepin.daemon.Power", "LinePowerIdleDelay", dbus.MakeVariant(v))
	} else {
		fmt.Println("The property LinePowerIdleDelay of com.deepin.daemon.Power is an int32 but Set with an ", reflect.TypeOf(v))
	}
}
func (this *dbusPropertyPowerLinePowerIdleDelay) Set(v int32) {
	this.SetValue(v)
}

func (this *dbusPropertyPowerLinePowerIdleDelay) Get() int32 {
	v, _ := this.GetValue()
	return v.(int32)
}
func (this *dbusPropertyPowerLinePowerIdleDelay) GetValue() (interface{} /*int32*/, error) {
	var r dbus.Variant
	err := this.core.Call("org.freedesktop.DBus.Properties.Get", 0, "com.deepin.daemon.Power", "LinePowerIdleDelay").Store(&r)
	if err == nil && r.Signature().String() == "i" {
		return r.Value().(int32), nil
	}
	return *new(int32), err
}
func (this *dbusPropertyPowerLinePowerIdleDelay) GetType() reflect.Type {
	return reflect.TypeOf((*int32)(nil)).Elem()
}

type dbusPropertyPowerBatteryPlan struct {
	*property.BaseObserver
	core *dbus.Object
}

func (this *dbusPropertyPowerBatteryPlan) SetValue(v interface{} /*int32*/) {
	if reflect.TypeOf(v) == reflect.TypeOf((*int32)(nil)).Elem() {
		this.core.Call("org.freedesktop.DBus.Properties.Set", 0, "com.deepin.daemon.Power", "BatteryPlan", dbus.MakeVariant(v))
	} else {
		fmt.Println("The property BatteryPlan of com.deepin.daemon.Power is an int32 but Set with an ", reflect.TypeOf(v))
	}
}
func (this *dbusPropertyPowerBatteryPlan) Set(v int32) {
	this.SetValue(v)
}

func (this *dbusPropertyPowerBatteryPlan) Get() int32 {
	v, _ := this.GetValue()
	return v.(int32)
}
func (this *dbusPropertyPowerBatteryPlan) GetValue() (interface{} /*int32*/, error) {
	var r dbus.Variant
	err := this.core.Call("org.freedesktop.DBus.Properties.Get", 0, "com.deepin.daemon.Power", "BatteryPlan").Store(&r)
	if err == nil && r.Signature().String() == "i" {
		return r.Value().(int32), nil
	}
	return *new(int32), err
}
func (this *dbusPropertyPowerBatteryPlan) GetType() reflect.Type {
	return reflect.TypeOf((*int32)(nil)).Elem()
}

type dbusPropertyPowerBatterySuspendDelay struct {
	*property.BaseObserver
	core *dbus.Object
}

func (this *dbusPropertyPowerBatterySuspendDelay) SetValue(v interface{} /*int32*/) {
	if reflect.TypeOf(v) == reflect.TypeOf((*int32)(nil)).Elem() {
		this.core.Call("org.freedesktop.DBus.Properties.Set", 0, "com.deepin.daemon.Power", "BatterySuspendDelay", dbus.MakeVariant(v))
	} else {
		fmt.Println("The property BatterySuspendDelay of com.deepin.daemon.Power is an int32 but Set with an ", reflect.TypeOf(v))
	}
}
func (this *dbusPropertyPowerBatterySuspendDelay) Set(v int32) {
	this.SetValue(v)
}

func (this *dbusPropertyPowerBatterySuspendDelay) Get() int32 {
	v, _ := this.GetValue()
	return v.(int32)
}
func (this *dbusPropertyPowerBatterySuspendDelay) GetValue() (interface{} /*int32*/, error) {
	var r dbus.Variant
	err := this.core.Call("org.freedesktop.DBus.Properties.Get", 0, "com.deepin.daemon.Power", "BatterySuspendDelay").Store(&r)
	if err == nil && r.Signature().String() == "i" {
		return r.Value().(int32), nil
	}
	return *new(int32), err
}
func (this *dbusPropertyPowerBatterySuspendDelay) GetType() reflect.Type {
	return reflect.TypeOf((*int32)(nil)).Elem()
}

type dbusPropertyPowerBatteryIdleDelay struct {
	*property.BaseObserver
	core *dbus.Object
}

func (this *dbusPropertyPowerBatteryIdleDelay) SetValue(v interface{} /*int32*/) {
	if reflect.TypeOf(v) == reflect.TypeOf((*int32)(nil)).Elem() {
		this.core.Call("org.freedesktop.DBus.Properties.Set", 0, "com.deepin.daemon.Power", "BatteryIdleDelay", dbus.MakeVariant(v))
	} else {
		fmt.Println("The property BatteryIdleDelay of com.deepin.daemon.Power is an int32 but Set with an ", reflect.TypeOf(v))
	}
}
func (this *dbusPropertyPowerBatteryIdleDelay) Set(v int32) {
	this.SetValue(v)
}

func (this *dbusPropertyPowerBatteryIdleDelay) Get() int32 {
	v, _ := this.GetValue()
	return v.(int32)
}
func (this *dbusPropertyPowerBatteryIdleDelay) GetValue() (interface{} /*int32*/, error) {
	var r dbus.Variant
	err := this.core.Call("org.freedesktop.DBus.Properties.Get", 0, "com.deepin.daemon.Power", "BatteryIdleDelay").Store(&r)
	if err == nil && r.Signature().String() == "i" {
		return r.Value().(int32), nil
	}
	return *new(int32), err
}
func (this *dbusPropertyPowerBatteryIdleDelay) GetType() reflect.Type {
	return reflect.TypeOf((*int32)(nil)).Elem()
}

type dbusPropertyPowerBatteryPercentage struct {
	*property.BaseObserver
	core *dbus.Object
}

func (this *dbusPropertyPowerBatteryPercentage) SetValue(notwritable interface{}) {
	fmt.Println("com.deepin.daemon.Power.BatteryPercentage is not writable")
}

func (this *dbusPropertyPowerBatteryPercentage) Get() float64 {
	v, _ := this.GetValue()
	return v.(float64)
}
func (this *dbusPropertyPowerBatteryPercentage) GetValue() (interface{} /*float64*/, error) {
	var r dbus.Variant
	err := this.core.Call("org.freedesktop.DBus.Properties.Get", 0, "com.deepin.daemon.Power", "BatteryPercentage").Store(&r)
	if err == nil && r.Signature().String() == "d" {
		return r.Value().(float64), nil
	}
	return *new(float64), err
}
func (this *dbusPropertyPowerBatteryPercentage) GetType() reflect.Type {
	return reflect.TypeOf((*float64)(nil)).Elem()
}

type dbusPropertyPowerBatteryState struct {
	*property.BaseObserver
	core *dbus.Object
}

func (this *dbusPropertyPowerBatteryState) SetValue(notwritable interface{}) {
	fmt.Println("com.deepin.daemon.Power.BatteryState is not writable")
}

func (this *dbusPropertyPowerBatteryState) Get() uint32 {
	v, _ := this.GetValue()
	return v.(uint32)
}
func (this *dbusPropertyPowerBatteryState) GetValue() (interface{} /*uint32*/, error) {
	var r dbus.Variant
	err := this.core.Call("org.freedesktop.DBus.Properties.Get", 0, "com.deepin.daemon.Power", "BatteryState").Store(&r)
	if err == nil && r.Signature().String() == "u" {
		return r.Value().(uint32), nil
	}
	return *new(uint32), err
}
func (this *dbusPropertyPowerBatteryState) GetType() reflect.Type {
	return reflect.TypeOf((*uint32)(nil)).Elem()
}

type dbusPropertyPowerBatteryIsPresent struct {
	*property.BaseObserver
	core *dbus.Object
}

func (this *dbusPropertyPowerBatteryIsPresent) SetValue(notwritable interface{}) {
	fmt.Println("com.deepin.daemon.Power.BatteryIsPresent is not writable")
}

func (this *dbusPropertyPowerBatteryIsPresent) Get() bool {
	v, _ := this.GetValue()
	return v.(bool)
}
func (this *dbusPropertyPowerBatteryIsPresent) GetValue() (interface{} /*bool*/, error) {
	var r dbus.Variant
	err := this.core.Call("org.freedesktop.DBus.Properties.Get", 0, "com.deepin.daemon.Power", "BatteryIsPresent").Store(&r)
	if err == nil && r.Signature().String() == "b" {
		return r.Value().(bool), nil
	}
	return *new(bool), err
}
func (this *dbusPropertyPowerBatteryIsPresent) GetType() reflect.Type {
	return reflect.TypeOf((*bool)(nil)).Elem()
}

type dbusPropertyPowerOnBattery struct {
	*property.BaseObserver
	core *dbus.Object
}

func (this *dbusPropertyPowerOnBattery) SetValue(notwritable interface{}) {
	fmt.Println("com.deepin.daemon.Power.OnBattery is not writable")
}

func (this *dbusPropertyPowerOnBattery) Get() bool {
	v, _ := this.GetValue()
	return v.(bool)
}
func (this *dbusPropertyPowerOnBattery) GetValue() (interface{} /*bool*/, error) {
	var r dbus.Variant
	err := this.core.Call("org.freedesktop.DBus.Properties.Get", 0, "com.deepin.daemon.Power", "OnBattery").Store(&r)
	if err == nil && r.Signature().String() == "b" {
		return r.Value().(bool), nil
	}
	return *new(bool), err
}
func (this *dbusPropertyPowerOnBattery) GetType() reflect.Type {
	return reflect.TypeOf((*bool)(nil)).Elem()
}

type dbusPropertyPowerPlanInfo struct {
	*property.BaseObserver
	core *dbus.Object
}

func (this *dbusPropertyPowerPlanInfo) SetValue(notwritable interface{}) {
	fmt.Println("com.deepin.daemon.Power.PlanInfo is not writable")
}

func (this *dbusPropertyPowerPlanInfo) Get() string {
	v, _ := this.GetValue()
	return v.(string)
}
func (this *dbusPropertyPowerPlanInfo) GetValue() (interface{} /*string*/, error) {
	var r dbus.Variant
	err := this.core.Call("org.freedesktop.DBus.Properties.Get", 0, "com.deepin.daemon.Power", "PlanInfo").Store(&r)
	if err == nil && r.Signature().String() == "s" {
		return r.Value().(string), nil
	}
	return *new(string), err
}
func (this *dbusPropertyPowerPlanInfo) GetType() reflect.Type {
	return reflect.TypeOf((*string)(nil)).Elem()
}

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

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

	obj := &Power{Path: path, DestName: destName, core: core, signals: make(map[<-chan *dbus.Signal]struct{})}

	obj.PowerButtonAction = &dbusPropertyPowerPowerButtonAction{&property.BaseObserver{}, core}
	obj.LidClosedAction = &dbusPropertyPowerLidClosedAction{&property.BaseObserver{}, core}
	obj.LockWhenActive = &dbusPropertyPowerLockWhenActive{&property.BaseObserver{}, core}
	obj.LidIsPresent = &dbusPropertyPowerLidIsPresent{&property.BaseObserver{}, core}
	obj.LinePowerPlan = &dbusPropertyPowerLinePowerPlan{&property.BaseObserver{}, core}
	obj.LinePowerSuspendDelay = &dbusPropertyPowerLinePowerSuspendDelay{&property.BaseObserver{}, core}
	obj.LinePowerIdleDelay = &dbusPropertyPowerLinePowerIdleDelay{&property.BaseObserver{}, core}
	obj.BatteryPlan = &dbusPropertyPowerBatteryPlan{&property.BaseObserver{}, core}
	obj.BatterySuspendDelay = &dbusPropertyPowerBatterySuspendDelay{&property.BaseObserver{}, core}
	obj.BatteryIdleDelay = &dbusPropertyPowerBatteryIdleDelay{&property.BaseObserver{}, core}
	obj.BatteryPercentage = &dbusPropertyPowerBatteryPercentage{&property.BaseObserver{}, core}
	obj.BatteryState = &dbusPropertyPowerBatteryState{&property.BaseObserver{}, core}
	obj.BatteryIsPresent = &dbusPropertyPowerBatteryIsPresent{&property.BaseObserver{}, core}
	obj.OnBattery = &dbusPropertyPowerOnBattery{&property.BaseObserver{}, core}
	obj.PlanInfo = &dbusPropertyPowerPlanInfo{&property.BaseObserver{}, core}

	dbusAddMatch("type='signal',path='" + string(path) + "',interface='org.freedesktop.DBus.Properties',sender='" + destName + "',member='PropertiesChanged'")
	dbusAddMatch("type='signal',path='" + string(path) + "',interface='com.deepin.daemon.Power',sender='" + destName + "',member='PropertiesChanged'")
	sigChan := obj._createSignalChan()
	go func() {
		typeString := reflect.TypeOf("")
		typeKeyValues := reflect.TypeOf(map[string]dbus.Variant{})
		typeArrayValues := reflect.TypeOf([]string{})
		for v := range sigChan {
			if v.Name == "org.freedesktop.DBus.Properties.PropertiesChanged" &&
				len(v.Body) == 3 &&
				reflect.TypeOf(v.Body[0]) == typeString &&
				reflect.TypeOf(v.Body[1]) == typeKeyValues &&
				reflect.TypeOf(v.Body[2]) == typeArrayValues &&
				v.Body[0].(string) == "com.deepin.daemon.Power" {
				props := v.Body[1].(map[string]dbus.Variant)
				for key, _ := range props {
					if false {
					} else if key == "PowerButtonAction" {
						obj.PowerButtonAction.Notify()

					} else if key == "LidClosedAction" {
						obj.LidClosedAction.Notify()

					} else if key == "LockWhenActive" {
						obj.LockWhenActive.Notify()

					} else if key == "LidIsPresent" {
						obj.LidIsPresent.Notify()

					} else if key == "LinePowerPlan" {
						obj.LinePowerPlan.Notify()

					} else if key == "LinePowerSuspendDelay" {
						obj.LinePowerSuspendDelay.Notify()

					} else if key == "LinePowerIdleDelay" {
						obj.LinePowerIdleDelay.Notify()

					} else if key == "BatteryPlan" {
						obj.BatteryPlan.Notify()

					} else if key == "BatterySuspendDelay" {
						obj.BatterySuspendDelay.Notify()

					} else if key == "BatteryIdleDelay" {
						obj.BatteryIdleDelay.Notify()

					} else if key == "BatteryPercentage" {
						obj.BatteryPercentage.Notify()

					} else if key == "BatteryState" {
						obj.BatteryState.Notify()

					} else if key == "BatteryIsPresent" {
						obj.BatteryIsPresent.Notify()

					} else if key == "OnBattery" {
						obj.OnBattery.Notify()

					} else if key == "PlanInfo" {
						obj.PlanInfo.Notify()
					}
				}
			} else if v.Name == "com.deepin.daemon.Power.PropertiesChanged" && len(v.Body) == 1 && reflect.TypeOf(v.Body[0]) == typeKeyValues {
				for key, _ := range v.Body[0].(map[string]dbus.Variant) {
					if false {
					} else if key == "PowerButtonAction" {
						obj.PowerButtonAction.Notify()

					} else if key == "LidClosedAction" {
						obj.LidClosedAction.Notify()

					} else if key == "LockWhenActive" {
						obj.LockWhenActive.Notify()

					} else if key == "LidIsPresent" {
						obj.LidIsPresent.Notify()

					} else if key == "LinePowerPlan" {
						obj.LinePowerPlan.Notify()

					} else if key == "LinePowerSuspendDelay" {
						obj.LinePowerSuspendDelay.Notify()

					} else if key == "LinePowerIdleDelay" {
						obj.LinePowerIdleDelay.Notify()

					} else if key == "BatteryPlan" {
						obj.BatteryPlan.Notify()

					} else if key == "BatterySuspendDelay" {
						obj.BatterySuspendDelay.Notify()

					} else if key == "BatteryIdleDelay" {
						obj.BatteryIdleDelay.Notify()

					} else if key == "BatteryPercentage" {
						obj.BatteryPercentage.Notify()

					} else if key == "BatteryState" {
						obj.BatteryState.Notify()

					} else if key == "BatteryIsPresent" {
						obj.BatteryIsPresent.Notify()

					} else if key == "OnBattery" {
						obj.OnBattery.Notify()

					} else if key == "PlanInfo" {
						obj.PlanInfo.Notify()
					}
				}
			}
		}
	}()

	runtime.SetFinalizer(obj, func(_obj *Power) { DestroyPower(_obj) })
	return obj, nil
}
