Added characterstring change of value example (#175)
* Added characterstring change of value example * Add COV to unit tests * Add memcopy to object COV unit tests Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
This commit is contained in:
@@ -368,41 +368,19 @@ bool Multistate_Value_Encode_Value_List(
|
||||
uint32_t object_instance, BACNET_PROPERTY_VALUE *value_list)
|
||||
{
|
||||
bool status = false;
|
||||
const bool in_alarm = false;
|
||||
const bool fault = false;
|
||||
const bool overridden = false;
|
||||
bool out_of_service = false;
|
||||
uint32_t present_value = 0.0;
|
||||
unsigned index = 0;
|
||||
|
||||
if (value_list) {
|
||||
value_list->propertyIdentifier = PROP_PRESENT_VALUE;
|
||||
value_list->propertyArrayIndex = BACNET_ARRAY_ALL;
|
||||
value_list->value.context_specific = false;
|
||||
value_list->value.tag = BACNET_APPLICATION_TAG_ENUMERATED;
|
||||
value_list->value.next = NULL;
|
||||
value_list->value.type.Enumerated =
|
||||
Multistate_Value_Present_Value(object_instance);
|
||||
value_list->priority = BACNET_NO_PRIORITY;
|
||||
value_list = value_list->next;
|
||||
}
|
||||
if (value_list) {
|
||||
value_list->propertyIdentifier = PROP_STATUS_FLAGS;
|
||||
value_list->propertyArrayIndex = BACNET_ARRAY_ALL;
|
||||
value_list->value.context_specific = false;
|
||||
value_list->value.tag = BACNET_APPLICATION_TAG_BIT_STRING;
|
||||
value_list->value.next = NULL;
|
||||
bitstring_init(&value_list->value.type.Bit_String);
|
||||
bitstring_set_bit(
|
||||
&value_list->value.type.Bit_String, STATUS_FLAG_IN_ALARM, false);
|
||||
bitstring_set_bit(
|
||||
&value_list->value.type.Bit_String, STATUS_FLAG_FAULT, false);
|
||||
bitstring_set_bit(
|
||||
&value_list->value.type.Bit_String, STATUS_FLAG_OVERRIDDEN, false);
|
||||
if (Multistate_Value_Out_Of_Service(object_instance)) {
|
||||
bitstring_set_bit(&value_list->value.type.Bit_String,
|
||||
STATUS_FLAG_OUT_OF_SERVICE, true);
|
||||
} else {
|
||||
bitstring_set_bit(&value_list->value.type.Bit_String,
|
||||
STATUS_FLAG_OUT_OF_SERVICE, false);
|
||||
}
|
||||
value_list->priority = BACNET_NO_PRIORITY;
|
||||
value_list->next = NULL;
|
||||
status = true;
|
||||
index = Multistate_Value_Instance_To_Index(object_instance);
|
||||
if (index < MAX_MULTISTATE_VALUES) {
|
||||
present_value = Present_Value[index];
|
||||
out_of_service = Out_Of_Service[index];
|
||||
status = cov_value_list_encode_enumerated(value_list, present_value,
|
||||
in_alarm, fault, overridden, out_of_service);
|
||||
}
|
||||
|
||||
return status;
|
||||
|
||||
Reference in New Issue
Block a user