socketcan

package module
v0.0.0-...-5cc6228 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2021 License: MIT Imports: 3 Imported by: 0

README

socketcan [WIP]

socketcan provides an interface to a CAN bus to read and write frames. The library is based on the SocketCAN network stack on Linux.

Features

  • supports kernel timestamps for received frames
  • receive and parse error frames
  • CAN filters
  • interfaces:
    • simple io.ReadWriteCloser interface (via os.File)
    • more sophisticated Send and Receive methods to handle out-of-band ( oob) data like timestamps
  • no dependencies beside golang.org/x/sys/unix

Documentation

Overview

Package socketcan provides an interface to a CAN bus to read and write frames via the SocketCAN network stack on Linux.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CanError

type CanError struct {
	Class    uint
	Detail   uint
	Location uint
	// contains filtered or unexported fields
}

CanError contains the error information parsed from CAN error frames

func ParseCanErrors

func ParseCanErrors(id int, data []byte) (errs []CanError)

ParseCanErrors returns the CAN errors from given CAN frame

func (CanError) Error

func (e CanError) Error() (s string)

Error implements the error interface

type MultipleError

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

MultipleError implements the error interface and may contain multiple errors

func (*MultipleError) Add

func (e *MultipleError) Add(err error)

Add adds the given error to the contained errors

func (*MultipleError) Err

func (e *MultipleError) Err() (err error)

Err returns, dependent upon the count of contained errors, nil, the one contained error or the MultipleError itself. This should be returned as error to the calling function.

func (*MultipleError) Error

func (e *MultipleError) Error() (s string)

Error implements the error interface

func (*MultipleError) Errors

func (e *MultipleError) Errors() (errs []error)

Errors returns the contained errors

Jump to

Keyboard shortcuts

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