2023-04-15 15:03:35 +00:00
|
|
|
package can
|
|
|
|
|
|
|
|
type Frame struct {
|
2023-04-16 07:46:41 +00:00
|
|
|
Id uint32
|
|
|
|
Data []byte
|
2023-04-15 15:03:35 +00:00
|
|
|
Kind Kind
|
|
|
|
}
|
|
|
|
|
|
|
|
//go:generate stringer -output=frame_kind.go -type Kind
|
|
|
|
type Kind uint8
|
|
|
|
|
|
|
|
const (
|
2023-04-16 07:46:41 +00:00
|
|
|
SFF Kind = iota // Standard ID Frame
|
|
|
|
EFF // Extended ID Frame
|
|
|
|
RTR // Remote Transmission Request Frame
|
|
|
|
ERR // Error Frame
|
2023-04-15 15:03:35 +00:00
|
|
|
)
|
|
|
|
|
2023-04-16 07:46:41 +00:00
|
|
|
type CanFilter struct {
|
|
|
|
Id uint32
|
|
|
|
Mask uint32
|
|
|
|
Inverted bool
|
|
|
|
}
|
2023-04-15 15:03:35 +00:00
|
|
|
|
|
|
|
type CanSink interface {
|
2023-04-16 07:46:41 +00:00
|
|
|
Send(*Frame) error
|
2023-04-15 15:03:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type CanSource interface {
|
2023-04-15 20:41:51 +00:00
|
|
|
Recv() (*Frame, error)
|
2023-04-15 15:03:35 +00:00
|
|
|
}
|