gocan

package module
v1.4.5 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2026 License: MIT Imports: 31 Imported by: 6 modules, 25 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

goCAN

A Go Linux/Windows/OSX CAN library

Linux maintainer wanted! Please contact me at gocan@roffe.nu if you want to help out.

Build tags

  • ftdi - d2xx based FTDI support
  • canlib - requires client32.dll
  • canusb - requires canusbdrv(64).dll
  • combi - requires libusb-1.0.dll
  • j2538 - requires vendor DLL to be installed
  • pcan - requires PCANBasic.dll

Usage

Get goCAN

go get github.com/roffe/gocan@latest

Import the package in your imports

import (
	...
	"github.com/roffe/gocan"
)

Showcase

Supported Adapters

USB Serial
d2xx based FTDI adapters

these adapters can be accessible directly using the d2xx api from FTDI

libusb
  • CombiAdapter
Canusb DLL

Supported via goCANUSB

Lawicel canusbdrv.dll for both 32 and 64bit is supported

Kvaser Canlib

Supported via goCANlib, Tested with the following adapters

J2534

Support for both 32 & 64bit DLL's. Your GOARCH will controll which DLL it will look for.

Do note that not all vendors provide 64bit DLL's so you migh need to build your software with GOARCH=386 to be able to use the j2534 DLL. I've made a experimental CAN gateway that can be accessed over gRCP on linux or named pipes on windows to be able to use 32bit DLL's on 64bit systems. See goCANGateway

Most adapters that comes with a J2534 DLL will work. The list given is just ones verified to work.

Windows
Linux
Other
  • SocketCAN, note. to run from user space set cap_net_admin for target application sudo setcap cap_net_admin=eip APPNAME
  • OBDX Pro GT BLE & Wifi
  • Combiadapter via libusb

Documentation

Index

Constants

View Source
const (
	MagicByte   uint8 = 0x51
	ChecksumXOR uint8 = 0xE6

	DirectionOut uint8 = 0x01
	DirectionIn  uint8 = 0x00

	FlagRequest       uint8 = 0x01
	FlagRequestFinal  uint8 = 0x00
	FlagResponse      uint8 = 0x81
	FlagResponseFinal uint8 = 0x80

	SubCmdInit           uint8 = 0x00
	SubCmdGetVersion     uint8 = 0x03
	SubCmdClose          uint8 = 0x05
	SubCmdConnect        uint8 = 0x06
	SubCmdDisconnect     uint8 = 0x07
	SubCmdCANTx          uint8 = 0x08
	SubCmdCANRx          uint8 = 0x09
	SubCmdSetConfig      uint8 = 0x0B
	SubCmdGetConfig      uint8 = 0x0C
	SubCmdStartMsgFilter uint8 = 0x0D
	SubCmdStopMsgFilter  uint8 = 0x10
	SubCmdGetStatus      uint8 = 0x11
	SubCmdSetProtocol    uint8 = 0x12
	SubCmdGetSerial      uint8 = 0x13

	ProtocolCAN uint32 = 6

	ParamDataRate       uint32 = 0x04
	ParamBitSamplePoint uint32 = 0x14
	ParamSyncJumpWidth  uint32 = 0x15
)
View Source
const (
	ELM327_OK      = "OK\r\r"
	ELM327_UNKNOWN = "?\r\r"
)
View Source
const (
	OBDLinkSX = "OBDLink SX"
	OBDLinkEX = "OBDLink EX"
	STN1170   = "STN1170"
	STN2120   = "STN2120"
)
View Source
const (
	SystemMsg uint32 = 0x80000000 + iota
	SystemMsgError
	SystemMsgUnrecoverableError
	SystemMsgWBLReading
	SystemMsgDataResponse
	SystemMsgDataRequest
	SystemMsgWriteResponse
	SystemMsgUnknown
)

We have 3 bits allowing 8 different system messages hidden in a 29bit can id stored in a uint32

Variables

