FB_BACnet_StringExtEncode

FB_BACnet_StringExtEncode 1:

Application

Function block for coding BACnet strings. The following coding is supported: ASCII and UTF-8. The input takes place in in Windows-1252.

VAR_INPUT

pString        : POINTER TO T_MaxString;
nSize          : INT;
pResultExtStr  : POINTER TO ST_BACnet_CharacterStringExt;
cbResult       : UDINT;

pString: Pointer to the input STRING (Windows-1252-coded text).

nSize: Character length of the input string (LEN or SIZEOF).

pResultExtStr: Pointer to the output structure (BACnet string).

cbResult: Byte length of the output structure (maximum writeable length in bytes, SIZEOF).

VAR_OUPUT

bValid         : BOOL;
bOverflow      : BOOL;
nLength        : UDINT;

bValid: Coding was successful.

bOverflow: Input string is too long to be coded to the output structure (for conversion of Windows-1252 [1 byte per character] to UTF-8 [1 to 3 bytes per character], the memory requirement of the output may be significantly higher than that of the input STRINGs → space requirement varies between 1 and 3 bytes for UTF-8 coding).

nLength: Actually written number of bytes of the output structure (does not necessarily corresponds to the character length).