canbus

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SerialCanDefaultPort     = "/dev/ttyS1234"
	SerialCanDefaultBaudrate = 25000

	SerialCanParity   = serial.NoParity
	SerialCanDataBits = 8
	SerialCanStopBits = serial.OneStopBit
)
View Source
const (
	CanInterfaceDefaultName = "can0"
)
View Source
const CanbusBufferSize = 2048
View Source
const (
	TCP_CAN_DEFAULT_PORT = 9001
)
View Source
const (
	TcpCanNetworkType = "tcp"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CanBus

type CanBus interface {
	Connect(wg *sync.WaitGroup) (<-chan *can.Frame, error)
	Disconnect() error
	Send(message *can.Frame) error
}

type CanFrameParser

type CanFrameParser interface {
	Unmarshal(in []byte) *can.Frame
	Marshal(*can.Frame) []byte
}

type NetworkIf

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

func NewIface

func NewIface(iface string) *NetworkIf

func (*NetworkIf) Connect

func (i *NetworkIf) Connect(wg *sync.WaitGroup) (<-chan *can.Frame, error)

func (*NetworkIf) Disconnect

func (i *NetworkIf) Disconnect() error

func (*NetworkIf) Send

func (i *NetworkIf) Send(message *can.Frame) error

type Serial

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

func NewSerial

func NewSerial(port string, baudrate int) *Serial

func NewSerialCustomParser

func NewSerialCustomParser(port string, baudrate int, parser CanFrameParser) *Serial

func (*Serial) Connect

func (s *Serial) Connect(wg *sync.WaitGroup) (<-chan *can.Frame, error)

func (*Serial) Disconnect

func (s *Serial) Disconnect() error

func (*Serial) Send

func (s *Serial) Send(message *can.Frame) error

type TcpClient

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

func NewTcpClient

func NewTcpClient(address string, port uint16) *TcpClient

func NewTcpClientCustomParser

func NewTcpClientCustomParser(address string, port uint16,
	parser CanFrameParser) *TcpClient

func (*TcpClient) Connect

func (c *TcpClient) Connect(wg *sync.WaitGroup) (<-chan *can.Frame, error)

func (*TcpClient) Disconnect

func (c *TcpClient) Disconnect() error

func (*TcpClient) Send

func (c *TcpClient) Send(message *can.Frame) error

Jump to

Keyboard shortcuts

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