txbridge

package
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: MIT Imports: 12 Imported by: ? modules, 0 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.

Documentation

Overview

Package txbridge drives the txbridge dongle over TCP (192.168.4.1:1337 or tcp://host[:1337] from cfg.Port). Importing the package registers the "txbridge wifi" adapter.

The wire protocol is framed serial commands (command byte, length, data, 1-byte sum checksum — see gocan v1's pkg/serialcommand): 't' carries CAN frames (idHi, idLo, dlc, data), 'e' errors, and the dongle's host-side features (fast logger streams, WBL readings, RAM read/write) ride on their own command bytes ('r', 'R', 'w', 'W', ...). Those are exposed with the Command/Raw/Subscribe/Request methods on the concrete type; consumers reach them via bus.Adapter() and a type assertion.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(cfg gocan.Config) (gocan.Adapter, error)

Types

type Txbridge

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

func (*Txbridge) Close

func (tx *Txbridge) Close() error

func (*Txbridge) Command

func (tx *Txbridge) Command(cmd byte, data []byte) error

Command frames and writes one serial command (cmd, len, data, checksum).

func (*Txbridge) Open

func (tx *Txbridge) Open(ctx context.Context, bus *gocan.Bus) error

func (*Txbridge) Raw

func (tx *Txbridge) Raw(data []byte) error

Raw writes bytes to the dongle as-is, for the unframed one-shot commands ("5"/"7"/"8" ECU select, "r"/"s" logger start/stop, "g" gather, ...).

func (*Txbridge) Request

func (tx *Txbridge) Request(ctx context.Context, cmd byte, data []byte, reply ...byte) (*serialcommand.SerialCommand, error)

Request sends one framed command and waits for the first reply carrying one of the given command bytes. Bound it with a context deadline.

func (*Txbridge) Send

func (tx *Txbridge) Send(ctx context.Context, f gocan.Frame) error

Send serializes and writes a single CAN frame; the write completing is the confirmation.

func (*Txbridge) SetFilter

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

SetFilter installs the dongle's dynamic whitelist: only listed IDs are forwarded over the link (KWP IDs the firmware handles itself always pass). An empty list is a no-op so the firmware keeps its boot default.

func (*Txbridge) Subscribe

func (tx *Txbridge) Subscribe(ctx context.Context, cmds ...byte) <-chan *serialcommand.SerialCommand

Subscribe delivers dongle commands carrying one of the given command bytes until ctx is cancelled. Delivery is non-blocking; slow readers lose commands.

Jump to

Keyboard shortcuts

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