2nd pass at changing the error/reject/abort status reporting to improve BTL test compliance. ReadProperty fully done for core and demo objects. Will tackle other services next.

This commit is contained in:
petermcs
2010-06-07 15:52:33 +00:00
parent b780c7bea6
commit 61bb34d726
21 changed files with 158 additions and 104 deletions
+11 -10
View File
@@ -949,8 +949,8 @@ int tm_isdst Daylight Savings flag.
}
}
/* return the length of the apdu encoded or -1 for error or
-2 for abort message */
/* return the length of the apdu encoded or BACNET_STATUS_ERROR for error or
BACNET_STATUS_ABORT for abort message */
static int Device_Read_Property_Local(
BACNET_READ_PROPERTY_DATA * rpdata)
{
@@ -1105,15 +1105,16 @@ static int Device_Read_Property_Local(
/* assume next one is the same size as this one */
/* can we all fit into the APDU? */
if ((apdu_len + len) >= MAX_APDU) {
/* reject message */
apdu_len = -2;
/* Abort response */
rpdata->error_code = ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;
apdu_len = BACNET_STATUS_ABORT;
break;
}
} else {
/* error: internal error? */
rpdata->error_class = ERROR_CLASS_SERVICES;
rpdata->error_code = ERROR_CODE_OTHER;
apdu_len = -1;
apdu_len = BACNET_STATUS_ERROR;
break;
}
}
@@ -1128,7 +1129,7 @@ static int Device_Read_Property_Local(
} else {
rpdata->error_class = ERROR_CLASS_PROPERTY;
rpdata->error_code = ERROR_CODE_INVALID_ARRAY_INDEX;
apdu_len = -1;
apdu_len = BACNET_STATUS_ERROR;
}
}
break;
@@ -1172,7 +1173,7 @@ static int Device_Read_Property_Local(
default:
rpdata->error_class = ERROR_CLASS_PROPERTY;
rpdata->error_code = ERROR_CODE_UNKNOWN_PROPERTY;
apdu_len = -1;
apdu_len = BACNET_STATUS_ERROR;
break;
}
/* only array properties can have array options */
@@ -1180,7 +1181,7 @@ static int Device_Read_Property_Local(
(rpdata->array_index != BACNET_ARRAY_ALL)) {
rpdata->error_class = ERROR_CLASS_PROPERTY;
rpdata->error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY;
apdu_len = -1;
apdu_len = BACNET_STATUS_ERROR;
}
return apdu_len;
@@ -1192,12 +1193,12 @@ static int Device_Read_Property_Local(
*
* @param rpdata [in,out] Structure with the desired Object and Property info
* on entry, and APDU message on return.
* @return The length of the APDU on success, else -1
* @return The length of the APDU on success, else BACNET_STATUS_ERROR
*/
int Device_Read_Property(
BACNET_READ_PROPERTY_DATA * rpdata)
{
int apdu_len = -1;
int apdu_len = BACNET_STATUS_ERROR;
struct object_functions *pObject = NULL;
/* initialize the default return values */