From a5f6477364bfd153ea414d86a04310ac3cde1190 Mon Sep 17 00:00:00 2001 From: petermcs Date: Sat, 31 Dec 2011 07:58:13 +0000 Subject: [PATCH] Moved check for wild card Device Id to before call to rp_ack_encode_apdu_init so that the real Device ID is encoded in the response. --- bacnet-stack/demo/handler/h_rp.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/bacnet-stack/demo/handler/h_rp.c b/bacnet-stack/demo/handler/h_rp.c index da3117ee..bdaed213 100644 --- a/bacnet-stack/demo/handler/h_rp.c +++ b/bacnet-stack/demo/handler/h_rp.c @@ -110,6 +110,12 @@ void handler_read_property( #endif goto RP_FAILURE; } + /* Test for case of indefinite Device object instance */ + if ((rpdata.object_type == OBJECT_DEVICE) && + (rpdata.object_instance == BACNET_MAX_INSTANCE)) { + rpdata.object_instance = Device_Object_Instance_Number(); + } + apdu_len = rp_ack_encode_apdu_init(&Handler_Transmit_Buffer[npdu_len], service_data->invoke_id, &rpdata); @@ -117,11 +123,6 @@ void handler_read_property( rpdata.application_data = &Handler_Transmit_Buffer[npdu_len + apdu_len]; rpdata.application_data_len = sizeof(Handler_Transmit_Buffer) - (npdu_len + apdu_len); - /* Test for case of indefinite Device object instance */ - if ((rpdata.object_type == OBJECT_DEVICE) && - (rpdata.object_instance == BACNET_MAX_INSTANCE)) { - rpdata.object_instance = Device_Object_Instance_Number(); - } len = Device_Read_Property(&rpdata); if (len >= 0) { apdu_len += len;