类 FoE
java.lang.Object
com.darra.ethercat.slave.FoE
- 所有已实现的接口:
IMailboxProtocol
FoE (File over EtherCAT) 完整实现
对齐 C# FoEInstance: 文件下载/上传、CRC 校验、进度回调、包数量估算
-
嵌套类概要
嵌套类修饰符和类型类说明static classBUSY 帧事件参数 / BUSY frame event args (ETG.1000.6 Table 93).static interfaceFoE BUSY 监听器 / FoE BUSY listener.static classFoE 协议异常, 承载最后一次 FoE 错误码.static interface进度回调接口 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明booleancancel()请求取消当前 FoE 传输 / request cancellation of the current FoE transfer.boolean清除 FoE 取消标志 / clear the FoE cancel flag.protected Executor默认 Executor, 子类或用户可覆盖以使用自定义线程池 (Default Executor, subclass or user can override for custom thread pool)intvoidDefaultPassword(int value) intvoidDefaultTimeoutMs(int value) void禁用进度回调byte[]byte[]从从站设备下载(读取)文件byte[]从从站设备下载(读取)文件 (支持 CRC 校验) 对齐 C# FoEInstance.Download(enableCrc)CompletableFuture<byte[]> downloadAsync(String filename) 异步下载文件 (默认密码/超时) (Async download with default password/timeout)CompletableFuture<byte[]> downloadAsync(String filename, Integer password, Integer timeoutMs) 异步从从站下载文件 (Asynchronously download file from slave).byte[]DownloadWithCrc(String filename) 带 CRC 校验的文件下载便捷方法byte[]DownloadWithCrc(String filename, Integer password, Integer timeoutMs) 带 CRC 校验的文件下载voidEnableProgressHook(FoE.ProgressCallback callback, int estimatedTotalPackets) 设置进度回调intEstimatePacketCount(int fileSize) intEstimatePacketCount(int fileSize, int mailboxSize) 估算文件传输所需的数据包数量static StringgetErrorDescription(EtherCATTypes.FoEErrorCode errorCode) 获取 FoE 错误代码的中文描述文本 (对齐 C# GetErrorDescription)获取最后一次操作的FoE错误码long最近一次协议层错误码 (FoE Error Code).最后一次邮箱事务的统一状态.协议名称 ("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从站是否支持 FoE 邮箱协议.static EtherCATTypes.FoEErrorCodemapDllFoEError(int dllErrorCode) 将DLL错误码映射到FoE错误码void重置邮箱统计.voidsetBusyHook(FoE.FoEBusyListener listener) 设置 FoE BUSY 回调 / install FoE BUSY hook.booleanboolean上传(写入)文件到从站设备boolean上传(写入)文件到从站设备 (支持 CRC 校验) 对齐 C# FoEInstance.Upload(enableCrc)uploadAsync(String filename, byte[] fileData) 异步上传文件 (默认密码/超时) (Async upload with default password/timeout)uploadAsync(String filename, byte[] fileData, Integer password, Integer timeoutMs) 异步上传文件到从站 (Asynchronously upload file to slave).booleanUploadWithCrc(String filename, byte[] fileData) 带 CRC 校验的文件上传便捷方法booleanUploadWithCrc(String filename, byte[] fileData, Integer password, Integer timeoutMs) 带 CRC 校验的文件上传
-
构造器详细资料
-
FoE
public FoE(short masterIndex, short slaveIndex)
-
-
方法详细资料
-
getLastError
获取最后一次操作的FoE错误码 -
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- 返回:
- 协议类型 0x04 (FoE).
-
getProtocolName
从接口复制的说明:IMailboxProtocol协议名称 ("CoE" / "FoE" / "SoE" / "AoE" / "EoE" / "VoE" / "FSoE").
Protocol name literal.- 指定者:
getProtocolName在接口中IMailboxProtocol- 返回:
- 协议名称 "FoE".
-
isSupported
public boolean isSupported()从站是否支持 FoE 邮箱协议.
Whether the slave supports FoE.- 指定者:
isSupported在接口中IMailboxProtocol
-
getLastStatus
从接口复制的说明:IMailboxProtocol最后一次邮箱事务的统一状态. 初始为MailboxStatus.PENDING.
Status of the most recent mailbox transaction; initial value isMailboxStatus.PENDING.- 指定者:
getLastStatus在接口中IMailboxProtocol- 返回:
- 最近一次邮箱事务状态.
-
getLastErrorCode
public long getLastErrorCode()最近一次协议层错误码 (FoE Error Code).
Last FoE 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
-
mapDllFoEError
将DLL错误码映射到FoE错误码 -
DefaultTimeoutMs
public int DefaultTimeoutMs() -
DefaultTimeoutMs
public void DefaultTimeoutMs(int value) -
DefaultPassword
public int DefaultPassword() -
DefaultPassword
public void DefaultPassword(int value) -
EnableProgressHook
设置进度回调 -
DisableProgressHook
public void DisableProgressHook()禁用进度回调 -
setBusyHook
设置 FoE BUSY 回调 / install FoE BUSY hook.
对齐 C# FoEInstance.EnableProgressHook 中 FOESetBusyHook 部分.- 参数:
listener- BUSY 监听器; 传 null 则禁用 / pass null to clear the hook.
-
cancel
public boolean cancel()请求取消当前 FoE 传输 / request cancellation of the current FoE transfer. 透传 DLLFOERequestCancel, native 主循环下一次迭代退出.
Sets the DLL cancel flag; the ongoing transfer bails out at the next iteration of the internal loop.- 返回:
- true=DLL 接受取消请求 / true if the DLL accepted the cancel request.
-
clearCancel
public boolean clearCancel()清除 FoE 取消标志 / clear the FoE cancel flag. 通常由 Read/Write 入口自动清零, 仅异常复位时调用.
Normally cleared automatically by Read/Write entry points; use only for manual reset paths. -
Download
从从站设备下载(读取)文件- 参数:
filename- 文件名password- 密码, null 使用默认值timeoutMs- 超时, null 使用默认值- 返回:
- 文件内容, 失败返回 null
-
Download
从从站设备下载(读取)文件 (支持 CRC 校验) 对齐 C# FoEInstance.Download(enableCrc)- 参数:
filename- 文件名password- 密码, null 使用默认值timeoutMs- 超时, null 使用默认值enableCrc- 是否启用 CRC 校验- 返回:
- 文件内容, 失败返回 null
-
Download
-
DownloadWithCrc
带 CRC 校验的文件下载便捷方法 -
DownloadWithCrc
带 CRC 校验的文件下载 -
Upload
上传(写入)文件到从站设备 -
Upload
public boolean Upload(String filename, byte[] fileData, Integer password, Integer timeoutMs, boolean enableCrc) 上传(写入)文件到从站设备 (支持 CRC 校验) 对齐 C# FoEInstance.Upload(enableCrc)- 参数:
filename- 文件名fileData- 文件内容password- 密码, null 使用默认值timeoutMs- 超时, null 使用默认值enableCrc- 是否启用 CRC 校验- 返回:
- 成功返回 true
-
Upload
-
UploadWithCrc
带 CRC 校验的文件上传便捷方法 -
UploadWithCrc
带 CRC 校验的文件上传 -
EstimatePacketCount
public int EstimatePacketCount(int fileSize, int mailboxSize) 估算文件传输所需的数据包数量 -
EstimatePacketCount
public int EstimatePacketCount(int fileSize) -
defaultExecutor
默认 Executor, 子类或用户可覆盖以使用自定义线程池 (Default Executor, subclass or user can override for custom thread pool) -
downloadAsync
public CompletableFuture<byte[]> downloadAsync(String filename, Integer password, Integer timeoutMs) 异步从从站下载文件 (Asynchronously download file from slave).- 参数:
filename- 文件名 (remote filename)password- 密码, null 使用默认 (password, null = default)timeoutMs- 超时毫秒, null 使用默认 (timeout ms, null = default)- 返回:
- 包含文件字节的 CompletableFuture (CompletableFuture with file bytes)
- 抛出:
FoE.FoEProtocolException- 下载失败 (FoE protocol failure)
-
downloadAsync
异步下载文件 (默认密码/超时) (Async download with default password/timeout) -
uploadAsync
public CompletableFuture<Boolean> uploadAsync(String filename, byte[] fileData, Integer password, Integer timeoutMs) 异步上传文件到从站 (Asynchronously upload file to slave).- 参数:
filename- 文件名 (remote filename)fileData- 文件内容 (file bytes)password- 密码, null 使用默认 (password, null = default)timeoutMs- 超时毫秒, null 使用默认 (timeout ms, null = default)- 返回:
- 成功为 true 的 CompletableFuture (CompletableFuture resolving to true on success)
- 抛出:
FoE.FoEProtocolException- 上传失败 (FoE protocol failure)
-
uploadAsync
异步上传文件 (默认密码/超时) (Async upload with default password/timeout) -
getErrorDescription
获取 FoE 错误代码的中文描述文本 (对齐 C# GetErrorDescription)- 参数:
errorCode- 错误代码- 返回:
- 错误描述字符串
-