Documentation
¶
Index ¶
- Constants
- Variables
- 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 Frame
- func (f *Frame) ColorString() string
- func (f *Frame) Data() []byte
- func (f *Frame) GetTimeout() time.Duration
- func (f *Frame) Identifier() uint32
- func (f *Frame) Length() int
- func (f *Frame) SetTimeout(t time.Duration)
- func (f *Frame) SetType(t CANFrameType)
- func (f *Frame) String() string
- func (f *Frame) Type() CANFrameType
- type FrameHandler
- type Opts
- type RawCommand
- type Sub
Constants ¶
const ( SystemMsg uint32 = 0x80000000 + iota SystemMsgError SystemMsgDebug 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 ¶
This section is empty.
Types ¶
type AdapterConfig ¶
type CANFrame ¶
type CANFrame interface {
// Return frame identifier
Identifier() uint32
// Return frame data length (DLC)
Length() int
// Return data of frame
Data() []byte
// Return type of frame
Type() CANFrameType
// Return fancy string version of frame
String() string
// Set response timeout
SetTimeout(time.Duration)
// Return response timeout
GetTimeout() time.Duration
}
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 Frame ¶
type Frame struct {
// contains filtered or unexported fields
}
func (*Frame) ColorString ¶
func (*Frame) GetTimeout ¶
func (*Frame) Identifier ¶
func (*Frame) SetTimeout ¶
func (*Frame) SetType ¶
func (f *Frame) SetType(t CANFrameType)
func (*Frame) Type ¶
func (f *Frame) Type() CANFrameType
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()
type RawCommand ¶
type RawCommand struct {
// contains filtered or unexported fields
}
func NewRawCommand ¶
func NewRawCommand(data string) *RawCommand
func (*RawCommand) Data ¶
func (r *RawCommand) Data() []byte
func (*RawCommand) GetTimeout ¶
func (f *RawCommand) GetTimeout() time.Duration
func (*RawCommand) Identifier ¶
func (r *RawCommand) Identifier() uint32
func (*RawCommand) Length ¶
func (r *RawCommand) Length() int
func (*RawCommand) SetTimeout ¶
func (f *RawCommand) SetTimeout(t time.Duration)
func (*RawCommand) String ¶
func (r *RawCommand) String() string
func (*RawCommand) Type ¶
func (r *RawCommand) Type() CANFrameType
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 |