BACnetStack_GetInfo
uint32_t BACnetStack_GetInfo(char * infoString, const uint32_t maxInfoStringLength);Provides information about the stack as an XML string.
Provides:
- Live runtime status where available (e.g. isForeignDevice, activeCOVSubscriptionsCount).
- A
<capabilities>section listing the meaningful customer-facing features, each with an explicit enabled=“true”/“false” flag (so a consumer can tell a disabled feature apart from one this stack build does not know about), plus the compiled protocolRevision. - A raw
<macros>section listing which of a fixed set of compile-time feature macros are enabled. It is not every build option: object types, for example, are not listed.
The output is an XML fragment (there is no <?xml?> prolog, so it is NOT a standalone XML document - unlike the XML output of BACnetStack_DecodeAs()). The three sections always render in this order: runtime status, then <capabilities>, then <macros>. Within the runtime-status section the keys are emitted in alphabetical order. Some runtime keys are conditional: activeCOVSubscriptionsCount only appears when COV is compiled and at least one device exists; isForeignDevice only appears when the IPv4 data link is compiled.
Example output (whitespace added here for readability - the real output is a single line):
<info> <activeCOVSubscriptionsCount>0</activeCOVSubscriptionsCount> <isForeignDevice>false</isForeignDevice> <capabilities> <protocolRevision>30</protocolRevision> <capability name="dataLinkIPv4" enabled="true"/> <capability name="dataLinkMSTP" enabled="false"/> <capability name="bacnetSC" enabled="false"/> <capability name="segmentation" enabled="true"/> <capability name="decodeAsXML" enabled="true"/> <capability name="decodeAsJSON" enabled="true"/> <!-- ... remaining curated capabilities ... --> </capabilities> <macros> <macro>STACK_OPTION_DATA_LINK_LAYER_IPV4</macro> <macro>STACK_OPTION_DS_COV_SUBSCRIBE_COV</macro> <!-- ... remaining enabled compile-time macros ... --> </macros></info>Parameters
Section titled “Parameters”| Parameter | Direction | Description |
|---|---|---|
infoString |
out | The output string to fill with the stack info. |
maxInfoStringLength |
in | The max length of the infoString. |
Returns
Section titled “Returns”The LENGTH of the string written, NOT counting the NUL terminator that is also written. The buffer must therefore have room for length+1 bytes, and on success the result is always NUL-terminated. Returns 0 on error - infoString is NULL, maxInfoStringLength is 0, or maxInfoStringLength is too small for the string plus its terminator. There is NO required-size query: a 0 return does not tell you how large the buffer needs to be, and the three error cases are indistinguishable. Size generously and check the debug log.
Topic: Version, information and settings. Declared in CASBACnetStackDLL.h.