diff --git a/dotnet/IEC61850forCSharp/IEC61850ClientAPI.cs b/dotnet/IEC61850forCSharp/IEC61850ClientAPI.cs index e24a20d4..9691d4b0 100644 --- a/dotnet/IEC61850forCSharp/IEC61850ClientAPI.cs +++ b/dotnet/IEC61850forCSharp/IEC61850ClientAPI.cs @@ -1146,6 +1146,30 @@ namespace IEC61850 /** The server expected an object of another type */ IED_ERROR_TYPE_INCONSISTENT = 25, + /** The object or service is temporarily unavailable */ + IED_ERROR_TEMPORARILY_UNAVAILABLE = 26, + + /** The specified object is not defined in the server (returned by server) */ + IED_ERROR_OBJECT_UNDEFINED = 27, + + /** The specified address is invalid (returned by server) */ + IED_ERROR_INVALID_ADDRESS = 28, + + /** Service failed due to a hardware fault (returned by server) */ + IED_ERROR_HARDWARE_FAULT = 29, + + /** The requested data type is not supported by the server (returned by server) */ + IED_ERROR_TYPE_UNSUPPORTED = 30, + + /** The provided attributes are inconsistent (returned by server) */ + IED_ERROR_OBJECT_ATTRIBUTE_INCONSISTENT = 31, + + /** The provided object value is invalid (returned by server) */ + IED_ERROR_OBJECT_VALUE_INVALID = 32, + + /** The object is invalidated (returned by server) */ + IED_ERROR_OBJECT_INVALIDATED = 33, + /* unknown error */ IED_ERROR_UNKNOWN = 99 } diff --git a/src/iec61850/client/client_report_control.c b/src/iec61850/client/client_report_control.c index e3774c20..9ed5f615 100644 --- a/src/iec61850/client/client_report_control.c +++ b/src/iec61850/client/client_report_control.c @@ -458,6 +458,16 @@ IedConnection_getRCBValues(IedConnection self, IedClientError* error, const char return NULL; } + if (MmsValue_getType(rcb) == MMS_DATA_ACCESS_ERROR) { + if (DEBUG_IED_CLIENT) + printf("DEBUG_IED_CLIENT: getRCBValues returned data-access-error!\n"); + + *error = iedConnection_mapDataAccessErrorToIedError( + MmsValue_getDataAccessError(rcb)); + + return NULL; + } + if (MmsValue_getType(rcb) != MMS_STRUCTURE) { if (DEBUG_IED_CLIENT) printf("DEBUG_IED_CLIENT: getRCBValues returned wrong type!\n"); diff --git a/src/iec61850/client/ied_connection.c b/src/iec61850/client/ied_connection.c index 5d9f7436..f71a4451 100644 --- a/src/iec61850/client/ied_connection.c +++ b/src/iec61850/client/ied_connection.c @@ -97,12 +97,49 @@ IedClientError iedConnection_mapDataAccessErrorToIedError(MmsDataAccessError mmsError) { switch (mmsError) { - case DATA_ACCESS_ERROR_OBJECT_NONE_EXISTENT: - return IED_ERROR_OBJECT_DOES_NOT_EXIST; + + case DATA_ACCESS_ERROR_NO_RESPONSE: + return IED_ERROR_TIMEOUT; + + case DATA_ACCESS_ERROR_SUCCESS: + return IED_ERROR_OK; + + case DATA_ACCESS_ERROR_OBJECT_INVALIDATED: + return IED_ERROR_OBJECT_INVALIDATED; + + case DATA_ACCESS_ERROR_HARDWARE_FAULT: + return IED_ERROR_HARDWARE_FAULT; + + case DATA_ACCESS_ERROR_TEMPORARILY_UNAVAILABLE: + return IED_ERROR_TEMPORARILY_UNAVAILABLE; + case DATA_ACCESS_ERROR_OBJECT_ACCESS_DENIED: return IED_ERROR_ACCESS_DENIED; + + case DATA_ACCESS_ERROR_OBJECT_UNDEFINED: + return IED_ERROR_OBJECT_UNDEFINED; + + case DATA_ACCESS_ERROR_INVALID_ADDRESS: + return IED_ERROR_INVALID_ADDRESS; + + case DATA_ACCESS_ERROR_TYPE_UNSUPPORTED: + return IED_ERROR_TYPE_UNSUPPORTED; + + case DATA_ACCESS_ERROR_TYPE_INCONSISTENT: + return IED_ERROR_TYPE_INCONSISTENT; + + case DATA_ACCESS_ERROR_OBJECT_ATTRIBUTE_INCONSISTENT: + return IED_ERROR_OBJECT_ATTRIBUTE_INCONSISTENT; + case DATA_ACCESS_ERROR_OBJECT_ACCESS_UNSUPPORTED: return IED_ERROR_OBJECT_ACCESS_UNSUPPORTED; + + case DATA_ACCESS_ERROR_OBJECT_NONE_EXISTENT: + return IED_ERROR_OBJECT_DOES_NOT_EXIST; + + case DATA_ACCESS_ERROR_OBJECT_VALUE_INVALID: + return IED_ERROR_OBJECT_VALUE_INVALID; + default: return IED_ERROR_UNKNOWN; } diff --git a/src/iec61850/inc/iec61850_client.h b/src/iec61850/inc/iec61850_client.h index 6fefb049..ad96ab11 100644 --- a/src/iec61850/inc/iec61850_client.h +++ b/src/iec61850/inc/iec61850_client.h @@ -120,18 +120,42 @@ typedef enum { /** The server rejected the access to the requested object/service due to access control */ IED_ERROR_ACCESS_DENIED = 21, - /** The server reported that the requested object does not exist */ + /** The server reported that the requested object does not exist (returned by server) */ IED_ERROR_OBJECT_DOES_NOT_EXIST = 22, /** The server reported that the requested object already exists */ IED_ERROR_OBJECT_EXISTS = 23, - /** The server does not support the requested access method */ + /** The server does not support the requested access method (returned by server) */ IED_ERROR_OBJECT_ACCESS_UNSUPPORTED = 24, - /** The server expected an object of another type */ + /** The server expected an object of another type (returned by server) */ IED_ERROR_TYPE_INCONSISTENT = 25, + /** The object or service is temporarily unavailable (returned by server) */ + IED_ERROR_TEMPORARILY_UNAVAILABLE = 26, + + /** The specified object is not defined in the server (returned by server) */ + IED_ERROR_OBJECT_UNDEFINED = 27, + + /** The specified address is invalid (returned by server) */ + IED_ERROR_INVALID_ADDRESS = 28, + + /** Service failed due to a hardware fault (returned by server) */ + IED_ERROR_HARDWARE_FAULT = 29, + + /** The requested data type is not supported by the server (returned by server) */ + IED_ERROR_TYPE_UNSUPPORTED = 30, + + /** The provided attributes are inconsistent (returned by server) */ + IED_ERROR_OBJECT_ATTRIBUTE_INCONSISTENT = 31, + + /** The provided object value is invalid (returned by server) */ + IED_ERROR_OBJECT_VALUE_INVALID = 32, + + /** The object is invalidated (returned by server) */ + IED_ERROR_OBJECT_INVALIDATED = 33, + /* unknown error */ IED_ERROR_UNKNOWN = 99 } IedClientError;