modem

package
v0.0.0-...-2269899 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Unknown = iota
	Initializing
	Locked
	Disabled
	Disabling
	Enabling
	Enabled
	Searching
	Registered
	Disconnecting
	Connecting
	Connected

	Failed = -1
)

Possible values of State.

Variables

This section is empty.

Functions

func GetModems

func GetModems() ([]string, error)

GetModems lists all modems currently available from the ModemManager DBus service.

Types

type ConnectOption

type ConnectOption interface {
	// contains filtered or unexported methods
}

ConnectOption is used to specify options during connection.

func WithAllowRoaming

func WithAllowRoaming(allow bool) ConnectOption

WithAllowRoaming inidicates whether roaming should be allowed on the modem.

func WithUserAndPassword

func WithUserAndPassword(user, password string) ConnectOption

WithUserAndPassword sets the user and password required by the network, if necessary.

type Manager

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

Manager is a wrapper around the ModemManager DBus interface.

func NewManager

func NewManager(modem string) (*Manager, error)

NewManager returns a new Manager.

func (*Manager) Close

func (m *Manager) Close() error

Close closes the Manager.

func (*Manager) Connect

func (m *Manager) Connect(apn string, opts ...ConnectOption) error

Connect connects the modem managed by Manager using the required APN, and additional ConnectOptions if supplied.

func (*Manager) CurrentAPN

func (m *Manager) CurrentAPN() string

CurrentAPN returns the APN that the modem is configured with.

func (*Manager) Disable

func (m *Manager) Disable() error

Disable disables the modem.

func (*Manager) Disconnect

func (m *Manager) Disconnect() error

Disconnect disconnects the modem.

func (*Manager) Enable

func (m *Manager) Enable() error

Enable enables the modem. The modem must be enabled before it can be connected.

func (*Manager) State

func (m *Manager) State() (State, error)

State returns the current state of the modem.

type State

type State int32

State represents the modem connection state.

func (State) String

func (s State) String() string

String returns the string representation of State.

Jump to

Keyboard shortcuts

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