BACnetStack_RegisterCallbackCompleteRestore
void BACnetStack_RegisterCallbackCompleteRestore( bool (*FPCallbackCompleteRestore)(const uint32_t deviceInstance, const bool wasAborted));Registers the callback the stack calls to finish a restore session: apply the uploaded files and clean up, or - when the session was aborted - discard them and revert whatever the restore had already changed.
Called from inside Tick().
wasAborted is true for a ReinitializeDevice with reinitializedStateOfDevice = abortRestore, for a restore the stack abandoned because the Backup_Failure_Timeout deadline expired, and for a restore ended by BACnetStack_SetBackupAndRestoreEnabled(…, false) - a half-written image must not be applied. It is false only for a normal endRestore.
THE RETURN DECIDES Last_Restore_Time AND System_Status. On an endRestore, Last_Restore_Time is recorded only when this returns true. Either way the stack resets the backup/restore state. System_Status returns to operational when this returns true, and becomes download-required when it returns false: false means the application could neither apply the restore nor recover its previous configuration. There is no errorCode out-parameter and nothing reaches the client.
Download-required stays until a later restore session ends - by endRestore, abortRestore, or the stack abandoning it - with this callback returning true; no function sets System_Status. An application that recovers its configuration some other way after a false return still reads download-required until a client runs another restore session.
DATABASE_REVISION (cl. 19.1.3.4): after a successful restore, Database_Revision is one more than it was when the restore began. The stack does this for the value it stores. An application that serves Database_Revision through CallbackGetPropertyUInt (whose value the stack uses in preference) does it here: it keeps its current Database_Revision when it returns true from CallbackPrepareRestore, and sets it to that kept value plus one when this callback returns true with wasAborted false after a CallbackPrepareRestore it accepted (an endRestore that follows a refused CallbackPrepareRestore is not a restore, and the stack does not add one then). An aborted restore leaves it as it was.
The Backup_Failure_Timeout deadline is only armed when CallbackGetSystemTime is registered. See BACnetStack_RegisterCallbackPrepareBackup() for the all-five-callbacks registration rule. Registering has no effect if backup and restore was not compiled (STACK_OPTION_DM_BR_BACKUP_AND_RESTORE).
See also: CASBACnetStack::FPCallbackCompleteRestore
BACnet reference: ANSI/ASHRAE 135-2024 clause 19.1 (Backup and Restore).
Parameters
Section titled “Parameters”| Parameter | Direction | Description |
|---|---|---|
FPCallbackCompleteRestore |
in | The function pointer for the CallbackCompleteRestore function. See CASBACnetStack::FPCallbackCompleteRestore for more info. |
Callback type
Section titled “Callback type”Topic: Service callbacks. Declared in CASBACnetStackDLL.h.