Run clang-format and enable CI check for it (#755)

* pre-commit: Update and enable clang-format check

There is newer version from clang-format so use that. We do not yet want
18 as that is little bit too new.

* Format some thing by hand which clang-format "breaks"

Clang-format will format some things little bit off in some cases.
Format some things by hand so we get cleaner end result.

* Run clang-format with

```
pre-commit run --all-files clang-format
```

We have already in previously checked places where clang-format does not
make good format and ignored those (hopefully most of the things).

---------

Co-authored-by: Kari Argillander <kari.argillander@fidelix.com>
This commit is contained in:
Kari Argillander
2024-08-30 19:20:58 +03:00
committed by GitHub
parent 622a9e609e
commit f806c5829b
547 changed files with 18286 additions and 16575 deletions
+44 -42
View File
@@ -34,18 +34,18 @@ typedef enum {
** Based on UnconfirmedEventNotification-Request
*/
/** Enable decoding of complex-event-type property-values. If set to 0, the values are decoded and discarded. */
/** Enable decoding of complex-event-type property-values. If set to 0, the
* values are decoded and discarded. */
#ifndef BACNET_DECODE_COMPLEX_EVENT_TYPE_PARAMETERS
#define BACNET_DECODE_COMPLEX_EVENT_TYPE_PARAMETERS 1
#endif
/** Max complex-event-type property-values to decode. Events with more values fail to decode. */
/** Max complex-event-type property-values to decode. Events with more values
* fail to decode. */
#ifndef BACNET_COMPLEX_EVENT_TYPE_MAX_PARAMETERS
#define BACNET_COMPLEX_EVENT_TYPE_MAX_PARAMETERS 5
#endif
typedef struct BACnet_Event_Notification_Data {
uint32_t processIdentifier;
BACNET_OBJECT_ID initiatingObjectIdentifier;
@@ -54,7 +54,8 @@ typedef struct BACnet_Event_Notification_Data {
uint32_t notificationClass;
uint8_t priority;
BACNET_EVENT_TYPE eventType;
BACNET_CHARACTER_STRING *messageText; /* OPTIONAL - Set to NULL if not being used */
/* OPTIONAL - Set to NULL if not being used */
BACNET_CHARACTER_STRING *messageText;
BACNET_NOTIFY_TYPE notifyType;
bool ackRequired;
BACNET_EVENT_STATE fromState;
@@ -91,8 +92,8 @@ typedef struct BACnet_Event_Notification_Data {
BACNET_BIT_STRING statusFlags;
} changeOfValue;
/*
** EVENT_COMMAND_FAILURE
*/
** EVENT_COMMAND_FAILURE
*/
struct {
union {
BACNET_BINARY_PV binaryValue;
@@ -168,16 +169,17 @@ typedef struct BACnet_Event_Notification_Data {
} accessEvent;
#if (BACNET_DECODE_COMPLEX_EVENT_TYPE_PARAMETERS == 1)
/*
* complex-event-type - a sequence of values, used for proprietary event types
* complex-event-type - a sequence of values, used for proprietary event
* types
*/
struct {
BACNET_PROPERTY_VALUE values[BACNET_COMPLEX_EVENT_TYPE_MAX_PARAMETERS];
BACNET_PROPERTY_VALUE
values[BACNET_COMPLEX_EVENT_TYPE_MAX_PARAMETERS];
} complexEventType;
#endif
} notificationParams;
} BACNET_EVENT_NOTIFICATION_DATA;
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
@@ -187,60 +189,57 @@ extern "C" {
** Creates a Confirmed Event Notification APDU
**
****************************************************/
BACNET_STACK_EXPORT
int cevent_notify_encode_apdu(
uint8_t * apdu,
uint8_t invoke_id,
const BACNET_EVENT_NOTIFICATION_DATA * data);
BACNET_STACK_EXPORT
int cevent_notify_encode_apdu(
uint8_t *apdu,
uint8_t invoke_id,
const BACNET_EVENT_NOTIFICATION_DATA *data);
/***************************************************
**
** Creates an Unconfirmed Event Notification APDU
**
****************************************************/
BACNET_STACK_EXPORT
int uevent_notify_encode_apdu(
uint8_t * apdu,
const BACNET_EVENT_NOTIFICATION_DATA * data);
BACNET_STACK_EXPORT
int uevent_notify_encode_apdu(
uint8_t *apdu, const BACNET_EVENT_NOTIFICATION_DATA *data);
/***************************************************
**
** Encodes the service data part of Event Notification
**
****************************************************/
BACNET_STACK_EXPORT
int event_notify_encode_service_request(
uint8_t * apdu,
const BACNET_EVENT_NOTIFICATION_DATA * data);
BACNET_STACK_EXPORT
int event_notify_encode_service_request(
uint8_t *apdu, const BACNET_EVENT_NOTIFICATION_DATA *data);
BACNET_STACK_EXPORT
size_t event_notification_service_request_encode(
uint8_t *apdu,
size_t apdu_size,
const BACNET_EVENT_NOTIFICATION_DATA *data);
BACNET_STACK_EXPORT
size_t event_notification_service_request_encode(
uint8_t *apdu,
size_t apdu_size,
const BACNET_EVENT_NOTIFICATION_DATA *data);
/***************************************************
**
** Decodes the service data part of Event Notification
**
****************************************************/
BACNET_STACK_EXPORT
int event_notify_decode_service_request(
const uint8_t * apdu,
unsigned apdu_len,
BACNET_EVENT_NOTIFICATION_DATA * data);
BACNET_STACK_EXPORT
int event_notify_decode_service_request(
const uint8_t *apdu,
unsigned apdu_len,
BACNET_EVENT_NOTIFICATION_DATA *data);
/***************************************************
**
** Sends an Unconfirmed Event Notification to a dest
**
****************************************************/
BACNET_STACK_EXPORT
int uevent_notify_send(
uint8_t * buffer,
BACNET_EVENT_NOTIFICATION_DATA * data,
BACNET_ADDRESS * dest);
BACNET_STACK_EXPORT
int uevent_notify_send(
uint8_t *buffer,
BACNET_EVENT_NOTIFICATION_DATA *data,
BACNET_ADDRESS *dest);
#ifdef __cplusplus
}
@@ -249,7 +248,8 @@ extern "C" {
* These BIBBs prescribe the BACnet capabilities required to interoperably
* perform the alarm and event management functions enumerated in 22.2.1.2
* for the BACnet devices defined therein.
*//** @defgroup EVNOTFCN Alarm and Event-Notification (AE-N)
*/
/** @defgroup EVNOTFCN Alarm and Event-Notification (AE-N)
* @ingroup ALMEVNT
* 13.6 ConfirmedCOVNotification Service <br>
* The ConfirmedCOVNotification service is used to notify subscribers about
@@ -266,7 +266,8 @@ extern "C" {
* For unsubscribed notifications, the algorithm for determining when to issue
* this service is a local matter and may be based on a change of value,
* periodic updating, or some other criteria.
*//** @defgroup ALMACK Alarm and Event-ACK (AE-ACK)
*/
/** @defgroup ALMACK Alarm and Event-ACK (AE-ACK)
* @ingroup ALMEVNT
* 13.5 AcknowledgeAlarm Service <br>
* In some systems a device may need to know that an operator has seen the alarm
@@ -275,6 +276,7 @@ extern "C" {
* notification with 'AckRequired' = TRUE. Ensuring that the acknowledgment
* actually comes from a person with appropriate authority is a local matter.
* This service may be used in conjunction with either the
* ConfirmedEventNotification service or the UnconfirmedEventNotification service.
* ConfirmedEventNotification service or the
* UnconfirmedEventNotificationservice.
*/
#endif /* BACNET_EVENT_H_ */