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

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

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

	IconName         *dbusPropertyDeviceIconName
	WarningLevel     *dbusPropertyDeviceWarningLevel
	Technology       *dbusPropertyDeviceTechnology
	Capacity         *dbusPropertyDeviceCapacity
	IsRechargeable   *dbusPropertyDeviceIsRechargeable
	State            *dbusPropertyDeviceState
	IsPresent        *dbusPropertyDeviceIsPresent
	Temperature      *dbusPropertyDeviceTemperature
	Percentage       *dbusPropertyDevicePercentage
	TimeToFull       *dbusPropertyDeviceTimeToFull
	TimeToEmpty      *dbusPropertyDeviceTimeToEmpty
	Luminosity       *dbusPropertyDeviceLuminosity
	Voltage          *dbusPropertyDeviceVoltage
	EnergyRate       *dbusPropertyDeviceEnergyRate
	EnergyFullDesign *dbusPropertyDeviceEnergyFullDesign
	EnergyFull       *dbusPropertyDeviceEnergyFull
	EnergyEmpty      *dbusPropertyDeviceEnergyEmpty
	Energy           *dbusPropertyDeviceEnergy
	Online           *dbusPropertyDeviceOnline
	HasStatistics    *dbusPropertyDeviceHasStatistics
	HasHistory       *dbusPropertyDeviceHasHistory
	PowerSupply      *dbusPropertyDevicePowerSupply
	Type             *dbusPropertyDeviceType
	UpdateTime       *dbusPropertyDeviceUpdateTime
	Serial           *dbusPropertyDeviceSerial
	Model            *dbusPropertyDeviceModel
	Vendor           *dbusPropertyDeviceVendor
	NativePath       *dbusPropertyDeviceNativePath
}

func (obj *Device) _createSignalChan() <-chan *dbus.Signal {
	obj.signalsLocker.Lock()
	ch := getBus().Signal()
	obj.signals[ch] = struct{}{}
	obj.signalsLocker.Unlock()
	return ch
}
func (obj *Device) _deleteSignalChan(ch <-chan *dbus.Signal) {
	obj.signalsLocker.Lock()
	delete(obj.signals, ch)
	getBus().DetachSignal(ch)
	obj.signalsLocker.Unlock()
}
func DestroyDevice(obj *Device) {
	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='org.freedesktop.UPower.Device',sender='" + obj.DestName + "',member='PropertiesChanged'")

	obj.IconName.Reset()
	obj.WarningLevel.Reset()
	obj.Technology.Reset()
	obj.Capacity.Reset()
	obj.IsRechargeable.Reset()
	obj.State.Reset()
	obj.IsPresent.Reset()
	obj.Temperature.Reset()
	obj.Percentage.Reset()
	obj.TimeToFull.Reset()
	obj.TimeToEmpty.Reset()
	obj.Luminosity.Reset()
	obj.Voltage.Reset()
	obj.EnergyRate.Reset()
	obj.EnergyFullDesign.Reset()
	obj.EnergyFull.Reset()
	obj.EnergyEmpty.Reset()
	obj.Energy.Reset()
	obj.Online.Reset()
	obj.HasStatistics.Reset()
	obj.HasHistory.Reset()
	obj.PowerSupply.Reset()
	obj.Type.Reset()
	obj.UpdateTime.Reset()
	obj.Serial.Reset()
	obj.Model.Reset()
	obj.Vendor.Reset()
	obj.NativePath.Reset()
}

func (obj *Device) GetStatistics(type_ string) (data [][]interface{}, _err error) {
	_err = obj.core.Call("org.freedesktop.UPower.Device.GetStatistics", 0, type_).Store(&data)
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func (obj *Device) GetHistory(type_ string, timespan uint32, resolution uint32) (data [][]interface{}, _err error) {
	_err = obj.core.Call("org.freedesktop.UPower.Device.GetHistory", 0, type_, timespan, resolution).Store(&data)
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func (obj *Device) Refresh() (_err error) {
	_err = obj.core.Call("org.freedesktop.UPower.Device.Refresh", 0).Store()
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

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

func (this *dbusPropertyDeviceIconName) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.UPower.Device.IconName is not writable")
}

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

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

func (this *dbusPropertyDeviceWarningLevel) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.UPower.Device.WarningLevel is not writable")
}

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

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

func (this *dbusPropertyDeviceTechnology) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.UPower.Device.Technology is not writable")
}

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

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

