smdx

package
v0.0.0-...-1daccfa Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2023 License: BSD-3-Clause Imports: 3 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoSuchModel = errors.New("no such model")
)

Functions

func DoModels

func DoModels(f func(m *ModelElement) error) error

DoModels iterates over all the registered models and calls the specified function on each.

func RegisterModel

func RegisterModel(m *ModelElement)

RegisterModel registers a new model element.

Types

type BlockElement

type BlockElement struct {
	XMLName xml.Name       `xml:"block"`
	Name    string         `xml:"name,attr"`
	Length  uint16         `xml:"len,attr"`
	Type    string         `xml:"type,attr"`
	Points  []PointElement `xml:"point"`
}

type ModelDefinitionElement

type ModelDefinitionElement struct {
	XMLName xml.Name         `xml:"sunSpecModels"`
	Version string           `xml:"v,attr"`
	Models  []ModelElement   `xml:"model"`
	Strings []StringsElement `xml:"strings"`
}

func FromXML

func FromXML(reader io.Reader) (model ModelDefinitionElement, err error)

type ModelElement

type ModelElement struct {
	XMLName xml.Name       `xml:"model"`
	Id      uint16         `xml:"id,attr"`
	Name    string         `xml:"name,attr"`
	Length  uint16         `xml:"len,attr"`
	Blocks  []BlockElement `xml:"block"`
}

func GetModel

func GetModel(id uint16) *ModelElement

GetModel answers the model element corresponding to the specified identifier or nil if no such element exists.

type ModelStringsElement

type ModelStringsElement struct {
	XMLName     xml.Name `xml:"model"`
	Label       string   `xml:"label"`
	Description string   `xml:"description"`
	Notes       string   `xml:"notes"`
}

type PointElement

type PointElement struct {
	XMLName     xml.Name        `xml:"point"`
	Id          string          `xml:"id,attr"`
	Label       string          `xml:",omit"`
	Description string          `xml:",omit"`
	Offset      uint16          `xml:"offset,attr"`
	Length      uint16          `xml:"len,attr"`
	Type        string          `xml:"type,attr"`
	ScaleFactor string          `xml:"sf,attr"`
	Units       string          `xml:"units,attr"`
	Mandatory   bool            `xml:"mandatory,attr"`
	Access      string          `xml:"access,attr"`
	Symbols     []SymbolElement `xml:"symbol"`
}

type PointStringsElement

type PointStringsElement struct {
	XMLName     xml.Name `xml:"point"`
	Id          string   `xml:"id,attr"`
	Label       string   `xml:"label"`
	Description string   `xml:"description"`
	Notes       string   `xml:"notes"`
}

type StringsElement

type StringsElement struct {
	XMLName      xml.Name              `xml:"strings"`
	Id           string                `xml:"id,attr"`
	Locale       string                `xml:"locale,attr"`
	ModelStrings ModelStringsElement   `xml:"model"`
	PointStrings []PointStringsElement `xml:"point"`
}

type SymbolElement

type SymbolElement struct {
	XMLName xml.Name `xml:"symbol"`
	Id      string   `xml:"id,attr"`
	Value   string   `xml:",chardata"`
}

Jump to

Keyboard shortcuts

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