Completed successfully unit testing the ReadPropertyMultiple service, and refactored the bacapp module unit test.
This commit is contained in:
+95
-88
@@ -186,75 +186,83 @@ int bacapp_decode_application_data(
|
||||
return len;
|
||||
}
|
||||
|
||||
/* generic - can be used by other unit tests */
|
||||
bool bacapp_compare(
|
||||
BACNET_APPLICATION_DATA_VALUE *value,
|
||||
BACNET_APPLICATION_DATA_VALUE *test_value)
|
||||
{
|
||||
bool status = true; /*return value*/
|
||||
|
||||
/* does the tag match? */
|
||||
if (test_value->tag != value->tag)
|
||||
status = false;
|
||||
if (status)
|
||||
{
|
||||
/* does the value match? */
|
||||
switch (test_value->tag)
|
||||
{
|
||||
case BACNET_APPLICATION_TAG_NULL:
|
||||
break;
|
||||
case BACNET_APPLICATION_TAG_BOOLEAN:
|
||||
if (test_value->type.Boolean != value->type.Boolean)
|
||||
status = false;
|
||||
break;
|
||||
case BACNET_APPLICATION_TAG_UNSIGNED_INT:
|
||||
if (test_value->type.Unsigned_Int != value->type.Unsigned_Int)
|
||||
status = false;
|
||||
break;
|
||||
case BACNET_APPLICATION_TAG_SIGNED_INT:
|
||||
if (test_value->type.Signed_Int != value->type.Signed_Int)
|
||||
status = false;
|
||||
break;
|
||||
case BACNET_APPLICATION_TAG_REAL:
|
||||
if (test_value->type.Real != value->type.Real)
|
||||
status = false;
|
||||
break;
|
||||
case BACNET_APPLICATION_TAG_ENUMERATED:
|
||||
if (test_value->type.Enumerated != value->type.Enumerated)
|
||||
status = false;
|
||||
break;
|
||||
case BACNET_APPLICATION_TAG_DATE:
|
||||
if (test_value->type.Date.year != value->type.Date.year)
|
||||
status = false;
|
||||
if (test_value->type.Date.month != value->type.Date.month)
|
||||
status = false;
|
||||
if (test_value->type.Date.day != value->type.Date.day)
|
||||
status = false;
|
||||
if(test_value->type.Date.wday != value->type.Date.wday)
|
||||
status = false;
|
||||
break;
|
||||
case BACNET_APPLICATION_TAG_TIME:
|
||||
if (test_value->type.Time.hour != value->type.Time.hour)
|
||||
status = false;
|
||||
if (test_value->type.Time.min != value->type.Time.min)
|
||||
status = false;
|
||||
if (test_value->type.Time.sec != value->type.Time.sec)
|
||||
status = false;
|
||||
if (test_value->type.Time.hundredths != value->type.Time.hundredths)
|
||||
status = false;
|
||||
break;
|
||||
case BACNET_APPLICATION_TAG_OBJECT_ID:
|
||||
if (test_value->type.Object_Id.type != value->type.Object_Id.type)
|
||||
status = false;
|
||||
if (test_value->type.Object_Id.instance != value->type.Object_Id.instance)
|
||||
status = false;
|
||||
break;
|
||||
default:
|
||||
status = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
#ifdef TEST
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include "ctest.h"
|
||||
|
||||
/* generic - can be used by other unit tests */
|
||||
void testCompareApplicationData(Test * pTest,
|
||||
BACNET_APPLICATION_DATA_VALUE *value,
|
||||
BACNET_APPLICATION_DATA_VALUE *test_value)
|
||||
{
|
||||
/* does the tag match? */
|
||||
ct_test(pTest, test_value->tag == value->tag);
|
||||
/* does the value match? */
|
||||
switch (test_value->tag)
|
||||
{
|
||||
case BACNET_APPLICATION_TAG_NULL:
|
||||
break;
|
||||
case BACNET_APPLICATION_TAG_BOOLEAN:
|
||||
ct_test(pTest,
|
||||
test_value->type.Boolean == value->type.Boolean);
|
||||
break;
|
||||
case BACNET_APPLICATION_TAG_UNSIGNED_INT:
|
||||
ct_test(pTest,
|
||||
test_value->type.Unsigned_Int == value->type.Unsigned_Int);
|
||||
break;
|
||||
case BACNET_APPLICATION_TAG_SIGNED_INT:
|
||||
ct_test(pTest,
|
||||
test_value->type.Signed_Int == value->type.Signed_Int);
|
||||
break;
|
||||
case BACNET_APPLICATION_TAG_REAL:
|
||||
ct_test(pTest,
|
||||
test_value->type.Real == value->type.Real);
|
||||
break;
|
||||
case BACNET_APPLICATION_TAG_ENUMERATED:
|
||||
ct_test(pTest,
|
||||
test_value->type.Enumerated == value->type.Enumerated);
|
||||
break;
|
||||
case BACNET_APPLICATION_TAG_DATE:
|
||||
ct_test(pTest,
|
||||
test_value->type.Date.year == value->type.Date.year);
|
||||
ct_test(pTest,
|
||||
test_value->type.Date.month == value->type.Date.month);
|
||||
ct_test(pTest,
|
||||
test_value->type.Date.day == value->type.Date.day);
|
||||
ct_test(pTest,
|
||||
test_value->type.Date.wday == value->type.Date.wday);
|
||||
break;
|
||||
case BACNET_APPLICATION_TAG_TIME:
|
||||
ct_test(pTest,
|
||||
test_value->type.Time.hour == value->type.Time.hour);
|
||||
ct_test(pTest,
|
||||
test_value->type.Time.min == value->type.Time.min);
|
||||
ct_test(pTest,
|
||||
test_value->type.Time.sec == value->type.Time.sec);
|
||||
ct_test(pTest,
|
||||
test_value->type.Time.hundredths == value->type.Time.hundredths);
|
||||
break;
|
||||
case BACNET_APPLICATION_TAG_OBJECT_ID:
|
||||
ct_test(pTest,
|
||||
test_value->type.Object_Id.type == value->type.Object_Id.type);
|
||||
ct_test(pTest, test_value->type.Object_Id.instance ==
|
||||
value->type.Object_Id.instance);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void testBACnetApplicationDataValue(Test * pTest,
|
||||
static bool testBACnetApplicationDataValue(Test * pTest,
|
||||
BACNET_APPLICATION_DATA_VALUE *value)
|
||||
{
|
||||
uint8_t apdu[480] = {0};
|
||||
@@ -267,9 +275,8 @@ void testBACnetApplicationDataValue(Test * pTest,
|
||||
&apdu[0],
|
||||
apdu_len,
|
||||
&test_value);
|
||||
testCompareApplicationData(pTest, value, &test_value);
|
||||
|
||||
return;
|
||||
return bacapp_compare(value, &test_value);
|
||||
}
|
||||
|
||||
void testBACnetApplicationData(Test * pTest)
|
||||
@@ -277,73 +284,73 @@ void testBACnetApplicationData(Test * pTest)
|
||||
BACNET_APPLICATION_DATA_VALUE value = {0};
|
||||
|
||||
value.tag = BACNET_APPLICATION_TAG_NULL;
|
||||
testBACnetApplicationDataValue(pTest, &value);
|
||||
ct_test(pTest,testBACnetApplicationDataValue(pTest, &value));
|
||||
|
||||
value.tag = BACNET_APPLICATION_TAG_BOOLEAN;
|
||||
value.type.Boolean = true;
|
||||
testBACnetApplicationDataValue(pTest, &value);
|
||||
ct_test(pTest,testBACnetApplicationDataValue(pTest, &value));
|
||||
value.type.Boolean = false;
|
||||
testBACnetApplicationDataValue(pTest, &value);
|
||||
ct_test(pTest,testBACnetApplicationDataValue(pTest, &value));
|
||||
|
||||
value.tag = BACNET_APPLICATION_TAG_UNSIGNED_INT;
|
||||
value.type.Unsigned_Int = 0;
|
||||
testBACnetApplicationDataValue(pTest, &value);
|
||||
ct_test(pTest,testBACnetApplicationDataValue(pTest, &value));
|
||||
value.type.Unsigned_Int = 0xFFFF;
|
||||
testBACnetApplicationDataValue(pTest, &value);
|
||||
ct_test(pTest,testBACnetApplicationDataValue(pTest, &value));
|
||||
value.type.Unsigned_Int = 0xFFFFFFFF;
|
||||
testBACnetApplicationDataValue(pTest, &value);
|
||||
ct_test(pTest,testBACnetApplicationDataValue(pTest, &value));
|
||||
|
||||
value.tag = BACNET_APPLICATION_TAG_SIGNED_INT;
|
||||
value.type.Signed_Int = 0;
|
||||
testBACnetApplicationDataValue(pTest, &value);
|
||||
ct_test(pTest,testBACnetApplicationDataValue(pTest, &value));
|
||||
value.type.Signed_Int = -1;
|
||||
testBACnetApplicationDataValue(pTest, &value);
|
||||
ct_test(pTest,testBACnetApplicationDataValue(pTest, &value));
|
||||
value.type.Signed_Int = 32768;
|
||||
testBACnetApplicationDataValue(pTest, &value);
|
||||
ct_test(pTest,testBACnetApplicationDataValue(pTest, &value));
|
||||
value.type.Signed_Int = -32768;
|
||||
testBACnetApplicationDataValue(pTest, &value);
|
||||
ct_test(pTest,testBACnetApplicationDataValue(pTest, &value));
|
||||
|
||||
value.tag = BACNET_APPLICATION_TAG_REAL;
|
||||
value.type.Real = 0.0;
|
||||
testBACnetApplicationDataValue(pTest, &value);
|
||||
ct_test(pTest,testBACnetApplicationDataValue(pTest, &value));
|
||||
value.type.Real = -1.0;
|
||||
testBACnetApplicationDataValue(pTest, &value);
|
||||
ct_test(pTest,testBACnetApplicationDataValue(pTest, &value));
|
||||
value.type.Real = 1.0;
|
||||
testBACnetApplicationDataValue(pTest, &value);
|
||||
ct_test(pTest,testBACnetApplicationDataValue(pTest, &value));
|
||||
value.type.Real = 3.14159;
|
||||
testBACnetApplicationDataValue(pTest, &value);
|
||||
ct_test(pTest,testBACnetApplicationDataValue(pTest, &value));
|
||||
value.type.Real = -3.14159;
|
||||
testBACnetApplicationDataValue(pTest, &value);
|
||||
ct_test(pTest,testBACnetApplicationDataValue(pTest, &value));
|
||||
|
||||
value.tag = BACNET_APPLICATION_TAG_ENUMERATED;
|
||||
value.type.Enumerated = 0;
|
||||
testBACnetApplicationDataValue(pTest, &value);
|
||||
ct_test(pTest,testBACnetApplicationDataValue(pTest, &value));
|
||||
value.type.Enumerated = 0xFFFF;
|
||||
testBACnetApplicationDataValue(pTest, &value);
|
||||
ct_test(pTest,testBACnetApplicationDataValue(pTest, &value));
|
||||
value.type.Enumerated = 0xFFFFFFFF;
|
||||
testBACnetApplicationDataValue(pTest, &value);
|
||||
ct_test(pTest,testBACnetApplicationDataValue(pTest, &value));
|
||||
|
||||
value.tag = BACNET_APPLICATION_TAG_DATE;
|
||||
value.type.Date.year = 5;
|
||||
value.type.Date.month = 5;
|
||||
value.type.Date.day = 22;
|
||||
value.type.Date.wday = 1;
|
||||
testBACnetApplicationDataValue(pTest, &value);
|
||||
ct_test(pTest,testBACnetApplicationDataValue(pTest, &value));
|
||||
|
||||
value.tag = BACNET_APPLICATION_TAG_TIME;
|
||||
value.type.Time.hour = 23;
|
||||
value.type.Time.min = 59;
|
||||
value.type.Time.sec = 59;
|
||||
value.type.Time.hundredths = 12;
|
||||
testBACnetApplicationDataValue(pTest, &value);
|
||||
ct_test(pTest,testBACnetApplicationDataValue(pTest, &value));
|
||||
|
||||
value.tag = BACNET_APPLICATION_TAG_OBJECT_ID;
|
||||
value.type.Object_Id.type = OBJECT_ANALOG_INPUT;
|
||||
value.type.Object_Id.instance = 0;
|
||||
testBACnetApplicationDataValue(pTest, &value);
|
||||
ct_test(pTest,testBACnetApplicationDataValue(pTest, &value));
|
||||
value.type.Object_Id.type = OBJECT_LIFE_SAFETY_ZONE;
|
||||
value.type.Object_Id.instance = BACNET_MAX_INSTANCE;
|
||||
testBACnetApplicationDataValue(pTest, &value);
|
||||
ct_test(pTest,testBACnetApplicationDataValue(pTest, &value));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -72,14 +72,13 @@ int bacapp_encode_application_data(
|
||||
uint8_t *apdu,
|
||||
BACNET_APPLICATION_DATA_VALUE *value);
|
||||
|
||||
bool bacapp_compare(
|
||||
BACNET_APPLICATION_DATA_VALUE *value,
|
||||
BACNET_APPLICATION_DATA_VALUE *test_value);
|
||||
|
||||
#ifdef TEST
|
||||
#include "ctest.h"
|
||||
void testBACnetApplicationData(Test * pTest);
|
||||
void testBACnetApplicationDataValue(Test * pTest,
|
||||
BACNET_APPLICATION_DATA_VALUE *value);
|
||||
void testCompareApplicationData(Test * pTest,
|
||||
BACNET_APPLICATION_DATA_VALUE *value,
|
||||
BACNET_APPLICATION_DATA_VALUE *test_value);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
+60
-104
@@ -286,25 +286,23 @@ int rpm_ack_encode_apdu_object_property(
|
||||
|
||||
return apdu_len;
|
||||
}
|
||||
|
||||
/* This could be using a generic data buffer or the
|
||||
specific application data type. Using the specific
|
||||
application data type container would encourage
|
||||
using standard types, and would make it easier on
|
||||
the developer. */
|
||||
|
||||
int rpm_ack_encode_apdu_object_property_value(
|
||||
uint8_t *apdu,
|
||||
BACNET_APPLICATION_DATA_VALUE *application_data)
|
||||
uint8_t *application_data,
|
||||
unsigned application_data_len)
|
||||
{
|
||||
int apdu_len = 0; /* total length of the apdu, return value */
|
||||
unsigned len = 0;
|
||||
|
||||
if (apdu)
|
||||
{
|
||||
/* Tag 4: propertyValue */
|
||||
apdu_len += encode_opening_tag(&apdu[apdu_len], 4);
|
||||
apdu_len += bacapp_encode_application_data(
|
||||
&apdu[apdu_len],
|
||||
&application_data[0]);
|
||||
for (len = 0; len < application_data_len; len++)
|
||||
{
|
||||
apdu[apdu_len++] = application_data[len];
|
||||
}
|
||||
apdu_len += encode_closing_tag(&apdu[apdu_len], 4);
|
||||
}
|
||||
|
||||
@@ -428,38 +426,6 @@ int rpm_ack_decode_object_property(
|
||||
return (int)len;
|
||||
}
|
||||
|
||||
int rpm_ack_decode_is_object_property_value(
|
||||
uint8_t *apdu,
|
||||
unsigned apdu_len)
|
||||
{
|
||||
int len = 0; /* total length of the apdu, return value */
|
||||
|
||||
if (apdu && apdu_len)
|
||||
{
|
||||
// Tag 4: opening context tag for the value data */
|
||||
if (decode_is_opening_tag_number(&apdu[0], 4))
|
||||
len = 1;
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
int rpm_ack_decode_is_object_property_error(
|
||||
uint8_t *apdu,
|
||||
unsigned apdu_len)
|
||||
{
|
||||
int len = 0; /* total length of the apdu, return value */
|
||||
|
||||
if (apdu && apdu_len)
|
||||
{
|
||||
// Tag 5: opening context tag for error */
|
||||
if (decode_is_opening_tag_number(&apdu[0], 5))
|
||||
len = 1;
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
int rpm_ack_decode_apdu(
|
||||
uint8_t *apdu,
|
||||
int apdu_len, /* total length of the apdu */
|
||||
@@ -648,6 +614,8 @@ void testReadPropertyMultipleAck(Test * pTest)
|
||||
int32_t array_index = 0;
|
||||
BACNET_APPLICATION_DATA_VALUE application_data[4] = {{0}};
|
||||
BACNET_APPLICATION_DATA_VALUE test_application_data = {0};
|
||||
uint8_t application_data_buffer[MAX_APDU] = {0};
|
||||
int application_data_buffer_len = 0;
|
||||
BACNET_ERROR_CLASS error_class;
|
||||
BACNET_ERROR_CODE error_code;
|
||||
|
||||
@@ -672,16 +640,24 @@ void testReadPropertyMultipleAck(Test * pTest)
|
||||
application_data[0].tag = BACNET_APPLICATION_TAG_OBJECT_ID;
|
||||
application_data[0].type.Object_Id.type = OBJECT_DEVICE;
|
||||
application_data[0].type.Object_Id.instance = 123;
|
||||
apdu_len += rpm_ack_encode_apdu_object_property_value(&apdu[apdu_len],
|
||||
application_data_buffer_len = bacapp_encode_application_data(
|
||||
&application_data_buffer[0],
|
||||
&application_data[0]);
|
||||
apdu_len += rpm_ack_encode_apdu_object_property_value(&apdu[apdu_len],
|
||||
&application_data_buffer[0],
|
||||
application_data_buffer_len);
|
||||
/* reply property */
|
||||
apdu_len += rpm_ack_encode_apdu_object_property(&apdu[apdu_len],
|
||||
PROP_OBJECT_TYPE, BACNET_ARRAY_ALL);
|
||||
/* reply value */
|
||||
application_data[1].tag = BACNET_APPLICATION_TAG_ENUMERATED;
|
||||
application_data[1].type.Enumerated = OBJECT_DEVICE;
|
||||
apdu_len += rpm_ack_encode_apdu_object_property_value(&apdu[apdu_len],
|
||||
application_data_buffer_len = bacapp_encode_application_data(
|
||||
&application_data_buffer[0],
|
||||
&application_data[1]);
|
||||
apdu_len += rpm_ack_encode_apdu_object_property_value(&apdu[apdu_len],
|
||||
&application_data_buffer[0],
|
||||
application_data_buffer_len);
|
||||
/* object end */
|
||||
apdu_len += rpm_ack_encode_apdu_object_end(&apdu[apdu_len]);
|
||||
|
||||
@@ -694,8 +670,12 @@ void testReadPropertyMultipleAck(Test * pTest)
|
||||
/* reply value */
|
||||
application_data[2].tag = BACNET_APPLICATION_TAG_REAL;
|
||||
application_data[2].type.Real = 0.0;
|
||||
apdu_len += rpm_ack_encode_apdu_object_property_value(&apdu[apdu_len],
|
||||
application_data_buffer_len = bacapp_encode_application_data(
|
||||
&application_data_buffer[0],
|
||||
&application_data[2]);
|
||||
apdu_len += rpm_ack_encode_apdu_object_property_value(&apdu[apdu_len],
|
||||
&application_data_buffer[0],
|
||||
application_data_buffer_len);
|
||||
/* reply property */
|
||||
apdu_len += rpm_ack_encode_apdu_object_property(&apdu[apdu_len],
|
||||
PROP_DEADBAND, BACNET_ARRAY_ALL);
|
||||
@@ -706,7 +686,7 @@ void testReadPropertyMultipleAck(Test * pTest)
|
||||
apdu_len += rpm_ack_encode_apdu_object_end(&apdu[apdu_len]);
|
||||
ct_test(pTest, apdu_len != 0);
|
||||
|
||||
/* decode the packet */
|
||||
/****** decode the packet ******/
|
||||
test_len = rpm_ack_decode_apdu(
|
||||
&apdu[0],
|
||||
apdu_len,
|
||||
@@ -737,25 +717,20 @@ void testReadPropertyMultipleAck(Test * pTest)
|
||||
ct_test(pTest, array_index == BACNET_ARRAY_ALL);
|
||||
len += test_len;
|
||||
/* what is the result? An error or a value? */
|
||||
test_len = rpm_ack_decode_is_object_property_error(
|
||||
&service_request[len],
|
||||
service_request_len - len);
|
||||
ct_test(pTest, test_len == 0);
|
||||
test_len = rpm_ack_decode_is_object_property_value(
|
||||
&service_request[len],
|
||||
service_request_len - len);
|
||||
ct_test(pTest, test_len == 1);
|
||||
len += test_len;
|
||||
ct_test(pTest,decode_is_opening_tag_number(&service_request[len], 4));
|
||||
len ++;
|
||||
/* decode the object property portion of the service request */
|
||||
test_len += bacapp_decode_application_data(
|
||||
&apdu[len],
|
||||
apdu_len - len,
|
||||
/* note: if this was an array, there could have been
|
||||
more than one element to decode */
|
||||
test_len = bacapp_decode_application_data(
|
||||
&service_request[len],
|
||||
service_request_len - len,
|
||||
&test_application_data);
|
||||
ct_test(pTest, test_len > 0);
|
||||
testCompareApplicationData(pTest,
|
||||
&application_data[0],
|
||||
&test_application_data);
|
||||
ct_test(pTest, bacapp_compare(&application_data[0],&test_application_data));
|
||||
len += test_len;
|
||||
ct_test(pTest,decode_is_closing_tag_number(&service_request[len], 4));
|
||||
len ++;
|
||||
/* see if there is another property */
|
||||
test_len = rpm_ack_decode_object_property(
|
||||
&service_request[len],
|
||||
@@ -763,29 +738,22 @@ void testReadPropertyMultipleAck(Test * pTest)
|
||||
&object_property,
|
||||
&array_index);
|
||||
ct_test(pTest, test_len != -1);
|
||||
ct_test(pTest, object_property == PROP_OBJECT_NAME);
|
||||
ct_test(pTest, object_property == PROP_OBJECT_TYPE);
|
||||
ct_test(pTest, array_index == BACNET_ARRAY_ALL);
|
||||
len += test_len;
|
||||
/* what is the result value? */
|
||||
test_len = rpm_ack_decode_is_object_property_error(
|
||||
&service_request[len],
|
||||
service_request_len - len);
|
||||
ct_test(pTest, test_len == 0);
|
||||
test_len = rpm_ack_decode_is_object_property_value(
|
||||
&service_request[len],
|
||||
service_request_len - len);
|
||||
ct_test(pTest, test_len == 1);
|
||||
len += test_len;
|
||||
ct_test(pTest,decode_is_opening_tag_number(&service_request[len], 4));
|
||||
len ++;
|
||||
/* decode the object property portion of the service request */
|
||||
test_len += bacapp_decode_application_data(
|
||||
&apdu[len],
|
||||
apdu_len - len,
|
||||
test_len = bacapp_decode_application_data(
|
||||
&service_request[len],
|
||||
service_request_len - len,
|
||||
&test_application_data);
|
||||
ct_test(pTest, test_len > 0);
|
||||
testCompareApplicationData(pTest,
|
||||
&application_data[1],
|
||||
&test_application_data);
|
||||
ct_test(pTest, bacapp_compare(&application_data[1],&test_application_data));
|
||||
len += test_len;
|
||||
ct_test(pTest,decode_is_closing_tag_number(&service_request[len], 4));
|
||||
len ++;
|
||||
/* see if there is another property */
|
||||
/* this time we should fail */
|
||||
test_len = rpm_ack_decode_object_property(
|
||||
@@ -817,29 +785,22 @@ void testReadPropertyMultipleAck(Test * pTest)
|
||||
&object_property,
|
||||
&array_index);
|
||||
ct_test(pTest, test_len != -1);
|
||||
ct_test(pTest, object_property == PROP_OBJECT_IDENTIFIER);
|
||||
ct_test(pTest, object_property == PROP_PRESENT_VALUE);
|
||||
ct_test(pTest, array_index == BACNET_ARRAY_ALL);
|
||||
len += test_len;
|
||||
/* what is the result value? */
|
||||
test_len = rpm_ack_decode_is_object_property_error(
|
||||
&service_request[len],
|
||||
service_request_len - len);
|
||||
ct_test(pTest, test_len == 0);
|
||||
test_len = rpm_ack_decode_is_object_property_value(
|
||||
&service_request[len],
|
||||
service_request_len - len);
|
||||
ct_test(pTest, test_len == 1);
|
||||
len += test_len;
|
||||
ct_test(pTest,decode_is_opening_tag_number(&service_request[len], 4));
|
||||
len++;
|
||||
/* decode the object property portion of the service request */
|
||||
test_len += bacapp_decode_application_data(
|
||||
&apdu[len],
|
||||
apdu_len - len,
|
||||
test_len = bacapp_decode_application_data(
|
||||
&service_request[len],
|
||||
service_request_len - len,
|
||||
&test_application_data);
|
||||
ct_test(pTest, test_len > 0);
|
||||
testCompareApplicationData(pTest,
|
||||
&application_data[2],
|
||||
&test_application_data);
|
||||
ct_test(pTest, bacapp_compare(&application_data[2],&test_application_data));
|
||||
len += test_len;
|
||||
ct_test(pTest,decode_is_closing_tag_number(&service_request[len], 4));
|
||||
len++;
|
||||
/* see if there is another property */
|
||||
test_len = rpm_ack_decode_object_property(
|
||||
&service_request[len],
|
||||
@@ -851,25 +812,20 @@ void testReadPropertyMultipleAck(Test * pTest)
|
||||
ct_test(pTest, array_index == BACNET_ARRAY_ALL);
|
||||
len += test_len;
|
||||
/* what is the result value? */
|
||||
test_len = rpm_ack_decode_is_object_property_error(
|
||||
&service_request[len],
|
||||
service_request_len - len);
|
||||
ct_test(pTest, test_len == 1);
|
||||
test_len = rpm_ack_decode_is_object_property_value(
|
||||
&service_request[len],
|
||||
service_request_len - len);
|
||||
ct_test(pTest, test_len == 0);
|
||||
len += test_len;
|
||||
ct_test(pTest,decode_is_opening_tag_number(&service_request[len], 5));
|
||||
len++;
|
||||
/* it was an error reply */
|
||||
test_len = bacerror_decode_error_class_and_code(
|
||||
&service_request[len],
|
||||
service_request_len - len,
|
||||
&error_class,
|
||||
&error_code);
|
||||
ct_test(pTest, test_len != -1);
|
||||
ct_test(pTest, test_len != 0);
|
||||
ct_test(pTest, error_class == ERROR_CLASS_PROPERTY);
|
||||
ct_test(pTest, error_code == ERROR_CODE_UNKNOWN_PROPERTY);
|
||||
len += test_len;
|
||||
ct_test(pTest,decode_is_closing_tag_number(&service_request[len], 5));
|
||||
len++;
|
||||
/* is there another property? */
|
||||
test_len = rpm_ack_decode_object_property(
|
||||
&service_request[len],
|
||||
@@ -889,7 +845,7 @@ void testReadPropertyMultipleAck(Test * pTest)
|
||||
service_request_len - len,
|
||||
&object_type,
|
||||
&object_instance);
|
||||
ct_test(pTest, test_len == -1);
|
||||
ct_test(pTest, test_len == 0);
|
||||
ct_test(pTest, len == service_request_len);
|
||||
}
|
||||
|
||||
|
||||
+2
-4
@@ -102,7 +102,8 @@ int rpm_ack_encode_apdu_object_begin(
|
||||
|
||||
int rpm_ack_encode_apdu_object_property_value(
|
||||
uint8_t *apdu,
|
||||
BACNET_APPLICATION_DATA_VALUE *application_data);
|
||||
uint8_t *application_data,
|
||||
unsigned application_data_len);
|
||||
|
||||
int rpm_ack_encode_apdu_object_property_error(
|
||||
uint8_t *apdu,
|
||||
@@ -126,9 +127,6 @@ int rpm_ack_decode_object_property(
|
||||
unsigned apdu_len,
|
||||
BACNET_PROPERTY_ID *object_property,
|
||||
int32_t *array_index);
|
||||
int rpm_ack_decode_is_object_property_error(
|
||||
uint8_t *apdu,
|
||||
unsigned apdu_len);
|
||||
/* decode the object property value portion of the service request only */
|
||||
int rpm_ack_decode_object_property_value(
|
||||
uint8_t *apdu,
|
||||
|
||||
Reference in New Issue
Block a user