Added bitstring-bits-used-set API to use in audit-log status bits (#879)

This commit is contained in:
Steve Karg
2024-12-19 10:25:15 -06:00
committed by GitHub
parent 6b6be4a434
commit a1d0a5ff5a
2 changed files with 20 additions and 0 deletions
+18
View File
@@ -116,6 +116,24 @@ uint8_t bitstring_bits_used(const BACNET_BIT_STRING *bit_string)
return (bit_string ? bit_string->bits_used : 0);
}
/**
* @brief Write the amount of bits used in the bit string structure.
* @param bit_string Pointer to the bit string structure.
* @param bits_used Number of bits in this bitstring
* @return true on success or false on error.
*/
bool bitstring_bits_used_set(BACNET_BIT_STRING *bit_string, uint8_t bits_used)
{
bool status = false;
if (bit_string) {
bit_string->bits_used = bits_used;
status = true;
}
return status;
}
/**
* Returns the number of bytes that a bit string is using.
*
+2
View File
@@ -45,6 +45,8 @@ BACNET_STACK_EXPORT
bool bitstring_bit(const BACNET_BIT_STRING *bit_string, uint8_t bit_number);
BACNET_STACK_EXPORT
uint8_t bitstring_bits_used(const BACNET_BIT_STRING *bit_string);
BACNET_STACK_EXPORT
bool bitstring_bits_used_set(BACNET_BIT_STRING *bit_string, uint8_t bits_used);
/* returns the number of bytes that a bit string is using */
BACNET_STACK_EXPORT
uint8_t bitstring_bytes_used(const BACNET_BIT_STRING *bit_string);