Documentation ¶
Index ¶
- Constants
- Variables
- type Adapter
- type AdapterConfig
- type CANFrame
- type CANFrameType
- type Client
- func (c *Client) Adapter() Adapter
- func (c *Client) Close() error
- func (c *Client) Poll(ctx context.Context, timeout time.Duration, identifiers ...uint32) (CANFrame, error)
- func (c *Client) Send(msg CANFrame) error
- func (c *Client) SendAndPoll(ctx context.Context, frame CANFrame, timeout time.Duration, ...) (CANFrame, error)
- func (c *Client) SendFrame(identifier uint32, data []byte, f CANFrameType) error
- func (c *Client) SetFilter(filters []uint32) error
- func (c *Client) Subscribe(ctx context.Context, identifiers ...uint32) *Sub
- func (c *Client) Subscribe2(ctx context.Context, identifiers ...uint32) chan CANFrame
- type Frame
- func (f *Frame) ColorString() string
- func (f *Frame) Data() []byte
- 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) Timeout() time.Duration
- func (f *Frame) Type() CANFrameType
- type FrameHandler
- type Opts
- type RawCommand
- type Sub
Constants ¶
View Source
const (
CR = 0x0D
)
Variables ¶
View Source
var ( Incoming = CANFrameType{Type: 0, Responses: 0} Outgoing = CANFrameType{Type: 1, Responses: 0} 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 Length() int // Return data of frame Data() []byte // Return type of frame Type() CANFrameType // Return fancy string version of frame String() string // Set response timeour SetTimeout(time.Duration) // Return response timeout Timeout() 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) Poll ¶
func (c *Client) Poll(ctx context.Context, timeout time.Duration, identifiers ...uint32) (CANFrame, error)
Poll for a certain CAN identifier for up to <timeout>
func (*Client) SendAndPoll ¶
func (c *Client) SendAndPoll(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
type Frame ¶
type Frame struct {
// contains filtered or unexported fields
}
func (*Frame) ColorString ¶
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) 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) Timeout ¶
func (f *RawCommand) Timeout() time.Duration
func (*RawCommand) Type ¶
func (r *RawCommand) Type() CANFrameType
Click to show internal directories.
Click to hide internal directories.