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

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

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

	GetDevices_             *dbusPropertyManagerGetDevices_
	GetAllDevices_          *dbusPropertyManagerGetAllDevices_
	NetworkingEnabled       *dbusPropertyManagerNetworkingEnabled
	WirelessEnabled         *dbusPropertyManagerWirelessEnabled
	WirelessHardwareEnabled *dbusPropertyManagerWirelessHardwareEnabled
	WwanEnabled             *dbusPropertyManagerWwanEnabled
	WwanHardwareEnabled     *dbusPropertyManagerWwanHardwareEnabled
	WimaxEnabled            *dbusPropertyManagerWimaxEnabled
	WimaxHardwareEnabled    *dbusPropertyManagerWimaxHardwareEnabled
	ActiveConnections       *dbusPropertyManagerActiveConnections
	PrimaryConnection       *dbusPropertyManagerPrimaryConnection
	PrimaryConnectionType   *dbusPropertyManagerPrimaryConnectionType
	Metered                 *dbusPropertyManagerMetered
	ActivatingConnection    *dbusPropertyManagerActivatingConnection
	Startup                 *dbusPropertyManagerStartup
	Version                 *dbusPropertyManagerVersion
	State                   *dbusPropertyManagerState
	Connectivity            *dbusPropertyManagerConnectivity
	GlobalDnsConfiguration  *dbusPropertyManagerGlobalDnsConfiguration
}

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

	dbusRemoveMatch("type='signal',path='" + string(obj.Path) + "',interface='org.freedesktop.NetworkManager',sender='" + obj.DestName + "',member='CheckPermissions'")

	dbusRemoveMatch("type='signal',path='" + string(obj.Path) + "',interface='org.freedesktop.NetworkManager',sender='" + obj.DestName + "',member='StateChanged'")

	dbusRemoveMatch("type='signal',path='" + string(obj.Path) + "',interface='org.freedesktop.NetworkManager',sender='" + obj.DestName + "',member='PropertiesChanged'")

	dbusRemoveMatch("type='signal',path='" + string(obj.Path) + "',interface='org.freedesktop.NetworkManager',sender='" + obj.DestName + "',member='DeviceAdded'")

	dbusRemoveMatch("type='signal',path='" + string(obj.Path) + "',interface='org.freedesktop.NetworkManager',sender='" + obj.DestName + "',member='DeviceRemoved'")

	obj.GetDevices_.Reset()
	obj.GetAllDevices_.Reset()
	obj.NetworkingEnabled.Reset()
	obj.WirelessEnabled.Reset()
	obj.WirelessHardwareEnabled.Reset()
	obj.WwanEnabled.Reset()
	obj.WwanHardwareEnabled.Reset()
	obj.WimaxEnabled.Reset()
	obj.WimaxHardwareEnabled.Reset()
	obj.ActiveConnections.Reset()
	obj.PrimaryConnection.Reset()
	obj.PrimaryConnectionType.Reset()
	obj.Metered.Reset()
	obj.ActivatingConnection.Reset()
	obj.Startup.Reset()
	obj.Version.Reset()
	obj.State.Reset()
	obj.Connectivity.Reset()
	obj.GlobalDnsConfiguration.Reset()
}

