Fixed EOL, indent.

This commit is contained in:
skarg
2009-10-24 17:02:59 +00:00
parent 857d0c185d
commit c04e69da8c
118 changed files with 2633 additions and 2629 deletions
+2 -1
View File
@@ -217,7 +217,8 @@ int Analog_Input_Encode_Property_APDU(
return apdu_len;
}
void Analog_Input_Init(void)
void Analog_Input_Init(
void)
{
}
+2 -2
View File
@@ -433,8 +433,8 @@ bool Analog_Output_Write_Property(
object_index =
Analog_Output_Instance_To_Index(wp_data->object_instance);
status =
Analog_Output_Present_Value_Relinquish(wp_data->
object_instance, wp_data->priority);
Analog_Output_Present_Value_Relinquish
(wp_data->object_instance, wp_data->priority);
if (!status) {
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
+2 -1
View File
@@ -463,6 +463,7 @@ bool bacfile_write_stream_data(
return found;
}
void bacfile_init(void)
void bacfile_init(
void)
{
}
+2 -2
View File
@@ -364,8 +364,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
+2 -2
View File
@@ -345,8 +345,8 @@ bool Binary_Value_Write_Property(
(value.type.Enumerated <= MAX_BINARY_PV)) {
level = (BACNET_BINARY_PV) value.type.Enumerated;
object_index =
Binary_Value_Instance_To_Index(wp_data->
object_instance);
Binary_Value_Instance_To_Index
(wp_data->object_instance);
priority--;
Binary_Value_Level[object_index][priority] = level;
/* Note: you could set the physical output here if we
+25 -26
View File
@@ -42,12 +42,10 @@
#include "bacfile.h" /* object list dependency */
#endif
static object_count_function
Object_Count[MAX_BACNET_OBJECT_TYPE];
static object_index_to_instance_function
static object_count_function Object_Count[MAX_BACNET_OBJECT_TYPE];
static object_index_to_instance_function
Object_Index_To_Instance[MAX_BACNET_OBJECT_TYPE];
static object_name_function
Object_Name[MAX_BACNET_OBJECT_TYPE];
static object_name_function Object_Name[MAX_BACNET_OBJECT_TYPE];
void Device_Object_Function_Set(
BACNET_OBJECT_TYPE object_type,
@@ -60,7 +58,7 @@ void Device_Object_Function_Set(
Object_Index_To_Instance[object_type] = index_function;
Object_Name[object_type] = name_function;
}
}
}
/* These three arrays are used by the ReadPropertyMultiple handler */
static const int Device_Properties_Required[] = {
@@ -377,11 +375,11 @@ unsigned Device_Object_List_Count(
void)
{
unsigned count = 1; /* 1 for the device object */
unsigned i = 0; /* loop counter */
unsigned i = 0; /* loop counter */
for (i = 0; i < MAX_BACNET_OBJECT_TYPE; i++) {
if (Object_Count[i]) {
count += Object_Count[i]();
count += Object_Count[i] ();
}
}
@@ -396,18 +394,18 @@ bool Device_Object_List_Identifier(
bool status = false;
unsigned object_index = 0;
unsigned count = 0;
unsigned i = 0; /* loop counter */
unsigned i = 0; /* loop counter */
if (array_index == 0) {
return status;
}
/* device object */
/* device object */
if (array_index == 1) {
*object_type = OBJECT_DEVICE;
*instance = Object_Instance_Number;
status = true;
}
if (!status) {
/* array index starts at 1, and if we are this far,
we are not the device object, so array_index must
@@ -417,10 +415,10 @@ bool Device_Object_List_Identifier(
for (i = 0; i < MAX_BACNET_OBJECT_TYPE; i++) {
if (Object_Count[i] && Object_Index_To_Instance[i]) {
object_index -= count;
count = Object_Count[i]();
count = Object_Count[i] ();
if (object_index < count) {
*object_type = i;
*instance = Object_Index_To_Instance[i](object_index);
*instance = Object_Index_To_Instance[i] (object_index);
status = true;
break;
}
@@ -505,7 +503,7 @@ int Device_Encode_Property_APDU(
int object_type = 0;
uint32_t instance = 0;
unsigned count = 0;
object_instance = object_instance;
switch (property) {
case PROP_OBJECT_IDENTIFIER:
@@ -740,8 +738,8 @@ bool Device_Write_Property(
case PROP_OBJECT_IDENTIFIER:
if (value.tag == BACNET_APPLICATION_TAG_OBJECT_ID) {
if ((value.type.Object_Id.type == OBJECT_DEVICE) &&
(Device_Set_Object_Instance_Number(value.type.Object_Id.
instance))) {
(Device_Set_Object_Instance_Number(value.type.
Object_Id.instance))) {
/* FIXME: we could send an I-Am broadcast to let the world know */
status = true;
} else {
@@ -776,8 +774,8 @@ bool Device_Write_Property(
case PROP_VENDOR_IDENTIFIER:
if (value.tag == BACNET_APPLICATION_TAG_UNSIGNED_INT) {
/* FIXME: bounds check? */
Device_Set_Vendor_Identifier((uint16_t) value.type.
Unsigned_Int);
Device_Set_Vendor_Identifier((uint16_t) value.
type.Unsigned_Int);
status = true;
} else {
*error_class = ERROR_CLASS_PROPERTY;
@@ -787,8 +785,8 @@ bool Device_Write_Property(
case PROP_SYSTEM_STATUS:
if (value.tag == BACNET_APPLICATION_TAG_ENUMERATED) {
/* FIXME: bounds check? */
Device_Set_System_Status((BACNET_DEVICE_STATUS) value.type.
Enumerated);
Device_Set_System_Status((BACNET_DEVICE_STATUS) value.
type.Enumerated);
status = true;
} else {
*error_class = ERROR_CLASS_PROPERTY;
@@ -802,8 +800,8 @@ bool Device_Write_Property(
characterstring_encoding(&value.type.Character_String);
if (encoding == CHARACTER_ANSI_X34) {
status =
Device_Set_Object_Name(characterstring_value(&value.
type.Character_String),
Device_Set_Object_Name(characterstring_value
(&value.type.Character_String),
characterstring_length(&value.type.Character_String));
if (!status) {
*error_class = ERROR_CLASS_PROPERTY;
@@ -822,8 +820,8 @@ bool Device_Write_Property(
case PROP_MAX_INFO_FRAMES:
if (value.tag == BACNET_APPLICATION_TAG_UNSIGNED_INT) {
if (value.type.Unsigned_Int <= 255) {
dlmstp_set_max_info_frames((uint8_t) value.type.
Unsigned_Int);
dlmstp_set_max_info_frames((uint8_t) value.
type.Unsigned_Int);
status = true;
} else {
*error_class = ERROR_CLASS_PROPERTY;
@@ -859,7 +857,8 @@ bool Device_Write_Property(
return status;
}
void Device_Init(void)
void Device_Init(
void)
{
}
+1
View File
@@ -127,6 +127,7 @@ static char *Shed_Level_Descriptions[MAX_SHED_LEVELS] = {
"dim lights 20%",
"dim lights 30%"
};
static float Shed_Level_Values[MAX_SHED_LEVELS] = {
90.0,
80.0,
+6 -6
View File
@@ -551,11 +551,11 @@ bool Lighting_Output_Write_Property(
} else if (value.tag == BACNET_APPLICATION_TAG_NULL) {
level = LIGHTING_LEVEL_NULL;
object_index =
Lighting_Output_Instance_To_Index(wp_data->
object_instance);
Lighting_Output_Instance_To_Index
(wp_data->object_instance);
status =
Lighting_Output_Present_Value_Relinquish(wp_data->
object_instance, wp_data->priority);
Lighting_Output_Present_Value_Relinquish
(wp_data->object_instance, wp_data->priority);
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
@@ -580,8 +580,8 @@ bool Lighting_Output_Write_Property(
case PROP_OUT_OF_SERVICE:
if (value.tag == BACNET_APPLICATION_TAG_BOOLEAN) {
object_index =
Lighting_Output_Instance_To_Index(wp_data->
object_instance);
Lighting_Output_Instance_To_Index
(wp_data->object_instance);
Lighting_Output_Out_Of_Service[object_index] =
value.type.Boolean;
status = true;
+4 -4
View File
@@ -317,8 +317,8 @@ bool Life_Safety_Point_Write_Property(
if (value.tag == BACNET_APPLICATION_TAG_ENUMERATED) {
if (value.type.Enumerated <= MAX_LIFE_SAFETY_MODE) {
object_index =
Life_Safety_Point_Instance_To_Index(wp_data->
object_instance);
Life_Safety_Point_Instance_To_Index
(wp_data->object_instance);
Life_Safety_Point_Mode[object_index] =
value.type.Enumerated;
status = true;
@@ -334,8 +334,8 @@ bool Life_Safety_Point_Write_Property(
case PROP_OUT_OF_SERVICE:
if (value.tag == BACNET_APPLICATION_TAG_BOOLEAN) {
object_index =
Life_Safety_Point_Instance_To_Index(wp_data->
object_instance);
Life_Safety_Point_Instance_To_Index
(wp_data->object_instance);
Life_Safety_Point_Out_Of_Service[object_index] =
value.type.Boolean;
status = true;
+33 -38
View File
@@ -44,8 +44,7 @@
#define MULTISTATE_NUMBER_OF_STATES (254)
#endif
/* Here is our Present Value */
static uint8_t
Present_Value[MAX_MULTISTATE_INPUTS];
static uint8_t Present_Value[MAX_MULTISTATE_INPUTS];
/* Writable out-of-service allows others to manipulate our Present Value */
static bool Out_Of_Service[MAX_MULTISTATE_INPUTS];
static char Object_Name[MAX_MULTISTATE_INPUTS][64];
@@ -138,7 +137,7 @@ bool Multistate_Input_Valid_Instance(
uint32_t object_instance)
{
unsigned index = 0; /* offset from instance lookup */
index = Multistate_Input_Instance_To_Index(object_instance);
if (index < MAX_MULTISTATE_INPUTS) {
return true;
@@ -167,7 +166,7 @@ bool Multistate_Input_Present_Value_Set(
{
bool status = false;
unsigned index = 0; /* offset from instance lookup */
index = Multistate_Input_Instance_To_Index(object_instance);
if (index < MAX_MULTISTATE_INPUTS) {
if (value < MULTISTATE_NUMBER_OF_STATES) {
@@ -175,7 +174,7 @@ bool Multistate_Input_Present_Value_Set(
status = true;
}
}
return status;
}
@@ -184,7 +183,7 @@ char *Multistate_Input_Description(
{
unsigned index = 0; /* offset from instance lookup */
char *pName = NULL; /* return value */
index = Multistate_Input_Instance_To_Index(object_instance);
if (index < MAX_MULTISTATE_INPUTS) {
pName = Object_Description[index];
@@ -198,8 +197,8 @@ bool Multistate_Input_Description_Set(
char *new_name)
{
unsigned index = 0; /* offset from instance lookup */
size_t i = 0; /* loop counter */
bool status = false; /* return value */
size_t i = 0; /* loop counter */
bool status = false; /* return value */
index = Multistate_Input_Instance_To_Index(object_instance);
if (index < MAX_MULTISTATE_INPUTS) {
@@ -217,7 +216,7 @@ bool Multistate_Input_Description_Set(
}
}
}
return status;
}
@@ -226,7 +225,7 @@ char *Multistate_Input_Name(
{
unsigned index = 0; /* offset from instance lookup */
char *pName = NULL; /* return value */
index = Multistate_Input_Instance_To_Index(object_instance);
if (index < MAX_MULTISTATE_INPUTS) {
pName = Object_Name[index];
@@ -241,9 +240,9 @@ bool Multistate_Input_Name_Set(
char *new_name)
{
unsigned index = 0; /* offset from instance lookup */
size_t i = 0; /* loop counter */
bool status = false; /* return value */
size_t i = 0; /* loop counter */
bool status = false; /* return value */
index = Multistate_Input_Instance_To_Index(object_instance);
if (index < MAX_MULTISTATE_INPUTS) {
status = true;
@@ -271,9 +270,9 @@ char *Multistate_Input_State_Text(
{
unsigned index = 0; /* offset from instance lookup */
char *pName = NULL; /* return value */
index = Multistate_Input_Instance_To_Index(object_instance);
if ((index < MAX_MULTISTATE_INPUTS) &&
if ((index < MAX_MULTISTATE_INPUTS) &&
(state_index < MULTISTATE_NUMBER_OF_STATES)) {
pName = State_Text[index][state_index];
}
@@ -288,11 +287,11 @@ bool Multistate_Input_State_Text_Set(
char *new_name)
{
unsigned index = 0; /* offset from instance lookup */
size_t i = 0; /* loop counter */
bool status = false; /* return value */
size_t i = 0; /* loop counter */
bool status = false; /* return value */
index = Multistate_Input_Instance_To_Index(object_instance);
if ((index < MAX_MULTISTATE_INPUTS) &&
if ((index < MAX_MULTISTATE_INPUTS) &&
(state_index < MULTISTATE_NUMBER_OF_STATES)) {
status = true;
if (new_name) {
@@ -375,8 +374,7 @@ int Multistate_Input_Encode_Property_APDU(
encode_application_enumerated(&apdu[0], EVENT_STATE_NORMAL);
break;
case PROP_OUT_OF_SERVICE:
object_index =
Multistate_Input_Instance_To_Index(object_instance);
object_index = Multistate_Input_Instance_To_Index(object_instance);
state = Out_Of_Service[object_index];
apdu_len = encode_application_boolean(&apdu[0], state);
break;
@@ -388,10 +386,10 @@ int Multistate_Input_Encode_Property_APDU(
case PROP_STATE_TEXT:
if (array_index == 0) {
/* Array element zero is the number of elements in the array */
apdu_len = encode_application_unsigned(&apdu[0],
apdu_len =
encode_application_unsigned(&apdu[0],
MULTISTATE_NUMBER_OF_STATES);
}
else if (array_index == BACNET_ARRAY_ALL) {
} else if (array_index == BACNET_ARRAY_ALL) {
/* if no index was specified, then try to encode the entire list */
/* into one packet. */
object_index =
@@ -400,8 +398,8 @@ int Multistate_Input_Encode_Property_APDU(
characterstring_init_ansi(&char_string,
Multistate_Input_State_Text(object_instance, i));
/* FIXME: this might go beyond MAX_APDU length! */
len = encode_application_character_string(
&apdu[apdu_len],
len =
encode_application_character_string(&apdu[apdu_len],
&char_string);
/* add it if we have room */
if ((apdu_len + len) < MAX_APDU) {
@@ -419,11 +417,10 @@ int Multistate_Input_Encode_Property_APDU(
if (array_index <= MULTISTATE_NUMBER_OF_STATES) {
array_index--;
characterstring_init_ansi(&char_string,
Multistate_Input_State_Text(
object_instance,
Multistate_Input_State_Text(object_instance,
array_index));
apdu_len = encode_application_character_string(
&apdu[0],
apdu_len =
encode_application_character_string(&apdu[0],
&char_string);
} else {
*error_class = ERROR_CLASS_PROPERTY;
@@ -469,9 +466,8 @@ bool Multistate_Input_Write_Property(
case PROP_PRESENT_VALUE:
if (value.tag == BACNET_APPLICATION_TAG_UNSIGNED_INT) {
if (Out_Of_Service[object_index]) {
if (Multistate_Input_Present_Value_Set(
wp_data->object_instance,
value.type.Unsigned_Int)) {
if (Multistate_Input_Present_Value_Set(wp_data->
object_instance, value.type.Unsigned_Int)) {
status = true;
} else {
*error_class = ERROR_CLASS_PROPERTY;
@@ -489,10 +485,9 @@ bool Multistate_Input_Write_Property(
case PROP_OUT_OF_SERVICE:
if (value.tag == BACNET_APPLICATION_TAG_BOOLEAN) {
object_index =
Multistate_Input_Instance_To_Index(wp_data->
object_instance);
Out_Of_Service[object_index] =
value.type.Boolean;
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;
@@ -560,5 +555,5 @@ int main(
return 0;
}
#endif
#endif
#endif /* TEST */
+6 -6
View File
@@ -364,8 +364,8 @@ bool Multistate_Output_Write_Property(
(value.type.Unsigned_Int <= MULTISTATE_NUMBER_OF_STATES)) {
level = value.type.Unsigned_Int;
object_index =
Multistate_Output_Instance_To_Index(wp_data->
object_instance);
Multistate_Output_Instance_To_Index
(wp_data->object_instance);
priority--;
Multistate_Output_Level[object_index][priority] =
(uint8_t) level;
@@ -388,8 +388,8 @@ bool Multistate_Output_Write_Property(
} else if (value.tag == BACNET_APPLICATION_TAG_NULL) {
level = MULTISTATE_NULL;
object_index =
Multistate_Output_Instance_To_Index(wp_data->
object_instance);
Multistate_Output_Instance_To_Index
(wp_data->object_instance);
priority = wp_data->priority;
if (priority && (priority <= BACNET_MAX_PRIORITY)) {
priority--;
@@ -414,8 +414,8 @@ bool Multistate_Output_Write_Property(
case PROP_OUT_OF_SERVICE:
if (value.tag == BACNET_APPLICATION_TAG_BOOLEAN) {
object_index =
Multistate_Output_Instance_To_Index(wp_data->
object_instance);
Multistate_Output_Instance_To_Index
(wp_data->object_instance);
Multistate_Output_Out_Of_Service[object_index] =
value.type.Boolean;
status = true;