config

package
v0.0.0-...-17bb7b9 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Board

type Board struct {
	Bootloader         *string
	Debug              *extenders.DebugConfig
	IsRouter           bool   `yaml:"is_router"`
	FactoryResetButton string `yaml:"factory_reset_button"`
	NetworkStateLED    string `yaml:"network_state_led"`
	LEDs               types.PinWithIDSlice
	// Buttons provide definitions(or references) to board buttons.
	// They will be used in other configuration places to
	// reference specific button.
	Buttons types.PinWithIDSlice
	I2C     []extenders.I2CInstance
	UART    []extenders.UARTInstance
}

type Device

type Device struct {
	General General
	Board   Board

	Sensors sensor.Sensors
}

func ParseFromFile

func ParseFromFile(configPath string) (*Device, error)

func ParseFromReader

func ParseFromReader(defConfig *Device, rdr io.Reader) (*Device, error)

func (*Device) PrependCommonClusters

func (d *Device) PrependCommonClusters()

PrependCommonClusters adds common device clusters as first endpoint.

This allows to have dynamic set of common device clusters, such as Identify(server), basic, poll control, etc.

FIXME: It is mostly a "workaround" to simplify device endpoint generation. While the solution is sound to me, the implementation of this function is questionable. Should it be here? Should it look like this? Should this common clusters be a sensor, rather then converting templates to handle endpoints rather than sensors directly?

func (*Device) UnmarshalYAML

func (d *Device) UnmarshalYAML(node *yaml.Node) error

UnamrshalYAML is implemented to intercept the original configuration file and resolve any known tags inside.

type General

type General struct {
	NCSToolChainBase string `yaml:"ncs_toolchain_base"`
	NCSVersion       string `yaml:"ncs_version"`
	ZephyrBase       string `yaml:"zephyr_base"`

	Manufacturer string `yaml:"manufacturer"`
	DeviceName   string `yaml:"device_name"`
	// Zephyr name for the board
	Board    string
	RunEvery time.Duration
	// ZigbeeChannels will define which endpoints device should try to use.
	// By default device will try all available channels.
	ZigbeeChannels []int `yaml:"zigbee_channels"`
	// Flasher defines the way the board should be flashed.
	Flasher        string
	FlasherOptions map[string]any
}

func (General) GetToochainsPath

func (g General) GetToochainsPath() NCSLocation

type NCSLocation

type NCSLocation struct {
	Version types.Semver
	NCS     string
	Zephyr  string
}

func FindNCSLocation

func FindNCSLocation(ncsBase, version string) (NCSLocation, error)

FindNCSLocation will return paths for NCS and Zephyr toolchains.

If toolchain of required version was not found - it will try to use default version from toolchain file, and if it is not present - latest available in list of toolchains.

As such this function can return different toolchain version that was requested, and caller can check it by comparing to version returned in NCSLocation.

Jump to

Keyboard shortcuts

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