Added bitstring-bits-used-set API to use in audit-log status bits (#879)
This commit is contained in:
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user