Strip tabs and trailing white spaces, and fix end of files (#748)
* format: Strip trailing whitespaces
We want to get rid of trailing whitespaces completly as they make just git
noice. Much better to start using automated tools to get rid of them once and
not getting them back again. This way git history will be cleaner and review
easier.
Commit was generated with:
pre-commit run --all-files trailing-whitespace
* format: Files should have exactly one new line end of them
It is good practice that every file has one new line. It is not now days so
mandatory but it also is not nice if file has lot of newlines end of it. We will
use pre-commit which takes automatically care about this so let's fix all.
Commit was generated with:
pre-commit run --all-files end-of-file-fixer
* format: Convert tabs to spaces
Project mostly use spaces over tabs. When mixing tabs and spaces this usually
makes formatting issues and also when changing those in commits it will make lot
of git noise. We will force spaces most of the time and use pre-commit to fix.
Commit was generated with:
pre-commit run --all-files remove-tabs
---------
Co-authored-by: Kari Argillander <kari.argillander@fidelix.com>
This commit is contained in:
@@ -5,8 +5,8 @@
|
||||
# @copyright SPDX-License-Identifier: MIT
|
||||
menuconfig BACNETSTACK_BACNET_BASIC
|
||||
bool "BACNETSTACK_BACNET_BASIC"
|
||||
default n
|
||||
help
|
||||
default n
|
||||
help
|
||||
This option enables a basic BACnet Device object and tasking
|
||||
|
||||
if BACNETSTACK_BACNET_BASIC
|
||||
@@ -14,33 +14,33 @@ if BACNETSTACK_BACNET_BASIC
|
||||
module = BACNETSTACK_BACNET_BASIC
|
||||
module-str = bacnet_basic
|
||||
|
||||
config BACNET_BASIC_DEVICE_OBJECT_NAME
|
||||
string "BACnet device object default name"
|
||||
default "Basic Server"
|
||||
help
|
||||
BACnet device object default name
|
||||
config BACNET_BASIC_DEVICE_OBJECT_NAME
|
||||
string "BACnet device object default name"
|
||||
default "Basic Server"
|
||||
help
|
||||
BACnet device object default name
|
||||
|
||||
config BACNET_BASIC_DEVICE_OBJECT_VERSION
|
||||
string "BACnet device object default application version string"
|
||||
default "1.0.0"
|
||||
help
|
||||
BACnet device object default application version string
|
||||
config BACNET_BASIC_DEVICE_OBJECT_VERSION
|
||||
string "BACnet device object default application version string"
|
||||
default "1.0.0"
|
||||
help
|
||||
BACnet device object default application version string
|
||||
|
||||
config BACNET_BASIC_DEVICE_DESCRIPTION
|
||||
string "BACnet device object default description string"
|
||||
default "BACnet Basic Server"
|
||||
help
|
||||
BACnet device object default description string
|
||||
config BACNET_BASIC_DEVICE_DESCRIPTION
|
||||
string "BACnet device object default description string"
|
||||
default "BACnet Basic Server"
|
||||
help
|
||||
BACnet device object default description string
|
||||
|
||||
config BACNET_BASIC_DEVICE_MODEL_NAME
|
||||
string "BACnet device object default model name string"
|
||||
default "Basic Server"
|
||||
help
|
||||
BACnet device object default model name string
|
||||
config BACNET_BASIC_DEVICE_MODEL_NAME
|
||||
string "BACnet device object default model name string"
|
||||
default "Basic Server"
|
||||
help
|
||||
BACnet device object default model name string
|
||||
|
||||
config BACNET_BASIC_DEVICE_SHELL
|
||||
bool "BACnet Basic Device subsystem shell"
|
||||
depends on BACNETSTACK
|
||||
default y if SHELL
|
||||
config BACNET_BASIC_DEVICE_SHELL
|
||||
bool "BACnet Basic Device subsystem shell"
|
||||
depends on BACNETSTACK
|
||||
default y if SHELL
|
||||
|
||||
endif # BACNETSTACK_BACNET_SETTINGS
|
||||
|
||||
@@ -49,7 +49,7 @@ static void *BACnet_Task_Context;
|
||||
* @param callback [in] The callback function called after initialization
|
||||
* @param context [in] The context to pass to the callback function
|
||||
*/
|
||||
void bacnet_basic_init_callback_set(bacnet_basic_callback callback,
|
||||
void bacnet_basic_init_callback_set(bacnet_basic_callback callback,
|
||||
void *context)
|
||||
{
|
||||
BACnet_Init_Callback = callback;
|
||||
@@ -71,7 +71,7 @@ static void bacnet_init_callback_handler(void)
|
||||
* @param callback [in] The callback function to call during the task
|
||||
* @param context [in] The context to pass to the callback function
|
||||
*/
|
||||
void bacnet_basic_task_callback_set(bacnet_basic_callback callback,
|
||||
void bacnet_basic_task_callback_set(bacnet_basic_callback callback,
|
||||
void *context)
|
||||
{
|
||||
BACnet_Task_Callback = callback;
|
||||
@@ -106,7 +106,7 @@ unsigned long bacnet_basic_packet_count(void)
|
||||
return BACnet_Packet_Count;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* @brief Initialize the BACnet device object, the service handlers, and timers
|
||||
*/
|
||||
void bacnet_basic_init(void)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief The BACnet/IPv4 datalink tasks for handling the device specific
|
||||
* @brief The BACnet/IPv4 datalink tasks for handling the device specific
|
||||
* data link layer
|
||||
* @author Steve Karg <skarg@users.sourceforge.net>
|
||||
* @date April 2024
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief The BACnet/IPv4 datalink tasks for handling the device specific
|
||||
* @brief The BACnet/IPv4 datalink tasks for handling the device specific
|
||||
* data link layer
|
||||
* @author Steve Karg <skarg@users.sourceforge.net>
|
||||
* @date April 2024
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief The BACnet datalink tasks for handling the device specific
|
||||
* @brief The BACnet datalink tasks for handling the device specific
|
||||
* data link layer
|
||||
* @author Steve Karg <skarg@users.sourceforge.net>
|
||||
* @date April 2024
|
||||
@@ -76,7 +76,7 @@ bool bacnet_port_ipv6_init(void)
|
||||
|
||||
if (!bip6_init(NULL)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Network_Port_Object_Instance_Number_Set(0, instance);
|
||||
Network_Port_Name_Set(instance, "BACnet/IPv6 Port");
|
||||
Network_Port_Type_Set(instance, PORT_TYPE_BIP6);
|
||||
|
||||
@@ -28,30 +28,30 @@
|
||||
*/
|
||||
static int cmd_objects(const struct shell *sh, size_t argc, char **argv)
|
||||
{
|
||||
int count;
|
||||
BACNET_OBJECT_TYPE object_type;
|
||||
uint32_t instance;
|
||||
uint32_t array_index;
|
||||
bool found;
|
||||
int count;
|
||||
BACNET_OBJECT_TYPE object_type;
|
||||
uint32_t instance;
|
||||
uint32_t array_index;
|
||||
bool found;
|
||||
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
shell_print(sh, "List of BACnet Objects: [{");
|
||||
count = Device_Object_List_Count();
|
||||
for (array_index = 1; array_index <= count; array_index++) {
|
||||
found = Device_Object_List_Identifier(array_index, &object_type,
|
||||
&instance);
|
||||
if (found) {
|
||||
shell_print(sh, " \"%s-%u\"%c",
|
||||
bactext_object_type_name(object_type),
|
||||
instance,
|
||||
(array_index == count) ? ' ' : ',');
|
||||
}
|
||||
}
|
||||
shell_print(sh, "}] -- %d objects found", count);
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
shell_print(sh, "List of BACnet Objects: [{");
|
||||
count = Device_Object_List_Count();
|
||||
for (array_index = 1; array_index <= count; array_index++) {
|
||||
found = Device_Object_List_Identifier(array_index, &object_type,
|
||||
&instance);
|
||||
if (found) {
|
||||
shell_print(sh, " \"%s-%u\"%c",
|
||||
bactext_object_type_name(object_type),
|
||||
instance,
|
||||
(array_index == count) ? ' ' : ',');
|
||||
}
|
||||
}
|
||||
shell_print(sh, "}] -- %d objects found", count);
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
SHELL_SUBCMD_ADD((bacnet), objects, NULL, "list of BACnet objects", cmd_objects,
|
||||
1, 0);
|
||||
1, 0);
|
||||
|
||||
@@ -35,4 +35,4 @@ static int cmd_packets(const struct shell *sh, size_t argc, char **argv)
|
||||
}
|
||||
|
||||
SHELL_SUBCMD_ADD((bacnet), packets, NULL, "BACnet task packet stats", cmd_packets,
|
||||
1, 0);
|
||||
1, 0);
|
||||
|
||||
@@ -35,4 +35,4 @@ static int cmd_uptime(const struct shell *sh, size_t argc, char **argv)
|
||||
}
|
||||
|
||||
SHELL_SUBCMD_ADD((bacnet), uptime, NULL, "BACnet task uptime", cmd_uptime,
|
||||
1, 0);
|
||||
1, 0);
|
||||
|
||||
@@ -93,12 +93,12 @@
|
||||
#define BACNET_DEVICE_MODEL_NAME "GNU Basic Server Model 42"
|
||||
#endif
|
||||
|
||||
static object_functions_t Object_Table[] = {
|
||||
static object_functions_t Object_Table[] = {
|
||||
{ OBJECT_DEVICE, NULL, /* don't init - recursive! */
|
||||
Device_Count, Device_Index_To_Instance,
|
||||
Device_Valid_Object_Instance_Number,
|
||||
Device_Object_Name, Device_Read_Property_Local,
|
||||
Device_Write_Property_Local, Device_Property_Lists,
|
||||
Device_Write_Property_Local, Device_Property_Lists,
|
||||
NULL /* ReadRangeInfo */, NULL /* Iterator */,
|
||||
NULL /* Value_Lists */, NULL /* COV */, NULL /* COV Clear */,
|
||||
NULL /* Intrinsic Reporting */, NULL /* Add_List_Element */,
|
||||
@@ -120,7 +120,7 @@ static object_functions_t Object_Table[] = {
|
||||
Analog_Output_Index_To_Instance, Analog_Output_Valid_Instance,
|
||||
Analog_Output_Object_Name, Analog_Output_Read_Property,
|
||||
Analog_Output_Write_Property, Analog_Output_Property_Lists,
|
||||
NULL /* ReadRangeInfo */, NULL /* Iterator */,
|
||||
NULL /* ReadRangeInfo */, NULL /* Iterator */,
|
||||
Analog_Output_Encode_Value_List, Analog_Output_Change_Of_Value,
|
||||
Analog_Output_Change_Of_Value_Clear, NULL /* Intrinsic Reporting */,
|
||||
NULL /* Add_List_Element */, NULL /* Remove_List_Element */,
|
||||
@@ -153,7 +153,7 @@ static object_functions_t Object_Table[] = {
|
||||
Binary_Output_Index_To_Instance, Binary_Output_Valid_Instance,
|
||||
Binary_Output_Object_Name, Binary_Output_Read_Property,
|
||||
Binary_Output_Write_Property, Binary_Output_Property_Lists,
|
||||
NULL /* ReadRangeInfo */, NULL /* Iterator */,
|
||||
NULL /* ReadRangeInfo */, NULL /* Iterator */,
|
||||
Binary_Output_Encode_Value_List, Binary_Output_Change_Of_Value,
|
||||
Binary_Output_Change_Of_Value_Clear, NULL /* Intrinsic Reporting */,
|
||||
NULL /* Add_List_Element */, NULL /* Remove_List_Element */,
|
||||
@@ -164,9 +164,9 @@ static object_functions_t Object_Table[] = {
|
||||
Binary_Value_Index_To_Instance, Binary_Value_Valid_Instance,
|
||||
Binary_Value_Object_Name, Binary_Value_Read_Property,
|
||||
Binary_Value_Write_Property, Binary_Value_Property_Lists,
|
||||
NULL /* ReadRangeInfo */, NULL /* Iterator */,
|
||||
NULL /* ReadRangeInfo */, NULL /* Iterator */,
|
||||
Binary_Value_Encode_Value_List, Binary_Value_Change_Of_Value,
|
||||
Binary_Value_Change_Of_Value_Clear,
|
||||
Binary_Value_Change_Of_Value_Clear,
|
||||
NULL /* Intrinsic Reporting */,
|
||||
NULL /* Add_List_Element */, NULL /* Remove_List_Element */,
|
||||
Binary_Value_Create, Binary_Value_Delete, NULL /* Timer */ },
|
||||
@@ -176,7 +176,7 @@ static object_functions_t Object_Table[] = {
|
||||
Multistate_Input_Index_To_Instance, Multistate_Input_Valid_Instance,
|
||||
Multistate_Input_Object_Name, Multistate_Input_Read_Property,
|
||||
Multistate_Input_Write_Property, Multistate_Input_Property_Lists,
|
||||
NULL /* ReadRangeInfo */, NULL /* Iterator */,
|
||||
NULL /* ReadRangeInfo */, NULL /* Iterator */,
|
||||
Multistate_Input_Encode_Value_List, Multistate_Input_Change_Of_Value,
|
||||
Multistate_Input_Change_Of_Value_Clear, NULL /* Intrinsic Reporting */,
|
||||
NULL /* Add_List_Element */, NULL /* Remove_List_Element */,
|
||||
@@ -188,7 +188,7 @@ static object_functions_t Object_Table[] = {
|
||||
Multistate_Output_Valid_Instance, Multistate_Output_Object_Name,
|
||||
Multistate_Output_Read_Property, Multistate_Output_Write_Property,
|
||||
Multistate_Output_Property_Lists, NULL /* ReadRangeInfo */,
|
||||
NULL /* Iterator */,
|
||||
NULL /* Iterator */,
|
||||
Multistate_Output_Encode_Value_List, Multistate_Output_Change_Of_Value,
|
||||
Multistate_Output_Change_Of_Value_Clear, NULL /* Intrinsic Reporting */,
|
||||
NULL /* Add_List_Element */, NULL /* Remove_List_Element */,
|
||||
@@ -374,9 +374,9 @@ static const int Device_Properties_Required[] = { PROP_OBJECT_IDENTIFIER,
|
||||
PROP_DATABASE_REVISION, -1 };
|
||||
|
||||
static const int Device_Properties_Optional[] = { PROP_DESCRIPTION,
|
||||
PROP_LOCATION,
|
||||
PROP_LOCATION,
|
||||
#if defined(BACDL_MSTP)
|
||||
PROP_MAX_MASTER, PROP_MAX_INFO_FRAMES,
|
||||
PROP_MAX_MASTER, PROP_MAX_INFO_FRAMES,
|
||||
#endif
|
||||
-1 };
|
||||
|
||||
@@ -958,7 +958,7 @@ int Device_Read_Property_Local(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
encode_application_character_string(&apdu[0], &char_string);
|
||||
break;
|
||||
case PROP_APPLICATION_SOFTWARE_VERSION:
|
||||
characterstring_init_ansi(&char_string,
|
||||
characterstring_init_ansi(&char_string,
|
||||
Application_Software_Version);
|
||||
apdu_len =
|
||||
encode_application_character_string(&apdu[0], &char_string);
|
||||
|
||||
Reference in New Issue
Block a user