Documentation ¶
Index ¶
- Constants
- type CanIsotpOptions
- type Interface
- func (i Interface) Close() error
- func (i Interface) Rebind(rxID uint32, txID uint32) error
- func (i Interface) RecvBuf() ([]byte, error)
- func (i Interface) RecvFrame() (RawFrame, error)
- func (i Interface) SendBuf(data []byte) error
- func (i Interface) SendFrame(f RawFrame) error
- func (i Interface) SetLoopback(enable bool) error
- func (i Interface) SetRecvTimeout(timeout time.Duration) error
- func (i Interface) SetSendTimeout(timeout time.Duration) error
- func (i Interface) SetTxPadding(on bool, value uint8) error
- type InterfaceCfg
- type RawFrame
- type TrueCanFdFrame
- type TrueCanFrame
Constants ¶
View Source
const ( CanFrameWithoutData = 8 CanFrameMaxDlc = 8 CanFdFrameMaxDlc = 64 CanInterfaceMaxBuf = 16 CanFdInterfaceMaxBuf = 72 )
View Source
const ( CAN_RAW_FILTER /* set 0 .. n can_filter(s) */ CAN_RAW_ERR_FILTER /* set filter for error frames */ CAN_RAW_LOOPBACK /* local loopback (default:on) */ CAN_RAW_RECV_OWN_MSGS /* receive my own msgs (default:off) */ CAN_RAW_FD_FRAMES /* allow CAN FD frames (default:off) */ CAN_RAW_JOIN_FILTERS /* all filters must match to trigger */ )
从can-utils里看到的定义
View Source
const ( CAN_RAW /* RAW sockets */ CAN_BCM /* Broadcast Manager */ CAN_TP16 /* VAG Transport Protocol v1.6 */ CAN_TP20 /* VAG Transport Protocol v2.0 */ CAN_MCNET /* Bosch MCNet */ CAN_ISOTP /* ISO 15765-2 Transport Protocol */ CAN_J1939 /* SAE J1939 */ CAN_NPROTO )
从can-utils里看到的定义, 可以在unix包里找到: particular protocols of the protocol family PF_CAN
View Source
const ( IF_TYPE_RAW_FD = iota IF_TYPE_ISOTP )
View Source
const ( SOL_CAN_BASE = 100 SOL_CAN_RAW = 101 )
View Source
const CAN_EFF_FLAG = 0x80000000
View Source
const CAN_ISOTP_EXTEND_ADDR = 0x002
View Source
const CAN_ISOTP_OPTS = 1
View Source
const CAN_ISOTP_RX_PADDING = 0x008
View Source
const CAN_ISOTP_TX_PADDING = 0x004
View Source
const SOL_CAN_ISOTP = 106
View Source
const SYS_SETSOCKOPT = 54
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CanIsotpOptions ¶
type CanIsotpOptions struct {
// contains filtered or unexported fields
}
type Interface ¶
type Interface struct { IfName string SocketFd int Interface int32 // contains filtered or unexported fields }
func NewIsotpInterface ¶
func NewRawFdInterface ¶
func NewRawFdInterface(cfg InterfaceCfg) (Interface, error)
func (Interface) SetLoopback ¶
type InterfaceCfg ¶
type RawFrame ¶
type RawFrame struct { Interface int32 ArbId int32 Time uint32 Dlc byte Extend bool Data [64]byte // contains filtered or unexported fields }
RawFrame 这个结构和[RawFrameSize]byte一一对应, 和C lib部分一一对应
type TrueCanFdFrame ¶
type TrueCanFdFrame struct { ArbId uint32 Dlc byte Flags byte Data []byte // contains filtered or unexported fields }
TrueCanFdFrame 从can-utils里看到的真实fd帧结构体, 到时write的时候按照这个位置进行写入
type TrueCanFrame ¶
type TrueCanFrame struct { ArbId uint32 Dlc byte Data []byte // contains filtered or unexported fields }
TrueCanFrame
1.从can-utils里看到的真实can帧结构体, 到时write的时候按照这个位置进行写入
2.从socketcan里看感觉并不是这个结构, 而是和TrueCanFdFrame一样的结构 这样看来可以直接混合写入了
Click to show internal directories.
Click to hide internal directories.