Fix/router ipv6 test (#806)

* fix app router-ipv6: duplicate symbol
Makefile use Device_Object_Instance_Number from device-client.c (Device_Object_Instance_Number is not in bacnet.a from Makefile)

Cmake use Device_Object_Instance_Number from libbacnet-stac.a:device.c

This fix #778

* test ipv6
This commit is contained in:
Patrick Grimm
2024-10-14 14:55:04 +02:00
committed by GitHub
parent e71c4177a1
commit a71d4b95eb
3 changed files with 8 additions and 20 deletions
+3 -6
View File
@@ -67,7 +67,7 @@ option(
option( option(
BACDL_BIP6 BACDL_BIP6
"compile with ipv6 datalink support" "compile with ipv6 datalink support"
OFF) ON)
if(NOT (BACDL_ETHERNET OR if(NOT (BACDL_ETHERNET OR
BACDL_MSTP OR BACDL_MSTP OR
@@ -945,11 +945,8 @@ if(BACNET_STACK_BUILD_APPS)
router-ipv6 router-ipv6
PRIVATE ${PROJECT_NAME}) PRIVATE ${PROJECT_NAME})
target_compile_options(router-ipv6 PRIVATE target_compile_options(router-ipv6 PRIVATE
# These make this example not totally C90 compatible but it is ok. # Unreachable code because we have endless loop.
$<$<C_COMPILER_ID:MSVC>:/wd4702>
-Wno-declaration-after-statement
-Wno-overlength-strings
-Wno-variadic-macros
) )
endif() endif()
+3 -1
View File
@@ -13,7 +13,9 @@ TARGET_BIN = ${TARGET}$(TARGET_EXT)
# BACNET_SRC_DIR is defined in common apps Makefile # BACNET_SRC_DIR is defined in common apps Makefile
BACNET_OBJECT_DIR = $(BACNET_SRC_DIR)/bacnet/basic/object BACNET_OBJECT_DIR = $(BACNET_SRC_DIR)/bacnet/basic/object
SRC = main.c \ SRC = main.c \
$(BACNET_SRC_DIR)/bacnet/basic/npdu/s_router.c $(BACNET_SRC_DIR)/bacnet/basic/npdu/s_router.c \
$(BACNET_OBJECT_DIR)/client/device-client.c \
$(BACNET_OBJECT_DIR)/netport.c
# WARNINGS, DEBUGGING, OPTIMIZATION are defined in common apps Makefile # WARNINGS, DEBUGGING, OPTIMIZATION are defined in common apps Makefile
# BACNET_DEFINES is defined in common apps Makefile # BACNET_DEFINES is defined in common apps Makefile
+2 -13
View File
@@ -26,6 +26,7 @@
#include "bacnet/basic/sys/debug.h" #include "bacnet/basic/sys/debug.h"
#include "bacnet/basic/tsm/tsm.h" #include "bacnet/basic/tsm/tsm.h"
#include "bacnet/basic/binding/address.h" #include "bacnet/basic/binding/address.h"
#include "bacnet/basic/object/device.h"
#include "bacnet/basic/services.h" #include "bacnet/basic/services.h"
/* port agnostic file */ /* port agnostic file */
#include "bacport.h" #include "bacport.h"
@@ -39,7 +40,6 @@
/* current version of the BACnet stack */ /* current version of the BACnet stack */
static const char *BACnet_Version = BACNET_VERSION_TEXT; static const char *BACnet_Version = BACNET_VERSION_TEXT;
static uint32_t Device_Instance_Number = BACNET_MAX_INSTANCE;
/** /**
* 6.6.1 Routing Tables * 6.6.1 Routing Tables
@@ -1129,17 +1129,6 @@ static void control_c_hooks(void)
} }
#endif #endif
/**
* @brief Get the Device object instance number
* @return The Device object instance number
* @note This is a proxy function to satisfy the BACnet Stack IPv6 port layer
* requirements since this application omits a Device object.
*/
uint32_t Device_Object_Instance_Number(void)
{
return Device_Instance_Number;
}
/** /**
* Main function of simple router demo. * Main function of simple router demo.
* *
@@ -1158,7 +1147,7 @@ int main(int argc, char *argv[])
printf("BACnet Simple IP to IPv6 Router Demo\n"); printf("BACnet Simple IP to IPv6 Router Demo\n");
printf("BACnet Stack Version %s\n", BACnet_Version); printf("BACnet Stack Version %s\n", BACnet_Version);
if (argc > 1) { if (argc > 1) {
Device_Instance_Number = strtol(argv[1], NULL, 0); Device_Set_Object_Instance_Number(strtol(argv[1], NULL, 0));
} }
datalink_init(); datalink_init();
atexit(cleanup); atexit(cleanup);