using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Iob.Model { public class IobError { public IOB_ERROR_CODES errorCode; public string localizationKey; public Exception exception; public IobError(IOB_ERROR_CODES errorCode, string message, Exception exception) { this.errorCode = errorCode; this.localizationKey = message; this.exception = exception; } public IobError(IOB_ERROR_CODES errorCode, string message) { this.errorCode = errorCode; this.localizationKey = message; } public bool IsError() { if (errorCode == IOB_ERROR_CODES.OK) return false; else return true; } public static IobError InternalError(string message, Exception exception) { return new IobError(IOB_ERROR_CODES.INTERNAL_ERROR, message, exception); } public static IobError NcError(string message) { return new IobError(IOB_ERROR_CODES.NC_PROD_ERROR, message); } } public enum IOB_ERROR_CODES : uint { OK = 0 , NOT_CONNECTED , INTERNAL_ERROR , NC_PROD_ERROR , PLC_PROD_ERROR , BIT_NOT_IN_RANGE , BYTE_NOT_IN_RANGE , FUNCTION_NOT_ALLOWED , INCORRECT_PARAMETERS , FILE_NOT_FOUND , PLC_NOT_RUNNING , S7NET_READ_ERROR , S7NET_WRITE_ERROR } }