Fixed up error return so that we report not having a particular instance of an object differently to not supporting that object type at all.

This commit is contained in:
petermcs
2010-01-21 21:51:20 +00:00
parent d36c29ff08
commit 45c631b133
+13 -4
View File
@@ -78,11 +78,20 @@ int Encode_Property_APDU(
object_rp = Read_Property[object_type]; object_rp = Read_Property[object_type];
object_valid = Valid_Instance[object_type]; object_valid = Valid_Instance[object_type];
} }
if (object_rp && object_valid && object_valid(object_instance)) { if (object_rp && object_valid) {
apdu_len = /* There are handlers for this type of object */
object_rp(&apdu[0], object_instance, property, array_index, if(object_valid(object_instance)) {
error_class, error_code); apdu_len =
object_rp(&apdu[0], object_instance, property, array_index,
error_class, error_code);
} else {
/* The specified object instance is not valid */
*error_class = ERROR_CLASS_OBJECT;
*error_code = ERROR_CODE_UNKNOWN_OBJECT;
}
} else { } else {
/* We don't support this object type */
*error_class = ERROR_CLASS_OBJECT; *error_class = ERROR_CLASS_OBJECT;
*error_code = ERROR_CODE_UNSUPPORTED_OBJECT_TYPE; *error_code = ERROR_CODE_UNSUPPORTED_OBJECT_TYPE;
} }