View Source
var (
	Incoming         = CANFrameType{Type: ResponseTypeIncoming, Responses: 0}
	Outgoing         = CANFrameType{Type: ResponseTypeOutgoing, Responses: 0}
	ResponseRequired = CANFrameType{Type: ResponseTypeResponseRequired, Responses: 1} // Used for ELM and STN adapters to signal we want the adapter to wait for a response
)
View Source
var (
	ErrErrorChannelFull       = errors.New("error channel full")
	ErrNillAdapter            = errors.New("adapter is nil")
	ErrDroppedFrame           = errors.New("adapter incoming channel full")
	ErrFramhandlerRegisterSub = errors.New("failed to register subscription, framehandler is full")
	ErrSendTimeout            = errors.New("timeout sending frame")
	ErrResponsechannelClosed  = errors.New("response channel closed")
)
View Source
var ErrClosed = errors.New("gocan: client closed")

ErrClosed is the context cause set when a client is shut down via Close. It is reported as a clean shutdown (Client.Err returns nil) rather than a fatal error.

Functions

func CANUSBAccept11 added in v1.0.7

func CANUSBAccept11(ids []uint32) (ac, am [4]byte, err error)

func CANUSBCmds11 added in v1.0.7

func CANUSBCmds11(ids []uint32) (mCmd, maskCmd string, err error)

Helper to produce the actual CANUSB ASCII commands for 11-bit IDs. Example output for ids 0x300..0x3FF:

M00006000
m00001FF0

func ListAdapterNames added in v1.0.7

func ListAdapterNames() []string

func NewGRPCClient added in v1.0.7

func NewGRPCClient() (*grpc.ClientConn, proto.GocanClient, error)

func NewScantoolVCP added in v1.0.7

func NewScantoolVCP(name string) func(cfg *AdapterConfig) (Adapter, error)

func NewTxbridge added in v1.0.7

func NewTxbridge(name string) func(cfg *AdapterConfig) (Adapter, error)

func RegisterAdapter added in v1.0.7

func RegisterAdapter(adapter *AdapterInfo) error

func SetLatencyTimer added in v1.3.4

func SetLatencyTimer(device string, latency int) error

Types

type ADCCapable added in v1.0.7

type ADCCapable interface {
	GetADCValue(ctx context.Context, channel int) (float64, error)
}

type Adapter

type Adapter interface {
	Name() string
	Open(context.Context) error
	Close() error
	Send() chan<- *CANFrame
	Recv() <-chan *CANFrame
	Err() <-chan error
	Event() <-chan Event
}

func NewAdapter added in v1.0.7

func NewAdapter(adapterName string, cfg *AdapterConfig) (Adapter, error)

func NewCanusbVCP added in v1.0.7

func NewCanusbVCP(cfg *AdapterConfig) (Adapter, error)

func NewDrewtech added in v1.3.4

func NewDrewtech(cfg *AdapterConfig) (Adapter, error)

func NewELM327 added in v1.0.7

func NewELM327(cfg *AdapterConfig) (Adapter, error)

func NewJust4Trionic added in v1.0.7

func NewJust4Trionic(cfg *AdapterConfig) (Adapter, error)

func NewMock added in v1.0.7

func NewMock(name string, cfg *AdapterConfig) (Adapter, error)

Create a new Mock adapter used for testing. Frames written to Send() are echoed back on Recv() as Incoming frames.

func NewOBDXProWifi added in v1.0.7

func NewOBDXProWifi(cfg *AdapterConfig) (Adapter, error)

func NewSLCan added in v1.0.7

func NewSLCan(cfg *AdapterConfig) (Adapter, error)

func NewTemplate added in v1.0.7

func NewTemplate(name string, cfg *AdapterConfig) (Adapter, error)

func NewYACA added in v1.0.7

func NewYACA(cfg *AdapterConfig) (Adapter, error)

type AdapterCapabilities added in v1.0.7

type AdapterCapabilities struct {
	HSCAN bool
	SWCAN bool
	KLine bool
}

func (*AdapterCapabilities) String added in v1.0.7

func (a *AdapterCapabilities) String() string

type AdapterConfig

