nocan

package
v0.0.0-...-947ae56 Latest Latest
Warning

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

Go to latest
Published: May 26, 2021 License: MIT Imports: 3 Imported by: 3

Documentation

Index

Constants

View Source
const (
	MAX_NODE_N           = 128
	NOCANID_MASK_FIRST   = (1 << 28)
	NOCANID_MASK_LAST    = (1 << 20)
	NOCANID_MASK_SYSTEM  = (1 << 18)
	NOCANID_MASK_MESSAGE = ^(uint32((1 << 28) | (1 << 20)))
)
View Source
const (
	DEFAULT_TIMEOUT  = 3 * time.Second
	EXTENDED_TIMEOUT = 12 * time.Second
)
View Source
const (
	UNDEFINED_NODE    NodeId    = NodeId(-1)
	UNDEFINED_CHANNEL ChannelId = ChannelId(0xFFFF)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ChannelId

type ChannelId uint16

func (ChannelId) ToBytes

func (cid ChannelId) ToBytes() []byte

type Message

type Message struct {
	CanId uint32
	Dlc   uint8
	Data  [64]byte
}

func NewMessage

func NewMessage(id uint32, data []byte) *Message

func NewPublishMessage

func NewPublishMessage(node NodeId, channel ChannelId, data []byte) *Message

func NewSystemMessage

func NewSystemMessage(node NodeId, fn MessageType, param uint8, data []byte) *Message

func (*Message) AppendData

func (m *Message) AppendData(data []byte) bool

func (*Message) Bytes

func (m *Message) Bytes() []byte

func (*Message) ChannelId

func (m *Message) ChannelId() ChannelId

func (*Message) DataToString

func (m *Message) DataToString() string

func (*Message) IsSystemMessage

func (m *Message) IsSystemMessage() bool

func (*Message) NodeId

func (m *Message) NodeId() NodeId

func (*Message) SetChannelId

func (m *Message) SetChannelId(cid ChannelId) *Message

func (*Message) SetNodeId

func (m *Message) SetNodeId(nodeid NodeId) *Message

func (*Message) SetSystemFunctionParam

func (m *Message) SetSystemFunctionParam(fn MessageType, pr uint8) *Message

func (*Message) String

func (m *Message) String() string

func (*Message) SystemFunctionParam

func (m *Message) SystemFunctionParam() (MessageType, uint8)

func (*Message) SystemParam

func (m *Message) SystemParam() uint8

type MessageType

type MessageType byte
const (
	PUBLISH                          MessageType = iota
	SYS_ADDRESS_REQUEST                          //= 1
	SYS_ADDRESS_CONFIGURE                        //= 2
	SYS_ADDRESS_CONFIGURE_ACK                    //= 3
	SYS_ADDRESS_LOOKUP                           //= 4
	SYS_ADDRESS_LOOKUP_ACK                       //= 5
	SYS_NODE_BOOT_REQUEST                        //= 6
	SYS_NODE_BOOT_ACK                            //= 7
	SYS_NODE_PING                                //= 8
	SYS_NODE_PING_ACK                            //= 9
	SYS_CHANNEL_REGISTER                         //= 10
	SYS_CHANNEL_REGISTER_ACK                     //= 11
	SYS_CHANNEL_UNREGISTER                       //= 12
	SYS_CHANNEL_UNREGISTER_ACK                   //= 13
	SYS_CHANNEL_SUBSCRIBE                        //= 14
	SYS_CHANNEL_UNSUBSCRIBE                      //= 15
	SYS_CHANNEL_LOOKUP                           //= 16
	SYS_CHANNEL_LOOKUP_ACK                       //= 17
	SYS_BOOTLOADER_GET_SIGNATURE                 //= 18
	SYS_BOOTLOADER_GET_SIGNATURE_ACK             //= 19
	SYS_BOOTLOADER_SET_ADDRESS                   //= 20
	SYS_BOOTLOADER_SET_ADDRESS_ACK               //= 21
	SYS_BOOTLOADER_WRITE                         //= 22
	SYS_BOOTLOADER_WRITE_ACK                     //= 23
	SYS_BOOTLOADER_READ                          //= 24
	SYS_BOOTLOADER_READ_ACK                      //= 25
	SYS_BOOTLOADER_LEAVE                         //= 26
	SYS_BOOTLOADER_LEAVE_ACK                     //= 27
	SYS_BOOTLOADER_ERASE                         //= 28
	SYS_BOOTLOADER_ERASE_ACK                     //= 29
	SYS_RESERVED                                 //= 30
	SYS_DEBUG_MESSAGE                            //= 31
	MESSAGE_TYPE_COUNT
)

func (MessageType) String

func (mt MessageType) String() string

type NodeId

type NodeId int8

Jump to

Keyboard shortcuts

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