fix server app doesn't work with BAC_ROUTING (#783)

This commit is contained in:
Patrick Grimm
2024-10-04 20:47:52 +02:00
committed by GitHub
parent 90dcd9dca1
commit 712dda8bbe
2 changed files with 30 additions and 5 deletions
+20 -4
View File
@@ -802,8 +802,12 @@ if(BACNET_STACK_BUILD_APPS)
add_executable(error apps/error/main.c)
target_link_libraries(error PRIVATE ${PROJECT_NAME})
# add_executable(gateway apps/gateway/main.c apps/gateway/gateway.h)
# target_link_libraries(gateway PRIVATE ${PROJECT_NAME})
add_executable(gateway apps/gateway/main.c apps/gateway/gateway.h)
target_link_libraries(gateway PRIVATE ${PROJECT_NAME})
target_compile_options(gateway PRIVATE
# Unreachable code because we have endless loop.
$<$<C_COMPILER_ID:MSVC>:/wd4702>
)
add_executable(getevent apps/getevent/main.c)
target_link_libraries(getevent PRIVATE ${PROJECT_NAME})
@@ -933,8 +937,20 @@ if(BACNET_STACK_BUILD_APPS)
endif()
if(BACDL_BIP AND BACDL_BIP6)
add_executable(router-ipv6 apps/router-ipv6/main.c)
target_link_libraries(router-ipv6 PRIVATE ${PROJECT_NAME})
add_executable(
router-ipv6
apps/router-ipv6/router-ipv6.h
apps/router-ipv6/main.c)
target_link_libraries(
router-ipv6
PRIVATE ${PROJECT_NAME})
target_compile_options(router-ipv6 PRIVATE
# These make this example not totally C90 compatible but it is ok.
-Wno-declaration-after-statement
-Wno-overlength-strings
-Wno-variadic-macros
)
endif()
add_executable(scov apps/scov/main.c)
+9
View File
@@ -627,6 +627,10 @@ static BACNET_REINITIALIZED_STATE Reinitialize_State = BACNET_REINIT_IDLE;
static const char *Reinit_Password = "filister";
static write_property_function Device_Write_Property_Store_Callback;
#ifdef BAC_ROUTING
static bool Device_Router_Mode = false;
#endif
/**
* @brief Sets the ReinitializeDevice password
*
@@ -750,7 +754,11 @@ uint32_t Device_Index_To_Instance(unsigned index)
uint32_t Device_Object_Instance_Number(void)
{
#ifdef BAC_ROUTING
if (Device_Router_Mode) {
return Routed_Device_Object_Instance_Number();
} else {
return Object_Instance_Number;
}
#else
return Object_Instance_Number;
#endif
@@ -2445,6 +2453,7 @@ void Device_Timer(uint16_t milliseconds)
void Routing_Device_Init(uint32_t first_object_instance)
{
struct object_functions *pDevObject = NULL;
Device_Router_Mode = true;
/* Initialize with our preset strings */
Add_Routed_Device(first_object_instance, &My_Object_Name, Description);