From 8207c3931b0527b41c15a7f120c59cf7f5fcd5c9 Mon Sep 17 00:00:00 2001 From: skarg Date: Wed, 6 Jun 2007 00:13:58 +0000 Subject: [PATCH] Corrected the size of the file chunk requested when the Max APDU is 50. --- bacnet-stack/demo/readfile/main.c | 10 +++++++++- bacnet-stack/demo/writefile/main.c | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/bacnet-stack/demo/readfile/main.c b/bacnet-stack/demo/readfile/main.c index 0ff8dc5d..1315485a 100644 --- a/bacnet-stack/demo/readfile/main.c +++ b/bacnet-stack/demo/readfile/main.c @@ -269,7 +269,15 @@ int main(int argc, char *argv[]) my_max_apdu = max_apdu; else my_max_apdu = MAX_APDU; - requestedOctetCount = my_max_apdu - 16; + /* Typical sizes are 50, 128, 206, 480, 1024, and 1476 octets */ + if (my_max_apdu <= 50) + requestedOctetCount = my_max_apdu - 20; + else if (my_max_apdu <= 480) + requestedOctetCount = my_max_apdu - 32; + else if (my_max_apdu <= 1476) + requestedOctetCount = my_max_apdu - 64; + else + requestedOctetCount = my_max_apdu / 2; /* has the previous invoke id expired or returned? note: invoke ID = 0 is invalid, so it will be idle */ if ((invoke_id == 0) || tsm_invoke_id_free(invoke_id)) { diff --git a/bacnet-stack/demo/writefile/main.c b/bacnet-stack/demo/writefile/main.c index 59675946..8fa936a6 100644 --- a/bacnet-stack/demo/writefile/main.c +++ b/bacnet-stack/demo/writefile/main.c @@ -229,7 +229,7 @@ int main(int argc, char *argv[]) my_max_apdu = MAX_APDU; /* Typical sizes are 50, 128, 206, 480, 1024, and 1476 octets */ if (my_max_apdu <= 50) - requestedOctetCount = my_max_apdu - 16; + requestedOctetCount = my_max_apdu - 19; else if (my_max_apdu <= 480) requestedOctetCount = my_max_apdu - 32; else if (my_max_apdu <= 1476)