Skip to content
Version 6.1.0
Contact Us

BACnetStack_SetBACnetSCUuid

bool BACnetStack_SetBACnetSCUuid(const uint8_t * uuid, const uint8_t uuidLength);

Sets the device’s BACnet/SC device UUID (135-2024 AB.1.5.3), which identifies this device across VMAC and device-instance changes.

It is REQUIRED: an SC data link with no UUID refuses to start.

SET-ONCE. A second call is REJECTED and returns false; the only way to change it is BACnetStack_Reset(). It is also DEVICE-WIDE - the value is applied to EVERY BACnet/SC data link instance, and mirrored into the Device object.

THE DEFAULT VMAC IS DERIVED FROM THE UUID, not the other way round. Each BACnet/SC port has one VMAC, used on all of its connections - to a hub, by its hub function, and on direct connections. When no VMAC is given to BACnetStack_SetBACnetSCHubConnector() (or its per-port form), it is the LAST 6 octets of this UUID in Random-48 form (the low 4 bits of the first octet set to 0x2, clause H.7.3), so it stays the same across restarts. A UUID of all zeros has no such default: a random VMAC is drawn at each start.

After a peer refuses the port’s VMAC as a duplicate (NODE_DUPLICATE_VMAC) - a configured one or the default - the port chooses a new random Random-48 VMAC and reconnects to its hub with it; the UUID does not change. That VMAC is not kept: after a restart or BACnetStack_Reset() the port uses whatever the host then configures, and a later call that gives no VMAC returns to the default. To keep it, read the Network Port object’s MAC_Address and pass it back as the configured VMAC.

Parameter Direction Description
uuid in The 16-octet device UUID. Must not be NULL.
uuidLength in The length of uuid. Must be EXACTLY 16; any other length is rejected. The parameter exists for symmetry with the other BACnet/SC setters, not because other lengths are legal.

True if successfully set. False if uuid is NULL, uuidLength is not 16, a UUID has already been set, the Device object sync failed, no BACnet/SC data link exists, or the stack was built without STACK_OPTION_DATA_LINK_LAYER_SC.

Topic: BACnet/SC. Declared in CASBACnetStackDLL.h.