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:
@@ -208,7 +208,8 @@ uint8_t tsm_next_free_invokeID(void)
|
||||
* @param apdu Pointer to the received message.
|
||||
* @param apdu_len Bytes valid in the received message.
|
||||
*/
|
||||
void tsm_set_confirmed_unsegmented_transaction(uint8_t invokeID,
|
||||
void tsm_set_confirmed_unsegmented_transaction(
|
||||
uint8_t invokeID,
|
||||
const BACNET_ADDRESS *dest,
|
||||
const BACNET_NPDU_DATA *ndpu_data,
|
||||
const uint8_t *apdu,
|
||||
@@ -252,7 +253,8 @@ void tsm_set_confirmed_unsegmented_transaction(uint8_t invokeID,
|
||||
* the count of bytes valid in the
|
||||
* received message.
|
||||
*/
|
||||
bool tsm_get_transaction_pdu(uint8_t invokeID,
|
||||
bool tsm_get_transaction_pdu(
|
||||
uint8_t invokeID,
|
||||
BACNET_ADDRESS *dest,
|
||||
BACNET_NPDU_DATA *ndpu_data,
|
||||
uint8_t *apdu,
|
||||
@@ -311,8 +313,9 @@ void tsm_timer_milliseconds(uint16_t milliseconds)
|
||||
if (plist->RetryCount < apdu_retries()) {
|
||||
plist->RequestTimer = apdu_timeout();
|
||||
plist->RetryCount++;
|
||||
datalink_send_pdu(&plist->dest, &plist->npdu_data,
|
||||
&plist->apdu[0], plist->apdu_len);
|
||||
datalink_send_pdu(
|
||||
&plist->dest, &plist->npdu_data, &plist->apdu[0],
|
||||
plist->apdu_len);
|
||||
} else {
|
||||
/* note: the invoke id has not been cleared yet
|
||||
and this indicates a failed message:
|
||||
|
||||
+41
-55
@@ -1,10 +1,10 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright (C) 2012 Steve Karg <skarg@users.sourceforge.net>
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*********************************************************************/
|
||||
*
|
||||
* Copyright (C) 2012 Steve Karg <skarg@users.sourceforge.net>
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*********************************************************************/
|
||||
#ifndef BACNET_BASIC_TSM_TSM_H
|
||||
#define BACNET_BASIC_TSM_TSM_H
|
||||
|
||||
@@ -23,15 +23,13 @@
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* FIXME: modify basic service handlers to use TSM rather than this buffer! */
|
||||
BACNET_STACK_EXPORT extern
|
||||
uint8_t Handler_Transmit_Buffer[MAX_PDU];
|
||||
/* FIXME: modify basic service handlers to use TSM rather than this buffer! */
|
||||
BACNET_STACK_EXPORT extern uint8_t Handler_Transmit_Buffer[MAX_PDU];
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#if (!MAX_TSM_TRANSACTIONS)
|
||||
#define tsm_free_invoke_id(x) (void)x;
|
||||
#else
|
||||
@@ -80,62 +78,50 @@ typedef struct BACnet_TSM_Data {
|
||||
unsigned apdu_len;
|
||||
} BACNET_TSM_DATA;
|
||||
|
||||
typedef void (
|
||||
*tsm_timeout_function) (
|
||||
uint8_t invoke_id);
|
||||
|
||||
typedef void (*tsm_timeout_function)(uint8_t invoke_id);
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void tsm_set_timeout_handler(
|
||||
tsm_timeout_function pFunction);
|
||||
BACNET_STACK_EXPORT
|
||||
void tsm_set_timeout_handler(tsm_timeout_function pFunction);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool tsm_transaction_available(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint8_t tsm_transaction_idle_count(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
void tsm_timer_milliseconds(
|
||||
uint16_t milliseconds);
|
||||
BACNET_STACK_EXPORT
|
||||
bool tsm_transaction_available(void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint8_t tsm_transaction_idle_count(void);
|
||||
BACNET_STACK_EXPORT
|
||||
void tsm_timer_milliseconds(uint16_t milliseconds);
|
||||
/* free the invoke ID when the reply comes back */
|
||||
BACNET_STACK_EXPORT
|
||||
void tsm_free_invoke_id(
|
||||
uint8_t invokeID);
|
||||
BACNET_STACK_EXPORT
|
||||
void tsm_free_invoke_id(uint8_t invokeID);
|
||||
/* use these in tandem */
|
||||
BACNET_STACK_EXPORT
|
||||
uint8_t tsm_next_free_invokeID(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
void tsm_invokeID_set(
|
||||
uint8_t invokeID);
|
||||
BACNET_STACK_EXPORT
|
||||
uint8_t tsm_next_free_invokeID(void);
|
||||
BACNET_STACK_EXPORT
|
||||
void tsm_invokeID_set(uint8_t invokeID);
|
||||
/* returns the same invoke ID that was given */
|
||||
BACNET_STACK_EXPORT
|
||||
void tsm_set_confirmed_unsegmented_transaction(
|
||||
uint8_t invokeID,
|
||||
const BACNET_ADDRESS * dest,
|
||||
const BACNET_NPDU_DATA * ndpu_data,
|
||||
const uint8_t * apdu,
|
||||
uint16_t apdu_len);
|
||||
BACNET_STACK_EXPORT
|
||||
void tsm_set_confirmed_unsegmented_transaction(
|
||||
uint8_t invokeID,
|
||||
const BACNET_ADDRESS *dest,
|
||||
const BACNET_NPDU_DATA *ndpu_data,
|
||||
const uint8_t *apdu,
|
||||
uint16_t apdu_len);
|
||||
/* returns true if transaction is found */
|
||||
BACNET_STACK_EXPORT
|
||||
bool tsm_get_transaction_pdu(
|
||||
uint8_t invokeID,
|
||||
BACNET_ADDRESS * dest,
|
||||
BACNET_NPDU_DATA * ndpu_data,
|
||||
uint8_t * apdu,
|
||||
uint16_t * apdu_len);
|
||||
BACNET_STACK_EXPORT
|
||||
bool tsm_get_transaction_pdu(
|
||||
uint8_t invokeID,
|
||||
BACNET_ADDRESS *dest,
|
||||
BACNET_NPDU_DATA *ndpu_data,
|
||||
uint8_t *apdu,
|
||||
uint16_t *apdu_len);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool tsm_invoke_id_free(
|
||||
uint8_t invokeID);
|
||||
BACNET_STACK_EXPORT
|
||||
bool tsm_invoke_id_failed(
|
||||
uint8_t invokeID);
|
||||
BACNET_STACK_EXPORT
|
||||
bool tsm_invoke_id_free(uint8_t invokeID);
|
||||
BACNET_STACK_EXPORT
|
||||
bool tsm_invoke_id_failed(uint8_t invokeID);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user