From 84ad4fe8a52c4666134914404d2a2459bb6ca024 Mon Sep 17 00:00:00 2001 From: brayra Date: Thu, 9 Jul 2009 21:09:23 +0000 Subject: [PATCH] moved datalink_recieve to bottom of main loop to improve speed when using address cache --- bacnet-stack/demo/readprop/main.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/bacnet-stack/demo/readprop/main.c b/bacnet-stack/demo/readprop/main.c index 8daae768..5018e2c2 100644 --- a/bacnet-stack/demo/readprop/main.c +++ b/bacnet-stack/demo/readprop/main.c @@ -239,22 +239,17 @@ int main( /* increment timer - exit if timed out */ current_seconds = time(NULL); - /* returns 0 bytes on timeout */ - pdu_len = datalink_receive(&src, &Rx_Buf[0], MAX_MPDU, timeout); - - /* process */ - if (pdu_len) { - npdu_handler(&src, &Rx_Buf[0], pdu_len); - } /* at least one second has passed */ if (current_seconds != last_seconds) tsm_timer_milliseconds(((current_seconds - last_seconds) * 1000)); if (Error_Detected) break; /* wait until the device is bound, or timeout and quit */ + if(!found){ found = address_bind_request(Target_Device_Object_Instance, &max_apdu, &Target_Address); + } if (found) { if (invoke_id == 0) { invoke_id = @@ -279,6 +274,15 @@ int main( break; } } + + /* returns 0 bytes on timeout */ + pdu_len = datalink_receive(&src, &Rx_Buf[0], MAX_MPDU, timeout); + + /* process */ + if (pdu_len) { + npdu_handler(&src, &Rx_Buf[0], pdu_len); + } + /* keep track of time for next check */ last_seconds = current_seconds; }