Moved COV object handling into Device object.

Fixed COV for multiple subscriptions to same object.
This commit is contained in:
skarg
2011-05-25 20:18:56 +00:00
parent 297bba14fa
commit 8da85f6c79
16 changed files with 180 additions and 103 deletions
+1 -1
View File
@@ -96,5 +96,5 @@ extern "C" {
OBJECT_ANALOG_INPUT, Analog_Input_Init, Analog_Input_Count, \
Analog_Input_Index_To_Instance, Analog_Input_Valid_Instance, \
Analog_Input_Object_Name, Analog_Input_Read_Property, NULL, \
Analog_Input_Property_Lists, NULL, NULL
Analog_Input_Property_Lists, NULL, NULL, NULL
#endif
+1 -1
View File
@@ -105,5 +105,5 @@ extern "C" {
Analog_Output_Index_To_Instance, Analog_Output_Valid_Instance, \
Analog_Output_Object_Name, Analog_Output_Read_Property, \
Analog_Output_Write_Property, Analog_Output_Property_Lists, \
NULL, NULL
NULL, NULL, NULL
#endif
+1 -1
View File
@@ -82,5 +82,5 @@ extern "C" {
Analog_Value_Index_To_Instance, Analog_Value_Valid_Instance, \
Analog_Value_Object_Name, Analog_Value_Read_Property, \
Analog_Value_Write_Property, Analog_Value_Property_Lists, NULL, \
NULL
NULL, NULL
#endif
+1 -1
View File
@@ -101,5 +101,5 @@ extern "C" {
#define FILE_OBJ_FUNCTIONS \
OBJECT_FILE, bacfile_init, bacfile_count, bacfile_index_to_instance, \
bacfile_valid_instance, bacfile_object_name, bacfile_read_property, \
bacfile_write_property, BACfile_Property_Lists, NULL
bacfile_write_property, BACfile_Property_Lists, NULL, NULL
#endif
+37 -30
View File
@@ -183,7 +183,7 @@ bool Binary_Input_Out_Of_Service(
return value;
}
bool Binary_Input_Change_Of_Value(
static bool Binary_Input_Change_Of_Value(
uint32_t object_instance)
{
bool status = false;
@@ -197,7 +197,7 @@ bool Binary_Input_Change_Of_Value(
return status;
}
void Binary_Input_Change_Of_Value_Clear(
static void Binary_Input_Change_Of_Value_Clear(
uint32_t object_instance)
{
unsigned index;
@@ -210,41 +210,48 @@ void Binary_Input_Change_Of_Value_Clear(
return;
}
/* returns true if value has changed */
bool Binary_Input_Encode_Value_List(
uint32_t object_instance,
BACNET_PROPERTY_VALUE * 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.type.Enumerated =
Binary_Input_Present_Value(object_instance);
value_list->priority = BACNET_NO_PRIORITY;
bool status = false;
value_list = value_list->next;
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;
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 (Binary_Input_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);
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.type.Enumerated =
Binary_Input_Present_Value(object_instance);
value_list->priority = BACNET_NO_PRIORITY;
value_list = value_list->next;
}
value_list->priority = BACNET_NO_PRIORITY;
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;
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 (Binary_Input_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;
}
status = Binary_Input_Change_Of_Value(object_instance);
Binary_Input_Change_Of_Value_Clear(object_instance);
return true;
return status;
}
bool Binary_Input_Present_Value_Set(
+1 -5
View File
@@ -83,10 +83,6 @@ extern "C" {
bool Binary_Input_Out_Of_Service(
uint32_t object_instance);
bool Binary_Input_Change_Of_Value(
uint32_t object_instance);
void Binary_Input_Change_Of_Value_Clear(
uint32_t object_instance);
bool Binary_Input_Encode_Value_List(
uint32_t object_instance,
BACNET_PROPERTY_VALUE * value_list);
@@ -118,5 +114,5 @@ extern "C" {
OBJECT_BINARY_INPUT, Binary_Input_Init, Binary_Input_Count, \
Binary_Input_Index_To_Instance, Binary_Input_Valid_Instance, \
Binary_Input_Object_Name, Binary_Input_Read_Property, NULL, \
Binary_Input_Property_Lists, NULL, NULL
Binary_Input_Property_Lists, NULL, NULL, Binary_Input_Encode_Value_List
#endif
+1 -1
View File
@@ -114,5 +114,5 @@ extern "C" {
Binary_Output_Index_To_Instance, Binary_Output_Valid_Instance, \
Binary_Output_Object_Name, Binary_Output_Read_Property, \
Binary_Output_Write_Property, Binary_Output_Property_Lists, \
NULL, NULL
NULL, NULL, NULL
#endif
+1 -1
View File
@@ -76,5 +76,5 @@ extern "C" {
Binary_Value_Index_To_Instance, Binary_Value_Valid_Instance, \
Binary_Value_Object_Name, Binary_Value_Read_Property, \
Binary_Value_Write_Property, Binary_Value_Property_Lists, NULL, \
NULL
NULL, NULL
#endif
+52
View File
@@ -1359,6 +1359,58 @@ bool Device_Write_Property(
return (status);
}
/** Looks up the requested Object, and fills the Property Value list.
* If the Object or Property can't be found, returns false.
* @ingroup ObjHelpers
* @param [in] The object type to be looked up.
* @param [in] The object instance number to be looked up.
* @param [out] The value list
* @return True if the object instance supports this feature and value changed.
*/
bool Device_Encode_Value_List(
BACNET_OBJECT_TYPE object_type,
uint32_t object_instance,
BACNET_PROPERTY_VALUE * value_list)
{
bool status = false; /* Ever the pessamist! */
struct object_functions *pObject = NULL;
pObject = Device_Objects_Find_Functions(object_type);
if (pObject != NULL) {
if (pObject->Object_Valid_Instance &&
pObject->Object_Valid_Instance(object_instance)) {
if (pObject->Object_Value_List) {
status = pObject->Object_Value_List(
object_instance,
value_list);
}
}
}
return (status);
}
/** Looks up the requested Object to see if the functionality is supported.
* @ingroup ObjHelpers
* @param [in] The object type to be looked up.
* @return True if the object instance supports this feature.
*/
bool Device_Value_List_Supported(
BACNET_OBJECT_TYPE object_type)
{
bool status = false; /* Ever the pessamist! */
struct object_functions *pObject = NULL;
pObject = Device_Objects_Find_Functions(object_type);
if (pObject != NULL) {
if (pObject->Object_Value_List) {
status = true;
}
}
return (status);
}
/** Initialize the Device Object.
Initialize the group of object helper functions for any supported Object.
Initialize each of the Device Object child Object instances.
+20 -1
View File
@@ -101,6 +101,17 @@ typedef unsigned (
*object_iterate_function) (
unsigned current_index);
/** Look in the table of objects of this type, and get the COV Value List.
* @ingroup ObjHelpers
* @param [in] The object instance number to be looked up.
* @param [out] The value list
* @return True if the object instance supports this feature, and has changed.
*/
typedef bool(
*object_value_list_function) (
uint32_t object_instance,
BACNET_PROPERTY_VALUE * value_list);
/** Defines the group of object helper functions for any supported Object.
* @ingroup ObjHelpers
* Each Object must provide some implementation of each of these helpers
@@ -122,6 +133,7 @@ typedef struct object_functions {
rpm_property_lists_function Object_RPM_List;
rr_info_function Object_RR_Info;
object_iterate_function Object_Iterator;
object_value_list_function Object_Value_List;
} object_functions_t;
/* String Lengths - excluding any nul terminator */
@@ -199,6 +211,13 @@ extern "C" {
BACNET_OBJECT_TYPE object_type,
struct special_property_list_t *pPropertyList);
bool Device_Encode_Value_List(
BACNET_OBJECT_TYPE object_type,
uint32_t object_instance,
BACNET_PROPERTY_VALUE * value_list);
bool Device_Value_List_Supported(
BACNET_OBJECT_TYPE object_type);
uint32_t Device_Object_Instance_Number(
void);
bool Device_Set_Object_Instance_Number(
@@ -366,7 +385,7 @@ extern "C" {
OBJECT_DEVICE, NULL, Device_Count, Device_Index_To_Instance, \
Device_Valid_Object_Instance_Number, Device_Object_Name, \
Device_Read_Property_Local, Device_Write_Property_Local, \
Device_Property_Lists, DeviceGetRRInfo, NULL
Device_Property_Lists, DeviceGetRRInfo, NULL, NULL
/** @defgroup ObjFrmwk Object Framework
* The modules in this section describe the BACnet-stack's framework for
* BACnet-defined Objects (Device, Analog Input, etc). There are two submodules
+1 -1
View File
@@ -81,5 +81,5 @@ extern "C" {
Load_Control_Index_To_Instance, Load_Control_Valid_Instance, \
Load_Control_Object_Name, Load_Control_Read_Property, \
Load_Control_Write_Property, Load_Control_Property_Lists, NULL, \
NULL
NULL, NULL
#endif
+1 -1
View File
@@ -75,5 +75,5 @@ extern "C" {
Life_Safety_Point_Valid_Instance, Life_Safety_Point_Object_Name, \
Life_Safety_Point_Read_Property, \
Life_Safety_Point_Write_Property, \
Life_Safety_Point_Property_Lists, NULL, NULL
Life_Safety_Point_Property_Lists, NULL, NULL, NULL
#endif
+1 -1
View File
@@ -102,5 +102,5 @@ extern "C" {
Multistate_Input_Valid_Instance, Multistate_Input_Object_Name, \
Multistate_Input_Read_Property, \
Multistate_Input_Write_Property, \
Multistate_Input_Property_Lists, NULL, NULL
Multistate_Input_Property_Lists, NULL, NULL, NULL
#endif
+1 -1
View File
@@ -77,5 +77,5 @@ extern "C" {
Multistate_Output_Valid_Instance, Multistate_Output_Object_Name, \
Multistate_Output_Read_Property, \
Multistate_Output_Write_Property, \
Multistate_Output_Property_Lists, NULL, NULL
Multistate_Output_Property_Lists, NULL, NULL, NULL
#endif
+1 -1
View File
@@ -202,5 +202,5 @@ extern "C" {
Trend_Log_Index_To_Instance, Trend_Log_Valid_Instance, \
Trend_Log_Object_Name, Trend_Log_Read_Property, \
Trend_Log_Write_Property, Trend_Log_Property_Lists, \
TrendLogGetRRInfo, NULL
TrendLogGetRRInfo, NULL, NULL
#endif