naos

package
v0.13.2 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BaseTopics added in v0.8.0

func BaseTopics(devices []*Device) []string

BaseTopics returns a list of base topics from the provided devices.

Types

type Component

type Component struct {
	Path       string `json:"path"`
	Registry   string `json:"registry"`
	Repository string `json:"repository"`
	Version    string `json:"version"`
}

A Component represents an installable component.

type Device

type Device struct {
	BaseTopic       string            `json:"base_topic"`
	Name            string            `json:"name"`
	Type            string            `json:"type"`
	FirmwareVersion string            `json:"firmware_version"`
	Parameters      map[string]string `json:"parameters"`
}

A Device represents a single device in a Fleet.

type Fleet added in v0.12.1

type Fleet struct {
	Broker  string             `json:"broker,omitempty"`
	Devices map[string]*Device `json:"devices,omitempty"`
}

A Fleet represents the contents of the fleet file.

func NewFleet added in v0.12.1

func NewFleet() *Fleet

NewFleet creates a new Fleet.

func ReadFleet added in v0.12.1

func ReadFleet(path string) (*Fleet, error)

ReadFleet will attempt to read the fleet file at the specified path.

func (*Fleet) Collect added in v0.12.1

func (f *Fleet) Collect(duration time.Duration) ([]*Device, error)

Collect will collect announcements and update the inventory with found devices for the given amount of time. It will return a list of devices that have been added to the inventory.

func (*Fleet) Debug added in v0.12.1

func (f *Fleet) Debug(pattern string, delete bool, duration time.Duration) (map[*Device][]byte, error)

Debug will load the coredump data from the devices that match the supplied glob pattern.

func (*Fleet) DeviceByBaseTopic added in v0.12.1

func (f *Fleet) DeviceByBaseTopic(baseTopic string) *Device

DeviceByBaseTopic returns the first device that has the matching base topic.

func (*Fleet) Discover added in v0.12.1

func (f *Fleet) Discover(pattern string, timeout time.Duration) ([]*Device, error)

Discover will request the list of parameters from all devices matching the supplied glob pattern. The inventory is updated with the reported parameters and a list of answering devices is returned.

func (*Fleet) FilterDevices added in v0.12.1

func (f *Fleet) FilterDevices(pattern string) []*Device

FilterDevices will return a list of devices that have a name matching the supplied glob pattern.

func (*Fleet) GetParams added in v0.12.1

func (f *Fleet) GetParams(pattern, param string, timeout time.Duration) ([]*Device, error)

GetParams will request specified parameter from all devices matching the supplied glob pattern. The inventory is updated with the reported value and a list of answering devices is returned.

func (*Fleet) Monitor added in v0.12.1

func (f *Fleet) Monitor(pattern string, quit chan struct{}, timeout time.Duration, callback func(*Device, *fleet.Heartbeat)) error

Monitor will monitor the devices that match the supplied glob pattern and update the inventory accordingly. The specified callback is called for every heartbeat with the update device and the heartbeat available at device.LastHeartbeat.

func (*Fleet) Ping added in v0.12.1

func (f *Fleet) Ping(pattern string, timeout time.Duration) error

Ping will send a ping message to all devices matching the supplied glob pattern.

func (*Fleet) Receive added in v0.12.1

func (f *Fleet) Receive(pattern, topic string, timeout time.Duration) (map[string]string, error)

Receive will receive messages from all devices matching the supplied glob pattern.

func (*Fleet) Record added in v0.12.1

func (f *Fleet) Record(pattern string, quit chan struct{}, timeout time.Duration, callback func(time.Time, *Device, string)) error

Record will enable log recording mode and yield the received log messages until the provided channel has been closed.

func (*Fleet) Save added in v0.12.1

func (f *Fleet) Save(path string) error

Save will write the inventory file to the specified path.

func (*Fleet) Send added in v0.12.1

func (f *Fleet) Send(pattern, topic, message string, timeout time.Duration) error

Send will send a message to all devices matching the supplied glob pattern.

func (*Fleet) SetParams added in v0.12.1

func (f *Fleet) SetParams(pattern, param, value string, timeout time.Duration) ([]*Device, error)

SetParams will set the specified parameter on all devices matching the supplied glob pattern. The inventory is updated with the saved value and a list of updated devices is returned.

func (*Fleet) UnsetParams added in v0.12.1

func (f *Fleet) UnsetParams(pattern, param string, timeout time.Duration) ([]*Device, error)

