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

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

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

	Sim                   *dbusPropertyModemSim
	Bearers               *dbusPropertyModemBearers
	SupportedCapabilities *dbusPropertyModemSupportedCapabilities
	CurrentCapabilities   *dbusPropertyModemCurrentCapabilities
	MaxBearers            *dbusPropertyModemMaxBearers
	MaxActiveBearers      *dbusPropertyModemMaxActiveBearers
	Manufacturer          *dbusPropertyModemManufacturer
	Model                 *dbusPropertyModemModel
	Revision              *dbusPropertyModemRevision
	DeviceIdentifier      *dbusPropertyModemDeviceIdentifier
	Device                *dbusPropertyModemDevice
	Drivers               *dbusPropertyModemDrivers
	Plugin                *dbusPropertyModemPlugin
	PrimaryPort           *dbusPropertyModemPrimaryPort
	Ports                 *dbusPropertyModemPorts
	EquipmentIdentifier   *dbusPropertyModemEquipmentIdentifier
	UnlockRequired        *dbusPropertyModemUnlockRequired
	UnlockRetries         *dbusPropertyModemUnlockRetries
	State                 *dbusPropertyModemState
	StateFailedReason     *dbusPropertyModemStateFailedReason
	AccessTechnologies    *dbusPropertyModemAccessTechnologies
	SignalQuality         *dbusPropertyModemSignalQuality
	OwnNumbers            *dbusPropertyModemOwnNumbers
	PowerState            *dbusPropertyModemPowerState
	SupportedModes        *dbusPropertyModemSupportedModes
	CurrentModes          *dbusPropertyModemCurrentModes
	SupportedBands        *dbusPropertyModemSupportedBands
	CurrentBands          *dbusPropertyModemCurrentBands
	SupportedIpFamilies   *dbusPropertyModemSupportedIpFamilies
}

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

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

	obj.Sim.Reset()
	obj.Bearers.Reset()
	obj.SupportedCapabilities.Reset()
	obj.CurrentCapabilities.Reset()
	obj.MaxBearers.Reset()
	obj.MaxActiveBearers.Reset()
	obj.Manufacturer.Reset()
	obj.Model.Reset()
	obj.Revision.Reset()
	obj.DeviceIdentifier.Reset()
	obj.Device.Reset()
	obj.Drivers.Reset()
	obj.Plugin.Reset()
	obj.PrimaryPort.Reset()
	obj.Ports.Reset()
	obj.EquipmentIdentifier.Reset()
	obj.UnlockRequired.Reset()
	obj.UnlockRetries.Reset()
	obj.State.Reset()
	obj.StateFailedReason.Reset()
	obj.AccessTechnologies.Reset()
	obj.SignalQuality.Reset()
	obj.OwnNumbers.Reset()
	obj.PowerState.Reset()
	obj.SupportedModes.Reset()
	obj.CurrentModes.Reset()
	obj.SupportedBands.Reset()
	obj.CurrentBands.Reset()
	obj.SupportedIpFamilies.Reset()
}

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

