Documentation ¶
Overview ¶
Package modemmanager provides D-Bus wrappers and utilities for modemmanager.
Index ¶
- Constants
- func Connect(ctx context.Context, modem *Modem, props map[string]interface{}, ...) error
- func EnsureConnectState(ctx context.Context, modem, simpleModem *Modem, expectedConnected bool) error
- func EnsureDisabled(ctx context.Context, modem *Modem) error
- func EnsureEnabled(ctx context.Context, modem *Modem) error
- func EnsureRegistered(ctx context.Context, modem, simpleModem *Modem) error
- func GetPuk(ctx context.Context, iccid string) (string, error)
- func InhibitModem(ctx context.Context) (func(ctx context.Context) error, error)
- func SetInitialEpsBearerSettings(ctx context.Context, modem3gpp *Modem, props map[string]interface{}) error
- func SetPrimarySimSlot(ctx context.Context, primary uint32) error
- func SwitchSlot(ctx context.Context) (uint32, error)
- type Interface
- type Modem
- func (m *Modem) EnableSAR(ctx context.Context, enable bool) error
- func (m *Modem) GetActiveSimPuk(ctx context.Context) (string, error)
- func (m *Modem) GetBearerProperties(ctx context.Context, bearerPath dbus.ObjectPath) (*dbusutil.Properties, error)
- func (m *Modem) GetEid(ctx context.Context) (string, error)
- func (m *Modem) GetFirstConnectedBearer(ctx context.Context, modem *Modem) (map[string]interface{}, error)
- func (m *Modem) GetInitialEpsBearerSettings(ctx context.Context, modem *Modem) (map[string]interface{}, error)
- func (m *Modem) GetModem3gpp(ctx context.Context) (*Modem, error)
- func (m *Modem) GetSARInterface(ctx context.Context) (*Modem, error)
- func (m *Modem) GetSimProperties(ctx context.Context, simPath dbus.ObjectPath) (*dbusutil.Properties, error)
- func (m *Modem) GetSimSlots(ctx context.Context) (simProps []*dbusutil.Properties, primary uint32, err error)
- func (m *Modem) GetSimpleModem(ctx context.Context) (*Modem, error)
- func (m *Modem) IsConnected(ctx context.Context) (bool, error)
- func (m *Modem) IsDisabled(ctx context.Context) (bool, error)
- func (m *Modem) IsEnabled(ctx context.Context) (bool, error)
- func (m *Modem) IsPowered(ctx context.Context) (bool, error)
- func (m *Modem) IsRegistered(ctx context.Context) (bool, error)
- func (m *Modem) IsSAREnabled(ctx context.Context) (bool, error)
- func (m *Modem) WaitForState(ctx context.Context, state mmconst.ModemState, timeout time.Duration) error
- type ObjectPath
- type ObjectPaths
- type Properties
- type PropertyHolder
Constants ¶
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 ¶
EnsureDisabled polls for modem state property to be disabled.
func EnsureEnabled ¶
EnsureEnabled polls for modem state property to be enabled.
func EnsureRegistered ¶
EnsureRegistered polls for simple modem property m3gpp-registration-state.
func InhibitModem ¶
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 ¶
SetPrimarySimSlot switches primary SIM slot to a given 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 NewModemWithSim ¶
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 ¶
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) GetActiveSimPuk ¶
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) 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 ¶
GetModem3gpp creates a PropertyHolder for the Modem3gpp object.
func (*Modem) GetSARInterface ¶
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 ¶
GetSimpleModem creates a PropertyHolder for the SimpleModem object.
func (*Modem) IsConnected ¶
IsConnected checks modem state and returns a boolean.
func (*Modem) IsDisabled ¶
IsDisabled checks modem state and returns a boolean.
func (*Modem) IsRegistered ¶
IsRegistered checks modem registration state and returns a boolean.
func (*Modem) IsSAREnabled ¶
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) 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.