类 SoE
java.lang.Object
com.darra.ethercat.slave.SoE
- 所有已实现的接口:
IMailboxProtocol
SoE (Servo over EtherCAT) 完整实现
对齐 C# SoEInstance: IDN 读写、类型化读取、命令执行、参数信息、通知
-
嵌套类概要
嵌套类修饰符和类型类说明static classSERCOS IDN 解码结果 / decoded SERCOS IDN triple.static interface通知回调接口static classSoE IDN 映射条目static classSoE AT/MDT 映射信息static classSoE 属性结构static final classSoE Element Flags 位掩码常量 (对齐 C# enum SoEElementFlags).static classSoE Emergency 事件参数 / SoE Emergency event args (OpCode=6, ETG.1020).static interface[2026-04-24 C# Sync] SoE Emergency 监听器 (OpCode=6).static classSoE 专用异常static classSoE 通知事件参数static interface[2026-04-24 C# Sync] SoE 通知监听器别名 (与 C# SoENotificationListener 对齐).static classSoE 参数信息static classSoE 协议异常, 承载最后一次 SoE 错误码.static classSoE 标准 IDN 常量 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明voidaddEmergencyListener(SoE.SoEEmergencyListener listener) [2026-04-24 C# Sync] 注册 SoE Emergency 监听器 (OpCode=6).void注册通知监听器static SoE.IdnTripledecodeIdn(short idn) 将 16 位 IDN 解码为 (Standard?protected Executor默认 Executor, 子类或用户可覆盖以使用自定义线程池 (Default Executor, subclass or user can override for custom thread pool)void禁用所有通知voidDisableNotification(short idn) 禁用指定 IDN 的通知voiddispatchHardwareEmergency(short errorCode) 硬件 Emergency 分发入口 / hardware Emergency dispatch entry.voiddispatchHardwareNotification(short idn, byte elementFlags, byte[] newValue) 硬件 Notification 分发入口 / hardware Notification dispatch entry.booleanEnableNotification(short idn) booleanEnableNotification(short idn, int timeoutMs) 启用指定 IDN 的参数变化通知static shortencodeIdn(boolean isStandard, byte parameterSet, short dataBlock) 将 (Standard?booleanExecuteCommand(short idn) booleanExecuteCommand(short idn, int timeoutMs, int pollIntervalMs) 执行 SoE 程序命令 (SERCOS Procedure Command)static StringFormatByteArray(byte[] data) 字节数组格式化为十六进制字符串 对应 C# FormatByteArraystatic StringFormatByteArray(byte[] data, int dataType) 根据数据类型智能格式化字节数组GetAllDriveMappings(int timeoutMs) 获取所有驱动器的映射GetAvailableIDNs(int timeoutMs) 获取该驱动器支持的所有 IDN 列表GetIDNMapping(int timeoutMs) 读取 AT/MDT 映射配置long最近一次 SoE Error Code.获取最后一次操作的SoE错误码最后一次邮箱事务的统一状态.获取正在监控的 IDN 列表GetParameterInfo(short idn) GetParameterInfo(short idn, int timeoutMs) 获取指定 IDN 的详细参数信息协议名称 ("CoE" / "FoE" / "SoE" / "AoE" / "EoE" / "VoE" / "FSoE").byte协议类型 (ECT_MBXT_*): AoE=0x01, EoE=0x02, CoE=0x03, FoE=0x04, SoE=0x05, FSoE=0x08, VoE=0x0F.邮箱统计快照.boolean从站是否支持 SoE 邮箱协议.intintPollNotifications(int timeoutMs) 轮询检测已监控 IDN 的变化byte[]Read(short idn) byte[]Read(short idn, byte elementFlags, int timeoutMs) 读取 IDN 参数 (原始字节)批量读取常见 SoE 参数 遍历标准 Sercos IDN 子集,跳过读取失败的条目ReadAllParameters(int timeoutMs) 批量读取常见 SoE 参数CompletableFuture<byte[]> readAsync(short idn) 异步读取 IDN (默认 elementFlags=0x40, 默认超时) (Async read IDN with default flags/timeout)CompletableFuture<byte[]> readAsync(short idn, byte elementFlags, int timeoutMs) 异步读取 IDN (Asynchronously read IDN).ReadDataState(short idn) ReadDataState(short idn, int timeoutMs) 读取 IDN 的 Data State (Element 0x01)byte[]ReadDefaultValue(short idn) 读取默认值 (ElementFlag 0x80)ReadDouble(short idn) ReadFloat(short idn) ReadInt16(short idn) ReadInt16(short idn, byte elementFlags, int timeoutMs) ReadInt32(short idn) ReadInt32(short idn, byte elementFlags, int timeoutMs) byte[]ReadMaxValue(short idn) 读取最大值 (ElementFlag 0x20)byte[]ReadMinValue(short idn) 读取最小值 (ElementFlag 0x10)ReadName(short idn) ReadName(short idn, int timeoutMs) 读取参数名称 (ElementFlag 0x02) (2026-05-08: 对齐 C# SoE.cs:554 严格 UTF-8 → ASCII → Latin-1 兜底)ReadParameter(short idn) 读取单个 SoE 参数的元信息与当前值ReadParameter(short idn, int timeoutMs) 读取单个 SoE 参数的元信息与当前值ReadString(short idn) ReadUInt16(short idn) ReadUInt32(short idn) ReadUnit(short idn) ReadUnit(short idn, int timeoutMs) 读取参数单位 (ElementFlag 0x08) (2026-05-08: 对齐 C# SoE.cs:564 严格 UTF-8 → ASCII → Latin-1 兜底)void移除 SoE Emergency 监听器 / remove an Emergency listener.void重置邮箱统计.static ShorttryParseSercosIdn(String text) 解析 SERCOS IDN 字符串 ("S-0-0040" / "P-1-0123") 为 16 位 IDN.booleanWrite(short idn, byte[] data) booleanWrite(short idn, byte[] data, byte elementFlags, int timeoutMs) 写入 IDN 参数writeAsync(short idn, byte[] data) 异步写入 IDN (默认 elementFlags=0x40, 默认超时) (Async write IDN with default flags/timeout)writeAsync(short idn, byte[] data, byte elementFlags, int timeoutMs) 异步写入 IDN (Asynchronously write IDN).booleanWriteInt16(short idn, short value) booleanWriteInt32(short idn, int value) booleanWriteParameter(short idn, byte[] value) 写入 SoE 参数booleanWriteParameter(short idn, byte[] value, int timeoutMs) 写入 SoE 参数booleanWriteUInt16(short idn, int value) booleanWriteUInt32(short idn, long value)
-
构造器详细资料
-
SoE
public SoE(short masterIndex, short slaveIndex, byte driveNumber) -
SoE
public SoE(short masterIndex, short slaveIndex)
-
-
方法详细资料
-
getLastSoEError
获取最后一次操作的SoE错误码 -
getProtocolType
public byte getProtocolType()从接口复制的说明:IMailboxProtocol协议类型 (ECT_MBXT_*): AoE=0x01, EoE=0x02, CoE=0x03, FoE=0x04, SoE=0x05, FSoE=0x08, VoE=0x0F.
Protocol type constant (ECT_MBXT_*).- 指定者:
getProtocolType在接口中IMailboxProtocol- 返回:
- 协议类型 0x05 (SoE).
-
getProtocolName
从接口复制的说明:IMailboxProtocol协议名称 ("CoE" / "FoE" / "SoE" / "AoE" / "EoE" / "VoE" / "FSoE").
Protocol name literal.- 指定者:
getProtocolName在接口中IMailboxProtocol- 返回:
- 协议名称 "SoE".
-
isSupported
public boolean isSupported()从站是否支持 SoE 邮箱协议.
Whether the slave supports SoE.- 指定者:
isSupported在接口中IMailboxProtocol
-
getLastStatus
从接口复制的说明:IMailboxProtocol最后一次邮箱事务的统一状态. 初始为MailboxStatus.PENDING.
Status of the most recent mailbox transaction; initial value isMailboxStatus.PENDING.- 指定者:
getLastStatus在接口中IMailboxProtocol- 返回:
- 最近一次邮箱事务状态.
-
getLastErrorCode
public long getLastErrorCode()最近一次 SoE Error Code.
Last SoE protocol error code.- 指定者:
getLastErrorCode在接口中IMailboxProtocol
-
getStatistics
邮箱统计快照.
Mailbox statistics snapshot.[审计补齐 roundSDKSAN2] 经真实导出的 native EcxMbxGetStats 拉取.
- 指定者:
getStatistics在接口中IMailboxProtocol
-
resetStatistics
public void resetStatistics()重置邮箱统计.
Reset mailbox statistics.[审计补齐 roundSDKSAN2] 真调 native EcxMbxResetStats 重置统计.
- 指定者:
resetStatistics在接口中IMailboxProtocol
-
Read
public byte[] Read(short idn, byte elementFlags, int timeoutMs) 读取 IDN 参数 (原始字节)- 参数:
idn- IDN 编号elementFlags- 元素标志 (默认 0x40=读取值)timeoutMs- 超时 (毫秒)
-
Read
public byte[] Read(short idn) -
Write
public boolean Write(short idn, byte[] data, byte elementFlags, int timeoutMs) 写入 IDN 参数 -
Write
public boolean Write(short idn, byte[] data) -
defaultExecutor
默认 Executor, 子类或用户可覆盖以使用自定义线程池 (Default Executor, subclass or user can override for custom thread pool) -
readAsync
异步读取 IDN (Asynchronously read IDN).- 参数:
idn- IDN 编号 (IDN number)elementFlags- 元素标志 (element flags, default 0x40 = value)timeoutMs- 超时毫秒 (timeout ms)- 返回:
- 包含响应字节的 CompletableFuture (CompletableFuture with response bytes)
- 抛出:
SoE.SoEProtocolException- 读取失败 (SoE read failure)
-
readAsync
异步读取 IDN (默认 elementFlags=0x40, 默认超时) (Async read IDN with default flags/timeout) -
writeAsync
public CompletableFuture<Boolean> writeAsync(short idn, byte[] data, byte elementFlags, int timeoutMs) 异步写入 IDN (Asynchronously write IDN).- 参数:
idn- IDN 编号 (IDN number)data- 数据字节 (payload bytes)elementFlags- 元素标志 (element flags)timeoutMs- 超时毫秒 (timeout ms)- 返回:
- 成功为 true 的 CompletableFuture (CompletableFuture resolving to true on success)
- 抛出:
SoE.SoEProtocolException- 写入失败 (SoE write failure)
-
writeAsync
异步写入 IDN (默认 elementFlags=0x40, 默认超时) (Async write IDN with default flags/timeout) -
ReadInt16
-
ReadInt16
-
ReadInt32
-
ReadInt32
-
ReadUInt16
-
ReadUInt32
-
ReadFloat
-
ReadDouble
-
ReadString
-
ReadName
读取参数名称 (ElementFlag 0x02) (2026-05-08: 对齐 C# SoE.cs:554 严格 UTF-8 → ASCII → Latin-1 兜底) -
ReadName
-
ReadUnit
读取参数单位 (ElementFlag 0x08) (2026-05-08: 对齐 C# SoE.cs:564 严格 UTF-8 → ASCII → Latin-1 兜底) -
ReadUnit
-
ReadMinValue
public byte[] ReadMinValue(short idn) 读取最小值 (ElementFlag 0x10) -
ReadMaxValue
public byte[] ReadMaxValue(short idn) 读取最大值 (ElementFlag 0x20) -
ReadDefaultValue
public byte[] ReadDefaultValue(short idn) 读取默认值 (ElementFlag 0x80) -
WriteInt16
public boolean WriteInt16(short idn, short value) -
WriteInt32
public boolean WriteInt32(short idn, int value) -
WriteUInt16
public boolean WriteUInt16(short idn, int value) -
WriteUInt32
public boolean WriteUInt32(short idn, long value) -
ExecuteCommand
public boolean ExecuteCommand(short idn, int timeoutMs, int pollIntervalMs) 执行 SoE 程序命令 (SERCOS Procedure Command)- 参数:
idn- 命令 IDN 编号timeoutMs- 超时 (毫秒)pollIntervalMs- 轮询间隔 (毫秒)- 返回:
- 是否成功
-
ExecuteCommand
public boolean ExecuteCommand(short idn) -
GetAvailableIDNs
获取该驱动器支持的所有 IDN 列表 -
GetAvailableIDNs
-
GetParameterInfo
获取指定 IDN 的详细参数信息 -
GetParameterInfo
-
ReadDataState
读取 IDN 的 Data State (Element 0x01) -
ReadDataState
-
GetIDNMapping
读取 AT/MDT 映射配置 -
GetIDNMapping
-
GetAllDriveMappings
获取所有驱动器的映射 -
GetAllDriveMappings
-
addNotificationListener
注册通知监听器 -
addEmergencyListener
[2026-04-24 C# Sync] 注册 SoE Emergency 监听器 (OpCode=6).
Register an SoE Emergency listener (dispatched from DLL OpCode=6). -
removeEmergencyListener
移除 SoE Emergency 监听器 / remove an Emergency listener. -
dispatchHardwareNotification
public void dispatchHardwareNotification(short idn, byte elementFlags, byte[] newValue) 硬件 Notification 分发入口 / hardware Notification dispatch entry. 由 MasterEvents 在 DLL 回调线程上调用, 将事件投递到已注册监听器.
Called by MasterEvents from the native callback thread; forwards to registered notification listeners. -
dispatchHardwareEmergency
public void dispatchHardwareEmergency(short errorCode) 硬件 Emergency 分发入口 / hardware Emergency dispatch entry. 由 MasterEvents 在 DLL OpCode=6 回调时调用.
Called by MasterEvents on DLL OpCode=6 callback. -
EnableNotification
public boolean EnableNotification(short idn, int timeoutMs) 启用指定 IDN 的参数变化通知 -
EnableNotification
public boolean EnableNotification(short idn) -
DisableNotification
public void DisableNotification(short idn) 禁用指定 IDN 的通知 -
DisableAllNotifications
public void DisableAllNotifications()禁用所有通知 -
GetMonitoredIDNs
获取正在监控的 IDN 列表 -
PollNotifications
public int PollNotifications(int timeoutMs) 轮询检测已监控 IDN 的变化- 返回:
- 检测到变化的数量
-
PollNotifications
public int PollNotifications() -
ReadAllParameters
批量读取常见 SoE 参数 遍历标准 Sercos IDN 子集,跳过读取失败的条目- 返回:
- 成功读取到的参数列表
-
ReadAllParameters
批量读取常见 SoE 参数- 参数:
timeoutMs- 每个 IDN 的读取超时 (毫秒)- 返回:
- 成功读取到的参数列表
-
ReadParameter
读取单个 SoE 参数的元信息与当前值- 参数:
idn- 参数 IDN- 返回:
- SoEParameter 实例
-
ReadParameter
读取单个 SoE 参数的元信息与当前值- 参数:
idn- 参数 IDNtimeoutMs- 超时 (毫秒)- 返回:
- SoEParameter 实例
-
WriteParameter
public boolean WriteParameter(short idn, byte[] value) 写入 SoE 参数- 参数:
idn- 参数 IDNvalue- 要写入的字节数据- 返回:
- 写入成功返回 true
-
WriteParameter
public boolean WriteParameter(short idn, byte[] value, int timeoutMs) 写入 SoE 参数- 参数:
idn- 参数 IDNvalue- 要写入的字节数据timeoutMs- 超时 (毫秒)- 返回:
- 写入成功返回 true
-
FormatByteArray
字节数组格式化为十六进制字符串 对应 C# FormatByteArray- 参数:
data- 字节数组- 返回:
- 格式化后的十六进制字符串
-
encodeIdn
public static short encodeIdn(boolean isStandard, byte parameterSet, short dataBlock) 将 (Standard?, Set, Block) 三元组编码为 16 位 IDN (对齐 DLL SoEIdnEncode).
Encode (Standard?, Set, Block) into a 16-bit SERCOS IDN.- 参数:
isStandard- true = S-x-xxxx 标准 IDN, false = P-x-xxxx 厂商 IDNparameterSet- 参数集 0..7 (3 bit)dataBlock- 数据块编号 0..4095 (12 bit)- 返回:
- 16 位 IDN, 与 DLL SoEIdnEncode 输出完全一致
-
decodeIdn
将 16 位 IDN 解码为 (Standard?, Set, Block) 三元组 (对齐 DLL SoEIdnDecode).
Decode a 16-bit SERCOS IDN. -
tryParseSercosIdn
解析 SERCOS IDN 字符串 ("S-0-0040" / "P-1-0123") 为 16 位 IDN.
Parse a SERCOS IDN string. Returns null on malformed input. -
FormatByteArray
根据数据类型智能格式化字节数组- 参数:
data- 字节数组dataType- 0=Binary, 1=UInt, 2=Int, 3=Hex, 4=String, 6=Float- 返回:
- 格式化字符串
-