type AdapterConfig struct {
	Debug            bool              // enable debug logging
	Port             string            // port name or path to dll/so/dylib
	PortBaudrate     int               // port baudrate in bps (only used for serial based adapters)
	CANRate          float64           // CAN bus rate in kbit/s
	CANFilter        []uint32          // CAN ID filters
	UseExtendedID    bool              // only used for j2534 when setting upp frame filters
	PrintVersion     bool              // print adapter version info on open
	AdditionalConfig map[string]string // Key value pairs for adapter specific configuration
}

type AdapterInfo added in v1.0.7

type AdapterInfo struct {
	Name               string
	Description        string
	RequiresSerialPort bool
	SerialPortOptional bool
	Capabilities       AdapterCapabilities
	New                func(*AdapterConfig) (Adapter, error)
}

func ListAdapters added in v1.0.7

func ListAdapters() []AdapterInfo

func (*AdapterInfo) String added in v1.0.7

func (a *AdapterInfo) String() string

type BaseAdapter added in v1.0.7

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

func NewBaseAdapter added in v1.0.7

func NewBaseAdapter(name string, cfg *AdapterConfig) *BaseAdapter

func (*BaseAdapter) Close added in v1.0.7

func (base *BaseAdapter) Close()

func (*BaseAdapter) Debug added in v1.0.7

func (base *BaseAdapter) Debug(debug string)

Send a debug event

func (*BaseAdapter) Err added in v1.0.7

func (base *BaseAdapter) Err() <-chan error

Return the error channel for the adapter

func (*BaseAdapter) Error added in v1.0.7

func (base *BaseAdapter) Error(err error)

Send an error event

func (*BaseAdapter) Event added in v1.0.7

func (base *BaseAdapter) Event() <-chan Event

func (*BaseAdapter) Fatal added in v1.0.7

func (base *BaseAdapter) Fatal(err error)

Set a fatal adapter error, meaning communication is broken and cannot continue.

func (*BaseAdapter) Info added in v1.0.7

func (base *BaseAdapter) Info(info string)

Send an info event

func (*BaseAdapter) Name added in v1.0.7

func (base *BaseAdapter) Name() string

Name returns the adapter name.

func (*BaseAdapter) Recv added in v1.0.7

func (base *BaseAdapter) Recv() <-chan *CANFrame

Return the receive channel for the adapter

func (*BaseAdapter) Send added in v1.0.7

func (base *BaseAdapter) Send() chan<- *CANFrame

Return the send channel for the adapter

func (*BaseAdapter) Warn added in v1.0.7

func (base *BaseAdapter) Warn(warn string)

Send a warning event

type CANFrame

type CANFrame struct {
	Identifier uint32
	Extended   bool
	RTR        bool
	Data       []byte
	FrameType  CANFrameType
	Timeout    uint32
}

func NewExtendedFrame added in v1.0.7

func NewExtendedFrame(identifier uint32, data []byte, frameType CANFrameType) *CANFrame

NewExtendedFrame creates a new CANFrame and copies the data slice

func NewFrame

func NewFrame(identifier uint32, data []byte, frameType CANFrameType) *CANFrame

NewFrame creates a new CANFrame and copies the data slice

func (*CANFrame) Bytes added in v1.0.7

func (f *CANFrame) Bytes() []byte

returns the frame as a byte slice, 4 bytes for the identifier, 1 byte for the length and the data if holding more than 8 bytes of data, it will be truncated

func (*CANFrame) ColorString added in v1.0.7

func (f *CANFrame) ColorString() string

func (*CANFrame) DLC added in v1.0.7

func (f *CANFrame) DLC() int

Returns the length of the data (DLC)

func (*CANFrame) String

func (f *CANFrame) String() string

type CANFrameType

type CANFrameType struct {
	Type      ResponseType
	Responses int
}

func ResponseRequiredWithResponses added in v1.0.7

func ResponseRequiredWithResponses(responses int) CANFrameType

type CanusbVCP added in v1.0.7

type CanusbVCP struct {
	*BaseAdapter
	// contains filtered or unexported fields
}

func (*CanusbVCP) Close added in v1.0.7

func (cu *CanusbVCP) Close() error

func (*CanusbVCP) Open added in v1.0.7

func (cu *CanusbVCP) Open(ctx context.Context) error