func (obj *Modem) ListBearers() (bearers []dbus.ObjectPath, _err error) {
	_err = obj.core.Call("org.freedesktop.ModemManager1.Modem.ListBearers", 0).Store(&bearers)
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func (obj *Modem) CreateBearer(properties map[string]dbus.Variant) (path dbus.ObjectPath, _err error) {
	_err = obj.core.Call("org.freedesktop.ModemManager1.Modem.CreateBearer", 0, properties).Store(&path)
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func (obj *Modem) DeleteBearer(bearer dbus.ObjectPath) (_err error) {
	_err = obj.core.Call("org.freedesktop.ModemManager1.Modem.DeleteBearer", 0, bearer).Store()
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

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

func (obj *Modem) FactoryReset(code string) (_err error) {
	_err = obj.core.Call("org.freedesktop.ModemManager1.Modem.FactoryReset", 0, code).Store()
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func (obj *Modem) SetPowerState(state uint32) (_err error) {
	_err = obj.core.Call("org.freedesktop.ModemManager1.Modem.SetPowerState", 0, state).Store()
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func (obj *Modem) SetCurrentCapabilities(capabilities uint32) (_err error) {
	_err = obj.core.Call("org.freedesktop.ModemManager1.Modem.SetCurrentCapabilities", 0, capabilities).Store()
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func (obj *Modem) SetCurrentModes(modes interface{}) (_err error) {
	_err = obj.core.Call("org.freedesktop.ModemManager1.Modem.SetCurrentModes", 0, modes).Store()
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func (obj *Modem) SetCurrentBands(bands []uint32) (_err error) {
	_err = obj.core.Call("org.freedesktop.ModemManager1.Modem.SetCurrentBands", 0, bands).Store()
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func (obj *Modem) Command(cmd string, timeout uint32) (response string, _err error) {
	_err = obj.core.Call("org.freedesktop.ModemManager1.Modem.Command", 0, cmd, timeout).Store(&response)
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func (obj *Modem) ConnectStateChanged(callback func(old int32, new_ int32, reason uint32)) func() {
	sigChan := obj._createSignalChan()
	go func() {
		for v := range sigChan {
			if v.Path != obj.Path || v.Name != "org.freedesktop.ModemManager1.Modem.StateChanged" || 3 != len(v.Body) {
				continue
			}
			if reflect.TypeOf(v.Body[0]) != reflect.TypeOf((*int32)(nil)).Elem() {
				continue
			}
			if reflect.TypeOf(v.Body[1]) != reflect.TypeOf((*int32)(nil)).Elem() {
				continue
			}
			if reflect.TypeOf(v.Body[2]) != reflect.TypeOf((*uint32)(nil)).Elem() {
				continue
			}

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

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

func (this *dbusPropertyModemSim) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.ModemManager1.Modem.Sim is not writable")
}

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

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

func (this *dbusPropertyModemBearers) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.ModemManager1.Modem.Bearers is not writable")
}

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

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

func (this *dbusPropertyModemSupportedCapabilities) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.ModemManager1.Modem.SupportedCapabilities is not writable")
}

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

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

func (this *dbusPropertyModemCurrentCapabilities) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.ModemManager1.Modem.CurrentCapabilities is not writable")
}

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

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

func (this *dbusPropertyModemMaxBearers) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.ModemManager1.Modem.MaxBearers is not writable")
}

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

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

func (this *dbusPropertyModemMaxActiveBearers) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.ModemManager1.Modem.MaxActiveBearers is not writable")
}

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

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

func (this *dbusPropertyModemManufacturer) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.ModemManager1.Modem.Manufacturer is not writable")
}

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

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

func (this *dbusPropertyModemModel) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.ModemManager1.Modem.Model is not writable")
}

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

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

func (this *dbusPropertyModemRevision) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.ModemManager1.Modem.Revision is not writable")
}

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

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

func (this *dbusPropertyModemDeviceIdentifier) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.ModemManager1.Modem.DeviceIdentifier is not writable")
}

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

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

func (this *dbusPropertyModemDevice) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.ModemManager1.Modem.Device is not writable")
}

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

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

func (this *dbusPropertyModemDrivers) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.ModemManager1.Modem.Drivers is not writable")
}

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

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

func (this *dbusPropertyModemPlugin) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.ModemManager1.Modem.Plugin is not writable")
}

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

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

func (this *dbusPropertyModemPrimaryPort) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.ModemManager1.Modem.PrimaryPort is not writable")
}

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

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

func (this *dbusPropertyModemPorts) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.ModemManager1.Modem.Ports is not writable")
}

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

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

func (this *dbusPropertyModemEquipmentIdentifier) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.ModemManager1.Modem.EquipmentIdentifier is not writable")
}

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

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

func (this *dbusPropertyModemUnlockRequired) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.ModemManager1.Modem.UnlockRequired is not writable")
}

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

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

func (this *dbusPropertyModemUnlockRetries) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.ModemManager1.Modem.UnlockRetries is not writable")
}

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

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

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

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

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

func (this *dbusPropertyModemStateFailedReason) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.ModemManager1.Modem.StateFailedReason is not writable")
}

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

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

func (this *dbusPropertyModemAccessTechnologies) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.ModemManager1.Modem.AccessTechnologies is not writable")
}

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

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

func (this *dbusPropertyModemSignalQuality) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.ModemManager1.Modem.SignalQuality is not writable")
}

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

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

func (this *dbusPropertyModemOwnNumbers) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.ModemManager1.Modem.OwnNumbers is not writable")
}

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

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

func (this *dbusPropertyModemPowerState) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.ModemManager1.Modem.PowerState is not writable")
}

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

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

func (this *dbusPropertyModemSupportedModes) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.ModemManager1.Modem.SupportedModes is not writable")
}

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

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