func (this *dbusPropertyDeviceCapacity) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.UPower.Device.Capacity is not writable")
}

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

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

func (this *dbusPropertyDeviceIsRechargeable) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.UPower.Device.IsRechargeable is not writable")
}

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

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

func (this *dbusPropertyDeviceState) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.UPower.Device.State is not writable")
}

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

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

func (this *dbusPropertyDeviceIsPresent) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.UPower.Device.IsPresent is not writable")
}

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

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

func (this *dbusPropertyDeviceTemperature) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.UPower.Device.Temperature is not writable")
}

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

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

func (this *dbusPropertyDevicePercentage) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.UPower.Device.Percentage is not writable")
}

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

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

func (this *dbusPropertyDeviceTimeToFull) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.UPower.Device.TimeToFull is not writable")
}

func (this *dbusPropertyDeviceTimeToFull) Get() int64 {
	v, _ := this.GetValue()
	return v.(int64)
}
func (this *dbusPropertyDeviceTimeToFull) GetValue() (interface{} /*int64*/, error) {
	var r dbus.Variant
	err := this.core.Call("org.freedesktop.DBus.Properties.Get", 0, "org.freedesktop.UPower.Device", "TimeToFull").Store(&r)
	if err == nil && r.Signature().String() == "x" {
		return r.Value().(int64), nil
	}
	return *new(int64), err
}
func (this *dbusPropertyDeviceTimeToFull) GetType() reflect.Type {
	return reflect.TypeOf((*int64)(nil)).Elem()
}

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

func (this *dbusPropertyDeviceTimeToEmpty) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.UPower.Device.TimeToEmpty is not writable")
}

func (this *dbusPropertyDeviceTimeToEmpty) Get() int64 {
	v, _ := this.GetValue()
	return v.(int64)
}
func (this *dbusPropertyDeviceTimeToEmpty) GetValue() (interface{} /*int64*/, error) {
	var r dbus.Variant
	err := this.core.Call("org.freedesktop.DBus.Properties.Get", 0, "org.freedesktop.UPower.Device", "TimeToEmpty").Store(&r)
	if err == nil && r.Signature().String() == "x" {
		return r.Value().(int64), nil
	}
	return *new(int64), err
}
func (this *dbusPropertyDeviceTimeToEmpty) GetType() reflect.Type {
	return reflect.TypeOf((*int64)(nil)).Elem()
}

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

func (this *dbusPropertyDeviceLuminosity) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.UPower.Device.Luminosity is not writable")
}

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

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

func (this *dbusPropertyDeviceVoltage) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.UPower.Device.Voltage is not writable")
}

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

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

func (this *dbusPropertyDeviceEnergyRate) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.UPower.Device.EnergyRate is not writable")
}

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

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

func (this *dbusPropertyDeviceEnergyFullDesign) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.UPower.Device.EnergyFullDesign is not writable")
}

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

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

func (this *dbusPropertyDeviceEnergyFull) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.UPower.Device.EnergyFull is not writable")
}

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

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

func (this *dbusPropertyDeviceEnergyEmpty) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.UPower.Device.EnergyEmpty is not writable")
}

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

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

func (this *dbusPropertyDeviceEnergy) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.UPower.Device.Energy is not writable")
}

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

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

func (this *dbusPropertyDeviceOnline) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.UPower.Device.Online is not writable")
}

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

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

func (this *dbusPropertyDeviceHasStatistics) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.UPower.Device.HasStatistics is not writable")
}

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

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

func (this *dbusPropertyDeviceHasHistory) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.UPower.Device.HasHistory is not writable")
}

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

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

func (this *dbusPropertyDevicePowerSupply) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.UPower.Device.PowerSupply is not writable")
}

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

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

func (this *dbusPropertyDeviceType) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.UPower.Device.Type is not writable")
}

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

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

func (this *dbusPropertyDeviceUpdateTime) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.UPower.Device.UpdateTime is not writable")
}

func (this *dbusPropertyDeviceUpdateTime) Get() uint64 {
	v, _ := this.GetValue()
	return v.(uint64)
}
func (this *dbusPropertyDeviceUpdateTime) GetValue() (interface{} /*uint64*/, error) {
	var r dbus.Variant
	err := this.core.Call("org.freedesktop.DBus.Properties.Get", 0, "org.freedesktop.UPower.Device", "UpdateTime").Store(&r)
	if err == nil && r.Signature().String() == "t" {
		return r.Value().(uint64), nil
	}
	return *new(uint64), err
}
func (this *dbusPropertyDeviceUpdateTime) GetType() reflect.Type {
	return reflect.TypeOf((*uint64)(nil)).Elem()
}

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

