ota

package
Version: v0.0.0-...-901f175 Latest Latest
Warning

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

Go to latest
Published: May 25, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	SoftwareDirectory string `yaml:"softwareDirectory"`
	Mqtt              struct {
		URL      string `yaml:"url"`
		Username string `yaml:"username"`
		Password string `yaml:"password"`
		Topics   struct {
			Advertise string `yaml:"advertise"`
			Report    string `yaml:"report"`
			Upgrade   string `yaml:"upgrade"`
		}
	} `yaml:"mqtt"`
}

type Index

type Index struct {
	Entries map[string][]*semver.Version
	C       chan bool
	// contains filtered or unexported fields
}

Index contains OTA software by type and by version.

func NewIndex

func NewIndex(directory string) *Index

NewIndex creates a new Index object.

func (*Index) GetLatest

func (i *Index) GetLatest(softwareType string) (version *semver.Version, found bool)

GetLatest gets the version for the specified software type

func (*Index) WatchDirectory

func (i *Index) WatchDirectory()

WatchDirectory watches the directory associated with the Index.

type Upgrade

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

An Upgrade is a representation of a upgrade job to be completed.

func NewUpgrade

func NewUpgrade(upgrader *Upgrader, softwareType string, version *semver.Version) *Upgrade

NewUpgrade creates an upgrade job.

type Upgrader

type Upgrader struct {
	Config Config
	// contains filtered or unexported fields
}

Upgrader manages message

func NewUpgrader

func NewUpgrader(client mqtt.Client, config Config) *Upgrader

NewUpgrader instantiates an Upgrader object.

func (*Upgrader) HandleVersionMessage

func (u *Upgrader) HandleVersionMessage(client mqtt.Client, msg mqtt.Message)

HandleVersionMessage handles an iotp version message over MQTT.

func (*Upgrader) Run

func (u *Upgrader) Run()

Run the Upgrader.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL