类 EoE

java.lang.Object
com.darra.ethercat.slave.EoE
所有已实现的接口:
IMailboxProtocol

public class EoE extends Object implements IMailboxProtocol
EoE (Ethernet over EtherCAT) 实现 对齐 C# EoEInstance: IP/Subnet/Gateway/MAC/DNS 属性, 帧收发, 地址过滤器 注意: IP/Subnet/Gateway/DNS 使用 EOEGetIP/EOESetIP 结构体 API, 不存在 EOEGetIPString/EOESetIPString 等字符串版本的 DLL 导出
  • 字段详细资料

    • DEFAULT_TIMEOUT_MS

      public static final int DEFAULT_TIMEOUT_MS
      默认超时 (毫秒)
      另请参阅:
  • 构造器详细资料

    • EoE

      public EoE(short masterIndex, short slaveIndex, byte port)
    • EoE

      public EoE(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
      返回:
      协议类型 0x02 (EoE).
    • getProtocolName

      public String getProtocolName()
      从接口复制的说明: IMailboxProtocol
      协议名称 ("CoE" / "FoE" / "SoE" / "AoE" / "EoE" / "VoE" / "FSoE").
      Protocol name literal.
      指定者:
      getProtocolName 在接口中 IMailboxProtocol
      返回:
      协议名称 "EoE".
    • isSupported

      public boolean isSupported()
      从站是否支持 EoE 邮箱协议.
      Whether the slave supports EoE.
      指定者:
      isSupported 在接口中 IMailboxProtocol
    • getLastStatus

      public MailboxStatus getLastStatus()
      从接口复制的说明: IMailboxProtocol
      最后一次邮箱事务的统一状态. 初始为 MailboxStatus.PENDING.
      Status of the most recent mailbox transaction; initial value is MailboxStatus.PENDING.
      指定者:
      getLastStatus 在接口中 IMailboxProtocol
      返回:
      最近一次邮箱事务状态.
    • getLastErrorCode

      public long getLastErrorCode()
      从接口复制的说明: IMailboxProtocol
      最后一次邮箱事务的协议层错误码 (CoE=SDO Abort, FoE=FoE Error, SoE=SoE Error, 等). 0 表示无错误或不适用.
      Protocol-level error code of the last transaction (CoE SDO abort, FoE error code, SoE error, etc.). Zero means no error or not applicable.
      指定者:
      getLastErrorCode 在接口中 IMailboxProtocol
      返回:
      最近一次协议层错误码.
    • getStatistics

      public MailboxStatistics getStatistics()
      邮箱统计快照.
      Mailbox statistics snapshot.

      [审计补齐 roundSDKSAN2] 经真实导出的 native EcxMbxGetStats 拉取.

      指定者:
      getStatistics 在接口中 IMailboxProtocol
    • resetStatistics

      public void resetStatistics()
      重置邮箱统计.
      Reset mailbox statistics.

      [审计补齐 roundSDKSAN2] 真调 native EcxMbxResetStats 重置统计.

      指定者:
      resetStatistics 在接口中 IMailboxProtocol
    • IP

      public String IP()
      IP 地址 (点分十进制字符串) - 读取
    • IP

      public void IP(String ip)
      IP 地址 - 写入
    • Subnet

      public String Subnet()
      子网掩码 - 读取
    • Subnet

      public void Subnet(String subnet)
      子网掩码 - 写入
    • Gateway

      public String Gateway()
      网关 - 读取
    • Gateway

      public void Gateway(String gateway)
      网关 - 写入
    • MAC

      public String MAC()
      MAC 地址 (格式 AA:BB:CC:DD:EE:FF) - 读取
    • MAC

      public void MAC(String macString)
      MAC 地址 - 写入
    • DNS

      public String DNS()
      DNS 地址 - 读取 (以 IPv4 字符串返回, dnsName 作为辅助)
    • DNS

      public void DNS(String dns)
      DNS 地址 - 写入 (传入 IPv4 字符串)
    • SendFrame

      public boolean SendFrame(byte[] frame, int timeoutMs)
      发送以太网帧
      参数:
      frame - 帧数据
      timeoutMs - 超时 (毫秒)
      返回:
      成功返回 true
    • SendFrame

      public boolean SendFrame(byte[] frame)
    • SendFrameWithTimestamp

      public boolean SendFrameWithTimestamp(byte[] frame, long timestamp, int timeoutMs)
      发送以太网帧 (附加时间戳) 对齐 C# EoEInstance.SendFrameWithTimestamp 在帧末尾附加 4 字节时间戳 (ETG.1000.6 Table 78, Unsigned32)
      参数:
      frame - 帧数据
      timestamp - DC 时间戳 (纳秒)
      timeoutMs - 超时 (毫秒)
      返回:
      成功返回 true
    • SendFrameWithTimestamp

      public boolean SendFrameWithTimestamp(byte[] frame, long timestamp)
      发送以太网帧 (附加时间戳, 默认超时)
    • ReceiveFrame

      public byte[] ReceiveFrame(int timeoutMs)
      接收以太网帧
      参数:
      timeoutMs - 超时 (毫秒)
      返回:
      帧数据, 失败返回 null
    • ReceiveFrame

      public byte[] ReceiveFrame()
    • ping

      public EoE.EoEPingResult ping(String targetIp, int timeoutMs, int ttl)
      通过 EoE 发送 ICMP Ping 并等待响应.
      参数:
      targetIp - 目标 IP (点分十进制)
      timeoutMs - 超时 (毫秒)
      ttl - IP TTL
      返回:
      Ping 结果
    • ping

      public EoE.EoEPingResult ping(String targetIp)
      Ping (默认 5s 超时, TTL=64).
    • pingAsync

      public CompletableFuture<EoE.EoEPingResult> pingAsync(String targetIp, int timeoutMs, int ttl)
      异步 Ping (对齐 C# PingAsync).
    • pingAsync

      public CompletableFuture<EoE.EoEPingResult> pingAsync(String targetIp)
    • setReceiveHook

      public boolean setReceiveHook(EoE.ReceiveHookListener listener)
      注册 EoE 异步接收 Hook (每 master 一个, 整库共用; 重复调用覆盖之前 listener).
      对齐 C# EoEInstance EOESetReceiveHook.
      参数:
      listener - 用户 listener; 传 null 等价 clearReceiveHook().
      返回:
      DLL 接受注册返回 true; DLL 未导出或失败返回 false.
    • clearReceiveHook

      public boolean clearReceiveHook()
      清除 EoE 异步接收 Hook.
    • defaultExecutor

      protected Executor defaultExecutor()
      默认 Executor, 子类或用户可覆盖以使用自定义线程池 (Default Executor, subclass or user can override for custom thread pool)
    • sendFrameAsync

      public CompletableFuture<Boolean> sendFrameAsync(byte[] frame, int timeoutMs)
      异步发送以太网帧 (Asynchronously send Ethernet frame).
      参数:
      frame - 帧字节数组 (frame bytes)
      timeoutMs - 超时毫秒 (timeout ms)
      返回:
      成功为 true 的 CompletableFuture (CompletableFuture resolving to true on success)
      抛出:
      EoE.EoEProtocolException - 发送失败 (EoE send failure)
    • sendFrameAsync

      public CompletableFuture<Boolean> sendFrameAsync(byte[] frame)
      异步发送帧 (默认超时) (Async send with default timeout)
    • receiveFrameAsync

      public CompletableFuture<byte[]> receiveFrameAsync(int timeoutMs)
      异步接收以太网帧 (Asynchronously receive Ethernet frame).
      参数:
      timeoutMs - 超时毫秒 (timeout ms)
      返回:
      包含帧字节的 CompletableFuture (CompletableFuture with frame bytes)
      抛出:
      EoE.EoEProtocolException - 接收失败 (EoE receive failure)
    • receiveFrameAsync

      public CompletableFuture<byte[]> receiveFrameAsync()
      异步接收帧 (默认超时) (Async receive with default timeout)
    • ClearAddressFilters

      public boolean ClearAddressFilters(int timeoutMs)
      清空所有地址过滤器
    • ClearAddressFilters

      public boolean ClearAddressFilters()
    • addAddressFilter

      public boolean addAddressFilter(byte[] mac, int timeoutMs)
      添加单个 MAC 地址到过滤器列表 先读取已有过滤器, 追加新地址后重新设置
      参数:
      mac - MAC 地址 (6 字节)
      timeoutMs - 超时 (毫秒)
      返回:
      是否成功
    • removeAddressFilter

      public boolean removeAddressFilter(byte[] mac, int timeoutMs)
      从过滤器列表中移除指定 MAC 地址
      参数:
      mac - MAC 地址 (6 字节)
      timeoutMs - 超时 (毫秒)
      返回:
      是否成功
    • getAddressFilters

      public List<byte[]> getAddressFilters(int timeoutMs)
      获取当前地址过滤器列表
      参数:
      timeoutMs - 超时 (毫秒)
      返回:
      MAC 地址列表 (每个 6 字节)
    • getAddressFilters

      public List<byte[]> getAddressFilters()