Documentation
¶
Index ¶
- type Component
- type Device
- type Inventory
- func (i *Inventory) Collect(duration time.Duration) ([]*Device, error)
- func (i *Inventory) Debug(pattern string, delete bool, duration time.Duration) (map[*Device][]byte, error)
- func (i *Inventory) DeviceBaseTopics(pattern string) []string
- func (i *Inventory) DeviceByBaseTopic(baseTopic string) *Device
- func (i *Inventory) FilterDevices(pattern string) []*Device
- func (i *Inventory) GetParams(pattern, param string, timeout time.Duration) ([]*Device, error)
- func (i *Inventory) Monitor(pattern string, quit chan struct{}, timeout time.Duration, ...) error
- func (i *Inventory) Record(pattern string, quit chan struct{}, timeout time.Duration, ...) error
- func (i *Inventory) Save(path string) error
- func (i *Inventory) SetParams(pattern, param, value string, timeout time.Duration) ([]*Device, error)
- func (i *Inventory) UnsetParams(pattern, param string, timeout time.Duration) ([]*Device, error)
- func (i *Inventory) Update(pattern string, firmware []byte, jobs int, timeout time.Duration, ...) error
- type Project
- func (p *Project) Attach(device string, simple bool, out io.Writer, in io.Reader) error
- func (p *Project) Build(clean, appOnly bool, out io.Writer) error
- func (p *Project) Debug(pattern string, delete bool, duration time.Duration, out io.Writer) error
- func (p *Project) Flash(device string, erase bool, appOnly bool, out io.Writer) error
- func (p *Project) Format(out io.Writer) error
- func (p *Project) Install(force bool, out io.Writer) error
- func (p *Project) SaveInventory() error
- func (p *Project) Tree() string
- func (p *Project) Update(pattern string, jobs int, timeout time.Duration, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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 an Inventory.
type Inventory ¶
type Inventory struct {
Version string `json:"version"`
Components map[string]*Component `json:"components"`
Broker string `json:"broker"`
Devices map[string]*Device `json:"devices"`
}
A Inventory represents the contents of the inventory file.
func ReadInventory ¶
ReadInventory will attempt to read the inventory file at the specified path.
func (*Inventory) Collect ¶
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 (*Inventory) Debug ¶
func (i *Inventory) 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 (*Inventory) DeviceBaseTopics ¶
DeviceBaseTopics returns a list of base topics from devices that match the supplied pattern.
func (*Inventory) DeviceByBaseTopic ¶
DeviceByBaseTopic returns the first device that has the matching base topic.
func (*Inventory) FilterDevices ¶
FilterDevices will return a list of devices that have a name matching the supplied glob pattern.
func (*Inventory) GetParams ¶
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 (*Inventory) Monitor ¶
func (i *Inventory) Monitor(pattern string, quit chan struct{}, timeout time.Duration, callback func(*Device, *mqtt.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 (*Inventory) Record ¶
func (i *Inventory) Record(pattern string, quit chan struct{}, timeout time.Duration, callback func(*Device, string)) error
Record will enable log recording mode and yield the received log messages until the provided channel has been closed.
func (*Inventory) SetParams ¶
func (i *Inventory) 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 (*Inventory) UnsetParams ¶
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 (*Inventory) Update ¶
func (i *Inventory) Update(pattern string, firmware []byte, jobs int, timeout time.Duration, callback func(*Device, *mqtt.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 Project ¶
A Project is a project available on disk.
func CreateProject ¶
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 ¶
OpenProject will open the project in the specified path.
func (*Project) Debug ¶
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) Format ¶
Format will format all source files in the project if 'clang-format' is available.
func (*Project) Install ¶
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) SaveInventory ¶
SaveInventory will save the associated inventory to disk.
func (*Project) Tree ¶
Tree returns the internal directory used to store the toolchain, development framework and other necessary files.
func (*Project) Update ¶
func (p *Project) Update(pattern string, jobs int, timeout time.Duration, callback func(*Device, *mqtt.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.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
naos
command
|
|
|
Package mqtt provides a low-level implementation of the NAOS MQTT protocol.
|
Package mqtt provides a low-level implementation of the NAOS MQTT protocol. |
|
Package tree provides utility functions to manage the the NAOS build tree.
|
Package tree provides utility functions to manage the the NAOS build tree. |
|
Package utils provides some small utility functions.
|
Package utils provides some small utility functions. |