Fixed basic device object and ReadRange handling for test 9.21.2.2 and 9.21.2.3 array index (#692)

This commit is contained in:
GauiStori
2024-07-11 16:23:55 +02:00
committed by GitHub
parent 66fd9f5c48
commit 8bb93d3286
2 changed files with 19 additions and 2 deletions
+14 -2
View File
@@ -2290,7 +2290,11 @@ bool DeviceGetRRInfo(BACNET_READ_RANGE_DATA *pRequest, /* Info on the request */
case PROP_UTC_TIME_SYNCHRONIZATION_RECIPIENTS:
pInfo->RequestTypes = RR_BY_POSITION;
pRequest->error_class = ERROR_CLASS_PROPERTY;
pRequest->error_code = ERROR_CODE_UNKNOWN_PROPERTY;
if (pRequest->array_index == BACNET_ARRAY_ALL) {
pRequest->error_code = ERROR_CODE_UNKNOWN_PROPERTY;
} else {
pRequest->error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY;
}
break;
case PROP_DEVICE_ADDRESS_BINDING:
@@ -2302,11 +2306,19 @@ bool DeviceGetRRInfo(BACNET_READ_RANGE_DATA *pRequest, /* Info on the request */
case PROP_ACTIVE_COV_SUBSCRIPTIONS:
pInfo->RequestTypes = RR_BY_POSITION;
pRequest->error_class = ERROR_CLASS_PROPERTY;
pRequest->error_code = ERROR_CODE_UNKNOWN_PROPERTY;
if (pRequest->array_index == BACNET_ARRAY_ALL) {
pRequest->error_code = ERROR_CODE_UNKNOWN_PROPERTY;
} else {
pRequest->error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY;
}
break;
default:
pRequest->error_class = ERROR_CLASS_SERVICES;
pRequest->error_code = ERROR_CODE_PROPERTY_IS_NOT_A_LIST;
if (pRequest->array_index == BACNET_ARRAY_ALL) {
pRequest->error_code = ERROR_CODE_UNKNOWN_PROPERTY;
pRequest->error_class = ERROR_CLASS_PROPERTY;
}
break;
}
+5
View File
@@ -81,6 +81,7 @@ static int Encode_RR_payload(uint8_t *apdu, BACNET_READ_RANGE_DATA *pRequest)
(pRequest->array_index != 0) &&
(pRequest->array_index != BACNET_ARRAY_ALL)) {
/* Array access attempted on a non array property */
pRequest->error_class = ERROR_CLASS_PROPERTY;
pRequest->error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY;
} else if ((pRequest->RequestType != RR_READ_ALL) &&
((PropInfo.RequestTypes & pRequest->RequestType) == 0)) {
@@ -101,6 +102,10 @@ static int Encode_RR_payload(uint8_t *apdu, BACNET_READ_RANGE_DATA *pRequest)
/* Either we don't support RR for this property yet or it is not a list
* or array of lists */
pRequest->error_code = ERROR_CODE_PROPERTY_IS_NOT_A_LIST;
if (pRequest->array_index != BACNET_ARRAY_ALL) {
pRequest->error_class = ERROR_CLASS_PROPERTY;
pRequest->error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY;
}
}
return apdu_len;