Documentation
¶
Index ¶
- Constants
- Variables
- func IsRecoverable(err error) bool
- func Unrecoverable(err error) error
- type Adapter
- type AdapterConfig
- type CANFrame
- type CANFrameType
- type Client
- func (c *Client) Adapter() Adapter
- func (c *Client) Close() (err error)
- func (c *Client) Err() <-chan error
- func (c *Client) Send(msg *CANFrame) error
- func (c *Client) SendAndWait(ctx context.Context, frame *CANFrame, timeout time.Duration, ...) (*CANFrame, error)
- func (c *Client) SendFrame(identifier uint32, data []byte, f CANFrameType) error
- func (c *Client) Subscribe(ctx context.Context, identifiers ...uint32) *Sub
- func (c *Client) SubscribeChan(ctx context.Context, channel chan *CANFrame, identifiers ...uint32) *Sub
- func (c *Client) SubscribeFunc(ctx context.Context, f func(*CANFrame), identifiers ...uint32) *Sub
- func (c *Client) Wait(ctx context.Context, timeout time.Duration, identifiers ...uint32) (*CANFrame, error)
- type FrameHandler
- type Opts
- type Sub
Constants ¶
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 ¶
var ( Incoming = CANFrameType{Type: 0, Responses: 0} Outgoing = CANFrameType{Type: 1, Responses: 0} // Used for ELM and STN adapters to signal we want the adapter to wait for a response ResponseRequired = CANFrameType{Type: 2, Responses: 1} )
Functions ¶
func IsRecoverable ¶ added in v1.0.1
IsRecoverable checks if error is an instance of `unrecoverableError`
func Unrecoverable ¶ added in v1.0.1
Unrecoverable wraps an error in `unrecoverableError` struct
Types ¶
type AdapterConfig ¶
type CANFrame ¶
type CANFrame struct {
Identifier uint32
Extended bool
Data []byte
FrameType CANFrameType
Timeout time.Duration
}
func NewExtendedFrame ¶ added in v1.0.7
func NewExtendedFrame(identifier uint32, data []byte, frameType CANFrameType) *CANFrame
func (*CANFrame) ColorString ¶ added in v1.0.7
type CANFrameType ¶
func (*CANFrameType) GetResponseCount ¶
func (c *CANFrameType) GetResponseCount() int
func (*CANFrameType) SetResponseCount ¶
func (c *CANFrameType) SetResponseCount(no int)
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewWithOpts ¶
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) SendFrame ¶
func (c *Client) SendFrame(identifier uint32, data []byte, f CANFrameType) error
Shortcommand to send a standard 11bit frame
func (*Client) SubscribeChan ¶
func (c *Client) SubscribeChan(ctx context.Context, channel chan *CANFrame, identifiers ...uint32) *Sub
Subscribe to CAN identifiers and return a message channel
func (*Client) SubscribeFunc ¶
type FrameHandler ¶
type FrameHandler struct {
// contains filtered or unexported fields
}
FrameHandler takes care of faning out incoming frames to any subs
func (*FrameHandler) Close ¶
func (h *FrameHandler) Close()
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
gmlan/read_vin_from_uec
command
|
|
|
pingpong/client
command
|
|
|
pingpong/server
command
|
|
|
pkg
|
|
|
gmlan
see GMW3110 gmw3110-2010.pdf
|
see GMW3110 gmw3110-2010.pdf |