fix analog, binary, and multistate output tests

This commit is contained in:
Steve Karg
2022-11-10 17:35:03 -06:00
parent 100df01cef
commit 77b2881f60
11 changed files with 106 additions and 24 deletions
+16 -1
View File
@@ -74,6 +74,8 @@ struct object_data {
};
/* Key List for storing the object data sorted by instance number */
static OS_Keylist Object_List;
/* common object type */
static const BACNET_OBJECT_TYPE Object_Type = OBJECT_ANALOG_OUTPUT;
/* callback for present value writes */
static analog_output_write_present_value_callback
Analog_Output_Write_Present_Value_Callback;
@@ -559,7 +561,7 @@ bool Analog_Output_Name_Set(uint32_t object_instance, char *new_name)
characterstring_init_ansi(&object_name, new_name);
if (Device_Valid_Object_Name(
&object_name, &found_type, &found_instance)) {
if ((found_type == OBJECT_ANALOG_OUTPUT) &&
if ((found_type == Object_Type) &&
(found_instance == object_instance)) {
/* writing same name to same object */
status = true;
@@ -1007,6 +1009,19 @@ int Analog_Output_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
apdu = rpdata->application_data;
switch (rpdata->object_property) {
case PROP_OBJECT_IDENTIFIER:
apdu_len = encode_application_object_id(
&apdu[0], Object_Type, rpdata->object_instance);
break;
case PROP_OBJECT_NAME:
Analog_Output_Object_Name(rpdata->object_instance, &char_string);
apdu_len =
encode_application_character_string(&apdu[0], &char_string);
break;
case PROP_OBJECT_TYPE:
apdu_len =
encode_application_enumerated(&apdu[0], Object_Type);
break;
case PROP_PRESENT_VALUE:
real_value = Analog_Output_Present_Value(rpdata->object_instance);
apdu_len = encode_application_real(&apdu[0], real_value);
+16 -1
View File
@@ -73,6 +73,8 @@ struct object_data {
};
/* Key List for storing the object data sorted by instance number */
static OS_Keylist Object_List;
/* common object type */
static const BACNET_OBJECT_TYPE Object_Type = OBJECT_BINARY_OUTPUT;
/* callback for present value writes */
static binary_output_write_present_value_callback
Binary_Output_Write_Present_Value_Callback;
@@ -563,7 +565,7 @@ bool Binary_Output_Name_Set(uint32_t object_instance, char *new_name)
characterstring_init_ansi(&object_name, new_name);
if (Device_Valid_Object_Name(
&object_name, &found_type, &found_instance)) {
if ((found_type == OBJECT_BINARY_OUTPUT) &&
if ((found_type == Object_Type) &&
(found_instance == object_instance)) {
/* writing same name to same object */
status = true;
@@ -987,6 +989,19 @@ int Binary_Output_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
}
apdu = rpdata->application_data;
switch (rpdata->object_property) {
case PROP_OBJECT_IDENTIFIER:
apdu_len = encode_application_object_id(
&apdu[0], Object_Type, rpdata->object_instance);
break;
case PROP_OBJECT_NAME:
Binary_Output_Object_Name(rpdata->object_instance, &char_string);
apdu_len =
encode_application_character_string(&apdu[0], &char_string);
break;
case PROP_OBJECT_TYPE:
apdu_len =
encode_application_enumerated(&apdu[0], Object_Type);
break;
case PROP_PRESENT_VALUE:
present_value =
Binary_Output_Present_Value(rpdata->object_instance);
+15 -1
View File
@@ -69,6 +69,8 @@ struct object_data {
};
/* Key List for storing the object data sorted by instance number */
static OS_Keylist Object_List;
/* common object type */
static const BACNET_OBJECT_TYPE Object_Type = OBJECT_MULTI_STATE_OUTPUT;
/* callback for present value writes */
static multistate_output_write_present_value_callback
Multistate_Output_Write_Present_Value_Callback;
@@ -650,7 +652,7 @@ bool Multistate_Output_Name_Set(uint32_t object_instance, char *new_name)
characterstring_init_ansi(&object_name, new_name);
if (Device_Valid_Object_Name(
&object_name, &found_type, &found_instance)) {
if ((found_type == OBJECT_MULTI_STATE_VALUE) &&
if ((found_type == Object_Type) &&
(found_instance == object_instance)) {
/* writing same name to same object */
status = true;
@@ -928,6 +930,18 @@ int Multistate_Output_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
}
apdu = rpdata->application_data;
switch (rpdata->object_property) {
case PROP_OBJECT_IDENTIFIER:
apdu_len = encode_application_object_id(
&apdu[0], Object_Type, rpdata->object_instance);
break;
case PROP_OBJECT_NAME:
Multistate_Output_Object_Name(rpdata->object_instance, &char_string);
apdu_len =
encode_application_character_string(&apdu[0], &char_string);
break;
case PROP_OBJECT_TYPE:
apdu_len = encode_application_enumerated(&apdu[0], Object_Type);
break;
case PROP_PRESENT_VALUE:
present_value =
Multistate_Output_Present_Value(rpdata->object_instance);