类 AoE
java.lang.Object
com.darra.ethercat.slave.AoE
- 所有已实现的接口:
IMailboxProtocol
AoE (ADS over EtherCAT) 完整实现
对齐 C# AoEInstance: Read/Write/ReadWrite/SendCommand + 订阅管理 + SetConfig/GetConfig
-
嵌套类概要
嵌套类修饰符和类型类说明static classADS 状态结果static classAoE 配置结果static classAoE 协议异常 (AoE protocol exception).static enumAoE 结果错误码 (ETG.1020 Table 16, 对齐 C# AoEResultCode).static class设备信息结果static interface订阅回调接口 -
字段概要
字段修饰符和类型字段说明static final intCoE (CANopen over EtherCAT) 路由 IndexGroupstatic final intSoE (Servo over EtherCAT) 路由 IndexGroup -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明protected Executor默认 Executor, 子类或用户可覆盖以使用自定义线程池 (Default Executor, subclass or user can override for custom thread pool)int[]获取所有活跃的 AoE 订阅列表 对应 C# GetActiveSubscriptionsstatic StringGetAdsStateDescription(int adsState) ADS 状态码描述 对应 C# GetAdsStateDescription获取 AoE 配置 (NetId 和 Port) 对齐 C# AoEInstance.GetConfiglong最近一次 AoE/ADS 错误码.最后一次邮箱事务的统一状态.协议名称 ("CoE" / "FoE" / "SoE" / "AoE" / "EoE" / "VoE" / "FSoE").byte协议类型 (ECT_MBXT_*): AoE=0x01, EoE=0x02, CoE=0x03, FoE=0x04, SoE=0x05, FSoE=0x08, VoE=0x0F.邮箱统计快照.booleanInitializeSlaveNetId(byte[] netId) booleanInitializeSlaveNetId(byte[] netId, int timeoutUs) 初始化从站 AoE Net ID (ETG.1020 §9.4) 在 IP→PreOp 状态切换期间调用,将 Net ID 写入从站 ADS 路由表。boolean从站是否支持 AoE 邮箱协议.byte[]Read(int indexGroup, int indexOffset, int length) byte[]Read(int indexGroup, int indexOffset, int length, int timeoutUs) 便捷读操作CompletableFuture<byte[]> readAsync(int indexGroup, int indexOffset, int length) 异步 ADS 读取 (默认超时) (Async ADS read with default timeout)CompletableFuture<byte[]> readAsync(int indexGroup, int indexOffset, int length, int timeoutUs) 异步 ADS 读取 (Asynchronously ADS read).byte[]ReadCoEViaAoE(int index, int subindex, int readLength) byte[]ReadCoEViaAoE(int index, int subindex, int readLength, int timeoutUs) 通过 AoE 路由读取 CoE 对象 (IndexGroup=0xF302) IndexOffset 编码: (index 无效输入:'<'无效输入:'<' 16) | subindexReadDeviceInfo(int timeoutUs) 读取设备信息 (Command 0x01)byte[]ReadSoEViaAoE(int idn, int readLength) byte[]ReadSoEViaAoE(int idn, int readLength, int timeoutUs) 通过 AoE 路由读取 SoE IDN (IndexGroup=0xF420) IndexOffset 编码: IDN 编号ReadState(int timeoutUs) 读取 ADS 状态 (Command 0x04)byte[]ReadWrite(int indexGroup, int indexOffset, int readLength, byte[] writeData, int timeoutUs) ADS ReadWrite 操作CompletableFuture<byte[]> readWriteAsync(int indexGroup, int indexOffset, int readLength, byte[] writeData, int timeoutUs) 异步 ADS ReadWrite (Asynchronously ADS read-write).void重置邮箱统计.byte[]SendCommand(short targetPort, short commandId, byte[] commandData, int timeoutUs) 发送 ADS 命令booleanSetConfig(byte[] targetNetId, short targetPort, byte[] sourceNetId, short sourcePort) 设置 AoE 配置 (NetId 和 Port) 对齐 C# AoEInstance.SetConfigintSubscribe(int indexGroup, int indexOffset, int dataLength, AoE.NotificationCallback callback, int cycleTimeMs) 添加通知订阅booleanUnsubscribe(int handle) 取消订阅void取消所有订阅booleanWrite(int indexGroup, int indexOffset, byte[] data) booleanWrite(int indexGroup, int indexOffset, byte[] data, int timeoutUs) 便捷写操作writeAsync(int indexGroup, int indexOffset, byte[] data) 异步 ADS 写入 (默认超时) (Async ADS write with default timeout)writeAsync(int indexGroup, int indexOffset, byte[] data, int timeoutUs) 异步 ADS 写入 (Asynchronously ADS write).booleanWriteCoEViaAoE(int index, int subindex, byte[] data) booleanWriteCoEViaAoE(int index, int subindex, byte[] data, int timeoutUs) 通过 AoE 路由写入 CoE 对象 (IndexGroup=0xF302) IndexOffset 编码: (index 无效输入:'<'无效输入:'<' 16) | subindexbooleanWriteControl(short adsState, short deviceState) booleanWriteControl(short adsState, short deviceState, byte[] data, int timeoutUs) 写入控制命令 (Command 0x05)booleanWriteSoEViaAoE(int idn, byte[] data) booleanWriteSoEViaAoE(int idn, byte[] data, int timeoutUs) 通过 AoE 路由写入 SoE IDN (IndexGroup=0xF420) IndexOffset 编码: IDN 编号
-
字段详细资料
-
COE_INDEX_GROUP
public static final int COE_INDEX_GROUPCoE (CANopen over EtherCAT) 路由 IndexGroup- 另请参阅:
-
SOE_INDEX_GROUP
public static final int SOE_INDEX_GROUPSoE (Servo over EtherCAT) 路由 IndexGroup- 另请参阅:
-
-
构造器详细资料
-
AoE
public AoE(short masterIndex, short slaveIndex)
-
-
方法详细资料
-
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- 返回:
- 协议类型 0x01 (AoE).
-
getProtocolName
从接口复制的说明:IMailboxProtocol协议名称 ("CoE" / "FoE" / "SoE" / "AoE" / "EoE" / "VoE" / "FSoE").
Protocol name literal.- 指定者:
getProtocolName在接口中IMailboxProtocol- 返回:
- 协议名称 "AoE".
-
isSupported
public boolean isSupported()从站是否支持 AoE 邮箱协议.
Whether the slave supports AoE.- 指定者:
isSupported在接口中IMailboxProtocol
-
getLastStatus
从接口复制的说明:IMailboxProtocol最后一次邮箱事务的统一状态. 初始为MailboxStatus.PENDING.
Status of the most recent mailbox transaction; initial value isMailboxStatus.PENDING.- 指定者:
getLastStatus在接口中IMailboxProtocol- 返回:
- 最近一次邮箱事务状态.
-
getLastErrorCode
public long getLastErrorCode()最近一次 AoE/ADS 错误码.
Last AoE/ADS 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
-
ReadWrite
public byte[] ReadWrite(int indexGroup, int indexOffset, int readLength, byte[] writeData, int timeoutUs) ADS ReadWrite 操作- 参数:
indexGroup- 索引组indexOffset- 索引偏移readLength- 读取长度 (0=纯写入)writeData- 写入数据 (null=只读)timeoutUs- 超时 (微秒)- 返回:
- 读取数据, 失败返回 null
-
Read
public byte[] Read(int indexGroup, int indexOffset, int length, int timeoutUs) 便捷读操作 -
Read
public byte[] Read(int indexGroup, int indexOffset, int length) -
Write
public boolean Write(int indexGroup, int indexOffset, byte[] data, int timeoutUs) 便捷写操作 -
Write
public boolean Write(int indexGroup, int indexOffset, byte[] data) -
defaultExecutor
默认 Executor, 子类或用户可覆盖以使用自定义线程池 (Default Executor, subclass or user can override for custom thread pool) -
readAsync
public CompletableFuture<byte[]> readAsync(int indexGroup, int indexOffset, int length, int timeoutUs) 异步 ADS 读取 (Asynchronously ADS read).- 参数:
indexGroup- 索引组 (index group)indexOffset- 索引偏移 (index offset)length- 读取长度 (length in bytes)timeoutUs- 超时微秒 (timeout in microseconds)- 返回:
- 包含响应字节的 CompletableFuture (CompletableFuture with response bytes)
- 抛出:
AoE.AoEProtocolException- 读取失败 (AoE read failure)
-
readAsync
异步 ADS 读取 (默认超时) (Async ADS read with default timeout) -
writeAsync
public CompletableFuture<Boolean> writeAsync(int indexGroup, int indexOffset, byte[] data, int timeoutUs) 异步 ADS 写入 (Asynchronously ADS write).- 参数:
indexGroup- 索引组 (index group)indexOffset- 索引偏移 (index offset)data- 数据字节 (payload bytes)timeoutUs- 超时微秒 (timeout in microseconds)- 返回:
- 成功为 true 的 CompletableFuture (CompletableFuture resolving to true on success)
- 抛出:
AoE.AoEProtocolException- 写入失败 (AoE write failure)
-
writeAsync
异步 ADS 写入 (默认超时) (Async ADS write with default timeout) -
readWriteAsync
public CompletableFuture<byte[]> readWriteAsync(int indexGroup, int indexOffset, int readLength, byte[] writeData, int timeoutUs) 异步 ADS ReadWrite (Asynchronously ADS read-write).- 参数:
indexGroup- 索引组 (index group)indexOffset- 索引偏移 (index offset)readLength- 读取长度 (read length, 0 = write-only)writeData- 写入数据 (write payload, null = read-only)timeoutUs- 超时微秒 (timeout in microseconds)- 返回:
- 包含读取响应字节的 CompletableFuture (CompletableFuture with read response bytes)
- 抛出:
AoE.AoEProtocolException- 操作失败 (AoE read-write failure)
-
ReadCoEViaAoE
public byte[] ReadCoEViaAoE(int index, int subindex, int readLength, int timeoutUs) 通过 AoE 路由读取 CoE 对象 (IndexGroup=0xF302) IndexOffset 编码: (index 无效输入:'<'无效输入:'<' 16) | subindex- 参数:
index- CoE 对象索引subindex- CoE 子索引readLength- 期望读取长度timeoutUs- 超时 (微秒)- 返回:
- 读取数据, 失败返回 null
-
ReadCoEViaAoE
public byte[] ReadCoEViaAoE(int index, int subindex, int readLength) -
WriteCoEViaAoE
public boolean WriteCoEViaAoE(int index, int subindex, byte[] data, int timeoutUs) 通过 AoE 路由写入 CoE 对象 (IndexGroup=0xF302) IndexOffset 编码: (index 无效输入:'<'无效输入:'<' 16) | subindex- 参数:
index- CoE 对象索引subindex- CoE 子索引data- 写入数据timeoutUs- 超时 (微秒)- 返回:
- 是否成功
-
WriteCoEViaAoE
public boolean WriteCoEViaAoE(int index, int subindex, byte[] data) -
ReadSoEViaAoE
public byte[] ReadSoEViaAoE(int idn, int readLength, int timeoutUs) 通过 AoE 路由读取 SoE IDN (IndexGroup=0xF420) IndexOffset 编码: IDN 编号- 参数:
idn- SoE IDN 编号readLength- 期望读取长度timeoutUs- 超时 (微秒)- 返回:
- 读取数据, 失败返回 null
-
ReadSoEViaAoE
public byte[] ReadSoEViaAoE(int idn, int readLength) -
WriteSoEViaAoE
public boolean WriteSoEViaAoE(int idn, byte[] data, int timeoutUs) 通过 AoE 路由写入 SoE IDN (IndexGroup=0xF420) IndexOffset 编码: IDN 编号- 参数:
idn- SoE IDN 编号data- 写入数据timeoutUs- 超时 (微秒)- 返回:
- 是否成功
-
WriteSoEViaAoE
public boolean WriteSoEViaAoE(int idn, byte[] data) -
InitializeSlaveNetId
public boolean InitializeSlaveNetId(byte[] netId, int timeoutUs) 初始化从站 AoE Net ID (ETG.1020 §9.4) 在 IP→PreOp 状态切换期间调用,将 Net ID 写入从站 ADS 路由表。 写入 IndexGroup=1, IndexOffset=3。- 参数:
netId- 6 字节的 AMS Net IDtimeoutUs- 超时 (微秒)- 返回:
- 是否成功
-
InitializeSlaveNetId
public boolean InitializeSlaveNetId(byte[] netId) -
SendCommand
public byte[] SendCommand(short targetPort, short commandId, byte[] commandData, int timeoutUs) 发送 ADS 命令 -
ReadDeviceInfo
读取设备信息 (Command 0x01) -
ReadDeviceInfo
-
ReadState
读取 ADS 状态 (Command 0x04) -
ReadState
-
WriteControl
public boolean WriteControl(short adsState, short deviceState, byte[] data, int timeoutUs) 写入控制命令 (Command 0x05) -
WriteControl
public boolean WriteControl(short adsState, short deviceState) -
SetConfig
public boolean SetConfig(byte[] targetNetId, short targetPort, byte[] sourceNetId, short sourcePort) 设置 AoE 配置 (NetId 和 Port) 对齐 C# AoEInstance.SetConfig- 参数:
targetNetId- 目标 AMS NetId (6 字节)targetPort- 目标 AMS PortsourceNetId- 源 AMS NetId (6 字节)sourcePort- 源 AMS Port- 返回:
- 成功返回 true
-
GetConfig
获取 AoE 配置 (NetId 和 Port) 对齐 C# AoEInstance.GetConfig- 返回:
- 配置信息, 失败时 Success=false
-
Subscribe
public int Subscribe(int indexGroup, int indexOffset, int dataLength, AoE.NotificationCallback callback, int cycleTimeMs) 添加通知订阅- 参数:
indexGroup- 索引组indexOffset- 索引偏移dataLength- 数据长度callback- 回调- 返回:
- 通知句柄, 失败返回 -1
-
Unsubscribe
public boolean Unsubscribe(int handle) 取消订阅 -
UnsubscribeAll
public void UnsubscribeAll()取消所有订阅 -
GetActiveSubscriptions
public int[] GetActiveSubscriptions()获取所有活跃的 AoE 订阅列表 对应 C# GetActiveSubscriptions- 返回:
- 活跃订阅数组
-
GetAdsStateDescription
ADS 状态码描述 对应 C# GetAdsStateDescription- 参数:
adsState- ADS 状态码- 返回:
- 状态描述字符串
-