func (obj *Manager) Reload(flags uint32) (_err error) {
	_err = obj.core.Call("org.freedesktop.NetworkManager.Reload", 0, flags).Store()
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func (obj *Manager) GetDevices() (devices []dbus.ObjectPath, _err error) {
	_err = obj.core.Call("org.freedesktop.NetworkManager.GetDevices", 0).Store(&devices)
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func (obj *Manager) GetAllDevices() (devices []dbus.ObjectPath, _err error) {
	_err = obj.core.Call("org.freedesktop.NetworkManager.GetAllDevices", 0).Store(&devices)
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func (obj *Manager) GetDeviceByIpIface(iface string) (device dbus.ObjectPath, _err error) {
	_err = obj.core.Call("org.freedesktop.NetworkManager.GetDeviceByIpIface", 0, iface).Store(&device)
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func (obj *Manager) ActivateConnection(connection dbus.ObjectPath, device dbus.ObjectPath, specific_object dbus.ObjectPath) (active_connection dbus.ObjectPath, _err error) {
	_err = obj.core.Call("org.freedesktop.NetworkManager.ActivateConnection", 0, connection, device, specific_object).Store(&active_connection)
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func (obj *Manager) AddAndActivateConnection(connection map[string]map[string]dbus.Variant, device dbus.ObjectPath, specific_object dbus.ObjectPath) (path dbus.ObjectPath, active_connection dbus.ObjectPath, _err error) {
	_err = obj.core.Call("org.freedesktop.NetworkManager.AddAndActivateConnection", 0, connection, device, specific_object).Store(&path, &active_connection)
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func (obj *Manager) DeactivateConnection(active_connection dbus.ObjectPath) (_err error) {
	_err = obj.core.Call("org.freedesktop.NetworkManager.DeactivateConnection", 0, active_connection).Store()
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func (obj *Manager) Sleep(sleep bool) (_err error) {
	_err = obj.core.Call("org.freedesktop.NetworkManager.Sleep", 0, sleep).Store()
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func (obj *Manager) Enable(enable bool) (_err error) {
	_err = obj.core.Call("org.freedesktop.NetworkManager.Enable", 0, enable).Store()
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func (obj *Manager) GetPermissions() (permissions map[string]string, _err error) {
	_err = obj.core.Call("org.freedesktop.NetworkManager.GetPermissions", 0).Store(&permissions)
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func (obj *Manager) SetLogging(level string, domains string) (_err error) {
	_err = obj.core.Call("org.freedesktop.NetworkManager.SetLogging", 0, level, domains).Store()
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func (obj *Manager) GetLogging() (level string, domains string, _err error) {
	_err = obj.core.Call("org.freedesktop.NetworkManager.GetLogging", 0).Store(&level, &domains)
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func (obj *Manager) CheckConnectivity() (connectivity uint32, _err error) {
	_err = obj.core.Call("org.freedesktop.NetworkManager.CheckConnectivity", 0).Store(&connectivity)
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func (obj *Manager) ConnectCheckPermissions(callback func()) func() {
	sigChan := obj._createSignalChan()
	go func() {
		for v := range sigChan {
			if v.Path != obj.Path || v.Name != "org.freedesktop.NetworkManager.CheckPermissions" || 0 != len(v.Body) {
				continue
			}

			callback()
		}
	}()
	return func() {
		obj._deleteSignalChan(sigChan)
	}
}

func (obj *Manager) ConnectStateChanged(callback func(state uint32)) func() {
	sigChan := obj._createSignalChan()
	go func() {
		for v := range sigChan {
			if v.Path != obj.Path || v.Name != "org.freedesktop.NetworkManager.StateChanged" || 1 != len(v.Body) {
				continue
			}
			if reflect.TypeOf(v.Body[0]) != reflect.TypeOf((*uint32)(nil)).Elem() {
				continue
			}

			callback(v.Body[0].(uint32))
		}
	}()
	return func() {
		obj._deleteSignalChan(sigChan)
	}
}

func (obj *Manager) ConnectPropertiesChanged(callback func(properties map[string]dbus.Variant)) func() {
	sigChan := obj._createSignalChan()
	go func() {
		for v := range sigChan {
			if v.Path != obj.Path || v.Name != "org.freedesktop.NetworkManager.PropertiesChanged" || 1 != len(v.Body) {
				continue
			}
			if reflect.TypeOf(v.Body[0]) != reflect.TypeOf((*map[string]dbus.Variant)(nil)).Elem() {
				continue
			}

			callback(v.Body[0].(map[string]dbus.Variant))
		}
	}()
	return func() {
		obj._deleteSignalChan(sigChan)
	}
}

func (obj *Manager) ConnectDeviceAdded(callback func(device_path dbus.ObjectPath)) func() {
	sigChan := obj._createSignalChan()
	go func() {
		for v := range sigChan {
			if v.Path != obj.Path || v.Name != "org.freedesktop.NetworkManager.DeviceAdded" || 1 != len(v.Body) {
				continue
			}
			if reflect.TypeOf(v.Body[0]) != reflect.TypeOf((*dbus.ObjectPath)(nil)).Elem() {
				continue
			}

			callback(v.Body[0].(dbus.ObjectPath))
		}
	}()
	return func() {
		obj._deleteSignalChan(sigChan)
	}
}

func (obj *Manager) ConnectDeviceRemoved(callback func(device_path dbus.ObjectPath)) func() {
	sigChan := obj._createSignalChan()
	go func() {
		for v := range sigChan {
			if v.Path != obj.Path || v.Name != "org.freedesktop.NetworkManager.DeviceRemoved" || 1 != len(v.Body) {
				continue
			}
			if reflect.TypeOf(v.Body[0]) != reflect.TypeOf((*dbus.ObjectPath)(nil)).Elem() {
				continue
			}

			callback(v.Body[0].(dbus.ObjectPath))
		}
	}()
	return func() {
		obj._deleteSignalChan(sigChan)
	}
}

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

func (this *dbusPropertyManagerGetDevices_) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.NetworkManager.GetDevices_ is not writable")
}

func (this *dbusPropertyManagerGetDevices_) Get() []dbus.ObjectPath {
	v, _ := this.GetValue()
	return v.([]dbus.ObjectPath)
}
func (this *dbusPropertyManagerGetDevices_) GetValue() (interface{} /*[]dbus.ObjectPath*/, error) {
	var r dbus.Variant
	err := this.core.Call("org.freedesktop.DBus.Properties.Get", 0, "org.freedesktop.NetworkManager", "GetDevices_").Store(&r)
	if err == nil && r.Signature().String() == "ao" {
		return r.Value().([]dbus.ObjectPath), nil
	}
	return *new([]dbus.ObjectPath), err
}
func (this *dbusPropertyManagerGetDevices_) GetType() reflect.Type {
	return reflect.TypeOf((*[]dbus.ObjectPath)(nil)).Elem()
}

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

func (this *dbusPropertyManagerGetAllDevices_) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.NetworkManager.GetAllDevices_ is not writable")
}

func (this *dbusPropertyManagerGetAllDevices_) Get() []dbus.ObjectPath {
	v, _ := this.GetValue()
	return v.([]dbus.ObjectPath)
}
func (this *dbusPropertyManagerGetAllDevices_) GetValue() (interface{} /*[]dbus.ObjectPath*/, error) {
	var r dbus.Variant
	err := this.core.Call("org.freedesktop.DBus.Properties.Get", 0, "org.freedesktop.NetworkManager", "GetAllDevices_").Store(&r)
	if err == nil && r.Signature().String() == "ao" {
		return r.Value().([]dbus.ObjectPath), nil
	}
	return *new([]dbus.ObjectPath), err
}
func (this *dbusPropertyManagerGetAllDevices_) GetType() reflect.Type {
	return reflect.TypeOf((*[]dbus.ObjectPath)(nil)).Elem()
}

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

func (this *dbusPropertyManagerNetworkingEnabled) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.NetworkManager.NetworkingEnabled is not writable")
}

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

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

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

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

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

func (this *dbusPropertyManagerWirelessHardwareEnabled) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.NetworkManager.WirelessHardwareEnabled is not writable")
}

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

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

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

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

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

func (this *dbusPropertyManagerWwanHardwareEnabled) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.NetworkManager.WwanHardwareEnabled is not writable")
}

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

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

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

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

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

func (this *dbusPropertyManagerWimaxHardwareEnabled) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.NetworkManager.WimaxHardwareEnabled is not writable")
}

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

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

func (this *dbusPropertyManagerActiveConnections) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.NetworkManager.ActiveConnections is not writable")
}

func (this *dbusPropertyManagerActiveConnections) Get() []dbus.ObjectPath {
	v, _ := this.GetValue()
	return v.([]dbus.ObjectPath)
}
func (this *dbusPropertyManagerActiveConnections) GetValue() (interface{} /*[]dbus.ObjectPath*/, error) {
	var r dbus.Variant
	err := this.core.Call("org.freedesktop.DBus.Properties.Get", 0, "org.freedesktop.NetworkManager", "ActiveConnections").Store(&r)
	if err == nil && r.Signature().String() == "ao" {
		return r.Value().([]dbus.ObjectPath), nil
	}
	return *new([]dbus.ObjectPath), err
}
func (this *dbusPropertyManagerActiveConnections) GetType() reflect.Type {
	return reflect.TypeOf((*[]dbus.ObjectPath)(nil)).Elem()
}

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

func (this *dbusPropertyManagerPrimaryConnection) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.NetworkManager.PrimaryConnection is not writable")
}

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

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

func (this *dbusPropertyManagerPrimaryConnectionType) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.NetworkManager.PrimaryConnectionType is not writable")
}

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

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

func (this *dbusPropertyManagerMetered) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.NetworkManager.Metered is not writable")
}

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

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

func (this *dbusPropertyManagerActivatingConnection) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.NetworkManager.ActivatingConnection is not writable")
}

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

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

func (this *dbusPropertyManagerStartup) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.NetworkManager.Startup is not writable")
}

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

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

func (this *dbusPropertyManagerVersion) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.NetworkManager.Version is not writable")
}

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

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

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

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

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

