using HslCommunication;
using XP.Hardware.Plc.Exceptions;
namespace XP.Hardware.PLC.Helpers
{
///
/// PLC 辅助类,提供数据类型转换和地址解析辅助方法 | PLC helper class, provides data type conversion and address parsing helper methods
///
public static class PlcHelper
{
///
/// 检查操作结果,抛出统一异常 | Check operation result and throw unified exception
///
/// 操作结果 | Operation result
public static void CheckSuccess(OperateResult result)
{
if (!result.IsSuccess)
throw new PlcException($"PLC操作失败: {result.Message} (Code: {result.ErrorCode})");
}
}
}