calibrationReader

package module
v0.9.7 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2022 License: MIT Imports: 11 Imported by: 0

README

calibrationReader

Go Report Card Codacy Badge Codacy Badge Go CodeQL Go Reference

The calibrationReader package reads characteristics information from an a2l file and fills it with the data from a hex file. At least that is the plan (see TO-DO). Currently it can parse a2l-files as well as the corresponding IntelHex32 or Motorola S19 files. And it is quite fast at that. Currently a real world A2L(80MB) with its corresponding Hex File(10MB) will be parsed in less than a second.

USAGE: cd, err := ReadCalibration(a2lFilePath, hexFilePath)

parses a2l and hex file into datastructures. All relevant information e.g. Record Layouts, Measurements, Characterstics, etc. is part of a module which is in turn part of the Project whithin the a2l data structure. An a2l file can contain several modules but usually only contains one. So indexOfModuleInProject (see below) can basically assumed to be 0. All datastructures that are directly below a module within the a2l data structure hierarchy are accessible through maps by their identifiers.

To access System Constants: sc, exists := cd.a2l.Project.Modules[indexOfModuleInProject].SystemConstants["NameOfSystemConstant"]

To access Characteristics: c, exists := cd.a2l.Project.Modules[indexOfModuleInProject].Characteristics["NameOfCharacteristic"]

and so on.

To access a specific memory location in the hex-file (contains a single byte): b, exists := cd.hex[12345]

TO-DO: The Package still lacks the last bit of work which is implementing the methods for axis_pts, axis_descr, record_layout and fnc_values in order to understand the memory layout and position of a specific characteristic. This is somewhat of a convoluted mess in the a2l standard due to its historic growth and will be implemented when I have a little more spare time.

I am a mechanical engineer, so any code you see might not be up to the standards of true/correct/modern/acceptable software development ;) Feedback is always appreciated.

The only dependency outside the go standard library is currently zerolog.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AsciiCharacteristic added in v0.9.5

type AsciiCharacteristic struct {
	Characteristic a2l.Characteristic
	// contains filtered or unexported fields
}

type CalibrationData

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

CalibrationData contains the parsed structs from the a2l as well as the byte data from the hex file that are parsed by ReadCalibration()

func ReadCalibration

func ReadCalibration(a2lFilePath string, hexFilePath string) (CalibrationData, error)

ReadCalibration takes filepaths to the a2l file and the hex file, parses them in parallel and returns a CalibrationData struct

type CharacteristicType added in v0.9.5

type CharacteristicType interface {
	// contains filtered or unexported methods
}

type Cube4Characteristic added in v0.9.5

type Cube4Characteristic struct {
	Characteristic a2l.Characteristic
	// contains filtered or unexported fields
}

type Cube5Characteristic added in v0.9.5

type Cube5Characteristic struct {
	Characteristic a2l.Characteristic
	// contains filtered or unexported fields
}

type CuboidCharacteristic added in v0.9.5

type CuboidCharacteristic struct {
	Characteristic a2l.Characteristic
	// contains filtered or unexported fields
}

type CurveCharacteristic added in v0.9.5

type CurveCharacteristic struct {
	Characteristic a2l.Characteristic
	// contains filtered or unexported fields
}

type DerivedCharacteristic added in v0.9.5

type DerivedCharacteristic struct {
	Characteristic a2l.Characteristic
	// contains filtered or unexported fields
}

type ValBlkCharacteristic added in v0.9.5

type ValBlkCharacteristic struct {
	Characteristic a2l.Characteristic
	// contains filtered or unexported fields
}

type ValueCharacteristic added in v0.9.5

type ValueCharacteristic struct {
	Characteristic a2l.Characteristic
	// contains filtered or unexported fields
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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