func (*CanusbVCP) SetFilter added in v1.0.7

func (cu *CanusbVCP) SetFilter(filters []uint32) error

SetFilter reconfigures the SJA1000 acceptance filter at runtime. The channel must be closed to set M/m, so we bounce C -> M -> m -> O.

type Client

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

func New added in v1.0.7

func New(ctx context.Context, adapterName string, cfg *AdapterConfig) (*Client, error)

Create a new CAN client with given adapter name and config

func NewWithOpts

func NewWithOpts(ctx context.Context, adapter Adapter, opts ...Opt) (*Client, error)

Create a new CAN client with given adapter and options

func (*Client) Adapter

func (c *Client) Adapter() Adapter

Return the underlying adapter

func (*Client) AdapterName added in v1.0.7

func (c *Client) AdapterName() string

Return the name of the underlying adapter

func (*Client) Close

func (c *Client) Close() (err error)

Close the client and underlying adapter

func (*Client) Context added in v1.4.1

func (c *Client) Context() context.Context

Context returns the client context. It is cancelled when the client is closed or the adapter fails fatally; context.Cause reports why (ErrClosed on a clean shutdown, otherwise the fatal adapter error).

func (*Client) Done added in v1.4.1

func (c *Client) Done() <-chan struct{}

Done returns a channel that is closed when the client terminates, for use in a select alongside your own work.

func (*Client) Err

func (c *Client) Err() error

Err returns the fatal adapter error that terminated the client, or nil if it is still running or was shut down cleanly (via Close or context cancellation).

func (*Client) OnEvent added in v1.4.1

func (c *Client) OnEvent(fn func(Event)) (cancel func())

OnEvent registers fn to receive subsequent events and returns a function that unregisters it. Unlike the construction-time options it can be called at any time and supports multiple independent listeners.

func (*Client) Recv added in v1.0.7

func (c *Client) Recv(ctx context.Context, timeout time.Duration, identifiers ...uint32) (*CANFrame, error)

Receive a single CAN frame with specific identifier and timeout

func (*Client) Send

func (c *Client) Send(identifier uint32, data []byte, f CANFrameType) error

Shortcommand to send a standard 11bit frame

func (*Client) SendAndWait

func (c *Client) SendAndWait(ctx context.Context, frame *CANFrame, timeout time.Duration, identifiers ...uint32) (*CANFrame, error)

Send and wait up to <timeout> for a answer on given identifiers

func (*Client) SendExtended added in v1.0.7

func (c *Client) SendExtended(identifier uint32, data []byte, f CANFrameType) error

Shortcommand to send a extended 29bit frame

func (*Client) SendFrame

func (c *Client) SendFrame(msg *CANFrame) error

Send a CAN Frame

func (*Client) Subscribe

func (c *Client) Subscribe(ctx context.Context, identifiers ...uint32) *Subscriber

Subscribe to CAN identifiers and return a message channel

func (*Client) SubscribeChan

func (c *Client) SubscribeChan(ctx context.Context, channel chan *CANFrame, identifiers ...uint32) *Subscriber

Subscribe to CAN identifiers with provided channel

func (*Client) SubscribeFunc

func (c *Client) SubscribeFunc(ctx context.Context, fn func(*CANFrame), identifiers ...uint32) *Subscriber

Subscribe to CAN identifiers with a callback function

func (*Client) Wait

func (c *Client) Wait(ctx context.Context) error

Wait blocks until ctx is done or the client terminates, returning the fatal adapter error if one occurred (nil on a clean shutdown or ctx cancellation).

type Device added in v1.3.4

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

Device represents a DrewTech J2534 device

func NewDrewtechDevice added in v1.3.4

func NewDrewtechDevice(opts ...Option) *Device

NewDrewtechDevice creates a new Device

func (*Device) Close added in v1.3.4

func (d *Device) Close() error

Close stops the read loop and closes the port

func (*Device) GetChannelConfig added in v1.3.4

func (d *Device) GetChannelConfig(param uint32) (uint32, error)

GetChannelConfig gets a config parameter from the current channel

func (*Device) GetConfig added in v1.3.4

