Documentation
¶
Index ¶
Constants ¶
View Source
const ( MNT_Start = "start" MNT_Stop = "stop" MNT_Preop = "preop" MNT_ResetNode = "reset node" MNT_ResetComm = "reset comm" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CANOpenClient ¶
type CANOpenClient struct {
// contains filtered or unexported fields
}
CANOpenClient 代表 CANOpen 客户端
func NewCANOpenClient ¶
func NewCANOpenClient(host string, port int, timeout time.Duration) *CANOpenClient
NewCANOpenClient 创建新的 CANOpen 客户端
func (*CANOpenClient) SendCommand ¶
func (c *CANOpenClient) SendCommand(cmd Command) (CommandResult, error)
SendCommand 发送单条命令,支持重试
func (*CANOpenClient) SendMultipleCommands ¶
func (c *CANOpenClient) SendMultipleCommands(commands []Command) []CommandResult
SendMultipleCommands 并发发送多条命令
type Command ¶
type Command struct {
CommandID int // 唯一标识符
NodeID int
Index int
SubIndex int
DataType dataType
Content string // 指令内容,如 "[1] r 1000 0"
Timeout time.Duration // 命令超时
MaxRetries int // 最大重试次数
}
Command 代表一条 CANOpen 指令
func ReadSDO ¶
func ReadSDO(cmdID int, nodeID, index, subindex int, dataType dataType, timeout time.Duration, retries int) Command
ReadSDO 生成读取 SDO 的命令
func SetNMTState ¶
SetNMTState 生成设置 NMT 状态的命令
type CommandResult ¶
CommandResult 代表指令执行结果
Click to show internal directories.
Click to hide internal directories.