Prepere repo so we can run auto formatters (#747)

* clang-format: Ignore javascript files

Ignore javascript files. Clang-format is not very good formatter for
javascript files anyway. If we ever need javascript formatter we should
use Prettier.

* clang-format: Ignore some lines in sources

Couple things get formatted really funky if we let clang-format format
those. Just ignore those locally.

* zephyr/tescase.yaml: Fix yaml syntax

pre-commit hook check-yaml did found out that there are two skips.
Remove another as this is not right syntax.

* Fix repo contains unicode replacement chars

When running pre-commit text-unicode-replacement-char it founds that
there is couple unicode replacemnt chars. Remove and replace these.

* Convert some tabs to spaces manually

We will soon auto format tabs to spaces. How ever it could not do couple
thing so fix those by hand first.

* Make files with shebang executables

It is good habit that if file has shebang then it is marked executable.
These where found with pre-commit check-shebang-scripts-are-executable
checker.

---------

Co-authored-by: Kari Argillander <kari.argillander@fidelix.com>
This commit is contained in:
Kari Argillander
2024-08-24 01:58:41 +03:00
committed by GitHub
parent 36b5a3be98
commit 9e0657424e
26 changed files with 84 additions and 77 deletions
+3
View File
@@ -18,4 +18,7 @@ IndentWidth: 4
UseTab: Never
SortIncludes: false
ColumnLimit: 80
---
Language: JavaScript
DisableFormat: true
...
+4 -4
View File
@@ -39,10 +39,10 @@ option(
"compile the bacpoll app"
ON)
option(
BACNET_BUILD_BACDISCOVER_APP
"compile the bacdiscover app"
ON)
option(
BACNET_BUILD_BACDISCOVER_APP
"compile the bacdiscover app"
ON)
option(
BACDL_ETHERNET
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
View File
+29 -29
View File
@@ -10,47 +10,47 @@
#define BACPORT_H
/* common unix sockets headers needed */
#include <sys/types.h> /* basic system data types */
#include <sys/time.h> /* timeval{} for select() */
#include <time.h> /* timespec{} for pselect() */
#include <netinet/in.h> /* sockaddr_in{} and other Internet defns */
#include <arpa/inet.h> /* inet(3) functions */
#include <fcntl.h> /* for nonblocking */
#include <netdb.h>
#include <errno.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h> /* for S_xxx file mode constants */
#include <sys/uio.h> /* for iovec{} and readv/writev */
#include <unistd.h>
#include <sys/wait.h>
#include <sys/un.h> /* for Unix domain sockets */
#include <sys/types.h> /* basic system data types */
#include <sys/time.h> /* timeval{} for select() */
#include <time.h> /* timespec{} for pselect() */
#include <netinet/in.h> /* sockaddr_in{} and other Internet defns */
#include <arpa/inet.h> /* inet(3) functions */
#include <fcntl.h> /* for nonblocking */
#include <netdb.h>
#include <errno.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h> /* for S_xxx file mode constants */
#include <sys/uio.h> /* for iovec{} and readv/writev */
#include <unistd.h>
#include <sys/wait.h>
#include <sys/un.h> /* for Unix domain sockets */
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h> /* for convenience */
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h> /* for convenience */
#endif
#ifdef HAVE_POLL_H
#include <poll.h> /* for convenience */
#ifdef HAVE_POLL_H
#include <poll.h> /* for convenience */
#endif
#ifdef HAVE_STRINGS_H
#include <strings.h> /* for convenience */
#ifdef HAVE_STRINGS_H
#include <strings.h> /* for convenience */
#endif
/* Three headers are normally needed for socket/file ioctl's:
* <sys/ioctl.h>, <sys/filio.h>, and <sys/sockio.h>.
*/
#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
#endif
#ifdef HAVE_SYS_FILIO_H
#include <sys/filio.h>
#ifdef HAVE_SYS_FILIO_H
#include <sys/filio.h>
#endif
#ifdef HAVE_SYS_SOCKIO_H
#include <sys/sockio.h>
#ifdef HAVE_SYS_SOCKIO_H
#include <sys/sockio.h>
#endif
#include <pthread.h>
+1 -1
View File
@@ -69,7 +69,7 @@ bool datetime_local(BACNET_DATE *bdate,
* int tm_wday Day of week [0,6] (Sunday =0).
* int tm_yday Day of year [0,365].
* int tm_isdst Daylight Savings flag.
* long tm_gmtoff offset from UTC in seconds
* long tm_gmtoff offset from UTC in seconds
*/
datetime_set_date(bdate, (uint16_t)tblock->tm_year + 1900,
(uint8_t)tblock->tm_mon + 1, (uint8_t)tblock->tm_mday);
+1 -1
View File
@@ -837,7 +837,7 @@ static int createSocket(struct sockaddr_in *sin)
if (status < 0) {
if (BIP_Debug) {
perror("SO_BINDTODEVICE: ");
}
}
}
/* bind the socket to the local port number and IP address */
status =
View File
+3 -3
View File
@@ -22,9 +22,9 @@ enum INT_STATE { INT_DISABLED, INT_ENABLED, INT_RESTORE };
#define RESTART_WDT() { _asm CLRWDT _endasm }
/* *************************************************************************
define ENABLE_GLOBAL_INT() INTCONbits.GIE = 1
#define DISABLE_GLOBAL_INT() INTCONbits.GIE = 0
#define ENABLE_PERIPHERAL_INT() INTCONbits.PEIE = 1
define ENABLE_GLOBAL_INT() INTCONbits.GIE = 1
#define DISABLE_GLOBAL_INT() INTCONbits.GIE = 0
#define ENABLE_PERIPHERAL_INT() INTCONbits.PEIE = 1
#define DISABLE_PERIPHERAL_INT() INTCONbits.PEIE = 0
*************************************************************************** */
#define ENABLE_HIGH_INT() INTCONbits.GIE = 1
View File
+3 -3
View File
@@ -45,9 +45,9 @@ enum INT_STATE { INT_DISABLED, INT_ENABLED, INT_RESTORE };
#define RESTART_WDT() { _asm CLRWDT _endasm }
/* *************************************************************************
define ENABLE_GLOBAL_INT() INTCONbits.GIE = 1
#define DISABLE_GLOBAL_INT() INTCONbits.GIE = 0
#define ENABLE_PERIPHERAL_INT() INTCONbits.PEIE = 1
define ENABLE_GLOBAL_INT() INTCONbits.GIE = 1
#define DISABLE_GLOBAL_INT() INTCONbits.GIE = 0
#define ENABLE_PERIPHERAL_INT() INTCONbits.PEIE = 1
#define DISABLE_PERIPHERAL_INT() INTCONbits.PEIE = 0
*************************************************************************** */
#define ENABLE_HIGH_INT() INTCONbits.GIE = 1
+1 -1
View File
@@ -81,7 +81,7 @@
/**
* @brief This is the HAL system configuration section
*/
#define VDD_VALUE ((uint32_t)3300U) /*!< Value of VDD in mv */
#define VDD_VALUE ((uint32_t)3300U) /*!< Value of VDD in mv */
#define TICK_INT_PRIORITY ((uint32_t)0U) /*!< tick interrupt priority */
#define USE_RTOS 0U
#define PREFETCH_ENABLE 1U
+2 -2
View File
@@ -13,7 +13,7 @@
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
#endif /* __cplusplus */
void adc_init (void);
uint16_t adc_result_12bit(uint8_t channel);
@@ -22,5 +22,5 @@ extern "C"
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif
+2 -2
View File
@@ -13,7 +13,7 @@
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
#endif /* __cplusplus */
void bacnet_init (void);
void bacnet_task (void);
@@ -22,5 +22,5 @@ extern "C"
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif
+1 -1
View File
@@ -165,7 +165,7 @@ BACNET_ADDRESS *Get_Routed_Device_Address(int idx)
* devices with routing.
*
* @param my_address [out] Points to the currently active Device Object's
* BACnet address.
* BACnet address.
*/
void routed_get_my_address(BACNET_ADDRESS *my_address)
{
+2 -2
View File
@@ -198,10 +198,10 @@ extern "C" {
BACNET_STACK_EXPORT
bool Network_Port_IP_DHCP_Enable(
uint32_t object_instance);
uint32_t object_instance);
BACNET_STACK_EXPORT
bool Network_Port_IP_DHCP_Enable_Set(
uint32_t object_instance, bool value);
uint32_t object_instance, bool value);
BACNET_STACK_EXPORT
bool Network_Port_IP_DNS_Server(
+1 -1
View File
@@ -222,7 +222,7 @@ int PositiveInteger_Value_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
apdu_len =
encode_application_enumerated(&apdu[0], CurrentAV->Units);
break;
/* BACnet Testing Observed Incident oi00109
/* BACnet Testing Observed Incident oi00109
Positive Integer Value / Units returned wrong datatype -
missing break. Revealed by BACnet Test Client v1.8.16 (
www.bac-test.com/bacnet-test-client-download ) BITS: BIT00031 BC
+2
View File
@@ -19,12 +19,14 @@
* @{
*/
#ifndef NEXT_POWER_OF_2
/* clang-format off */
#define B2(x) ( (x) | ( (x) >> 1) )
#define B4(x) ( B2(x) | ( B2(x) >> 2) )
#define B8(x) ( B4(x) | ( B4(x) >> 4) )
#define B16(x) ( B8(x) | ( B8(x) >> 8) )
#define B32(x) (B16(x) | (B16(x) >>16) )
#define NEXT_POWER_OF_2(x) (B32((x)-1) + 1)
/* clang-format on */
#endif
/** @} */
+6 -1
View File
@@ -130,7 +130,9 @@
/* BACAPP decodes WriteProperty service requests
Choose the datatypes that your application supports */
#if !(defined(BACAPP_ALL) || \
/* clang-format off */
#if !( \
defined(BACAPP_ALL) || \
defined(BACAPP_MINIMAL) || \
defined(BACAPP_NULL) || \
defined(BACAPP_BOOLEAN) || \
@@ -166,6 +168,7 @@
defined(BACAPP_TYPES_EXTRA))
#define BACAPP_ALL
#endif
/* clang-format on */
#if defined (BACAPP_ALL)
#define BACAPP_MINIMAL
@@ -210,6 +213,7 @@
#define BACAPP_SHED_LEVEL
#endif
/* clang-format off */
#if defined(BACAPP_DOUBLE) || \
defined(BACAPP_DATETIME) || \
defined(BACAPP_DATERANGE) || \
@@ -231,6 +235,7 @@
defined(BACAPP_SHED_LEVEL)
#define BACAPP_COMPLEX_TYPES
#endif
/* clang-format on */
/*
** Set the maximum vector type sizes
+7 -7
View File
@@ -1465,9 +1465,9 @@ int bvlc6_decode_secure_bvll(uint8_t *pdu,
*
* This message provides a mechanism whereby a foreign device
* shall cause a BBMD to distribute a Forwarded-NPDU
* BVLC to the local multicast domain, to all BBMDs configured
* in the BBMDs BDT, and to all foreign devices in the
* BBMDs FDT.
* BVLC to the local multicast domain, to all BBMD's configured
* in the BBMD's BDT, and to all foreign devices in the
* BBMD's FDT.
*
* @param pdu - buffer to store the encoding
* @param pdu_size - size of the buffer to store encoding
@@ -1696,10 +1696,10 @@ int bvlc6_broadcast_distribution_table_encode(uint8_t *apdu,
{
int len = 0;
len = bvlc6_broadcast_distribution_table_list_encode(NULL,
len = bvlc6_broadcast_distribution_table_list_encode(NULL,
bdt_head);
if (len <= apdu_size) {
len = bvlc6_broadcast_distribution_table_list_encode(apdu,
len = bvlc6_broadcast_distribution_table_list_encode(apdu,
bdt_head);
} else {
len = BACNET_STATUS_ERROR;
@@ -1800,10 +1800,10 @@ int bvlc6_foreign_device_table_encode(uint8_t *apdu,
{
int len = 0;
len = bvlc6_foreign_device_table_list_encode(NULL,
len = bvlc6_foreign_device_table_list_encode(NULL,
fdt_head);
if (len <= apdu_size) {
len = bvlc6_foreign_device_table_list_encode(apdu,
len = bvlc6_foreign_device_table_list_encode(apdu,
fdt_head);
} else {
len = BACNET_STATUS_ERROR;
+4 -4
View File
@@ -152,8 +152,8 @@ static bool MSTP_Compare_Data_Expecting_Reply(
request.address.mac[0] = src_address;
request.address.mac_len = 1;
offset = bacnet_npdu_decode(
&request_pdu[0], request_pdu_len, NULL, &request.address,
&request.npdu_data);
&request_pdu[0], request_pdu_len, NULL, &request.address,
&request.npdu_data);
if (request.npdu_data.network_layer_message) {
return false;
}
@@ -170,8 +170,8 @@ static bool MSTP_Compare_Data_Expecting_Reply(
/* decode the reply data */
bacnet_address_copy(&reply.address, dest_address);
offset = bacnet_npdu_decode(
&reply_pdu[0], reply_pdu_len, &reply.address, NULL,
&reply.npdu_data);
&reply_pdu[0], reply_pdu_len, &reply.address, NULL,
&reply.npdu_data);
if (reply.npdu_data.network_layer_message) {
return false;
}
+1 -1
View File
@@ -393,7 +393,7 @@ int rr_decode_service_request(
* ReadRange-ACK ::= SEQUENCE {
* objectIdentifier [0] BACnetObjectIdentifier,
* propertyIdentifier [1] BACnetPropertyIdentifier,
* propertyArrayIndex [2] Unsigned OPTIONAL , -- used only with
* propertyArrayIndex [2] Unsigned OPTIONAL, -- used only with
* array datatype resultFlags [3] BACnetResultFlags, itemCount [4]
* Unsigned, itemData [5] SEQUENCE OF ABSTRACT-SYNTAX.&TYPE,
* firstSequenceNumber [6] Unsigned32 OPTIONAL -- used only if 'Item
+11 -13
View File
@@ -11,16 +11,14 @@ rsource "object/Kconfig"
rsource "server/Kconfig"
config BACNET_SHELL
bool "BACnet Shell"
default n
select SHELL
select CONSOLE
select KERNEL_SHELL
select THREAD_MONITOR
select THREAD_NAME
select DEVICE_SHELL
select LOG
help
Enable BACnet Shell support
bool "BACnet Shell"
default n
select SHELL
select CONSOLE
select KERNEL_SHELL
select THREAD_MONITOR
select THREAD_NAME
select DEVICE_SHELL
select LOG
help
Enable BACnet Shell support
@@ -1,6 +1,5 @@
common:
skip: true # TODO: Remove skip when zephyr v3.0.0 nested <time.h> conflicting definitions resolved.
skip: true #TODO: debug test for Zephyr v3.2.0
tests:
bacnet.datalink.bvlc.unit:
tags: bacnet