Feature - added create/delete/COV services for analog, binary, and multistate objects (#612)
* Added Create/Delete object services to Analog Input, Analog Value, Binary Input, Binary Value, Multistate Input, Multistate Value object examples, and updated their units tests.
This commit is contained in:
@@ -9,7 +9,9 @@
|
||||
*/
|
||||
|
||||
#include <zephyr/ztest.h>
|
||||
#include <bacnet/bactext.h>
|
||||
#include <bacnet/basic/object/bv.h>
|
||||
#include <property_test.h>
|
||||
|
||||
/**
|
||||
* @addtogroup bacnet_tests
|
||||
@@ -25,40 +27,26 @@ ZTEST(bv_tests, testBinary_Value)
|
||||
static void testBinary_Value(void)
|
||||
#endif
|
||||
{
|
||||
uint8_t apdu[MAX_APDU] = { 0 };
|
||||
int len = 0, test_len = 0;
|
||||
BACNET_READ_PROPERTY_DATA rpdata = { 0 };
|
||||
BACNET_APPLICATION_DATA_VALUE value = {0};
|
||||
const int *required_property = NULL;
|
||||
const uint32_t instance = 1;
|
||||
bool status = false;
|
||||
unsigned count = 0;
|
||||
uint32_t object_instance = BACNET_MAX_INSTANCE, test_object_instance = 0;
|
||||
const int skip_fail_property_list[] = { -1 };
|
||||
|
||||
Binary_Value_Init();
|
||||
rpdata.application_data = &apdu[0];
|
||||
rpdata.application_data_len = sizeof(apdu);
|
||||
rpdata.object_type = OBJECT_BINARY_VALUE;
|
||||
rpdata.object_instance = instance;
|
||||
rpdata.array_index = BACNET_ARRAY_ALL;
|
||||
|
||||
Binary_Value_Property_Lists(&required_property, NULL, NULL);
|
||||
while ((*required_property) >= 0) {
|
||||
rpdata.object_property = *required_property;
|
||||
len = Binary_Value_Read_Property(&rpdata);
|
||||
zassert_true(len >= 0, NULL);
|
||||
if (len >= 0) {
|
||||
test_len = bacapp_decode_known_property(rpdata.application_data,
|
||||
len, &value, rpdata.object_type, rpdata.object_property);
|
||||
if (len != test_len) {
|
||||
//printf("property '%s': failed to decode!\n",
|
||||
// bactext_property_name(rpdata.object_property));
|
||||
}
|
||||
if (rpdata.object_property == PROP_PRIORITY_ARRAY) {
|
||||
/* FIXME: known fail to decode */
|
||||
len = test_len;
|
||||
}
|
||||
zassert_equal(len, test_len, NULL);
|
||||
}
|
||||
required_property++;
|
||||
}
|
||||
object_instance = Binary_Value_Create(object_instance);
|
||||
count = Binary_Value_Count();
|
||||
zassert_true(count == 1, NULL);
|
||||
test_object_instance = Binary_Value_Index_To_Instance(0);
|
||||
zassert_equal(object_instance, test_object_instance, NULL);
|
||||
bacnet_object_properties_read_write_test(
|
||||
OBJECT_BINARY_VALUE,
|
||||
object_instance,
|
||||
Binary_Value_Property_Lists,
|
||||
Binary_Value_Read_Property,
|
||||
Binary_Value_Write_Property,
|
||||
skip_fail_property_list);
|
||||
status = Binary_Value_Delete(object_instance);
|
||||
zassert_true(status, NULL);
|
||||
}
|
||||
/**
|
||||
* @}
|
||||
|
||||
Reference in New Issue
Block a user