common

package
v0.0.1-alpha Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2015 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TypeInfos = TypeIndex{
	&FieldTypeInfo{0, "int8", 1},
	&FieldTypeInfo{1, "int16", 2},
	&FieldTypeInfo{2, "int32", 4},
	&FieldTypeInfo{3, "uint8", 1},
	&FieldTypeInfo{4, "uint16", 2},
	&FieldTypeInfo{5, "uint32", 4},
	&FieldTypeInfo{6, "float", 4},
	&FieldTypeInfo{7, "enum", 1},
}

Functions

This section is empty.

Types

type Definition

type Definition struct {
	Name           string `xml:"name,attr" json:"name"`
	Description    string `xml:"description" json:"description"`
	SingleInstance bool   `xml:"singleinstance,attr" json:"singleInstance"`
	Settings       bool   `xml:"settings,attr" json:"settings"`
	Category       string `xml:"category,attr" json:"category"`

	ObjectID uint32 `json:"id"`

	Access struct {
		Gcs    string `xml:"gcs,attr" json:"gcs"`
		Flight string `xml:"flight,attr" json:"flight"`
	} `xml:"access" json:"access"`

	TelemetryGcs struct {
		Acked      bool   `xml:"acked,attr" json:"acked"`
		UpdateMode string `xml:"updatemode,attr" json:"updateMode"`
		Period     string `xml:"period,attr" json:"period"`
	} `xml:"telemetrygcs" json:"telemetryGcs"`

	TelemetryFlight struct {
		Acked      bool   `xml:"acked,attr" json:"acked"`
		UpdateMode string `xml:"updatemode,attr" json:"updateMode"`
		Period     string `xml:"period,attr" json:"period"`
	} `xml:"telemetryflight" json:"telemetryFlight"`

	Logging struct {
		UpdateMode string `xml:"updatemode,attr" json:"updateMode"`
		Period     string `xml:"period,attr" json:"period"`
	} `xml:"logging" json:"logging"`

	Fields FieldsSlice `xml:"field" json:"fields"`
}

Definition _

type Definitions

type Definitions []*Definition

Definitions is a slice of Definition, adds findBy

func (Definitions) GetDefinitionForName

func (definitions Definitions) GetDefinitionForName(name string) (*Definition, error)

GetDefinitionForName _

func (Definitions) GetDefinitionForObjectID

func (definitions Definitions) GetDefinitionForObjectID(objectID uint32) (*Definition, error)

GetDefinitionForObjectID _

func (Definitions) IsUniqueInstanceForObjectID

func (definitions Definitions) IsUniqueInstanceForObjectID(objectID uint32) (bool, error)

IsUniqueInstanceForObjectID an common is said unique when its number of instances is == 0 (which means, it is not an array)

type FieldDefinition

type FieldDefinition struct {
	Name  string `xml:"name,attr" json:"name"`
	Units string `xml:"units,attr" json:"units"`
	Type  string `xml:"type,attr" json:"-"`

	FieldTypeInfo *FieldTypeInfo

	Elements         int      `xml:"elements,attr" json:"elements"`
	ElementNamesAttr string   `xml:"elementnames,attr" json:"-"`
	ElementNames     []string `xml:"elementnames>elementname" json:"elementsName"`
	OptionsAttr      string   `xml:"options,attr" json:"-"`
	Options          []string `xml:"options>option" json:"options"`
	DefaultValue     string   `xml:"defaultvalue,attr" json:"defaultValue"`

	CloneOf string `xml:"cloneof,attr" json:"cloneOf"`
}

FieldDefinition _

type FieldTypeInfo

type FieldTypeInfo struct {
	Index int
	Name  string
	Size  int
}

FieldTypeInfo Taulabs defines its fields as type names, with a given size implicitely implied

type FieldsSlice

type FieldsSlice []*FieldDefinition

FieldsSlice sortable slice of fields

func (FieldsSlice) ByteLength

func (fields FieldsSlice) ByteLength() int

ByteLength returns the size in bytes of all the fields

func (FieldsSlice) FieldForName

func (fields FieldsSlice) FieldForName(name string) (*FieldDefinition, error)

FieldForName returns a fieldDefinition for a given name

func (FieldsSlice) Len

func (fields FieldsSlice) Len() int

func (FieldsSlice) Less

func (fields FieldsSlice) Less(i, j int) bool

func (FieldsSlice) Swap

func (fields FieldsSlice) Swap(i, j int)

type TypeIndex

type TypeIndex []*FieldTypeInfo

TypeIndex holds a slice of *FieldTypeInfo, adds helper methods

func (TypeIndex) FieldTypeForString

func (t TypeIndex) FieldTypeForString(ts string) (*FieldTypeInfo, error)

FieldTypeForString _

Jump to

Keyboard shortcuts

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