Indented using indent script.

This commit is contained in:
skarg
2010-05-04 21:06:26 +00:00
parent b2368acc27
commit 710cfccfef
134 changed files with 2901 additions and 3035 deletions
+25 -25
View File
@@ -183,7 +183,8 @@ char *Binary_Output_Name(
static char text_string[32] = ""; /* okay for single thread */
if (object_instance < MAX_BINARY_OUTPUTS) {
sprintf(text_string, "BINARY OUTPUT %lu", (unsigned long)object_instance);
sprintf(text_string, "BINARY OUTPUT %lu",
(unsigned long) object_instance);
return text_string;
}
@@ -192,7 +193,7 @@ char *Binary_Output_Name(
/* return apdu len, or -1 on error */
int Binary_Output_Read_Property(
BACNET_READ_PROPERTY_DATA *rpdata)
BACNET_READ_PROPERTY_DATA * rpdata)
{
int len = 0;
int apdu_len = 0; /* return value */
@@ -205,8 +206,7 @@ int Binary_Output_Read_Property(
bool state = false;
uint8_t *apdu = NULL;
if ((rpdata == NULL) ||
(rpdata->application_data == NULL) ||
if ((rpdata == NULL) || (rpdata->application_data == NULL) ||
(rpdata->application_data_len == 0)) {
return 0;
}
@@ -231,7 +231,8 @@ int Binary_Output_Read_Property(
encode_application_enumerated(&apdu[0], OBJECT_BINARY_OUTPUT);
break;
case PROP_PRESENT_VALUE:
present_value = Binary_Output_Present_Value(rpdata->object_instance);
present_value =
Binary_Output_Present_Value(rpdata->object_instance);
apdu_len = encode_application_enumerated(&apdu[0], present_value);
break;
case PROP_STATUS_FLAGS:
@@ -249,7 +250,8 @@ int Binary_Output_Read_Property(
encode_application_enumerated(&apdu[0], EVENT_STATE_NORMAL);
break;
case PROP_OUT_OF_SERVICE:
object_index = Binary_Output_Instance_To_Index(rpdata->object_instance);
object_index =
Binary_Output_Instance_To_Index(rpdata->object_instance);
state = Binary_Output_Out_Of_Service[object_index];
apdu_len = encode_application_boolean(&apdu[0], state);
break;
@@ -290,12 +292,13 @@ int Binary_Output_Read_Property(
object_index =
Binary_Output_Instance_To_Index(rpdata->object_instance);
if (rpdata->array_index <= BACNET_MAX_PRIORITY) {
if (Binary_Output_Level[object_index][rpdata->array_index - 1] ==
BINARY_NULL)
if (Binary_Output_Level[object_index][rpdata->array_index -
1] == BINARY_NULL)
apdu_len = encode_application_null(&apdu[apdu_len]);
else {
present_value =
Binary_Output_Level[object_index][rpdata->array_index - 1];
Binary_Output_Level[object_index][rpdata->
array_index - 1];
apdu_len =
encode_application_enumerated(&apdu[apdu_len],
present_value);
@@ -329,8 +332,7 @@ int Binary_Output_Read_Property(
break;
}
/* only array properties can have array options */
if ((apdu_len >= 0) &&
(rpdata->object_property != PROP_PRIORITY_ARRAY) &&
if ((apdu_len >= 0) && (rpdata->object_property != PROP_PRIORITY_ARRAY) &&
(rpdata->array_index != BACNET_ARRAY_ALL)) {
rpdata->error_class = ERROR_CLASS_PROPERTY;
rpdata->error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY;
@@ -369,8 +371,8 @@ bool Binary_Output_Write_Property(
(value.type.Enumerated <= MAX_BINARY_PV)) {
level = (BACNET_BINARY_PV) value.type.Enumerated;
object_index =
Binary_Output_Instance_To_Index
(wp_data->object_instance);
Binary_Output_Instance_To_Index(wp_data->
object_instance);
priority--;
Binary_Output_Level[object_index][priority] = level;
/* Note: you could set the physical output here if we
@@ -390,14 +392,14 @@ bool Binary_Output_Write_Property(
wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
}
} else {
status = WPValidateArgType(&value,
BACNET_APPLICATION_TAG_NULL,
&wp_data->error_class,
&wp_data->error_code);
status =
WPValidateArgType(&value, BACNET_APPLICATION_TAG_NULL,
&wp_data->error_class, &wp_data->error_code);
if (status) {
level = BINARY_NULL;
object_index =
Binary_Output_Instance_To_Index(wp_data->object_instance);
Binary_Output_Instance_To_Index(wp_data->
object_instance);
priority = wp_data->priority;
if (priority && (priority <= BACNET_MAX_PRIORITY)) {
priority--;
@@ -417,10 +419,9 @@ bool Binary_Output_Write_Property(
}
break;
case PROP_OUT_OF_SERVICE:
status = WPValidateArgType(&value,
BACNET_APPLICATION_TAG_BOOLEAN,
&wp_data->error_class,
&wp_data->error_code);
status =
WPValidateArgType(&value, BACNET_APPLICATION_TAG_BOOLEAN,
&wp_data->error_class, &wp_data->error_code);
if (status) {
object_index =
Binary_Output_Instance_To_Index(wp_data->object_instance);
@@ -457,7 +458,7 @@ void testBinaryOutput(
Binary_Output_Init();
rpdata.application_data = &apdu[0];
rpdata.application_data_len = sizeof(apdu);
rpdata.object_type = OBJECT_BINARY_OUTPUT;
rpdata.object_type = OBJECT_BINARY_OUTPUT;
rpdata.object_instance = 1;
rpdata.object_property = PROP_OBJECT_IDENTIFIER;
rpdata.array_index = BACNET_ARRAY_ALL;
@@ -465,8 +466,7 @@ void testBinaryOutput(
ct_test(pTest, len != 0);
len = decode_tag_number_and_value(&apdu[0], &tag_number, &len_value);
ct_test(pTest, tag_number == BACNET_APPLICATION_TAG_OBJECT_ID);
len =
decode_object_id(&apdu[len], &decoded_type, &decoded_instance);
len = decode_object_id(&apdu[len], &decoded_type, &decoded_instance);
ct_test(pTest, decoded_type == rpdata.object_type);
ct_test(pTest, decoded_instance == rpdata.object_instance);