socketcan

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CANErrTxTimeout flags a TX timeout
	CANErrTxTimeout CANErrorClass = 0x00000001
	// CANErrLostArb flags a lost arbitration
	CANErrLostArb CANErrorClass = 0x00000002
	// CANErrCtrl flags controller problems
	CANErrCtrl CANErrorClass = 0x00000004
	// CANErrProt flags protocol violations
	CANErrProt CANErrorClass = 0x00000008
	// CANErrTrx flags transceiver status
	CANErrTrx CANErrorClass = 0x00000010
	// CANErrAck flags received no ACK on transmission
	CANErrAck CANErrorClass = 0x00000020
	// CANErrBusOff flags bus off
	CANErrBusOff CANErrorClass = 0x00000040
	// CANErrBusError flags bus error
	CANErrBusError CANErrorClass = 0x00000080
	// CANErrRestarted flags controller restarted
	CANErrRestarted CANErrorClass = 0x00000100

	// CANErrCtrlUnspec flags unspecified
	CANErrCtrlUnspec CANCtrlErrorDetails = 0x00
	// CANErrCtrlRxOverflow flags RX buffer overflow
	CANErrCtrlRxOverflow CANCtrlErrorDetails = 0x01
	// CANErrCtrlTxOverflow flags TX buffer overflow
	CANErrCtrlTxOverflow CANCtrlErrorDetails = 0x02
	// CANErrCtrlRxWarning flags reached warning level for RX errors
	CANErrCtrlRxWarning CANCtrlErrorDetails = 0x04
	// CANErrCtrlTxWarning flags reached warning level for TX errors
	CANErrCtrlTxWarning CANCtrlErrorDetails = 0x08
	// CANErrCtrlRxPassive flags reached error passive status RX
	CANErrCtrlRxPassive CANCtrlErrorDetails = 0x10
	// CANErrCtrlTxPassive flags reached error passive status TX
	CANErrCtrlTxPassive CANCtrlErrorDetails = 0x20
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CANCtrlErrorDetails

type CANCtrlErrorDetails uint8

CANCtrlErrorDetails represents of a can controller error (when CANErrCtrl is set in CANErrorClass).

type CANErrorClass

type CANErrorClass uint32

CANErrorClass represents athe CAN error class.

type CANErrorFrame

type CANErrorFrame struct {
	ErrorClass          CANErrorClass
	CANCtrlErrorDetails CANCtrlErrorDetails
}

CANErrorFrame represents a CAN error frame.

type CANFrame

type CANFrame struct {
	ID       uint32
	DLC      uint8
	Data     []byte
	Extended bool
	RTR      bool
}

CANFrame represents a CAN frame.

func (*CANFrame) String

func (f *CANFrame) String() string

type RawInterface

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

RawInterface represents a raw CAN interface.

func NewRawInterface

func NewRawInterface(interfaceName string) (*RawInterface, error)

NewRawInterface creates a new raw CAN interface.

func (*RawInterface) Close

func (i *RawInterface) Close() error

Close closes the raw CAN interface.

func (*RawInterface) Receive

func (i *RawInterface) Receive() (*CANFrame, error)

Receive receives a CAN frame. Blocking read Handles only standard and extended frames, error frames are ignored

func (*RawInterface) Send

func (i *RawInterface) Send(f *CANFrame) error

Send sends a CAN frame. blocking write Use this function for standard and extended frames.

func (*RawInterface) SendErrorFrame

func (i *RawInterface) SendErrorFrame(f *CANErrorFrame) error

SendErrorFrame sends a CAN error frame.

Jump to

Keyboard shortcuts

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