Files
Hyeongjun Kim b9dc173c57 Support routed virtual device backup/restore reinitialization (#1320)
* Support routed virtual device backup restore reinitialization

Allow routed virtual devices to accept ReinitializeDevice so Backup and Restore
states can be handled per device. Gateway behavior remains unchanged, and
DeviceCommunicationControl remains disabled for virtual devices.

Virtual-device COLDSTART, WARMSTART, and ACTIVATE_CHANGES requests now return
OPTIONAL_FUNCTIONALITY_NOT_SUPPORTED instead of being acknowledged.

* Cover routed device backup restore test variants

Add routed-device tests for ReinitializeDevice service approval, DCC blocking,
virtual-device unsupported reinitialize states, per-device Backup/Restore state,
and backup timeout countdown behavior.

Build device tests in four compile-time variants so BAC_ROUTING and
BACNET_BACKUP_RESTORE are covered in both enabled and disabled combinations.

* Keep routed device variant tests in CTest

Register each optional device test build as its own CTest build/run pair so BAC_ROUTING and BACNET_BACKUP_RESTORE variants keep the existing fixture-based build-before-run behavior without changing the top-level test CMake file.

Constraint: Top-level test/CMakeLists.txt remains unchanged to preserve the existing test registration convention
Confidence: high
Scope-risk: narrow
Tested: cmake -S test -B /tmp/bacnet-stack-test-cmake-pr1320
Tested: ctest --test-dir /tmp/bacnet-stack-test-cmake-pr1320 -R '^test_device(_.*)?$' --output-on-failure -j4
Not-tested: Full repository CTest suite

* Ensure Backup/Restore has real configuration-file storage

Centralize reinitialize state storage so routed devices and the default device use the same access path. Enforce BACNET_BACKUP_FILE_COUNT as a positive Backup/Restore invariant, while preserving BACNET_BACKUP_RESTORE guards for no-backup builds.

Constraint: BACNET_BACKUP_RESTORE performs backup and restore through Configuration_Files[0].
Rejected: Preserve BACNET_BACKUP_FILE_COUNT=0 support | it leaves only state/property handling without a usable backup file.
Confidence: high
Scope-risk: moderate
Directive: Guard no-backup builds with BACNET_BACKUP_RESTORE, not BACNET_BACKUP_FILE_COUNT.
Tested: ctest --test-dir test/build -R '^(build_device|test_device|build_device_backup_restore|test_device_backup_restore|build_device_bac_routing|test_device_bac_routing|build_device_bac_routing_backup_restore|test_device_bac_routing_backup_restore)$' --output-on-failure
Tested: cmake --build build --target server gateway gateway2 bacbasic
Not-tested: Runtime BACnet client backup/restore exchange

---------

Signed-off-by: kimhyeongjun <hjun1.kim@samsung.com>
Co-authored-by: OmX <omx@oh-my-codex.dev>
2026-04-30 09:05:14 -05:00
..