From 5c0d0d0fe896cd59633f98d1dde1808aa7dd5629 Mon Sep 17 00:00:00 2001 From: skarg Date: Wed, 6 Jun 2007 21:25:18 +0000 Subject: [PATCH] Corrected SubscribeCOV decoding for cancellation request. Updated COV Code::Blocks project. --- bacnet-stack/cov.c | 9 ++-- bacnet-stack/cov.cbp | 104 +++++++++++++++++++------------------------ 2 files changed, 52 insertions(+), 61 deletions(-) diff --git a/bacnet-stack/cov.c b/bacnet-stack/cov.c index 12a03a75..08fa8b50 100644 --- a/bacnet-stack/cov.c +++ b/bacnet-stack/cov.c @@ -78,7 +78,7 @@ static int notify_encode_adpu(uint8_t * apdu, BACNET_COV_DATA * data) len = encode_opening_tag(&apdu[apdu_len], 4); apdu_len += len; /* the first value includes a pointer to the next value, etc */ - /* FIXME: for small implementations, we might try a partial + /* FIXME: for small implementations, we might try a partial approach like the rpm.c where the values are encoded with a separate function */ value = &data->listOfValues; @@ -367,7 +367,7 @@ int cov_subscribe_decode_service_request(uint8_t * apdu, } else return -1; /* optional parameters - if missing, means cancellation */ - if (len > apdu_len) { + if (len < apdu_len) { /* tag 2 - issueConfirmedNotifications - optional */ if (decode_is_context_tag(&apdu[len], 2)) { data->cancellationRequest = false; @@ -840,7 +840,10 @@ void testCOVSubscribeData(Test * pTest, test_data->monitoredObjectIdentifier.instance == data->monitoredObjectIdentifier.instance); ct_test(pTest, - test_data->cancellationRequest == data->cancellationRequest); + test_data->cancellationRequest == data->cancellationRequest); + if (test_data->cancellationRequest != data->cancellationRequest) { + printf("cancellation request failed!\n"); + } if (!test_data->cancellationRequest) { ct_test(pTest, test_data->issueConfirmedNotifications == diff --git a/bacnet-stack/cov.cbp b/bacnet-stack/cov.cbp index a4265572..ac9c5acf 100644 --- a/bacnet-stack/cov.cbp +++ b/bacnet-stack/cov.cbp @@ -1,80 +1,68 @@ - - + - + -