removed kludge by adding initializer

This commit is contained in:
skarg
2010-09-11 19:23:08 +00:00
parent 7832ba11db
commit 914a063681
2 changed files with 7 additions and 21 deletions
+4 -10
View File
@@ -80,14 +80,16 @@ void handler_read_property(
int bytes_sent = 0;
BACNET_ADDRESS my_address;
/* configure default error code as an abort since it is common */
rpdata.error_code = ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;
/* encode the NPDU portion of the packet */
datalink_get_my_address(&my_address);
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
npdu_len =
npdu_encode_pdu(&Handler_Transmit_Buffer[0], src, &my_address,
&npdu_data);
if (service_data->segmented_message) { /* we don't support segmentation - send an abort */
rpdata.error_code = ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;
if (service_data->segmented_message) {
/* we don't support segmentation - send an abort */
len = BACNET_STATUS_ABORT;
#if PRINT_ENABLED
fprintf(stderr, "RP: Segmented message. Sending Abort!\n");
@@ -124,7 +126,6 @@ void handler_read_property(
apdu_len += len;
if (apdu_len > service_data->max_resp) {
/* too big for the sender - send an abort */
rpdata.error_code = ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;
len = BACNET_STATUS_ABORT;
#if PRINT_ENABLED
fprintf(stderr, "RP: Message too large.\n");
@@ -140,13 +141,6 @@ void handler_read_property(
RP_FAILURE:
if (error) {
if (len == BACNET_STATUS_ABORT) {
/* Kludge alert! At the moment we assume any abort is due to
* to space issues due to segmentation or lack thereof. I wanted to show the proper
* handling via the abort_convert_error_code() so I put the error code
* in here, if you are sure all aborts properly set up the error_code then
* remove this next line
*/
rpdata.error_code = ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;
apdu_len =
abort_encode_apdu(&Handler_Transmit_Buffer[npdu_len],
service_data->invoke_id,
+3 -11
View File
@@ -382,10 +382,9 @@ void handler_read_property_multiple(
if (apdu_len > service_data->max_resp) {
/* too big for the sender - send an abort */
apdu_len =
abort_encode_apdu(&Handler_Transmit_Buffer[npdu_len],
service_data->invoke_id, ABORT_REASON_SEGMENTATION_NOT_SUPPORTED,
true);
rpmdata.error_code =
ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;
error = BACNET_STATUS_ABORT;
#if PRINT_ENABLED
fprintf(stderr, "RPM: Message too large. Sending Abort!\n");
#endif
@@ -395,13 +394,6 @@ void handler_read_property_multiple(
RPM_FAILURE:
if (error) {
if (error == BACNET_STATUS_ABORT) {
/* Kludge alert! At the moment we assume any abort is due to
* to space issues due to segmentation or lack thereof. I wanted to show the proper
* handling via the abort_convert_error_code() so I put the error code
* in here, if you are sure all aborts properly set up the error_code then
* remove this next line
*/
rpmdata.error_code = ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;
apdu_len =
abort_encode_apdu(&Handler_Transmit_Buffer[npdu_len],
service_data->invoke_id,