Added additional BACnet demo object API (header files) for various properties. Updated demo objects to compile cleanly with the updated API.

This commit is contained in:
skarg
2013-05-22 17:42:48 +00:00
parent afa20e55b3
commit f52fc092e5
16 changed files with 310 additions and 78 deletions
+33 -11
View File
@@ -55,7 +55,7 @@ static uint8_t
Multistate_Output_Level[MAX_MULTISTATE_OUTPUTS][BACNET_MAX_PRIORITY];
/* Writable out-of-service allows others to play with our Present Value */
/* without changing the physical output */
static bool Multistate_Output_Out_Of_Service[MAX_MULTISTATE_OUTPUTS];
static bool Out_Of_Service[MAX_MULTISTATE_OUTPUTS];
/* These three arrays are used by the ReadPropertyMultiple handler */
static const int Multistate_Output_Properties_Required[] = {
@@ -159,7 +159,7 @@ unsigned Multistate_Output_Instance_To_Index(
return index;
}
static uint32_t Multistate_Output_Present_Value(
uint32_t Multistate_Output_Present_Value(
uint32_t object_instance)
{
uint32_t value = MULTISTATE_RELINQUISH_DEFAULT;
@@ -195,6 +195,32 @@ bool Multistate_Output_Object_Name(
return status;
}
bool Multistate_Output_Out_Of_Service(
uint32_t instance)
{
unsigned index = 0;
bool oos_flag = false;
index = Multistate_Output_Instance_To_Index(instance);
if (index < MAX_MULTISTATE_OUTPUTS) {
oos_flag = Out_Of_Service[index];
}
return oos_flag;
}
void Multistate_Output_Out_Of_Service_Set(
uint32_t instance,
bool oos_flag)
{
unsigned index = 0;
index = Multistate_Output_Instance_To_Index(instance);
if (index < MAX_MULTISTATE_OUTPUTS) {
Out_Of_Service[index] = oos_flag;
}
}
/* return apdu len, or BACNET_STATUS_ERROR on error */
int Multistate_Output_Read_Property(
BACNET_READ_PROPERTY_DATA * rpdata)
@@ -245,7 +271,8 @@ int Multistate_Output_Read_Property(
bitstring_set_bit(&bit_string, STATUS_FLAG_IN_ALARM, false);
bitstring_set_bit(&bit_string, STATUS_FLAG_FAULT, false);
bitstring_set_bit(&bit_string, STATUS_FLAG_OVERRIDDEN, false);
bitstring_set_bit(&bit_string, STATUS_FLAG_OUT_OF_SERVICE, false);
state = Multistate_Output_Out_Of_Service(rpdata->object_instance);
bitstring_set_bit(&bit_string, STATUS_FLAG_OUT_OF_SERVICE, state);
apdu_len = encode_application_bitstring(&apdu[0], &bit_string);
break;
case PROP_EVENT_STATE:
@@ -254,9 +281,7 @@ int Multistate_Output_Read_Property(
encode_application_enumerated(&apdu[0], EVENT_STATE_NORMAL);
break;
case PROP_OUT_OF_SERVICE:
object_index =
Multistate_Output_Instance_To_Index(rpdata->object_instance);
state = Multistate_Output_Out_Of_Service[object_index];
state = Multistate_Output_Out_Of_Service(rpdata->object_instance);
apdu_len = encode_application_boolean(&apdu[0], state);
break;
case PROP_PRIORITY_ARRAY:
@@ -440,11 +465,8 @@ bool Multistate_Output_Write_Property(
WPValidateArgType(&value, BACNET_APPLICATION_TAG_BOOLEAN,
&wp_data->error_class, &wp_data->error_code);
if (status) {
object_index =
Multistate_Output_Instance_To_Index
(wp_data->object_instance);
Multistate_Output_Out_Of_Service[object_index] =
value.type.Boolean;
Multistate_Output_Out_Of_Service_Set(wp_data->object_instance,
value.type.Boolean);
}
break;
case PROP_OBJECT_IDENTIFIER: