modemmanager

package
v0.0.0-...-683b059 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2022 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package modemmanager provides D-Bus wrappers and utilities for modemmanager.

Index

Constants

View Source
const (
	DBusModemmanagerPath                 = "/org/freedesktop/ModemManager1"
	DBusModemmanagerService              = "org.freedesktop.ModemManager1"
	DBusModemmanagerInterface            = "org.freedesktop.ModemManager1"
	DBusModemmanagerBearerInterface      = "org.freedesktop.ModemManager1.Bearer"
	DBusModemmanagerModemInterface       = "org.freedesktop.ModemManager1.Modem"
	DBusModemmanager3gppModemInterface   = "org.freedesktop.ModemManager1.Modem.Modem3gpp"
	DBusModemmanagerSimpleModemInterface = "org.freedesktop.ModemManager1.Modem.Simple"
	DBusModemmanagerSARInterface         = "org.freedesktop.ModemManager1.Modem.Sar"
	DBusModemmanagerSimInterface         = "org.freedesktop.ModemManager1.Sim"
)

ModemManager1 DBus constants

Variables

This section is empty.

Functions

func Connect

func Connect(ctx context.Context, modem *Modem, props map[string]interface{}, timeout time.Duration) error

Connect polls on simple modem D-Bus connect call with given apn.

func EnsureConnectState

func EnsureConnectState(ctx context.Context, modem, simpleModem *Modem, expectedConnected bool) error

EnsureConnectState polls for modem state to be connected or disconnected.

func EnsureDisabled

func EnsureDisabled(ctx context.Context, modem *Modem) error

EnsureDisabled polls for modem state property to be disabled.

func EnsureEnabled

func EnsureEnabled(ctx context.Context, modem *Modem) error

EnsureEnabled polls for modem state property to be enabled.

func EnsureRegistered

func EnsureRegistered(ctx context.Context, modem, simpleModem *Modem) error

EnsureRegistered polls for simple modem property m3gpp-registration-state.

func GetPuk

func GetPuk(ctx context.Context, iccid string) (string, error)

GetPuk gets puk code for given sim iccid from known iccid, puk pairs/list.

func InhibitModem

func InhibitModem(ctx context.Context) (func(ctx context.Context) error, error)

InhibitModem inhibits the first available modem on DBus. Use the returned callback to uninhibit.

func SetInitialEpsBearerSettings

func SetInitialEpsBearerSettings(ctx context.Context, modem3gpp *Modem, props map[string]interface{}) error

SetInitialEpsBearerSettings sets the Attach APN.

func SetPrimarySimSlot

func SetPrimarySimSlot(ctx context.Context, primary uint32) error

SetPrimarySimSlot switches primary SIM slot to a given slot

func SwitchSlot

func SwitchSlot(ctx context.Context) (uint32, error)

SwitchSlot switches from current slot to new slot on dual sim duts, returns new primary slot.

Types

type Interface

type Interface struct {
	// contains filtered or unexported fields
}

Interface wraps an interface object and the error result when creating the object .

type Modem

type Modem struct {
	*dbusutil.PropertyHolder
}

Modem wraps a Modemmanager.Modem D-Bus object.

func NewModem

func NewModem(ctx context.Context) (*Modem, error)

NewModem creates a new PropertyHolder instance for the Modem object.

func NewModemWithSim

func NewModemWithSim(ctx context.Context) (*Modem, error)

NewModemWithSim returns a Modem where the primary SIM slot is not empty. Useful on dual SIM DUTs where only one SIM is available, and we want to select the slot with the active SIM.

func PollModem

func PollModem(ctx context.Context, oldModem string) (*Modem, error)

PollModem polls for a new modem to appear on D-Bus. oldModem is the D-Bus path of the modem that should disappear.

func (*Modem) EnableSAR

func (m *Modem) EnableSAR(ctx context.Context, enable bool) error

EnableSAR - enable/disable MM SAR

func (*Modem) GetActiveSimPuk

func (m *Modem) GetActiveSimPuk(ctx context.Context) (string, error)

GetActiveSimPuk gets puk for psim iccid, sets primary slot to psim.

func (*Modem) GetBearerProperties

func (m *Modem) GetBearerProperties(ctx context.Context, bearerPath dbus.ObjectPath) (*dbusutil.Properties, error)

GetBearerProperties creates a PropertyHolder for the Bearer object and returns the associated Properties.

func (*Modem) GetEid

func (m *Modem) GetEid(ctx context.Context) (string, error)

GetEid gets current modem sim eid, return eid if esim is active.

func (*Modem) GetFirstConnectedBearer

func (m *Modem) GetFirstConnectedBearer(ctx context.Context, modem *Modem) (map[string]interface{}, error)

GetFirstConnectedBearer gets the apn information of the first connected bearer.

func (*Modem) GetInitialEpsBearerSettings

func (m *Modem) GetInitialEpsBearerSettings(ctx context.Context, modem *Modem) (map[string]interface{}, error)

GetInitialEpsBearerSettings gets the Attach APN.

func (*Modem) GetModem3gpp

func (m *Modem) GetModem3gpp(ctx context.Context) (*Modem, error)

GetModem3gpp creates a PropertyHolder for the Modem3gpp object.

func (*Modem) GetSARInterface

func (m *Modem) GetSARInterface(ctx context.Context) (*Modem, error)

GetSARInterface creates a PropertyHolder for the SAR object.

func (*Modem) GetSimProperties

func (m *Modem) GetSimProperties(ctx context.Context, simPath dbus.ObjectPath) (*dbusutil.Properties, error)

GetSimProperties creates a PropertyHolder for the Sim object and returns the associated Properties.

func (*Modem) GetSimSlots

func (m *Modem) GetSimSlots(ctx context.Context) (simProps []*dbusutil.Properties, primary uint32, err error)

GetSimSlots uses the Modem.SimSlots property to fetch SimProperties for each slot. Returns the array of SimProperties and the array index of the primary slot on success. If a slot path is empty, the entry for that slot will be nil.

func (*Modem) GetSimpleModem

func (m *Modem) GetSimpleModem(ctx context.Context) (*Modem, error)

GetSimpleModem creates a PropertyHolder for the SimpleModem object.

func (*Modem) IsConnected

func (m *Modem) IsConnected(ctx context.Context) (bool, error)

IsConnected checks modem state and returns a boolean.

func (*Modem) IsDisabled

func (m *Modem) IsDisabled(ctx context.Context) (bool, error)

IsDisabled checks modem state and returns a boolean.

func (*Modem) IsEnabled

func (m *Modem) IsEnabled(ctx context.Context) (bool, error)

IsEnabled checks modem state and returns a boolean.

func (*Modem) IsPowered

func (m *Modem) IsPowered(ctx context.Context) (bool, error)

IsPowered checks modem powerstate and returns a boolean.

func (*Modem) IsRegistered

func (m *Modem) IsRegistered(ctx context.Context) (bool, error)

IsRegistered checks modem registration state and returns a boolean.

func (*Modem) IsSAREnabled

func (m *Modem) IsSAREnabled(ctx context.Context) (bool, error)

IsSAREnabled - checks if SAR is enabled

func (*Modem) WaitForState

func (m *Modem) WaitForState(ctx context.Context, state mmconst.ModemState, timeout time.Duration) error

WaitForState waits for the modem to reach a particular state

type ObjectPath

type ObjectPath struct {
	// contains filtered or unexported fields
}

ObjectPath wraps a dbus.ObjectPath object and the error result when creating the object .

func (ObjectPath) GetObjectProperties

func (i ObjectPath) GetObjectProperties(ctx context.Context, service, iface string) Properties

GetObjectProperties creates a new PropertyHolder and returns its properties. If the ObjectPath already contains an error, returns early.

func (ObjectPath) GetPropertyHolder

func (i ObjectPath) GetPropertyHolder(ctx context.Context, service, iface string) PropertyHolder

GetPropertyHolder creates a new PropertyHolder and returns the result. If the ObjectPath already contains an error, returns early.

type ObjectPaths

type ObjectPaths struct {
	// contains filtered or unexported fields
}

ObjectPaths wraps a []dbus.ObjectPath object and the error result when creating the object .

type Properties

type Properties struct {
	// contains filtered or unexported fields
}

Properties wraps a dbusutil.Properties object and the error result when creating the object .

func (Properties) Get

func (i Properties) Get(prop string) Interface

Get returns property value.

func (Properties) GetObjectPath

func (i Properties) GetObjectPath(prop string) ObjectPath

GetObjectPath returns the DBus ObjectPath of the given property name. If the Properties already contains an error, returns early.

func (Properties) GetObjectPaths

func (i Properties) GetObjectPaths(prop string) ObjectPaths

GetObjectPaths returns the list of DBus ObjectPaths of the given property name. If the Properties already contains an error, returns early.

type PropertyHolder

type PropertyHolder struct {
	// contains filtered or unexported fields
}

PropertyHolder wraps a dbusutil.PropertyHolder object and the error result when creating the object .

func (PropertyHolder) GetProperties

func (i PropertyHolder) GetProperties(ctx context.Context) Properties

GetProperties calls dbus.GetProperties with the PropertyHolder object and returns the result. If the PropertyHolder already contains an error, returns early.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL