/// <summary> /// Gets service error description. /// </summary> /// <param name="error">Service error enumerator value.</param> /// <returns>Service error as an string.</returns> public static string ExceptionServiceErrorToString(ExceptionServiceError error) { switch (error) { case ExceptionServiceError.OperationNotPossible: return("OperationNotPossible"); case ExceptionServiceError.ServiceNotSupported: return("ServiceNotSupported"); case ExceptionServiceError.OtherReason: return("OtherReason"); case ExceptionServiceError.PduTooLong: return("PduTooLong"); case ExceptionServiceError.DecipheringError: return("DecipheringError"); case ExceptionServiceError.InvocationCounterError: return("InvocationCounterError"); default: throw new ArgumentOutOfRangeException(); } }
/// <summary> /// Constructor for Confirmed ServiceError. /// </summary> internal GXDLMSExceptionResponse(ExceptionStateError error, ExceptionServiceError type, object value) : base("Exception response. \"" + GetStateError(error) + "\"-exception. " + GetServiceError(type, value)) { ExceptionStateError = error; ExceptionServiceError = type; Value = value; HelpLink = " https://www.gurux.fi/Gurux.DLMS.ErrorCodes"; }
private static string GetServiceError(ExceptionServiceError serviceError) { switch (serviceError) { case ExceptionServiceError.OperationNotPossible: return("Operation not possible"); case ExceptionServiceError.OtherReason: return("Other reason"); case ExceptionServiceError.ServiceNotSupported: return("Service not supported"); } return(string.Empty); }
private static string GetServiceError(ExceptionServiceError serviceError, object value) { switch (serviceError) { case ExceptionServiceError.OperationNotPossible: return "Operation not possible"; case ExceptionServiceError.OtherReason: return "Other reason"; case ExceptionServiceError.ServiceNotSupported: return "Service not supported"; case ExceptionServiceError.PduTooLong: return "PDU is too long"; case ExceptionServiceError.DecipheringError: return "Deciphering failed"; case ExceptionServiceError.InvocationCounterError: return "Invocation counter is invalid. Expected value is " + Convert.ToString(value); } return string.Empty; }
/// <summary> /// Constructor for AARE error. /// </summary> internal GXDLMSException(ExceptionStateError stateError, ExceptionServiceError serviceError) : base("Meter returns " + GetStateError(stateError) + " exception. " + GetServiceError(serviceError)) { StateError = stateError; ExceptionServiceError = serviceError; }
private static string GetServiceError(ExceptionServiceError serviceError) { switch (serviceError) { case ExceptionServiceError.OperationNotPossible: return "Operation not possible"; case ExceptionServiceError.OtherReason: return "Other reason"; case ExceptionServiceError.ServiceNotSupported: return "Service not supported"; } return string.Empty; }