pkg

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: May 31, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package pkg provides utilities for the cli

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attribute added in v0.2.0

type Attribute struct {
	Int    *AttributeInt    `json:"int,omitempty"`
	String *AttributeString `json:"string,omitempty"`
	Enum   *AttributeEnum   `json:"enum,omitempty"`
	// contains filtered or unexported fields
}

type AttributeAssignments added in v0.2.0

type AttributeAssignments struct {
	Attributes map[string]any `json:"attributes,omitempty"`
}

type AttributeEnum added in v0.2.0

type AttributeEnum struct {
	Default string   `json:"default"`
	Values  []string `json:"values"`
	// contains filtered or unexported fields
}

type AttributeInt added in v0.2.0

type AttributeInt struct {
	Default int `json:"default"`
	From    int `json:"from"`
	To      int `json:"to"`
}

type AttributeString added in v0.2.0

type AttributeString struct {
	Default string `json:"default"`
}

type CanModel

type CanModel struct {
	Version           string                       `json:"version"`
	Boundrate         uint32                       `json:"boundrate"`
	Nodes             map[string]*Node             `json:"nodes"`
	GeneralAttributes map[string]*Attribute        `json:"general_attributes"`
	NodeAttributes    map[string]*NodeAttribute    `json:"node_attributes"`
	MessageAttributes map[string]*MessageAttribute `json:"message_attributes"`
	SignalAttributes  map[string]*SignalAttribute  `json:"signal_attributes"`
	Messages          map[string]*Message          `json:"messages"`
}

CanModel represents the CAN model.

func (*CanModel) Init added in v0.2.0

func (c *CanModel) Init()

func (*CanModel) Validate

func (c *CanModel) Validate() error

Validate validates the CAN model.

type DBCReader added in v0.2.0

type DBCReader struct {
	// contains filtered or unexported fields
}

func NewDBCReader added in v0.2.0

func NewDBCReader() *DBCReader

func (*DBCReader) Read added in v0.2.0

func (r *DBCReader) Read(file *os.File) (*CanModel, error)

type DBCWriter added in v0.2.0

type DBCWriter struct{}

func NewDBCWriter added in v0.2.0

func NewDBCWriter() *DBCWriter

func (*DBCWriter) Write added in v0.2.0

func (w *DBCWriter) Write(file *os.File, canModel *CanModel) error

type JsonReader added in v0.2.0

type JsonReader struct{}

func NewJsonReader added in v0.2.0

func NewJsonReader() *JsonReader

func (*JsonReader) Read added in v0.2.0

func (r *JsonReader) Read(file *os.File) (*CanModel, error)

type JsonWriter added in v0.2.0

type JsonWriter struct{}

func NewJsonWriter added in v0.2.0

func NewJsonWriter() *JsonWriter

func (*JsonWriter) Write added in v0.2.0

func (w *JsonWriter) Write(file *os.File, canModel *CanModel) error

type Message

type Message struct {
	*AttributeAssignments
	ID          uint32             `json:"id"`
	Description string             `json:"description,omitempty"`
	Length      uint32             `json:"length"`
	Sender      string             `json:"sender,omitempty"`
	Signals     map[string]*Signal `json:"signals"`
	// contains filtered or unexported fields
}

Message represents a CAN message.

func (*Message) FormatID

func (m *Message) FormatID() string

FormatID returns the message ID as a string.

func (*Message) HasDescription

func (m *Message) HasDescription() bool

HasDescription returns true if the message has a description.

type MessageAttribute added in v0.2.0

type MessageAttribute struct {
	*Attribute
	// contains filtered or unexported fields
}

type Node

type Node struct {
	*AttributeAssignments
	Description string `json:"description,omitempty"`
	// contains filtered or unexported fields
}

Node represents a CAN node.

func (*Node) HasDescription

func (n *Node) HasDescription() bool

HasDescription returns true if the node has a description.

type NodeAttribute added in v0.2.0

type NodeAttribute struct {
	*Attribute
	// contains filtered or unexported fields
}

type Reader added in v0.2.0

type Reader interface {
	Read(file *os.File) (*CanModel, error)
}

type Signal

type Signal struct {
	*AttributeAssignments
	Description string             `json:"description,omitempty"`
	MuxSwitch   uint32             `json:"mux_switch,omitempty"`
	StartBit    uint32             `json:"start_bit"`
	Size        uint32             `json:"size"`
	BigEndian   bool               `json:"big_endian,omitempty"`
	Signed      bool               `json:"signed,omitempty"`
	Unit        string             `json:"unit,omitempty"`
	Receivers   []string           `json:"receivers,omitempty"`
	Scale       float64            `json:"scale"`
	Offset      float64            `json:"offset"`
	Min         float64            `json:"min"`
	Max         float64            `json:"max"`
	Bitmap      map[string]uint32  `json:"bitmap,omitempty"`
	MuxGroup    map[string]*Signal `json:"mux_group,omitempty"`
	// contains filtered or unexported fields
}

Signal represents a CAN signal in a message.

func (*Signal) HasDescription

func (s *Signal) HasDescription() bool

HasDescription returns true if the signal has a description.

func (*Signal) IsBitmap

func (s *Signal) IsBitmap() bool

IsBitmap returns true if the signal is a bitmap.

func (*Signal) IsMultiplexor

func (s *Signal) IsMultiplexor() bool

IsMultiplexor returns true if the signal is a multiplexor.

type SignalAttribute added in v0.2.0

type SignalAttribute struct {
	*Attribute
	// contains filtered or unexported fields
}

type Writer added in v0.2.0

type Writer interface {
	Write(file *os.File, canModel *CanModel) error
}

Directories

Path Synopsis
Package sym contains the symbols used by the generator
Package sym contains the symbols used by the generator

Jump to

Keyboard shortcuts

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