func (this *dbusPropertyManagerConnectivity) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.NetworkManager.Connectivity is not writable")
}

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

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

func (this *dbusPropertyManagerGlobalDnsConfiguration) SetValue(v interface{} /*map[string]dbus.Variant*/) {
	if reflect.TypeOf(v) == reflect.TypeOf((*map[string]dbus.Variant)(nil)).Elem() {
		this.core.Call("org.freedesktop.DBus.Properties.Set", 0, "org.freedesktop.NetworkManager", "GlobalDnsConfiguration", dbus.MakeVariant(v))
	} else {
		fmt.Println("The property GlobalDnsConfiguration of org.freedesktop.NetworkManager is an map[string]dbus.Variant but Set with an ", reflect.TypeOf(v))
	}
}
func (this *dbusPropertyManagerGlobalDnsConfiguration) Set(v map[string]dbus.Variant) {
	this.SetValue(v)
}

func (this *dbusPropertyManagerGlobalDnsConfiguration) Get() map[string]dbus.Variant {
	v, _ := this.GetValue()
	return v.(map[string]dbus.Variant)
}
func (this *dbusPropertyManagerGlobalDnsConfiguration) GetValue() (interface{} /*map[string]dbus.Variant*/, error) {
	var r dbus.Variant
	err := this.core.Call("org.freedesktop.DBus.Properties.Get", 0, "org.freedesktop.NetworkManager", "GlobalDnsConfiguration").Store(&r)
	if err == nil && r.Signature().String() == "a{sv}" {
		return r.Value().(map[string]dbus.Variant), nil
	}
	return *new(map[string]dbus.Variant), err
}
func (this *dbusPropertyManagerGlobalDnsConfiguration) GetType() reflect.Type {
	return reflect.TypeOf((*map[string]dbus.Variant)(nil)).Elem()
}

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

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

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

	obj.GetDevices_ = &dbusPropertyManagerGetDevices_{&property.BaseObserver{}, core}
	obj.GetAllDevices_ = &dbusPropertyManagerGetAllDevices_{&property.BaseObserver{}, core}
	obj.NetworkingEnabled = &dbusPropertyManagerNetworkingEnabled{&property.BaseObserver{}, core}
	obj.WirelessEnabled = &dbusPropertyManagerWirelessEnabled{&property.BaseObserver{}, core}
	obj.WirelessHardwareEnabled = &dbusPropertyManagerWirelessHardwareEnabled{&property.BaseObserver{}, core}
	obj.WwanEnabled = &dbusPropertyManagerWwanEnabled{&property.BaseObserver{}, core}
	obj.WwanHardwareEnabled = &dbusPropertyManagerWwanHardwareEnabled{&property.BaseObserver{}, core}
	obj.WimaxEnabled = &dbusPropertyManagerWimaxEnabled{&property.BaseObserver{}, core}
	obj.WimaxHardwareEnabled = &dbusPropertyManagerWimaxHardwareEnabled{&property.BaseObserver{}, core}
	obj.ActiveConnections = &dbusPropertyManagerActiveConnections{&property.BaseObserver{}, core}
	obj.PrimaryConnection = &dbusPropertyManagerPrimaryConnection{&property.BaseObserver{}, core}
	obj.PrimaryConnectionType = &dbusPropertyManagerPrimaryConnectionType{&property.BaseObserver{}, core}
	obj.Metered = &dbusPropertyManagerMetered{&property.BaseObserver{}, core}
	obj.ActivatingConnection = &dbusPropertyManagerActivatingConnection{&property.BaseObserver{}, core}
	obj.Startup = &dbusPropertyManagerStartup{&property.BaseObserver{}, core}
	obj.Version = &dbusPropertyManagerVersion{&property.BaseObserver{}, core}
	obj.State = &dbusPropertyManagerState{&property.BaseObserver{}, core}
	obj.Connectivity = &dbusPropertyManagerConnectivity{&property.BaseObserver{}, core}
	obj.GlobalDnsConfiguration = &dbusPropertyManagerGlobalDnsConfiguration{&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.NetworkManager',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.NetworkManager" {
				props := v.Body[1].(map[string]dbus.Variant)
				for key, _ := range props {
					if false {
					} else if key == "GetDevices_" {
						obj.GetDevices_.Notify()

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

					} else if key == "GlobalDnsConfiguration" {
						obj.GlobalDnsConfiguration.Notify()
					}
				}
			} else if v.Name == "org.freedesktop.NetworkManager.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 == "GetDevices_" {
						obj.GetDevices_.Notify()

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	dbusAddMatch("type='signal',path='" + string(obj.Path) + "',interface='org.freedesktop.NetworkManager',sender='" + obj.DestName + "',member='CheckPermissions'")

	dbusAddMatch("type='signal',path='" + string(obj.Path) + "',interface='org.freedesktop.NetworkManager',sender='" + obj.DestName + "',member='StateChanged'")

	dbusAddMatch("type='signal',path='" + string(obj.Path) + "',interface='org.freedesktop.NetworkManager',sender='" + obj.DestName + "',member='PropertiesChanged'")

	dbusAddMatch("type='signal',path='" + string(obj.Path) + "',interface='org.freedesktop.NetworkManager',sender='" + obj.DestName + "',member='DeviceAdded'")

	dbusAddMatch("type='signal',path='" + string(obj.Path) + "',interface='org.freedesktop.NetworkManager',sender='" + obj.DestName + "',member='DeviceRemoved'")

	runtime.SetFinalizer(obj, func(_obj *Manager) { DestroyManager(_obj) })
	return obj, nil
}
