BACnetStack_RegisterCallbackReinitializeDevice
void BACnetStack_RegisterCallbackReinitializeDevice( bool (*FPCallbackReinitializeDevice)(const uint32_t deviceInstance, const uint32_t reinitializedState, const char *password, const uint32_t passwordLength, uint32_t *errorCode));Registers the callback that performs a ReinitializeDevice request - warm start, cold start, activate changes, and the four backup/restore transitions.
Called from inside Tick().
MANDATORY. With this callback unregistered the stack answers every ReinitializeDevice with Abort(other); it will not perform a default reinitialization.
YOU OWN PASSWORD VALIDATION. The stack rejects a password that is not 1 to 20 characters, or a UTF-8 password that is not well-formed UTF-8, before calling you; otherwise it only relays it. The password argument is NULL with length 0 when the request carried none. Every other admissibility check - backup/restore state, the required backup/restore callbacks, the DeviceCommunicationControl override, Network Port pending-change validation - has already run before you are called.
A REFUSAL IS AN ERROR RESPONSE. The stack presets errorCode to success. On a false return it maps passwordFailure to class security, configurationInProgress to class device, missingRequiredParameter / communicationDisabled / optionalFunctionalityNotSupported to class services, and invalidConfigurationData to class property. Any other code that fits an Error PDU is sent with the class the stack’s callback error-code mapping gives it. Leaving errorCode untouched, setting other, or setting a code that cannot be sent as an error answers class services, code serviceRequestDenied. Only abortOther asks for an Abort(other).
On a true return the stack sends the SimpleAck and only THEN drives the backup/restore transition.
DO NOT RESTART INSIDE THE CALLBACK. The SimpleAck is sent after the callback returns, so a device that performs a warm or cold start inside it never sends the reply, and the client times out and retries. Validate the request, return, and restart after the call.
See also: CASBACnetStack::FPCallbackReinitializeDevice
BACnet reference: ANSI/ASHRAE 135-2024 clause 16.4 (ReinitializeDevice Service).
Parameters
Section titled “Parameters”| Parameter | Direction | Description |
|---|---|---|
FPCallbackReinitializeDevice |
in | The function pointer for the CallbackReinitializeDevice function. See CASBACnetStack::FPCallbackReinitializeDevice for more info. |
Callback type
Section titled “Callback type”Topic: Service callbacks. Declared in CASBACnetStackDLL.h.