Fixed network port object to accept host name option of host-n-port writes. (#997)

This commit is contained in:
Steve Karg
2025-05-20 15:44:47 -05:00
committed by GitHub
parent 524fd162f9
commit b3fd374c84
9 changed files with 1077 additions and 133 deletions
+29
View File
@@ -498,6 +498,35 @@ bool characterstring_ansi_copy(
return false;
}
/**
* @brief Copy a BACnetCharacterString into a buffer with null padding
* @param dest Pointer to the destination buffer.
* @param dest_max_len Size of the destination buffer.
* @param src Pointer to the source BACnetCharacterString.
* @return Length of the copied BACnetCharacterString, or 0 if the string
* exceeds the destination buffer size.
*/
size_t characterstring_copy_value(
char *dest, size_t dest_max_len, const BACNET_CHARACTER_STRING *src)
{
size_t i = 0, length = 0;
if (dest && src) {
if (src->length < dest_max_len) {
length = src->length;
for (i = 0; i < dest_max_len; i++) {
if (i < src->length) {
dest[i] = src->value[i];
} else {
dest[i] = 0;
}
}
}
}
return length;
}
/**
* Returns true if the character encoding and string
* contents are the same.