can

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 11, 2023 License: BSD-2-Clause Imports: 2 Imported by: 3

Documentation

Overview

@@ @ Author : Eacher @ Date : 2023-09-06 10:48:53 @ LastEditTime : 2023-09-11 08:01:05 @ LastEditors : Eacher @ --------------------------------------------------------------------------------< @ Description : @ --------------------------------------------------------------------------------< @ FilePath : /20yyq/packet/can/frame.go @@

Index

Constants

View Source
const (
	// SocketCAN frame 最大 bytes 长度
	CanFrameLength = 0x10
	// SocketCAN frame 数据最大 bytes 长度
	CanDataLength = 0x08
	// SocketCANFD frame 最大 bytes 长度
	CanFDFrameLength = 0x48
	// SocketCANFD frame 数据最大 bytes 长度
	CanFDDataLength = 0x40

	FlagExtended = 0x80000000
	FlagRemote   = 0x40000000
	FlagError    = 0x20000000
	MaxExtended  = 0x1FFFFFFF
	MaxStandard  = 0x7FF
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Frame

type Frame struct {
	Len   uint8
	Flags uint8
	Res0  uint8
	Res1  uint8
	Data  [CanFDDataLength]byte

	CanFd    bool
	Extended bool
	Remote   bool
	Error    bool
	// contains filtered or unexported fields
}
struct canfd_frame {
        canid_t can_id;  /* 32 bit CAN_ID + EFF/RTR/ERR flags */
        __u8    len;     /* frame payload length in byte (0 .. 64) */
        __u8    flags;   /* additional flags for CAN FD */
        __u8    __res0;  /* reserved / padding */
        __u8    __res1;  /* reserved / padding */
        __u8    data[64] __attribute__((aligned(8)));
};

func NewCanFDFrame added in v0.1.2

func NewCanFDFrame(b [CanFDFrameLength]byte) (f Frame)

func NewCanFrame added in v0.1.2

func NewCanFrame(b [CanFrameLength]byte) (f Frame)

func (Frame) ID

func (f Frame) ID() uint32

func (*Frame) SetID

func (f *Frame) SetID(id uint32) error

func (Frame) String

func (f Frame) String() string

func (Frame) WireFormat

func (f Frame) WireFormat() []byte

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL