Documentation
¶
Overview ¶
Package fleet provides a low-level implementation of the NAOS fleet management protocol.
Index ¶
- func Debug(url string, baseTopics []string, delete bool, duration time.Duration) (map[string][]byte, error)
- func Discover(url string, baseTopics []string, timeout time.Duration) (map[string][]string, error)
- func GetParams(url, param string, baseTopics []string, timeout time.Duration) (map[string]string, error)
- func Monitor(url string, baseTopics []string, quit chan struct{}, timeout time.Duration, ...) error
- func Receive(url string, topics []string, timeout time.Duration) (map[string]string, error)
- func Record(url string, baseTopics []string, quit chan struct{}, timeout time.Duration, ...) error
- func Send(url string, topics []string, message string, timeout time.Duration) error
- func SetParams(url, param, value string, baseTopics []string, timeout time.Duration) (map[string]string, error)
- func UnsetParams(url, param string, baseTopics []string, timeout time.Duration) error
- func Update(url string, baseTopics []string, firmware []byte, jobs int, ...) error
- type Announcement
- type Heartbeat
- type LogMessage
- type UpdateStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Debug ¶
func Debug(url string, baseTopics []string, delete bool, duration time.Duration) (map[string][]byte, error)
Debug will request coredump debug information from the specified devices.
func Discover ¶
Discover will connect to the specified MQTT broker and publish the 'discover' command to receive a list of available parameters.
func GetParams ¶
func GetParams(url, param string, baseTopics []string, timeout time.Duration) (map[string]string, error)
GetParams will connect to the specified MQTT broker and publish the 'get' command to receive the provided parameter for all specified base topics.
func Monitor ¶
func Monitor(url string, baseTopics []string, quit chan struct{}, timeout time.Duration, cb func(*Heartbeat)) error
Monitor will connect to the specified MQTT broker and listen on the passed base topics for heartbeats and call the supplied callback until the specified quit channel is closed.
Note: Not correctly formatted heartbeats are ignored.
func Record ¶
func Record(url string, baseTopics []string, quit chan struct{}, timeout time.Duration, cb func(*LogMessage)) error
Record will enable log recording mode and yield the received log messages until the provided channel has been closed.
func SetParams ¶
func SetParams(url, param, value string, baseTopics []string, timeout time.Duration) (map[string]string, error)
SetParams will connect to the specified MQTT broker and publish the 'set' command to receive the provided updated parameter for all specified base topics.
func UnsetParams ¶
UnsetParams will connect to the specified MQTT broker and publish the 'unset' command to unset the provided parameter for all specified base topics.
func Update ¶
func Update(url string, baseTopics []string, firmware []byte, jobs int, timeout time.Duration, callback func(string, *UpdateStatus)) error
Update will concurrently perform a firmware update and block until all devices have updated or returned errors. If a callback is provided it will be called with the current status of the update.
Types ¶
type Announcement ¶
type Announcement struct {
ReceivedAt time.Time
BaseTopic string
DeviceName string
DeviceType string
FirmwareVersion string
}
An Announcement is returned by Collect.
type Heartbeat ¶
type Heartbeat struct {
ReceivedAt time.Time
BaseTopic string
DeviceName string
DeviceType string
FirmwareVersion string
FreeHeapSize int64
UpTime time.Duration
StartPartition string
BatteryLevel float64 // -1, 0 - 1
SignalStrength int64 // -50 - -100
CPU0Usage float64 // 0 - 1
CPU1Usage float64 // 0 - 1
}
A Heartbeat is emitted by Monitor.
type LogMessage ¶
LogMessage is emitted by Record.
type UpdateStatus ¶
UpdateStatus is emitted by updateOne and Update.