Changed some demo main files to main.c and made them use datalink generic API calls.

This commit is contained in:
skarg
2006-11-02 21:50:43 +00:00
parent cb13cbf354
commit fcf942b5f8
7 changed files with 18 additions and 8 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ CFLAGS = -Wall -g $(INCLUDES) $(DEFINES)
TARGET = bacarf TARGET = bacarf
SRCS = readfile.c \ SRCS = main.c \
$(BACNET_PORT)/bip-init.c \ $(BACNET_PORT)/bip-init.c \
$(BACNET_ROOT)/bip.c \ $(BACNET_ROOT)/bip.c \
$(BACNET_HANDLER)/txbuf.c \ $(BACNET_HANDLER)/txbuf.c \
@@ -230,11 +230,21 @@ int main(int argc, char *argv[])
Device_Set_Object_Instance_Number(BACNET_MAX_INSTANCE); Device_Set_Object_Instance_Number(BACNET_MAX_INSTANCE);
address_init(); address_init();
Init_Service_Handlers(); Init_Service_Handlers();
/* configure standard BACnet/IP port */ #ifdef BACDL_ETHERNET
bip_set_interface("eth0"); /* for linux */ /* init the physical layer */
bip_set_port(0xBAC0); if (!ethernet_init("eth0"))
return 1;
#endif
#ifdef BACDL_BIP
bip_set_interface("eth0");
if (!bip_init()) if (!bip_init())
return 1; return 1;
printf("bip: using port %hu\r\n", bip_get_port());
#endif
#ifdef BACDL_ARCNET
if (!arcnet_init("arc0"))
return 1;
#endif
/* configure the timeout values */ /* configure the timeout values */
last_seconds = time(NULL); last_seconds = time(NULL);
timeout_seconds = (Device_APDU_Timeout() / 1000) * timeout_seconds = (Device_APDU_Timeout() / 1000) *
@@ -248,7 +258,7 @@ int main(int argc, char *argv[])
current_seconds = time(NULL); current_seconds = time(NULL);
/* returns 0 bytes on timeout */ /* returns 0 bytes on timeout */
pdu_len = bip_receive(&src, &Rx_Buf[0], MAX_MPDU, timeout); pdu_len = datalink_receive(&src, &Rx_Buf[0], MAX_MPDU, timeout);
/* process */ /* process */
if (pdu_len) { if (pdu_len) {
+1 -1
View File
@@ -17,7 +17,7 @@ PRODUCT_EXE = $(PRODUCT).exe
# Choose the Data Link Layer to Enable # Choose the Data Link Layer to Enable
DEFINES = -DBACDL_BIP=1;TSM_ENABLED=1;BIG_ENDIAN=0;PRINT_ENABLED=1 DEFINES = -DBACDL_BIP=1;TSM_ENABLED=1;BIG_ENDIAN=0;PRINT_ENABLED=1
SRCS = readfile.c \ SRCS = main.c \
..\..\ports\win32\bip-init.c \ ..\..\ports\win32\bip-init.c \
..\..\bip.c \ ..\..\bip.c \
..\..\demo\handler\txbuf.c \ ..\..\demo\handler\txbuf.c \
+1 -1
View File
@@ -20,7 +20,7 @@ CFLAGS = -Wall -g $(INCLUDES) $(DEFINES)
TARGET = bacserv TARGET = bacserv
SRCS = server.c \ SRCS = main.c \
$(BACNET_PORT)/bip-init.c \ $(BACNET_PORT)/bip-init.c \
$(BACNET_PORT)/ethernet.c \ $(BACNET_PORT)/ethernet.c \
$(BACNET_PORT)/arcnet.c \ $(BACNET_PORT)/arcnet.c \
+1 -1
View File
@@ -19,7 +19,7 @@ PRODUCT_EXE = $(PRODUCT).exe
# datalink layer that Win32 supports # datalink layer that Win32 supports
DEFINES = -DBACDL_BIP=1;USE_INADDR=1;PRINT_ENABLED=1;BIG_ENDIAN=0 DEFINES = -DBACDL_BIP=1;USE_INADDR=1;PRINT_ENABLED=1;BIG_ENDIAN=0
SRCS = server.c \ SRCS = main.c \
..\..\ports\win32\bip-init.c \ ..\..\ports\win32\bip-init.c \
..\..\bip.c \ ..\..\bip.c \
..\..\demo\handler\txbuf.c \ ..\..\demo\handler\txbuf.c \