logformat

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2021 License: MIT Imports: 6 Imported by: 0

README

logformat

Go Reference gotest

This repository contains the log formats used in the FS World Datalogger used in Formula Student competitions.

Usage

go get github.com/fs-world/logformat

Modifying

The marshalling functions for the structs are autogenerated using msgp and easyjson.

To update the generated code follow these steps:

# Install msgp & easyjson
go install github.com/tinylib/msgp@latest
go install github.com/mailru/easyjson/...@latest
# run generators
go generate

Documentation

Index

Constants

View Source
const (
	CANFrameLength = 16 // CANFrameLength is total length of the frame in the kernel.
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CANFrame

type CANFrame struct {
	TimestampSoftware Timespec `json:"tss" msg:"tss"` // Software (kernel) timestamp of the frame
	TimestampHardware Timespec `json:"tsh" msg:"tsh"` // Hardware timestamp of the frame
	ID                uint32   `json:"id" msg:"id"`   // CAN ID
	DLC               uint8    `json:"l" msg:"l"`     // CAN DLC (data length code)
	Data              []byte   `json:"d" msg:"d"`     // CAN Data (0-8 bytes)
}

CANFrame is a CAN frame

func (*CANFrame) DecodeMsg

func (z *CANFrame) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*CANFrame) EncodeMsg

func (z *CANFrame) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (CANFrame) MarshalEasyJSON

func (v CANFrame) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (CANFrame) MarshalJSON

func (v CANFrame) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*CANFrame) MarshalMsg

func (z *CANFrame) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*CANFrame) Msgsize

func (z *CANFrame) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*CANFrame) String

func (f *CANFrame) String() string

String formats a CAN message in human-readable format

func (*CANFrame) UnmarshalEasyJSON

func (v *CANFrame) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*CANFrame) UnmarshalJSON

func (v *CANFrame) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*CANFrame) UnmarshalMsg

func (z *CANFrame) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type IVTMessage

type IVTMessage struct {
	Timestamp   Timespec `json:"ts" msg:"ts"` // Timestamp of the message
	Voltage     int32    `json:"u" msg:"u"`   // Voltage in mV
	Current     int32    `json:"i" msg:"i"`   // Current in mA
	Temperature int32    `json:"t" msg:"t"`   // Temperature of the shunt in 1/10 °C
}

IVTMessage is a message received from the IVT sensor, containing the power measurements

func (*IVTMessage) DecodeMsg

func (z *IVTMessage) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*IVTMessage) EncodeMsg

func (z *IVTMessage) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (IVTMessage) MarshalEasyJSON

func (v IVTMessage) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (IVTMessage) MarshalJSON

func (v IVTMessage) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*IVTMessage) MarshalMsg

func (z *IVTMessage) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*IVTMessage) Msgsize

func (z *IVTMessage) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*IVTMessage) UnmarshalEasyJSON

func (v *IVTMessage) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*IVTMessage) UnmarshalJSON

func (v *IVTMessage) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*IVTMessage) UnmarshalMsg

func (z *IVTMessage) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Serializable

Serializable is an interface that all data to be persisted as logdata must satisfy.

type Timespec

type Timespec struct {
	Sec  int32 `json:"s" msg:"s"`   // Seconds
	Nsec int32 `json:"ns" msg:"ns"` // Nanoseconds
}

Timespec is the unix.Timespec struct with msgp tags

func (*Timespec) DecodeMsg

func (z *Timespec) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (Timespec) EncodeMsg

func (z Timespec) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (Timespec) MarshalEasyJSON

func (v Timespec) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Timespec) MarshalJSON

func (v Timespec) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (Timespec) MarshalMsg

func (z Timespec) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (Timespec) Msgsize

func (z Timespec) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Timespec) UnmarshalEasyJSON

func (v *Timespec) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Timespec) UnmarshalJSON

func (v *Timespec) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*Timespec) UnmarshalMsg

func (z *Timespec) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

Jump to

Keyboard shortcuts

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