drivers

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2024 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoDrivers = errors.New("no drivers were registered")
View Source
var ErrUnknown = errors.New("unknown error")
View Source
var ErrUnknownModel = errors.New("attempting to get unknown model")

Basic Errors

Functions

func GetAvailableDrivers

func GetAvailableDrivers() []string

func GetInterfaceIPv4Addr added in v0.1.2

func GetInterfaceIPv4Addr(iface string) (addr net.IP, err error)

Returns this computer's address on the interface

func GetTransportForIPv4 added in v0.1.2

func GetTransportForIPv4(ifaceIP net.IP) (*http.Transport, error)

func IsRegistered added in v0.1.2

func IsRegistered(name string) bool

func RegisterDriver added in v0.1.2

func RegisterDriver(name string, generator func(config *viper.Viper, logger *slog.Logger) (BaseModem, error))

Types

type ActionError

type ActionError struct {
	Action string
	Err    error
}

Complex Errors

func (ActionError) Error

func (e ActionError) Error() string

func (ActionError) Unwrap

func (e ActionError) Unwrap() error

type BaseModem

type BaseModem interface {
	GetModel() string
}

func GetModemDriver

func GetModemDriver(name string, config *viper.Viper, logger *slog.Logger) (BaseModem, error)

type LinkStatus

type LinkStatus struct {
	State int8 // 0 - down 1 - disconnecting 2 - connecting 3 - up
}

Link statuses

type ModemCell

type ModemCell interface {
	BaseModem

	GetCellConnStatus() (*LinkStatus, error)
	ConnectCell() error
	DisconnectCell() error
}

type ModemSMS

type ModemSMS interface {
	BaseModem

	SendSMS(phone string, message string) error
	ReadAllSMS() ([]SMS, error)
}

type SMS

type SMS struct {
	Time    time.Time
	Sender  string
	Message string
}

type UnmarshalError

type UnmarshalError struct {
	RawData *[]byte
	Err     error
}

-- //

func (UnmarshalError) Error

func (e UnmarshalError) Error() string

func (UnmarshalError) Unwrap

func (e UnmarshalError) Unwrap() error

Jump to

Keyboard shortcuts

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