Feature/create object initial value backup (#1223)

* Added example Device object and property value backup using create-object list-of-initial-values and writable properties. Initiated using ReinitializeDevice with STARTBACKUP command. Added backup and restore required properties to the Device object.

* Fixed fwrite parameters in bacfile_posix_write_stream_data to return the correct number of bytes written.

* Added Device Management-Backup and Restore-B (DM-BR-B) conversion to Wireshark PCAP format command line utility in apps/dmbrcap which decodes and provides a view of the binary backup file.
This commit is contained in:
Steve Karg
2026-02-06 16:54:10 -06:00
committed by GitHub
parent 94e79efead
commit 1d1cf9bfac
17 changed files with 1897 additions and 72 deletions
+15
View File
@@ -174,6 +174,21 @@ static void Init_Service_Handlers(void)
(unsigned)object_data.object_instance);
}
}
#if defined(BACFILE)
/* file for backup and restore example */
object_data.object_instance = bacfile_create(BACNET_MAX_INSTANCE);
if (object_data.object_instance != BACNET_MAX_INSTANCE) {
bacfile_pathname_set(object_data.object_instance, "backup_1.bin");
#if defined(BACNET_BACKUP_RESTORE)
Device_Configuration_File_Set(0, object_data.object_instance);
#endif
printf(
"Created %s-%u path=%s for backup and restore (%u files).\n",
bactext_object_type_name(OBJECT_FILE),
(unsigned)object_data.object_instance,
bacfile_pathname(object_data.object_instance), bacfile_count());
}
#endif
/* we need to handle who-is to support dynamic device binding */
apdu_set_unconfirmed_handler(
SERVICE_UNCONFIRMED_WHO_IS, handler_who_is_who_am_i_unicast);