Simplified write property code using new validation helper functions in h_wp.c.

This commit is contained in:
petermcs
2010-02-04 16:22:12 +00:00
parent 818ddefae5
commit 634237cf43
11 changed files with 62 additions and 162 deletions
+3 -9
View File
@@ -35,6 +35,7 @@
#include "config.h" /* the custom stuff */
#include "wp.h"
#include "ao.h"
#include "handlers.h"
#define MAX_ANALOG_OUTPUTS 4
@@ -436,7 +437,7 @@ bool Analog_Output_Write_Property(
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
}
} else if (value.tag == BACNET_APPLICATION_TAG_NULL) {
} else if(WPValidateArgType(&value, BACNET_APPLICATION_TAG_NULL, error_class, error_code) == true) {
level = AO_LEVEL_NULL;
object_index =
Analog_Output_Instance_To_Index(wp_data->object_instance);
@@ -447,21 +448,14 @@ bool Analog_Output_Write_Property(
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
}
} else {
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_INVALID_DATA_TYPE;
}
break;
case PROP_OUT_OF_SERVICE:
if (value.tag == BACNET_APPLICATION_TAG_BOOLEAN) {
if((status = WPValidateArgType(&value, BACNET_APPLICATION_TAG_BOOLEAN, error_class, error_code)) == true) {
object_index =
Analog_Output_Instance_To_Index(wp_data->object_instance);
Analog_Output_Out_Of_Service[object_index] =
value.type.Boolean;
status = true;
} else {
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_INVALID_DATA_TYPE;
}
break;
default:
+3 -9
View File
@@ -35,6 +35,7 @@
#include "config.h" /* the custom stuff */
#include "wp.h"
#include "av.h"
#include "handlers.h"
/* we choose to have a NULL level in our system represented by */
/* a particular value. When the priorities are not in use, they */
@@ -397,7 +398,7 @@ bool Analog_Value_Write_Property(
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
}
} else if (value.tag == BACNET_APPLICATION_TAG_NULL) {
} else if(WPValidateArgType(&value, BACNET_APPLICATION_TAG_NULL, error_class, error_code) == true) {
level = ANALOG_LEVEL_NULL;
object_index =
Analog_Value_Instance_To_Index(wp_data->object_instance);
@@ -416,20 +417,13 @@ bool Analog_Value_Write_Property(
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
}
} else {
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_INVALID_DATA_TYPE;
}
break;
case PROP_OUT_OF_SERVICE:
if (value.tag == BACNET_APPLICATION_TAG_BOOLEAN) {
if((status = WPValidateArgType(&value, BACNET_APPLICATION_TAG_BOOLEAN, error_class, error_code)) == true) {
object_index =
Analog_Value_Instance_To_Index(wp_data->object_instance);
Analog_Value_Out_Of_Service[object_index] = value.type.Boolean;
status = true;
} else {
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_INVALID_DATA_TYPE;
}
break;
default:
+2 -8
View File
@@ -300,27 +300,21 @@ bool bacfile_write_property(
property shall be logical TRUE only if no changes have been
made to the file data by internal processes or through File
Access Services since the last time the object was archived. */
if (value.tag == BACNET_APPLICATION_TAG_BOOLEAN) {
if((status = WPValidateArgType(&value, BACNET_APPLICATION_TAG_BOOLEAN, error_class, error_code)) == true) {
if (value.type.Boolean) {
/* FIXME: do something to wp_data->object_instance */
} else {
/* FIXME: do something to wp_data->object_instance */
}
} else {
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_INVALID_DATA_TYPE;
}
break;
case PROP_FILE_SIZE:
/* If the file size can be changed by writing to the file,
and File_Access_Method is STREAM_ACCESS, then this property
shall be writable. */
if (value.tag == BACNET_APPLICATION_TAG_UNSIGNED_INT) {
if((status = WPValidateArgType(&value, BACNET_APPLICATION_TAG_UNSIGNED_INT, error_class, error_code)) == true) {
/* FIXME: do something with value.type.Unsigned
to wp_data->object_instance */
} else {
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_INVALID_DATA_TYPE;
}
break;
default:
+3 -9
View File
@@ -34,6 +34,7 @@
#include "wp.h"
#include "cov.h"
#include "config.h" /* the custom stuff */
#include "handlers.h"
#define MAX_BINARY_INPUTS 5
@@ -394,7 +395,7 @@ bool Binary_Input_Write_Property(
/* FIXME: len == 0: unable to decode? */
switch (wp_data->object_property) {
case PROP_PRESENT_VALUE:
if (value.tag == BACNET_APPLICATION_TAG_ENUMERATED) {
if(WPValidateArgType(&value, BACNET_APPLICATION_TAG_ENUMERATED, error_class, error_code) == true) {
if (value.type.Enumerated <= MAX_BINARY_PV) {
Binary_Input_Present_Value_Set(wp_data->object_instance,
(BACNET_BINARY_PV) value.type.Enumerated);
@@ -403,19 +404,12 @@ bool Binary_Input_Write_Property(
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
}
} else {
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_INVALID_DATA_TYPE;
}
break;
case PROP_OUT_OF_SERVICE:
if (value.tag == BACNET_APPLICATION_TAG_BOOLEAN) {
if((status = WPValidateArgType(&value, BACNET_APPLICATION_TAG_BOOLEAN, error_class, error_code)) == true) {
Binary_Input_Out_Of_Service_Set(wp_data->object_instance,
value.type.Boolean);
status = true;
} else {
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_INVALID_DATA_TYPE;
}
break;
default:
+3 -9
View File
@@ -34,6 +34,7 @@
#include "bacapp.h"
#include "config.h" /* the custom stuff */
#include "wp.h"
#include "handlers.h"
#define MAX_BINARY_OUTPUTS 6
@@ -392,7 +393,7 @@ bool Binary_Output_Write_Property(
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
}
} else if (value.tag == BACNET_APPLICATION_TAG_NULL) {
} else if(WPValidateArgType(&value, BACNET_APPLICATION_TAG_NULL, error_class, error_code) == true) {
level = BINARY_NULL;
object_index =
Binary_Output_Instance_To_Index(wp_data->object_instance);
@@ -411,21 +412,14 @@ bool Binary_Output_Write_Property(
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
}
} else {
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_INVALID_DATA_TYPE;
}
break;
case PROP_OUT_OF_SERVICE:
if (value.tag == BACNET_APPLICATION_TAG_BOOLEAN) {
if((status = WPValidateArgType(&value, BACNET_APPLICATION_TAG_BOOLEAN, error_class, error_code)) == true) {
object_index =
Binary_Output_Instance_To_Index(wp_data->object_instance);
Binary_Output_Out_Of_Service[object_index] =
value.type.Boolean;
status = true;
} else {
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_INVALID_DATA_TYPE;
}
break;
default:
+4 -11
View File
@@ -34,6 +34,7 @@
#include "bacapp.h"
#include "config.h" /* the custom stuff */
#include "wp.h"
#include "handlers.h"
#define MAX_BINARY_VALUES 2
@@ -373,7 +374,7 @@ bool Binary_Value_Write_Property(
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
}
} else if (value.tag == BACNET_APPLICATION_TAG_NULL) {
} else if(WPValidateArgType(&value, BACNET_APPLICATION_TAG_NULL, error_class, error_code) == true) {
level = BINARY_NULL;
object_index =
Binary_Value_Instance_To_Index(wp_data->object_instance);
@@ -392,20 +393,12 @@ bool Binary_Value_Write_Property(
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
}
} else {
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_INVALID_DATA_TYPE;
}
break;
case PROP_OUT_OF_SERVICE:
if (value.tag == BACNET_APPLICATION_TAG_BOOLEAN) {
object_index =
Binary_Value_Instance_To_Index(wp_data->object_instance);
if((status = WPValidateArgType(&value, BACNET_APPLICATION_TAG_BOOLEAN, error_class, error_code)) == true) {
object_index = Binary_Value_Instance_To_Index(wp_data->object_instance);
Binary_Value_Out_Of_Service[object_index] = value.type.Boolean;
status = true;
} else {
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_INVALID_DATA_TYPE;
}
break;
default:
+7 -12
View File
@@ -39,6 +39,7 @@
#include "bacapp.h"
#include "config.h" /* the custom stuff */
#include "wp.h"
#include "handlers.h"
#define MAX_LIGHTING_OUTPUTS 5
@@ -155,7 +156,7 @@ int Lighting_Output_Decode_Lighting_Command(
apdu_len += len;
len =
decode_enumerated(&apdu[apdu_len], len_value_type,
&data->operation);
(uint32_t *)&data->operation);
apdu_len += len;
/* Tag 1: level - OPTIONAL */
if (decode_is_context_tag(&apdu[apdu_len], 1)) {
@@ -165,7 +166,7 @@ int Lighting_Output_Decode_Lighting_Command(
apdu_len += len;
len = decode_real(&apdu[apdu_len], &real_value);
apdu_len += len;
data->level = real_value;
data->level = (uint8_t)real_value;
/* FIXME: are we going to flag errors in decoding values here? */
}
/* FIXME: finish me! */
@@ -561,7 +562,7 @@ bool Lighting_Output_Write_Property(
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
}
} else if (value.tag == BACNET_APPLICATION_TAG_NULL) {
} else if(WPValidateArgType(&value, BACNET_APPLICATION_TAG_NULL, error_class, error_code) == true) {
level = LIGHTING_LEVEL_NULL;
object_index =
Lighting_Output_Instance_To_Index
@@ -572,16 +573,14 @@ bool Lighting_Output_Write_Property(
if (wp_data->priority == 6) {
/* Command priority 6 is reserved for use by Minimum On/Off
algorithm and may not be used for other purposes in any
object. */
object. - Note Lighting_Output_Present_Value_Relinquish()
will have returned false because of this */
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_WRITE_ACCESS_DENIED;
} else if (!status) {
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
}
} else {
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_INVALID_DATA_TYPE;
}
break;
case PROP_LIGHTING_COMMAND:
@@ -591,16 +590,12 @@ bool Lighting_Output_Write_Property(
&Lighting_Command[wp_data->object_instance]);
break;
case PROP_OUT_OF_SERVICE:
if (value.tag == BACNET_APPLICATION_TAG_BOOLEAN) {
if((status = WPValidateArgType(&value, BACNET_APPLICATION_TAG_BOOLEAN, error_class, error_code)) == true) {
object_index =
Lighting_Output_Instance_To_Index
(wp_data->object_instance);
Lighting_Output_Out_Of_Service[object_index] =
value.type.Boolean;
status = true;
} else {
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_INVALID_DATA_TYPE;
}
break;
default:
+3 -9
View File
@@ -34,6 +34,7 @@
#include "bacapp.h"
#include "config.h" /* the custom stuff */
#include "wp.h"
#include "handlers.h"
#define MAX_LIFE_SAFETY_POINTS 7
@@ -320,7 +321,7 @@ bool Life_Safety_Point_Write_Property(
/* FIXME: len == 0: unable to decode? */
switch (wp_data->object_property) {
case PROP_MODE:
if (value.tag == BACNET_APPLICATION_TAG_ENUMERATED) {
if(WPValidateArgType(&value, BACNET_APPLICATION_TAG_ENUMERATED, error_class, error_code) == true) {
if (value.type.Enumerated <= MAX_LIFE_SAFETY_MODE) {
object_index =
Life_Safety_Point_Instance_To_Index
@@ -332,22 +333,15 @@ bool Life_Safety_Point_Write_Property(
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
}
} else {
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_INVALID_DATA_TYPE;
}
break;
case PROP_OUT_OF_SERVICE:
if (value.tag == BACNET_APPLICATION_TAG_BOOLEAN) {
if((status = WPValidateArgType(&value, BACNET_APPLICATION_TAG_BOOLEAN, error_class, error_code)) == true) {
object_index =
Life_Safety_Point_Instance_To_Index
(wp_data->object_instance);
Life_Safety_Point_Out_Of_Service[object_index] =
value.type.Boolean;
status = true;
} else {
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_INVALID_DATA_TYPE;
}
break;
default:
+3 -9
View File
@@ -34,6 +34,7 @@
#include "bacapp.h"
#include "config.h" /* the custom stuff */
#include "wp.h"
#include "handlers.h"
#ifndef MAX_MULTISTATE_INPUTS
#define MAX_MULTISTATE_INPUTS 1
@@ -472,7 +473,7 @@ bool Multistate_Input_Write_Property(
/* FIXME: len == 0: unable to decode? */
switch (wp_data->object_property) {
case PROP_PRESENT_VALUE:
if (value.tag == BACNET_APPLICATION_TAG_UNSIGNED_INT) {
if(WPValidateArgType(&value, BACNET_APPLICATION_TAG_UNSIGNED_INT, error_class, error_code) == true) {
if (Out_Of_Service[object_index]) {
if (Multistate_Input_Present_Value_Set(wp_data->
object_instance, value.type.Unsigned_Int)) {
@@ -485,21 +486,14 @@ bool Multistate_Input_Write_Property(
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_WRITE_ACCESS_DENIED;
}
} else {
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_INVALID_DATA_TYPE;
}
break;
case PROP_OUT_OF_SERVICE:
if (value.tag == BACNET_APPLICATION_TAG_BOOLEAN) {
if((status = WPValidateArgType(&value, BACNET_APPLICATION_TAG_BOOLEAN, error_class, error_code)) == true) {
object_index =
Multistate_Input_Instance_To_Index
(wp_data->object_instance);
Out_Of_Service[object_index] = value.type.Boolean;
status = true;
} else {
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_INVALID_DATA_TYPE;
}
break;
default:
+3 -9
View File
@@ -34,6 +34,7 @@
#include "bacapp.h"
#include "config.h" /* the custom stuff */
#include "wp.h"
#include "handlers.h"
#define MAX_MULTISTATE_OUTPUTS 4
@@ -393,7 +394,7 @@ bool Multistate_Output_Write_Property(
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
}
} else if (value.tag == BACNET_APPLICATION_TAG_NULL) {
} else if(WPValidateArgType(&value, BACNET_APPLICATION_TAG_NULL, error_class, error_code) == true) {
level = MULTISTATE_NULL;
object_index =
Multistate_Output_Instance_To_Index
@@ -414,22 +415,15 @@ bool Multistate_Output_Write_Property(
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
}
} else {
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_INVALID_DATA_TYPE;
}
break;
case PROP_OUT_OF_SERVICE:
if (value.tag == BACNET_APPLICATION_TAG_BOOLEAN) {
if((status = WPValidateArgType(&value, BACNET_APPLICATION_TAG_BOOLEAN, error_class, error_code)) == true) {
object_index =
Multistate_Output_Instance_To_Index
(wp_data->object_instance);
Multistate_Output_Out_Of_Service[object_index] =
value.type.Boolean;
status = true;
} else {
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_INVALID_DATA_TYPE;
}
break;
default:
+28 -68
View File
@@ -531,7 +531,7 @@ bool Trend_Log_Write_Property(
switch (wp_data->object_property) {
case PROP_ENABLE:
if (value.tag == BACNET_APPLICATION_TAG_BOOLEAN) {
if(WPValidateArgType(&value, BACNET_APPLICATION_TAG_BOOLEAN, error_class, error_code) == true) {
/* Section 12.25.5 can't enable a full log with stop when full set */
if((CurrentLog->bEnable == false) &&
(CurrentLog->bStopWhenFull == true) &&
@@ -561,16 +561,12 @@ bool Trend_Log_Write_Property(
}
}
}
status = true;
} else {
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_INVALID_DATA_TYPE;
}
break;
case PROP_STOP_WHEN_FULL:
if (value.tag == BACNET_APPLICATION_TAG_BOOLEAN) {
if((status = WPValidateArgType(&value, BACNET_APPLICATION_TAG_BOOLEAN, error_class, error_code)) == true) {
/* Only trigger this on a change of state */
if(CurrentLog->bStopWhenFull != value.type.Boolean) {
CurrentLog->bStopWhenFull = value.type.Boolean;
@@ -586,10 +582,6 @@ bool Trend_Log_Write_Property(
TL_Insert_Status_Rec(wp_data->object_instance, LOG_STATUS_LOG_DISABLED, true);
}
}
status = true;
} else {
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_INVALID_DATA_TYPE;
}
break;
@@ -603,17 +595,13 @@ bool Trend_Log_Write_Property(
break;
case PROP_RECORD_COUNT:
if (value.tag == BACNET_APPLICATION_TAG_UNSIGNED_INT) {
if((status = WPValidateArgType(&value, BACNET_APPLICATION_TAG_UNSIGNED_INT, error_class, error_code)) == true) {
if(value.type.Unsigned_Int == 0) {
/* Time to clear down the log */
CurrentLog->ulRecordCount = 0;
CurrentLog->iIndex = 0;
TL_Insert_Status_Rec(wp_data->object_instance, LOG_STATUS_BUFFER_PURGED, true);
}
status = true;
} else {
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_INVALID_DATA_TYPE;
}
break;
@@ -622,7 +610,7 @@ bool Trend_Log_Write_Property(
* triggered and polled options.
*/
if (value.tag == BACNET_APPLICATION_TAG_ENUMERATED) {
if(WPValidateArgType(&value, BACNET_APPLICATION_TAG_ENUMERATED, error_class, error_code) == true) {
if(value.type.Enumerated != LOGGING_TYPE_COV) {
CurrentLog->LoggingType = value.type.Enumerated;
if(value.type.Enumerated == LOGGING_TYPE_POLLED) {
@@ -641,26 +629,20 @@ bool Trend_Log_Write_Property(
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_OPTIONAL_FUNCTIONALITY_NOT_SUPPORTED;
}
} else {
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_INVALID_DATA_TYPE;
}
break;
case PROP_START_TIME:
/* Copy the date part to safe place */
if (value.tag == BACNET_APPLICATION_TAG_DATE) {
TempDate = value.type.Date;
} else {
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_INVALID_DATA_TYPE;
if(WPValidateArgType(&value, BACNET_APPLICATION_TAG_DATE, error_class, error_code) == false)
break;
}
/* Then decode the time part */
TempDate = value.type.Date;
/* Then decode the time part */
len = bacapp_decode_application_data(wp_data->application_data + len,
wp_data->application_data_len - len, &value);
if (len && value.tag == BACNET_APPLICATION_TAG_TIME) {
if (len && ((status = WPValidateArgType(&value, BACNET_APPLICATION_TAG_TIME, error_class, error_code)) == true)) {
/* First record the current enable state of the log */
bEffectiveEnable = TL_Is_Enabled(wp_data->object_instance);
CurrentLog->StartTime.date = TempDate; /* Safe to copy the date now */
@@ -686,27 +668,20 @@ bool Trend_Log_Write_Property(
TL_Insert_Status_Rec(wp_data->object_instance, LOG_STATUS_LOG_DISABLED, false);
}
}
status = true;
} else {
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_INVALID_DATA_TYPE;
}
break;
case PROP_STOP_TIME:
/* Copy the date part to safe place */
if (value.tag == BACNET_APPLICATION_TAG_DATE) {
TempDate = value.type.Date;
} else {
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_INVALID_DATA_TYPE;
if(WPValidateArgType(&value, BACNET_APPLICATION_TAG_DATE, error_class, error_code) == false)
break;
}
TempDate = value.type.Date;
/* Then decode the time part */
len = bacapp_decode_application_data(wp_data->application_data + len,
wp_data->application_data_len - len, &value);
if (len && value.tag == BACNET_APPLICATION_TAG_TIME) {
if (len && ((status = WPValidateArgType(&value, BACNET_APPLICATION_TAG_TIME, error_class, error_code)) == true)) {
/* First record the current enable state of the log */
bEffectiveEnable = TL_Is_Enabled(wp_data->object_instance);
CurrentLog->StopTime.date = TempDate; /* Safe to copy the date now */
@@ -732,10 +707,6 @@ bool Trend_Log_Write_Property(
TL_Insert_Status_Rec(wp_data->object_instance, LOG_STATUS_LOG_DISABLED, false);
}
}
status = true;
} else {
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_INVALID_DATA_TYPE;
}
break;
@@ -826,46 +797,38 @@ bool Trend_Log_Write_Property(
/* Read only if triggered log so flag error and bail out */
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_WRITE_ACCESS_DENIED;
} else if((CurrentLog->LoggingType == LOGGING_TYPE_POLLED) &&
(value.tag == BACNET_APPLICATION_TAG_UNSIGNED_INT) &&
(value.type.Unsigned_Int == 0)) {
break;
}
if(WPValidateArgType(&value, BACNET_APPLICATION_TAG_UNSIGNED_INT, error_class, error_code) == true) {
if((CurrentLog->LoggingType == LOGGING_TYPE_POLLED) && (value.type.Unsigned_Int == 0)) {
/* We don't support COV at the moment so don't allow switching
* to it by clearing interval whilst in polling mode */
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_OPTIONAL_FUNCTIONALITY_NOT_SUPPORTED;
} else if (value.tag == BACNET_APPLICATION_TAG_UNSIGNED_INT) {
/* We only log to 1 sec accuracy so must divide by 100 before passing it on */
CurrentLog->ulLogInterval = value.type.Unsigned_Int / 100;
status = true;
} else {
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_INVALID_DATA_TYPE;
} else {
/* We only log to 1 sec accuracy so must divide by 100 before passing it on */
CurrentLog->ulLogInterval = value.type.Unsigned_Int / 100;
status = true;
}
}
break;
case PROP_ALIGN_INTERVALS:
if (value.tag == BACNET_APPLICATION_TAG_BOOLEAN) {
if((status = WPValidateArgType(&value, BACNET_APPLICATION_TAG_BOOLEAN, error_class, error_code)) == true)
CurrentLog->bAlignIntervals = value.type.Boolean;
status = true;
} else {
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_INVALID_DATA_TYPE;
}
break;
case PROP_INTERVAL_OFFSET:
/* We only log to 1 sec accuracy so must divide by 100 before passing it on */
if (value.tag == BACNET_APPLICATION_TAG_UNSIGNED_INT) {
if((status = WPValidateArgType(&value, BACNET_APPLICATION_TAG_UNSIGNED_INT, error_class, error_code)) == true)
CurrentLog->ulIntervalOffset = value.type.Unsigned_Int / 100;
status = true;
} else {
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_INVALID_DATA_TYPE;
}
break;
case PROP_TRIGGER:
if (value.tag == BACNET_APPLICATION_TAG_BOOLEAN) {
if(WPValidateArgType(&value, BACNET_APPLICATION_TAG_BOOLEAN, error_class, error_code) == true) {
/* We will not allow triggered operation if polling with aligning
* to the clock as that will produce non aligned readings which
* goes against the reason for selscting this mode
@@ -878,9 +841,6 @@ bool Trend_Log_Write_Property(
CurrentLog->bTrigger = value.type.Boolean;
status = true;
}
} else {
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_INVALID_DATA_TYPE;
}
break;