func (this *dbusPropertyDeviceSerial) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.UPower.Device.Serial is not writable")
}

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

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

func (this *dbusPropertyDeviceModel) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.UPower.Device.Model is not writable")
}

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

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

func (this *dbusPropertyDeviceVendor) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.UPower.Device.Vendor is not writable")
}

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

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

func (this *dbusPropertyDeviceNativePath) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.UPower.Device.NativePath is not writable")
}

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

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

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

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

	obj.IconName = &dbusPropertyDeviceIconName{&property.BaseObserver{}, core}
	obj.WarningLevel = &dbusPropertyDeviceWarningLevel{&property.BaseObserver{}, core}
	obj.Technology = &dbusPropertyDeviceTechnology{&property.BaseObserver{}, core}
	obj.Capacity = &dbusPropertyDeviceCapacity{&property.BaseObserver{}, core}
	obj.IsRechargeable = &dbusPropertyDeviceIsRechargeable{&property.BaseObserver{}, core}
	obj.State = &dbusPropertyDeviceState{&property.BaseObserver{}, core}
	obj.IsPresent = &dbusPropertyDeviceIsPresent{&property.BaseObserver{}, core}
	obj.Temperature = &dbusPropertyDeviceTemperature{&property.BaseObserver{}, core}
	obj.Percentage = &dbusPropertyDevicePercentage{&property.BaseObserver{}, core}
	obj.TimeToFull = &dbusPropertyDeviceTimeToFull{&property.BaseObserver{}, core}
	obj.TimeToEmpty = &dbusPropertyDeviceTimeToEmpty{&property.BaseObserver{}, core}
	obj.Luminosity = &dbusPropertyDeviceLuminosity{&property.BaseObserver{}, core}
	obj.Voltage = &dbusPropertyDeviceVoltage{&property.BaseObserver{}, core}
	obj.EnergyRate = &dbusPropertyDeviceEnergyRate{&property.BaseObserver{}, core}
	obj.EnergyFullDesign = &dbusPropertyDeviceEnergyFullDesign{&property.BaseObserver{}, core}
	obj.EnergyFull = &dbusPropertyDeviceEnergyFull{&property.BaseObserver{}, core}
	obj.EnergyEmpty = &dbusPropertyDeviceEnergyEmpty{&property.BaseObserver{}, core}
	obj.Energy = &dbusPropertyDeviceEnergy{&property.BaseObserver{}, core}
	obj.Online = &dbusPropertyDeviceOnline{&property.BaseObserver{}, core}
	obj.HasStatistics = &dbusPropertyDeviceHasStatistics{&property.BaseObserver{}, core}
	obj.HasHistory = &dbusPropertyDeviceHasHistory{&property.BaseObserver{}, core}
	obj.PowerSupply = &dbusPropertyDevicePowerSupply{&property.BaseObserver{}, core}
	obj.Type = &dbusPropertyDeviceType{&property.BaseObserver{}, core}
	obj.UpdateTime = &dbusPropertyDeviceUpdateTime{&property.BaseObserver{}, core}
	obj.Serial = &dbusPropertyDeviceSerial{&property.BaseObserver{}, core}
	obj.Model = &dbusPropertyDeviceModel{&property.BaseObserver{}, core}
	obj.Vendor = &dbusPropertyDeviceVendor{&property.BaseObserver{}, core}
	obj.NativePath = &dbusPropertyDeviceNativePath{&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='org.freedesktop.UPower.Device',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) == "org.freedesktop.UPower.Device" {
				props := v.Body[1].(map[string]dbus.Variant)
				for key, _ := range props {
					if false {
					} else if key == "IconName" {
						obj.IconName.Notify()

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

					} else if key == "NativePath" {
						obj.NativePath.Notify()
					}
				}
			} else if v.Name == "org.freedesktop.UPower.Device.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 == "IconName" {
						obj.IconName.Notify()

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	runtime.SetFinalizer(obj, func(_obj *Device) { DestroyDevice(_obj) })
	return obj, nil
}