func (d *Device) GetConfig(param uint32) (uint32, error)

func (*Device) GetDeviceInfo added in v1.3.4

func (d *Device) GetDeviceInfo(param uint16) error

func (*Device) GetFirmwareVersion added in v1.3.4

func (d *Device) GetFirmwareVersion() (string, error)

func (*Device) GetSerial added in v1.3.4

func (d *Device) GetSerial() (string, error)

func (*Device) GetStatus added in v1.3.4

func (d *Device) GetStatus() error

func (*Device) Init added in v1.3.4

func (d *Device) Init() error

func (*Device) Open added in v1.3.4

func (d *Device) Open(portName string) error

Open opens the serial port and starts the read loop

func (*Device) PassThruClose added in v1.3.4

func (d *Device) PassThruClose() error

PassThruClose closes the device connection

func (*Device) PassThruConnect added in v1.3.4

func (d *Device) PassThruConnect(baudRate uint32) error

PassThruConnect connects to CAN bus

func (*Device) PassThruDisconnect added in v1.3.4

func (d *Device) PassThruDisconnect() error

PassThruDisconnect disconnects from CAN bus

func (*Device) PassThruOpen added in v1.3.4

func (d *Device) PassThruOpen() error

PassThruOpen performs the full device initialization sequence

func (*Device) PassThruStartMsgFilter added in v1.3.4

func (d *Device) PassThruStartMsgFilter(patern, mask uint32) (uint32, error)

PassThruStartMsgFilter starts a pass-all filter

func (*Device) PassThruStopMsgFilter added in v1.3.4

func (d *Device) PassThruStopMsgFilter(filterID uint32) error

PassThruStopMsgFilter stops the current filter

func (*Device) PassThruWriteMsgs added in v1.3.4

func (d *Device) PassThruWriteMsgs(canID uint32, data []byte) error

PassThruWriteMsgs transmits a CAN frame

func (*Device) SetChannelConfig added in v1.3.4

func (d *Device) SetChannelConfig(param, value uint32) error

SetChannelConfig sets a config parameter on the current channel

type Drewtech added in v1.3.4

type Drewtech struct {
	*BaseAdapter
	// contains filtered or unexported fields
}

func (*Drewtech) Close added in v1.3.4

func (a *Drewtech) Close() error

func (*Drewtech) Open added in v1.3.4

func (a *Drewtech) Open(ctx context.Context) error

func (*Drewtech) SetFilter added in v1.3.4

func (a *Drewtech) SetFilter(filters []uint32) error

type ELM327 added in v1.0.7

type ELM327 struct {
	*BaseAdapter
	// contains filtered or unexported fields
}

func (*ELM327) Close added in v1.0.7

func (el *ELM327) Close() error

func (*ELM327) Open added in v1.0.7

func (el *ELM327) Open(ctx context.Context) error

type Event added in v1.0.7

type Event struct {
	Type    EventType
	Details string
	// Err holds the underlying error for EventTypeError and EventTypeFatal
	// events. It may be nil for events raised from a plain message.
	Err error
}

func (Event) IsFatal added in v1.4.1

func (e Event) IsFatal() bool

IsFatal reports whether the event signals an unrecoverable adapter failure.

func (Event) Raw added in v1.0.7

func (e Event) Raw() string

Returns the raw details of the event.

func (Event) String added in v1.0.7

func (e Event) String() string

Returns a formatted string representation of the event.

type EventType added in v1.0.7

type EventType int
const (
	EventTypeError EventType = iota
	EventTypeWarning
	EventTypeInfo
	EventTypeDebug
	// EventTypeFatal signals an unrecoverable adapter failure. It is always
	// the last event delivered before the client terminates.
	EventTypeFatal
)

func (EventType) Level added in v1.4.1

func (et EventType) Level() slog.Level

Level maps the event type to the matching slog level so events can be forwarded to an slog.Logger with WithLogger.

func (EventType) String added in v1.0.7

func (et EventType) String() string

type FirmwareInfo added in v1.3.4

type FirmwareInfo struct {
	FW Version
	BL Version
}

func ExtractVersions added in v1.3.4

