socketcan

package
v0.0.0-...-75bc78b Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

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

func NewConnection

func NewConnection(ifName string) (*Connection, error)

func (Connection) Close

func (i Connection) Close() error

func (Connection) ReadRawFrame

func (i Connection) ReadRawFrame() (nmea.RawFrame, error)

func (Connection) SendFrame

func (i Connection) SendFrame(raw nmea.RawFrame) error

func (Connection) SetReadTimeout

func (i Connection) SetReadTimeout(timeout time.Duration) error

func (Connection) SetSendTimeout

func (i Connection) SetSendTimeout(timeout time.Duration) error

type Device

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

func NewDevice

func NewDevice(config DeviceConfig) *Device

func (*Device) Close

func (d *Device) Close() error

func (*Device) Initialize

func (d *Device) Initialize() error

func (*Device) ReadRawMessage

func (d *Device) ReadRawMessage(ctx context.Context) (nmea.RawMessage, error)

func (*Device) WriteRawMessage

func (d *Device) WriteRawMessage(ctx context.Context, msg nmea.RawMessage) error

type DeviceConfig

type DeviceConfig struct {
	// InterfaceName is SocketCAN interface name.
	// Defaults to: can0
	InterfaceName string

	// ReceiveDataTimeout is to limit amount of time reads can result no data. to timeout the connection when there is no
	// interaction in bus. This is different from for example serial device readTimeout which limits how much time Read
	// call blocks but we want to Reads block small amount of time to be able to check if context was cancelled during read
	// but at the same time we want to be able to detect when there are no coming from bus for excessive amount of time.
	// Defaults to: 5 seconds
	ReceiveDataTimeout time.Duration

	// FastPacketAssembler assembles fast-packet PGN frames to complete messages.
	// Optional: if not set, messages are directly created out of frames with no assembly
	FastPacketAssembler nmea.Assembler
}

Jump to

Keyboard shortcuts

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