UnsetParams will unset the specified parameter on all devices matching the supplied glob pattern. The inventory is updated with the removed value and a list of updated devices is returned.

func (*Fleet) Update added in v0.12.1

func (f *Fleet) Update(version, pattern string, firmware []byte, jobs int, timeout time.Duration, callback func(*Device, *fleet.UpdateStatus)) error

Update will update the devices that match the supplied glob pattern with the specified image. The specified callback is called for every change in state or progress.

type Frameworks added in v0.10.0

type Frameworks struct {
	Audio string `json:"audio,omitempty"`
}

Frameworks represents the official frameworks.

type Inventory

type Inventory struct {
	Name       string                `json:"name"`
	Version    string                `json:"version"`
	Target     string                `json:"target"`
	BaudRate   string                `json:"baud_rate,omitempty"`
	TagPrefix  string                `json:"tag_prefix,omitempty"`
	Embeds     []string              `json:"embeds"`
	Overrides  map[string]string     `json:"overrides"`
	Partitions *tree.Partitions      `json:"partitions"`
	Components map[string]*Component `json:"components"`
	Frameworks Frameworks            `json:"frameworks,omitempty"`
}

An Inventory represents the contents of the inventory file.

func NewInventory

func NewInventory() *Inventory

NewInventory creates a new Inventory.

func ReadInventory

func ReadInventory(path string) (*Inventory, error)

ReadInventory will attempt to read the inventory file at the specified path.

func (*Inventory) Save

func (i *Inventory) Save(path string) error

Save will write the inventory file to the specified path.

type Project

type Project struct {
	Location  string
	Inventory *Inventory
	Fleet     *Fleet
}

A Project is a project available on disk.

func CreateProject

func CreateProject(path string, force, cmake bool, out io.Writer) (*Project, error)

CreateProject will initialize a project in the specified directory. If out is not nil, it will be used to log information about the process.

func OpenProject

func OpenProject(path string) (*Project, error)

OpenProject will open the project in the specified path.

func (*Project) Attach

func (p *Project) Attach(device string, out io.Writer, in io.Reader) error

Attach will attach to the attached device.

func (*Project) Build

func (p *Project) Build(clean, reconfigure, appOnly bool, out io.Writer) error

Build will build the project.

func (*Project) BuildTrace added in v0.10.0

func (p *Project) BuildTrace(cpuCore, baudRate string, clean, reconfigure, appOnly bool, out io.Writer) error

BuildTrace will build the project with tracing enabled.

func (*Project) Bundle added in v0.13.2

func (p *Project) Bundle(file string, out io.Writer) error

Bundle will create a bundle of the project.

func (*Project) Config added in v0.8.0

func (p *Project) Config(file, device, baudRate string, useBLE bool, out io.Writer) error

Config will write settings and parameters to an attached device.

func (*Project) Debug

func (p *Project) Debug(pattern string, delete bool, duration time.Duration, out io.Writer) error

Debug will request coredumps from the devices that match the supplied glob pattern. The coredumps are saved to the 'debug' directory in the project.

func (*Project) Exec added in v0.10.0

func (p *Project) Exec(cmd string, out io.Writer, in io.Reader) error

Exec will execute a command withing the tree.

func (*Project) Flash

func (p *Project) Flash(device, baudRate string, erase bool, appOnly, alt bool, out io.Writer) error

Flash will flash the project to the attached device.

func (*Project) Format

func (p *Project) Format(out io.Writer) error

Format will format all source files in the project if 'clang-format' is available.

func (*Project) Install

func (p *Project) Install(force bool, out io.Writer) error

Install will download necessary dependencies. Any existing dependencies will be removed if force is set to true. If out is not nil, it will be used to log information about the process.

func (*Project) SaveFleet added in v0.12.1

func (p *Project) SaveFleet() error

SaveFleet will save the associated fleet to disk.

func (*Project) SaveInventory

func (p *Project) SaveInventory() error

SaveInventory will save the associated inventory to disk.

func (*Project) Tree

func (p *Project) Tree() string

Tree returns the internal directory used to store the toolchain, development framework and other necessary files.

func (*Project) Update

func (p *Project) Update(version, pattern string, jobs int, timeout time.Duration, callback func(*Device, *fleet.UpdateStatus)) error

Update will update the devices that match the supplied glob pattern with the previously built image. The specified callback is called for every change in state or progress.

Jump to

Keyboard shortcuts

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