func ExtractVersions(data []byte) FirmwareInfo

type GWClient added in v1.0.7

type GWClient struct {
	*BaseAdapter
	// contains filtered or unexported fields
}

func NewGWClient added in v1.0.7

func NewGWClient(adapterName string, cfg *AdapterConfig) (*GWClient, error)

func (*GWClient) Close added in v1.0.7

func (c *GWClient) Close() error

func (*GWClient) Open added in v1.0.7

func (c *GWClient) Open(gctx context.Context) error

func (*GWClient) SetFilter added in v1.0.7

func (c *GWClient) SetFilter([]uint32) error

type Just4Trionic added in v1.0.7

type Just4Trionic struct {
	*BaseAdapter
	// contains filtered or unexported fields
}

func (*Just4Trionic) Close added in v1.0.7

func (a *Just4Trionic) Close() error

func (*Just4Trionic) Open added in v1.0.7

func (a *Just4Trionic) Open(ctx context.Context) error

func (*Just4Trionic) SetFilter added in v1.0.7

func (a *Just4Trionic) SetFilter(filters []uint32) error

type Mock added in v1.0.7

type Mock struct {
	*BaseAdapter
}

func (*Mock) Close added in v1.0.7

func (v *Mock) Close() error

func (*Mock) Open added in v1.0.7

func (v *Mock) Open(ctx context.Context) error

type OBDXProWifi added in v1.0.7

type OBDXProWifi struct {
	*BaseAdapter
	// contains filtered or unexported fields
}

func (*OBDXProWifi) Close added in v1.0.7

func (a *OBDXProWifi) Close() error

func (*OBDXProWifi) Open added in v1.0.7

func (a *OBDXProWifi) Open(ctx context.Context) error

func (*OBDXProWifi) SetFilter added in v1.0.7

func (a *OBDXProWifi) SetFilter(filters []uint32) error

type Opt added in v1.0.7

type Opt func(*Client)

func WithEventChan added in v1.4.1

func WithEventChan(ch chan<- Event) Opt

WithEventChan forwards every adapter event to ch. Sends are non-blocking: if ch is full the event is dropped, so size the buffer for your consumer. The channel is never closed by the client; range with a select on Client.Done.

func WithEventFunc added in v1.4.1

func WithEventFunc(fn func(Event)) Opt

WithEventFunc registers fn as a synchronous event handler. It is called in order, from a single goroutine, for every adapter event (including the final fatal event). Keep it quick; a slow handler delays subsequent events.

func WithEventHandler deprecated added in v1.0.7

func WithEventHandler(fn func(Event)) Opt

Deprecated: use WithEventFunc. Retained for backwards compatibility; note the callback is now invoked synchronously and in order rather than per-goroutine.

func WithLogger added in v1.4.1

func WithLogger(l *slog.Logger) Opt

WithLogger forwards every adapter event to l at the matching slog level. Error and fatal events attach the underlying error under the "err" key.

type Option added in v1.3.4

type Option func(*Device)

Option configures the device

func WithCANChannel added in v1.3.4

func WithCANChannel(ch chan *CANFrame) Option

WithCANChannel sets a channel for receiving CAN frames

func WithCANFrameHandler added in v1.3.4

func WithCANFrameHandler(handler func(*CANFrame)) Option

WithCANFrameHandler sets the CAN frame callback

func WithErrorHandler added in v1.3.4

func WithErrorHandler(handler func(error)) Option

WithErrorHandler sets the error callback

type Packet added in v1.3.4

type Packet struct {
	Length    uint16
	Direction uint8
	Channel   uint8
	Payload   []byte
}

Packet represents a protocol packet

func (*Packet) IsCANRx added in v1.3.4

func (p *Packet) IsCANRx() bool

func (*Packet) ParseCANFrame added in v1.3.4

func (p *Packet) ParseCANFrame() (*CANFrame, error)

func (*Packet) Sequence added in v1.3.4

func (p *Packet) Sequence() uint16

func (*Packet) SubCommand added in v1.3.4

func (p *Packet) SubCommand() uint8

func (*Packet) ToBytes added in v1.3.4

