Skip to content
Version 6.1.0
Contact Us

BACnetStack_RegisterCallbackCreateObject

void BACnetStack_RegisterCallbackCreateObject(
bool (*FPCallbackCreateObject)(const uint32_t deviceInstance, const uint16_t objectType, const uint32_t objectInstance));

Registers the callback the stack calls when a CreateObject request asks the host to allocate an object.

Called from inside Tick(), and only for the CreateObject SERVICE - BACnetStack_AddObject() does NOT call it.

ORDER: it fires BEFORE the object exists in the stack’s database. Allocate host-side storage; do not try to read the object back from the stack yet.

Returning false has ONE fixed meaning: the stack answers Error(resources, noSpaceForObject) and does not create the object. There is no error-code out-parameter, so no other BACnet error can be reported from here. If the object is created and one of the request’s initial-value writes then fails, the stack calls CallbackDeleteObject to roll your allocation back before deleting it.

Registering has no effect if object creation was not compiled (STACK_OPTION_DM_OCD_OBJECT_CREATION_AND_DELETION): the pointer is discarded and set to NULL.

See also: CASBACnetStack::FPCallbackCreateObject

BACnet reference: ANSI/ASHRAE 135-2024 clause 15.3 (CreateObject Service).

Parameter Direction Description
FPCallbackCreateObject in The function pointer for the CallbackCreateObject function. See CASBACnetStack::FPCallbackCreateObject for more info.

FPCallbackCreateObject

Topic: Service callbacks. Declared in CASBACnetStackDLL.h.