Corrected ReadProperty reply when data is too big to fit into APDU. It is required to be an Abort messaage, not an Error message.

This commit is contained in:
skarg
2006-10-05 12:47:23 +00:00
parent de8a4b960c
commit 4ddeb3dcad
3 changed files with 21 additions and 11 deletions
+14 -3
View File
@@ -314,9 +314,20 @@ void handler_read_property(uint8_t * service_request,
}
}
if (error) {
len = bacerror_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
service_data->invoke_id,
SERVICE_CONFIRMED_READ_PROPERTY, error_class, error_code);
switch (len) {
/* BACnet APDU too small to fit data, so proper response is Abort */
case -2:
len = abort_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
service_data->invoke_id,
ABORT_REASON_SEGMENTATION_NOT_SUPPORTED);
break;
case -1:
default:
len = bacerror_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
service_data->invoke_id,
SERVICE_CONFIRMED_READ_PROPERTY, error_class, error_code);
break;
}
#if PRINT_ENABLED
fprintf(stderr, "Sending Read Property Error!\n");
#endif
+4 -4
View File
@@ -548,7 +548,8 @@ char *Device_Valid_Object_Id(int object_type, uint32_t object_instance)
return name;
}
/* return the length of the apdu encoded or -1 for error */
/* return the length of the apdu encoded or -1 for error or
-2 for abort message */
int Device_Encode_Property_APDU(uint8_t * apdu,
BACNET_PROPERTY_ID property,
int32_t array_index,
@@ -704,9 +705,8 @@ int Device_Encode_Property_APDU(uint8_t * apdu,
/* assume next one is the same size as this one */
/* can we all fit into the APDU? */
if ((apdu_len + len) >= MAX_APDU) {
*error_class = ERROR_CLASS_SERVICES;
*error_code = ERROR_CODE_NO_SPACE_FOR_OBJECT;
apdu_len = -1;
/* reject message */
apdu_len = -2;
break;
}
} else {
+3 -4
View File
@@ -157,7 +157,8 @@ bool Device_Object_List_Identifier(unsigned array_index,
return status;
}
/* return the length of the apdu encoded or -1 for error */
/* return the length of the apdu encoded or -1 for error or
-2 for abort */
int Device_Encode_Property_APDU(uint8_t * apdu,
BACNET_PROPERTY_ID property,
int32_t array_index,
@@ -265,9 +266,7 @@ int Device_Encode_Property_APDU(uint8_t * apdu,
/* assume next one is the same size as this one */
/* can we all fit into the APDU? */
if ((apdu_len + len) >= MAX_APDU) {
*error_class = ERROR_CLASS_SERVICES;
*error_code = ERROR_CODE_NO_SPACE_FOR_OBJECT;
apdu_len = -1;
apdu_len = -2;
break;
}
} else {