func (p *Packet) ToBytes() []byte

type Parser added in v1.3.4

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

Parser handles streaming packet parsing

func NewParser added in v1.3.4

func NewParser() *Parser

func (*Parser) Feed added in v1.3.4

func (p *Parser) Feed(data []byte) ([]*Packet, error)

type ResponseType added in v1.0.7

type ResponseType int
const (
	ResponseTypeIncoming         ResponseType = 0
	ResponseTypeOutgoing         ResponseType = 1
	ResponseTypeResponseRequired ResponseType = 2 // Used for ELM and STN adapters to signal we want the adapter to wait for a response
)

type SLCan added in v1.0.7

type SLCan struct {
	*BaseAdapter
	// contains filtered or unexported fields
}

func (*SLCan) Close added in v1.0.7

func (sl *SLCan) Close() error

func (*SLCan) Open added in v1.0.7

func (sl *SLCan) Open(ctx context.Context) error

func (*SLCan) SetFilter added in v1.0.7

func (sl *SLCan) SetFilter(filters []uint32) error

type ScantoolVCP added in v1.0.7

type ScantoolVCP struct {
	*BaseAdapter
	// contains filtered or unexported fields
}

func (*ScantoolVCP) Close added in v1.0.7

func (stn *ScantoolVCP) Close() error

func (*ScantoolVCP) Open added in v1.0.7

func (stn *ScantoolVCP) Open(ctx context.Context) error

func (*ScantoolVCP) SetFilter added in v1.0.7

func (stn *ScantoolVCP) SetFilter(filters []uint32) error

type Subscriber added in v1.0.7

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

func (*Subscriber) Chan added in v1.0.7

func (s *Subscriber) Chan() <-chan *CANFrame

func (*Subscriber) Close added in v1.0.7

func (s *Subscriber) Close()

type Template added in v1.0.7

type Template struct {
	*BaseAdapter
}

func (*Template) Close added in v1.0.7

func (a *Template) Close() error

func (*Template) Open added in v1.0.7

func (a *Template) Open(ctx context.Context) error

func (*Template) SetFilter added in v1.0.7

func (a *Template) SetFilter(filters []uint32) error

type TimeoutError added in v1.0.7

type TimeoutError struct {
	Timeout int64
	Frames  []uint32
	Type    string
}

func (*TimeoutError) Error added in v1.0.7

func (e *TimeoutError) Error() string

type Txbridge added in v1.0.7

type Txbridge struct {
	*BaseAdapter
	// contains filtered or unexported fields
}

func (*Txbridge) Close added in v1.0.7

func (tx *Txbridge) Close() error

func (*Txbridge) Open added in v1.0.7

func (tx *Txbridge) Open(ctx context.Context) error

func (*Txbridge) SetFilter added in v1.0.7

func (tx *Txbridge) SetFilter(filters []uint32) error

SetFilter installs the adapter's dynamic whitelist: only frames whose ID is listed are forwarded over the link (the KWP IDs the firmware handles itself are always passed). Can be called at any time. An empty list is a no-op so the firmware keeps its boot default whitelist rather than going silent.

type Version added in v1.3.4

type Version struct {
	Major, Minor, Patch, Build byte
}

func (Version) String added in v1.3.4

func (v Version) String() string

type YACA added in v1.0.7

type YACA struct {
	*BaseAdapter
	// contains filtered or unexported fields
}

func (*YACA) Close added in v1.0.7

func (ya *YACA) Close() error

func (*YACA) Open added in v1.0.7

func (ya *YACA) Open(ctx context.Context) error

func (*YACA) SetFilter added in v1.0.7

func (ya *YACA) SetFilter(filters []uint32) error

Directories

Path Synopsis
cmd
testsuite command
examples
list_adapters command
passthru command
pingpong/client command
pingpong/server command
pkg
drewtech
Package drewtech provides a client for DrewTech J2534 devices
Package drewtech provides a client for DrewTech J2534 devices
dvi
gmlan
see GMW3110 gmw3110-2010.pdf
see GMW3110 gmw3110-2010.pdf
pcan/cmd command
w32

Jump to

Keyboard shortcuts

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