Skip to main content

BACnet data types – Definition and exceptions

The BACnet library primarily uses BACnet data types (defined in the CmpBACnet library) at their interface (method arguments, method return values, function block properties).

If other data types are used on the interface (in this case mainly IEC basic data types), then the corresponding methods and properties perform an implicit conversion to/from the corresponding internally used BACnet data types.

Examples of this:

Conversion

IEC BOOL <-> CmpBACnet.IEC_BACNET_BOOLEAN

Using BOOL (TRUE/FALSE) instead of CmpBACnet.IEC_BACNET_BOOLEAN improves the readability of the IEC code.

IEC WSTRING <-> CmpBACnet.IEC_BACNET_STRING

The use of WSTRING is necessary because a conversion to/from the internally used BACnet data types CmpBACnet.IEC_BACNET_STRING_TYPE.BACNET_STRING_UTF_8 or CmpBACnet.IEC_BACNET_STRING_TYPE.BACNET_STRING_ISO_8859_1 is performed.

IEC DATE/TIME / BACnetDateTime <-> CmpBACnet.IEC_BACNET_DATE/CmpBACnet.IEC_BACNET_TIME

The use of DATE/TIME is more common for the IEC programmer and therefore it is preferred on the interface.

At the interface of the BACnet library, BACnet data types other than the BACnet data types are used only in well-founded exceptions in order to simplify the application IEC code. The additional effort for a conversion, which is generally small, is negligible.