func (this *dbusPropertyModemCurrentModes) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.ModemManager1.Modem.CurrentModes is not writable")
}

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

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

func (this *dbusPropertyModemSupportedBands) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.ModemManager1.Modem.SupportedBands is not writable")
}

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

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

func (this *dbusPropertyModemCurrentBands) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.ModemManager1.Modem.CurrentBands is not writable")
}

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

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

func (this *dbusPropertyModemSupportedIpFamilies) SetValue(notwritable interface{}) {
	fmt.Println("org.freedesktop.ModemManager1.Modem.SupportedIpFamilies is not writable")
}

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

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

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

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

	obj.Sim = &dbusPropertyModemSim{&property.BaseObserver{}, core}
	obj.Bearers = &dbusPropertyModemBearers{&property.BaseObserver{}, core}
	obj.SupportedCapabilities = &dbusPropertyModemSupportedCapabilities{&property.BaseObserver{}, core}
	obj.CurrentCapabilities = &dbusPropertyModemCurrentCapabilities{&property.BaseObserver{}, core}
	obj.MaxBearers = &dbusPropertyModemMaxBearers{&property.BaseObserver{}, core}
	obj.MaxActiveBearers = &dbusPropertyModemMaxActiveBearers{&property.BaseObserver{}, core}
	obj.Manufacturer = &dbusPropertyModemManufacturer{&property.BaseObserver{}, core}
	obj.Model = &dbusPropertyModemModel{&property.BaseObserver{}, core}
	obj.Revision = &dbusPropertyModemRevision{&property.BaseObserver{}, core}
	obj.DeviceIdentifier = &dbusPropertyModemDeviceIdentifier{&property.BaseObserver{}, core}
	obj.Device = &dbusPropertyModemDevice{&property.BaseObserver{}, core}
	obj.Drivers = &dbusPropertyModemDrivers{&property.BaseObserver{}, core}
	obj.Plugin = &dbusPropertyModemPlugin{&property.BaseObserver{}, core}
	obj.PrimaryPort = &dbusPropertyModemPrimaryPort{&property.BaseObserver{}, core}
	obj.Ports = &dbusPropertyModemPorts{&property.BaseObserver{}, core}
	obj.EquipmentIdentifier = &dbusPropertyModemEquipmentIdentifier{&property.BaseObserver{}, core}
	obj.UnlockRequired = &dbusPropertyModemUnlockRequired{&property.BaseObserver{}, core}
	obj.UnlockRetries = &dbusPropertyModemUnlockRetries{&property.BaseObserver{}, core}
	obj.State = &dbusPropertyModemState{&property.BaseObserver{}, core}
	obj.StateFailedReason = &dbusPropertyModemStateFailedReason{&property.BaseObserver{}, core}
	obj.AccessTechnologies = &dbusPropertyModemAccessTechnologies{&property.BaseObserver{}, core}
	obj.SignalQuality = &dbusPropertyModemSignalQuality{&property.BaseObserver{}, core}
	obj.OwnNumbers = &dbusPropertyModemOwnNumbers{&property.BaseObserver{}, core}
	obj.PowerState = &dbusPropertyModemPowerState{&property.BaseObserver{}, core}
	obj.SupportedModes = &dbusPropertyModemSupportedModes{&property.BaseObserver{}, core}
	obj.CurrentModes = &dbusPropertyModemCurrentModes{&property.BaseObserver{}, core}
	obj.SupportedBands = &dbusPropertyModemSupportedBands{&property.BaseObserver{}, core}
	obj.CurrentBands = &dbusPropertyModemCurrentBands{&property.BaseObserver{}, core}
	obj.SupportedIpFamilies = &dbusPropertyModemSupportedIpFamilies{&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.ModemManager1.Modem',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.ModemManager1.Modem" {
				props := v.Body[1].(map[string]dbus.Variant)
				for key, _ := range props {
					if false {
					} else if key == "Sim" {
						obj.Sim.Notify()

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

					} else if key == "SupportedIpFamilies" {
						obj.SupportedIpFamilies.Notify()
					}
				}
			} else if v.Name == "org.freedesktop.ModemManager1.Modem.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 == "Sim" {
						obj.Sim.Notify()

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	runtime.SetFinalizer(obj, func(_obj *Modem) { DestroyModem(_obj) })
	return obj, nil
}
