Refactored the Property_List property and added Protocol_Revision 14 define restriction for Property_List and Channel and Lighting Output objects.
This commit is contained in:
@@ -352,6 +352,7 @@ static object_functions_t My_Object_Table[] = {
|
||||
NULL /* COV */ ,
|
||||
NULL /* COV Clear */ ,
|
||||
NULL /* Intrinsic Reporting */ },
|
||||
#if (BACNET_PROTOCOL_REVISION >= 14)
|
||||
{OBJECT_LIGHTING_OUTPUT,
|
||||
Lighting_Output_Init,
|
||||
Lighting_Output_Count,
|
||||
@@ -382,6 +383,7 @@ static object_functions_t My_Object_Table[] = {
|
||||
NULL /* COV */ ,
|
||||
NULL /* COV Clear */ ,
|
||||
NULL /* Intrinsic Reporting */ },
|
||||
#endif
|
||||
#if defined(BACFILE)
|
||||
{OBJECT_FILE,
|
||||
bacfile_init,
|
||||
@@ -1442,7 +1444,7 @@ int Device_Read_Property_Local(
|
||||
break;
|
||||
}
|
||||
/* only array properties can have array options */
|
||||
if ((apdu_len >= 0) && (rpdata->object_property != PROP_OBJECT_LIST) &&
|
||||
if ((apdu_len >= 0) &&
|
||||
(rpdata->array_index != BACNET_ARRAY_ALL)) {
|
||||
rpdata->error_class = ERROR_CLASS_PROPERTY;
|
||||
rpdata->error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY;
|
||||
@@ -1465,6 +1467,9 @@ int Device_Read_Property(
|
||||
{
|
||||
int apdu_len = BACNET_STATUS_ERROR;
|
||||
struct object_functions *pObject = NULL;
|
||||
#if (BACNET_PROTOCOL_REVISION >= 14)
|
||||
struct special_property_list_t property_list;
|
||||
#endif
|
||||
|
||||
/* initialize the default return values */
|
||||
rpdata->error_class = ERROR_CLASS_OBJECT;
|
||||
@@ -1474,7 +1479,21 @@ int Device_Read_Property(
|
||||
if (pObject->Object_Valid_Instance &&
|
||||
pObject->Object_Valid_Instance(rpdata->object_instance)) {
|
||||
if (pObject->Object_Read_Property) {
|
||||
apdu_len = pObject->Object_Read_Property(rpdata);
|
||||
#if (BACNET_PROTOCOL_REVISION >= 14)
|
||||
if ((int)rpdata->object_property == PROP_PROPERTY_LIST) {
|
||||
Device_Objects_Property_List(
|
||||
rpdata->object_type,
|
||||
&property_list);
|
||||
apdu_len = property_list_encode(
|
||||
rpdata,
|
||||
property_list.Required.pList,
|
||||
property_list.Optional.pList,
|
||||
property_list.Proprietary.pList);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
apdu_len = pObject->Object_Read_Property(rpdata);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1717,7 +1736,15 @@ bool Device_Write_Property(
|
||||
if (pObject->Object_Valid_Instance &&
|
||||
pObject->Object_Valid_Instance(wp_data->object_instance)) {
|
||||
if (pObject->Object_Write_Property) {
|
||||
status = pObject->Object_Write_Property(wp_data);
|
||||
#if (BACNET_PROTOCOL_REVISION >= 14)
|
||||
if (wp_data->object_property == PROP_PROPERTY_LIST) {
|
||||
wp_data->error_class = ERROR_CLASS_PROPERTY;
|
||||
wp_data->error_code = ERROR_CODE_WRITE_ACCESS_DENIED;
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
status = pObject->Object_Write_Property(wp_data);
|
||||
}
|
||||
} else {
|
||||
wp_data->error_class = ERROR_CLASS_PROPERTY;
|
||||
wp_data->error_code = ERROR_CODE_WRITE_ACCESS_DENIED;
|
||||
|
||||
Reference in New Issue
Block a user