类 VoE

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

public class VoE extends Object implements IMailboxProtocol
VoE (Vendor specific over EtherCAT) 完整实现 对齐 C# VoEInstance: Send/Receive/SendAndReceive + Raw 帧操作 + 帧构建解析 + SendRawAndReceive + IsSupported
  • 字段详细资料

    • VOE_HEADER_SIZE

      public static final int VOE_HEADER_SIZE
      VoE 头部大小 (VendorID 4字节 + VendorType 2字节)
      另请参阅:
  • 构造器详细资料

    • VoE

      public VoE(short masterIndex, short slaveIndex)
  • 方法详细资料

    • DefaultTimeoutMs

      public int DefaultTimeoutMs()
    • DefaultTimeoutMs

      public void DefaultTimeoutMs(int value)
    • IsSupported

      public boolean IsSupported()
      检查从站是否支持 VoE 邮箱协议 (mbx_proto bit 5 = 0x0020) 对齐 C# VoEInstance.IsSupported
      返回:
      支持返回 true
    • 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
      返回:
      协议类型 0x0F (VoE).
    • getProtocolName

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

      public boolean isSupported()
      从站是否支持 VoE 邮箱协议 (委托给 IsSupported()).
      Whether the slave supports VoE (delegates to IsSupported()).
      指定者:
      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
    • Send

      public boolean Send(int vendorId, short vendorType, byte[] data, int timeoutMs)
      发送 VoE 数据到从站
    • Send

      public boolean Send(int vendorId, short vendorType, byte[] data)
    • Receive

      public VoE.VoEResponse Receive(int timeoutMs)
      从从站接收 VoE 数据
    • Receive

      public VoE.VoEResponse Receive()
    • SendAndReceive

      public VoE.VoEResponse SendAndReceive(int vendorId, short vendorType, byte[] data, int timeoutMs)
      发送并等待响应
    • SendAndReceive

      public VoE.VoEResponse SendAndReceive(int vendorId, short vendorType, byte[] data)
    • defaultExecutor

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

      public CompletableFuture<Boolean> sendAsync(int vendorId, short vendorType, byte[] data, int timeoutMs)
      异步发送 VoE 数据 (Asynchronously send VoE data).
      参数:
      vendorId - 厂商 ID (vendor ID)
      vendorType - 厂商类型 (vendor type)
      data - 数据字节 (payload bytes)
      timeoutMs - 超时毫秒 (timeout ms)
      返回:
      成功为 true 的 CompletableFuture (CompletableFuture resolving to true on success)
      抛出:
      VoE.VoEProtocolException - 发送失败 (VoE send failure)
    • sendAsync

      public CompletableFuture<Boolean> sendAsync(int vendorId, short vendorType, byte[] data)
      异步发送 (默认超时) (Async send with default timeout)
    • receiveAsync

      public CompletableFuture<VoE.VoEResponse> receiveAsync(int timeoutMs)
      异步接收 VoE 数据 (Asynchronously receive VoE data).
      参数:
      timeoutMs - 超时毫秒 (timeout ms)
      返回:
      包含 VoEResponse 的 CompletableFuture (CompletableFuture with VoEResponse)
      抛出:
      VoE.VoEProtocolException - 接收失败 (VoE receive failure)
    • receiveAsync

      public CompletableFuture<VoE.VoEResponse> receiveAsync()
      异步接收 (默认超时) (Async receive with default timeout)
    • sendAndReceiveAsync

      public CompletableFuture<VoE.VoEResponse> sendAndReceiveAsync(int vendorId, short vendorType, byte[] data, int timeoutMs)
      异步发送并接收响应 (Asynchronously send and receive response).
      参数:
      vendorId - 厂商 ID (vendor ID)
      vendorType - 厂商类型 (vendor type)
      data - 数据字节 (payload bytes)
      timeoutMs - 超时毫秒 (timeout ms)
      返回:
      包含 VoEResponse 的 CompletableFuture (CompletableFuture with VoEResponse)
      抛出:
      VoE.VoEProtocolException - 失败 (VoE exchange failure)
    • sendAndReceiveAsync

      public CompletableFuture<VoE.VoEResponse> sendAndReceiveAsync(int vendorId, short vendorType, byte[] data)
      异步发送并接收 (默认超时) (Async send-and-receive with default timeout)
    • StartNotificationListener

      public boolean StartNotificationListener()
      启动 VoE 监听线程 (Start VoE notification listener thread).

      对齐 C# VoEInstance.StartNotificationListener.

      FFI 路径: 调用 VOEStartNotificationListener + VOERegisterNotification; DLL 未导出 (UnsatisfiedLinkError) 时静默 fallback 返回 false.

      返回:
      真实启动成功返回 true; DLL 未导出或失败返回 false.
    • StopNotificationListener

      public void StopNotificationListener()
      停止本实例的 VoE 通知订阅 (Stop notification subscription for this instance).

      FFI 路径: 调用 VOEUnregisterNotification; DLL 未导出时静默 fallback.

    • stopAllListeners

      public static void stopAllListeners()
      停止整个 master 的 VoE 监听线程 (Stop all listeners on the master).

      FFI 路径: 调用 VOEStopNotificationListener; DLL 未导出时静默 fallback.

    • isListenerRunning

      public static boolean isListenerRunning()
      监听线程是否运行 (Whether the listener thread is running).

      FFI 路径: 调用 VOEIsNotificationListening; DLL 未导出时返回 false.

    • addNotificationListener

      public void addNotificationListener(VoE.NotificationListener listener)
      添加通知监听器 (Add notification listener).
    • removeNotificationListener

      public void removeNotificationListener(VoE.NotificationListener listener)
      移除通知监听器 (Remove notification listener).
    • dispatchNotification

      protected void dispatchNotification(VoE.VoENotificationEventArgs args)
      内部分发入口 — FFI 回调到达时调用此方法将事件分发给所有监听器.
      Internal dispatch hook — called by the JNI callback once FFI binding lands.
    • SendRaw

      public boolean SendRaw(byte[] frameData, int timeoutMs)
      发送原始 VoE 帧
    • SendRaw

      public boolean SendRaw(byte[] frameData)
    • ReceiveRaw

      public byte[] ReceiveRaw(int timeoutMs)
      接收原始 VoE 帧
    • ReceiveRaw

      public byte[] ReceiveRaw()
    • SendRawAndReceive

      public byte[] SendRawAndReceive(byte[] frameData, int timeoutMs)
      发送原始帧并等待响应 对齐 C# VoEInstance.SendRawAndReceive
      参数:
      frameData - 要发送的帧数据
      timeoutMs - 超时时间 (毫秒)
      返回:
      响应帧数据, 失败返回 null
    • SendRawAndReceive

      public byte[] SendRawAndReceive(byte[] frameData)
      发送原始帧并等待响应 (默认超时)
    • BuildVoEFrame

      public byte[] BuildVoEFrame(int vendorId, short vendorType, byte[] data)
      构建标准 VoE 帧 (头 + 数据)
    • ParseVoEFrame

      public VoE.VoEResponse ParseVoEFrame(byte[] frame)
      解析 VoE 帧头部