added clang format C and H files.

This commit is contained in:
Steve Karg
2019-10-24 16:23:10 -05:00
parent da91a11454
commit 710173d6e0
205 changed files with 19377 additions and 25754 deletions
+153 -223
View File
@@ -47,87 +47,78 @@
#include "bacdcode.h"
#include "bacenum.h"
#include "bactext.h"
#include "config.h" /* the custom stuff */
#include "config.h" /* the custom stuff */
#include "device.h"
#include "handlers.h"
#include "proplist.h"
#include "timestamp.h"
#include "command.h"
/*BACnetActionCommand ::= SEQUENCE {
deviceIdentifier [0] BACnetObjectIdentifier OPTIONAL,
objectIdentifier [1] BACnetObjectIdentifier,
propertyIdentifier [2] BACnetPropertyIdentifier,
propertyArrayIndex [3] Unsigned OPTIONAL, --used only with array datatype
propertyValue [4] ABSTRACT-SYNTAX.&Type,
priority [5] Unsigned (1..16) OPTIONAL, --used only when property is commandable
postDelay [6] Unsigned OPTIONAL,
quitOnFailure [7] BOOLEAN,
writeSuccessful [8] BOOLEAN
}*/
/*BACnetActionCommand ::= SEQUENCE {
deviceIdentifier [0] BACnetObjectIdentifier OPTIONAL,
objectIdentifier [1] BACnetObjectIdentifier,
propertyIdentifier [2] BACnetPropertyIdentifier,
propertyArrayIndex [3] Unsigned OPTIONAL, --used only with array datatype
propertyValue [4] ABSTRACT-SYNTAX.&Type,
priority [5] Unsigned (1..16) OPTIONAL, --used only when property is commandable
postDelay [6] Unsigned OPTIONAL,
quitOnFailure [7] BOOLEAN,
writeSuccessful [8] BOOLEAN
}*/
int cl_encode_apdu(
uint8_t * apdu,
BACNET_ACTION_LIST * bcl)
int cl_encode_apdu(uint8_t *apdu, BACNET_ACTION_LIST *bcl)
{
int len = 0;
int apdu_len = 0;
if (bcl->Device_Id.instance >= 0 &&
bcl->Device_Id.instance <= BACNET_MAX_INSTANCE) {
len =
encode_context_object_id(&apdu[apdu_len], 0, bcl->Device_Id.type,
bcl->Device_Id.instance);
len = encode_context_object_id(&apdu[apdu_len], 0, bcl->Device_Id.type,
bcl->Device_Id.instance);
if (len < 0)
return BACNET_STATUS_REJECT;
apdu_len += len;
}
/* TODO: Check for object type and instance limits */
len =
encode_context_object_id(&apdu[apdu_len], 1, bcl->Object_Id.type,
bcl->Object_Id.instance);
len = encode_context_object_id(&apdu[apdu_len], 1, bcl->Object_Id.type,
bcl->Object_Id.instance);
if (len < 0)
return BACNET_STATUS_REJECT;
apdu_len += len;
len =
encode_context_enumerated(&apdu[apdu_len], 2,
bcl->Property_Identifier);
encode_context_enumerated(&apdu[apdu_len], 2, bcl->Property_Identifier);
if (len < 0)
return BACNET_STATUS_REJECT;
apdu_len += len;
if (bcl->Property_Array_Index != BACNET_ARRAY_ALL) {
len =
encode_context_unsigned(&apdu[apdu_len], 3,
bcl->Property_Array_Index);
len = encode_context_unsigned(&apdu[apdu_len], 3,
bcl->Property_Array_Index);
if (len < 0)
return BACNET_STATUS_REJECT;
apdu_len += len;
}
/* BACnet Testing Observed Incident oi00108
Command Action not correctly formatted
Revealed by BACnet Test Client v1.8.16 ( www.bac-test.com/bacnet-test-client-download )
BITS: BIT00031
BC 135.1: 9.20.1.7
BC 135.1: 9.20.1.9
Any discussions can be directed to edward@bac-test.com
Please feel free to remove this comment when my changes have been reviewed
by all interested parties. Say 6 months -> September 2016 */
len = encode_opening_tag(&apdu[apdu_len], 4);
if (len < 0)
return BACNET_STATUS_REJECT;
apdu_len += len;
len = bacapp_encode_application_data(&apdu[apdu_len], &bcl->Value);
/* BACnet Testing Observed Incident oi00108
Command Action not correctly formatted
Revealed by BACnet Test Client v1.8.16 (
www.bac-test.com/bacnet-test-client-download ) BITS: BIT00031 BC
135.1: 9.20.1.7 BC 135.1: 9.20.1.9 Any discussions can be directed to
edward@bac-test.com Please feel free to remove this comment when my
changes have been reviewed by all interested parties. Say 6 months ->
September 2016 */
len = encode_opening_tag(&apdu[apdu_len], 4);
if (len < 0)
return BACNET_STATUS_REJECT;
apdu_len += len;
len = bacapp_encode_application_data(&apdu[apdu_len], &bcl->Value);
if (len < 0)
return BACNET_STATUS_REJECT;
apdu_len += len;
len = encode_closing_tag(&apdu[apdu_len], 4);
if (len < 0)
return BACNET_STATUS_REJECT;
apdu_len += len;
len = encode_closing_tag(&apdu[apdu_len], 4);
if (len < 0)
return BACNET_STATUS_REJECT;
apdu_len += len;
if (bcl->Priority != BACNET_NO_PRIORITY) {
len = encode_context_unsigned(&apdu[apdu_len], 5, bcl->Priority);
@@ -153,11 +144,8 @@ int cl_encode_apdu(
return apdu_len;
}
int cl_decode_apdu(
uint8_t * apdu,
unsigned apdu_len,
BACNET_APPLICATION_TAG tag,
BACNET_ACTION_LIST * bcl)
int cl_decode_apdu(uint8_t *apdu, unsigned apdu_len, BACNET_APPLICATION_TAG tag,
BACNET_ACTION_LIST *bcl)
{
int len = 0;
int dec_len = 0;
@@ -167,43 +155,37 @@ int cl_decode_apdu(
if (decode_is_context_tag(&apdu[dec_len], 0)) {
/* Tag 0: Device ID */
dec_len++;
len =
decode_object_id(&apdu[dec_len], &bcl->Device_Id.type,
&bcl->Device_Id.instance);
len = decode_object_id(&apdu[dec_len], &bcl->Device_Id.type,
&bcl->Device_Id.instance);
if (len < 0)
return BACNET_STATUS_REJECT;
dec_len += len;
}
if (!decode_is_context_tag(&apdu[dec_len++], 1))
return BACNET_STATUS_REJECT;
len =
decode_object_id(&apdu[dec_len], &bcl->Object_Id.type,
&bcl->Object_Id.instance);
len = decode_object_id(&apdu[dec_len], &bcl->Object_Id.type,
&bcl->Object_Id.instance);
if (len < 0)
return BACNET_STATUS_REJECT;
dec_len += len;
len =
decode_tag_number_and_value(&apdu[dec_len], &tag_number,
&len_value_type);
len = decode_tag_number_and_value(&apdu[dec_len], &tag_number,
&len_value_type);
if (len < 0)
return BACNET_STATUS_REJECT;
dec_len += len;
if (tag_number != 2)
return BACNET_STATUS_REJECT;
len =
decode_enumerated(&apdu[dec_len], len_value_type,
&bcl->Property_Identifier);
len = decode_enumerated(&apdu[dec_len], len_value_type,
&bcl->Property_Identifier);
if (len < 0)
return BACNET_STATUS_REJECT;
dec_len += len;
if (decode_is_context_tag(&apdu[dec_len], 3)) {
len =
decode_tag_number_and_value(&apdu[dec_len], &tag_number,
&len_value_type);
len = decode_tag_number_and_value(&apdu[dec_len], &tag_number,
&len_value_type);
dec_len += len;
len =
decode_unsigned(&apdu[dec_len], len_value_type,
&bcl->Property_Array_Index);
len = decode_unsigned(&apdu[dec_len], len_value_type,
&bcl->Property_Array_Index);
if (len < 0)
return BACNET_STATUS_REJECT;
dec_len += len;
@@ -220,68 +202,55 @@ int cl_decode_apdu(
len = 1;
break;
case BACNET_APPLICATION_TAG_BOOLEAN:
len =
decode_context_boolean2(&apdu[dec_len], 4,
&bcl->Value.type.Boolean);
len = decode_context_boolean2(&apdu[dec_len], 4,
&bcl->Value.type.Boolean);
break;
case BACNET_APPLICATION_TAG_UNSIGNED_INT:
len =
decode_context_unsigned(&apdu[dec_len], 4,
&bcl->Value.type.Unsigned_Int);
len = decode_context_unsigned(&apdu[dec_len], 4,
&bcl->Value.type.Unsigned_Int);
break;
case BACNET_APPLICATION_TAG_SIGNED_INT:
len =
decode_context_signed(&apdu[dec_len], 4,
&bcl->Value.type.Signed_Int);
len = decode_context_signed(&apdu[dec_len], 4,
&bcl->Value.type.Signed_Int);
break;
case BACNET_APPLICATION_TAG_REAL:
len =
decode_context_real(&apdu[dec_len], 4, &bcl->Value.type.Real);
len = decode_context_real(&apdu[dec_len], 4, &bcl->Value.type.Real);
break;
case BACNET_APPLICATION_TAG_DOUBLE:
len =
decode_context_double(&apdu[dec_len], 4,
&bcl->Value.type.Double);
len = decode_context_double(&apdu[dec_len], 4,
&bcl->Value.type.Double);
break;
case BACNET_APPLICATION_TAG_OCTET_STRING:
len =
decode_context_octet_string(&apdu[dec_len], 4,
&bcl->Value.type.Octet_String);
len = decode_context_octet_string(&apdu[dec_len], 4,
&bcl->Value.type.Octet_String);
break;
case BACNET_APPLICATION_TAG_CHARACTER_STRING:
len =
decode_context_character_string(&apdu[dec_len], 4,
&bcl->Value.type.Character_String);
len = decode_context_character_string(
&apdu[dec_len], 4, &bcl->Value.type.Character_String);
break;
case BACNET_APPLICATION_TAG_BIT_STRING:
len =
decode_context_bitstring(&apdu[dec_len], 4,
&bcl->Value.type.Bit_String);
len = decode_context_bitstring(&apdu[dec_len], 4,
&bcl->Value.type.Bit_String);
break;
case BACNET_APPLICATION_TAG_ENUMERATED:
len =
decode_context_enumerated(&apdu[dec_len], 4,
&bcl->Value.type.Enumerated);
len = decode_context_enumerated(&apdu[dec_len], 4,
&bcl->Value.type.Enumerated);
break;
case BACNET_APPLICATION_TAG_DATE:
len =
decode_context_date(&apdu[dec_len], 4, &bcl->Value.type.Date);
len = decode_context_date(&apdu[dec_len], 4, &bcl->Value.type.Date);
break;
case BACNET_APPLICATION_TAG_TIME:
len =
decode_context_bacnet_time(&apdu[dec_len], 4,
&bcl->Value.type.Time);
len = decode_context_bacnet_time(&apdu[dec_len], 4,
&bcl->Value.type.Time);
break;
case BACNET_APPLICATION_TAG_OBJECT_ID:
len =
decode_context_object_id(&apdu[dec_len], 4,
&bcl->Value.type.Object_Id.type,
&bcl->Value.type.Object_Id.instance);
len = decode_context_object_id(&apdu[dec_len], 4,
&bcl->Value.type.Object_Id.type,
&bcl->Value.type.Object_Id.instance);
break;
case BACNET_APPLICATION_TAG_LIGHTING_COMMAND:
len =
lighting_command_decode(&apdu[dec_len], apdu_len - dec_len,
&bcl->Value.type.Lighting_Command);
len = lighting_command_decode(&apdu[dec_len], apdu_len - dec_len,
&bcl->Value.type.Lighting_Command);
break;
default:
return BACNET_STATUS_REJECT;
@@ -291,25 +260,22 @@ int cl_decode_apdu(
dec_len += len;
if (decode_is_context_tag(&apdu[dec_len], 5)) {
uint32_t priority_dec;
len =
decode_tag_number_and_value(&apdu[dec_len], &tag_number,
&len_value_type);
len = decode_tag_number_and_value(&apdu[dec_len], &tag_number,
&len_value_type);
dec_len += len;
len = decode_unsigned(&apdu[dec_len], len_value_type, &priority_dec);
if (len < 0)
return BACNET_STATUS_REJECT;
bcl->Priority = (uint8_t) priority_dec;
bcl->Priority = (uint8_t)priority_dec;
dec_len += len;
} else {
bcl->Priority = BACNET_NO_PRIORITY;
}
if (decode_is_context_tag(&apdu[dec_len], 6)) {
len =
decode_tag_number_and_value(&apdu[dec_len], &tag_number,
&len_value_type);
len = decode_tag_number_and_value(&apdu[dec_len], &tag_number,
&len_value_type);
dec_len += len;
len =
decode_unsigned(&apdu[dec_len], len_value_type, &bcl->Post_Delay);
len = decode_unsigned(&apdu[dec_len], len_value_type, &bcl->Post_Delay);
if (len < 0)
return BACNET_STATUS_REJECT;
dec_len += len;
@@ -340,25 +306,18 @@ int cl_decode_apdu(
COMMAND_DESCR Command_Descr[MAX_COMMANDS];
/* These arrays are used by the ReadPropertyMultiple handler */
static const int Command_Properties_Required[] = {
PROP_OBJECT_IDENTIFIER,
PROP_OBJECT_NAME,
PROP_OBJECT_TYPE,
PROP_PRESENT_VALUE,
PROP_IN_PROCESS,
PROP_ALL_WRITES_SUCCESSFUL,
PROP_ACTION,
-1
};
static const int Command_Properties_Required[] = {PROP_OBJECT_IDENTIFIER,
PROP_OBJECT_NAME,
PROP_OBJECT_TYPE,
PROP_PRESENT_VALUE,
PROP_IN_PROCESS,
PROP_ALL_WRITES_SUCCESSFUL,
PROP_ACTION,
-1};
static const int Command_Properties_Optional[] = {
PROP_DESCRIPTION,
-1
};
static const int Command_Properties_Optional[] = {PROP_DESCRIPTION, -1};
static const int Command_Properties_Proprietary[] = {
-1
};
static const int Command_Properties_Proprietary[] = {-1};
/**
* Returns the list of required, optional, and proprietary properties.
@@ -371,10 +330,8 @@ static const int Command_Properties_Proprietary[] = {
* @param pProprietary - pointer to list of int terminated by -1, of
* BACnet proprietary properties for this object.
*/
void Command_Property_Lists(
const int **pRequired,
const int **pOptional,
const int **pProprietary)
void Command_Property_Lists(const int **pRequired, const int **pOptional,
const int **pProprietary)
{
if (pRequired)
*pRequired = Command_Properties_Required;
@@ -386,18 +343,16 @@ void Command_Property_Lists(
return;
}
/**
* Initializes the Command object data
*/
void Command_Init(
void)
void Command_Init(void)
{
unsigned i;
for (i = 0; i < MAX_COMMANDS; i++) {
Command_Descr[i].Present_Value = 0;
Command_Descr[i].In_Process = false;
Command_Descr[i].All_Writes_Successful = true; /* Optimistic default */
Command_Descr[i].All_Writes_Successful = true; /* Optimistic default */
}
}
@@ -408,8 +363,7 @@ void Command_Init(
*
* @return true if the instance is valid, and false if not
*/
bool Command_Valid_Instance(
uint32_t object_instance)
bool Command_Valid_Instance(uint32_t object_instance)
{
unsigned int index;
@@ -425,8 +379,7 @@ bool Command_Valid_Instance(
*
* @return Number of objects
*/
unsigned Command_Count(
void)
unsigned Command_Count(void)
{
return MAX_COMMANDS;
}
@@ -439,8 +392,7 @@ unsigned Command_Count(
*
* @return object instance-number for the given index
*/
uint32_t Command_Index_To_Instance(
unsigned index)
uint32_t Command_Index_To_Instance(unsigned index)
{
return index;
}
@@ -454,8 +406,7 @@ uint32_t Command_Index_To_Instance(
* @return index for the given instance-number, or
* the total number of this object instances if not valid.
*/
unsigned Command_Instance_To_Index(
uint32_t object_instance)
unsigned Command_Instance_To_Index(uint32_t object_instance)
{
unsigned index = MAX_COMMANDS;
@@ -472,8 +423,7 @@ unsigned Command_Instance_To_Index(
*
* @return present-value of the object
*/
uint32_t Command_Present_Value(
uint32_t object_instance)
uint32_t Command_Present_Value(uint32_t object_instance)
{
uint32_t value = 0;
unsigned int index;
@@ -494,9 +444,7 @@ uint32_t Command_Present_Value(
*
* @return true if values are within range and present-value is set.
*/
bool Command_Present_Value_Set(
uint32_t object_instance,
uint32_t value)
bool Command_Present_Value_Set(uint32_t object_instance, uint32_t value)
{
bool status = false;
unsigned int index;
@@ -521,8 +469,7 @@ bool Command_Present_Value_Set(
*
* @return true if this object-instance is in-process.
*/
bool Command_In_Process(
uint32_t object_instance)
bool Command_In_Process(uint32_t object_instance)
{
bool value = false;
unsigned int index;
@@ -543,9 +490,7 @@ bool Command_In_Process(
*
* @return true if values are within range and in-process flag is set.
*/
bool Command_In_Process_Set(
uint32_t object_instance,
bool value)
bool Command_In_Process_Set(uint32_t object_instance, bool value)
{
bool status = false;
unsigned int index;
@@ -568,8 +513,7 @@ bool Command_In_Process_Set(
*
* @return true if all writes were successful for this object-instance
*/
bool Command_All_Writes_Successful(
uint32_t object_instance)
bool Command_All_Writes_Successful(uint32_t object_instance)
{
bool value = false;
unsigned int index;
@@ -590,9 +534,7 @@ bool Command_All_Writes_Successful(
*
* @return true if values are within range and all-writes-succcessful is set.
*/
bool Command_All_Writes_Successful_Set(
uint32_t object_instance,
bool value)
bool Command_All_Writes_Successful_Set(uint32_t object_instance, bool value)
{
bool status = false;
unsigned int index;
@@ -615,17 +557,16 @@ bool Command_All_Writes_Successful_Set(
*
* @return true if object-name was retrieved
*/
bool Command_Object_Name(
uint32_t object_instance,
BACNET_CHARACTER_STRING * object_name)
bool Command_Object_Name(uint32_t object_instance,
BACNET_CHARACTER_STRING *object_name)
{
static char text_string[32] = ""; /* okay for single thread */
static char text_string[32] = ""; /* okay for single thread */
unsigned int index;
bool status = false;
index = Command_Instance_To_Index(object_instance);
if (index < MAX_COMMANDS) {
sprintf(text_string, "COMMAND %lu", (unsigned long) index);
sprintf(text_string, "COMMAND %lu", (unsigned long)index);
status = characterstring_init_ansi(object_name, text_string);
}
@@ -642,10 +583,9 @@ bool Command_Object_Name(
* @return number of APDU bytes in the response, or
* BACNET_STATUS_ERROR on error.
*/
int Command_Read_Property(
BACNET_READ_PROPERTY_DATA * rpdata)
int Command_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
{
int apdu_len = 0; /* return value */
int apdu_len = 0; /* return value */
int len = 0;
BACNET_CHARACTER_STRING char_string;
unsigned object_index = 0;
@@ -666,11 +606,10 @@ int Command_Read_Property(
}
apdu = rpdata->application_data;
switch ((int) rpdata->object_property) {
switch ((int)rpdata->object_property) {
case PROP_OBJECT_IDENTIFIER:
apdu_len =
encode_application_object_id(&apdu[0], OBJECT_COMMAND,
rpdata->object_instance);
apdu_len = encode_application_object_id(&apdu[0], OBJECT_COMMAND,
rpdata->object_instance);
break;
case PROP_OBJECT_NAME:
@@ -685,24 +624,23 @@ int Command_Read_Property(
break;
case PROP_PRESENT_VALUE:
apdu_len =
encode_application_unsigned(&apdu[0],
Command_Present_Value(rpdata->object_instance));
apdu_len = encode_application_unsigned(
&apdu[0], Command_Present_Value(rpdata->object_instance));
break;
case PROP_IN_PROCESS:
apdu_len =
encode_application_boolean(&apdu[0],
Command_In_Process(rpdata->object_instance));
apdu_len = encode_application_boolean(
&apdu[0], Command_In_Process(rpdata->object_instance));
break;
case PROP_ALL_WRITES_SUCCESSFUL:
apdu_len =
encode_application_boolean(&apdu[0],
apdu_len = encode_application_boolean(
&apdu[0],
Command_All_Writes_Successful(rpdata->object_instance));
break;
case PROP_ACTION:
/* TODO */
if (rpdata->array_index == 0)
apdu_len = encode_application_unsigned(&apdu[0], MAX_COMMAND_ACTIONS);
apdu_len =
encode_application_unsigned(&apdu[0], MAX_COMMAND_ACTIONS);
else if (rpdata->array_index == BACNET_ARRAY_ALL) {
int i;
for (i = 0; i < MAX_COMMAND_ACTIONS; i++) {
@@ -710,12 +648,12 @@ int Command_Read_Property(
&CurrentCommand->Action[0];
/* another loop, for aditional actions in the list */
for (; Curr_CL_Member != NULL;
Curr_CL_Member = Curr_CL_Member->next) {
len =
cl_encode_apdu(&apdu[apdu_len],
&CurrentCommand->Action[0]);
Curr_CL_Member = Curr_CL_Member->next) {
len = cl_encode_apdu(&apdu[apdu_len],
&CurrentCommand->Action[0]);
apdu_len += len;
/* assume the next one is of the same length, which need not be the case */
/* assume the next one is of the same length, which need
* not be the case */
if ((i != MAX_COMMAND_ACTIONS - 1) &&
(apdu_len + len) >= apdu_max) {
rpdata->error_code =
@@ -731,12 +669,12 @@ int Command_Read_Property(
&CurrentCommand->Action[rpdata->array_index];
/* another loop, for aditional actions in the list */
for (; Curr_CL_Member != NULL;
Curr_CL_Member = Curr_CL_Member->next) {
len =
cl_encode_apdu(&apdu[apdu_len],
&CurrentCommand->Action[0]);
Curr_CL_Member = Curr_CL_Member->next) {
len = cl_encode_apdu(&apdu[apdu_len],
&CurrentCommand->Action[0]);
apdu_len += len;
/* assume the next one is of the same length, which need not be the case */
/* assume the next one is of the same length, which need
* not be the case */
if ((apdu_len + len) >= apdu_max) {
rpdata->error_code =
ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;
@@ -758,8 +696,8 @@ int Command_Read_Property(
break;
}
/* only array properties can have array options */
if ((apdu_len >= 0) && (rpdata->object_property != PROP_ACTION)
&& (rpdata->array_index != BACNET_ARRAY_ALL)) {
if ((apdu_len >= 0) && (rpdata->object_property != PROP_ACTION) &&
(rpdata->array_index != BACNET_ARRAY_ALL)) {
rpdata->error_class = ERROR_CLASS_PROPERTY;
rpdata->error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY;
apdu_len = BACNET_STATUS_ERROR;
@@ -777,17 +715,15 @@ int Command_Read_Property(
*
* @return false if an error is loaded, true if no errors
*/
bool Command_Write_Property(
BACNET_WRITE_PROPERTY_DATA * wp_data)
bool Command_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
{
bool status = false; /* return value */
bool status = false; /* return value */
unsigned int object_index = 0;
int len = 0;
BACNET_APPLICATION_DATA_VALUE value;
/* decode the some of the request */
len =
bacapp_decode_application_data(wp_data->application_data,
wp_data->application_data_len, &value);
len = bacapp_decode_application_data(wp_data->application_data,
wp_data->application_data_len, &value);
/* FIXME: len < application_data_len: more data? */
if (len < 0) {
/* error while decoding - a value larger than we can handle */
@@ -807,11 +743,11 @@ bool Command_Write_Property(
return false;
}
switch ((int) wp_data->object_property) {
switch ((int)wp_data->object_property) {
case PROP_PRESENT_VALUE:
status =
WPValidateArgType(&value, BACNET_APPLICATION_TAG_UNSIGNED_INT,
&wp_data->error_class, &wp_data->error_code);
&wp_data->error_class, &wp_data->error_code);
if (status) {
if (value.type.Unsigned_Int >= MAX_COMMAND_ACTIONS) {
wp_data->error_class = ERROR_CLASS_PROPERTY;
@@ -819,7 +755,7 @@ bool Command_Write_Property(
return false;
}
Command_Present_Value_Set(wp_data->object_instance,
value.type.Unsigned_Int);
value.type.Unsigned_Int);
} else {
wp_data->error_class = ERROR_CLASS_PROPERTY;
wp_data->error_code = ERROR_CODE_WRITE_ACCESS_DENIED;
@@ -846,8 +782,7 @@ bool Command_Write_Property(
return status;
}
void Command_Intrinsic_Reporting(
uint32_t object_instance)
void Command_Intrinsic_Reporting(uint32_t object_instance)
{
}
@@ -856,11 +791,9 @@ void Command_Intrinsic_Reporting(
#include <string.h>
#include "ctest.h"
bool WPValidateArgType(
BACNET_APPLICATION_DATA_VALUE * pValue,
uint8_t ucExpectedTag,
BACNET_ERROR_CLASS * pErrorClass,
BACNET_ERROR_CODE * pErrorCode)
bool WPValidateArgType(BACNET_APPLICATION_DATA_VALUE *pValue,
uint8_t ucExpectedTag, BACNET_ERROR_CLASS *pErrorClass,
BACNET_ERROR_CODE *pErrorCode)
{
bool bResult;
@@ -878,10 +811,9 @@ bool WPValidateArgType(
return (bResult);
}
void testCommand(
Test * pTest)
void testCommand(Test *pTest)
{
uint8_t apdu[MAX_APDU] = { 0 };
uint8_t apdu[MAX_APDU] = {0};
int len = 0;
uint32_t len_value = 0;
uint8_t tag_number = 0;
@@ -926,10 +858,9 @@ void testCommand(
ct_test(pTest, clist.Device_Id.instance == clist_test.Device_Id.instance);
ct_test(pTest, clist.Object_Id.type == clist_test.Object_Id.type);
ct_test(pTest, clist.Object_Id.instance == clist_test.Object_Id.instance);
ct_test(pTest, clist.Property_Identifier == clist_test.Property_Identifier);
ct_test(pTest,
clist.Property_Identifier == clist_test.Property_Identifier);
ct_test(pTest,
clist.Property_Array_Index == clist_test.Property_Array_Index);
clist.Property_Array_Index == clist_test.Property_Array_Index);
ct_test(pTest, clist.Value.tag == clist_test.Value.tag);
ct_test(pTest, clist.Value.type.Real == clist_test.Value.type.Real);
ct_test(pTest, clist.Priority == clist_test.Priority);
@@ -940,8 +871,7 @@ void testCommand(
}
#ifdef TEST_COMMAND
int main(
void)
int main(void)
{
Test *pTest;
bool rc;
@@ -953,7 +883,7 @@ int main(
ct_setStream(pTest, stdout);
ct_run(pTest);
(void) ct_report(pTest);
(void)ct_report(pTest);
ct_destroy(pTest);
return 0;