Issue 2 move folders and use deep path include file names to prevent collisions (#4)
* moving folders and files and adjust server demo build * Fix Makefile for apps/server on Linux * fix unit test source file folders * fix datetime convert UTC functions. Add Code::Blocks project for datetime testing * added some ignore extensions * disable parallel make option * fix build for abort, dcc, and epics apps * fix build for dcc, epics, error, and getevent apps. * Fixed building of all apps * fix the ipv4 to ipv6 router app build * Change indent style from Google to Webkit * make pretty to re-format style * removed common Makefile since we already had one and two was too many * remove scripts from root folder that are no longer maintained or used * remove mercurial EOL and ignore files for git repo * remove .vscodeconfig files from repo * tweak clang-format style * clang-format src and apps with tweaked style * added clang-tidy to fix readability if braces in src * result of make tidy for src and apps * fix clang-tidy mangling * Added code::blocks project for BACnet server simulation * added code::blocks linux project for WhoIs app * update text files for EOL * fix EOL in some files * fixed make win32 apps for older gcc * Removed Borland C++ Makefile in apps. Unable to maintain support for Borland C++ compiler. * created codeblocks project for apps/epics for Windows * fixing ports/xplained to work with new data structure. * fix ports/xplained example for Atmel Studio compile * fix ports/stm32f10x example for gcc Makefile compile * fix ports/stm32f10x example for IAR EWARM compile * fix ports/xplained timer callback * fix ports/bdk_atxx_mspt build with subdirs * fix ports/bdk_atxx_mspt build with subdirs * updated git ignore for IAR build artifacts * updated gitignore for non-tracked files and folders * fixed bdk-atxx4-mstp port for Rowley Crossworks project file * fixed bdk-atxx4-mstp port for GCC AVR Makefile * fixed atmega168 port for IAR AVR and GCC AVR Makefile * fixed at91sam7s port for IAR ARM and GCC ARM Makefile * removed unmaintainable DOS, RTOS32, and atmega8 ports. Updated rx62n (untested). * changed arm7 to uip port
This commit is contained in:
+10
-2
@@ -1,10 +1,18 @@
|
||||
---
|
||||
BasedOnStyle: Google
|
||||
BasedOnStyle: WebKit
|
||||
BinPackParameters: false
|
||||
AlignEscapedNewlines: Left
|
||||
PointerAlignment: Right
|
||||
AllowShortFunctionsOnASingleLine: None
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterReturnType: None
|
||||
BreakBeforeBraces: Linux
|
||||
BreakBeforeBinaryOperators: None
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
PenaltyBreakBeforeFirstCallParameter: 1
|
||||
IndentCaseLabels: true
|
||||
IndentWidth: 4
|
||||
UseTab: Never
|
||||
SortIncludes: false
|
||||
ColumnLimit: 80
|
||||
...
|
||||
|
||||
@@ -4,19 +4,29 @@
|
||||
# Explicitly declare text files you want to always be normalized and converted
|
||||
# to native line endings on checkout.
|
||||
*.c text
|
||||
*.cpp text
|
||||
*.cxx text
|
||||
*.h text
|
||||
*.hpp text
|
||||
*.s text
|
||||
Makefile.* text
|
||||
Makefile text
|
||||
*.mak text
|
||||
*.MAK text
|
||||
*.xml text
|
||||
*.aps text
|
||||
*.mcp text
|
||||
*.hwp text
|
||||
*.lkr text
|
||||
*.lua text
|
||||
*.txt text
|
||||
*.htm text
|
||||
.cproject text
|
||||
.project text
|
||||
.gdbinit text
|
||||
.slintrc text
|
||||
*.sh text
|
||||
README.* text
|
||||
|
||||
# Declare files that will always have CRLF line endings on checkout.
|
||||
*.sln text eol=crlf
|
||||
|
||||
+11
@@ -17,6 +17,7 @@
|
||||
*.config
|
||||
*.pbd
|
||||
*.ewd
|
||||
*.ewt
|
||||
*.d
|
||||
*.r90
|
||||
*.r90
|
||||
@@ -44,5 +45,15 @@
|
||||
*.hex
|
||||
*.elf
|
||||
*.emSession
|
||||
*.depend
|
||||
*.layout
|
||||
tags
|
||||
test-results.xml
|
||||
.vscode/
|
||||
.vs/
|
||||
Debug/
|
||||
settings/
|
||||
*.componentinfo.xml
|
||||
bin/
|
||||
Backup*
|
||||
BACnet_BDT_table
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
# use glob syntax.
|
||||
syntax: glob
|
||||
|
||||
*.o
|
||||
*.exe
|
||||
*.bak
|
||||
*~
|
||||
*.dep
|
||||
*.orig
|
||||
*.hex
|
||||
*.map
|
||||
*.bin
|
||||
*.out
|
||||
*.sim
|
||||
*.dbgdt
|
||||
*.dni
|
||||
*.jlink
|
||||
*.wsdt
|
||||
*.config
|
||||
*.pbd
|
||||
*.ewd
|
||||
*.d
|
||||
*.r90
|
||||
*.s90
|
||||
*.pbi
|
||||
*.cap
|
||||
*.pcapng
|
||||
*.pcap
|
||||
*.patch
|
||||
*.suo
|
||||
*.sdf
|
||||
*.lastbuildstate
|
||||
*.obj
|
||||
*.pdb
|
||||
*.tlog
|
||||
*.log
|
||||
*.idb
|
||||
*.lib
|
||||
*.ilk
|
||||
*.opendb
|
||||
@@ -1,144 +1,127 @@
|
||||
# Main Makefile for BACnet-stack project with GCC
|
||||
|
||||
# tools - only if you need them.
|
||||
# Most platforms have this already defined
|
||||
# CC = gcc
|
||||
# AR = ar
|
||||
# MAKE = make
|
||||
# SIZE = size
|
||||
#
|
||||
# Assumes rm and cp are available
|
||||
|
||||
# configuration
|
||||
# If BACNET_DEFINES has not already been set, configure to your needs here
|
||||
MY_BACNET_DEFINES = -DPRINT_ENABLED=1
|
||||
MY_BACNET_DEFINES += -DBACAPP_ALL
|
||||
MY_BACNET_DEFINES += -DBACFILE
|
||||
MY_BACNET_DEFINES += -DINTRINSIC_REPORTING
|
||||
MY_BACNET_DEFINES += -DBACNET_TIME_MASTER
|
||||
MY_BACNET_DEFINES += -DBACNET_PROPERTY_LISTS=1
|
||||
MY_BACNET_DEFINES += -DBACNET_PROTOCOL_REVISION=17
|
||||
BACNET_DEFINES ?= $(MY_BACNET_DEFINES)
|
||||
|
||||
# un-comment the next line to build in uci integration
|
||||
#BACNET_DEFINES += -DBAC_UCI
|
||||
#UCI_LIB_DIR ?= /usr/local/lib
|
||||
|
||||
#BACDL_DEFINE=-DBACDL_ETHERNET=1
|
||||
#BACDL_DEFINE=-DBACDL_ARCNET=1
|
||||
#BACDL_DEFINE=-DBACDL_MSTP=1
|
||||
BACDL_DEFINE?=-DBACDL_BIP=1
|
||||
|
||||
# Declare your level of BBMD support
|
||||
BBMD_DEFINE ?=-DBBMD_ENABLED=1
|
||||
#BBMD_DEFINE ?= -DBBMD_ENABLED=0
|
||||
#BBMD_DEFINE ?= -DBBMD_CLIENT_ENABLED
|
||||
|
||||
# Passing parameters via command line
|
||||
MAKE_DEFINE ?=
|
||||
|
||||
# Define WEAK_FUNC for [...somebody help here; I can't find any uses of it]
|
||||
DEFINES = $(BACNET_DEFINES) $(BACDL_DEFINE) $(BBMD_DEFINE) -DWEAK_FUNC=
|
||||
DEFINES += $(MAKE_DEFINE)
|
||||
|
||||
# BACnet Ports Directory
|
||||
BACNET_PORT ?= linux
|
||||
|
||||
# Default compiler settings
|
||||
OPTIMIZATION = -Os
|
||||
DEBUGGING =
|
||||
WARNINGS = -Wall -Wmissing-prototypes
|
||||
ifeq (${BUILD},debug)
|
||||
OPTIMIZATION = -O0
|
||||
DEBUGGING = -g -DDEBUG_ENABLED=1
|
||||
ifeq (${BACDL_DEFINE},-DBACDL_BIP=1)
|
||||
DEFINES += -DBIP_DEBUG
|
||||
endif
|
||||
endif
|
||||
CFLAGS = $(WARNINGS) $(DEBUGGING) $(OPTIMIZATION) $(STANDARDS) $(INCLUDES) $(DEFINES)
|
||||
# Main Makefile for BACnet-stack applications, tests, and sample ports
|
||||
|
||||
# Export the variables defined here to all subprocesses
|
||||
# (see http://www.gnu.org/software/automake/manual/make/Special-Targets.html)
|
||||
.EXPORT_ALL_VARIABLES:
|
||||
|
||||
all: library demos router-ipv6 ${DEMO_LINUX}
|
||||
.PHONY : all library demos router gateway router-ipv6 clean test
|
||||
# all: demos router-ipv6 ${DEMO_LINUX}
|
||||
|
||||
library:
|
||||
$(MAKE) -s -C lib all
|
||||
.PHONY: all
|
||||
all: apps
|
||||
|
||||
demos:
|
||||
$(MAKE) -C demo all
|
||||
.PHONY: win32
|
||||
win32:
|
||||
$(MAKE) BACNET_PORT=win32 -C apps all
|
||||
|
||||
gateway:
|
||||
$(MAKE) -B -s -C demo gateway
|
||||
|
||||
server:
|
||||
$(MAKE) -j -B -C demo server
|
||||
|
||||
mstpcap:
|
||||
$(MAKE) -B -C demo mstpcap
|
||||
|
||||
mstpcrc: library
|
||||
$(MAKE) -B -C demo mstpcrc
|
||||
|
||||
iam:
|
||||
$(MAKE) -B -C demo iam
|
||||
|
||||
uevent:
|
||||
$(MAKE) -B -C demo uevent
|
||||
|
||||
writepropm:
|
||||
$(MAKE) -s -B -C demo writepropm
|
||||
.PHONY: apps
|
||||
apps:
|
||||
$(MAKE) -s -C apps all
|
||||
|
||||
.PHONY: abort
|
||||
abort:
|
||||
$(MAKE) -B -C demo abort
|
||||
$(MAKE) -s -C apps $@
|
||||
|
||||
.PHONY: dcc
|
||||
dcc:
|
||||
$(MAKE) -s -C apps $@
|
||||
|
||||
.PHONY: epics
|
||||
epics:
|
||||
$(MAKE) -s -C apps $@
|
||||
|
||||
.PHONY: error
|
||||
error:
|
||||
$(MAKE) -B -C demo error
|
||||
$(MAKE) -s -C apps $@
|
||||
|
||||
router: library
|
||||
$(MAKE) -s -C demo router
|
||||
.PHONY: iam
|
||||
iam:
|
||||
$(MAKE) -s -C apps $@
|
||||
|
||||
router-ipv6: library
|
||||
$(MAKE) -B -s -C demo router-ipv6
|
||||
.PHONY: getevent
|
||||
getevent:
|
||||
$(MAKE) -s -C apps $@
|
||||
|
||||
.PHONY: gateway
|
||||
gateway:
|
||||
$(MAKE) -s -C apps $@
|
||||
|
||||
.PHONY: server
|
||||
server:
|
||||
$(MAKE) -s -C apps $@
|
||||
|
||||
.PHONY: mstpcap
|
||||
mstpcap:
|
||||
$(MAKE) -s -C apps $@
|
||||
|
||||
.PHONY: mstpcrc
|
||||
mstpcrc:
|
||||
$(MAKE) -s -C apps $@
|
||||
|
||||
.PHONY: uevent
|
||||
uevent:
|
||||
$(MAKE) -s -C apps $@
|
||||
|
||||
.PHONY: writepropm
|
||||
writepropm:
|
||||
$(MAKE) -s -C apps $@
|
||||
|
||||
.PHONY: router
|
||||
router:
|
||||
$(MAKE) -s -C apps $@
|
||||
|
||||
.PHONY: router-ipv6
|
||||
router-ipv6:
|
||||
$(MAKE) -s -C apps $@
|
||||
|
||||
# Add "ports" to the build, if desired
|
||||
.PHONY: ports
|
||||
ports: atmega168 bdk-atxx4-mstp at91sam7s stm32f10x
|
||||
@echo "Built the ARM7 and AVR ports"
|
||||
|
||||
.PHONY: atmega168
|
||||
atmega168: ports/atmega168/Makefile
|
||||
$(MAKE) -s -C ports/atmega168 clean all
|
||||
|
||||
.PHONY: at91sam7s
|
||||
at91sam7s: ports/at91sam7s/Makefile
|
||||
$(MAKE) -s -C ports/at91sam7s clean all
|
||||
|
||||
.PHONY: stm32f10x
|
||||
stm32f10x: ports/stm32f10x/Makefile
|
||||
$(MAKE) -s -C ports/stm32f10x clean all
|
||||
|
||||
.PHONY: mstpsnap
|
||||
mstpsnap: ports/linux/mstpsnap.mak
|
||||
$(MAKE) -s -C ports/linux -f mstpsnap.mak clean all
|
||||
|
||||
.PHONY: bdk-atxx4-mstp
|
||||
bdk-atxx4-mstp: ports/bdk-atxx4-mstp/Makefile
|
||||
$(MAKE) -s -C ports/bdk-atxx4-mstp clean all
|
||||
|
||||
.PHONY: pretty
|
||||
pretty:
|
||||
find ./src -iname *.h -o -iname *.c -exec clang-format -i -style=file -fallback-style=none {} \;
|
||||
find ./include -iname *.h -o -iname *.c -exec clang-format -i -style=file -fallback-style=none {} \;
|
||||
find ./demo -iname *.h -o -iname *.c -exec clang-format -i -style=file -fallback-style=none {} \;
|
||||
find ./src -iname *.h -o -iname *.c -exec \
|
||||
clang-format -i -style=file -fallback-style=none {} \;
|
||||
find ./apps -iname *.h -o -iname *.c -exec \
|
||||
clang-format -i -style=file -fallback-style=none {} \;
|
||||
|
||||
.PHONY : tidy
|
||||
tidy:
|
||||
find ./src -iname *.h -o -iname *.c -exec \
|
||||
clang-tidy {} -fix-errors -checks="readability-braces-around-statements" \
|
||||
-- -Isrc -Iports/linux \;
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
$(MAKE) -s -C lib clean
|
||||
$(MAKE) -s -C demo clean
|
||||
$(MAKE) -s -C demo/router clean
|
||||
$(MAKE) -s -C demo/router-ipv6 clean
|
||||
$(MAKE) -s -C demo/gateway clean
|
||||
$(MAKE) -s -C src clean
|
||||
$(MAKE) -s -C apps clean
|
||||
$(MAKE) -s -C apps/router clean
|
||||
$(MAKE) -s -C apps/router-ipv6 clean
|
||||
$(MAKE) -s -C apps/gateway clean
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
$(MAKE) -s -C test clean
|
||||
$(MAKE) -s -C test all
|
||||
$(MAKE) -s -C test report
|
||||
$(MAKE) -s -C demo/object clean
|
||||
$(MAKE) -s -C demo/object all
|
||||
$(MAKE) -s -C demo/object report
|
||||
|
||||
|
||||
@@ -103,8 +103,7 @@ http://lists.sourceforge.net/mailman/listinfo/bacnet-developers
|
||||
I hope that you get your BACnet Device working! If not, join us on the
|
||||
mailing list and we can help.
|
||||
|
||||
Steve Karg
|
||||
Birmingham, Alabama USA
|
||||
Steve Karg, Birmingham, Alabama USA
|
||||
skarg@users.sourceforge.net
|
||||
|
||||
ASHRAE® and BACnet® are registered trademarks of the
|
||||
|
||||
+275
@@ -0,0 +1,275 @@
|
||||
# tools - only if you need them.
|
||||
# Most platforms have this already defined
|
||||
# CC = gcc
|
||||
# AR = ar
|
||||
# MAKE = make
|
||||
# SIZE = size
|
||||
#
|
||||
# Assumes rm and cp are available
|
||||
|
||||
# Passing parameters via command line or from Makefile export to this one
|
||||
BACNET_DEFINES ?=
|
||||
BACNET_LIB ?=
|
||||
|
||||
# choose a datalink to build the example applications
|
||||
# Use BACDL=mstp or BACDL=bip and BBMD=server when invoking make
|
||||
|
||||
ifeq (${BACDL_DEFINE},)
|
||||
ifeq (${BACDL},ethernet)
|
||||
BACDL_DEFINE=-DBACDL_ETHERNET=1
|
||||
endif
|
||||
ifeq (${BACDL},arcnet)
|
||||
BACDL_DEFINE=-DBACDL_ARCNET=1
|
||||
endif
|
||||
ifeq (${BACDL},mstp)
|
||||
BACDL_DEFINE=-DBACDL_MSTP=1
|
||||
endif
|
||||
ifeq (${BACDL},bip)
|
||||
BACDL_DEFINE=-DBACDL_BIP=1
|
||||
endif
|
||||
ifeq (${BACDL},bip6)
|
||||
BACDL_DEFINE=-DBACDL_BIP6=1
|
||||
endif
|
||||
ifeq (${BACDL},)
|
||||
BACDL_DEFINE ?= -DBACDL_BIP=1
|
||||
BBMD_DEFINE ?= -DBBMD_ENABLED=1
|
||||
endif
|
||||
|
||||
ifeq (${BBMD},server)
|
||||
BBMD_DEFINE=-DBBMD_ENABLED=1
|
||||
endif
|
||||
ifeq (${BBMD},client)
|
||||
BBMD_DEFINE=-DBBMD_ENABLED=1
|
||||
BBMD_DEFINE=-DBBMD_CLIENT_ENABLED
|
||||
endif
|
||||
endif
|
||||
|
||||
# Define WEAK_FUNC for unsupported or specific compilers
|
||||
BACNET_DEFINES += $(BACDL_DEFINE)
|
||||
BACNET_DEFINES += $(BBMD_DEFINE)
|
||||
BACNET_DEFINES += -DWEAK_FUNC=
|
||||
BACNET_DEFINES += $(MAKE_DEFINE)
|
||||
|
||||
# Choose a BACnet Ports Directory for the example applications target OS
|
||||
# linux, win32, bsd
|
||||
BACNET_PORT ?= linux
|
||||
|
||||
# build in uci integration - use UCI=1 when invoking make
|
||||
ifeq (${UCI},1)
|
||||
BACNET_DEFINES += -DBAC_UCI
|
||||
UCI_LIB_DIR ?= /usr/local/lib
|
||||
BACNET_LIB += -L$(UCI_LIB_DIR),-luci
|
||||
endif
|
||||
# OS specific builds
|
||||
ifeq (${BACNET_PORT},linux)
|
||||
PFLAGS = -pthread
|
||||
TARGET_EXT =
|
||||
SYSTEM_LIB=-lc,-lgcc,-lrt,-lm
|
||||
endif
|
||||
ifeq (${BACNET_PORT},bsd)
|
||||
PFLAGS = -pthread
|
||||
TARGET_EXT =
|
||||
SYSTEM_LIB=-lc,-lm
|
||||
endif
|
||||
ifeq (${BACNET_PORT},win32)
|
||||
TARGET_EXT = .exe
|
||||
SYSTEM_LIB=-lws2_32,-lgcc,-lm,-liphlpapi,-lwinmm
|
||||
BACNET_DEFINES += -D_NO_OLDNAMES
|
||||
endif
|
||||
|
||||
# source file locations
|
||||
BACNET_PORT_DIR = $(realpath ../ports/$(BACNET_PORT))
|
||||
BACNET_SRC_DIR = $(realpath ../src)
|
||||
|
||||
#build for release (default) or debug
|
||||
OPTIMIZATION ?= -Os
|
||||
DEBUGGING ?=
|
||||
WARNINGS ?= -Wall -Wmissing-prototypes
|
||||
# dead code removal
|
||||
ifeq (${BUILD},debug)
|
||||
OPTIMIZATION = -O0
|
||||
DEBUGGING = -g -DDEBUG_ENABLED=1
|
||||
ifeq (${BACDL_DEFINE},-DBACDL_BIP=1)
|
||||
BACNET_DEFINES += -DBIP_DEBUG
|
||||
endif
|
||||
endif
|
||||
|
||||
# If BACNET_DEFINES has not already been set, configure to your needs here
|
||||
BACNET_DEFINES ?=
|
||||
BACNET_DEFINES += -DPRINT_ENABLED=1
|
||||
BACNET_DEFINES += -DBACAPP_ALL
|
||||
BACNET_DEFINES += -DBACFILE
|
||||
BACNET_DEFINES += -DINTRINSIC_REPORTING
|
||||
BACNET_DEFINES += -DBACNET_TIME_MASTER
|
||||
BACNET_DEFINES += -DBACNET_PROPERTY_LISTS=1
|
||||
BACNET_DEFINES += -DBACNET_PROTOCOL_REVISION=17
|
||||
|
||||
# put all the flags together
|
||||
INCLUDES = -I$(BACNET_SRC_DIR) -I$(BACNET_PORT_DIR)
|
||||
CFLAGS += $(WARNINGS) $(DEBUGGING) $(OPTIMIZATION) $(BACNET_DEFINES) $(INCLUDES)
|
||||
LFLAGS += -Wl,$(SYSTEM_LIB)
|
||||
ifneq (${BACNET_LIB},)
|
||||
LFLAGS += -Wl,$(BACNET_LIB)
|
||||
endif
|
||||
# GCC dead code removal
|
||||
CFLAGS += -ffunction-sections -fdata-sections
|
||||
LFLAGS += -Wl,--gc-sections
|
||||
|
||||
PORT_ARCNET_SRC = \
|
||||
$(BACNET_PORT_DIR)/arcnet.c
|
||||
|
||||
PORT_MSTP_SRC = \
|
||||
$(BACNET_PORT_DIR)/rs485.c \
|
||||
$(BACNET_PORT_DIR)/dlmstp.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/datalink/mstp.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/datalink/mstptext.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/datalink/crc.c
|
||||
|
||||
PORT_ETHERNET_SRC = \
|
||||
$(BACNET_PORT_DIR)/ethernet.c
|
||||
|
||||
PORT_BIP_SRC = \
|
||||
$(BACNET_PORT_DIR)/bip-init.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/datalink/bvlc.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/datalink/bip.c
|
||||
|
||||
PORT_BIP6_SRC = \
|
||||
$(BACNET_PORT_DIR)/bip6.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/bbmd6/h_bbmd6.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/bbmd6/vmac.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/datalink/bvlc6.c
|
||||
|
||||
PORT_ALL_SRC = \
|
||||
$(BACNET_SRC_DIR)/bacnet/datalink/datalink.c \
|
||||
$(PORT_ARCNET_SRC) \
|
||||
$(PORT_MSTP_SRC) \
|
||||
$(PORT_ETHERNET_SRC) \
|
||||
$(PORT_BIP_SRC) \
|
||||
$(PORT_BIP6_SRC)
|
||||
|
||||
ifeq (${BACDL_DEFINE},-DBACDL_BIP=1)
|
||||
BACNET_PORT_SRC = ${PORT_BIP_SRC}
|
||||
endif
|
||||
ifeq (${BACDL_DEFINE},-DBACDL_BIP6=1)
|
||||
BACNET_PORT_SRC = ${PORT_BIP6_SRC}
|
||||
endif
|
||||
ifeq (${BACDL_DEFINE},-DBACDL_MSTP=1)
|
||||
BACNET_PORT_SRC = ${PORT_MSTP_SRC}
|
||||
endif
|
||||
ifeq (${BACDL_DEFINE},-DBACDL_ARCNET=1)
|
||||
BACNET_PORT_SRC = ${PORT_ARCNET_SRC}
|
||||
endif
|
||||
ifeq (${BACDL_DEFINE},-DBACDL_ETHERNET=1)
|
||||
BACNET_PORT_SRC = ${PORT_ETHERNET_SRC}
|
||||
endif
|
||||
ifdef BACDL_ALL
|
||||
BACNET_PORT_SRC = ${PORT_ALL_SRC}
|
||||
endif
|
||||
|
||||
BACNET_PORT_SRC += \
|
||||
$(BACNET_SRC_DIR)/bacnet/datalink/dlenv.c \
|
||||
$(BACNET_PORT_DIR)/mstimer-init.c \
|
||||
$(BACNET_PORT_DIR)/datetime-init.c \
|
||||
|
||||
BACNET_SRC ?= \
|
||||
$(wildcard $(BACNET_SRC_DIR)/bacnet/*.c) \
|
||||
|
||||
BACNET_BASIC_SRC ?= \
|
||||
$(wildcard $(BACNET_SRC_DIR)/bacnet/basic/*.c) \
|
||||
$(wildcard $(BACNET_SRC_DIR)/bacnet/basic/binding/*.c) \
|
||||
$(wildcard $(BACNET_SRC_DIR)/bacnet/basic/sys/*.c) \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/npdu/h_npdu.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/npdu/s_router.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/tsm/tsm.c
|
||||
|
||||
.EXPORT_ALL_VARIABLES:
|
||||
|
||||
SUBDIRS = readprop writeprop readfile writefile reinit server dcc \
|
||||
whohas whois iam ucov scov timesync epics readpropm readrange \
|
||||
writepropm uptransfer getevent uevent abort error
|
||||
|
||||
ifeq (${BACDL_DEFINE},-DBACDL_BIP=1)
|
||||
SUBDIRS += whoisrouter iamrouter initrouter readbdt
|
||||
endif
|
||||
|
||||
ifeq (${BACNET_PORT},linux)
|
||||
ifneq (${OSTYPE},cygwin)
|
||||
SUBDIRS += mstpcap mstpcrc
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq (${BACNET_PORT},win32)
|
||||
SUBDIRS += mstpcap mstpcrc
|
||||
endif
|
||||
|
||||
.PHONY: all clean
|
||||
TARGETS = all clean
|
||||
|
||||
$(TARGETS): %: $(patsubst %, %.%, $(SUBDIRS))
|
||||
|
||||
$(foreach TGT, $(TARGETS), $(patsubst %, %.$(TGT), $(SUBDIRS))):
|
||||
$(MAKE) -b -C $(subst ., , $@)
|
||||
|
||||
.PHONY: gateway
|
||||
gateway:
|
||||
$(MAKE) -s -b -C gateway
|
||||
|
||||
.PHONY: server
|
||||
server:
|
||||
$(MAKE) -s -b -C $@
|
||||
|
||||
.PHONY: mstpcap
|
||||
mstpcap:
|
||||
$(MAKE) -b -C $@
|
||||
|
||||
.PHONY: mstpcrc
|
||||
mstpcrc:
|
||||
$(MAKE) -b -C $@
|
||||
|
||||
.PHONY: abort
|
||||
abort:
|
||||
$(MAKE) -b -C $@
|
||||
|
||||
.PHONY: dcc
|
||||
dcc:
|
||||
$(MAKE) -b -C $@
|
||||
|
||||
.PHONY: epics
|
||||
epics:
|
||||
$(MAKE) -b -C $@
|
||||
|
||||
.PHONY: error
|
||||
error:
|
||||
$(MAKE) -b -C $@
|
||||
|
||||
.PHONY: getevent
|
||||
getevent:
|
||||
$(MAKE) -b -C $@
|
||||
|
||||
.PHONY: iam
|
||||
iam:
|
||||
$(MAKE) -b -C $@
|
||||
|
||||
.PHONY: iamrouter
|
||||
iamrouter:
|
||||
$(MAKE) -b -C $@
|
||||
|
||||
.PHONY: initrouter
|
||||
initrouter:
|
||||
$(MAKE) -b -C $@
|
||||
|
||||
.PHONY: uevent
|
||||
uevent:
|
||||
$(MAKE) -b -C $@
|
||||
|
||||
.PHONY: router
|
||||
router:
|
||||
$(MAKE) -s -b -C $@
|
||||
|
||||
.PHONY: router-ipv6
|
||||
router-ipv6:
|
||||
$(MAKE) -b -C $@
|
||||
|
||||
.PHONY: writepropm
|
||||
writepropm:
|
||||
$(MAKE) -b -C $@
|
||||
@@ -0,0 +1,50 @@
|
||||
#Makefile to build BACnet Application for the GCC port
|
||||
|
||||
# Executable file name
|
||||
TARGET = bacabort
|
||||
|
||||
# BACnet objects that are used with this app
|
||||
BACNET_OBJECT_DIR = $(BACNET_SRC_DIR)/bacnet/basic/object
|
||||
SRC = main.c \
|
||||
$(BACNET_OBJECT_DIR)/client/device-client.c \
|
||||
$(BACNET_OBJECT_DIR)/netport.c
|
||||
BACNET_BASIC_SRC += \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_apdu.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_iam.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_noserv.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_rp.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_whois.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/s_iam.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/s_abort.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/s_whois.c
|
||||
|
||||
# TARGET_EXT is defined in apps/Makefile as .exe or nothing
|
||||
TARGET_BIN = ${TARGET}$(TARGET_EXT)
|
||||
|
||||
SRCS = $(SRC) $(BACNET_SRC) $(BACNET_BASIC_SRC) $(BACNET_PORT_SRC)
|
||||
|
||||
OBJS += ${SRCS:.c=.o}
|
||||
|
||||
.PHONY: all
|
||||
all: Makefile ${TARGET_BIN}
|
||||
|
||||
${TARGET_BIN}: ${OBJS}
|
||||
${CC} ${PFLAGS} ${OBJS} ${LFLAGS} -o $@
|
||||
size $@
|
||||
cp $@ ../../bin
|
||||
|
||||
.c.o:
|
||||
${CC} -c ${CFLAGS} $*.c -o $@
|
||||
|
||||
.PHONY: depend
|
||||
depend:
|
||||
rm -f .depend
|
||||
${CC} -MM ${CFLAGS} *.c >> .depend
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f core ${TARGET_BIN} ${OBJS} $(TARGET).map
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
@@ -30,22 +30,21 @@
|
||||
#include <stdlib.h>
|
||||
#include <time.h> /* for time */
|
||||
#include <errno.h>
|
||||
#include "bactext.h"
|
||||
#include "iam.h"
|
||||
#include "address.h"
|
||||
#include "config.h"
|
||||
#include "bacdef.h"
|
||||
#include "npdu.h"
|
||||
#include "apdu.h"
|
||||
#include "device.h"
|
||||
#include "datalink.h"
|
||||
#include "version.h"
|
||||
#include "bacnet/bactext.h"
|
||||
#include "bacnet/iam.h"
|
||||
#include "bacnet/config.h"
|
||||
#include "bacnet/bacdef.h"
|
||||
#include "bacnet/npdu.h"
|
||||
#include "bacnet/apdu.h"
|
||||
#include "bacnet/version.h"
|
||||
/* some demo stuff needed */
|
||||
#include "filename.h"
|
||||
#include "handlers.h"
|
||||
#include "client.h"
|
||||
#include "txbuf.h"
|
||||
#include "dlenv.h"
|
||||
#include "bacnet/basic/binding/address.h"
|
||||
#include "bacnet/basic/object/device.h"
|
||||
#include "bacnet/basic/services.h"
|
||||
#include "bacnet/basic/sys/filename.h"
|
||||
#include "bacnet/basic/tsm/tsm.h"
|
||||
#include "bacnet/datalink/datalink.h"
|
||||
#include "bacnet/datalink/dlenv.h"
|
||||
|
||||
/* parsed command line parameters */
|
||||
static uint8_t Target_Invoke_ID = 1;
|
||||
@@ -54,8 +53,8 @@ static bool Target_Server = true;
|
||||
/* flag for signalling errors */
|
||||
static bool Error_Detected = false;
|
||||
|
||||
void MyAbortHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
uint8_t abort_reason, bool server)
|
||||
static void MyAbortHandler(
|
||||
BACNET_ADDRESS *src, uint8_t invoke_id, uint8_t abort_reason, bool server)
|
||||
{
|
||||
(void)src;
|
||||
(void)invoke_id;
|
||||
@@ -64,8 +63,8 @@ void MyAbortHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
Error_Detected = true;
|
||||
}
|
||||
|
||||
void MyRejectHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
uint8_t reject_reason)
|
||||
static void MyRejectHandler(
|
||||
BACNET_ADDRESS *src, uint8_t invoke_id, uint8_t reject_reason)
|
||||
{
|
||||
(void)src;
|
||||
(void)invoke_id;
|
||||
@@ -83,8 +82,8 @@ static void Init_Service_Handlers(void)
|
||||
It is required to send the proper reject message... */
|
||||
apdu_set_unrecognized_service_handler_handler(handler_unrecognized_service);
|
||||
/* we must implement read property - it's required! */
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_PROPERTY,
|
||||
handler_read_property);
|
||||
apdu_set_confirmed_handler(
|
||||
SERVICE_CONFIRMED_READ_PROPERTY, handler_read_property);
|
||||
/* handle the reply (request) coming back */
|
||||
apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_I_AM, handler_i_am_add);
|
||||
/* handle any errors coming back */
|
||||
@@ -121,8 +120,7 @@ static void print_help(char *filename)
|
||||
"or an IP string with optional port number like 10.1.2.3:47808\n"
|
||||
"or an Ethernet MAC in hex like 00:21:70:7e:32:bb\n"
|
||||
"\n");
|
||||
printf(
|
||||
"abort-reason:\n"
|
||||
printf("abort-reason:\n"
|
||||
" number from 0 to 65535\n"
|
||||
"invoke-id:\n"
|
||||
" number from 1 to 255\n"
|
||||
@@ -136,9 +134,9 @@ static void print_help(char *filename)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
long dnet = -1;
|
||||
BACNET_MAC_ADDRESS mac = {0};
|
||||
BACNET_MAC_ADDRESS adr = {0};
|
||||
BACNET_ADDRESS dest = {0};
|
||||
BACNET_MAC_ADDRESS mac = { 0 };
|
||||
BACNET_MAC_ADDRESS adr = { 0 };
|
||||
BACNET_ADDRESS dest = { 0 };
|
||||
bool specific_address = false;
|
||||
int argi = 0;
|
||||
unsigned int target_args = 0;
|
||||
@@ -153,8 +151,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
if (strcmp(argv[argi], "--version") == 0) {
|
||||
printf("%s %s\n", filename, BACNET_VERSION_TEXT);
|
||||
printf(
|
||||
"Copyright (C) 2016 by Steve Karg and others.\n"
|
||||
printf("Copyright (C) 2016 by Steve Karg and others.\n"
|
||||
"This is free software; see the source for copying "
|
||||
"conditions.\n"
|
||||
"There is NO warranty; not even for MERCHANTABILITY or\n"
|
||||
@@ -0,0 +1,50 @@
|
||||
#Makefile to build BACnet Application for GCC compiler
|
||||
|
||||
TARGET = bacdcc
|
||||
|
||||
# BACnet objects that are used with this app
|
||||
BACNET_OBJECT_DIR = $(BACNET_SRC_DIR)/bacnet/basic/object
|
||||
SRC = main.c \
|
||||
$(BACNET_OBJECT_DIR)/client/device-client.c \
|
||||
$(BACNET_OBJECT_DIR)/netport.c
|
||||
BACNET_BASIC_SRC += \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_apdu.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_dcc.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_iam.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_noserv.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_rp.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_whois.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/s_iam.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/s_dcc.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/s_whois.c
|
||||
|
||||
# TARGET_EXT is defined in apps/Makefile as .exe or nothing
|
||||
TARGET_BIN = ${TARGET}$(TARGET_EXT)
|
||||
|
||||
SRCS = $(SRC) $(BACNET_SRC) $(BACNET_BASIC_SRC) $(BACNET_PORT_SRC)
|
||||
|
||||
OBJS += ${SRCS:.c=.o}
|
||||
|
||||
.PHONY: all
|
||||
all: Makefile ${TARGET_BIN}
|
||||
|
||||
${TARGET_BIN}: ${OBJS}
|
||||
${CC} ${PFLAGS} ${OBJS} ${LFLAGS} -o $@
|
||||
size $@
|
||||
cp $@ ../../bin
|
||||
|
||||
.c.o:
|
||||
${CC} -c ${CFLAGS} $*.c -o $@
|
||||
|
||||
.PHONY: depend
|
||||
depend:
|
||||
rm -f .depend
|
||||
${CC} -MM ${CFLAGS} *.c >> .depend
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f core ${TARGET_BIN} ${OBJS} $(TARGET).map
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
@@ -30,30 +30,30 @@
|
||||
#include <stdlib.h>
|
||||
#include <time.h> /* for time */
|
||||
#include <errno.h>
|
||||
#include "bactext.h"
|
||||
#include "iam.h"
|
||||
#include "arf.h"
|
||||
#include "tsm.h"
|
||||
#include "address.h"
|
||||
#include "config.h"
|
||||
#include "bacdef.h"
|
||||
#include "npdu.h"
|
||||
#include "apdu.h"
|
||||
#include "device.h"
|
||||
#include "net.h"
|
||||
#include "datalink.h"
|
||||
#include "whois.h"
|
||||
#include "dcc.h"
|
||||
#include "version.h"
|
||||
#include "bacnet/bactext.h"
|
||||
#include "bacnet/iam.h"
|
||||
#include "bacnet/arf.h"
|
||||
#include "bacnet/basic/tsm/tsm.h"
|
||||
#include "bacnet/basic/binding/address.h"
|
||||
#include "bacnet/config.h"
|
||||
#include "bacnet/bacdef.h"
|
||||
#include "bacnet/npdu.h"
|
||||
#include "bacnet/apdu.h"
|
||||
#include "bacnet/basic/object/device.h"
|
||||
#include "bacport.h"
|
||||
#include "bacnet/datalink/datalink.h"
|
||||
#include "bacnet/whois.h"
|
||||
#include "bacnet/dcc.h"
|
||||
#include "bacnet/version.h"
|
||||
/* some demo stuff needed */
|
||||
#include "filename.h"
|
||||
#include "handlers.h"
|
||||
#include "client.h"
|
||||
#include "txbuf.h"
|
||||
#include "dlenv.h"
|
||||
#include "bacnet/basic/sys/filename.h"
|
||||
#include "bacnet/basic/services.h"
|
||||
#include "bacnet/basic/services.h"
|
||||
#include "bacnet/basic/tsm/tsm.h"
|
||||
#include "bacnet/datalink/dlenv.h"
|
||||
|
||||
/* buffer used for receive */
|
||||
static uint8_t Rx_Buf[MAX_MPDU] = {0};
|
||||
static uint8_t Rx_Buf[MAX_MPDU] = { 0 };
|
||||
|
||||
/* global variables used in this file */
|
||||
static uint32_t Target_Device_Object_Instance = BACNET_MAX_INSTANCE;
|
||||
@@ -65,7 +65,8 @@ static char *Communication_Password = NULL;
|
||||
|
||||
static bool Error_Detected = false;
|
||||
|
||||
static void MyErrorHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
static void MyErrorHandler(BACNET_ADDRESS *src,
|
||||
uint8_t invoke_id,
|
||||
BACNET_ERROR_CLASS error_class,
|
||||
BACNET_ERROR_CODE error_code)
|
||||
{
|
||||
@@ -77,8 +78,8 @@ static void MyErrorHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
Error_Detected = true;
|
||||
}
|
||||
|
||||
void MyAbortHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
uint8_t abort_reason, bool server)
|
||||
static void MyAbortHandler(
|
||||
BACNET_ADDRESS *src, uint8_t invoke_id, uint8_t abort_reason, bool server)
|
||||
{
|
||||
/* FIXME: verify src and invoke id */
|
||||
(void)src;
|
||||
@@ -88,8 +89,8 @@ void MyAbortHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
Error_Detected = true;
|
||||
}
|
||||
|
||||
void MyRejectHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
uint8_t reject_reason)
|
||||
static void MyRejectHandler(
|
||||
BACNET_ADDRESS *src, uint8_t invoke_id, uint8_t reject_reason)
|
||||
{
|
||||
/* FIXME: verify src and invoke id */
|
||||
(void)src;
|
||||
@@ -98,8 +99,8 @@ void MyRejectHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
Error_Detected = true;
|
||||
}
|
||||
|
||||
void MyDeviceCommunicationControlSimpleAckHandler(BACNET_ADDRESS *src,
|
||||
uint8_t invoke_id)
|
||||
static void MyDeviceCommunicationControlSimpleAckHandler(
|
||||
BACNET_ADDRESS *src, uint8_t invoke_id)
|
||||
{
|
||||
(void)src;
|
||||
(void)invoke_id;
|
||||
@@ -118,8 +119,8 @@ static void Init_Service_Handlers(void)
|
||||
It is required to send the proper reject message... */
|
||||
apdu_set_unrecognized_service_handler_handler(handler_unrecognized_service);
|
||||
/* we must implement read property - it's required! */
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_PROPERTY,
|
||||
handler_read_property);
|
||||
apdu_set_confirmed_handler(
|
||||
SERVICE_CONFIRMED_READ_PROPERTY, handler_read_property);
|
||||
/* handle communication so we can shutup when asked */
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_DEVICE_COMMUNICATION_CONTROL,
|
||||
handler_device_communication_control);
|
||||
@@ -128,8 +129,8 @@ static void Init_Service_Handlers(void)
|
||||
SERVICE_CONFIRMED_DEVICE_COMMUNICATION_CONTROL,
|
||||
MyDeviceCommunicationControlSimpleAckHandler);
|
||||
/* handle any errors coming back */
|
||||
apdu_set_error_handler(SERVICE_CONFIRMED_DEVICE_COMMUNICATION_CONTROL,
|
||||
MyErrorHandler);
|
||||
apdu_set_error_handler(
|
||||
SERVICE_CONFIRMED_DEVICE_COMMUNICATION_CONTROL, MyErrorHandler);
|
||||
apdu_set_abort_handler(MyAbortHandler);
|
||||
apdu_set_reject_handler(MyRejectHandler);
|
||||
}
|
||||
@@ -162,7 +163,7 @@ static void print_help(char *filename)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
BACNET_ADDRESS src = {0}; /* address where message came from */
|
||||
BACNET_ADDRESS src = { 0 }; /* address where message came from */
|
||||
uint16_t pdu_len = 0;
|
||||
unsigned timeout = 100; /* milliseconds */
|
||||
unsigned max_apdu = 0;
|
||||
@@ -184,8 +185,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
if (strcmp(argv[argi], "--version") == 0) {
|
||||
printf("%s %s\n", filename, BACNET_VERSION_TEXT);
|
||||
printf(
|
||||
"Copyright (C) 2014 by Steve Karg and others.\n"
|
||||
printf("Copyright (C) 2014 by Steve Karg and others.\n"
|
||||
"This is free software; see the source for copying "
|
||||
"conditions.\n"
|
||||
"There is NO warranty; not even for MERCHANTABILITY or\n"
|
||||
@@ -223,11 +223,11 @@ int main(int argc, char *argv[])
|
||||
last_seconds = time(NULL);
|
||||
timeout_seconds = (apdu_timeout() / 1000) * apdu_retries();
|
||||
/* try to bind with the device */
|
||||
found = address_bind_request(Target_Device_Object_Instance, &max_apdu,
|
||||
&Target_Address);
|
||||
found = address_bind_request(
|
||||
Target_Device_Object_Instance, &max_apdu, &Target_Address);
|
||||
if (!found) {
|
||||
Send_WhoIs(Target_Device_Object_Instance,
|
||||
Target_Device_Object_Instance);
|
||||
Send_WhoIs(
|
||||
Target_Device_Object_Instance, Target_Device_Object_Instance);
|
||||
}
|
||||
/* loop forever */
|
||||
for (;;) {
|
||||
@@ -242,15 +242,16 @@ int main(int argc, char *argv[])
|
||||
npdu_handler(&src, &Rx_Buf[0], pdu_len);
|
||||
}
|
||||
/* at least one second has passed */
|
||||
if (current_seconds != last_seconds)
|
||||
if (current_seconds != last_seconds) {
|
||||
tsm_timer_milliseconds(
|
||||
(uint16_t)((current_seconds - last_seconds) * 1000));
|
||||
}
|
||||
if (Error_Detected)
|
||||
break;
|
||||
/* wait until the device is bound, or timeout and quit */
|
||||
if (!found) {
|
||||
found = address_bind_request(Target_Device_Object_Instance,
|
||||
&max_apdu, &Target_Address);
|
||||
found = address_bind_request(
|
||||
Target_Device_Object_Instance, &max_apdu, &Target_Address);
|
||||
}
|
||||
if (found) {
|
||||
if (invoke_id == 0) {
|
||||
@@ -258,9 +259,9 @@ int main(int argc, char *argv[])
|
||||
Target_Device_Object_Instance,
|
||||
Communication_Timeout_Minutes, Communication_State,
|
||||
Communication_Password);
|
||||
} else if (tsm_invoke_id_free(invoke_id))
|
||||
} else if (tsm_invoke_id_free(invoke_id)) {
|
||||
break;
|
||||
else if (tsm_invoke_id_failed(invoke_id)) {
|
||||
} else if (tsm_invoke_id_failed(invoke_id)) {
|
||||
fprintf(stderr, "\rError: TSM Timeout!\n");
|
||||
tsm_free_invoke_id(invoke_id);
|
||||
/* try again or abort? */
|
||||
@@ -0,0 +1,50 @@
|
||||
#Makefile to build BACnet Application for the Linux Port
|
||||
|
||||
TARGET = bacepics
|
||||
BACNET_OBJECT_DIR = $(BACNET_SRC_DIR)/bacnet/basic/object
|
||||
SRC = main.c \
|
||||
$(BACNET_OBJECT_DIR)/client/device-client.c \
|
||||
$(BACNET_OBJECT_DIR)/netport.c
|
||||
BACNET_BASIC_SRC += \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_apdu.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_iam.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_noserv.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_rp.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_rp_a.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_rpm_a.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_whois.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/s_iam.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/s_rp.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/s_rpm.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/s_whois.c
|
||||
|
||||
# TARGET_EXT is defined in apps/Makefile as .exe or nothing
|
||||
TARGET_BIN = ${TARGET}$(TARGET_EXT)
|
||||
|
||||
SRCS = $(SRC) $(BACNET_SRC) $(BACNET_BASIC_SRC) $(BACNET_PORT_SRC)
|
||||
|
||||
OBJS += ${SRCS:.c=.o}
|
||||
|
||||
.PHONY: all
|
||||
all: Makefile ${TARGET_BIN}
|
||||
|
||||
${TARGET_BIN}: ${OBJS}
|
||||
${CC} ${PFLAGS} ${OBJS} ${LFLAGS} -o $@
|
||||
size $@
|
||||
cp $@ ../../bin
|
||||
|
||||
.c.o:
|
||||
${CC} -c ${CFLAGS} $*.c -o $@
|
||||
|
||||
.PHONY: depend
|
||||
depend:
|
||||
rm -f .depend
|
||||
${CC} -MM ${CFLAGS} *.c >> .depend
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f core ${TARGET_BIN} ${OBJS} $(TARGET).map
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
@@ -0,0 +1,305 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<CodeBlocks_project_file>
|
||||
<FileVersion major="1" minor="6" />
|
||||
<Project>
|
||||
<Option title="BACnet EPICS Demo" />
|
||||
<Option pch_mode="2" />
|
||||
<Option compiler="gcc" />
|
||||
<Build>
|
||||
<Target title="Debug">
|
||||
<Option output="bin/Debug/bacepics" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj/Debug/" />
|
||||
<Option type="1" />
|
||||
<Option compiler="gcc" />
|
||||
<Compiler>
|
||||
<Add option="-g" />
|
||||
</Compiler>
|
||||
</Target>
|
||||
<Target title="Release">
|
||||
<Option output="bin/Release/bacepics" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj/Release/" />
|
||||
<Option type="1" />
|
||||
<Option compiler="gcc" />
|
||||
<Compiler>
|
||||
<Add option="-O2" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add option="-s" />
|
||||
</Linker>
|
||||
</Target>
|
||||
</Build>
|
||||
<Compiler>
|
||||
<Add option="-Wmissing-declarations" />
|
||||
<Add option="-Wall" />
|
||||
<Add option="-m32" />
|
||||
<Add option="-ffunction-sections" />
|
||||
<Add option="-fdata-sections" />
|
||||
<Add option="-DBACDL_BIP" />
|
||||
<Add option="-DPRINT_ENABLED=1" />
|
||||
<Add option="-DBACAPP_ALL" />
|
||||
<Add option="-DBACFILE" />
|
||||
<Add option="-DBACNET_TIME_MASTER" />
|
||||
<Add option="-DBACNET_PROPERTY_LISTS=1" />
|
||||
<Add option="-DBACNET_PROTOCOL_REVISION=17" />
|
||||
<Add option="-D_NO_OLDNAMES" />
|
||||
<Add directory="." />
|
||||
<Add directory="../../ports/win32" />
|
||||
<Add directory="../../src" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add option="-static" />
|
||||
<Add option="-m32" />
|
||||
<Add option="-Wl,--gc-sections" />
|
||||
<Add library="ws2_32" />
|
||||
<Add library="iphlpapi" />
|
||||
<Add library="gcc" />
|
||||
<Add library="m" />
|
||||
<Add library="winmm" />
|
||||
</Linker>
|
||||
<Unit filename="../../ports/win32/bip-init.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../ports/win32/datetime-init.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../ports/win32/mstimer-init.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/abort.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/access_rule.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/alarm_ack.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/arf.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/assigned_access_rights.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/authentication_factor.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/authentication_factor_format.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/awf.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/bacaddr.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/bacapp.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/bacdcode.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/bacdevobjpropref.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/bacerror.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/bacint.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/bacprop.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/bacpropstates.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/bacreal.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/bacstr.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/bactext.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/bactimevalue.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/binding/address.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/npdu/h_npdu.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/object/client/device-client.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/object/netport.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/h_apdu.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/h_iam.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/h_noserv.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/h_rp.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/h_rp_a.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/h_rpm_a.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/h_whois.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/s_iam.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/s_rp.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/s_rpm.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/s_whois.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/sys/bigend.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/sys/debug.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/sys/fifo.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/sys/filename.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/sys/key.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/sys/keylist.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/sys/mstimer.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/sys/ringbuf.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/sys/sbuf.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/tsm/tsm.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/cov.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/credential_authentication_factor.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/datalink/bip.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/datalink/bvlc.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/datalink/dlenv.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/datetime.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/dcc.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/event.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/get_alarm_sum.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/getevent.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/iam.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/ihave.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/indtext.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/lighting.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/lso.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/memcopy.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/npdu.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/property.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/proplist.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/ptransfer.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/rd.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/readrange.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/reject.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/rp.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/rpm.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/timestamp.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/timesync.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/whohas.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/whois.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/wp.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/wpm.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="main.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Extensions>
|
||||
<code_completion />
|
||||
<envvars />
|
||||
<debugger />
|
||||
</Extensions>
|
||||
</Project>
|
||||
</CodeBlocks_project_file>
|
||||
Executable → Regular
@@ -33,29 +33,30 @@
|
||||
#include <time.h> /* for time */
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
#include "config.h"
|
||||
#include "bactext.h"
|
||||
#include "iam.h"
|
||||
#include "arf.h"
|
||||
#include "tsm.h"
|
||||
#include "address.h"
|
||||
#include "bacdef.h"
|
||||
#include "npdu.h"
|
||||
#include "apdu.h"
|
||||
#include "device.h"
|
||||
#include "net.h"
|
||||
#include "datalink.h"
|
||||
#include "whois.h"
|
||||
#include "rp.h"
|
||||
#include "proplist.h"
|
||||
#include "version.h"
|
||||
#include "bacnet/config.h"
|
||||
#include "bacnet/bactext.h"
|
||||
#include "bacnet/iam.h"
|
||||
#include "bacnet/arf.h"
|
||||
#include "bacnet/basic/tsm/tsm.h"
|
||||
#include "bacnet/bacdef.h"
|
||||
#include "bacnet/npdu.h"
|
||||
#include "bacnet/apdu.h"
|
||||
#include "bacport.h"
|
||||
#include "bacnet/whois.h"
|
||||
#include "bacnet/rp.h"
|
||||
#include "bacnet/proplist.h"
|
||||
#include "bacnet/property.h"
|
||||
#include "bacnet/version.h"
|
||||
/* some demo stuff needed */
|
||||
#include "filename.h"
|
||||
#include "handlers.h"
|
||||
#include "client.h"
|
||||
#include "txbuf.h"
|
||||
#include "dlenv.h"
|
||||
#include "keylist.h"
|
||||
#include "bacnet/basic/binding/address.h"
|
||||
#include "bacnet/basic/object/device.h"
|
||||
#include "bacnet/basic/services.h"
|
||||
#include "bacnet/basic/services.h"
|
||||
#include "bacnet/basic/sys/filename.h"
|
||||
#include "bacnet/basic/sys/keylist.h"
|
||||
#include "bacnet/basic/tsm/tsm.h"
|
||||
#include "bacnet/datalink/datalink.h"
|
||||
#include "bacnet/datalink/dlenv.h"
|
||||
#include "bacepics.h"
|
||||
|
||||
/* (Doxygen note: The next two lines pull all the following Javadoc
|
||||
@@ -71,7 +72,7 @@
|
||||
*/
|
||||
|
||||
/* buffer used for receive */
|
||||
static uint8_t Rx_Buf[MAX_MPDU] = {0};
|
||||
static uint8_t Rx_Buf[MAX_MPDU] = { 0 };
|
||||
|
||||
/* target information converted from command line */
|
||||
static uint32_t Target_Device_Object_Instance = BACNET_MAX_INSTANCE;
|
||||
@@ -132,13 +133,12 @@ struct property_value_list_t {
|
||||
BACNET_APPLICATION_DATA_VALUE *value;
|
||||
};
|
||||
static struct property_value_list_t Property_Value_List[] = {
|
||||
{PROP_VENDOR_NAME, NULL},
|
||||
{PROP_MODEL_NAME, NULL},
|
||||
{PROP_MAX_APDU_LENGTH_ACCEPTED, NULL},
|
||||
{PROP_PROTOCOL_SERVICES_SUPPORTED, NULL},
|
||||
{PROP_PROTOCOL_OBJECT_TYPES_SUPPORTED, NULL},
|
||||
{PROP_DESCRIPTION, NULL},
|
||||
{-1, NULL}};
|
||||
{ PROP_VENDOR_NAME, NULL }, { PROP_MODEL_NAME, NULL },
|
||||
{ PROP_MAX_APDU_LENGTH_ACCEPTED, NULL },
|
||||
{ PROP_PROTOCOL_SERVICES_SUPPORTED, NULL },
|
||||
{ PROP_PROTOCOL_OBJECT_TYPES_SUPPORTED, NULL }, { PROP_DESCRIPTION, NULL },
|
||||
{ -1, NULL }
|
||||
};
|
||||
|
||||
static BACNET_APPLICATION_DATA_VALUE *object_property_value(int32_t property_id)
|
||||
{
|
||||
@@ -177,7 +177,8 @@ static bool Optional_Properties = false;
|
||||
#define PRINT_ERRORS 1
|
||||
#endif
|
||||
|
||||
static void MyErrorHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
static void MyErrorHandler(BACNET_ADDRESS *src,
|
||||
uint8_t invoke_id,
|
||||
BACNET_ERROR_CLASS error_class,
|
||||
BACNET_ERROR_CODE error_code)
|
||||
{
|
||||
@@ -196,8 +197,8 @@ static void MyErrorHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
}
|
||||
}
|
||||
|
||||
void MyAbortHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
uint8_t abort_reason, bool server)
|
||||
static void MyAbortHandler(
|
||||
BACNET_ADDRESS *src, uint8_t invoke_id, uint8_t abort_reason, bool server)
|
||||
{
|
||||
(void)server;
|
||||
if (address_match(&Target_Address, src) &&
|
||||
@@ -219,8 +220,8 @@ void MyAbortHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
}
|
||||
}
|
||||
|
||||
void MyRejectHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
uint8_t reject_reason)
|
||||
static void MyRejectHandler(
|
||||
BACNET_ADDRESS *src, uint8_t invoke_id, uint8_t reject_reason)
|
||||
{
|
||||
if (address_match(&Target_Address, src) &&
|
||||
(invoke_id == Request_Invoke_ID)) {
|
||||
@@ -240,7 +241,8 @@ void MyRejectHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
}
|
||||
}
|
||||
|
||||
void MyReadPropertyAckHandler(uint8_t *service_request, uint16_t service_len,
|
||||
static void MyReadPropertyAckHandler(uint8_t *service_request,
|
||||
uint16_t service_len,
|
||||
BACNET_ADDRESS *src,
|
||||
BACNET_CONFIRMED_SERVICE_ACK_DATA *service_data)
|
||||
{
|
||||
@@ -251,8 +253,8 @@ void MyReadPropertyAckHandler(uint8_t *service_request, uint16_t service_len,
|
||||
(service_data->invoke_id == Request_Invoke_ID)) {
|
||||
rp_data = calloc(1, sizeof(BACNET_READ_ACCESS_DATA));
|
||||
if (rp_data) {
|
||||
len = rp_ack_fully_decode_service_request(service_request,
|
||||
service_len, rp_data);
|
||||
len = rp_ack_fully_decode_service_request(
|
||||
service_request, service_len, rp_data);
|
||||
}
|
||||
if (len > 0) {
|
||||
memmove(&Read_Property_Multiple_Data.service_data, service_data,
|
||||
@@ -267,8 +269,9 @@ void MyReadPropertyAckHandler(uint8_t *service_request, uint16_t service_len,
|
||||
}
|
||||
}
|
||||
|
||||
void MyReadPropertyMultipleAckHandler(
|
||||
uint8_t *service_request, uint16_t service_len, BACNET_ADDRESS *src,
|
||||
static void MyReadPropertyMultipleAckHandler(uint8_t *service_request,
|
||||
uint16_t service_len,
|
||||
BACNET_ADDRESS *src,
|
||||
BACNET_CONFIRMED_SERVICE_ACK_DATA *service_data)
|
||||
{
|
||||
int len = 0;
|
||||
@@ -278,8 +281,8 @@ void MyReadPropertyMultipleAckHandler(
|
||||
(service_data->invoke_id == Request_Invoke_ID)) {
|
||||
rpm_data = calloc(1, sizeof(BACNET_READ_ACCESS_DATA));
|
||||
if (rpm_data) {
|
||||
len = rpm_ack_decode_service_request(service_request, service_len,
|
||||
rpm_data);
|
||||
len = rpm_ack_decode_service_request(
|
||||
service_request, service_len, rpm_data);
|
||||
}
|
||||
if (len > 0) {
|
||||
memmove(&Read_Property_Multiple_Data.service_data, service_data,
|
||||
@@ -317,13 +320,13 @@ static void Init_Service_Handlers(void)
|
||||
It is required to send the proper reject message... */
|
||||
apdu_set_unrecognized_service_handler_handler(handler_unrecognized_service);
|
||||
/* we must implement read property - it's required! */
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_PROPERTY,
|
||||
handler_read_property);
|
||||
apdu_set_confirmed_handler(
|
||||
SERVICE_CONFIRMED_READ_PROPERTY, handler_read_property);
|
||||
/* handle the data coming back from confirmed requests */
|
||||
apdu_set_confirmed_ack_handler(SERVICE_CONFIRMED_READ_PROPERTY,
|
||||
MyReadPropertyAckHandler);
|
||||
apdu_set_confirmed_ack_handler(SERVICE_CONFIRMED_READ_PROP_MULTIPLE,
|
||||
MyReadPropertyMultipleAckHandler);
|
||||
apdu_set_confirmed_ack_handler(
|
||||
SERVICE_CONFIRMED_READ_PROPERTY, MyReadPropertyAckHandler);
|
||||
apdu_set_confirmed_ack_handler(
|
||||
SERVICE_CONFIRMED_READ_PROP_MULTIPLE, MyReadPropertyMultipleAckHandler);
|
||||
/* handle any errors coming back */
|
||||
apdu_set_error_handler(SERVICE_CONFIRMED_READ_PROPERTY, MyErrorHandler);
|
||||
apdu_set_abort_handler(MyAbortHandler);
|
||||
@@ -339,7 +342,7 @@ static void Init_Service_Handlers(void)
|
||||
* @param rpm_property [in] Points to structure holding the Property,
|
||||
* Value, and Error information.
|
||||
*/
|
||||
void CheckIsWritableProperty(BACNET_OBJECT_TYPE object_type,
|
||||
static void CheckIsWritableProperty(BACNET_OBJECT_TYPE object_type,
|
||||
/* uint32_t object_instance, */
|
||||
BACNET_PROPERTY_REFERENCE *rpm_property)
|
||||
{
|
||||
@@ -453,8 +456,8 @@ static const char *protocol_services_supported_text(size_t bit_index)
|
||||
* @return True if success. Or otherwise.
|
||||
*/
|
||||
|
||||
bool PrettyPrintPropertyValue(FILE *stream,
|
||||
BACNET_OBJECT_PROPERTY_VALUE *object_value)
|
||||
static bool PrettyPrintPropertyValue(
|
||||
FILE *stream, BACNET_OBJECT_PROPERTY_VALUE *object_value)
|
||||
{
|
||||
BACNET_APPLICATION_DATA_VALUE *value = NULL;
|
||||
bool status = true; /*return value */
|
||||
@@ -470,13 +473,13 @@ bool PrettyPrintPropertyValue(FILE *stream,
|
||||
len = bitstring_bits_used(&value->type.Bit_String);
|
||||
fprintf(stream, "( \n ");
|
||||
for (i = 0; i < len; i++) {
|
||||
fprintf(
|
||||
stream, "%s",
|
||||
fprintf(stream, "%s",
|
||||
bitstring_bit(&value->type.Bit_String, (uint8_t)i) ? "T" : "F");
|
||||
if (i < len - 1)
|
||||
if (i < len - 1) {
|
||||
fprintf(stream, ",");
|
||||
else
|
||||
} else {
|
||||
fprintf(stream, " ");
|
||||
}
|
||||
/* Tried with 8 per line, but with the comments, got way too long.
|
||||
*/
|
||||
if ((i == (len - 1)) || ((i % 4) == 3)) { /* line break every 4 */
|
||||
@@ -485,8 +488,8 @@ bool PrettyPrintPropertyValue(FILE *stream,
|
||||
for (j = i - (i % 4); j <= i; j++) {
|
||||
if (bitstring_bit(&value->type.Bit_String, (uint8_t)j)) {
|
||||
if (property == PROP_PROTOCOL_OBJECT_TYPES_SUPPORTED) {
|
||||
fprintf(stream, " %s,",
|
||||
bactext_object_type_name(j));
|
||||
fprintf(
|
||||
stream, " %s,", bactext_object_type_name(j));
|
||||
} else {
|
||||
/* PROP_PROTOCOL_SERVICES_SUPPORTED */
|
||||
fprintf(stream, " %s,",
|
||||
@@ -528,7 +531,7 @@ bool PrettyPrintPropertyValue(FILE *stream,
|
||||
* @param rpm_property [in] Points to structure holding the Property,
|
||||
* Value, and Error information.
|
||||
*/
|
||||
void PrintReadPropertyData(BACNET_OBJECT_TYPE object_type,
|
||||
static void PrintReadPropertyData(BACNET_OBJECT_TYPE object_type,
|
||||
uint32_t object_instance,
|
||||
BACNET_PROPERTY_REFERENCE *rpm_property)
|
||||
{
|
||||
@@ -636,16 +639,15 @@ void PrintReadPropertyData(BACNET_OBJECT_TYPE object_type,
|
||||
|
||||
if (rpm_property->propertyIdentifier == PROP_OBJECT_LIST) {
|
||||
if (value->tag != BACNET_APPLICATION_TAG_OBJECT_ID) {
|
||||
assert(
|
||||
value->tag ==
|
||||
BACNET_APPLICATION_TAG_OBJECT_ID); /* Something not
|
||||
right here */
|
||||
assert(value->tag ==
|
||||
BACNET_APPLICATION_TAG_OBJECT_ID); /* Something
|
||||
not right
|
||||
here */
|
||||
break;
|
||||
}
|
||||
/* Store the object list so we can interrogate
|
||||
each object. */
|
||||
object_list_element =
|
||||
KEY_ENCODE(value->type.Object_Id.type,
|
||||
object_list_element = KEY_ENCODE(value->type.Object_Id.type,
|
||||
value->type.Object_Id.instance);
|
||||
/* We don't have anything to put in the data pointer
|
||||
* yet, so just leave it null. The key is Key here. */
|
||||
@@ -668,10 +670,10 @@ void PrintReadPropertyData(BACNET_OBJECT_TYPE object_type,
|
||||
} else if (rpm_property->propertyIdentifier ==
|
||||
PROP_SUBORDINATE_LIST) {
|
||||
if (value->tag != BACNET_APPLICATION_TAG_OBJECT_ID) {
|
||||
assert(
|
||||
value->tag ==
|
||||
BACNET_APPLICATION_TAG_OBJECT_ID); /* Something not
|
||||
right here */
|
||||
assert(value->tag ==
|
||||
BACNET_APPLICATION_TAG_OBJECT_ID); /* Something
|
||||
not right
|
||||
here */
|
||||
break;
|
||||
}
|
||||
/* TODO: handle Sequence of { Device ObjID, Object ID }, */
|
||||
@@ -811,8 +813,8 @@ static void BuildPropRequest(BACNET_READ_ACCESS_DATA *rpm_object)
|
||||
* @return The invokeID of the message sent, or 0 if reached the end
|
||||
* of the property list.
|
||||
*/
|
||||
static uint8_t Read_Properties(uint32_t device_instance,
|
||||
BACNET_OBJECT_ID *pMyObject)
|
||||
static uint8_t Read_Properties(
|
||||
uint32_t device_instance, BACNET_OBJECT_ID *pMyObject)
|
||||
{
|
||||
uint8_t invoke_id = 0;
|
||||
struct special_property_list_t PropertyListStruct;
|
||||
@@ -875,8 +877,7 @@ static uint8_t Read_Properties(uint32_t device_instance,
|
||||
break;
|
||||
}
|
||||
}
|
||||
invoke_id =
|
||||
Send_Read_Property_Request(device_instance, pMyObject->type,
|
||||
invoke_id = Send_Read_Property_Request(device_instance, pMyObject->type,
|
||||
pMyObject->instance, prop, array_index);
|
||||
}
|
||||
|
||||
@@ -894,8 +895,8 @@ static uint8_t Read_Properties(uint32_t device_instance,
|
||||
* if the RPM got good data, or GET_PROPERTY_REQUEST if we have to
|
||||
* singly process the list of Properties.
|
||||
*/
|
||||
EPICS_STATES ProcessRPMData(BACNET_READ_ACCESS_DATA *rpm_data,
|
||||
EPICS_STATES myState)
|
||||
static EPICS_STATES ProcessRPMData(
|
||||
BACNET_READ_ACCESS_DATA *rpm_data, EPICS_STATES myState)
|
||||
{
|
||||
BACNET_READ_ACCESS_DATA *old_rpm_data;
|
||||
BACNET_PROPERTY_REFERENCE *rpm_property;
|
||||
@@ -959,10 +960,10 @@ EPICS_STATES ProcessRPMData(BACNET_READ_ACCESS_DATA *rpm_data,
|
||||
}
|
||||
|
||||
/* Now determine the next state */
|
||||
if (myState == GET_HEADING_RESPONSE)
|
||||
if (myState == GET_HEADING_RESPONSE) {
|
||||
nextState = PRINT_HEADING;
|
||||
/* press ahead with or without the data */
|
||||
else if (bSuccess && (myState == GET_ALL_RESPONSE))
|
||||
} else if (bSuccess && (myState == GET_ALL_RESPONSE))
|
||||
nextState = NEXT_OBJECT;
|
||||
else if (bSuccess) { /* and GET_LIST_OF_ALL_RESPONSE */
|
||||
/* Now append the properties we waited on. */
|
||||
@@ -987,8 +988,7 @@ EPICS_STATES ProcessRPMData(BACNET_READ_ACCESS_DATA *rpm_data,
|
||||
|
||||
static void print_usage(char *filename)
|
||||
{
|
||||
printf(
|
||||
"Usage: %s [-v] [-d] [-p sport] [-t target_mac [-n dnet]]"
|
||||
printf("Usage: %s [-v] [-d] [-p sport] [-t target_mac [-n dnet]]"
|
||||
" device-instance\n",
|
||||
filename);
|
||||
printf(" [--version][--help]\n");
|
||||
@@ -997,8 +997,7 @@ static void print_usage(char *filename)
|
||||
static void print_help(char *filename)
|
||||
{
|
||||
printf("Generates Full EPICS file, including Object and Property List\n");
|
||||
printf(
|
||||
"device-instance:\n"
|
||||
printf("device-instance:\n"
|
||||
"BACnet Device Object Instance number that you are\n"
|
||||
"trying to communicate to. This number will be used\n"
|
||||
"to try and bind with the device using Who-Is and\n"
|
||||
@@ -1018,7 +1017,7 @@ static void print_help(char *filename)
|
||||
printf("e.g., bacepics 2701876 > epics-2701876.tpi \n");
|
||||
}
|
||||
|
||||
int CheckCommandLineArgs(int argc, char *argv[])
|
||||
static int CheckCommandLineArgs(int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
bool bFoundTarget = false;
|
||||
@@ -1034,8 +1033,7 @@ int CheckCommandLineArgs(int argc, char *argv[])
|
||||
}
|
||||
if (strcmp(argv[argi], "--version") == 0) {
|
||||
printf("%s %s\n", filename, BACNET_VERSION_TEXT);
|
||||
printf(
|
||||
"Copyright (C) 2014 by Steve Karg and others.\n"
|
||||
printf("Copyright (C) 2014 by Steve Karg and others.\n"
|
||||
"This is free software; see the source for copying "
|
||||
"conditions.\n"
|
||||
"There is NO warranty; not even for MERCHANTABILITY or\n"
|
||||
@@ -1071,8 +1069,8 @@ int CheckCommandLineArgs(int argc, char *argv[])
|
||||
case 'n':
|
||||
/* Destination Network Number */
|
||||
if (Target_Address.mac_len == 0)
|
||||
fprintf(stderr,
|
||||
"Must provide a Target MAC before DNET \n");
|
||||
fprintf(
|
||||
stderr, "Must provide a Target MAC before DNET \n");
|
||||
if (++i < argc)
|
||||
Target_Address.net = (uint16_t)strtol(argv[i], NULL, 0);
|
||||
/* Used strtol so dest.net can be either 0x1234 or 4660 */
|
||||
@@ -1097,8 +1095,9 @@ int CheckCommandLineArgs(int argc, char *argv[])
|
||||
Target_Address.len = 0; /* No src address */
|
||||
Provided_Targ_MAC = true;
|
||||
break;
|
||||
} else
|
||||
} else {
|
||||
printf("ERROR: invalid Target MAC %s \n", argv[i]);
|
||||
}
|
||||
/* And fall through to print_usage */
|
||||
}
|
||||
/* Either break or fall through, as above */
|
||||
@@ -1130,7 +1129,7 @@ int CheckCommandLineArgs(int argc, char *argv[])
|
||||
return 0; /* All OK if we reach here */
|
||||
}
|
||||
|
||||
void PrintHeading()
|
||||
static void PrintHeading(void)
|
||||
{
|
||||
BACNET_APPLICATION_DATA_VALUE *value = NULL;
|
||||
BACNET_OBJECT_PROPERTY_VALUE property_value;
|
||||
@@ -1171,8 +1170,7 @@ void PrintHeading()
|
||||
printf("Product Description: \"%s\"\n\n",
|
||||
characterstring_value(&value->type.Character_String));
|
||||
} else {
|
||||
printf(
|
||||
"Product Description: "
|
||||
printf("Product Description: "
|
||||
"\"your product description here\"\n\n");
|
||||
}
|
||||
printf("BIBBs Supported:\n");
|
||||
@@ -1347,8 +1345,7 @@ void PrintHeading()
|
||||
printf(
|
||||
" real: <minimum: -3.40282347E38; maximum: 3.40282347E38; resolution: "
|
||||
"1.0>\n");
|
||||
printf(
|
||||
" double: <minimum: 2.2250738585072016E-38; maximum: "
|
||||
printf(" double: <minimum: 2.2250738585072016E-38; maximum: "
|
||||
"1.7976931348623157E38; resolution: 0.0001>\n");
|
||||
printf(" date: <minimum: 01-January-1970; maximum: 31-December-2038>\n");
|
||||
printf(" octet-string: <maximum length string: 122>\n");
|
||||
@@ -1369,7 +1366,7 @@ void PrintHeading()
|
||||
printf("}\n\n");
|
||||
}
|
||||
|
||||
void Print_Device_Heading(void)
|
||||
static void Print_Device_Heading(void)
|
||||
{
|
||||
printf("List of Objects in Test Device:\n");
|
||||
/* Print Opening brace, then kick off the Device Object */
|
||||
@@ -1378,8 +1375,8 @@ void Print_Device_Heading(void)
|
||||
}
|
||||
|
||||
/* Initialize fields for a new Object */
|
||||
void StartNextObject(BACNET_READ_ACCESS_DATA *rpm_object,
|
||||
BACNET_OBJECT_ID *pNewObject)
|
||||
static void StartNextObject(
|
||||
BACNET_READ_ACCESS_DATA *rpm_object, BACNET_OBJECT_ID *pNewObject)
|
||||
{
|
||||
BACNET_PROPERTY_REFERENCE *rpm_property;
|
||||
Error_Detected = false;
|
||||
@@ -1419,7 +1416,7 @@ int main(int argc, char *argv[])
|
||||
time_t timeout_seconds = 0;
|
||||
bool found = false;
|
||||
BACNET_OBJECT_ID myObject;
|
||||
uint8_t buffer[MAX_PDU] = {0};
|
||||
uint8_t buffer[MAX_PDU] = { 0 };
|
||||
BACNET_READ_ACCESS_DATA *rpm_object = NULL;
|
||||
KEY nextKey;
|
||||
|
||||
@@ -1453,8 +1450,8 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
#endif
|
||||
/* try to bind with the target device */
|
||||
found = address_bind_request(Target_Device_Object_Instance, &max_apdu,
|
||||
&Target_Address);
|
||||
found = address_bind_request(
|
||||
Target_Device_Object_Instance, &max_apdu, &Target_Address);
|
||||
if (!found) {
|
||||
if (Provided_Targ_MAC) {
|
||||
if (Target_Address.net > 0) {
|
||||
@@ -1468,12 +1465,12 @@ int main(int argc, char *argv[])
|
||||
/* Update by adding the MAC address */
|
||||
if (max_apdu == 0)
|
||||
max_apdu = MAX_APDU; /* Whatever set for this datalink. */
|
||||
address_add_binding(Target_Device_Object_Instance, max_apdu,
|
||||
&Target_Address);
|
||||
address_add_binding(
|
||||
Target_Device_Object_Instance, max_apdu, &Target_Address);
|
||||
}
|
||||
} else {
|
||||
Send_WhoIs(Target_Device_Object_Instance,
|
||||
Target_Device_Object_Instance);
|
||||
Send_WhoIs(
|
||||
Target_Device_Object_Instance, Target_Device_Object_Instance);
|
||||
}
|
||||
}
|
||||
myObject.type = OBJECT_DEVICE;
|
||||
@@ -1500,8 +1497,8 @@ int main(int argc, char *argv[])
|
||||
npdu_handler(&src, &Rx_Buf[0], pdu_len);
|
||||
}
|
||||
/* will wait until the device is bound, or timeout and quit */
|
||||
found = address_bind_request(Target_Device_Object_Instance,
|
||||
&max_apdu, &Target_Address);
|
||||
found = address_bind_request(
|
||||
Target_Device_Object_Instance, &max_apdu, &Target_Address);
|
||||
if (!found) {
|
||||
/* increment timer - exit if timed out */
|
||||
elapsed_seconds += (current_seconds - last_seconds);
|
||||
@@ -1604,8 +1601,7 @@ int main(int argc, char *argv[])
|
||||
/* Was it because the Device can't do RPM? */
|
||||
Has_RPM = false;
|
||||
myState = GET_PROPERTY_REQUEST;
|
||||
} else if (
|
||||
Last_Error_Code ==
|
||||
} else if (Last_Error_Code ==
|
||||
ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED) {
|
||||
myState = GET_PROPERTY_REQUEST;
|
||||
StartNextObject(rpm_object, &myObject);
|
||||
@@ -1639,8 +1635,8 @@ int main(int argc, char *argv[])
|
||||
myState = PRINT_HEADING;
|
||||
/* just press ahead without the data */
|
||||
else
|
||||
myState =
|
||||
NEXT_OBJECT; /* Give up and move on to the next. */
|
||||
myState = NEXT_OBJECT; /* Give up and move on to the
|
||||
next. */
|
||||
Error_Count++;
|
||||
}
|
||||
break;
|
||||
@@ -1752,8 +1748,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
case NEXT_OBJECT:
|
||||
if (myObject.type == OBJECT_DEVICE) {
|
||||
printf(" -- Found %d Objects \n",
|
||||
Keylist_Count(Object_List));
|
||||
printf(
|
||||
" -- Found %d Objects \n", Keylist_Count(Object_List));
|
||||
Object_List_Index = -1; /* start over (will be incr to 0) */
|
||||
if (ShowDeviceObjectOnly) {
|
||||
/* Closing brace for the Device Object */
|
||||
@@ -1821,8 +1817,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
} while (myObject.type < MAX_BACNET_OBJECT_TYPE);
|
||||
|
||||
if (Error_Count > 0)
|
||||
if (Error_Count > 0) {
|
||||
fprintf(stdout, "\r-- Found %d Errors \n", Error_Count);
|
||||
}
|
||||
|
||||
/* Closing brace for all Objects, if we got any, and closing footer */
|
||||
if (myState != INITIAL_BINDING) {
|
||||
@@ -0,0 +1,47 @@
|
||||
#Makefile to build BACnet Application
|
||||
|
||||
TARGET = bacerror
|
||||
BACNET_OBJECT_DIR = $(BACNET_SRC_DIR)/bacnet/basic/object
|
||||
SRC = main.c \
|
||||
$(BACNET_OBJECT_DIR)/client/device-client.c \
|
||||
$(BACNET_OBJECT_DIR)/netport.c
|
||||
BACNET_BASIC_SRC += \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_apdu.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_iam.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_noserv.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_rp.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_whois.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/s_iam.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/s_error.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/s_whois.c
|
||||
|
||||
# TARGET_EXT is defined in apps/Makefile as .exe or nothing
|
||||
TARGET_BIN = ${TARGET}$(TARGET_EXT)
|
||||
|
||||
SRCS = $(SRC) $(BACNET_SRC) $(BACNET_BASIC_SRC) $(BACNET_PORT_SRC)
|
||||
|
||||
OBJS += ${SRCS:.c=.o}
|
||||
|
||||
.PHONY: all
|
||||
all: Makefile ${TARGET_BIN}
|
||||
|
||||
${TARGET_BIN}: ${OBJS}
|
||||
${CC} ${PFLAGS} ${OBJS} ${LFLAGS} -o $@
|
||||
size $@
|
||||
cp $@ ../../bin
|
||||
|
||||
.c.o:
|
||||
${CC} -c ${CFLAGS} $*.c -o $@
|
||||
|
||||
.PHONY: depend
|
||||
depend:
|
||||
rm -f .depend
|
||||
${CC} -MM ${CFLAGS} *.c >> .depend
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f core ${TARGET_BIN} ${OBJS} $(TARGET).map
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
@@ -30,22 +30,22 @@
|
||||
#include <stdlib.h>
|
||||
#include <time.h> /* for time */
|
||||
#include <errno.h>
|
||||
#include "bactext.h"
|
||||
#include "iam.h"
|
||||
#include "address.h"
|
||||
#include "config.h"
|
||||
#include "bacdef.h"
|
||||
#include "npdu.h"
|
||||
#include "apdu.h"
|
||||
#include "device.h"
|
||||
#include "datalink.h"
|
||||
#include "version.h"
|
||||
#include "bacnet/bactext.h"
|
||||
#include "bacnet/iam.h"
|
||||
#include "bacnet/config.h"
|
||||
#include "bacnet/bacdef.h"
|
||||
#include "bacnet/npdu.h"
|
||||
#include "bacnet/apdu.h"
|
||||
#include "bacnet/version.h"
|
||||
/* some demo stuff needed */
|
||||
#include "filename.h"
|
||||
#include "handlers.h"
|
||||
#include "client.h"
|
||||
#include "txbuf.h"
|
||||
#include "dlenv.h"
|
||||
#include "bacnet/basic/binding/address.h"
|
||||
#include "bacnet/basic/object/device.h"
|
||||
#include "bacnet/basic/services.h"
|
||||
#include "bacnet/basic/services.h"
|
||||
#include "bacnet/basic/sys/filename.h"
|
||||
#include "bacnet/basic/tsm/tsm.h"
|
||||
#include "bacnet/datalink/datalink.h"
|
||||
#include "bacnet/datalink/dlenv.h"
|
||||
|
||||
/* parsed command line parameters */
|
||||
static uint16_t Target_Error_Class;
|
||||
@@ -55,8 +55,8 @@ static uint16_t Target_Service = SERVICE_CONFIRMED_READ_PROPERTY;
|
||||
/* flag for signalling errors */
|
||||
static bool Error_Detected = false;
|
||||
|
||||
void MyAbortHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
uint8_t abort_reason, bool server)
|
||||
static void MyAbortHandler(
|
||||
BACNET_ADDRESS *src, uint8_t invoke_id, uint8_t abort_reason, bool server)
|
||||
{
|
||||
(void)src;
|
||||
(void)invoke_id;
|
||||
@@ -65,8 +65,8 @@ void MyAbortHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
Error_Detected = true;
|
||||
}
|
||||
|
||||
void MyRejectHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
uint8_t reject_reason)
|
||||
static void MyRejectHandler(
|
||||
BACNET_ADDRESS *src, uint8_t invoke_id, uint8_t reject_reason)
|
||||
{
|
||||
(void)src;
|
||||
(void)invoke_id;
|
||||
@@ -84,8 +84,8 @@ static void Init_Service_Handlers(void)
|
||||
It is required to send the proper reject message... */
|
||||
apdu_set_unrecognized_service_handler_handler(handler_unrecognized_service);
|
||||
/* we must implement read property - it's required! */
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_PROPERTY,
|
||||
handler_read_property);
|
||||
apdu_set_confirmed_handler(
|
||||
SERVICE_CONFIRMED_READ_PROPERTY, handler_read_property);
|
||||
/* handle the reply (request) coming back */
|
||||
apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_I_AM, handler_i_am_add);
|
||||
/* handle any errors coming back */
|
||||
@@ -123,8 +123,7 @@ static void print_help(char *filename)
|
||||
"or an IP string with optional port number like 10.1.2.3:47808\n"
|
||||
"or an Ethernet MAC in hex like 00:21:70:7e:32:bb\n"
|
||||
"\n");
|
||||
printf(
|
||||
"error-class:\n"
|
||||
printf("error-class:\n"
|
||||
" number from 0 to 65535\n"
|
||||
"error-code:\n"
|
||||
" number from 0 to 65535\n"
|
||||
@@ -140,9 +139,9 @@ static void print_help(char *filename)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
long dnet = -1;
|
||||
BACNET_MAC_ADDRESS mac = {0};
|
||||
BACNET_MAC_ADDRESS adr = {0};
|
||||
BACNET_ADDRESS dest = {0};
|
||||
BACNET_MAC_ADDRESS mac = { 0 };
|
||||
BACNET_MAC_ADDRESS adr = { 0 };
|
||||
BACNET_ADDRESS dest = { 0 };
|
||||
bool specific_address = false;
|
||||
int argi = 0;
|
||||
unsigned int target_args = 0;
|
||||
@@ -157,8 +156,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
if (strcmp(argv[argi], "--version") == 0) {
|
||||
printf("%s %s\n", filename, BACNET_VERSION_TEXT);
|
||||
printf(
|
||||
"Copyright (C) 2016 by Steve Karg and others.\n"
|
||||
printf("Copyright (C) 2016 by Steve Karg and others.\n"
|
||||
"This is free software; see the source for copying "
|
||||
"conditions.\n"
|
||||
"There is NO warranty; not even for MERCHANTABILITY or\n"
|
||||
@@ -242,8 +240,7 @@ int main(int argc, char *argv[])
|
||||
atexit(datalink_cleanup);
|
||||
/* send the request */
|
||||
Send_Error_To_Network(&Handler_Transmit_Buffer[0], &dest, Target_Invoke_ID,
|
||||
Target_Service, Target_Error_Class,
|
||||
Target_Error_Code);
|
||||
Target_Service, Target_Error_Class, Target_Error_Code);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -33,31 +33,31 @@
|
||||
#include <stdlib.h>
|
||||
#include <signal.h>
|
||||
#include <time.h>
|
||||
#include "config.h"
|
||||
#include "bacnet/config.h"
|
||||
#include "gateway.h"
|
||||
#include "address.h"
|
||||
#include "bacdef.h"
|
||||
#include "handlers.h"
|
||||
#include "client.h"
|
||||
#include "dlenv.h"
|
||||
#include "bacdcode.h"
|
||||
#include "npdu.h"
|
||||
#include "apdu.h"
|
||||
#include "iam.h"
|
||||
#include "tsm.h"
|
||||
#include "device.h"
|
||||
#include "bacfile.h"
|
||||
#include "datalink.h"
|
||||
#include "dcc.h"
|
||||
#include "net.h"
|
||||
#include "txbuf.h"
|
||||
#include "lc.h"
|
||||
#include "debug.h"
|
||||
#include "version.h"
|
||||
#include "bacnet/basic/binding/address.h"
|
||||
#include "bacnet/bacdef.h"
|
||||
#include "bacnet/basic/services.h"
|
||||
#include "bacnet/basic/services.h"
|
||||
#include "bacnet/datalink/dlenv.h"
|
||||
#include "bacnet/bacdcode.h"
|
||||
#include "bacnet/npdu.h"
|
||||
#include "bacnet/apdu.h"
|
||||
#include "bacnet/iam.h"
|
||||
#include "bacnet/basic/tsm/tsm.h"
|
||||
#include "bacnet/basic/object/device.h"
|
||||
#include "bacnet/basic/object/bacfile.h"
|
||||
#include "bacnet/datalink/datalink.h"
|
||||
#include "bacnet/dcc.h"
|
||||
#include "bacport.h"
|
||||
#include "bacnet/basic/tsm/tsm.h"
|
||||
#include "bacnet/basic/object/lc.h"
|
||||
#include "bacnet/basic/sys/debug.h"
|
||||
#include "bacnet/version.h"
|
||||
/* include the device object */
|
||||
#include "device.h"
|
||||
#include "bacnet/basic/object/device.h"
|
||||
#ifdef BACNET_TEST_VMAC
|
||||
#include "vmac.h"
|
||||
#include "bacnet/basic/bbmd6/vmac.h"
|
||||
#endif
|
||||
|
||||
/** @file gateway/main.c Example virtual gateway application using the BACnet
|
||||
@@ -71,7 +71,7 @@
|
||||
/*@{*/
|
||||
|
||||
/** Buffer used for receiving */
|
||||
static uint8_t Rx_Buf[MAX_MPDU] = {0};
|
||||
static uint8_t Rx_Buf[MAX_MPDU] = { 0 };
|
||||
|
||||
/** The list of DNETs that our router can reach.
|
||||
* Only one entry since we don't support downstream routers.
|
||||
@@ -80,6 +80,9 @@ int DNET_list[2] = {
|
||||
VIRTUAL_DNET, -1 /* Need -1 terminator */
|
||||
};
|
||||
|
||||
/* current version of the BACnet stack */
|
||||
static const char *BACnet_Version = BACNET_VERSION_TEXT;
|
||||
|
||||
/** Initialize the Device Objects and each of the child Object instances.
|
||||
* @param first_object_instance Set the first (gateway) Device to this
|
||||
instance number, and subsequent devices to incremented values.
|
||||
@@ -124,38 +127,38 @@ static void Init_Service_Handlers(uint32_t first_object_instance)
|
||||
* Don't need the routed versions, since the npdu handler calls
|
||||
* each device in turn.
|
||||
*/
|
||||
apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_WHO_IS,
|
||||
handler_who_is_unicast);
|
||||
apdu_set_unconfirmed_handler(
|
||||
SERVICE_UNCONFIRMED_WHO_IS, handler_who_is_unicast);
|
||||
apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_WHO_HAS, handler_who_has);
|
||||
/* set the handler for all the services we don't implement */
|
||||
/* It is required to send the proper reject message... */
|
||||
apdu_set_unrecognized_service_handler_handler(handler_unrecognized_service);
|
||||
/* Set the handlers for any confirmed services that we support. */
|
||||
/* We must implement read property - it's required! */
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_PROPERTY,
|
||||
handler_read_property);
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_PROP_MULTIPLE,
|
||||
handler_read_property_multiple);
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_WRITE_PROPERTY,
|
||||
handler_write_property);
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_RANGE,
|
||||
handler_read_range);
|
||||
apdu_set_confirmed_handler(
|
||||
SERVICE_CONFIRMED_READ_PROPERTY, handler_read_property);
|
||||
apdu_set_confirmed_handler(
|
||||
SERVICE_CONFIRMED_READ_PROP_MULTIPLE, handler_read_property_multiple);
|
||||
apdu_set_confirmed_handler(
|
||||
SERVICE_CONFIRMED_WRITE_PROPERTY, handler_write_property);
|
||||
apdu_set_confirmed_handler(
|
||||
SERVICE_CONFIRMED_READ_RANGE, handler_read_range);
|
||||
#if defined(BACFILE)
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_ATOMIC_READ_FILE,
|
||||
handler_atomic_read_file);
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_ATOMIC_WRITE_FILE,
|
||||
handler_atomic_write_file);
|
||||
apdu_set_confirmed_handler(
|
||||
SERVICE_CONFIRMED_ATOMIC_READ_FILE, handler_atomic_read_file);
|
||||
apdu_set_confirmed_handler(
|
||||
SERVICE_CONFIRMED_ATOMIC_WRITE_FILE, handler_atomic_write_file);
|
||||
#endif
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_REINITIALIZE_DEVICE,
|
||||
handler_reinitialize_device);
|
||||
apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_UTC_TIME_SYNCHRONIZATION,
|
||||
handler_timesync_utc);
|
||||
apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_TIME_SYNCHRONIZATION,
|
||||
handler_timesync);
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_SUBSCRIBE_COV,
|
||||
handler_cov_subscribe);
|
||||
apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_COV_NOTIFICATION,
|
||||
handler_ucov_notification);
|
||||
apdu_set_confirmed_handler(
|
||||
SERVICE_CONFIRMED_REINITIALIZE_DEVICE, handler_reinitialize_device);
|
||||
apdu_set_unconfirmed_handler(
|
||||
SERVICE_UNCONFIRMED_UTC_TIME_SYNCHRONIZATION, handler_timesync_utc);
|
||||
apdu_set_unconfirmed_handler(
|
||||
SERVICE_UNCONFIRMED_TIME_SYNCHRONIZATION, handler_timesync);
|
||||
apdu_set_confirmed_handler(
|
||||
SERVICE_CONFIRMED_SUBSCRIBE_COV, handler_cov_subscribe);
|
||||
apdu_set_unconfirmed_handler(
|
||||
SERVICE_UNCONFIRMED_COV_NOTIFICATION, handler_ucov_notification);
|
||||
/* handle communication so we can shutup when asked */
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_DEVICE_COMMUNICATION_CONTROL,
|
||||
handler_device_communication_control);
|
||||
@@ -248,7 +251,7 @@ static void Initialize_Device_Addresses()
|
||||
*/
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
BACNET_ADDRESS src = {0}; /* address where message came from */
|
||||
BACNET_ADDRESS src = { 0 }; /* address where message came from */
|
||||
uint16_t pdu_len = 0;
|
||||
unsigned timeout = 1000; /* milliseconds */
|
||||
time_t last_seconds = 0;
|
||||
@@ -268,13 +271,12 @@ int main(int argc, char *argv[])
|
||||
if ((first_object_instance == 0) ||
|
||||
(first_object_instance >= BACNET_MAX_INSTANCE)) {
|
||||
printf("Error: Invalid Object Instance %s \n", argv[1]);
|
||||
printf("Provide a number from 1 to %ul \n",
|
||||
BACNET_MAX_INSTANCE - 1);
|
||||
printf(
|
||||
"Provide a number from 1 to %ul \n", BACNET_MAX_INSTANCE - 1);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
printf(
|
||||
"BACnet Router Demo\n"
|
||||
printf("BACnet Router Demo\n"
|
||||
"BACnet Stack Version %s\n"
|
||||
"BACnet Device ID: %u\n"
|
||||
"Max APDU: %d\n",
|
||||
@@ -0,0 +1,50 @@
|
||||
#Makefile to build BACnet Application using GCC compiler
|
||||
|
||||
# Executable file name
|
||||
TARGET = bacge
|
||||
BACNET_OBJECT_DIR = $(BACNET_SRC_DIR)/bacnet/basic/object
|
||||
SRC = main.c \
|
||||
$(BACNET_OBJECT_DIR)/client/device-client.c \
|
||||
$(BACNET_OBJECT_DIR)/netport.c
|
||||
BACNET_BASIC_SRC += \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_apdu.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_getevent.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_iam.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_noserv.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_rp.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_rr_a.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_whois.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/s_iam.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/s_getevent.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/s_whois.c
|
||||
|
||||
# TARGET_EXT is defined in apps/Makefile as .exe or nothing
|
||||
TARGET_BIN = ${TARGET}$(TARGET_EXT)
|
||||
|
||||
SRCS = $(SRC) $(BACNET_SRC) $(BACNET_BASIC_SRC) $(BACNET_PORT_SRC)
|
||||
|
||||
OBJS += ${SRCS:.c=.o}
|
||||
|
||||
.PHONY: all
|
||||
all: Makefile ${TARGET_BIN}
|
||||
|
||||
${TARGET_BIN}: ${OBJS}
|
||||
${CC} ${PFLAGS} ${OBJS} ${LFLAGS} -o $@
|
||||
size $@
|
||||
cp $@ ../../bin
|
||||
|
||||
.c.o:
|
||||
${CC} -c ${CFLAGS} $*.c -o $@
|
||||
|
||||
.PHONY: depend
|
||||
depend:
|
||||
rm -f .depend
|
||||
${CC} -MM ${CFLAGS} *.c >> .depend
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f core ${TARGET_BIN} ${OBJS} $(TARGET).map
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
Executable → Regular
+44
-45
@@ -29,30 +29,27 @@
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
|
||||
/* core stuff needed */
|
||||
#include "bacdef.h"
|
||||
#include "config.h"
|
||||
#include "bactext.h"
|
||||
#include "bacerror.h"
|
||||
#include "iam.h"
|
||||
#include "arf.h"
|
||||
#include "tsm.h"
|
||||
#include "address.h"
|
||||
#include "npdu.h"
|
||||
#include "apdu.h"
|
||||
#include "device.h"
|
||||
#include "net.h"
|
||||
#include "datalink.h"
|
||||
#include "whois.h"
|
||||
#include "getevent.h"
|
||||
|
||||
#include "bacnet/bacdef.h"
|
||||
#include "bacnet/config.h"
|
||||
#include "bacnet/bactext.h"
|
||||
#include "bacnet/bacerror.h"
|
||||
#include "bacnet/iam.h"
|
||||
#include "bacnet/arf.h"
|
||||
#include "bacnet/npdu.h"
|
||||
#include "bacnet/apdu.h"
|
||||
#include "bacnet/whois.h"
|
||||
#include "bacnet/getevent.h"
|
||||
/* some demo stuff needed */
|
||||
#include "filename.h"
|
||||
#include "handlers.h"
|
||||
#include "client.h"
|
||||
#include "txbuf.h"
|
||||
#include "dlenv.h"
|
||||
#include "bacnet/basic/binding/address.h"
|
||||
#include "bacnet/basic/object/device.h"
|
||||
#include "bacnet/basic/services.h"
|
||||
#include "bacnet/basic/sys/filename.h"
|
||||
#include "bacnet/basic/tsm/tsm.h"
|
||||
#include "bacnet/datalink/datalink.h"
|
||||
#include "bacnet/datalink/dlenv.h"
|
||||
/* some port stuff needed */
|
||||
#include "bacport.h"
|
||||
|
||||
/* Depending on on the max-APDU-length-accepted (varies per device),
|
||||
the amount of event entries in the GetEventInformation ACK can sum
|
||||
@@ -61,7 +58,7 @@
|
||||
#define MAX_OBJ_IDS_IN_GE_ACK 24
|
||||
|
||||
/* buffer used for receive */
|
||||
static uint8_t Rx_Buf[MAX_MPDU] = {0};
|
||||
static uint8_t Rx_Buf[MAX_MPDU] = { 0 };
|
||||
|
||||
/* converted command line arguments */
|
||||
static uint32_t Target_Device_Object_Instance = BACNET_MAX_INSTANCE;
|
||||
@@ -73,7 +70,8 @@ static bool Recieved_Ack = false;
|
||||
static bool More_Events = false;
|
||||
static BACNET_OBJECT_ID LastReceivedObjectIdentifier;
|
||||
|
||||
static void MyErrorHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
static void MyErrorHandler(BACNET_ADDRESS *src,
|
||||
uint8_t invoke_id,
|
||||
BACNET_ERROR_CLASS error_class,
|
||||
BACNET_ERROR_CODE error_code)
|
||||
{
|
||||
@@ -86,8 +84,8 @@ static void MyErrorHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
}
|
||||
}
|
||||
|
||||
void MyAbortHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
uint8_t abort_reason, bool server)
|
||||
static void MyAbortHandler(
|
||||
BACNET_ADDRESS *src, uint8_t invoke_id, uint8_t abort_reason, bool server)
|
||||
{
|
||||
(void)server;
|
||||
if (address_match(&Target_Address, src) &&
|
||||
@@ -98,8 +96,8 @@ void MyAbortHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
}
|
||||
}
|
||||
|
||||
void MyRejectHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
uint8_t reject_reason)
|
||||
static void MyRejectHandler(
|
||||
BACNET_ADDRESS *src, uint8_t invoke_id, uint8_t reject_reason)
|
||||
{
|
||||
if (address_match(&Target_Address, src) &&
|
||||
(invoke_id == Request_Invoke_ID)) {
|
||||
@@ -119,7 +117,8 @@ void MyRejectHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
* @param service_data [in] The BACNET_CONFIRMED_SERVICE_DATA information
|
||||
* decoded from the APDU header of this message.
|
||||
*/
|
||||
void My_Get_Event_Ack_Handler(uint8_t *service_request, uint16_t service_len,
|
||||
static void My_Get_Event_Ack_Handler(uint8_t *service_request,
|
||||
uint16_t service_len,
|
||||
BACNET_ADDRESS *src,
|
||||
BACNET_CONFIRMED_SERVICE_ACK_DATA *service_data)
|
||||
{
|
||||
@@ -133,8 +132,8 @@ void My_Get_Event_Ack_Handler(uint8_t *service_request, uint16_t service_len,
|
||||
Request_Invoke_ID, service_data->invoke_id);
|
||||
|
||||
if (service_data->invoke_id == Request_Invoke_ID) {
|
||||
len = getevent_ack_decode_service_request(service_request, service_len,
|
||||
&data[0], &More_Events);
|
||||
len = getevent_ack_decode_service_request(
|
||||
service_request, service_len, &data[0], &More_Events);
|
||||
printf("Decode of Ack returned length %i. MoreEvents flag was %i \n",
|
||||
len, More_Events);
|
||||
if (len > 0) {
|
||||
@@ -162,11 +161,11 @@ static void Init_Service_Handlers(void)
|
||||
It is required to send the proper reject message... */
|
||||
apdu_set_unrecognized_service_handler_handler(handler_unrecognized_service);
|
||||
/* we must implement getevent - it's required! */
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_GET_EVENT_INFORMATION,
|
||||
handler_get_event_information);
|
||||
apdu_set_confirmed_handler(
|
||||
SERVICE_CONFIRMED_GET_EVENT_INFORMATION, handler_get_event_information);
|
||||
/* handle the data coming back from confirmed requests */
|
||||
apdu_set_confirmed_ack_handler(SERVICE_CONFIRMED_GET_EVENT_INFORMATION,
|
||||
My_Get_Event_Ack_Handler);
|
||||
apdu_set_confirmed_ack_handler(
|
||||
SERVICE_CONFIRMED_GET_EVENT_INFORMATION, My_Get_Event_Ack_Handler);
|
||||
/* handle any errors coming back */
|
||||
apdu_set_error_handler(SERVICE_CONFIRMED_READ_PROPERTY, MyErrorHandler);
|
||||
apdu_set_abort_handler(MyAbortHandler);
|
||||
@@ -175,8 +174,7 @@ static void Init_Service_Handlers(void)
|
||||
|
||||
static int print_help(char *exe_name)
|
||||
{
|
||||
printf(
|
||||
"Usage:\n"
|
||||
printf("Usage:\n"
|
||||
"\n"
|
||||
"%s device-instance [--help]\n"
|
||||
"\n"
|
||||
@@ -189,7 +187,7 @@ static int print_help(char *exe_name)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
BACNET_ADDRESS src = {0}; /* address where message came from */
|
||||
BACNET_ADDRESS src = { 0 }; /* address where message came from */
|
||||
uint16_t pdu_len = 0;
|
||||
unsigned timeout = 100; /* milliseconds */
|
||||
unsigned max_apdu = 0;
|
||||
@@ -220,11 +218,11 @@ int main(int argc, char *argv[])
|
||||
last_seconds = time(NULL);
|
||||
timeout_seconds = (apdu_timeout() / 1000) * apdu_retries();
|
||||
/* try to bind with the device */
|
||||
found = address_bind_request(Target_Device_Object_Instance, &max_apdu,
|
||||
&Target_Address);
|
||||
found = address_bind_request(
|
||||
Target_Device_Object_Instance, &max_apdu, &Target_Address);
|
||||
if (!found) {
|
||||
Send_WhoIs(Target_Device_Object_Instance,
|
||||
Target_Device_Object_Instance);
|
||||
Send_WhoIs(
|
||||
Target_Device_Object_Instance, Target_Device_Object_Instance);
|
||||
}
|
||||
/* loop forever */
|
||||
for (;;) {
|
||||
@@ -232,17 +230,18 @@ int main(int argc, char *argv[])
|
||||
current_seconds = time(NULL);
|
||||
|
||||
/* at least one second has passed */
|
||||
if (current_seconds != last_seconds)
|
||||
if (current_seconds != last_seconds) {
|
||||
tsm_timer_milliseconds(
|
||||
(uint16_t)((current_seconds - last_seconds) * 1000));
|
||||
}
|
||||
|
||||
if (Error_Detected) {
|
||||
break;
|
||||
}
|
||||
/* wait until the device is bound, or timeout and quit */
|
||||
if (!found) {
|
||||
found = address_bind_request(Target_Device_Object_Instance,
|
||||
&max_apdu, &Target_Address);
|
||||
found = address_bind_request(
|
||||
Target_Device_Object_Instance, &max_apdu, &Target_Address);
|
||||
}
|
||||
if (found) {
|
||||
if (Request_Invoke_ID == 0) {
|
||||
@@ -0,0 +1,47 @@
|
||||
#Makefile to build BACnet Application for the Linux Port
|
||||
|
||||
TARGET = baciam
|
||||
# BACnet objects that are used with this app
|
||||
BACNET_OBJECT_DIR = $(BACNET_SRC_DIR)/bacnet/basic/object
|
||||
SRC = main.c \
|
||||
$(BACNET_OBJECT_DIR)/client/device-client.c \
|
||||
$(BACNET_OBJECT_DIR)/netport.c
|
||||
BACNET_BASIC_SRC += \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_apdu.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_iam.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_noserv.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_rp.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_whois.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/s_iam.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/s_whois.c
|
||||
|
||||
# TARGET_EXT is defined in apps/Makefile as .exe or nothing
|
||||
TARGET_BIN = ${TARGET}$(TARGET_EXT)
|
||||
|
||||
SRCS = $(SRC) $(BACNET_SRC) $(BACNET_BASIC_SRC) $(BACNET_PORT_SRC)
|
||||
|
||||
OBJS += ${SRCS:.c=.o}
|
||||
|
||||
.PHONY: all
|
||||
all: Makefile ${TARGET_BIN}
|
||||
|
||||
${TARGET_BIN}: ${OBJS}
|
||||
${CC} ${PFLAGS} ${OBJS} ${LFLAGS} -o $@
|
||||
size $@
|
||||
cp $@ ../../bin
|
||||
|
||||
.c.o:
|
||||
${CC} -c ${CFLAGS} $*.c -o $@
|
||||
|
||||
.PHONY: depend
|
||||
depend:
|
||||
rm -f .depend
|
||||
${CC} -MM ${CFLAGS} *.c >> .depend
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f core ${TARGET_BIN} ${OBJS} $(TARGET).map
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
@@ -30,22 +30,22 @@
|
||||
#include <stdlib.h>
|
||||
#include <time.h> /* for time */
|
||||
#include <errno.h>
|
||||
#include "bactext.h"
|
||||
#include "iam.h"
|
||||
#include "address.h"
|
||||
#include "config.h"
|
||||
#include "bacdef.h"
|
||||
#include "npdu.h"
|
||||
#include "apdu.h"
|
||||
#include "device.h"
|
||||
#include "datalink.h"
|
||||
#include "version.h"
|
||||
#include "bacnet/bactext.h"
|
||||
#include "bacnet/iam.h"
|
||||
#include "bacnet/basic/binding/address.h"
|
||||
#include "bacnet/config.h"
|
||||
#include "bacnet/bacdef.h"
|
||||
#include "bacnet/npdu.h"
|
||||
#include "bacnet/apdu.h"
|
||||
#include "bacnet/basic/object/device.h"
|
||||
#include "bacnet/datalink/datalink.h"
|
||||
#include "bacnet/version.h"
|
||||
/* some demo stuff needed */
|
||||
#include "filename.h"
|
||||
#include "handlers.h"
|
||||
#include "client.h"
|
||||
#include "txbuf.h"
|
||||
#include "dlenv.h"
|
||||
#include "bacnet/basic/sys/filename.h"
|
||||
#include "bacnet/basic/services.h"
|
||||
#include "bacnet/basic/services.h"
|
||||
#include "bacnet/basic/tsm/tsm.h"
|
||||
#include "bacnet/datalink/dlenv.h"
|
||||
|
||||
/* parsed command line parameters */
|
||||
static uint32_t Target_Device_ID = BACNET_MAX_INSTANCE;
|
||||
@@ -55,8 +55,8 @@ static int Target_Segmentation = SEGMENTATION_NONE;
|
||||
/* flag for signalling errors */
|
||||
static bool Error_Detected = false;
|
||||
|
||||
void MyAbortHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
uint8_t abort_reason, bool server)
|
||||
static void MyAbortHandler(
|
||||
BACNET_ADDRESS *src, uint8_t invoke_id, uint8_t abort_reason, bool server)
|
||||
{
|
||||
(void)src;
|
||||
(void)invoke_id;
|
||||
@@ -65,8 +65,8 @@ void MyAbortHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
Error_Detected = true;
|
||||
}
|
||||
|
||||
void MyRejectHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
uint8_t reject_reason)
|
||||
static void MyRejectHandler(
|
||||
BACNET_ADDRESS *src, uint8_t invoke_id, uint8_t reject_reason)
|
||||
{
|
||||
(void)src;
|
||||
(void)invoke_id;
|
||||
@@ -84,8 +84,8 @@ static void Init_Service_Handlers(void)
|
||||
It is required to send the proper reject message... */
|
||||
apdu_set_unrecognized_service_handler_handler(handler_unrecognized_service);
|
||||
/* we must implement read property - it's required! */
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_PROPERTY,
|
||||
handler_read_property);
|
||||
apdu_set_confirmed_handler(
|
||||
SERVICE_CONFIRMED_READ_PROPERTY, handler_read_property);
|
||||
/* handle the reply (request) coming back */
|
||||
apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_I_AM, handler_i_am_add);
|
||||
/* handle any errors coming back */
|
||||
@@ -104,8 +104,7 @@ static void print_usage(char *filename)
|
||||
static void print_help(char *filename)
|
||||
{
|
||||
printf("Send BACnet I-Am message for a device.\n");
|
||||
printf(
|
||||
"--mac A\n"
|
||||
printf("--mac A\n"
|
||||
"Optional BACnet mac address."
|
||||
"Valid ranges are from 00 to FF (hex) for MS/TP or ARCNET,\n"
|
||||
"or an IP string with optional port number like 10.1.2.3:47808\n"
|
||||
@@ -140,9 +139,9 @@ static void print_help(char *filename)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
long dnet = -1;
|
||||
BACNET_MAC_ADDRESS mac = {0};
|
||||
BACNET_MAC_ADDRESS adr = {0};
|
||||
BACNET_ADDRESS dest = {0};
|
||||
BACNET_MAC_ADDRESS mac = { 0 };
|
||||
BACNET_MAC_ADDRESS adr = { 0 };
|
||||
BACNET_ADDRESS dest = { 0 };
|
||||
bool specific_address = false;
|
||||
int argi = 0;
|
||||
unsigned int target_args = 0;
|
||||
@@ -157,8 +156,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
if (strcmp(argv[argi], "--version") == 0) {
|
||||
printf("%s %s\n", filename, BACNET_VERSION_TEXT);
|
||||
printf(
|
||||
"Copyright (C) 2016 by Steve Karg and others.\n"
|
||||
printf("Copyright (C) 2016 by Steve Karg and others.\n"
|
||||
"This is free software; see the source for copying "
|
||||
"conditions.\n"
|
||||
"There is NO warranty; not even for MERCHANTABILITY or\n"
|
||||
@@ -0,0 +1,47 @@
|
||||
#Makefile to build BACnet Application for the Linux Port
|
||||
|
||||
TARGET = baciamr
|
||||
# BACnet objects that are used with this app
|
||||
BACNET_OBJECT_DIR = $(BACNET_SRC_DIR)/bacnet/basic/object
|
||||
SRC = main.c \
|
||||
$(BACNET_OBJECT_DIR)/client/device-client.c \
|
||||
$(BACNET_OBJECT_DIR)/netport.c
|
||||
BACNET_BASIC_SRC += \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_apdu.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_iam.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_noserv.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_rp.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_whois.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/s_iam.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/s_whois.c
|
||||
|
||||
# TARGET_EXT is defined in apps/Makefile as .exe or nothing
|
||||
TARGET_BIN = ${TARGET}$(TARGET_EXT)
|
||||
|
||||
SRCS = $(SRC) $(BACNET_SRC) $(BACNET_BASIC_SRC) $(BACNET_PORT_SRC)
|
||||
|
||||
OBJS += ${SRCS:.c=.o}
|
||||
|
||||
.PHONY: all
|
||||
all: Makefile ${TARGET_BIN}
|
||||
|
||||
${TARGET_BIN}: ${OBJS}
|
||||
${CC} ${PFLAGS} ${OBJS} ${LFLAGS} -o $@
|
||||
size $@
|
||||
cp $@ ../../bin
|
||||
|
||||
.c.o:
|
||||
${CC} -c ${CFLAGS} $*.c -o $@
|
||||
|
||||
.PHONY: depend
|
||||
depend:
|
||||
rm -f .depend
|
||||
${CC} -MM ${CFLAGS} *.c >> .depend
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f core ${TARGET_BIN} ${OBJS} $(TARGET).map
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
@@ -30,31 +30,31 @@
|
||||
#include <stdlib.h>
|
||||
#include <time.h> /* for time */
|
||||
#include <errno.h>
|
||||
#include "bactext.h"
|
||||
#include "iam.h"
|
||||
#include "address.h"
|
||||
#include "config.h"
|
||||
#include "bacdef.h"
|
||||
#include "npdu.h"
|
||||
#include "apdu.h"
|
||||
#include "device.h"
|
||||
#include "datalink.h"
|
||||
#include "version.h"
|
||||
#include "bacnet/bactext.h"
|
||||
#include "bacnet/iam.h"
|
||||
#include "bacnet/basic/binding/address.h"
|
||||
#include "bacnet/config.h"
|
||||
#include "bacnet/bacdef.h"
|
||||
#include "bacnet/npdu.h"
|
||||
#include "bacnet/apdu.h"
|
||||
#include "bacnet/basic/object/device.h"
|
||||
#include "bacnet/datalink/datalink.h"
|
||||
#include "bacnet/version.h"
|
||||
/* some demo stuff needed */
|
||||
#include "filename.h"
|
||||
#include "handlers.h"
|
||||
#include "client.h"
|
||||
#include "txbuf.h"
|
||||
#include "dlenv.h"
|
||||
#include "bacnet/basic/sys/filename.h"
|
||||
#include "bacnet/basic/services.h"
|
||||
#include "bacnet/basic/services.h"
|
||||
#include "bacnet/basic/tsm/tsm.h"
|
||||
#include "bacnet/datalink/dlenv.h"
|
||||
|
||||
/* global variables used in this file */
|
||||
#define MAX_ROUTER_DNETS 64
|
||||
static int Target_Router_Networks[MAX_ROUTER_DNETS] = {-1};
|
||||
static int Target_Router_Networks[MAX_ROUTER_DNETS] = { -1 };
|
||||
|
||||
static bool Error_Detected = false;
|
||||
|
||||
void MyAbortHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
uint8_t abort_reason, bool server)
|
||||
static void MyAbortHandler(
|
||||
BACNET_ADDRESS *src, uint8_t invoke_id, uint8_t abort_reason, bool server)
|
||||
{
|
||||
/* FIXME: verify src and invoke id */
|
||||
(void)src;
|
||||
@@ -64,8 +64,8 @@ void MyAbortHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
Error_Detected = true;
|
||||
}
|
||||
|
||||
void MyRejectHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
uint8_t reject_reason)
|
||||
static void MyRejectHandler(
|
||||
BACNET_ADDRESS *src, uint8_t invoke_id, uint8_t reject_reason)
|
||||
{
|
||||
/* FIXME: verify src and invoke id */
|
||||
(void)src;
|
||||
@@ -84,8 +84,8 @@ static void Init_Service_Handlers(void)
|
||||
It is required to send the proper reject message... */
|
||||
apdu_set_unrecognized_service_handler_handler(handler_unrecognized_service);
|
||||
/* we must implement read property - it's required! */
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_PROPERTY,
|
||||
handler_read_property);
|
||||
apdu_set_confirmed_handler(
|
||||
SERVICE_CONFIRMED_READ_PROPERTY, handler_read_property);
|
||||
/* handle the reply (request) coming back */
|
||||
apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_I_AM, handler_i_am_add);
|
||||
/* handle any errors coming back */
|
||||
@@ -101,8 +101,7 @@ static void print_usage(char *filename)
|
||||
|
||||
static void print_help(char *filename)
|
||||
{
|
||||
printf(
|
||||
"Send BACnet I-Am-Router-To-Network message for \n"
|
||||
printf("Send BACnet I-Am-Router-To-Network message for \n"
|
||||
"one or more networks.\n"
|
||||
"\nDNET:\n"
|
||||
"BACnet destination network number 0-65534\n"
|
||||
@@ -129,8 +128,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
if (strcmp(argv[argi], "--version") == 0) {
|
||||
printf("%s %s\n", filename, BACNET_VERSION_TEXT);
|
||||
printf(
|
||||
"Copyright (C) 2014 by Steve Karg and others.\n"
|
||||
printf("Copyright (C) 2014 by Steve Karg and others.\n"
|
||||
"This is free software; see the source for copying "
|
||||
"conditions.\n"
|
||||
"There is NO warranty; not even for MERCHANTABILITY or\n"
|
||||
@@ -146,8 +144,8 @@ int main(int argc, char *argv[])
|
||||
if (argc > 1) {
|
||||
for (arg_count = 1; arg_count < argc; arg_count++) {
|
||||
if (arg_count > MAX_ROUTER_DNETS) {
|
||||
fprintf(stderr, "Limited to %u DNETS. Sorry!\n",
|
||||
MAX_ROUTER_DNETS);
|
||||
fprintf(
|
||||
stderr, "Limited to %u DNETS. Sorry!\n", MAX_ROUTER_DNETS);
|
||||
break;
|
||||
}
|
||||
Target_Router_Networks[arg_count - 1] =
|
||||
@@ -0,0 +1,47 @@
|
||||
#Makefile to build BACnet Application for the Linux Port
|
||||
|
||||
TARGET = bacinitr
|
||||
# BACnet objects that are used with this app
|
||||
BACNET_OBJECT_DIR = $(BACNET_SRC_DIR)/bacnet/basic/object
|
||||
SRC = main.c \
|
||||
$(BACNET_OBJECT_DIR)/client/device-client.c \
|
||||
$(BACNET_OBJECT_DIR)/netport.c
|
||||
BACNET_BASIC_SRC += \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_apdu.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_iam.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_noserv.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_rp.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_whois.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/s_iam.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/s_whois.c
|
||||
|
||||
# TARGET_EXT is defined in apps/Makefile as .exe or nothing
|
||||
TARGET_BIN = ${TARGET}$(TARGET_EXT)
|
||||
|
||||
SRCS = $(SRC) $(BACNET_SRC) $(BACNET_BASIC_SRC) $(BACNET_PORT_SRC)
|
||||
|
||||
OBJS += ${SRCS:.c=.o}
|
||||
|
||||
.PHONY: all
|
||||
all: Makefile ${TARGET_BIN}
|
||||
|
||||
${TARGET_BIN}: ${OBJS}
|
||||
${CC} ${PFLAGS} ${OBJS} ${LFLAGS} -o $@
|
||||
size $@
|
||||
cp $@ ../../bin
|
||||
|
||||
.c.o:
|
||||
${CC} -c ${CFLAGS} $*.c -o $@
|
||||
|
||||
.PHONY: depend
|
||||
depend:
|
||||
rm -f .depend
|
||||
${CC} -MM ${CFLAGS} *.c >> .depend
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f core ${TARGET_BIN} ${OBJS} $(TARGET).map
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
@@ -30,29 +30,29 @@
|
||||
#include <stdlib.h>
|
||||
#include <time.h> /* for time */
|
||||
#include <errno.h>
|
||||
#include "bactext.h"
|
||||
#include "iam.h"
|
||||
#include "address.h"
|
||||
#include "config.h"
|
||||
#include "bacdef.h"
|
||||
#include "npdu.h"
|
||||
#include "apdu.h"
|
||||
#include "device.h"
|
||||
#include "datalink.h"
|
||||
#include "version.h"
|
||||
#include "bacnet/bactext.h"
|
||||
#include "bacnet/iam.h"
|
||||
#include "bacnet/basic/binding/address.h"
|
||||
#include "bacnet/config.h"
|
||||
#include "bacnet/bacdef.h"
|
||||
#include "bacnet/npdu.h"
|
||||
#include "bacnet/apdu.h"
|
||||
#include "bacnet/basic/object/device.h"
|
||||
#include "bacnet/datalink/datalink.h"
|
||||
#include "bacnet/version.h"
|
||||
/* some demo stuff needed */
|
||||
#ifndef DEBUG_ENABLED
|
||||
#define DEBUG_ENABLED 0
|
||||
#endif
|
||||
#include "debug.h"
|
||||
#include "filename.h"
|
||||
#include "handlers.h"
|
||||
#include "client.h"
|
||||
#include "txbuf.h"
|
||||
#include "dlenv.h"
|
||||
#include "bacnet/basic/sys/debug.h"
|
||||
#include "bacnet/basic/sys/filename.h"
|
||||
#include "bacnet/basic/services.h"
|
||||
#include "bacnet/basic/services.h"
|
||||
#include "bacnet/basic/tsm/tsm.h"
|
||||
#include "bacnet/datalink/dlenv.h"
|
||||
|
||||
/* buffer used for receive */
|
||||
static uint8_t Rx_Buf[MAX_MPDU] = {0};
|
||||
static uint8_t Rx_Buf[MAX_MPDU] = { 0 };
|
||||
|
||||
/* target address */
|
||||
static BACNET_ADDRESS Target_Router_Address;
|
||||
@@ -68,8 +68,8 @@ int DNET_list[2] = {
|
||||
|
||||
static bool Error_Detected = false;
|
||||
|
||||
static void MyAbortHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
uint8_t abort_reason, bool server)
|
||||
static void MyAbortHandler(
|
||||
BACNET_ADDRESS *src, uint8_t invoke_id, uint8_t abort_reason, bool server)
|
||||
{
|
||||
/* FIXME: verify src and invoke id */
|
||||
(void)src;
|
||||
@@ -79,8 +79,8 @@ static void MyAbortHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
Error_Detected = true;
|
||||
}
|
||||
|
||||
static void MyRejectHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
uint8_t reject_reason)
|
||||
static void MyRejectHandler(
|
||||
BACNET_ADDRESS *src, uint8_t invoke_id, uint8_t reject_reason)
|
||||
{
|
||||
/* FIXME: verify src and invoke id */
|
||||
(void)src;
|
||||
@@ -89,7 +89,8 @@ static void MyRejectHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
Error_Detected = true;
|
||||
}
|
||||
|
||||
static void My_Router_Handler(BACNET_ADDRESS *src, BACNET_NPDU_DATA *npdu_data,
|
||||
static void My_Router_Handler(BACNET_ADDRESS *src,
|
||||
BACNET_NPDU_DATA *npdu_data,
|
||||
uint8_t *npdu, /* PDU data */
|
||||
uint16_t npdu_len)
|
||||
{
|
||||
@@ -181,8 +182,8 @@ static void My_NPDU_Handler(BACNET_ADDRESS *src, /* source address */
|
||||
uint16_t pdu_len)
|
||||
{ /* length PDU */
|
||||
int apdu_offset = 0;
|
||||
BACNET_ADDRESS dest = {0};
|
||||
BACNET_NPDU_DATA npdu_data = {0};
|
||||
BACNET_ADDRESS dest = { 0 };
|
||||
BACNET_NPDU_DATA npdu_data = { 0 };
|
||||
|
||||
apdu_offset = npdu_decode(&pdu[0], &dest, src, &npdu_data);
|
||||
if (npdu_data.network_layer_message) {
|
||||
@@ -196,8 +197,8 @@ static void My_NPDU_Handler(BACNET_ADDRESS *src, /* source address */
|
||||
/* only handle the version that we know how to handle */
|
||||
/* and we are not a router, so ignore messages with
|
||||
routing information cause they are not for us */
|
||||
apdu_handler(src, &pdu[apdu_offset],
|
||||
(uint16_t)(pdu_len - apdu_offset));
|
||||
apdu_handler(
|
||||
src, &pdu[apdu_offset], (uint16_t)(pdu_len - apdu_offset));
|
||||
} else {
|
||||
if (dest.net) {
|
||||
debug_printf("NPDU: DNET=%d. Discarded!\n", dest.net);
|
||||
@@ -221,8 +222,8 @@ static void Init_Service_Handlers(void)
|
||||
It is required to send the proper reject message... */
|
||||
apdu_set_unrecognized_service_handler_handler(handler_unrecognized_service);
|
||||
/* we must implement read property - it's required! */
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_PROPERTY,
|
||||
handler_read_property);
|
||||
apdu_set_confirmed_handler(
|
||||
SERVICE_CONFIRMED_READ_PROPERTY, handler_read_property);
|
||||
/* handle the reply (request) coming back */
|
||||
apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_I_AM, handler_i_am_add);
|
||||
/* handle any errors coming back */
|
||||
@@ -296,7 +297,7 @@ static void address_parse(BACNET_ADDRESS *dst, int argc, char *argv[])
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
BACNET_ADDRESS src = {0}; /* address where message came from */
|
||||
BACNET_ADDRESS src = { 0 }; /* address where message came from */
|
||||
uint16_t pdu_len = 0;
|
||||
unsigned timeout = 100; /* milliseconds */
|
||||
time_t total_seconds = 0;
|
||||
@@ -316,8 +317,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
if (strcmp(argv[argi], "--version") == 0) {
|
||||
printf("%s %s\n", filename, BACNET_VERSION_TEXT);
|
||||
printf(
|
||||
"Copyright (C) 2014 by Steve Karg and others.\n"
|
||||
printf("Copyright (C) 2014 by Steve Karg and others.\n"
|
||||
"This is free software; see the source for copying "
|
||||
"conditions.\n"
|
||||
"There is NO warranty; not even for MERCHANTABILITY or\n"
|
||||
@@ -373,8 +373,9 @@ int main(int argc, char *argv[])
|
||||
#endif
|
||||
}
|
||||
total_seconds += elapsed_seconds;
|
||||
if (total_seconds > timeout_seconds)
|
||||
if (total_seconds > timeout_seconds) {
|
||||
break;
|
||||
}
|
||||
/* keep track of time for next check */
|
||||
last_seconds = current_seconds;
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
#Makefile to build BACnet Application
|
||||
|
||||
# Executable file name
|
||||
TARGET = mstpcap
|
||||
|
||||
# BACNET_PORT, BACNET_PORT_DIR, BACNET_PORT_SRC are defined in common Makefile
|
||||
# BACNET_SRC_DIR is defined in common apps Makefile
|
||||
SRCS = main.c \
|
||||
${BACNET_PORT_DIR}/rs485.c \
|
||||
${BACNET_PORT_DIR}/mstimer-init.c \
|
||||
${BACNET_SRC_DIR}/bacnet/bacdcode.c \
|
||||
${BACNET_SRC_DIR}/bacnet/bacint.c \
|
||||
${BACNET_SRC_DIR}/bacnet/bacreal.c \
|
||||
${BACNET_SRC_DIR}/bacnet/bacstr.c \
|
||||
${BACNET_SRC_DIR}/bacnet/iam.c \
|
||||
${BACNET_SRC_DIR}/bacnet/indtext.c \
|
||||
${BACNET_SRC_DIR}/bacnet/npdu.c \
|
||||
${BACNET_SRC_DIR}/bacnet/basic/sys/debug.c \
|
||||
${BACNET_SRC_DIR}/bacnet/basic/sys/fifo.c \
|
||||
${BACNET_SRC_DIR}/bacnet/basic/sys/filename.c \
|
||||
${BACNET_SRC_DIR}/bacnet/basic/sys/mstimer.c \
|
||||
${BACNET_SRC_DIR}/bacnet/basic/sys/ringbuf.c \
|
||||
${BACNET_SRC_DIR}/bacnet/datalink/mstp.c \
|
||||
${BACNET_SRC_DIR}/bacnet/datalink/mstptext.c \
|
||||
${BACNET_SRC_DIR}/bacnet/datalink/crc.c
|
||||
|
||||
# This demo seems to be a little unique
|
||||
DEFINES = $(BACNET_DEFINES) -DBACDL_MSTP
|
||||
|
||||
# BACNET_PORT, BACNET_PORT_DIR, BACNET_PORT_SRC are defined in common Makefile
|
||||
# BACNET_SRC_DIR is defined in common apps Makefile
|
||||
# WARNINGS, DEBUGGING, OPTIMIZATION are defined in common apps Makefile
|
||||
# BACNET_DEFINES is defined in common apps Makefile
|
||||
# put all the flags together
|
||||
INCLUDES = -I$(BACNET_SRC_DIR) -I$(BACNET_PORT_DIR)
|
||||
CFLAGS += $(WARNINGS) $(DEBUGGING) $(OPTIMIZATION) $(BACNET_DEFINES) $(INCLUDES)
|
||||
LFLAGS += -Wl,$(SYSTEM_LIB)
|
||||
ifneq (${BACNET_LIB},)
|
||||
LFLAGS += -Wl,$(BACNET_LIB)
|
||||
endif
|
||||
# GCC dead code removal
|
||||
CFLAGS += -ffunction-sections -fdata-sections
|
||||
LFLAGS += -Wl,--gc-sections
|
||||
|
||||
OBJS += ${SRCS:.c=.o}
|
||||
|
||||
TARGET_BIN = ${TARGET}$(TARGET_EXT)
|
||||
|
||||
.PHONY: all
|
||||
all: Makefile ${TARGET_BIN}
|
||||
|
||||
${TARGET_BIN}: ${OBJS}
|
||||
${CC} ${PFLAGS} ${OBJS} ${LFLAGS} -o $@
|
||||
size $@
|
||||
cp $@ ../../bin
|
||||
|
||||
.c.o:
|
||||
${CC} -c ${CFLAGS} $*.c -o $@
|
||||
|
||||
.PHONY: depend
|
||||
depend:
|
||||
rm -f .depend
|
||||
${CC} -MM ${CFLAGS} *.c >> .depend
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f core ${TARGET_BIN} ${OBJS} $(TARGET).map
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
@@ -39,19 +39,18 @@
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
/* OS specific include*/
|
||||
#include "net.h"
|
||||
#include "timer.h"
|
||||
/* local includes */
|
||||
#include "bytes.h"
|
||||
#include "bacnet/bytes.h"
|
||||
#include "bacnet/iam.h"
|
||||
#include "bacnet/version.h"
|
||||
/* basic datalink, timer, and filename */
|
||||
#include "bacnet/datalink/dlmstp.h"
|
||||
#include "bacnet/basic/sys/mstimer.h"
|
||||
#include "bacnet/datalink/crc.h"
|
||||
#include "bacnet/datalink/mstptext.h"
|
||||
#include "bacnet/basic/sys/filename.h"
|
||||
/* OS specific includes */
|
||||
#include "bacport.h"
|
||||
#include "rs485.h"
|
||||
#include "crc.h"
|
||||
#include "mstptext.h"
|
||||
#include "filename.h"
|
||||
#include "version.h"
|
||||
#include "dlmstp.h"
|
||||
/* I-Am decoding */
|
||||
#include "iam.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#define strncasecmp(x, y, z) _strnicmp(x, y, z)
|
||||
@@ -78,6 +77,8 @@ static uint8_t TxBuffer[MAX_MPDU];
|
||||
static volatile bool Exit_Requested;
|
||||
/* flag to indicate Wireshark is running the show - no stdout or stderr */
|
||||
static bool Wireshark_Capture;
|
||||
/* placed to track silence on the wire */
|
||||
static struct mstimer Silence_Timer;
|
||||
|
||||
/* statistics derived from monitoring the network for each node */
|
||||
struct mstp_statistics {
|
||||
@@ -146,9 +147,9 @@ static uint32_t timeval_diff_ms(struct timeval *old, struct timeval *now)
|
||||
|
||||
static void mstp_monitor_i_am(uint8_t mac, uint8_t *pdu, uint16_t pdu_len)
|
||||
{
|
||||
BACNET_ADDRESS src = {0};
|
||||
BACNET_ADDRESS dest = {0};
|
||||
BACNET_NPDU_DATA npdu_data = {0};
|
||||
BACNET_ADDRESS src = { 0 };
|
||||
BACNET_ADDRESS dest = { 0 };
|
||||
BACNET_NPDU_DATA npdu_data = { 0 };
|
||||
int apdu_offset = 0;
|
||||
uint16_t apdu_len = 0;
|
||||
uint8_t *apdu = NULL;
|
||||
@@ -182,10 +183,10 @@ static void mstp_monitor_i_am(uint8_t mac, uint8_t *pdu, uint16_t pdu_len)
|
||||
}
|
||||
}
|
||||
|
||||
static void packet_statistics(struct timeval *tv,
|
||||
volatile struct mstp_port_struct_t *mstp_port)
|
||||
static void packet_statistics(
|
||||
struct timeval *tv, volatile struct mstp_port_struct_t *mstp_port)
|
||||
{
|
||||
static struct timeval old_tv = {0};
|
||||
static struct timeval old_tv = { 0 };
|
||||
static uint8_t old_frame = 255;
|
||||
static uint8_t old_src = 255;
|
||||
static uint8_t old_dst = 255;
|
||||
@@ -288,8 +289,8 @@ static void packet_statistics(struct timeval *tv,
|
||||
(mstp_port->ReceivedValidFrameNotForUs)) {
|
||||
if ((mstp_port->DataLength <= mstp_port->InputBufferSize) &&
|
||||
(mstp_port->DataLength > 0)) {
|
||||
mstp_monitor_i_am(src, &mstp_port->InputBuffer[0],
|
||||
mstp_port->DataLength);
|
||||
mstp_monitor_i_am(
|
||||
src, &mstp_port->InputBuffer[0], mstp_port->DataLength);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -325,8 +326,7 @@ static void packet_statistics_print(void)
|
||||
fprintf(stdout, "\n");
|
||||
fprintf(stdout, "==== MS/TP Frame Counts ====\n");
|
||||
fprintf(stdout, "%-8s%-8s%-8s%-8s%-8s%-8s%-8s%-8s%-8s%-7s", "MAC", "Device",
|
||||
"Tokens", "PFM", "RPFM", "DER", "Postpd", "DNER", "TestReq",
|
||||
"TestRsp");
|
||||
"Tokens", "PFM", "RPFM", "DER", "Postpd", "DNER", "TestReq", "TestRsp");
|
||||
fprintf(stdout, "\n");
|
||||
for (i = 0; i < MAX_MSTP_DEVICES; i++) {
|
||||
/* check for masters or slaves */
|
||||
@@ -358,8 +358,8 @@ static void packet_statistics_print(void)
|
||||
fprintf(stdout, "\n");
|
||||
fprintf(stdout, "==== MS/TP Usage and Timing Maximums ====\n");
|
||||
fprintf(stdout, "%-8s%-8s%-8s%-8s%-8s%-8s%-8s%-8s%-8s%-7s", "MAC",
|
||||
"MaxMstr", "Retries", "Npoll", "Self/TT", "Treply", "Tusage",
|
||||
"Trpfm", "Tder", "Tpostpd");
|
||||
"MaxMstr", "Retries", "Npoll", "Self/TT", "Treply", "Tusage", "Trpfm",
|
||||
"Tder", "Tpostpd");
|
||||
fprintf(stdout, "\n");
|
||||
for (i = 0; i < MAX_MSTP_DEVICES; i++) {
|
||||
/* check for masters or slaves */
|
||||
@@ -372,8 +372,7 @@ static void packet_statistics_print(void)
|
||||
fprintf(stdout, "%-8lu%-8lu%-8lu%-8lu%-8lu",
|
||||
(long unsigned int)MSTP_Statistics[i].max_master,
|
||||
(long unsigned int)MSTP_Statistics[i].token_retries,
|
||||
(long unsigned int)MSTP_Statistics[i].npoll,
|
||||
self_or_ooo_count,
|
||||
(long unsigned int)MSTP_Statistics[i].npoll, self_or_ooo_count,
|
||||
(long unsigned int)MSTP_Statistics[i].token_reply);
|
||||
fprintf(stdout, "%-8lu%-8lu%-8lu%-7lu",
|
||||
(long unsigned int)MSTP_Statistics[i].tusage_timeout,
|
||||
@@ -401,12 +400,12 @@ static void packet_statistics_clear(void)
|
||||
|
||||
static uint32_t Timer_Silence(void *pArg)
|
||||
{
|
||||
return timer_milliseconds(TIMER_SILENCE);
|
||||
return mstimer_remaining(&Silence_Timer);
|
||||
}
|
||||
|
||||
static void Timer_Silence_Reset(void *pArg)
|
||||
{
|
||||
timer_reset(TIMER_SILENCE);
|
||||
mstimer_set(&Silence_Timer, 0);
|
||||
}
|
||||
|
||||
/* functions used by the MS/TP state machine to put or get data */
|
||||
@@ -419,16 +418,16 @@ uint16_t MSTP_Put_Receive(volatile struct mstp_port_struct_t *mstp_port)
|
||||
|
||||
/* for the MS/TP state machine to use for getting data to send */
|
||||
/* Return: amount of PDU data */
|
||||
uint16_t MSTP_Get_Send(volatile struct mstp_port_struct_t *mstp_port,
|
||||
unsigned timeout)
|
||||
uint16_t MSTP_Get_Send(
|
||||
volatile struct mstp_port_struct_t *mstp_port, unsigned timeout)
|
||||
{ /* milliseconds to wait for a packet */
|
||||
(void)mstp_port;
|
||||
(void)timeout;
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint16_t MSTP_Get_Reply(volatile struct mstp_port_struct_t *mstp_port,
|
||||
unsigned timeout)
|
||||
uint16_t MSTP_Get_Reply(
|
||||
volatile struct mstp_port_struct_t *mstp_port, unsigned timeout)
|
||||
{ /* milliseconds to wait for a packet */
|
||||
(void)mstp_port;
|
||||
(void)timeout;
|
||||
@@ -454,8 +453,7 @@ static void named_pipe_create(char *pipe_name)
|
||||
}
|
||||
/* if an error occured at handle creation */
|
||||
if (!WaitNamedPipe(pipe_name, 20000)) {
|
||||
printf(
|
||||
"Could not open pipe: waited for 20sec!\n"
|
||||
printf("Could not open pipe: waited for 20sec!\n"
|
||||
"If this message was issued before the 20sec finished,\n"
|
||||
"then the pipe doesn't exist!\n");
|
||||
Exit_Requested = true;
|
||||
@@ -465,7 +463,7 @@ static void named_pipe_create(char *pipe_name)
|
||||
ConnectNamedPipe(hPipe, NULL);
|
||||
}
|
||||
|
||||
size_t data_write(const void *ptr, size_t size, size_t nitems)
|
||||
static size_t data_write(const void *ptr, size_t size, size_t nitems)
|
||||
{
|
||||
DWORD cbWritten = 0;
|
||||
if (hPipe != INVALID_HANDLE_VALUE) {
|
||||
@@ -479,8 +477,8 @@ size_t data_write(const void *ptr, size_t size, size_t nitems)
|
||||
return fwrite(ptr, size, nitems, pFile);
|
||||
}
|
||||
|
||||
size_t data_write_header(const void *ptr, size_t size, size_t nitems,
|
||||
bool pipe_enable)
|
||||
static size_t data_write_header(
|
||||
const void *ptr, size_t size, size_t nitems, bool pipe_enable)
|
||||
{
|
||||
DWORD cbWritten = 0;
|
||||
if (pipe_enable && (hPipe != INVALID_HANDLE_VALUE)) {
|
||||
@@ -510,7 +508,7 @@ static void named_pipe_create(char *name)
|
||||
}
|
||||
}
|
||||
|
||||
size_t data_write(const void *ptr, size_t size, size_t nitems)
|
||||
static size_t data_write(const void *ptr, size_t size, size_t nitems)
|
||||
{
|
||||
ssize_t bytes = 0;
|
||||
if (FD_Pipe != -1) {
|
||||
@@ -520,8 +518,8 @@ size_t data_write(const void *ptr, size_t size, size_t nitems)
|
||||
return fwrite(ptr, size, nitems, pFile);
|
||||
}
|
||||
|
||||
size_t data_write_header(const void *ptr, size_t size, size_t nitems,
|
||||
bool pipe_enable)
|
||||
static size_t data_write_header(
|
||||
const void *ptr, size_t size, size_t nitems, bool pipe_enable)
|
||||
{
|
||||
ssize_t bytes = 0;
|
||||
if (pipe_enable && (FD_Pipe != -1)) {
|
||||
@@ -561,12 +559,12 @@ static void write_global_header(const char *filename)
|
||||
/* create a new file. */
|
||||
pFile = fopen(filename, "wb");
|
||||
if (pFile) {
|
||||
(void)data_write_header(&magic_number, sizeof(magic_number), 1,
|
||||
pipe_enable);
|
||||
(void)data_write_header(&version_major, sizeof(version_major), 1,
|
||||
pipe_enable);
|
||||
(void)data_write_header(&version_minor, sizeof(version_minor), 1,
|
||||
pipe_enable);
|
||||
(void)data_write_header(
|
||||
&magic_number, sizeof(magic_number), 1, pipe_enable);
|
||||
(void)data_write_header(
|
||||
&version_major, sizeof(version_major), 1, pipe_enable);
|
||||
(void)data_write_header(
|
||||
&version_minor, sizeof(version_minor), 1, pipe_enable);
|
||||
(void)data_write_header(&thiszone, sizeof(thiszone), 1, pipe_enable);
|
||||
(void)data_write_header(&sigfigs, sizeof(sigfigs), 1, pipe_enable);
|
||||
(void)data_write_header(&snaplen, sizeof(snaplen), 1, pipe_enable);
|
||||
@@ -584,14 +582,14 @@ static void write_global_header(const char *filename)
|
||||
}
|
||||
}
|
||||
|
||||
static void write_received_packet(volatile struct mstp_port_struct_t *mstp_port,
|
||||
size_t header_len)
|
||||
static void write_received_packet(
|
||||
volatile struct mstp_port_struct_t *mstp_port, size_t header_len)
|
||||
{
|
||||
uint32_t ts_sec = 0; /* timestamp seconds */
|
||||
uint32_t ts_usec = 0; /* timestamp microseconds */
|
||||
uint32_t incl_len = 0; /* number of octets of packet saved in file */
|
||||
uint32_t orig_len = 0; /* actual length of packet */
|
||||
uint8_t header[MSTP_HEADER_MAX] = {0}; /* MS/TP header */
|
||||
uint8_t header[MSTP_HEADER_MAX] = { 0 }; /* MS/TP header */
|
||||
struct timeval tv;
|
||||
size_t max_data = 0;
|
||||
|
||||
@@ -731,7 +729,7 @@ static bool read_received_packet(volatile struct mstp_port_struct_t *mstp_port)
|
||||
uint32_t ts_usec = 0; /* timestamp microseconds */
|
||||
uint32_t incl_len = 0; /* number of octets of packet saved in file */
|
||||
uint32_t orig_len = 0; /* actual length of packet */
|
||||
uint8_t header[8] = {0}; /* MS/TP header */
|
||||
uint8_t header[8] = { 0 }; /* MS/TP header */
|
||||
struct timeval tv;
|
||||
size_t count = 0;
|
||||
unsigned i = 0;
|
||||
@@ -814,8 +812,8 @@ static bool read_received_packet(volatile struct mstp_port_struct_t *mstp_port)
|
||||
}
|
||||
mstp_port->DataCRC = 0xFFFF;
|
||||
for (i = 0; i < mstp_port->DataLength; i++) {
|
||||
mstp_port->DataCRC = CRC_Calc_Data(mstp_port->InputBuffer[i],
|
||||
mstp_port->DataCRC);
|
||||
mstp_port->DataCRC = CRC_Calc_Data(
|
||||
mstp_port->InputBuffer[i], mstp_port->DataCRC);
|
||||
}
|
||||
mstp_port->DataCRC =
|
||||
CRC_Calc_Data(mstp_port->DataCRCActualMSB, mstp_port->DataCRC);
|
||||
@@ -889,7 +887,7 @@ static void sig_int(int signo)
|
||||
exit(0);
|
||||
}
|
||||
|
||||
void signal_init(void)
|
||||
static void signal_init(void)
|
||||
{
|
||||
signal(SIGINT, sig_int);
|
||||
signal(SIGHUP, sig_int);
|
||||
@@ -897,7 +895,7 @@ void signal_init(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
void filename_create_new(void)
|
||||
static void filename_create_new(void)
|
||||
{
|
||||
if (pFile) {
|
||||
fclose(pFile);
|
||||
@@ -919,13 +917,11 @@ static void print_usage(char *filename)
|
||||
|
||||
static void print_help(char *filename)
|
||||
{
|
||||
printf(
|
||||
"%s --scan <filename>\n"
|
||||
printf("%s --scan <filename>\n"
|
||||
"perform statistic analysis on MS/TP capture file.\n",
|
||||
filename);
|
||||
printf("\n");
|
||||
printf(
|
||||
"Captures MS/TP packets from a serial interface\n"
|
||||
printf("Captures MS/TP packets from a serial interface\n"
|
||||
"and saves them to a file. Saves packets in a\n"
|
||||
"filename mstp_20090123091200.cap that has data and time.\n"
|
||||
"After receiving 65535 packets, a new file is created.\n"
|
||||
@@ -948,8 +944,7 @@ static void print_help(char *filename)
|
||||
#endif
|
||||
" Use that name as the interface name in Wireshark.\n");
|
||||
printf("\n");
|
||||
printf(
|
||||
"%s [--extcap-interfaces][--extcap-dlts][--extcap-config]\n"
|
||||
printf("%s [--extcap-interfaces][--extcap-dlts][--extcap-config]\n"
|
||||
"[--capture][--baud baud][--fifo pipe]\n"
|
||||
"[--extcap-interface iface]\n"
|
||||
"Usage from Wireshark ExtCap interface\n",
|
||||
@@ -1007,8 +1002,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
if (strcmp(argv[argi], "--version") == 0) {
|
||||
printf("mstpcap %s\n", BACNET_VERSION_TEXT);
|
||||
printf(
|
||||
"Copyright (C) 2011-2016 by Steve Karg\n"
|
||||
printf("Copyright (C) 2011-2016 by Steve Karg\n"
|
||||
"This is free software; see the source for copying "
|
||||
"conditions.\n"
|
||||
"There is NO warranty; not even for MERCHANTABILITY or\n"
|
||||
@@ -1047,15 +1041,13 @@ int main(int argc, char *argv[])
|
||||
printf("An interface must be provided.\n");
|
||||
return 0;
|
||||
}
|
||||
printf(
|
||||
"dlt {number=%u}{name=BACnet MS/TP}"
|
||||
printf("dlt {number=%u}{name=BACnet MS/TP}"
|
||||
"{display=BACnet MS/TP}\n",
|
||||
DLT_BACNET_MS_TP);
|
||||
Exit_Requested = true;
|
||||
}
|
||||
if (strcmp(argv[argi], "--extcap-config") == 0) {
|
||||
printf(
|
||||
"arg {number=0}{call=--baud}{display=Baud Rate}"
|
||||
printf("arg {number=0}{call=--baud}{display=Baud Rate}"
|
||||
"{tooltip=Serial port baud rate in bits per second}"
|
||||
"{type=selector}\n");
|
||||
printf("value {arg=0}{value=9600}{display=9600}{default=false}\n");
|
||||
@@ -1077,8 +1069,7 @@ int main(int argc, char *argv[])
|
||||
if (strcmp(argv[argi], "--extcap-interface") == 0) {
|
||||
argi++;
|
||||
if (argi >= argc) {
|
||||
printf(
|
||||
"An interface must be provided or "
|
||||
printf("An interface must be provided or "
|
||||
"the selection must be displayed.\n");
|
||||
return 0;
|
||||
}
|
||||
@@ -1132,7 +1123,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
atexit(cleanup);
|
||||
RS485_Initialize();
|
||||
timer_init();
|
||||
mstimer_init();
|
||||
if (!Wireshark_Capture) {
|
||||
fprintf(stdout, "mstpcap: Using %s for capture at %ld bps.\n",
|
||||
RS485_Interface(), (long)RS485_Get_Baud_Rate());
|
||||
@@ -0,0 +1,51 @@
|
||||
#Makefile to build BACnet Application
|
||||
|
||||
# Executable file name
|
||||
TARGET = mstpcrc
|
||||
|
||||
SRCS = main.c \
|
||||
${BACNET_PORT_DIR}/mstimer-init.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/sys/mstimer.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/datalink/crc.c
|
||||
|
||||
# BACNET_PORT, BACNET_PORT_DIR, BACNET_PORT_SRC are defined in common Makefile
|
||||
# BACNET_SRC_DIR is defined in common apps Makefile
|
||||
# WARNINGS, DEBUGGING, OPTIMIZATION are defined in common apps Makefile
|
||||
# BACNET_DEFINES is defined in common apps Makefile
|
||||
# put all the flags together
|
||||
INCLUDES = -I$(BACNET_SRC_DIR) -I$(BACNET_PORT_DIR)
|
||||
CFLAGS += $(WARNINGS) $(DEBUGGING) $(OPTIMIZATION) $(BACNET_DEFINES) $(INCLUDES)
|
||||
LFLAGS += -Wl,$(SYSTEM_LIB)
|
||||
ifneq (${BACNET_LIB},)
|
||||
LFLAGS += -Wl,$(BACNET_LIB)
|
||||
endif
|
||||
# GCC dead code removal
|
||||
CFLAGS += -ffunction-sections -fdata-sections
|
||||
LFLAGS += -Wl,--gc-sections
|
||||
|
||||
OBJS += ${SRCS:.c=.o}
|
||||
|
||||
TARGET_BIN = ${TARGET}$(TARGET_EXT)
|
||||
|
||||
.PHONY: all
|
||||
all: Makefile ${TARGET_BIN}
|
||||
|
||||
${TARGET_BIN}: ${OBJS}
|
||||
${CC} ${PFLAGS} ${OBJS} ${LFLAGS} -o $@
|
||||
size $@
|
||||
cp $@ ../../bin
|
||||
|
||||
.c.o:
|
||||
${CC} -c ${CFLAGS} $*.c -o $@
|
||||
|
||||
.PHONY: depend
|
||||
depend:
|
||||
rm -f .depend
|
||||
${CC} -MM ${CFLAGS} *.c >> .depend
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f core ${TARGET_BIN} ${OBJS} $(TARGET).map
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
@@ -42,12 +42,12 @@
|
||||
#include <time.h>
|
||||
#include <ctype.h>
|
||||
/* OS specific include*/
|
||||
#include "net.h"
|
||||
#include "timer.h"
|
||||
#include "bacport.h"
|
||||
/* local includes */
|
||||
#include "bytes.h"
|
||||
#include "crc.h"
|
||||
#include "version.h"
|
||||
#include "bacnet/bytes.h"
|
||||
#include "bacnet/basic/sys/mstimer.h"
|
||||
#include "bacnet/datalink/crc.h"
|
||||
#include "bacnet/version.h"
|
||||
|
||||
#ifndef max
|
||||
#define max(a, b) (((a)(b)) ? (a) : (b))
|
||||
Executable → Regular
Executable → Regular
@@ -1,10 +1,10 @@
|
||||
#include "bacdef.h"
|
||||
#include "handlers.h"
|
||||
#include "bacenum.h"
|
||||
#include "datalink.h"
|
||||
#include "device.h"
|
||||
#include "bacnet/bacdef.h"
|
||||
#include "bacnet/basic/services.h"
|
||||
#include "bacnet/bacenum.h"
|
||||
#include "bacnet/datalink/datalink.h"
|
||||
#include "bacnet/basic/object/device.h"
|
||||
#include <time.h>
|
||||
#include "arf.h"
|
||||
#include "bacnet/arf.h"
|
||||
|
||||
/* Free is redefined as a macro, but Perl does not like that. */
|
||||
#undef free
|
||||
@@ -57,8 +57,8 @@ static void __LogAnswer(const char *msg, unsigned append)
|
||||
/**************************************/
|
||||
/* error handlers */
|
||||
/*************************************/
|
||||
static void MyAbortHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
uint8_t abort_reason, bool server)
|
||||
static void MyAbortHandler(
|
||||
BACNET_ADDRESS *src, uint8_t invoke_id, uint8_t abort_reason, bool server)
|
||||
{
|
||||
(void)server;
|
||||
if (address_match(&Target_Address, src) &&
|
||||
@@ -70,8 +70,8 @@ static void MyAbortHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
}
|
||||
}
|
||||
|
||||
static void MyRejectHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
uint8_t reject_reason)
|
||||
static void MyRejectHandler(
|
||||
BACNET_ADDRESS *src, uint8_t invoke_id, uint8_t reject_reason)
|
||||
{
|
||||
if (address_match(&Target_Address, src) &&
|
||||
(invoke_id == Request_Invoke_ID)) {
|
||||
@@ -82,7 +82,8 @@ static void MyRejectHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
}
|
||||
}
|
||||
|
||||
static void My_Error_Handler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
static void My_Error_Handler(BACNET_ADDRESS *src,
|
||||
uint8_t invoke_id,
|
||||
BACNET_ERROR_CLASS error_class,
|
||||
BACNET_ERROR_CODE error_code)
|
||||
{
|
||||
@@ -136,8 +137,7 @@ void rp_ack_extract_data(BACNET_READ_PROPERTY_DATA *data)
|
||||
object_value.array_index = data->array_index;
|
||||
object_value.value = &value;
|
||||
bacapp_snprintf_value(pAckString,
|
||||
MAX_ACK_STRING - (pAckString - ackString),
|
||||
&object_value);
|
||||
MAX_ACK_STRING - (pAckString - ackString), &object_value);
|
||||
if (len > 0) {
|
||||
if (len < application_data_len) {
|
||||
application_data += len;
|
||||
@@ -193,8 +193,8 @@ void rpm_ack_extract_data(BACNET_READ_ACCESS_DATA *rpm_data)
|
||||
object_value.array_index =
|
||||
listOfProperties->propertyArrayIndex;
|
||||
object_value.value = value;
|
||||
bacapp_snprintf_value(
|
||||
pAckString, MAX_ACK_STRING - (pAckString - ackString),
|
||||
bacapp_snprintf_value(pAckString,
|
||||
MAX_ACK_STRING - (pAckString - ackString),
|
||||
&object_value);
|
||||
if (value->next) {
|
||||
strncat(pAckString, ",", 1);
|
||||
@@ -229,8 +229,9 @@ void rpm_ack_extract_data(BACNET_READ_ACCESS_DATA *rpm_data)
|
||||
}
|
||||
}
|
||||
|
||||
static void AtomicReadFileAckHandler(
|
||||
uint8_t *service_request, uint16_t service_len, BACNET_ADDRESS *src,
|
||||
static void AtomicReadFileAckHandler(uint8_t *service_request,
|
||||
uint16_t service_len,
|
||||
BACNET_ADDRESS *src,
|
||||
BACNET_CONFIRMED_SERVICE_ACK_DATA *service_data)
|
||||
{
|
||||
int len = 0;
|
||||
@@ -276,8 +277,9 @@ static void AtomicReadFileAckHandler(
|
||||
* @param service_data [in] The BACNET_CONFIRMED_SERVICE_DATA information
|
||||
* decoded from the APDU header of this message.
|
||||
*/
|
||||
static void My_Read_Property_Ack_Handler(
|
||||
uint8_t *service_request, uint16_t service_len, BACNET_ADDRESS *src,
|
||||
static void My_Read_Property_Ack_Handler(uint8_t *service_request,
|
||||
uint16_t service_len,
|
||||
BACNET_ADDRESS *src,
|
||||
BACNET_CONFIRMED_SERVICE_ACK_DATA *service_data)
|
||||
{
|
||||
int len = 0;
|
||||
@@ -304,8 +306,9 @@ static void My_Read_Property_Ack_Handler(
|
||||
* @param service_data [in] The BACNET_CONFIRMED_SERVICE_DATA information
|
||||
* decoded from the APDU header of this message.
|
||||
*/
|
||||
static void My_Read_Property_Multiple_Ack_Handler(
|
||||
uint8_t *service_request, uint16_t service_len, BACNET_ADDRESS *src,
|
||||
static void My_Read_Property_Multiple_Ack_Handler(uint8_t *service_request,
|
||||
uint16_t service_len,
|
||||
BACNET_ADDRESS *src,
|
||||
BACNET_CONFIRMED_SERVICE_ACK_DATA *service_data)
|
||||
{
|
||||
int len = 0;
|
||||
@@ -320,8 +323,8 @@ static void My_Read_Property_Multiple_Ack_Handler(
|
||||
(service_data->invoke_id == Request_Invoke_ID)) {
|
||||
rpm_data = calloc(1, sizeof(BACNET_READ_ACCESS_DATA));
|
||||
if (rpm_data) {
|
||||
len = rpm_ack_decode_service_request(service_request, service_len,
|
||||
rpm_data);
|
||||
len = rpm_ack_decode_service_request(
|
||||
service_request, service_len, rpm_data);
|
||||
}
|
||||
if (len > 0) {
|
||||
while (rpm_data) {
|
||||
@@ -388,8 +391,8 @@ static void Init_Service_Handlers()
|
||||
apdu_set_unrecognized_service_handler_handler(handler_unrecognized_service);
|
||||
|
||||
/* we must implement read property - it's required! */
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_PROPERTY,
|
||||
handler_read_property);
|
||||
apdu_set_confirmed_handler(
|
||||
SERVICE_CONFIRMED_READ_PROPERTY, handler_read_property);
|
||||
|
||||
/* handle generic errors coming back */
|
||||
apdu_set_abort_handler(MyAbortHandler);
|
||||
@@ -408,8 +411,8 @@ static void Wait_For_Answer_Or_Timeout(unsigned timeout_ms, waitAction action)
|
||||
time_t timeout_seconds = (apdu_timeout() / 1000) * apdu_retries();
|
||||
time_t elapsed_seconds = 0;
|
||||
uint16_t pdu_len = 0;
|
||||
BACNET_ADDRESS src = {0}; /* address where message came from */
|
||||
uint8_t Rx_Buf[MAX_MPDU] = {0};
|
||||
BACNET_ADDRESS src = { 0 }; /* address where message came from */
|
||||
uint8_t Rx_Buf[MAX_MPDU] = { 0 };
|
||||
|
||||
while (true) {
|
||||
time_t current_seconds = time(NULL);
|
||||
@@ -490,10 +493,10 @@ int BacnetBindToDevice(int deviceInstanceNumber)
|
||||
Target_Device_Object_Instance = deviceInstanceNumber;
|
||||
|
||||
/* try to bind with the device */
|
||||
if (!address_bind_request(deviceInstanceNumber, &Target_Max_APDU,
|
||||
&Target_Address)) {
|
||||
Send_WhoIs(Target_Device_Object_Instance,
|
||||
Target_Device_Object_Instance);
|
||||
if (!address_bind_request(
|
||||
deviceInstanceNumber, &Target_Max_APDU, &Target_Address)) {
|
||||
Send_WhoIs(
|
||||
Target_Device_Object_Instance, Target_Device_Object_Instance);
|
||||
|
||||
/* Wait for timeout, failure, or success */
|
||||
Wait_For_Answer_Or_Timeout(100, waitBind);
|
||||
@@ -507,26 +510,27 @@ int BacnetBindToDevice(int deviceInstanceNumber)
|
||||
/****************************************************/
|
||||
/* This is the interface to ReadProperty */
|
||||
/****************************************************/
|
||||
int BacnetReadProperty(int deviceInstanceNumber, int objectType,
|
||||
int objectInstanceNumber, int objectProperty,
|
||||
int BacnetReadProperty(int deviceInstanceNumber,
|
||||
int objectType,
|
||||
int objectInstanceNumber,
|
||||
int objectProperty,
|
||||
int objectIndex)
|
||||
{
|
||||
if (!isReadPropertyHandlerRegistered) {
|
||||
/* handle the data coming back from confirmed requests */
|
||||
apdu_set_confirmed_ack_handler(SERVICE_CONFIRMED_READ_PROPERTY,
|
||||
My_Read_Property_Ack_Handler);
|
||||
apdu_set_confirmed_ack_handler(
|
||||
SERVICE_CONFIRMED_READ_PROPERTY, My_Read_Property_Ack_Handler);
|
||||
|
||||
/* handle any errors coming back */
|
||||
apdu_set_error_handler(SERVICE_CONFIRMED_READ_PROPERTY,
|
||||
My_Error_Handler);
|
||||
apdu_set_error_handler(
|
||||
SERVICE_CONFIRMED_READ_PROPERTY, My_Error_Handler);
|
||||
|
||||
/* indicate that handlers are now registered */
|
||||
isReadPropertyHandlerRegistered = true;
|
||||
}
|
||||
/* Send the message out */
|
||||
Request_Invoke_ID = Send_Read_Property_Request(
|
||||
deviceInstanceNumber, objectType, objectInstanceNumber, objectProperty,
|
||||
objectIndex);
|
||||
Request_Invoke_ID = Send_Read_Property_Request(deviceInstanceNumber,
|
||||
objectType, objectInstanceNumber, objectProperty, objectIndex);
|
||||
Wait_For_Answer_Or_Timeout(100, waitAnswer);
|
||||
|
||||
int isFailure = Error_Detected;
|
||||
@@ -546,7 +550,7 @@ int BacnetReadPropertyMultiple(int deviceInstanceNumber, ...)
|
||||
calloc(1, sizeof(BACNET_READ_ACCESS_DATA));
|
||||
BACNET_READ_ACCESS_DATA *Read_Access_Data = rpm_object;
|
||||
BACNET_PROPERTY_REFERENCE *rpm_property;
|
||||
uint8_t buffer[MAX_PDU] = {0};
|
||||
uint8_t buffer[MAX_PDU] = { 0 };
|
||||
|
||||
while (rpmIndex < Inline_Stack_Items) {
|
||||
SV *pSV = Inline_Stack_Item(rpmIndex++);
|
||||
@@ -625,8 +629,8 @@ int BacnetReadPropertyMultiple(int deviceInstanceNumber, ...)
|
||||
My_Read_Property_Multiple_Ack_Handler);
|
||||
|
||||
/* handle any errors coming back */
|
||||
apdu_set_error_handler(SERVICE_CONFIRMED_READ_PROP_MULTIPLE,
|
||||
My_Error_Handler);
|
||||
apdu_set_error_handler(
|
||||
SERVICE_CONFIRMED_READ_PROP_MULTIPLE, My_Error_Handler);
|
||||
|
||||
/* indicate that handlers are now registered */
|
||||
isReadPropertyMultipleHandlerRegistered = true;
|
||||
@@ -664,9 +668,13 @@ int BacnetReadPropertyMultiple(int deviceInstanceNumber, ...)
|
||||
/****************************************************/
|
||||
/* This is the interface to WriteProperty */
|
||||
/****************************************************/
|
||||
int BacnetWriteProperty(int deviceInstanceNumber, int objectType,
|
||||
int objectInstanceNumber, int objectProperty,
|
||||
int objectPriority, int objectIndex, const char *tag,
|
||||
int BacnetWriteProperty(int deviceInstanceNumber,
|
||||
int objectType,
|
||||
int objectInstanceNumber,
|
||||
int objectProperty,
|
||||
int objectPriority,
|
||||
int objectIndex,
|
||||
const char *tag,
|
||||
const char *value)
|
||||
{
|
||||
char msg[MAX_ERROR_STRING];
|
||||
@@ -674,13 +682,12 @@ int BacnetWriteProperty(int deviceInstanceNumber, int objectType,
|
||||
|
||||
if (!isWritePropertyHandlerRegistered) {
|
||||
/* handle the ack coming back */
|
||||
apdu_set_confirmed_simple_ack_handler(
|
||||
SERVICE_CONFIRMED_WRITE_PROPERTY,
|
||||
apdu_set_confirmed_simple_ack_handler(SERVICE_CONFIRMED_WRITE_PROPERTY,
|
||||
My_Write_Property_SimpleAck_Handler);
|
||||
|
||||
/* handle any errors coming back */
|
||||
apdu_set_error_handler(SERVICE_CONFIRMED_WRITE_PROPERTY,
|
||||
My_Error_Handler);
|
||||
apdu_set_error_handler(
|
||||
SERVICE_CONFIRMED_WRITE_PROPERTY, My_Error_Handler);
|
||||
|
||||
/* indicate that handlers are now registered */
|
||||
isWritePropertyHandlerRegistered = true;
|
||||
@@ -711,8 +718,8 @@ int BacnetWriteProperty(int deviceInstanceNumber, int objectType,
|
||||
LogError(msg);
|
||||
break;
|
||||
}
|
||||
if (!bacapp_parse_application_data(property_tag, value,
|
||||
&propertyValue)) {
|
||||
if (!bacapp_parse_application_data(
|
||||
property_tag, value, &propertyValue)) {
|
||||
sprintf(msg, "Error: unable to parse the tag value");
|
||||
LogError(msg);
|
||||
break;
|
||||
@@ -720,9 +727,9 @@ int BacnetWriteProperty(int deviceInstanceNumber, int objectType,
|
||||
propertyValue.next = NULL;
|
||||
|
||||
/* Send out the message */
|
||||
Request_Invoke_ID = Send_Write_Property_Request(
|
||||
deviceInstanceNumber, objectType, objectInstanceNumber,
|
||||
objectProperty, &propertyValue, objectPriority, objectIndex);
|
||||
Request_Invoke_ID = Send_Write_Property_Request(deviceInstanceNumber,
|
||||
objectType, objectInstanceNumber, objectProperty, &propertyValue,
|
||||
objectPriority, objectIndex);
|
||||
Wait_For_Answer_Or_Timeout(100, waitAnswer);
|
||||
|
||||
/* If we get here, then there were no explicit failures. However, there
|
||||
@@ -736,8 +743,10 @@ int BacnetWriteProperty(int deviceInstanceNumber, int objectType,
|
||||
return isFailure;
|
||||
}
|
||||
|
||||
int BacnetAtomicWriteFile(int deviceInstanceNumber, int fileInstanceNumber,
|
||||
int blockStartAddr, int blockNumBytes,
|
||||
int BacnetAtomicWriteFile(int deviceInstanceNumber,
|
||||
int fileInstanceNumber,
|
||||
int blockStartAddr,
|
||||
int blockNumBytes,
|
||||
char *nibbleBuffer)
|
||||
{
|
||||
BACNET_OCTET_STRING fileData;
|
||||
@@ -747,8 +756,8 @@ int BacnetAtomicWriteFile(int deviceInstanceNumber, int fileInstanceNumber,
|
||||
|
||||
if (!isAtomicWriteFileHandlerRegistered) {
|
||||
/* handle any errors coming back */
|
||||
apdu_set_error_handler(SERVICE_CONFIRMED_ATOMIC_WRITE_FILE,
|
||||
My_Error_Handler);
|
||||
apdu_set_error_handler(
|
||||
SERVICE_CONFIRMED_ATOMIC_WRITE_FILE, My_Error_Handler);
|
||||
|
||||
/* indicate that handlers are now registered */
|
||||
isAtomicWriteFileHandlerRegistered = true;
|
||||
@@ -772,9 +781,8 @@ int BacnetAtomicWriteFile(int deviceInstanceNumber, int fileInstanceNumber,
|
||||
|
||||
/* Send out the message and wait for answer */
|
||||
if (!Error_Detected) {
|
||||
Request_Invoke_ID = Send_Atomic_Write_File_Stream(
|
||||
deviceInstanceNumber, fileInstanceNumber, blockStartAddr,
|
||||
&fileData);
|
||||
Request_Invoke_ID = Send_Atomic_Write_File_Stream(deviceInstanceNumber,
|
||||
fileInstanceNumber, blockStartAddr, &fileData);
|
||||
Wait_For_Answer_Or_Timeout(100, waitAnswer);
|
||||
}
|
||||
|
||||
@@ -811,8 +819,15 @@ int BacnetGetMaxApdu()
|
||||
return requestedOctetCount;
|
||||
}
|
||||
|
||||
int BacnetTimeSync(int deviceInstanceNumber, int year, int month, int day,
|
||||
int hour, int minute, int second, int isUTC, int UTCOffset)
|
||||
int BacnetTimeSync(int deviceInstanceNumber,
|
||||
int year,
|
||||
int month,
|
||||
int day,
|
||||
int hour,
|
||||
int minute,
|
||||
int second,
|
||||
int isUTC,
|
||||
int UTCOffset)
|
||||
{
|
||||
BACNET_DATE bdate;
|
||||
BACNET_TIME btime;
|
||||
@@ -847,7 +862,7 @@ int BacnetTimeSync(int deviceInstanceNumber, int year, int month, int day,
|
||||
int bytes_sent = 0;
|
||||
BACNET_NPDU_DATA npdu_data;
|
||||
BACNET_ADDRESS my_address;
|
||||
uint8_t Handler_Transmit_Buffer[MAX_PDU] = {0};
|
||||
uint8_t Handler_Transmit_Buffer[MAX_PDU] = { 0 };
|
||||
|
||||
/* Loop for eary exit */
|
||||
do {
|
||||
@@ -863,13 +878,13 @@ int BacnetTimeSync(int deviceInstanceNumber, int year, int month, int day,
|
||||
&my_address, &npdu_data);
|
||||
|
||||
/* encode the APDU portion of the packet */
|
||||
len = timesync_encode_apdu(&Handler_Transmit_Buffer[pdu_len], &bdate,
|
||||
&btime);
|
||||
len = timesync_encode_apdu(
|
||||
&Handler_Transmit_Buffer[pdu_len], &bdate, &btime);
|
||||
pdu_len += len;
|
||||
|
||||
/* send it out the datalink */
|
||||
bytes_sent = datalink_send_pdu(&Target_Address, &npdu_data,
|
||||
&Handler_Transmit_Buffer[0], pdu_len);
|
||||
bytes_sent = datalink_send_pdu(
|
||||
&Target_Address, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
|
||||
if (bytes_sent <= 0) {
|
||||
char errorMsg[64];
|
||||
sprintf(errorMsg,
|
||||
@@ -890,17 +905,19 @@ int BacnetTimeSync(int deviceInstanceNumber, int year, int month, int day,
|
||||
/****************************************************/
|
||||
/* This is the interface to AtomicReadFile */
|
||||
/****************************************************/
|
||||
int BacnetAtomicReadFile(int deviceInstanceNumber, int fileInstanceNumber,
|
||||
int startOffset, int numBytes)
|
||||
int BacnetAtomicReadFile(int deviceInstanceNumber,
|
||||
int fileInstanceNumber,
|
||||
int startOffset,
|
||||
int numBytes)
|
||||
{
|
||||
if (!isAtomicReadFileHandlerRegistered) {
|
||||
/* handle the data coming back from confirmed requests */
|
||||
apdu_set_confirmed_ack_handler(SERVICE_CONFIRMED_ATOMIC_READ_FILE,
|
||||
AtomicReadFileAckHandler);
|
||||
apdu_set_confirmed_ack_handler(
|
||||
SERVICE_CONFIRMED_ATOMIC_READ_FILE, AtomicReadFileAckHandler);
|
||||
|
||||
/* handle any errors coming back */
|
||||
apdu_set_error_handler(SERVICE_CONFIRMED_ATOMIC_READ_FILE,
|
||||
My_Error_Handler);
|
||||
apdu_set_error_handler(
|
||||
SERVICE_CONFIRMED_ATOMIC_READ_FILE, My_Error_Handler);
|
||||
|
||||
/* indicate that handlers are now registered */
|
||||
isAtomicReadFileHandlerRegistered = true;
|
||||
Executable → Regular
@@ -26,28 +26,28 @@
|
||||
#include <stdint.h>
|
||||
#include <string.h> /* for memmove */
|
||||
#include <time.h> /* for timezone, localtime */
|
||||
#include "bacdef.h"
|
||||
#include "bacdcode.h"
|
||||
#include "bacenum.h"
|
||||
#include "bacapp.h"
|
||||
#include "config.h" /* the custom stuff */
|
||||
#include "apdu.h"
|
||||
#include "wp.h" /* WriteProperty handling */
|
||||
#include "rp.h" /* ReadProperty handling */
|
||||
#include "dcc.h" /* DeviceCommunicationControl handling */
|
||||
#include "version.h"
|
||||
#include "device.h" /* me */
|
||||
#include "handlers.h"
|
||||
#include "datalink.h"
|
||||
#include "address.h"
|
||||
#include "bacnet/bacdef.h"
|
||||
#include "bacnet/bacdcode.h"
|
||||
#include "bacnet/bacenum.h"
|
||||
#include "bacnet/bacapp.h"
|
||||
#include "bacnet/config.h" /* the custom stuff */
|
||||
#include "bacnet/apdu.h"
|
||||
#include "bacnet/wp.h" /* WriteProperty handling */
|
||||
#include "bacnet/rp.h" /* ReadProperty handling */
|
||||
#include "bacnet/dcc.h" /* DeviceCommunicationControl handling */
|
||||
#include "bacnet/version.h"
|
||||
#include "bacnet/basic/object/device.h" /* me */
|
||||
#include "bacnet/basic/services.h"
|
||||
#include "bacnet/datalink/datalink.h"
|
||||
#include "bacnet/basic/binding/address.h"
|
||||
/* include the OS specific */
|
||||
#include "timer.h"
|
||||
#include "bacnet/basic/sys/mstimer.h"
|
||||
/* include the device object */
|
||||
#include "device.h"
|
||||
#include "bi.h"
|
||||
#include "bo.h"
|
||||
#include "bacnet/basic/object/device.h"
|
||||
#include "bacnet/basic/object/bi.h"
|
||||
#include "bacnet/basic/object/bo.h"
|
||||
#if (BACNET_PROTOCOL_REVISION >= 17)
|
||||
#include "netport.h"
|
||||
#include "bacnet/basic/object/netport.h"
|
||||
#endif
|
||||
|
||||
/* local forward (semi-private) and external prototypes */
|
||||
@@ -61,40 +61,42 @@ extern bool Routed_Device_Write_Property_Local(
|
||||
static object_functions_t *Object_Table;
|
||||
|
||||
static object_functions_t My_Object_Table[] = {
|
||||
{OBJECT_DEVICE, NULL /* Init - don't init Device or it will recourse! */,
|
||||
{ OBJECT_DEVICE, NULL /* Init - don't init Device or it will recourse! */,
|
||||
Device_Count, Device_Index_To_Instance,
|
||||
Device_Valid_Object_Instance_Number, Device_Object_Name,
|
||||
Device_Read_Property_Local, Device_Write_Property_Local,
|
||||
Device_Property_Lists, DeviceGetRRInfo, NULL /* Iterator */,
|
||||
NULL /* Value_Lists */, NULL /* COV */, NULL /* COV Clear */,
|
||||
NULL /* Intrinsic Reporting */},
|
||||
NULL /* Intrinsic Reporting */ },
|
||||
#if (BACNET_PROTOCOL_REVISION >= 17)
|
||||
{OBJECT_NETWORK_PORT, Network_Port_Init, Network_Port_Count,
|
||||
{ OBJECT_NETWORK_PORT, Network_Port_Init, Network_Port_Count,
|
||||
Network_Port_Index_To_Instance, Network_Port_Valid_Instance,
|
||||
Network_Port_Object_Name, Network_Port_Read_Property,
|
||||
Network_Port_Write_Property, Network_Port_Property_Lists,
|
||||
NULL /* ReadRangeInfo */, NULL /* Iterator */, NULL /* Value_Lists */,
|
||||
NULL /* COV */, NULL /* COV Clear */, NULL /* Intrinsic Reporting */},
|
||||
NULL /* COV */, NULL /* COV Clear */, NULL /* Intrinsic Reporting */ },
|
||||
#endif
|
||||
{OBJECT_BINARY_INPUT, Binary_Input_Init, Binary_Input_Count,
|
||||
{ OBJECT_BINARY_INPUT, Binary_Input_Init, Binary_Input_Count,
|
||||
Binary_Input_Index_To_Instance, Binary_Input_Valid_Instance,
|
||||
Binary_Input_Object_Name, Binary_Input_Read_Property,
|
||||
Binary_Input_Write_Property, Binary_Input_Property_Lists,
|
||||
NULL /* ReadRangeInfo */, NULL /* Iterator */,
|
||||
Binary_Input_Encode_Value_List, Binary_Input_Change_Of_Value,
|
||||
Binary_Input_Change_Of_Value_Clear, NULL /* Intrinsic Reporting */},
|
||||
{OBJECT_BINARY_OUTPUT, Binary_Output_Init, Binary_Output_Count,
|
||||
Binary_Input_Change_Of_Value_Clear, NULL /* Intrinsic Reporting */ },
|
||||
{ OBJECT_BINARY_OUTPUT, Binary_Output_Init, Binary_Output_Count,
|
||||
Binary_Output_Index_To_Instance, Binary_Output_Valid_Instance,
|
||||
Binary_Output_Object_Name, Binary_Output_Read_Property,
|
||||
Binary_Output_Write_Property, Binary_Output_Property_Lists,
|
||||
NULL /* ReadRangeInfo */, NULL /* Iterator */, NULL /* Value_Lists */,
|
||||
NULL /* COV */, NULL /* COV Clear */, NULL /* Intrinsic Reporting */},
|
||||
{MAX_BACNET_OBJECT_TYPE, NULL /* Init */, NULL /* Count */,
|
||||
NULL /* COV */, NULL /* COV Clear */, NULL /* Intrinsic Reporting */ },
|
||||
{ MAX_BACNET_OBJECT_TYPE, NULL /* Init */, NULL /* Count */,
|
||||
NULL /* Index_To_Instance */, NULL /* Valid_Instance */,
|
||||
NULL /* Object_Name */, NULL /* Read_Property */,
|
||||
NULL /* Write_Property */, NULL /* Property_Lists */,
|
||||
NULL /* ReadRangeInfo */, NULL /* Iterator */, NULL /* Value_Lists */,
|
||||
NULL /* COV */, NULL /* COV Clear */, NULL /* Intrinsic Reporting */}};
|
||||
NULL /* COV */, NULL /* COV Clear */,
|
||||
NULL /* Intrinsic Reporting */ }
|
||||
};
|
||||
|
||||
/** Glue function to let the Device object, when called by a handler,
|
||||
* lookup which Object type needs to be invoked.
|
||||
@@ -170,23 +172,19 @@ void Device_Objects_Property_List(BACNET_OBJECT_TYPE object_type,
|
||||
pObject = Device_Objects_Find_Functions(object_type);
|
||||
if ((pObject != NULL) && (pObject->Object_RPM_List != NULL)) {
|
||||
pObject->Object_RPM_List(&pPropertyList->Required.pList,
|
||||
&pPropertyList->Optional.pList,
|
||||
&pPropertyList->Proprietary.pList);
|
||||
&pPropertyList->Optional.pList, &pPropertyList->Proprietary.pList);
|
||||
}
|
||||
|
||||
/* Fetch the counts if available otherwise zero them */
|
||||
pPropertyList->Required.count =
|
||||
pPropertyList->Required.pList == NULL
|
||||
pPropertyList->Required.count = pPropertyList->Required.pList == NULL
|
||||
? 0
|
||||
: property_list_count(pPropertyList->Required.pList);
|
||||
|
||||
pPropertyList->Optional.count =
|
||||
pPropertyList->Optional.pList == NULL
|
||||
pPropertyList->Optional.count = pPropertyList->Optional.pList == NULL
|
||||
? 0
|
||||
: property_list_count(pPropertyList->Optional.pList);
|
||||
|
||||
pPropertyList->Proprietary.count =
|
||||
pPropertyList->Proprietary.pList == NULL
|
||||
pPropertyList->Proprietary.count = pPropertyList->Proprietary.pList == NULL
|
||||
? 0
|
||||
: property_list_count(pPropertyList->Proprietary.pList);
|
||||
|
||||
@@ -194,54 +192,39 @@ void Device_Objects_Property_List(BACNET_OBJECT_TYPE object_type,
|
||||
}
|
||||
|
||||
/* These three arrays are used by the ReadPropertyMultiple handler */
|
||||
static const int Device_Properties_Required[] = {
|
||||
PROP_OBJECT_IDENTIFIER,
|
||||
PROP_OBJECT_NAME,
|
||||
PROP_OBJECT_TYPE,
|
||||
PROP_SYSTEM_STATUS,
|
||||
PROP_VENDOR_NAME,
|
||||
PROP_VENDOR_IDENTIFIER,
|
||||
PROP_MODEL_NAME,
|
||||
PROP_FIRMWARE_REVISION,
|
||||
PROP_APPLICATION_SOFTWARE_VERSION,
|
||||
PROP_PROTOCOL_VERSION,
|
||||
PROP_PROTOCOL_REVISION,
|
||||
PROP_PROTOCOL_SERVICES_SUPPORTED,
|
||||
PROP_PROTOCOL_OBJECT_TYPES_SUPPORTED,
|
||||
PROP_OBJECT_LIST,
|
||||
PROP_MAX_APDU_LENGTH_ACCEPTED,
|
||||
PROP_SEGMENTATION_SUPPORTED,
|
||||
PROP_APDU_TIMEOUT,
|
||||
PROP_NUMBER_OF_APDU_RETRIES,
|
||||
PROP_DEVICE_ADDRESS_BINDING,
|
||||
PROP_DATABASE_REVISION,
|
||||
-1};
|
||||
static const int Device_Properties_Required[] = { PROP_OBJECT_IDENTIFIER,
|
||||
PROP_OBJECT_NAME, PROP_OBJECT_TYPE, PROP_SYSTEM_STATUS, PROP_VENDOR_NAME,
|
||||
PROP_VENDOR_IDENTIFIER, PROP_MODEL_NAME, PROP_FIRMWARE_REVISION,
|
||||
PROP_APPLICATION_SOFTWARE_VERSION, PROP_PROTOCOL_VERSION,
|
||||
PROP_PROTOCOL_REVISION, PROP_PROTOCOL_SERVICES_SUPPORTED,
|
||||
PROP_PROTOCOL_OBJECT_TYPES_SUPPORTED, PROP_OBJECT_LIST,
|
||||
PROP_MAX_APDU_LENGTH_ACCEPTED, PROP_SEGMENTATION_SUPPORTED,
|
||||
PROP_APDU_TIMEOUT, PROP_NUMBER_OF_APDU_RETRIES, PROP_DEVICE_ADDRESS_BINDING,
|
||||
PROP_DATABASE_REVISION, -1 };
|
||||
|
||||
static const int Device_Properties_Optional[] = {
|
||||
#if defined(BACDL_MSTP)
|
||||
PROP_MAX_MASTER,
|
||||
PROP_MAX_INFO_FRAMES,
|
||||
PROP_MAX_MASTER, PROP_MAX_INFO_FRAMES,
|
||||
#endif
|
||||
PROP_DESCRIPTION,
|
||||
PROP_LOCAL_TIME,
|
||||
PROP_UTC_OFFSET,
|
||||
PROP_LOCAL_DATE,
|
||||
PROP_DAYLIGHT_SAVINGS_STATUS,
|
||||
PROP_LOCATION,
|
||||
PROP_ACTIVE_COV_SUBSCRIPTIONS,
|
||||
-1};
|
||||
PROP_DESCRIPTION, PROP_LOCAL_TIME, PROP_UTC_OFFSET, PROP_LOCAL_DATE,
|
||||
PROP_DAYLIGHT_SAVINGS_STATUS, PROP_LOCATION, PROP_ACTIVE_COV_SUBSCRIPTIONS,
|
||||
-1
|
||||
};
|
||||
|
||||
static const int Device_Properties_Proprietary[] = {-1};
|
||||
static const int Device_Properties_Proprietary[] = { -1 };
|
||||
|
||||
void Device_Property_Lists(const int **pRequired, const int **pOptional,
|
||||
const int **pProprietary)
|
||||
void Device_Property_Lists(
|
||||
const int **pRequired, const int **pOptional, const int **pProprietary)
|
||||
{
|
||||
if (pRequired)
|
||||
if (pRequired) {
|
||||
*pRequired = Device_Properties_Required;
|
||||
if (pOptional)
|
||||
}
|
||||
if (pOptional) {
|
||||
*pOptional = Device_Properties_Optional;
|
||||
if (pProprietary)
|
||||
}
|
||||
if (pProprietary) {
|
||||
*pProprietary = Device_Properties_Proprietary;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -258,6 +241,7 @@ static char *Vendor_Name = BACNET_VENDOR_NAME;
|
||||
static uint16_t Vendor_Identifier = BACNET_VENDOR_ID;
|
||||
static char Model_Name[MAX_DEV_MOD_LEN + 1] = "PiFace Digital";
|
||||
static char Application_Software_Version[MAX_DEV_VER_LEN + 1] = "1.0";
|
||||
static const char *BACnet_Version = BACNET_VERSION_TEXT;
|
||||
static char Location[MAX_DEV_LOC_LEN + 1] = "USA";
|
||||
static char Description[MAX_DEV_DESC_LEN + 1] = "Raspberry PiFace Digital Demo";
|
||||
/* static uint8_t Protocol_Version = 1; - constant, not settable */
|
||||
@@ -403,8 +387,8 @@ bool Device_Valid_Object_Instance_Number(uint32_t object_id)
|
||||
return (Object_Instance_Number == object_id);
|
||||
}
|
||||
|
||||
bool Device_Object_Name(uint32_t object_instance,
|
||||
BACNET_CHARACTER_STRING *object_name)
|
||||
bool Device_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name)
|
||||
{
|
||||
bool status = false;
|
||||
|
||||
@@ -660,8 +644,8 @@ unsigned Device_Object_List_Count(void)
|
||||
* @param instance [out] The object's instance number, if found.
|
||||
* @return True if found, else false.
|
||||
*/
|
||||
bool Device_Object_List_Identifier(uint32_t array_index, int *object_type,
|
||||
uint32_t *instance)
|
||||
bool Device_Object_List_Identifier(
|
||||
uint32_t array_index, int *object_type, uint32_t *instance)
|
||||
{
|
||||
bool status = false;
|
||||
uint32_t count = 0;
|
||||
@@ -719,7 +703,8 @@ bool Device_Object_List_Identifier(uint32_t array_index, int *object_type,
|
||||
* @return True on success or else False if not found.
|
||||
*/
|
||||
bool Device_Valid_Object_Name(BACNET_CHARACTER_STRING *object_name1,
|
||||
int *object_type, uint32_t *object_instance)
|
||||
int *object_type,
|
||||
uint32_t *object_instance)
|
||||
{
|
||||
bool found = false;
|
||||
int type = 0;
|
||||
@@ -823,8 +808,7 @@ int tm_isdst Daylight Savings flag.
|
||||
|
||||
if (tblock) {
|
||||
datetime_set_date(&Local_Date, (uint16_t)tblock->tm_year + 1900,
|
||||
(uint8_t)tblock->tm_mon + 1,
|
||||
(uint8_t)tblock->tm_mday);
|
||||
(uint8_t)tblock->tm_mon + 1, (uint8_t)tblock->tm_mday);
|
||||
#if !defined(_MSC_VER)
|
||||
datetime_set_time(&Local_Time, (uint8_t)tblock->tm_hour,
|
||||
(uint8_t)tblock->tm_min, (uint8_t)tblock->tm_sec,
|
||||
@@ -873,8 +857,8 @@ int Device_Read_Property_Local(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
{
|
||||
int apdu_len = 0; /* return value */
|
||||
int len = 0; /* apdu len intermediate value */
|
||||
BACNET_BIT_STRING bit_string = {0};
|
||||
BACNET_CHARACTER_STRING char_string = {0};
|
||||
BACNET_BIT_STRING bit_string = { 0 };
|
||||
BACNET_CHARACTER_STRING char_string = { 0 };
|
||||
uint32_t i = 0;
|
||||
int object_type = 0;
|
||||
uint32_t instance = 0;
|
||||
@@ -892,8 +876,8 @@ int Device_Read_Property_Local(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
apdu_max = rpdata->application_data_len;
|
||||
switch (rpdata->object_property) {
|
||||
case PROP_OBJECT_IDENTIFIER:
|
||||
apdu_len = encode_application_object_id(&apdu[0], OBJECT_DEVICE,
|
||||
Object_Instance_Number);
|
||||
apdu_len = encode_application_object_id(
|
||||
&apdu[0], OBJECT_DEVICE, Object_Instance_Number);
|
||||
break;
|
||||
case PROP_OBJECT_NAME:
|
||||
apdu_len =
|
||||
@@ -929,8 +913,8 @@ int Device_Read_Property_Local(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
encode_application_character_string(&apdu[0], &char_string);
|
||||
break;
|
||||
case PROP_APPLICATION_SOFTWARE_VERSION:
|
||||
characterstring_init_ansi(&char_string,
|
||||
Application_Software_Version);
|
||||
characterstring_init_ansi(
|
||||
&char_string, Application_Software_Version);
|
||||
apdu_len =
|
||||
encode_application_character_string(&apdu[0], &char_string);
|
||||
break;
|
||||
@@ -957,20 +941,19 @@ int Device_Read_Property_Local(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
encode_application_boolean(&apdu[0], Daylight_Savings_Status);
|
||||
break;
|
||||
case PROP_PROTOCOL_VERSION:
|
||||
apdu_len = encode_application_unsigned(&apdu[0],
|
||||
Device_Protocol_Version());
|
||||
apdu_len = encode_application_unsigned(
|
||||
&apdu[0], Device_Protocol_Version());
|
||||
break;
|
||||
case PROP_PROTOCOL_REVISION:
|
||||
apdu_len = encode_application_unsigned(&apdu[0],
|
||||
Device_Protocol_Revision());
|
||||
apdu_len = encode_application_unsigned(
|
||||
&apdu[0], Device_Protocol_Revision());
|
||||
break;
|
||||
case PROP_PROTOCOL_SERVICES_SUPPORTED:
|
||||
/* Note: list of services that are executed, not initiated. */
|
||||
bitstring_init(&bit_string);
|
||||
for (i = 0; i < MAX_BACNET_SERVICES_SUPPORTED; i++) {
|
||||
/* automatic lookup based on handlers set */
|
||||
bitstring_set_bit(
|
||||
&bit_string, (uint8_t)i,
|
||||
bitstring_set_bit(&bit_string, (uint8_t)i,
|
||||
apdu_service_supported((BACNET_SERVICES_SUPPORTED)i));
|
||||
}
|
||||
apdu_len = encode_application_bitstring(&apdu[0], &bit_string);
|
||||
@@ -1005,8 +988,8 @@ int Device_Read_Property_Local(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
/* your maximum APDU size. */
|
||||
else if (rpdata->array_index == BACNET_ARRAY_ALL) {
|
||||
for (i = 1; i <= count; i++) {
|
||||
found = Device_Object_List_Identifier(i, &object_type,
|
||||
&instance);
|
||||
found = Device_Object_List_Identifier(
|
||||
i, &object_type, &instance);
|
||||
if (found) {
|
||||
len = encode_application_object_id(
|
||||
&apdu[apdu_len], object_type, instance);
|
||||
@@ -1030,8 +1013,8 @@ int Device_Read_Property_Local(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
found = Device_Object_List_Identifier(rpdata->array_index,
|
||||
&object_type, &instance);
|
||||
found = Device_Object_List_Identifier(
|
||||
rpdata->array_index, &object_type, &instance);
|
||||
if (found) {
|
||||
apdu_len = encode_application_object_id(
|
||||
&apdu[0], object_type, instance);
|
||||
@@ -1132,8 +1115,8 @@ bool Device_Write_Property_Local(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
||||
int temp;
|
||||
|
||||
/* decode the some of the request */
|
||||
len = bacapp_decode_application_data(wp_data->application_data,
|
||||
wp_data->application_data_len, &value);
|
||||
len = bacapp_decode_application_data(
|
||||
wp_data->application_data, wp_data->application_data_len, &value);
|
||||
if (len < 0) {
|
||||
/* error while decoding - a value larger than we can handle */
|
||||
wp_data->error_class = ERROR_CLASS_PROPERTY;
|
||||
@@ -1150,8 +1133,7 @@ bool Device_Write_Property_Local(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
||||
/* FIXME: len < application_data_len: more data? */
|
||||
switch (wp_data->object_property) {
|
||||
case PROP_OBJECT_IDENTIFIER:
|
||||
status =
|
||||
WPValidateArgType(&value, BACNET_APPLICATION_TAG_OBJECT_ID,
|
||||
status = WPValidateArgType(&value, BACNET_APPLICATION_TAG_OBJECT_ID,
|
||||
&wp_data->error_class, &wp_data->error_code);
|
||||
if (status) {
|
||||
if ((value.type.Object_Id.type == OBJECT_DEVICE) &&
|
||||
@@ -1213,8 +1195,8 @@ bool Device_Write_Property_Local(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
||||
}
|
||||
break;
|
||||
case PROP_OBJECT_NAME:
|
||||
status = WPValidateString(
|
||||
&value, characterstring_capacity(&My_Object_Name), false,
|
||||
status = WPValidateString(&value,
|
||||
characterstring_capacity(&My_Object_Name), false,
|
||||
&wp_data->error_class, &wp_data->error_code);
|
||||
if (status) {
|
||||
/* All the object names in a device must be unique */
|
||||
@@ -1235,8 +1217,7 @@ bool Device_Write_Property_Local(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
||||
}
|
||||
break;
|
||||
case PROP_LOCATION:
|
||||
status =
|
||||
WPValidateString(&value, MAX_DEV_LOC_LEN, true,
|
||||
status = WPValidateString(&value, MAX_DEV_LOC_LEN, true,
|
||||
&wp_data->error_class, &wp_data->error_code);
|
||||
if (status) {
|
||||
Device_Set_Location(
|
||||
@@ -1246,8 +1227,7 @@ bool Device_Write_Property_Local(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
||||
break;
|
||||
|
||||
case PROP_DESCRIPTION:
|
||||
status =
|
||||
WPValidateString(&value, MAX_DEV_DESC_LEN, true,
|
||||
status = WPValidateString(&value, MAX_DEV_DESC_LEN, true,
|
||||
&wp_data->error_class, &wp_data->error_code);
|
||||
if (status) {
|
||||
Device_Set_Description(
|
||||
@@ -1256,8 +1236,7 @@ bool Device_Write_Property_Local(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
||||
}
|
||||
break;
|
||||
case PROP_MODEL_NAME:
|
||||
status =
|
||||
WPValidateString(&value, MAX_DEV_MOD_LEN, true,
|
||||
status = WPValidateString(&value, MAX_DEV_MOD_LEN, true,
|
||||
&wp_data->error_class, &wp_data->error_code);
|
||||
if (status) {
|
||||
Device_Set_Model_Name(
|
||||
@@ -1612,7 +1591,8 @@ void Routing_Device_Init(uint32_t first_object_instance)
|
||||
#include "ctest.h"
|
||||
|
||||
bool WPValidateArgType(BACNET_APPLICATION_DATA_VALUE *pValue,
|
||||
uint8_t ucExpectedTag, BACNET_ERROR_CLASS *pErrorClass,
|
||||
uint8_t ucExpectedTag,
|
||||
BACNET_ERROR_CLASS *pErrorClass,
|
||||
BACNET_ERROR_CODE *pErrorCode)
|
||||
{
|
||||
pValue = pValue;
|
||||
@@ -1623,8 +1603,10 @@ bool WPValidateArgType(BACNET_APPLICATION_DATA_VALUE *pValue,
|
||||
return false;
|
||||
}
|
||||
|
||||
bool WPValidateString(BACNET_APPLICATION_DATA_VALUE *pValue, int iMaxLen,
|
||||
bool bEmptyAllowed, BACNET_ERROR_CLASS *pErrorClass,
|
||||
bool WPValidateString(BACNET_APPLICATION_DATA_VALUE *pValue,
|
||||
int iMaxLen,
|
||||
bool bEmptyAllowed,
|
||||
BACNET_ERROR_CLASS *pErrorClass,
|
||||
BACNET_ERROR_CODE *pErrorCode)
|
||||
{
|
||||
pValue = pValue;
|
||||
@@ -1656,12 +1638,12 @@ void testDevice(Test *pTest)
|
||||
ct_test(pTest, Device_Object_Instance_Number() == BACNET_MAX_INSTANCE);
|
||||
ct_test(pTest, status == true);
|
||||
status = Device_Set_Object_Instance_Number(BACNET_MAX_INSTANCE / 2);
|
||||
ct_test(pTest,
|
||||
Device_Object_Instance_Number() == (BACNET_MAX_INSTANCE / 2));
|
||||
ct_test(
|
||||
pTest, Device_Object_Instance_Number() == (BACNET_MAX_INSTANCE / 2));
|
||||
ct_test(pTest, status == true);
|
||||
status = Device_Set_Object_Instance_Number(BACNET_MAX_INSTANCE + 1);
|
||||
ct_test(pTest,
|
||||
Device_Object_Instance_Number() != (BACNET_MAX_INSTANCE + 1));
|
||||
ct_test(
|
||||
pTest, Device_Object_Instance_Number() != (BACNET_MAX_INSTANCE + 1));
|
||||
ct_test(pTest, status == false);
|
||||
|
||||
Device_Set_System_Status(STATUS_NON_OPERATIONAL, true);
|
||||
@@ -29,30 +29,30 @@
|
||||
#include <signal.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "address.h"
|
||||
#include "bacdef.h"
|
||||
#include "handlers.h"
|
||||
#include "client.h"
|
||||
#include "dlenv.h"
|
||||
#include "bacdcode.h"
|
||||
#include "npdu.h"
|
||||
#include "apdu.h"
|
||||
#include "iam.h"
|
||||
#include "tsm.h"
|
||||
#include "device.h"
|
||||
#include "bacfile.h"
|
||||
#include "datalink.h"
|
||||
#include "dcc.h"
|
||||
#include "getevent.h"
|
||||
#include "net.h"
|
||||
#include "txbuf.h"
|
||||
#include "tsm.h"
|
||||
#include "version.h"
|
||||
#include "bacnet/config.h"
|
||||
#include "bacnet/basic/binding/address.h"
|
||||
#include "bacnet/bacdef.h"
|
||||
#include "bacnet/basic/services.h"
|
||||
#include "bacnet/basic/services.h"
|
||||
#include "bacnet/datalink/dlenv.h"
|
||||
#include "bacnet/bacdcode.h"
|
||||
#include "bacnet/npdu.h"
|
||||
#include "bacnet/apdu.h"
|
||||
#include "bacnet/iam.h"
|
||||
#include "bacnet/basic/tsm/tsm.h"
|
||||
#include "bacnet/basic/object/device.h"
|
||||
#include "bacnet/basic/object/bacfile.h"
|
||||
#include "bacnet/datalink/datalink.h"
|
||||
#include "bacnet/dcc.h"
|
||||
#include "bacnet/getevent.h"
|
||||
#include "bacport.h"
|
||||
#include "bacnet/basic/tsm/tsm.h"
|
||||
#include "bacnet/basic/tsm/tsm.h"
|
||||
#include "bacnet/version.h"
|
||||
/* include the device object */
|
||||
#include "device.h"
|
||||
#include "bi.h"
|
||||
#include "bo.h"
|
||||
#include "bacnet/basic/object/device.h"
|
||||
#include "bacnet/basic/object/bi.h"
|
||||
#include "bacnet/basic/object/bo.h"
|
||||
#include "pifacedigital.h"
|
||||
|
||||
/** @file server/main.c Example server application using the BACnet Stack. */
|
||||
@@ -63,7 +63,10 @@
|
||||
/*@{*/
|
||||
|
||||
/** Buffer used for receiving */
|
||||
static uint8_t Rx_Buf[MAX_MPDU] = {0};
|
||||
static uint8_t Rx_Buf[MAX_MPDU] = { 0 };
|
||||
|
||||
/* current version of the BACnet stack */
|
||||
static const char *BACnet_Version = BACNET_VERSION_TEXT;
|
||||
|
||||
/** Initialize the handlers we will utilize.
|
||||
* @see Device_Init, apdu_set_unconfirmed_handler, apdu_set_confirmed_handler
|
||||
@@ -81,26 +84,26 @@ static void Init_Service_Handlers(void)
|
||||
apdu_set_unrecognized_service_handler_handler(handler_unrecognized_service);
|
||||
/* Set the handlers for any confirmed services that we support. */
|
||||
/* We must implement read property - it's required! */
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_PROPERTY,
|
||||
handler_read_property);
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_PROP_MULTIPLE,
|
||||
handler_read_property_multiple);
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_WRITE_PROPERTY,
|
||||
handler_write_property);
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_WRITE_PROP_MULTIPLE,
|
||||
handler_write_property_multiple);
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_RANGE,
|
||||
handler_read_range);
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_REINITIALIZE_DEVICE,
|
||||
handler_reinitialize_device);
|
||||
apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_UTC_TIME_SYNCHRONIZATION,
|
||||
handler_timesync_utc);
|
||||
apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_TIME_SYNCHRONIZATION,
|
||||
handler_timesync);
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_SUBSCRIBE_COV,
|
||||
handler_cov_subscribe);
|
||||
apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_COV_NOTIFICATION,
|
||||
handler_ucov_notification);
|
||||
apdu_set_confirmed_handler(
|
||||
SERVICE_CONFIRMED_READ_PROPERTY, handler_read_property);
|
||||
apdu_set_confirmed_handler(
|
||||
SERVICE_CONFIRMED_READ_PROP_MULTIPLE, handler_read_property_multiple);
|
||||
apdu_set_confirmed_handler(
|
||||
SERVICE_CONFIRMED_WRITE_PROPERTY, handler_write_property);
|
||||
apdu_set_confirmed_handler(
|
||||
SERVICE_CONFIRMED_WRITE_PROP_MULTIPLE, handler_write_property_multiple);
|
||||
apdu_set_confirmed_handler(
|
||||
SERVICE_CONFIRMED_READ_RANGE, handler_read_range);
|
||||
apdu_set_confirmed_handler(
|
||||
SERVICE_CONFIRMED_REINITIALIZE_DEVICE, handler_reinitialize_device);
|
||||
apdu_set_unconfirmed_handler(
|
||||
SERVICE_UNCONFIRMED_UTC_TIME_SYNCHRONIZATION, handler_timesync_utc);
|
||||
apdu_set_unconfirmed_handler(
|
||||
SERVICE_UNCONFIRMED_TIME_SYNCHRONIZATION, handler_timesync);
|
||||
apdu_set_confirmed_handler(
|
||||
SERVICE_CONFIRMED_SUBSCRIBE_COV, handler_cov_subscribe);
|
||||
apdu_set_unconfirmed_handler(
|
||||
SERVICE_UNCONFIRMED_COV_NOTIFICATION, handler_ucov_notification);
|
||||
/* handle communication so we can shutup when asked */
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_DEVICE_COMMUNICATION_CONTROL,
|
||||
handler_device_communication_control);
|
||||
@@ -131,8 +134,7 @@ static void piface_init(void)
|
||||
if (intenable == 0) {
|
||||
printf("Interrupts enabled.\n");
|
||||
} else {
|
||||
printf(
|
||||
"Could not enable interrupts. "
|
||||
printf("Could not enable interrupts. "
|
||||
"Try running using sudo to enable PiFaceDigital interrupts.\n");
|
||||
}
|
||||
#endif
|
||||
@@ -205,7 +207,7 @@ static void piface_task(void)
|
||||
*/
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
BACNET_ADDRESS src = {0}; /* address where message came from */
|
||||
BACNET_ADDRESS src = { 0 }; /* address where message came from */
|
||||
uint16_t pdu_len = 0;
|
||||
unsigned timeout = 1; /* milliseconds */
|
||||
time_t last_seconds = 0;
|
||||
@@ -218,8 +220,7 @@ int main(int argc, char *argv[])
|
||||
if (argc > 1) {
|
||||
Device_Set_Object_Instance_Number(strtol(argv[1], NULL, 0));
|
||||
}
|
||||
printf(
|
||||
"BACnet Raspberry Pi PiFace Digital Demo\n"
|
||||
printf("BACnet Raspberry Pi PiFace Digital Demo\n"
|
||||
"BACnet Stack Version %s\n"
|
||||
"BACnet Device ID: %u\n"
|
||||
"Max APDU: %d\n",
|
||||
@@ -27,21 +27,15 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include "config.h"
|
||||
#include "txbuf.h"
|
||||
#include "bacdef.h"
|
||||
#include "bacdcode.h"
|
||||
#include "apdu.h"
|
||||
#include "npdu.h"
|
||||
#include "abort.h"
|
||||
/*#include "arf.h" */
|
||||
/* demo objects */
|
||||
#if defined(BACFILE)
|
||||
#include "bacfile.h"
|
||||
#endif
|
||||
#include "mydata.h"
|
||||
#include "ptransfer.h"
|
||||
#include "handlers.h"
|
||||
#include "bacnet/config.h"
|
||||
#include "bacnet/bacdef.h"
|
||||
#include "bacnet/bacdcode.h"
|
||||
#include "bacnet/apdu.h"
|
||||
#include "bacnet/npdu.h"
|
||||
#include "bacnet/abort.h"
|
||||
#include "bacnet/ptransfer.h"
|
||||
#include "bacnet/basic/services.h"
|
||||
#include "bacnet/basic/tsm/tsm.h"
|
||||
|
||||
/** @file h_pt.c Handles Confirmed Private Transfer requests. */
|
||||
|
||||
@@ -65,8 +59,8 @@ static void ProcessPT(BACNET_PRIVATE_TRANSFER_DATA *data)
|
||||
iLen = 0;
|
||||
|
||||
/* Decode the block number */
|
||||
tag_len = decode_tag_number_and_value(&data->serviceParameters[iLen],
|
||||
&tag_number, &len_value_type);
|
||||
tag_len = decode_tag_number_and_value(
|
||||
&data->serviceParameters[iLen], &tag_number, &len_value_type);
|
||||
iLen += tag_len;
|
||||
if (tag_number != BACNET_APPLICATION_TAG_UNSIGNED_INT) {
|
||||
/* Bail out early if wrong type */
|
||||
@@ -75,8 +69,8 @@ static void ProcessPT(BACNET_PRIVATE_TRANSFER_DATA *data)
|
||||
return;
|
||||
}
|
||||
|
||||
iLen += decode_unsigned(&data->serviceParameters[iLen], len_value_type,
|
||||
&ulTemp);
|
||||
iLen += decode_unsigned(
|
||||
&data->serviceParameters[iLen], len_value_type, &ulTemp);
|
||||
cBlockNumber = (char)ulTemp;
|
||||
if (cBlockNumber < MY_MAX_BLOCK) {
|
||||
if (data->serviceNumber == MY_SVC_READ) {
|
||||
@@ -124,8 +118,8 @@ static void ProcessPT(BACNET_PRIVATE_TRANSFER_DATA *data)
|
||||
data->serviceParametersLen = 0;
|
||||
return;
|
||||
}
|
||||
iLen += decode_unsigned(&data->serviceParameters[iLen],
|
||||
len_value_type, &ulTemp);
|
||||
iLen += decode_unsigned(
|
||||
&data->serviceParameters[iLen], len_value_type, &ulTemp);
|
||||
MyData[(int8_t)cBlockNumber].cMyByte1 = (char)ulTemp;
|
||||
|
||||
tag_len = decode_tag_number_and_value(
|
||||
@@ -135,8 +129,8 @@ static void ProcessPT(BACNET_PRIVATE_TRANSFER_DATA *data)
|
||||
data->serviceParametersLen = 0;
|
||||
return;
|
||||
}
|
||||
iLen += decode_unsigned(&data->serviceParameters[iLen],
|
||||
len_value_type, &ulTemp);
|
||||
iLen += decode_unsigned(
|
||||
&data->serviceParameters[iLen], len_value_type, &ulTemp);
|
||||
MyData[(int8_t)cBlockNumber].cMyByte2 = (char)ulTemp;
|
||||
|
||||
tag_len = decode_tag_number_and_value(
|
||||
@@ -156,8 +150,8 @@ static void ProcessPT(BACNET_PRIVATE_TRANSFER_DATA *data)
|
||||
data->serviceParametersLen = 0;
|
||||
return;
|
||||
}
|
||||
decode_character_string(&data->serviceParameters[iLen],
|
||||
len_value_type, &bsTemp);
|
||||
decode_character_string(
|
||||
&data->serviceParameters[iLen], len_value_type, &bsTemp);
|
||||
/* Only copy as much as we can accept */
|
||||
strncpy((char *)MyData[(int8_t)cBlockNumber].sMyString,
|
||||
characterstring_value(&bsTemp), MY_MAX_STR);
|
||||
@@ -184,7 +178,8 @@ static void ProcessPT(BACNET_PRIVATE_TRANSFER_DATA *data)
|
||||
*
|
||||
*/
|
||||
|
||||
void handler_conf_private_trans(uint8_t *service_request, uint16_t service_len,
|
||||
void handler_conf_private_trans(uint8_t *service_request,
|
||||
uint16_t service_len,
|
||||
BACNET_ADDRESS *src,
|
||||
BACNET_CONFIRMED_SERVICE_DATA *service_data)
|
||||
{
|
||||
@@ -213,13 +208,13 @@ void handler_conf_private_trans(uint8_t *service_request, uint16_t service_len,
|
||||
|
||||
datalink_get_my_address(&my_address);
|
||||
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
||||
pdu_len = npdu_encode_pdu(&Handler_Transmit_Buffer[0], src, &my_address,
|
||||
&npdu_data);
|
||||
pdu_len = npdu_encode_pdu(
|
||||
&Handler_Transmit_Buffer[0], src, &my_address, &npdu_data);
|
||||
|
||||
if (service_data->segmented_message) {
|
||||
len = abort_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
||||
service_data->invoke_id,
|
||||
ABORT_REASON_SEGMENTATION_NOT_SUPPORTED, true);
|
||||
service_data->invoke_id, ABORT_REASON_SEGMENTATION_NOT_SUPPORTED,
|
||||
true);
|
||||
#if PRINT_ENABLED
|
||||
fprintf(stderr, "CPT: Segmented Message. Sending Abort!\n");
|
||||
#endif
|
||||
@@ -230,8 +225,7 @@ void handler_conf_private_trans(uint8_t *service_request, uint16_t service_len,
|
||||
/* bad decoding - send an abort */
|
||||
if (len < 0) {
|
||||
len = abort_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
||||
service_data->invoke_id, ABORT_REASON_OTHER,
|
||||
true);
|
||||
service_data->invoke_id, ABORT_REASON_OTHER, true);
|
||||
#if PRINT_ENABLED
|
||||
fprintf(stderr, "CPT: Bad Encoding. Sending Abort!\n");
|
||||
#endif
|
||||
@@ -258,8 +252,8 @@ void handler_conf_private_trans(uint8_t *service_request, uint16_t service_len,
|
||||
fprintf(stderr, "CPT: Error servicing request!\n");
|
||||
#endif
|
||||
}
|
||||
len = ptransfer_ack_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
||||
service_data->invoke_id, &data);
|
||||
len = ptransfer_ack_encode_apdu(
|
||||
&Handler_Transmit_Buffer[pdu_len], service_data->invoke_id, &data);
|
||||
} else { /* Not our vendor ID or bad service parameter */
|
||||
|
||||
error = true;
|
||||
@@ -272,13 +266,12 @@ void handler_conf_private_trans(uint8_t *service_request, uint16_t service_len,
|
||||
|
||||
if (error) {
|
||||
len = ptransfer_error_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
||||
service_data->invoke_id, error_class,
|
||||
error_code, &data);
|
||||
service_data->invoke_id, error_class, error_code, &data);
|
||||
}
|
||||
CPT_ABORT:
|
||||
pdu_len += len;
|
||||
bytes_sent = datalink_send_pdu(src, &npdu_data, &Handler_Transmit_Buffer[0],
|
||||
pdu_len);
|
||||
bytes_sent = datalink_send_pdu(
|
||||
src, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
|
||||
|
||||
#if PRINT_ENABLED
|
||||
if (bytes_sent <= 0) {
|
||||
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* @file
|
||||
* @author Steve Karg
|
||||
* @date October 2019
|
||||
* @brief Header file for a basic ConfirmedPrivateTransfer service handler
|
||||
*
|
||||
* @section LICENSE
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#ifndef HANDLER_CONFIRMED_PRIVATE_TRANSFER_H
|
||||
#define HANDLER_CONFIRMED_PRIVATE_TRANSFER_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include "bacnet/bacdef.h"
|
||||
#include "bacnet/bacenum.h"
|
||||
#include "bacnet/apdu.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
void handler_conf_private_trans(
|
||||
uint8_t * service_request,
|
||||
uint16_t service_len,
|
||||
BACNET_ADDRESS * src,
|
||||
BACNET_CONFIRMED_SERVICE_DATA * service_data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
@@ -27,21 +27,15 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include "config.h"
|
||||
#include "txbuf.h"
|
||||
#include "bacdef.h"
|
||||
#include "bacdcode.h"
|
||||
#include "apdu.h"
|
||||
#include "npdu.h"
|
||||
#include "abort.h"
|
||||
/*#include "arf.h" */
|
||||
/* demo objects */
|
||||
#include "ptransfer.h"
|
||||
#include "mydata.h"
|
||||
#if defined(BACFILE)
|
||||
#include "bacfile.h"
|
||||
#endif
|
||||
#include "handlers.h"
|
||||
#include "bacnet/config.h"
|
||||
#include "bacnet/bacdef.h"
|
||||
#include "bacnet/bacdcode.h"
|
||||
#include "bacnet/apdu.h"
|
||||
#include "bacnet/npdu.h"
|
||||
#include "bacnet/abort.h"
|
||||
#include "bacnet/ptransfer.h"
|
||||
#include "bacnet/basic/services.h"
|
||||
#include "bacnet/basic/tsm/tsm.h"
|
||||
|
||||
/** @file h_pt_a.c Handles Confirmed Private Transfer Acknowledgment. */
|
||||
|
||||
@@ -96,8 +90,8 @@ static void DecodeBlock(char cBlockNum, uint8_t *pData)
|
||||
return;
|
||||
|
||||
iLen += decode_character_string(&pData[iLen], len_value_type, &bsName);
|
||||
strncpy((char *)Response.sMyString, characterstring_value(&bsName),
|
||||
MY_MAX_STR);
|
||||
strncpy(
|
||||
(char *)Response.sMyString, characterstring_value(&bsName), MY_MAX_STR);
|
||||
Response.sMyString[MY_MAX_STR] = '\0'; /* Make sure it is nul terminated */
|
||||
|
||||
printf("Private Transfer Read Block Response\n");
|
||||
@@ -122,8 +116,8 @@ static void ProcessPTA(BACNET_PRIVATE_TRANSFER_DATA *data)
|
||||
|
||||
/* Error code is returned for read and write operations */
|
||||
|
||||
tag_len = decode_tag_number_and_value(&data->serviceParameters[iLen],
|
||||
&tag_number, &len_value_type);
|
||||
tag_len = decode_tag_number_and_value(
|
||||
&data->serviceParameters[iLen], &tag_number, &len_value_type);
|
||||
iLen += tag_len;
|
||||
if (tag_number != BACNET_APPLICATION_TAG_UNSIGNED_INT) {
|
||||
#if PRINT_ENABLED
|
||||
@@ -131,8 +125,8 @@ static void ProcessPTA(BACNET_PRIVATE_TRANSFER_DATA *data)
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
iLen += decode_unsigned(&data->serviceParameters[iLen], len_value_type,
|
||||
&uiErrorCode);
|
||||
iLen += decode_unsigned(
|
||||
&data->serviceParameters[iLen], len_value_type, &uiErrorCode);
|
||||
|
||||
if (data->serviceNumber == MY_SVC_READ) { /* Read I/O block so should be
|
||||
full block of data or error */
|
||||
@@ -151,8 +145,8 @@ static void ProcessPTA(BACNET_PRIVATE_TRANSFER_DATA *data)
|
||||
return;
|
||||
}
|
||||
|
||||
iLen += decode_unsigned(&data->serviceParameters[iLen],
|
||||
len_value_type, &ulTemp);
|
||||
iLen += decode_unsigned(
|
||||
&data->serviceParameters[iLen], len_value_type, &ulTemp);
|
||||
cBlockNumber = (char)ulTemp;
|
||||
DecodeBlock(cBlockNumber, &data->serviceParameters[iLen]);
|
||||
} else { /* Read error */
|
||||
@@ -172,8 +166,9 @@ static void ProcessPTA(BACNET_PRIVATE_TRANSFER_DATA *data)
|
||||
* and decide what to do next...
|
||||
*/
|
||||
|
||||
void handler_conf_private_trans_ack(
|
||||
uint8_t *service_request, uint16_t service_len, BACNET_ADDRESS *src,
|
||||
void handler_conf_private_trans_ack(uint8_t *service_request,
|
||||
uint16_t service_len,
|
||||
BACNET_ADDRESS *src,
|
||||
BACNET_CONFIRMED_SERVICE_ACK_DATA *service_data)
|
||||
{
|
||||
BACNET_PRIVATE_TRANSFER_DATA data;
|
||||
@@ -195,8 +190,7 @@ void handler_conf_private_trans_ack(
|
||||
printf("Received Confirmed Private Transfer Ack!\n");
|
||||
#endif
|
||||
|
||||
len = ptransfer_decode_service_request(
|
||||
service_request, service_len,
|
||||
len = ptransfer_decode_service_request(service_request, service_len,
|
||||
&data); /* Same decode for ack as for service request! */
|
||||
if (len < 0) {
|
||||
#if PRINT_ENABLED
|
||||
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* @file
|
||||
* @author Steve Karg
|
||||
* @date October 2019
|
||||
* @brief Header file for a basic ConfirmedPrivateTransfer-Ack service handler
|
||||
*
|
||||
* @section LICENSE
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#ifndef HANDLER_CONFIRMED_PRIVATE_TRANSFER_ACK_H
|
||||
#define HANDLER_CONFIRMED_PRIVATE_TRANSFER_ACK_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include "bacnet/bacdef.h"
|
||||
#include "bacnet/bacenum.h"
|
||||
#include "bacnet/apdu.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
void handler_conf_private_trans_ack(
|
||||
uint8_t * service_request,
|
||||
uint16_t service_len,
|
||||
BACNET_ADDRESS * src,
|
||||
BACNET_CONFIRMED_SERVICE_ACK_DATA * service_data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
@@ -35,41 +35,47 @@
|
||||
#endif
|
||||
#define PRINT_ENABLED 1
|
||||
|
||||
#include "bacdef.h"
|
||||
#include "config.h"
|
||||
#include "bactext.h"
|
||||
#include "bacerror.h"
|
||||
#include "iam.h"
|
||||
#include "arf.h"
|
||||
#include "tsm.h"
|
||||
#include "address.h"
|
||||
#include "npdu.h"
|
||||
#include "apdu.h"
|
||||
#include "device.h"
|
||||
#include "net.h"
|
||||
#include "datalink.h"
|
||||
#include "whois.h"
|
||||
#include "bacnet/bacdef.h"
|
||||
#include "bacnet/config.h"
|
||||
#include "bacnet/bactext.h"
|
||||
#include "bacnet/bacerror.h"
|
||||
#include "bacnet/iam.h"
|
||||
#include "bacnet/arf.h"
|
||||
#include "bacnet/npdu.h"
|
||||
#include "bacnet/apdu.h"
|
||||
#include "bacnet/whois.h"
|
||||
/* some demo stuff needed */
|
||||
#include "filename.h"
|
||||
#include "handlers.h"
|
||||
#include "client.h"
|
||||
#include "txbuf.h"
|
||||
#include "dlenv.h"
|
||||
#include "mydata.h"
|
||||
#include "bacnet/basic/tsm/tsm.h"
|
||||
#include "bacnet/basic/binding/address.h"
|
||||
#include "bacnet/basic/object/device.h"
|
||||
#include "bacnet/basic/sys/filename.h"
|
||||
#include "bacnet/basic/services.h"
|
||||
#include "bacnet/datalink/datalink.h"
|
||||
#include "bacnet/datalink/dlenv.h"
|
||||
|
||||
#if defined(__BORLANDC__)
|
||||
#define _kbhit kbhit
|
||||
#define _stricmp stricmp
|
||||
#endif
|
||||
|
||||
extern uint8_t Send_Private_Transfer_Request(uint32_t device_id,
|
||||
uint16_t vendor_id,
|
||||
uint32_t service_number,
|
||||
char block_number,
|
||||
DATABLOCK *block);
|
||||
#define MY_MAX_STR 32
|
||||
#define MY_MAX_BLOCK 8
|
||||
|
||||
#define MY_SVC_READ 0
|
||||
#define MY_SVC_WRITE 1
|
||||
|
||||
#define MY_ERR_OK 0
|
||||
#define MY_ERR_BAD_INDEX 1
|
||||
|
||||
typedef struct MyData {
|
||||
uint8_t cMyByte1;
|
||||
uint8_t cMyByte2;
|
||||
float fMyReal;
|
||||
int8_t sMyString[MY_MAX_STR + 1]; /* A little extra for the nul */
|
||||
} DATABLOCK;
|
||||
|
||||
/* buffer used for receive */
|
||||
static uint8_t Rx_Buf[MAX_MPDU] = {0};
|
||||
static uint8_t Rx_Buf[MAX_MPDU] = { 0 };
|
||||
|
||||
/* global variables used in this file */
|
||||
static uint32_t Target_Device_Object_Instance = BACNET_MAX_INSTANCE;
|
||||
@@ -79,7 +85,8 @@ static int Target_Mode = 0;
|
||||
static BACNET_ADDRESS Target_Address;
|
||||
static bool Error_Detected = false;
|
||||
|
||||
static void MyErrorHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
static void MyErrorHandler(BACNET_ADDRESS *src,
|
||||
uint8_t invoke_id,
|
||||
BACNET_ERROR_CLASS error_class,
|
||||
BACNET_ERROR_CODE error_code)
|
||||
{
|
||||
@@ -92,20 +99,20 @@ static void MyErrorHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
/* Error_Detected = true; */
|
||||
}
|
||||
|
||||
void MyAbortHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
uint8_t abort_reason, bool server)
|
||||
static void MyAbortHandler(
|
||||
BACNET_ADDRESS *src, uint8_t invoke_id, uint8_t abort_reason, bool server)
|
||||
{
|
||||
/* FIXME: verify src and invoke id */
|
||||
(void)src;
|
||||
(void)invoke_id;
|
||||
(void)server;
|
||||
printf("BACnet Abort: %s\r\n",
|
||||
bactext_abort_reason_name((int)abort_reason));
|
||||
printf(
|
||||
"BACnet Abort: %s\r\n", bactext_abort_reason_name((int)abort_reason));
|
||||
Error_Detected = true;
|
||||
}
|
||||
|
||||
void MyRejectHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
uint8_t reject_reason)
|
||||
static void MyRejectHandler(
|
||||
BACNET_ADDRESS *src, uint8_t invoke_id, uint8_t reject_reason)
|
||||
{
|
||||
/* FIXME: verify src and invoke id */
|
||||
(void)src;
|
||||
@@ -127,17 +134,17 @@ static void Init_Service_Handlers(void)
|
||||
It is required to send the proper reject message... */
|
||||
apdu_set_unrecognized_service_handler_handler(handler_unrecognized_service);
|
||||
/* we must implement read property - it's required! */
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_PROPERTY,
|
||||
handler_read_property);
|
||||
apdu_set_confirmed_handler(
|
||||
SERVICE_CONFIRMED_READ_PROPERTY, handler_read_property);
|
||||
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_PRIVATE_TRANSFER,
|
||||
handler_conf_private_trans);
|
||||
apdu_set_confirmed_handler(
|
||||
SERVICE_CONFIRMED_PRIVATE_TRANSFER, handler_conf_private_trans);
|
||||
/* handle the data coming back from confirmed requests */
|
||||
apdu_set_confirmed_ack_handler(SERVICE_CONFIRMED_READ_PROPERTY,
|
||||
handler_read_property_ack);
|
||||
apdu_set_confirmed_ack_handler(
|
||||
SERVICE_CONFIRMED_READ_PROPERTY, handler_read_property_ack);
|
||||
|
||||
apdu_set_confirmed_ack_handler(SERVICE_CONFIRMED_PRIVATE_TRANSFER,
|
||||
handler_conf_private_trans_ack);
|
||||
apdu_set_confirmed_ack_handler(
|
||||
SERVICE_CONFIRMED_PRIVATE_TRANSFER, handler_conf_private_trans_ack);
|
||||
|
||||
/* handle any errors coming back */
|
||||
apdu_set_error_handler(SERVICE_CONFIRMED_READ_PROPERTY, MyErrorHandler);
|
||||
@@ -146,9 +153,22 @@ static void Init_Service_Handlers(void)
|
||||
apdu_set_reject_handler(MyRejectHandler);
|
||||
}
|
||||
|
||||
len += encode_application_unsigned(
|
||||
&pt_req_buffer[len], block_number); /* The block number */
|
||||
len += encode_application_unsigned(
|
||||
&pt_req_buffer[len], block->cMyByte1); /* And Then the block contents */
|
||||
len += encode_application_unsigned(&pt_req_buffer[len], block->cMyByte2);
|
||||
len += encode_application_real(&pt_req_buffer[len], block->fMyReal);
|
||||
characterstring_init_ansi(&bsTemp, (char *)block->sMyString);
|
||||
len += encode_application_character_string(&pt_req_buffer[len], &bsTemp);
|
||||
}
|
||||
|
||||
pt_block.serviceParameters = &pt_req_buffer[0];
|
||||
pt_block.serviceParametersLen = len;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
BACNET_ADDRESS src = {0}; /* address where message came from */
|
||||
BACNET_ADDRESS src = { 0 }; /* address where message came from */
|
||||
uint16_t pdu_len = 0;
|
||||
unsigned timeout = 100; /* milliseconds */
|
||||
unsigned max_apdu = 0;
|
||||
@@ -166,8 +186,7 @@ int main(int argc, char *argv[])
|
||||
if (((argc != 2) && (argc != 3)) ||
|
||||
((argc >= 2) && (strcmp(argv[1], "--help") == 0))) {
|
||||
printf("%s\n", argv[0]);
|
||||
printf(
|
||||
"Usage: %s server local-device-instance\r\n or\r\n"
|
||||
printf("Usage: %s server local-device-instance\r\n or\r\n"
|
||||
" %s remote-device-instance\r\n",
|
||||
filename_remove_path(argv[0]), filename_remove_path(argv[0]));
|
||||
if ((argc > 1) && (strcmp(argv[1], "--help") == 0)) {
|
||||
@@ -194,10 +213,11 @@ int main(int argc, char *argv[])
|
||||
return 0;
|
||||
}
|
||||
/* decode the command line parameters */
|
||||
if (_stricmp(argv[1], "server") == 0)
|
||||
if (_stricmp(argv[1], "server") == 0) {
|
||||
Target_Mode = 1;
|
||||
else
|
||||
} else {
|
||||
Target_Mode = 0;
|
||||
}
|
||||
|
||||
Target_Device_Object_Instance = strtol(argv[1 + Target_Mode], NULL, 0);
|
||||
|
||||
@@ -208,10 +228,12 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
/* setup my info */
|
||||
if (Target_Mode)
|
||||
if (Target_Mode) {
|
||||
Device_Set_Object_Instance_Number(Target_Device_Object_Instance);
|
||||
else
|
||||
Device_Set_Object_Instance_Number(BACNET_MAX_INSTANCE);
|
||||
} else {
|
||||
Device_Set_Object_Instance_Number
|
||||
}
|
||||
(BACNET_MAX_INSTANCE);
|
||||
|
||||
address_init();
|
||||
Init_Service_Handlers();
|
||||
@@ -255,11 +277,11 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
} else {
|
||||
/* try to bind with the device */
|
||||
found = address_bind_request(Target_Device_Object_Instance, &max_apdu,
|
||||
&Target_Address);
|
||||
found = address_bind_request(
|
||||
Target_Device_Object_Instance, &max_apdu, &Target_Address);
|
||||
if (!found) {
|
||||
Send_WhoIs(Target_Device_Object_Instance,
|
||||
Target_Device_Object_Instance);
|
||||
Send_WhoIs(
|
||||
Target_Device_Object_Instance, Target_Device_Object_Instance);
|
||||
}
|
||||
/* loop forever */
|
||||
for (;;) {
|
||||
@@ -274,15 +296,16 @@ int main(int argc, char *argv[])
|
||||
npdu_handler(&src, &Rx_Buf[0], pdu_len);
|
||||
}
|
||||
/* at least one second has passed */
|
||||
if (current_seconds != last_seconds)
|
||||
if (current_seconds != last_seconds) {
|
||||
tsm_timer_milliseconds(
|
||||
((current_seconds - last_seconds) * 1000));
|
||||
}
|
||||
if (Error_Detected)
|
||||
break;
|
||||
/* wait until the device is bound, or timeout and quit */
|
||||
if (!found)
|
||||
found = address_bind_request(Target_Device_Object_Instance,
|
||||
&max_apdu, &Target_Address);
|
||||
found = address_bind_request(
|
||||
Target_Device_Object_Instance, &max_apdu, &Target_Address);
|
||||
if (found) {
|
||||
if (invoke_id == 0) { /* Safe to send a new request */
|
||||
switch (iType) {
|
||||
@@ -290,9 +313,10 @@ int main(int argc, char *argv[])
|
||||
NewData.cMyByte1 = iCount;
|
||||
NewData.cMyByte2 = 255 - iCount;
|
||||
NewData.fMyReal = (float)iCount;
|
||||
strcpy((char *)NewData.sMyString,
|
||||
"Test Data - [x]");
|
||||
strcpy(
|
||||
(char *)NewData.sMyString, "Test Data - [x]");
|
||||
NewData.sMyString[13] = 'a' + iCount;
|
||||
pt_write_block_to_server()
|
||||
printf("Sending block %d\n", iCount);
|
||||
invoke_id = Send_Private_Transfer_Request(
|
||||
Target_Device_Object_Instance, BACNET_VENDOR_ID,
|
||||
@@ -326,8 +350,7 @@ int main(int argc, char *argv[])
|
||||
case 3:
|
||||
case 5:
|
||||
case 7:
|
||||
printf(
|
||||
"Requesting block %d with invalid "
|
||||
printf("Requesting block %d with invalid "
|
||||
"Vendor ID\n",
|
||||
iCount);
|
||||
invoke_id = Send_Private_Transfer_Request(
|
||||
@@ -348,9 +371,10 @@ int main(int argc, char *argv[])
|
||||
iCount = 0;
|
||||
invoke_id = 0;
|
||||
|
||||
if (iType > 2)
|
||||
if (iType > 2) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (tsm_invoke_id_failed(invoke_id)) {
|
||||
fprintf(stderr, "\rError: TSM Timeout!\r\n");
|
||||
tsm_free_invoke_id(invoke_id);
|
||||
@@ -0,0 +1,123 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright (C) 2006 Steve Karg <skarg@users.sourceforge.net>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*********************************************************************/
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include "bacnet/config.h"
|
||||
#include "bacnet/bacdef.h"
|
||||
#include "bacnet/bacdcode.h"
|
||||
#include "bacnet/npdu.h"
|
||||
#include "bacnet/apdu.h"
|
||||
#include "bacnet/dcc.h"
|
||||
#include "bacnet/ptransfer.h"
|
||||
/* some demo stuff needed */
|
||||
#include "bacnet/basic/binding/address.h"
|
||||
#include "bacnet/basic/tsm/tsm.h"
|
||||
#include "bacnet/basic/object/device.h"
|
||||
#include "bacnet/datalink/datalink.h"
|
||||
#include "bacnet/basic/services.h"
|
||||
|
||||
/** @file s_ptransfer.c Send a Private Transfer request. */
|
||||
|
||||
uint8_t Send_Private_Transfer_Request(uint32_t device_id,
|
||||
uint16_t vendor_id,
|
||||
uint32_t service_number,
|
||||
unsigned int block_number,
|
||||
char *block)
|
||||
{ /* NULL=optional */
|
||||
BACNET_ADDRESS dest;
|
||||
BACNET_ADDRESS my_address;
|
||||
unsigned max_apdu = 0;
|
||||
uint8_t invoke_id = 0;
|
||||
bool status = false;
|
||||
int len = 0;
|
||||
int pdu_len = 0;
|
||||
int bytes_sent = 0;
|
||||
BACNET_NPDU_DATA npdu_data;
|
||||
static uint8_t
|
||||
pt_req_buffer[300]; /* Somewhere to build the request packet */
|
||||
BACNET_PRIVATE_TRANSFER_DATA private_data;
|
||||
|
||||
/* if we are forbidden to send, don't send! */
|
||||
if (!dcc_communication_enabled()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* is the device bound? */
|
||||
status = address_get_by_device(device_id, &max_apdu, &dest);
|
||||
/* is there a tsm available? */
|
||||
if (status)
|
||||
invoke_id = tsm_next_free_invokeID();
|
||||
if (invoke_id) {
|
||||
/* encode the NPDU portion of the packet */
|
||||
datalink_get_my_address(&my_address);
|
||||
npdu_encode_npdu_data(&npdu_data, true, MESSAGE_PRIORITY_NORMAL);
|
||||
pdu_len = npdu_encode_pdu(
|
||||
&Handler_Transmit_Buffer[0], &dest, &my_address, &npdu_data);
|
||||
/* encode the APDU portion of the packet */
|
||||
private_data.vendorID = vendor_id;
|
||||
private_data.serviceNumber = service_number;
|
||||
len = uptransfer_encode_apdu(
|
||||
&Handler_Transmit_Buffer[pdu_len], &private_data);
|
||||
pdu_len += len;
|
||||
|
||||
if (service_number == MY_SVC_READ) {
|
||||
} else {
|
||||
len = ptransfer_encode_apdu(
|
||||
&Handler_Transmit_Buffer[pdu_len], invoke_id, &pt_block);
|
||||
pdu_len += len;
|
||||
|
||||
/* will it fit in the sender?
|
||||
note: if there is a bottleneck router in between
|
||||
us and the destination, we won't know unless
|
||||
we have a way to check for that and update the
|
||||
max_apdu in the address binding table. */
|
||||
|
||||
if ((unsigned)pdu_len < max_apdu) {
|
||||
tsm_set_confirmed_unsegmented_transaction(invoke_id, &dest,
|
||||
&npdu_data, &Handler_Transmit_Buffer[0], (uint16_t)pdu_len);
|
||||
bytes_sent = datalink_send_pdu(
|
||||
&dest, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
|
||||
#if PRINT_ENABLED
|
||||
if (bytes_sent <= 0)
|
||||
fprintf(stderr,
|
||||
"Failed to Send Private Transfer Request (%s)!\n",
|
||||
strerror(errno));
|
||||
#endif
|
||||
} else {
|
||||
tsm_free_invoke_id(invoke_id);
|
||||
invoke_id = 0;
|
||||
#if PRINT_ENABLED
|
||||
fprintf(stderr,
|
||||
"Failed to Send Private Transfer Request "
|
||||
"(exceeds destination maximum APDU)!\n");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
return invoke_id;
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* @file
|
||||
* @author Steve Karg
|
||||
* @date October 2019
|
||||
* @brief Header file for a basic WritePropertyMultiple service send
|
||||
*
|
||||
* @section LICENSE
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#ifndef SEND_WRITE_PROPERTY_MULTIPLE_H
|
||||
#define SEND_WRITE_PROPERTY_MULTIPLE_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include "bacnet/bacapp.h"
|
||||
#include "bacnet/bacdef.h"
|
||||
#include "bacnet/bacenum.h"
|
||||
#include "bacnet/apdu.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
uint8_t Send_Private_Transfer_Request(uint32_t device_id, uint16_t vendor_id,
|
||||
uint32_t service_number,
|
||||
char block_number, DATABLOCK *block);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
@@ -0,0 +1,47 @@
|
||||
#Makefile to build BACnet Application for the GCC Port
|
||||
|
||||
TARGET = bacrbdt
|
||||
# BACnet objects that are used with this app
|
||||
BACNET_OBJECT_DIR = $(BACNET_SRC_DIR)/bacnet/basic/object
|
||||
SRC = main.c \
|
||||
$(BACNET_OBJECT_DIR)/client/device-client.c \
|
||||
$(BACNET_OBJECT_DIR)/netport.c
|
||||
BACNET_BASIC_SRC += \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_apdu.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_iam.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_noserv.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_rp.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_whois.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/s_iam.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/s_whois.c
|
||||
|
||||
# TARGET_EXT is defined in apps/Makefile as .exe or nothing
|
||||
TARGET_BIN = ${TARGET}$(TARGET_EXT)
|
||||
|
||||
SRCS = $(SRC) $(BACNET_SRC) $(BACNET_BASIC_SRC) $(BACNET_PORT_SRC)
|
||||
|
||||
OBJS += ${SRCS:.c=.o}
|
||||
|
||||
.PHONY: all
|
||||
all: Makefile ${TARGET_BIN}
|
||||
|
||||
${TARGET_BIN}: ${OBJS}
|
||||
${CC} ${PFLAGS} ${OBJS} ${LFLAGS} -o $@
|
||||
size $@
|
||||
cp $@ ../../bin
|
||||
|
||||
.c.o:
|
||||
${CC} -c ${CFLAGS} $*.c -o $@
|
||||
|
||||
.PHONY: depend
|
||||
depend:
|
||||
rm -f .depend
|
||||
${CC} -MM ${CFLAGS} *.c >> .depend
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f core ${TARGET_BIN} ${OBJS} $(TARGET).map
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
@@ -31,29 +31,29 @@
|
||||
#include <time.h> /* for time */
|
||||
#include <errno.h>
|
||||
#include <ctype.h> /* for toupper */
|
||||
#include "bactext.h"
|
||||
#include "iam.h"
|
||||
#include "address.h"
|
||||
#include "config.h"
|
||||
#include "bacdef.h"
|
||||
#include "npdu.h"
|
||||
#include "apdu.h"
|
||||
#include "device.h"
|
||||
#include "datalink.h"
|
||||
#include "bvlc.h"
|
||||
#include "bacnet/bactext.h"
|
||||
#include "bacnet/iam.h"
|
||||
#include "bacnet/basic/binding/address.h"
|
||||
#include "bacnet/config.h"
|
||||
#include "bacnet/bacdef.h"
|
||||
#include "bacnet/npdu.h"
|
||||
#include "bacnet/apdu.h"
|
||||
#include "bacnet/basic/object/device.h"
|
||||
#include "bacnet/datalink/datalink.h"
|
||||
#include "bacnet/datalink/bvlc.h"
|
||||
/* some demo stuff needed */
|
||||
#ifndef DEBUG_ENABLED
|
||||
#define DEBUG_ENABLED 0
|
||||
#endif
|
||||
#include "debug.h"
|
||||
#include "filename.h"
|
||||
#include "handlers.h"
|
||||
#include "client.h"
|
||||
#include "txbuf.h"
|
||||
#include "dlenv.h"
|
||||
#include "bacnet/basic/sys/debug.h"
|
||||
#include "bacnet/basic/sys/filename.h"
|
||||
#include "bacnet/basic/services.h"
|
||||
#include "bacnet/basic/services.h"
|
||||
#include "bacnet/basic/tsm/tsm.h"
|
||||
#include "bacnet/datalink/dlenv.h"
|
||||
|
||||
/* buffer used for receive */
|
||||
static uint8_t Rx_Buf[MAX_MPDU] = {0};
|
||||
static uint8_t Rx_Buf[MAX_MPDU] = { 0 };
|
||||
|
||||
/* targets interpreted from the command line options */
|
||||
static uint32_t Target_BBMD_Address;
|
||||
@@ -61,8 +61,8 @@ static uint16_t Target_BBMD_Port;
|
||||
|
||||
static bool Error_Detected = false;
|
||||
|
||||
static void MyAbortHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
uint8_t abort_reason, bool server)
|
||||
static void MyAbortHandler(
|
||||
BACNET_ADDRESS *src, uint8_t invoke_id, uint8_t abort_reason, bool server)
|
||||
{
|
||||
/* FIXME: verify src and invoke id */
|
||||
(void)src;
|
||||
@@ -72,8 +72,8 @@ static void MyAbortHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
Error_Detected = true;
|
||||
}
|
||||
|
||||
static void MyRejectHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
uint8_t reject_reason)
|
||||
static void MyRejectHandler(
|
||||
BACNET_ADDRESS *src, uint8_t invoke_id, uint8_t reject_reason)
|
||||
{
|
||||
/* FIXME: verify src and invoke id */
|
||||
(void)src;
|
||||
@@ -92,8 +92,8 @@ static void Init_Service_Handlers(void)
|
||||
It is required to send the proper reject message... */
|
||||
apdu_set_unrecognized_service_handler_handler(handler_unrecognized_service);
|
||||
/* we must implement read property - it's required! */
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_PROPERTY,
|
||||
handler_read_property);
|
||||
apdu_set_confirmed_handler(
|
||||
SERVICE_CONFIRMED_READ_PROPERTY, handler_read_property);
|
||||
/* handle the reply (request) coming back */
|
||||
apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_I_AM, handler_i_am_add);
|
||||
/* handle any errors coming back */
|
||||
@@ -103,7 +103,7 @@ static void Init_Service_Handlers(void)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
BACNET_ADDRESS src = {0}; /* address where message came from */
|
||||
BACNET_ADDRESS src = { 0 }; /* address where message came from */
|
||||
uint16_t pdu_len = 0;
|
||||
unsigned timeout = 100; /* milliseconds */
|
||||
time_t total_seconds = 0;
|
||||
@@ -145,8 +145,8 @@ int main(int argc, char *argv[])
|
||||
if ((port > 0) && (port <= 65535)) {
|
||||
Target_BBMD_Port = htons(port);
|
||||
} else {
|
||||
fprintf(stderr, "port=%ld - port must be between 0-65535.\r\n",
|
||||
port);
|
||||
fprintf(
|
||||
stderr, "port=%ld - port must be between 0-65535.\r\n", port);
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
@@ -183,8 +183,9 @@ int main(int argc, char *argv[])
|
||||
#endif
|
||||
}
|
||||
total_seconds += elapsed_seconds;
|
||||
if (total_seconds > timeout_seconds)
|
||||
if (total_seconds > timeout_seconds) {
|
||||
break;
|
||||
}
|
||||
/* keep track of time for next check */
|
||||
last_seconds = current_seconds;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
#Makefile to build BACnet Application for the Linux Port
|
||||
|
||||
# tools - only if you need them.
|
||||
# Most platforms have this already defined
|
||||
# CC = gcc
|
||||
|
||||
TARGET = bacarf
|
||||
# BACnet objects that are used with this app
|
||||
BACNET_OBJECT_DIR = $(BACNET_SRC_DIR)/bacnet/basic/object
|
||||
SRC = main.c \
|
||||
$(BACNET_OBJECT_DIR)/client/device-client.c \
|
||||
$(BACNET_OBJECT_DIR)/netport.c
|
||||
BACNET_BASIC_SRC += \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_apdu.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_iam.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_noserv.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_rp.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_whois.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/s_iam.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/s_arfs.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/s_whois.c
|
||||
|
||||
# TARGET_EXT is defined in apps/Makefile as .exe or nothing
|
||||
TARGET_BIN = ${TARGET}$(TARGET_EXT)
|
||||
|
||||
SRCS = $(SRC) $(BACNET_SRC) $(BACNET_BASIC_SRC) $(BACNET_PORT_SRC)
|
||||
|
||||
OBJS += ${SRCS:.c=.o}
|
||||
|
||||
.PHONY: all
|
||||
all: Makefile ${TARGET_BIN}
|
||||
|
||||
${TARGET_BIN}: ${OBJS}
|
||||
${CC} ${PFLAGS} ${OBJS} ${LFLAGS} -o $@
|
||||
size $@
|
||||
cp $@ ../../bin
|
||||
|
||||
.c.o:
|
||||
${CC} -c ${CFLAGS} $*.c -o $@
|
||||
|
||||
.PHONY: depend
|
||||
depend:
|
||||
rm -f .depend
|
||||
${CC} -MM ${CFLAGS} *.c >> .depend
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f core ${TARGET_BIN} ${OBJS} $(TARGET).map
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
@@ -30,29 +30,29 @@
|
||||
#include <stdlib.h>
|
||||
#include <time.h> /* for time */
|
||||
#include <errno.h>
|
||||
#include "bactext.h"
|
||||
#include "iam.h"
|
||||
#include "arf.h"
|
||||
#include "tsm.h"
|
||||
#include "address.h"
|
||||
#include "config.h"
|
||||
#include "bacdef.h"
|
||||
#include "npdu.h"
|
||||
#include "apdu.h"
|
||||
#include "device.h"
|
||||
#include "net.h"
|
||||
#include "datalink.h"
|
||||
#include "whois.h"
|
||||
#include "version.h"
|
||||
#include "bacnet/bactext.h"
|
||||
#include "bacnet/iam.h"
|
||||
#include "bacnet/arf.h"
|
||||
#include "bacnet/basic/tsm/tsm.h"
|
||||
#include "bacnet/basic/binding/address.h"
|
||||
#include "bacnet/config.h"
|
||||
#include "bacnet/bacdef.h"
|
||||
#include "bacnet/npdu.h"
|
||||
#include "bacnet/apdu.h"
|
||||
#include "bacnet/basic/object/device.h"
|
||||
#include "bacport.h"
|
||||
#include "bacnet/datalink/datalink.h"
|
||||
#include "bacnet/whois.h"
|
||||
#include "bacnet/version.h"
|
||||
/* some demo stuff needed */
|
||||
#include "filename.h"
|
||||
#include "handlers.h"
|
||||
#include "client.h"
|
||||
#include "txbuf.h"
|
||||
#include "dlenv.h"
|
||||
#include "bacnet/basic/sys/filename.h"
|
||||
#include "bacnet/basic/services.h"
|
||||
#include "bacnet/basic/services.h"
|
||||
#include "bacnet/basic/tsm/tsm.h"
|
||||
#include "bacnet/datalink/dlenv.h"
|
||||
|
||||
/* buffer used for receive */
|
||||
static uint8_t Rx_Buf[MAX_MPDU] = {0};
|
||||
static uint8_t Rx_Buf[MAX_MPDU] = { 0 };
|
||||
|
||||
/* global variables used in this file */
|
||||
static uint32_t Target_File_Object_Instance = BACNET_MAX_INSTANCE;
|
||||
@@ -79,20 +79,20 @@ static void Atomic_Read_File_Error_Handler(BACNET_ADDRESS *src,
|
||||
}
|
||||
}
|
||||
|
||||
void MyAbortHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
uint8_t abort_reason, bool server)
|
||||
static void MyAbortHandler(
|
||||
BACNET_ADDRESS *src, uint8_t invoke_id, uint8_t abort_reason, bool server)
|
||||
{
|
||||
(void)server;
|
||||
if (address_match(&Target_Address, src) &&
|
||||
(invoke_id == Request_Invoke_ID)) {
|
||||
printf("BACnet Abort: %s\n",
|
||||
bactext_abort_reason_name((int)abort_reason));
|
||||
printf(
|
||||
"BACnet Abort: %s\n", bactext_abort_reason_name((int)abort_reason));
|
||||
Error_Detected = true;
|
||||
}
|
||||
}
|
||||
|
||||
void MyRejectHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
uint8_t reject_reason)
|
||||
static void MyRejectHandler(
|
||||
BACNET_ADDRESS *src, uint8_t invoke_id, uint8_t reject_reason)
|
||||
{
|
||||
if (address_match(&Target_Address, src) &&
|
||||
(invoke_id == Request_Invoke_ID)) {
|
||||
@@ -102,8 +102,9 @@ void MyRejectHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
}
|
||||
}
|
||||
|
||||
static void AtomicReadFileAckHandler(
|
||||
uint8_t *service_request, uint16_t service_len, BACNET_ADDRESS *src,
|
||||
static void AtomicReadFileAckHandler(uint8_t *service_request,
|
||||
uint16_t service_len,
|
||||
BACNET_ADDRESS *src,
|
||||
BACNET_CONFIRMED_SERVICE_ACK_DATA *service_data)
|
||||
{
|
||||
int len = 0;
|
||||
@@ -163,8 +164,8 @@ static void AtomicReadFileAckHandler(
|
||||
}
|
||||
}
|
||||
|
||||
static void LocalIAmHandler(uint8_t *service_request, uint16_t service_len,
|
||||
BACNET_ADDRESS *src)
|
||||
static void LocalIAmHandler(
|
||||
uint8_t *service_request, uint16_t service_len, BACNET_ADDRESS *src)
|
||||
{
|
||||
int len = 0;
|
||||
uint32_t device_id = 0;
|
||||
@@ -174,12 +175,13 @@ static void LocalIAmHandler(uint8_t *service_request, uint16_t service_len,
|
||||
|
||||
(void)src;
|
||||
(void)service_len;
|
||||
len = iam_decode_service_request(service_request, &device_id, &max_apdu,
|
||||
&segmentation, &vendor_id);
|
||||
len = iam_decode_service_request(
|
||||
service_request, &device_id, &max_apdu, &segmentation, &vendor_id);
|
||||
if (len != -1) {
|
||||
address_add(device_id, max_apdu, src);
|
||||
} else
|
||||
} else {
|
||||
fprintf(stderr, "!\n");
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -196,14 +198,14 @@ static void Init_Service_Handlers(void)
|
||||
It is required to send the proper reject message... */
|
||||
apdu_set_unrecognized_service_handler_handler(handler_unrecognized_service);
|
||||
/* we must implement read property - it's required! */
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_PROPERTY,
|
||||
handler_read_property);
|
||||
apdu_set_confirmed_handler(
|
||||
SERVICE_CONFIRMED_READ_PROPERTY, handler_read_property);
|
||||
/* handle the data coming back from confirmed requests */
|
||||
apdu_set_confirmed_ack_handler(SERVICE_CONFIRMED_ATOMIC_READ_FILE,
|
||||
AtomicReadFileAckHandler);
|
||||
apdu_set_confirmed_ack_handler(
|
||||
SERVICE_CONFIRMED_ATOMIC_READ_FILE, AtomicReadFileAckHandler);
|
||||
/* handle any errors coming back */
|
||||
apdu_set_error_handler(SERVICE_CONFIRMED_ATOMIC_READ_FILE,
|
||||
Atomic_Read_File_Error_Handler);
|
||||
apdu_set_error_handler(
|
||||
SERVICE_CONFIRMED_ATOMIC_READ_FILE, Atomic_Read_File_Error_Handler);
|
||||
apdu_set_abort_handler(MyAbortHandler);
|
||||
apdu_set_reject_handler(MyRejectHandler);
|
||||
}
|
||||
@@ -241,7 +243,7 @@ static void print_help(char *filename)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
BACNET_ADDRESS src = {0}; /* address where message came from */
|
||||
BACNET_ADDRESS src = { 0 }; /* address where message came from */
|
||||
uint16_t pdu_len = 0;
|
||||
unsigned timeout = 100; /* milliseconds */
|
||||
unsigned max_apdu = 0;
|
||||
@@ -265,8 +267,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
if (strcmp(argv[argi], "--version") == 0) {
|
||||
printf("%s %s\n", filename, BACNET_VERSION_TEXT);
|
||||
printf(
|
||||
"Copyright (C) 2014 by Steve Karg and others.\n"
|
||||
printf("Copyright (C) 2014 by Steve Karg and others.\n"
|
||||
"This is free software; see the source for copying "
|
||||
"conditions.\n"
|
||||
"There is NO warranty; not even for MERCHANTABILITY or\n"
|
||||
@@ -302,11 +303,11 @@ int main(int argc, char *argv[])
|
||||
last_seconds = time(NULL);
|
||||
timeout_seconds = (apdu_timeout() / 1000) * apdu_retries();
|
||||
/* try to bind with the device */
|
||||
found = address_bind_request(Target_Device_Object_Instance, &max_apdu,
|
||||
&Target_Address);
|
||||
found = address_bind_request(
|
||||
Target_Device_Object_Instance, &max_apdu, &Target_Address);
|
||||
if (!found) {
|
||||
Send_WhoIs(Target_Device_Object_Instance,
|
||||
Target_Device_Object_Instance);
|
||||
Send_WhoIs(
|
||||
Target_Device_Object_Instance, Target_Device_Object_Instance);
|
||||
}
|
||||
/* loop forever */
|
||||
for (;;) {
|
||||
@@ -326,8 +327,8 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
/* wait until the device is bound, or timeout and quit */
|
||||
if (!found) {
|
||||
found = address_bind_request(Target_Device_Object_Instance,
|
||||
&max_apdu, &Target_Address);
|
||||
found = address_bind_request(
|
||||
Target_Device_Object_Instance, &max_apdu, &Target_Address);
|
||||
}
|
||||
if (found) {
|
||||
/* calculate the smaller of our APDU size or theirs
|
||||
@@ -358,9 +359,9 @@ int main(int argc, char *argv[])
|
||||
/* the ACK will increment the start position if OK */
|
||||
/* we'll read the file in chunks
|
||||
less than max_apdu to keep unsegmented */
|
||||
invoke_id = Send_Atomic_Read_File_Stream(
|
||||
Target_Device_Object_Instance, Target_File_Object_Instance,
|
||||
Target_File_Start_Position,
|
||||
invoke_id =
|
||||
Send_Atomic_Read_File_Stream(Target_Device_Object_Instance,
|
||||
Target_File_Object_Instance, Target_File_Start_Position,
|
||||
Target_File_Requested_Octet_Count);
|
||||
Request_Invoke_ID = invoke_id;
|
||||
} else if (tsm_invoke_id_failed(invoke_id)) {
|
||||
@@ -0,0 +1,50 @@
|
||||
#Makefile to build BACnet Application using GCC compiler
|
||||
|
||||
# Executable file name
|
||||
TARGET = bacrp
|
||||
# BACnet objects that are used with this app
|
||||
BACNET_OBJECT_DIR = $(BACNET_SRC_DIR)/bacnet/basic/object
|
||||
SRC = main.c \
|
||||
$(BACNET_OBJECT_DIR)/client/device-client.c \
|
||||
$(BACNET_OBJECT_DIR)/netport.c
|
||||
BACNET_BASIC_SRC += \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_apdu.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_iam.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_noserv.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_rp.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_rp_a.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_whois.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/s_iam.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/s_rp.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/s_whois.c
|
||||
|
||||
# TARGET_EXT is defined in apps/Makefile as .exe or nothing
|
||||
TARGET_BIN = ${TARGET}$(TARGET_EXT)
|
||||
|
||||
SRCS = $(SRC) $(BACNET_SRC) $(BACNET_BASIC_SRC) $(BACNET_PORT_SRC)
|
||||
|
||||
OBJS += ${SRCS:.c=.o}
|
||||
|
||||
.PHONY: all
|
||||
all: Makefile ${TARGET_BIN}
|
||||
|
||||
${TARGET_BIN}: ${OBJS}
|
||||
${CC} ${PFLAGS} ${OBJS} ${LFLAGS} -o $@
|
||||
size $@
|
||||
cp $@ ../../bin
|
||||
|
||||
.c.o:
|
||||
${CC} -c ${CFLAGS} $*.c -o $@
|
||||
|
||||
.PHONY: depend
|
||||
depend:
|
||||
rm -f .depend
|
||||
${CC} -MM ${CFLAGS} *.c >> .depend
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f core ${TARGET_BIN} ${OBJS} $(TARGET).map
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
@@ -32,30 +32,30 @@
|
||||
|
||||
#define PRINT_ENABLED 1
|
||||
|
||||
#include "bacdef.h"
|
||||
#include "config.h"
|
||||
#include "bactext.h"
|
||||
#include "bacerror.h"
|
||||
#include "iam.h"
|
||||
#include "arf.h"
|
||||
#include "tsm.h"
|
||||
#include "address.h"
|
||||
#include "npdu.h"
|
||||
#include "apdu.h"
|
||||
#include "device.h"
|
||||
#include "net.h"
|
||||
#include "datalink.h"
|
||||
#include "whois.h"
|
||||
#include "version.h"
|
||||
#include "bacnet/bacdef.h"
|
||||
#include "bacnet/config.h"
|
||||
#include "bacnet/bactext.h"
|
||||
#include "bacnet/bacerror.h"
|
||||
#include "bacnet/iam.h"
|
||||
#include "bacnet/arf.h"
|
||||
#include "bacnet/basic/tsm/tsm.h"
|
||||
#include "bacnet/basic/binding/address.h"
|
||||
#include "bacnet/npdu.h"
|
||||
#include "bacnet/apdu.h"
|
||||
#include "bacnet/basic/object/device.h"
|
||||
#include "bacport.h"
|
||||
#include "bacnet/datalink/datalink.h"
|
||||
#include "bacnet/whois.h"
|
||||
#include "bacnet/version.h"
|
||||
/* some demo stuff needed */
|
||||
#include "filename.h"
|
||||
#include "handlers.h"
|
||||
#include "client.h"
|
||||
#include "txbuf.h"
|
||||
#include "dlenv.h"
|
||||
#include "bacnet/basic/sys/filename.h"
|
||||
#include "bacnet/basic/services.h"
|
||||
#include "bacnet/basic/services.h"
|
||||
#include "bacnet/basic/tsm/tsm.h"
|
||||
#include "bacnet/datalink/dlenv.h"
|
||||
|
||||
/* buffer used for receive */
|
||||
static uint8_t Rx_Buf[MAX_MPDU] = {0};
|
||||
static uint8_t Rx_Buf[MAX_MPDU] = { 0 };
|
||||
|
||||
/* converted command line arguments */
|
||||
static uint32_t Target_Device_Object_Instance = BACNET_MAX_INSTANCE;
|
||||
@@ -68,7 +68,8 @@ static uint8_t Request_Invoke_ID = 0;
|
||||
static BACNET_ADDRESS Target_Address;
|
||||
static bool Error_Detected = false;
|
||||
|
||||
static void MyErrorHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
static void MyErrorHandler(BACNET_ADDRESS *src,
|
||||
uint8_t invoke_id,
|
||||
BACNET_ERROR_CLASS error_class,
|
||||
BACNET_ERROR_CODE error_code)
|
||||
{
|
||||
@@ -81,20 +82,20 @@ static void MyErrorHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
}
|
||||
}
|
||||
|
||||
void MyAbortHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
uint8_t abort_reason, bool server)
|
||||
static void MyAbortHandler(
|
||||
BACNET_ADDRESS *src, uint8_t invoke_id, uint8_t abort_reason, bool server)
|
||||
{
|
||||
(void)server;
|
||||
if (address_match(&Target_Address, src) &&
|
||||
(invoke_id == Request_Invoke_ID)) {
|
||||
printf("BACnet Abort: %s\n",
|
||||
bactext_abort_reason_name((int)abort_reason));
|
||||
printf(
|
||||
"BACnet Abort: %s\n", bactext_abort_reason_name((int)abort_reason));
|
||||
Error_Detected = true;
|
||||
}
|
||||
}
|
||||
|
||||
void MyRejectHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
uint8_t reject_reason)
|
||||
static void MyRejectHandler(
|
||||
BACNET_ADDRESS *src, uint8_t invoke_id, uint8_t reject_reason)
|
||||
{
|
||||
if (address_match(&Target_Address, src) &&
|
||||
(invoke_id == Request_Invoke_ID)) {
|
||||
@@ -115,8 +116,9 @@ void MyRejectHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
* @param service_data [in] The BACNET_CONFIRMED_SERVICE_DATA information
|
||||
* decoded from the APDU header of this message.
|
||||
*/
|
||||
void My_Read_Property_Ack_Handler(
|
||||
uint8_t *service_request, uint16_t service_len, BACNET_ADDRESS *src,
|
||||
static void My_Read_Property_Ack_Handler(uint8_t *service_request,
|
||||
uint16_t service_len,
|
||||
BACNET_ADDRESS *src,
|
||||
BACNET_CONFIRMED_SERVICE_ACK_DATA *service_data)
|
||||
{
|
||||
int len = 0;
|
||||
@@ -146,11 +148,11 @@ static void Init_Service_Handlers(void)
|
||||
It is required to send the proper reject message... */
|
||||
apdu_set_unrecognized_service_handler_handler(handler_unrecognized_service);
|
||||
/* we must implement read property - it's required! */
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_PROPERTY,
|
||||
handler_read_property);
|
||||
apdu_set_confirmed_handler(
|
||||
SERVICE_CONFIRMED_READ_PROPERTY, handler_read_property);
|
||||
/* handle the data coming back from confirmed requests */
|
||||
apdu_set_confirmed_ack_handler(SERVICE_CONFIRMED_READ_PROPERTY,
|
||||
My_Read_Property_Ack_Handler);
|
||||
apdu_set_confirmed_ack_handler(
|
||||
SERVICE_CONFIRMED_READ_PROPERTY, My_Read_Property_Ack_Handler);
|
||||
/* handle any errors coming back */
|
||||
apdu_set_error_handler(SERVICE_CONFIRMED_READ_PROPERTY, MyErrorHandler);
|
||||
apdu_set_abort_handler(MyAbortHandler);
|
||||
@@ -159,8 +161,7 @@ static void Init_Service_Handlers(void)
|
||||
|
||||
static void print_usage(char *filename)
|
||||
{
|
||||
printf(
|
||||
"Usage: %s device-instance object-type object-instance "
|
||||
printf("Usage: %s device-instance object-type object-instance "
|
||||
"property [index]\n",
|
||||
filename);
|
||||
printf(" [--dnet][--dadr][--mac]\n");
|
||||
@@ -169,11 +170,9 @@ static void print_usage(char *filename)
|
||||
|
||||
static void print_help(char *filename)
|
||||
{
|
||||
printf(
|
||||
"Read a property from an object in a BACnet device\n"
|
||||
printf("Read a property from an object in a BACnet device\n"
|
||||
"and print the value.\n");
|
||||
printf(
|
||||
"--mac A\n"
|
||||
printf("--mac A\n"
|
||||
"Optional BACnet mac address."
|
||||
"Valid ranges are from 00 to FF (hex) for MS/TP or ARCNET,\n"
|
||||
"or an IP string with optional port number like 10.1.2.3:47808\n"
|
||||
@@ -191,8 +190,7 @@ static void print_help(char *filename)
|
||||
"or an IP string with optional port number like 10.1.2.3:47808\n"
|
||||
"or an Ethernet MAC in hex like 00:21:70:7e:32:bb\n"
|
||||
"\n");
|
||||
printf(
|
||||
"device-instance:\n"
|
||||
printf("device-instance:\n"
|
||||
"BACnet Device Object Instance number that you are\n"
|
||||
"trying to communicate to. This number will be used\n"
|
||||
"to try and bind with the device using Who-Is and\n"
|
||||
@@ -229,7 +227,7 @@ static void print_help(char *filename)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
BACNET_ADDRESS src = {0}; /* address where message came from */
|
||||
BACNET_ADDRESS src = { 0 }; /* address where message came from */
|
||||
uint16_t pdu_len = 0;
|
||||
unsigned timeout = 100; /* milliseconds */
|
||||
unsigned max_apdu = 0;
|
||||
@@ -239,9 +237,9 @@ int main(int argc, char *argv[])
|
||||
time_t timeout_seconds = 0;
|
||||
bool found = false;
|
||||
long dnet = -1;
|
||||
BACNET_MAC_ADDRESS mac = {0};
|
||||
BACNET_MAC_ADDRESS adr = {0};
|
||||
BACNET_ADDRESS dest = {0};
|
||||
BACNET_MAC_ADDRESS mac = { 0 };
|
||||
BACNET_MAC_ADDRESS adr = { 0 };
|
||||
BACNET_ADDRESS dest = { 0 };
|
||||
bool specific_address = false;
|
||||
int argi = 0;
|
||||
unsigned int target_args = 0;
|
||||
@@ -256,8 +254,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
if (strcmp(argv[argi], "--version") == 0) {
|
||||
printf("%s %s\n", filename, BACNET_VERSION_TEXT);
|
||||
printf(
|
||||
"Copyright (C) 2015 by Steve Karg and others.\n"
|
||||
printf("Copyright (C) 2015 by Steve Karg and others.\n"
|
||||
"This is free software; see the source for copying "
|
||||
"conditions.\n"
|
||||
"There is NO warranty; not even for MERCHANTABILITY or\n"
|
||||
@@ -355,11 +352,11 @@ int main(int argc, char *argv[])
|
||||
last_seconds = time(NULL);
|
||||
timeout_seconds = (apdu_timeout() / 1000) * apdu_retries();
|
||||
/* try to bind with the device */
|
||||
found = address_bind_request(Target_Device_Object_Instance, &max_apdu,
|
||||
&Target_Address);
|
||||
found = address_bind_request(
|
||||
Target_Device_Object_Instance, &max_apdu, &Target_Address);
|
||||
if (!found) {
|
||||
Send_WhoIs(Target_Device_Object_Instance,
|
||||
Target_Device_Object_Instance);
|
||||
Send_WhoIs(
|
||||
Target_Device_Object_Instance, Target_Device_Object_Instance);
|
||||
}
|
||||
/* loop forever */
|
||||
for (;;) {
|
||||
@@ -367,25 +364,26 @@ int main(int argc, char *argv[])
|
||||
current_seconds = time(NULL);
|
||||
|
||||
/* at least one second has passed */
|
||||
if (current_seconds != last_seconds)
|
||||
if (current_seconds != last_seconds) {
|
||||
tsm_timer_milliseconds(
|
||||
(uint16_t)((current_seconds - last_seconds) * 1000));
|
||||
}
|
||||
if (Error_Detected)
|
||||
break;
|
||||
/* wait until the device is bound, or timeout and quit */
|
||||
if (!found) {
|
||||
found = address_bind_request(Target_Device_Object_Instance,
|
||||
&max_apdu, &Target_Address);
|
||||
found = address_bind_request(
|
||||
Target_Device_Object_Instance, &max_apdu, &Target_Address);
|
||||
}
|
||||
if (found) {
|
||||
if (Request_Invoke_ID == 0) {
|
||||
Request_Invoke_ID = Send_Read_Property_Request(
|
||||
Target_Device_Object_Instance, Target_Object_Type,
|
||||
Target_Object_Instance, Target_Object_Property,
|
||||
Target_Object_Index);
|
||||
} else if (tsm_invoke_id_free(Request_Invoke_ID))
|
||||
Request_Invoke_ID =
|
||||
Send_Read_Property_Request(Target_Device_Object_Instance,
|
||||
Target_Object_Type, Target_Object_Instance,
|
||||
Target_Object_Property, Target_Object_Index);
|
||||
} else if (tsm_invoke_id_free(Request_Invoke_ID)) {
|
||||
break;
|
||||
else if (tsm_invoke_id_failed(Request_Invoke_ID)) {
|
||||
} else if (tsm_invoke_id_failed(Request_Invoke_ID)) {
|
||||
fprintf(stderr, "\rError: TSM Timeout!\n");
|
||||
tsm_free_invoke_id(Request_Invoke_ID);
|
||||
Error_Detected = true;
|
||||
@@ -0,0 +1,56 @@
|
||||
#Makefile to build BACnet Application for the Linux Port
|
||||
|
||||
# tools - only if you need them.
|
||||
# Most platforms have this already defined
|
||||
# CC = gcc
|
||||
|
||||
# Executable file name
|
||||
TARGET = bacrpm
|
||||
# BACnet objects that are used with this app
|
||||
BACNET_OBJECT_DIR = $(BACNET_SRC_DIR)/bacnet/basic/object
|
||||
SRC = main.c \
|
||||
$(BACNET_OBJECT_DIR)/client/device-client.c \
|
||||
$(BACNET_OBJECT_DIR)/netport.c
|
||||
BACNET_BASIC_SRC += \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_apdu.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_iam.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_noserv.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_rp.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_rp_a.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_rpm_a.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_whois.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/s_iam.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/s_rp.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/s_rpm.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/s_whois.c
|
||||
|
||||
# TARGET_EXT is defined in apps/Makefile as .exe or nothing
|
||||
TARGET_BIN = ${TARGET}$(TARGET_EXT)
|
||||
|
||||
SRCS = $(SRC) $(BACNET_SRC) $(BACNET_BASIC_SRC) $(BACNET_PORT_SRC)
|
||||
|
||||
OBJS += ${SRCS:.c=.o}
|
||||
|
||||
.PHONY: all
|
||||
all: Makefile ${TARGET_BIN}
|
||||
|
||||
${TARGET_BIN}: ${OBJS}
|
||||
${CC} ${PFLAGS} ${OBJS} ${LFLAGS} -o $@
|
||||
size $@
|
||||
cp $@ ../../bin
|
||||
|
||||
.c.o:
|
||||
${CC} -c ${CFLAGS} $*.c -o $@
|
||||
|
||||
.PHONY: depend
|
||||
depend:
|
||||
rm -f .depend
|
||||
${CC} -MM ${CFLAGS} *.c >> .depend
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f core ${TARGET_BIN} ${OBJS} $(TARGET).map
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
@@ -32,31 +32,31 @@
|
||||
|
||||
#define PRINT_ENABLED 1
|
||||
|
||||
#include "bacdef.h"
|
||||
#include "config.h"
|
||||
#include "bactext.h"
|
||||
#include "bacerror.h"
|
||||
#include "iam.h"
|
||||
#include "arf.h"
|
||||
#include "tsm.h"
|
||||
#include "address.h"
|
||||
#include "npdu.h"
|
||||
#include "apdu.h"
|
||||
#include "device.h"
|
||||
#include "net.h"
|
||||
#include "datalink.h"
|
||||
#include "whois.h"
|
||||
#include "version.h"
|
||||
#include "bacnet/bacdef.h"
|
||||
#include "bacnet/config.h"
|
||||
#include "bacnet/bactext.h"
|
||||
#include "bacnet/bacerror.h"
|
||||
#include "bacnet/iam.h"
|
||||
#include "bacnet/arf.h"
|
||||
#include "bacnet/basic/tsm/tsm.h"
|
||||
#include "bacnet/basic/binding/address.h"
|
||||
#include "bacnet/npdu.h"
|
||||
#include "bacnet/apdu.h"
|
||||
#include "bacnet/basic/object/device.h"
|
||||
#include "bacport.h"
|
||||
#include "bacnet/datalink/datalink.h"
|
||||
#include "bacnet/whois.h"
|
||||
#include "bacnet/version.h"
|
||||
/* some demo stuff needed */
|
||||
#include "rpm.h"
|
||||
#include "filename.h"
|
||||
#include "handlers.h"
|
||||
#include "client.h"
|
||||
#include "txbuf.h"
|
||||
#include "dlenv.h"
|
||||
#include "bacnet/rpm.h"
|
||||
#include "bacnet/basic/sys/filename.h"
|
||||
#include "bacnet/basic/services.h"
|
||||
#include "bacnet/basic/services.h"
|
||||
#include "bacnet/basic/tsm/tsm.h"
|
||||
#include "bacnet/datalink/dlenv.h"
|
||||
|
||||
/* buffer used for receive */
|
||||
static uint8_t Rx_Buf[MAX_MPDU] = {0};
|
||||
static uint8_t Rx_Buf[MAX_MPDU] = { 0 };
|
||||
|
||||
/* global variables used in this file */
|
||||
static uint32_t Target_Device_Object_Instance = BACNET_MAX_INSTANCE;
|
||||
@@ -67,7 +67,8 @@ static BACNET_ADDRESS Target_Address;
|
||||
/* needed for return value of main application */
|
||||
static bool Error_Detected = false;
|
||||
|
||||
static void MyErrorHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
static void MyErrorHandler(BACNET_ADDRESS *src,
|
||||
uint8_t invoke_id,
|
||||
BACNET_ERROR_CLASS error_class,
|
||||
BACNET_ERROR_CODE error_code)
|
||||
{
|
||||
@@ -80,20 +81,20 @@ static void MyErrorHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
}
|
||||
}
|
||||
|
||||
void MyAbortHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
uint8_t abort_reason, bool server)
|
||||
static void MyAbortHandler(
|
||||
BACNET_ADDRESS *src, uint8_t invoke_id, uint8_t abort_reason, bool server)
|
||||
{
|
||||
(void)server;
|
||||
if (address_match(&Target_Address, src) &&
|
||||
(invoke_id == Request_Invoke_ID)) {
|
||||
printf("BACnet Abort: %s\n",
|
||||
bactext_abort_reason_name((int)abort_reason));
|
||||
printf(
|
||||
"BACnet Abort: %s\n", bactext_abort_reason_name((int)abort_reason));
|
||||
Error_Detected = true;
|
||||
}
|
||||
}
|
||||
|
||||
void MyRejectHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
uint8_t reject_reason)
|
||||
static void MyRejectHandler(
|
||||
BACNET_ADDRESS *src, uint8_t invoke_id, uint8_t reject_reason)
|
||||
{
|
||||
/* FIXME: verify src and invoke id */
|
||||
if (address_match(&Target_Address, src) &&
|
||||
@@ -115,8 +116,9 @@ void MyRejectHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
* @param service_data [in] The BACNET_CONFIRMED_SERVICE_DATA information
|
||||
* decoded from the APDU header of this message.
|
||||
*/
|
||||
void My_Read_Property_Multiple_Ack_Handler(
|
||||
uint8_t *service_request, uint16_t service_len, BACNET_ADDRESS *src,
|
||||
static void My_Read_Property_Multiple_Ack_Handler(uint8_t *service_request,
|
||||
uint16_t service_len,
|
||||
BACNET_ADDRESS *src,
|
||||
BACNET_CONFIRMED_SERVICE_ACK_DATA *service_data)
|
||||
{
|
||||
int len = 0;
|
||||
@@ -131,8 +133,8 @@ void My_Read_Property_Multiple_Ack_Handler(
|
||||
(service_data->invoke_id == Request_Invoke_ID)) {
|
||||
rpm_data = calloc(1, sizeof(BACNET_READ_ACCESS_DATA));
|
||||
if (rpm_data) {
|
||||
len = rpm_ack_decode_service_request(service_request, service_len,
|
||||
rpm_data);
|
||||
len = rpm_ack_decode_service_request(
|
||||
service_request, service_len, rpm_data);
|
||||
}
|
||||
if (len > 0) {
|
||||
while (rpm_data) {
|
||||
@@ -188,8 +190,8 @@ static void Init_Service_Handlers(void)
|
||||
It is required to send the proper reject message... */
|
||||
apdu_set_unrecognized_service_handler_handler(handler_unrecognized_service);
|
||||
/* we must implement read property - it's required! */
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_PROPERTY,
|
||||
handler_read_property);
|
||||
apdu_set_confirmed_handler(
|
||||
SERVICE_CONFIRMED_READ_PROPERTY, handler_read_property);
|
||||
/* handle the data coming back from confirmed requests */
|
||||
apdu_set_confirmed_ack_handler(SERVICE_CONFIRMED_READ_PROP_MULTIPLE,
|
||||
My_Read_Property_Multiple_Ack_Handler);
|
||||
@@ -199,7 +201,7 @@ static void Init_Service_Handlers(void)
|
||||
apdu_set_reject_handler(MyRejectHandler);
|
||||
}
|
||||
|
||||
void cleanup(void)
|
||||
static void cleanup(void)
|
||||
{
|
||||
BACNET_READ_ACCESS_DATA *rpm_object;
|
||||
BACNET_READ_ACCESS_DATA *old_rpm_object;
|
||||
@@ -223,8 +225,7 @@ void cleanup(void)
|
||||
|
||||
static void print_usage(char *filename)
|
||||
{
|
||||
printf(
|
||||
"Usage: %s device-instance object-type object-instance "
|
||||
printf("Usage: %s device-instance object-type object-instance "
|
||||
"property[index][,property[index]] [object-type ...]\n",
|
||||
filename);
|
||||
printf(" [--version][--help]\n");
|
||||
@@ -232,8 +233,7 @@ static void print_usage(char *filename)
|
||||
|
||||
static void print_help(char *filename)
|
||||
{
|
||||
printf(
|
||||
"Read one or more properties from one or more objects\n"
|
||||
printf("Read one or more properties from one or more objects\n"
|
||||
"in a BACnet device and print the value(s).\n"
|
||||
"device-instance:\n"
|
||||
"BACnet Device Object Instance number that you are\n"
|
||||
@@ -283,7 +283,7 @@ static void print_help(char *filename)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
BACNET_ADDRESS src = {0}; /* address where message came from */
|
||||
BACNET_ADDRESS src = { 0 }; /* address where message came from */
|
||||
uint16_t pdu_len = 0;
|
||||
unsigned timeout = 100; /* milliseconds */
|
||||
unsigned max_apdu = 0;
|
||||
@@ -293,7 +293,7 @@ int main(int argc, char *argv[])
|
||||
time_t current_seconds = 0;
|
||||
time_t timeout_seconds = 0;
|
||||
bool found = false;
|
||||
uint8_t buffer[MAX_PDU] = {0};
|
||||
uint8_t buffer[MAX_PDU] = { 0 };
|
||||
BACNET_READ_ACCESS_DATA *rpm_object;
|
||||
BACNET_PROPERTY_REFERENCE *rpm_property;
|
||||
char *property_token = NULL;
|
||||
@@ -312,8 +312,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
if (strcmp(argv[argi], "--version") == 0) {
|
||||
printf("%s %s\n", filename, BACNET_VERSION_TEXT);
|
||||
printf(
|
||||
"Copyright (C) 2014 by Steve Karg and others.\n"
|
||||
printf("Copyright (C) 2014 by Steve Karg and others.\n"
|
||||
"This is free software; see the source for copying "
|
||||
"conditions.\n"
|
||||
"There is NO warranty; not even for MERCHANTABILITY or\n"
|
||||
@@ -368,8 +367,8 @@ int main(int argc, char *argv[])
|
||||
property_token = strtok(argv[tag_value_arg], ",");
|
||||
/* add all the properties and optional index to our list */
|
||||
while (rpm_property) {
|
||||
scan_count = sscanf(property_token, "%u[%u]", &property_id,
|
||||
&property_array_index);
|
||||
scan_count = sscanf(
|
||||
property_token, "%u[%u]", &property_id, &property_array_index);
|
||||
if (scan_count > 0) {
|
||||
rpm_property->propertyIdentifier = property_id;
|
||||
if (rpm_property->propertyIdentifier > MAX_BACNET_PROPERTY_ID) {
|
||||
@@ -416,11 +415,11 @@ int main(int argc, char *argv[])
|
||||
last_seconds = time(NULL);
|
||||
timeout_seconds = (apdu_timeout() / 1000) * apdu_retries();
|
||||
/* try to bind with the device */
|
||||
found = address_bind_request(Target_Device_Object_Instance, &max_apdu,
|
||||
&Target_Address);
|
||||
found = address_bind_request(
|
||||
Target_Device_Object_Instance, &max_apdu, &Target_Address);
|
||||
if (!found) {
|
||||
Send_WhoIs(Target_Device_Object_Instance,
|
||||
Target_Device_Object_Instance);
|
||||
Send_WhoIs(
|
||||
Target_Device_Object_Instance, Target_Device_Object_Instance);
|
||||
}
|
||||
/* loop forever */
|
||||
for (;;) {
|
||||
@@ -428,23 +427,24 @@ int main(int argc, char *argv[])
|
||||
current_seconds = time(NULL);
|
||||
|
||||
/* at least one second has passed */
|
||||
if (current_seconds != last_seconds)
|
||||
if (current_seconds != last_seconds) {
|
||||
tsm_timer_milliseconds(((current_seconds - last_seconds) * 1000));
|
||||
}
|
||||
if (Error_Detected)
|
||||
break;
|
||||
/* wait until the device is bound, or timeout and quit */
|
||||
if (!found) {
|
||||
found = address_bind_request(Target_Device_Object_Instance,
|
||||
&max_apdu, &Target_Address);
|
||||
found = address_bind_request(
|
||||
Target_Device_Object_Instance, &max_apdu, &Target_Address);
|
||||
}
|
||||
if (found) {
|
||||
if (Request_Invoke_ID == 0) {
|
||||
Request_Invoke_ID = Send_Read_Property_Multiple_Request(
|
||||
&buffer[0], sizeof(buffer), Target_Device_Object_Instance,
|
||||
Read_Access_Data);
|
||||
} else if (tsm_invoke_id_free(Request_Invoke_ID))
|
||||
} else if (tsm_invoke_id_free(Request_Invoke_ID)) {
|
||||
break;
|
||||
else if (tsm_invoke_id_failed(Request_Invoke_ID)) {
|
||||
} else if (tsm_invoke_id_failed(Request_Invoke_ID)) {
|
||||
fprintf(stderr, "\rError: TSM Timeout!\n");
|
||||
tsm_free_invoke_id(Request_Invoke_ID);
|
||||
Error_Detected = true;
|
||||
@@ -0,0 +1,50 @@
|
||||
#Makefile to build BACnet Application using GCC compiler
|
||||
|
||||
# Executable file name
|
||||
TARGET = bacrr
|
||||
# BACnet objects that are used with this app
|
||||
BACNET_OBJECT_DIR = $(BACNET_SRC_DIR)/bacnet/basic/object
|
||||
SRC = main.c \
|
||||
$(BACNET_OBJECT_DIR)/client/device-client.c \
|
||||
$(BACNET_OBJECT_DIR)/netport.c
|
||||
BACNET_BASIC_SRC += \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_apdu.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_iam.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_noserv.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_rp.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_rr_a.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_whois.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/s_iam.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/s_readrange.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/s_whois.c
|
||||
|
||||
# TARGET_EXT is defined in apps/Makefile as .exe or nothing
|
||||
TARGET_BIN = ${TARGET}$(TARGET_EXT)
|
||||
|
||||
SRCS = $(SRC) $(BACNET_SRC) $(BACNET_BASIC_SRC) $(BACNET_PORT_SRC)
|
||||
|
||||
OBJS += ${SRCS:.c=.o}
|
||||
|
||||
.PHONY: all
|
||||
all: Makefile ${TARGET_BIN}
|
||||
|
||||
${TARGET_BIN}: ${OBJS}
|
||||
${CC} ${PFLAGS} ${OBJS} ${LFLAGS} -o $@
|
||||
size $@
|
||||
cp $@ ../../bin
|
||||
|
||||
.c.o:
|
||||
${CC} -c ${CFLAGS} $*.c -o $@
|
||||
|
||||
.PHONY: depend
|
||||
depend:
|
||||
rm -f .depend
|
||||
${CC} -MM ${CFLAGS} *.c >> .depend
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f core ${TARGET_BIN} ${OBJS} $(TARGET).map
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
@@ -31,30 +31,30 @@
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <time.h> /* for time */
|
||||
#include "bacdef.h"
|
||||
#include "config.h"
|
||||
#include "bactext.h"
|
||||
#include "bacerror.h"
|
||||
#include "iam.h"
|
||||
#include "tsm.h"
|
||||
#include "address.h"
|
||||
#include "npdu.h"
|
||||
#include "apdu.h"
|
||||
#include "device.h"
|
||||
#include "net.h"
|
||||
#include "datalink.h"
|
||||
#include "whois.h"
|
||||
#include "version.h"
|
||||
#include "bacnet/bacdef.h"
|
||||
#include "bacnet/config.h"
|
||||
#include "bacnet/bactext.h"
|
||||
#include "bacnet/bacerror.h"
|
||||
#include "bacnet/iam.h"
|
||||
#include "bacnet/basic/tsm/tsm.h"
|
||||
#include "bacnet/basic/binding/address.h"
|
||||
#include "bacnet/npdu.h"
|
||||
#include "bacnet/apdu.h"
|
||||
#include "bacnet/basic/object/device.h"
|
||||
#include "bacport.h"
|
||||
#include "bacnet/datalink/datalink.h"
|
||||
#include "bacnet/whois.h"
|
||||
#include "bacnet/version.h"
|
||||
/* some demo stuff needed */
|
||||
#include "filename.h"
|
||||
#include "handlers.h"
|
||||
#include "client.h"
|
||||
#include "txbuf.h"
|
||||
#include "dlenv.h"
|
||||
#include "readrange.h"
|
||||
#include "bacnet/basic/sys/filename.h"
|
||||
#include "bacnet/basic/services.h"
|
||||
#include "bacnet/basic/services.h"
|
||||
#include "bacnet/basic/tsm/tsm.h"
|
||||
#include "bacnet/datalink/dlenv.h"
|
||||
#include "bacnet/readrange.h"
|
||||
|
||||
/* buffer used for receive */
|
||||
static uint8_t Rx_Buf[MAX_MPDU] = {0};
|
||||
static uint8_t Rx_Buf[MAX_MPDU] = { 0 };
|
||||
|
||||
/* converted command line arguments */
|
||||
static uint32_t Target_Device_Object_Instance = BACNET_MAX_INSTANCE;
|
||||
@@ -71,7 +71,8 @@ static bool Error_Detected = false;
|
||||
/* specific request data */
|
||||
static BACNET_READ_RANGE_DATA RR_Request;
|
||||
|
||||
static void MyErrorHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
static void MyErrorHandler(BACNET_ADDRESS *src,
|
||||
uint8_t invoke_id,
|
||||
BACNET_ERROR_CLASS error_class,
|
||||
BACNET_ERROR_CODE error_code)
|
||||
{
|
||||
@@ -84,20 +85,20 @@ static void MyErrorHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
}
|
||||
}
|
||||
|
||||
void MyAbortHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
uint8_t abort_reason, bool server)
|
||||
static void MyAbortHandler(
|
||||
BACNET_ADDRESS *src, uint8_t invoke_id, uint8_t abort_reason, bool server)
|
||||
{
|
||||
(void)server;
|
||||
if (address_match(&Target_Address, src) &&
|
||||
(invoke_id == Request_Invoke_ID)) {
|
||||
printf("BACnet Abort: %s\n",
|
||||
bactext_abort_reason_name((int)abort_reason));
|
||||
printf(
|
||||
"BACnet Abort: %s\n", bactext_abort_reason_name((int)abort_reason));
|
||||
Error_Detected = true;
|
||||
}
|
||||
}
|
||||
|
||||
void MyRejectHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
uint8_t reject_reason)
|
||||
static void MyRejectHandler(
|
||||
BACNET_ADDRESS *src, uint8_t invoke_id, uint8_t reject_reason)
|
||||
{
|
||||
if (address_match(&Target_Address, src) &&
|
||||
(invoke_id == Request_Invoke_ID)) {
|
||||
@@ -119,11 +120,11 @@ static void Init_Service_Handlers(void)
|
||||
It is required to send the proper reject message... */
|
||||
apdu_set_unrecognized_service_handler_handler(handler_unrecognized_service);
|
||||
/* we must implement read property - it's required! */
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_PROPERTY,
|
||||
handler_read_property);
|
||||
apdu_set_confirmed_handler(
|
||||
SERVICE_CONFIRMED_READ_PROPERTY, handler_read_property);
|
||||
/* handle the data coming back from confirmed requests */
|
||||
apdu_set_confirmed_ack_handler(SERVICE_CONFIRMED_READ_RANGE,
|
||||
handler_read_range_ack);
|
||||
apdu_set_confirmed_ack_handler(
|
||||
SERVICE_CONFIRMED_READ_RANGE, handler_read_range_ack);
|
||||
|
||||
/* handle any errors coming back */
|
||||
apdu_set_error_handler(SERVICE_CONFIRMED_READ_PROPERTY, MyErrorHandler);
|
||||
@@ -142,8 +143,7 @@ static void print_usage(char *filename)
|
||||
|
||||
static void print_help(char *filename)
|
||||
{
|
||||
printf(
|
||||
"Read a range of properties from an array or list property\n"
|
||||
printf("Read a range of properties from an array or list property\n"
|
||||
"in an object in a BACnet device and print the values.\n"
|
||||
"device-instance:\n"
|
||||
"BACnet Device Object Instance number that you are\n"
|
||||
@@ -186,7 +186,7 @@ static void print_help(char *filename)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
BACNET_ADDRESS src = {0}; /* address where message came from */
|
||||
BACNET_ADDRESS src = { 0 }; /* address where message came from */
|
||||
uint16_t pdu_len = 0;
|
||||
unsigned timeout = 100; /* milliseconds */
|
||||
unsigned max_apdu = 0;
|
||||
@@ -210,8 +210,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
if (strcmp(argv[argi], "--version") == 0) {
|
||||
printf("%s %s\n", filename, BACNET_VERSION_TEXT);
|
||||
printf(
|
||||
"Copyright (C) 2014 by Steve Karg and others.\n"
|
||||
printf("Copyright (C) 2014 by Steve Karg and others.\n"
|
||||
"This is free software; see the source for copying "
|
||||
"conditions.\n"
|
||||
"There is NO warranty; not even for MERCHANTABILITY or\n"
|
||||
@@ -318,11 +317,11 @@ int main(int argc, char *argv[])
|
||||
last_seconds = time(NULL);
|
||||
timeout_seconds = (apdu_timeout() / 1000) * apdu_retries();
|
||||
/* try to bind with the device */
|
||||
found = address_bind_request(Target_Device_Object_Instance, &max_apdu,
|
||||
&Target_Address);
|
||||
found = address_bind_request(
|
||||
Target_Device_Object_Instance, &max_apdu, &Target_Address);
|
||||
if (!found) {
|
||||
Send_WhoIs(Target_Device_Object_Instance,
|
||||
Target_Device_Object_Instance);
|
||||
Send_WhoIs(
|
||||
Target_Device_Object_Instance, Target_Device_Object_Instance);
|
||||
}
|
||||
/* loop forever */
|
||||
for (;;) {
|
||||
@@ -330,23 +329,24 @@ int main(int argc, char *argv[])
|
||||
current_seconds = time(NULL);
|
||||
|
||||
/* at least one second has passed */
|
||||
if (current_seconds != last_seconds)
|
||||
if (current_seconds != last_seconds) {
|
||||
tsm_timer_milliseconds(
|
||||
(uint16_t)((current_seconds - last_seconds) * 1000));
|
||||
}
|
||||
if (Error_Detected)
|
||||
break;
|
||||
/* wait until the device is bound, or timeout and quit */
|
||||
if (!found) {
|
||||
found = address_bind_request(Target_Device_Object_Instance,
|
||||
&max_apdu, &Target_Address);
|
||||
found = address_bind_request(
|
||||
Target_Device_Object_Instance, &max_apdu, &Target_Address);
|
||||
}
|
||||
if (found) {
|
||||
if (Request_Invoke_ID == 0) {
|
||||
Request_Invoke_ID = Send_ReadRange_Request(
|
||||
Target_Device_Object_Instance, &RR_Request);
|
||||
} else if (tsm_invoke_id_free(Request_Invoke_ID))
|
||||
} else if (tsm_invoke_id_free(Request_Invoke_ID)) {
|
||||
break;
|
||||
else if (tsm_invoke_id_failed(Request_Invoke_ID)) {
|
||||
} else if (tsm_invoke_id_failed(Request_Invoke_ID)) {
|
||||
fprintf(stderr, "\rError: TSM Timeout!\n");
|
||||
tsm_free_invoke_id(Request_Invoke_ID);
|
||||
Error_Detected = true;
|
||||
@@ -0,0 +1,53 @@
|
||||
#Makefile to build BACnet Application for the Linux Port
|
||||
|
||||
# tools - only if you need them.
|
||||
# Most platforms have this already defined
|
||||
# CC = gcc
|
||||
|
||||
# Executable file name
|
||||
TARGET = bacrd
|
||||
# BACnet objects that are used with this app
|
||||
BACNET_OBJECT_DIR = $(BACNET_SRC_DIR)/bacnet/basic/object
|
||||
SRC = main.c \
|
||||
$(BACNET_OBJECT_DIR)/client/device-client.c \
|
||||
$(BACNET_OBJECT_DIR)/netport.c
|
||||
BACNET_BASIC_SRC += \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_apdu.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_iam.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_noserv.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_rp.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_whois.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/s_iam.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/s_rd.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/s_whois.c
|
||||
|
||||
# TARGET_EXT is defined in apps/Makefile as .exe or nothing
|
||||
TARGET_BIN = ${TARGET}$(TARGET_EXT)
|
||||
|
||||
SRCS = $(SRC) $(BACNET_SRC) $(BACNET_BASIC_SRC) $(BACNET_PORT_SRC)
|
||||
|
||||
OBJS += ${SRCS:.c=.o}
|
||||
|
||||
.PHONY: all
|
||||
all: Makefile ${TARGET_BIN}
|
||||
|
||||
${TARGET_BIN}: ${OBJS}
|
||||
${CC} ${PFLAGS} ${OBJS} ${LFLAGS} -o $@
|
||||
size $@
|
||||
cp $@ ../../bin
|
||||
|
||||
.c.o:
|
||||
${CC} -c ${CFLAGS} $*.c -o $@
|
||||
|
||||
.PHONY: depend
|
||||
depend:
|
||||
rm -f .depend
|
||||
${CC} -MM ${CFLAGS} *.c >> .depend
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f core ${TARGET_BIN} ${OBJS} $(TARGET).map
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
@@ -30,29 +30,29 @@
|
||||
#include <stdlib.h>
|
||||
#include <time.h> /* for time */
|
||||
#include <errno.h>
|
||||
#include "bactext.h"
|
||||
#include "iam.h"
|
||||
#include "arf.h"
|
||||
#include "tsm.h"
|
||||
#include "address.h"
|
||||
#include "config.h"
|
||||
#include "bacdef.h"
|
||||
#include "npdu.h"
|
||||
#include "apdu.h"
|
||||
#include "device.h"
|
||||
#include "net.h"
|
||||
#include "datalink.h"
|
||||
#include "whois.h"
|
||||
#include "rd.h"
|
||||
#include "bacnet/bactext.h"
|
||||
#include "bacnet/iam.h"
|
||||
#include "bacnet/arf.h"
|
||||
#include "bacnet/basic/tsm/tsm.h"
|
||||
#include "bacnet/basic/binding/address.h"
|
||||
#include "bacnet/config.h"
|
||||
#include "bacnet/bacdef.h"
|
||||
#include "bacnet/npdu.h"
|
||||
#include "bacnet/apdu.h"
|
||||
#include "bacnet/basic/object/device.h"
|
||||
#include "bacport.h"
|
||||
#include "bacnet/datalink/datalink.h"
|
||||
#include "bacnet/whois.h"
|
||||
#include "bacnet/rd.h"
|
||||
/* some demo stuff needed */
|
||||
#include "filename.h"
|
||||
#include "handlers.h"
|
||||
#include "client.h"
|
||||
#include "txbuf.h"
|
||||
#include "dlenv.h"
|
||||
#include "bacnet/basic/sys/filename.h"
|
||||
#include "bacnet/basic/services.h"
|
||||
#include "bacnet/basic/services.h"
|
||||
#include "bacnet/basic/tsm/tsm.h"
|
||||
#include "bacnet/datalink/dlenv.h"
|
||||
|
||||
/* buffer used for receive */
|
||||
static uint8_t Rx_Buf[MAX_MPDU] = {0};
|
||||
static uint8_t Rx_Buf[MAX_MPDU] = { 0 };
|
||||
|
||||
/* global variables used in this file */
|
||||
static uint32_t Target_Device_Object_Instance = BACNET_MAX_INSTANCE;
|
||||
@@ -62,7 +62,8 @@ static char *Reinitialize_Password = NULL;
|
||||
|
||||
static bool Error_Detected = false;
|
||||
|
||||
static void MyErrorHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
static void MyErrorHandler(BACNET_ADDRESS *src,
|
||||
uint8_t invoke_id,
|
||||
BACNET_ERROR_CLASS error_class,
|
||||
BACNET_ERROR_CODE error_code)
|
||||
{
|
||||
@@ -74,8 +75,8 @@ static void MyErrorHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
Error_Detected = true;
|
||||
}
|
||||
|
||||
void MyAbortHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
uint8_t abort_reason, bool server)
|
||||
static void MyAbortHandler(
|
||||
BACNET_ADDRESS *src, uint8_t invoke_id, uint8_t abort_reason, bool server)
|
||||
{
|
||||
/* FIXME: verify src and invoke id */
|
||||
(void)src;
|
||||
@@ -85,8 +86,8 @@ void MyAbortHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
Error_Detected = true;
|
||||
}
|
||||
|
||||
void MyRejectHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
uint8_t reject_reason)
|
||||
static void MyRejectHandler(
|
||||
BACNET_ADDRESS *src, uint8_t invoke_id, uint8_t reject_reason)
|
||||
{
|
||||
/* FIXME: verify src and invoke id */
|
||||
(void)src;
|
||||
@@ -95,8 +96,8 @@ void MyRejectHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
Error_Detected = true;
|
||||
}
|
||||
|
||||
void MyReinitializeDeviceSimpleAckHandler(BACNET_ADDRESS *src,
|
||||
uint8_t invoke_id)
|
||||
static void MyReinitializeDeviceSimpleAckHandler(
|
||||
BACNET_ADDRESS *src, uint8_t invoke_id)
|
||||
{
|
||||
(void)src;
|
||||
(void)invoke_id;
|
||||
@@ -115,21 +116,21 @@ static void Init_Service_Handlers(void)
|
||||
It is required to send the proper reject message... */
|
||||
apdu_set_unrecognized_service_handler_handler(handler_unrecognized_service);
|
||||
/* we must implement read property - it's required! */
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_PROPERTY,
|
||||
handler_read_property);
|
||||
apdu_set_confirmed_handler(
|
||||
SERVICE_CONFIRMED_READ_PROPERTY, handler_read_property);
|
||||
/* handle the ack coming back */
|
||||
apdu_set_confirmed_simple_ack_handler(SERVICE_CONFIRMED_REINITIALIZE_DEVICE,
|
||||
MyReinitializeDeviceSimpleAckHandler);
|
||||
/* handle any errors coming back */
|
||||
apdu_set_error_handler(SERVICE_CONFIRMED_REINITIALIZE_DEVICE,
|
||||
MyErrorHandler);
|
||||
apdu_set_error_handler(
|
||||
SERVICE_CONFIRMED_REINITIALIZE_DEVICE, MyErrorHandler);
|
||||
apdu_set_abort_handler(MyAbortHandler);
|
||||
apdu_set_reject_handler(MyRejectHandler);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
BACNET_ADDRESS src = {0}; /* address where message came from */
|
||||
BACNET_ADDRESS src = { 0 }; /* address where message came from */
|
||||
uint16_t pdu_len = 0;
|
||||
unsigned timeout = 100; /* milliseconds */
|
||||
unsigned max_apdu = 0;
|
||||
@@ -142,8 +143,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (argc < 3) {
|
||||
/* note: priority 16 and 0 should produce the same end results... */
|
||||
printf(
|
||||
"Usage: %s device-instance state [password]\r\n"
|
||||
printf("Usage: %s device-instance state [password]\r\n"
|
||||
"Send BACnet ReinitializeDevice service to device.\r\n"
|
||||
"\r\n"
|
||||
"The device-instance can be 0 to %d.\r\n"
|
||||
@@ -164,8 +164,9 @@ int main(int argc, char *argv[])
|
||||
Target_Device_Object_Instance = strtol(argv[1], NULL, 0);
|
||||
Reinitialize_State = strtol(argv[2], NULL, 0);
|
||||
/* optional password */
|
||||
if (argc > 3)
|
||||
if (argc > 3) {
|
||||
Reinitialize_Password = argv[3];
|
||||
}
|
||||
|
||||
if (Target_Device_Object_Instance >= BACNET_MAX_INSTANCE) {
|
||||
fprintf(stderr, "device-instance=%u - it must be less than %u\r\n",
|
||||
@@ -183,11 +184,11 @@ int main(int argc, char *argv[])
|
||||
last_seconds = time(NULL);
|
||||
timeout_seconds = (apdu_timeout() / 1000) * apdu_retries();
|
||||
/* try to bind with the device */
|
||||
found = address_bind_request(Target_Device_Object_Instance, &max_apdu,
|
||||
&Target_Address);
|
||||
found = address_bind_request(
|
||||
Target_Device_Object_Instance, &max_apdu, &Target_Address);
|
||||
if (!found) {
|
||||
Send_WhoIs(Target_Device_Object_Instance,
|
||||
Target_Device_Object_Instance);
|
||||
Send_WhoIs(
|
||||
Target_Device_Object_Instance, Target_Device_Object_Instance);
|
||||
}
|
||||
/* loop forever */
|
||||
for (;;) {
|
||||
@@ -202,23 +203,24 @@ int main(int argc, char *argv[])
|
||||
npdu_handler(&src, &Rx_Buf[0], pdu_len);
|
||||
}
|
||||
/* at least one second has passed */
|
||||
if (current_seconds != last_seconds)
|
||||
if (current_seconds != last_seconds) {
|
||||
tsm_timer_milliseconds(((current_seconds - last_seconds) * 1000));
|
||||
}
|
||||
if (Error_Detected)
|
||||
break;
|
||||
/* wait until the device is bound, or timeout and quit */
|
||||
if (!found) {
|
||||
found = address_bind_request(Target_Device_Object_Instance,
|
||||
&max_apdu, &Target_Address);
|
||||
found = address_bind_request(
|
||||
Target_Device_Object_Instance, &max_apdu, &Target_Address);
|
||||
}
|
||||
if (found) {
|
||||
if (invoke_id == 0) {
|
||||
invoke_id = Send_Reinitialize_Device_Request(
|
||||
Target_Device_Object_Instance, Reinitialize_State,
|
||||
Reinitialize_Password);
|
||||
} else if (tsm_invoke_id_free(invoke_id))
|
||||
} else if (tsm_invoke_id_free(invoke_id)) {
|
||||
break;
|
||||
else if (tsm_invoke_id_failed(invoke_id)) {
|
||||
} else if (tsm_invoke_id_failed(invoke_id)) {
|
||||
fprintf(stderr, "\rError: TSM Timeout!\r\n");
|
||||
tsm_free_invoke_id(invoke_id);
|
||||
/* try again or abort? */
|
||||
@@ -0,0 +1,78 @@
|
||||
#Makefile to build BACnet Application for the GCC port
|
||||
|
||||
# tools - only if you need them.
|
||||
# Most platforms have this already defined
|
||||
# CC = gcc
|
||||
|
||||
# Executable file name
|
||||
TARGET = bacroute
|
||||
|
||||
TARGET_BIN = ${TARGET}$(TARGET_EXT)
|
||||
|
||||
# BACNET_PORT, BACNET_PORT_DIR, BACNET_PORT_SRC are defined in common Makefile
|
||||
# BACNET_SRC_DIR is defined in common apps Makefile
|
||||
BACNET_OBJECT_DIR = $(BACNET_SRC_DIR)/bacnet/basic/object
|
||||
SRC = main.c \
|
||||
$(BACNET_OBJECT_DIR)/netport.c \
|
||||
$(BACNET_OBJECT_DIR)/client/device-client.c
|
||||
|
||||
PORT_BIP6_SRC = \
|
||||
$(BACNET_PORT_DIR)/bip6.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/datalink/bvlc6.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/bbmd6/h_bbmd6.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/bbmd6/vmac.c
|
||||
|
||||
PORT_BIP_SRC = \
|
||||
$(BACNET_PORT_DIR)/bip-init.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/datalink/bvlc.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/datalink/bip.c
|
||||
|
||||
# WARNINGS, DEBUGGING, OPTIMIZATION are defined in common apps Makefile
|
||||
# BACNET_DEFINES is defined in common apps Makefile
|
||||
# put all the flags together
|
||||
INCLUDES = -I$(BACNET_SRC_DIR) -I$(BACNET_PORT_DIR)
|
||||
CFLAGS += $(WARNINGS) $(DEBUGGING) $(OPTIMIZATION) $(BACNET_DEFINES) $(INCLUDES)
|
||||
LFLAGS += -Wl,$(SYSTEM_LIB)
|
||||
ifneq (${BACNET_LIB},)
|
||||
LFLAGS += -Wl,$(BACNET_LIB)
|
||||
endif
|
||||
# GCC dead code removal
|
||||
CFLAGS += -ffunction-sections -fdata-sections
|
||||
LFLAGS += -Wl,--gc-sections
|
||||
|
||||
BACNET_SRC ?= \
|
||||
$(wildcard $(BACNET_SRC_DIR)/bacnet/*.c) \
|
||||
$(wildcard $(BACNET_SRC_DIR)/bacnet/basic/*.c) \
|
||||
$(wildcard $(BACNET_SRC_DIR)/bacnet/basic/binding/*.c) \
|
||||
$(wildcard $(BACNET_SRC_DIR)/bacnet/basic/service/*.c) \
|
||||
$(wildcard $(BACNET_SRC_DIR)/bacnet/basic/sys/*.c) \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/npdu/h_routed_npdu.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/npdu/s_router.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/tsm/tsm.c
|
||||
|
||||
SRCS = ${SRC} $(BACNET_SRC) ${PORT_BIP6_SRC} ${PORT_BIP_SRC}
|
||||
|
||||
OBJS += ${SRCS:.c=.o}
|
||||
|
||||
.PHONY: all
|
||||
all: Makefile ${TARGET_BIN}
|
||||
|
||||
${TARGET_BIN}: ${OBJS}
|
||||
${CC} ${PFLAGS} ${OBJS} ${LFLAGS} -o $@
|
||||
size $@
|
||||
cp $@ ../../bin
|
||||
|
||||
.c.o:
|
||||
${CC} -c ${CFLAGS} $*.c -o $@
|
||||
|
||||
.PHONY: depend
|
||||
depend:
|
||||
rm -f .depend
|
||||
${CC} -MM ${CFLAGS} *.c >> .depend
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f core ${TARGET_BIN} ${OBJS} $(TARGET).map
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
@@ -36,28 +36,33 @@
|
||||
#include <time.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "bacdef.h"
|
||||
#include "config.h"
|
||||
#include "debug.h"
|
||||
#include "bactext.h"
|
||||
#include "bacerror.h"
|
||||
#include "iam.h"
|
||||
#include "arf.h"
|
||||
#include "tsm.h"
|
||||
#include "address.h"
|
||||
#include "npdu.h"
|
||||
#include "apdu.h"
|
||||
#include "client.h"
|
||||
#include "net.h"
|
||||
#include "version.h"
|
||||
|
||||
#include "bacnet/bacdef.h"
|
||||
#include "bacnet/config.h"
|
||||
#include "bacnet/bactext.h"
|
||||
#include "bacnet/bacerror.h"
|
||||
#include "bacnet/iam.h"
|
||||
#include "bacnet/arf.h"
|
||||
#include "bacnet/npdu.h"
|
||||
#include "bacnet/apdu.h"
|
||||
#include "bacnet/version.h"
|
||||
/* some demo modules we use */
|
||||
#include "bacnet/basic/sys/debug.h"
|
||||
#include "bacnet/basic/tsm/tsm.h"
|
||||
#include "bacnet/basic/binding/address.h"
|
||||
#include "bacnet/basic/services.h"
|
||||
/* port agnostic file */
|
||||
#include "bacport.h"
|
||||
/* our datalink layers */
|
||||
#include "bvlc6.h"
|
||||
#include "bip6.h"
|
||||
#include "bacnet/datalink/bvlc6.h"
|
||||
#include "bacnet/datalink/bip6.h"
|
||||
#include "bacnet/basic/bbmd6/h_bbmd6.h"
|
||||
#undef MAX_HEADER
|
||||
#undef MAX_MPDU
|
||||
#include "bip.h"
|
||||
#include "bvlc.h"
|
||||
#include "bacnet/datalink/bip.h"
|
||||
#include "bacnet/datalink/bvlc.h"
|
||||
|
||||
/* current version of the BACnet stack */
|
||||
static const char *BACnet_Version = BACNET_VERSION_TEXT;
|
||||
|
||||
/**
|
||||
* 6.6.1 Routing Tables
|
||||
@@ -320,8 +325,10 @@ static void datalink_get_broadcast_address(BACNET_ADDRESS *dest)
|
||||
*
|
||||
* @return number of bytes sent
|
||||
*/
|
||||
static int datalink_send_pdu(uint16_t snet, BACNET_ADDRESS *dest,
|
||||
BACNET_NPDU_DATA *npdu_data, uint8_t *pdu,
|
||||
static int datalink_send_pdu(uint16_t snet,
|
||||
BACNET_ADDRESS *dest,
|
||||
BACNET_NPDU_DATA *npdu_data,
|
||||
uint8_t *pdu,
|
||||
unsigned int pdu_len)
|
||||
{
|
||||
int bytes_sent = 0;
|
||||
@@ -341,36 +348,6 @@ static int datalink_send_pdu(uint16_t snet, BACNET_ADDRESS *dest,
|
||||
return bytes_sent;
|
||||
}
|
||||
|
||||
/** Initialize an npdu_data structure with given parameters and good defaults,
|
||||
* and add the Network Layer Message fields.
|
||||
* The name is a misnomer, as it doesn't do any actual encoding here.
|
||||
* @see npdu_encode_npdu_data for a simpler version to use when sending an
|
||||
* APDU instead of a Network Layer Message.
|
||||
*
|
||||
* @param npdu_data [out] Returns a filled-out structure with information
|
||||
* provided by the other arguments and
|
||||
* good defaults.
|
||||
* @param network_message_type [in] The type of Network Layer Message.
|
||||
* @param data_expecting_reply [in] True if message should have a reply.
|
||||
* @param priority [in] One of the 4 priorities defined in section 6.2.2,
|
||||
* like B'11' = Life Safety message
|
||||
*/
|
||||
static void npdu_encode_npdu_network(
|
||||
BACNET_NPDU_DATA *npdu_data,
|
||||
BACNET_NETWORK_MESSAGE_TYPE network_message_type, bool data_expecting_reply,
|
||||
BACNET_MESSAGE_PRIORITY priority)
|
||||
{
|
||||
if (npdu_data) {
|
||||
npdu_data->data_expecting_reply = data_expecting_reply;
|
||||
npdu_data->protocol_version = BACNET_PROTOCOL_VERSION;
|
||||
npdu_data->network_layer_message = true; /* false if APDU */
|
||||
npdu_data->network_message_type = network_message_type; /* optional */
|
||||
npdu_data->vendor_id = 0; /* optional, if net message type is > 0x80 */
|
||||
npdu_data->priority = priority;
|
||||
npdu_data->hop_count = HOP_COUNT_DEFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Broadcast an I-am-router-to-network message
|
||||
*
|
||||
@@ -443,7 +420,7 @@ static void send_i_am_router_to_network(uint16_t snet, uint16_t net)
|
||||
* Optionally may designate a particular router destination,
|
||||
* especially when ACKing receipt of this message type.
|
||||
*/
|
||||
void send_initialize_routing_table_ack(uint8_t snet, BACNET_ADDRESS *dst)
|
||||
static void send_initialize_routing_table_ack(uint8_t snet, BACNET_ADDRESS *dst)
|
||||
{
|
||||
BACNET_ADDRESS dest;
|
||||
bool data_expecting_reply = false;
|
||||
@@ -502,8 +479,8 @@ void send_initialize_routing_table_ack(uint8_t snet, BACNET_ADDRESS *dst)
|
||||
* destination.
|
||||
* @param reject_reason [in] One of the BACNET_NETWORK_REJECT_REASONS codes.
|
||||
*/
|
||||
void send_reject_message_to_network(uint16_t snet, BACNET_ADDRESS *dst,
|
||||
uint8_t reject_reason, uint16_t dnet)
|
||||
static void send_reject_message_to_network(
|
||||
uint16_t snet, BACNET_ADDRESS *dst, uint8_t reject_reason, uint16_t dnet)
|
||||
{
|
||||
BACNET_ADDRESS dest;
|
||||
bool data_expecting_reply = false;
|
||||
@@ -517,8 +494,8 @@ void send_reject_message_to_network(uint16_t snet, BACNET_ADDRESS *dst,
|
||||
datalink_get_broadcast_address(&dest);
|
||||
}
|
||||
npdu_encode_npdu_network(&npdu_data,
|
||||
NETWORK_MESSAGE_REJECT_MESSAGE_TO_NETWORK,
|
||||
data_expecting_reply, MESSAGE_PRIORITY_NORMAL);
|
||||
NETWORK_MESSAGE_REJECT_MESSAGE_TO_NETWORK, data_expecting_reply,
|
||||
MESSAGE_PRIORITY_NORMAL);
|
||||
/* We don't need src information, since a message can't originate from
|
||||
our downstream BACnet network. */
|
||||
pdu_len = npdu_encode_pdu(&Tx_Buffer[0], &dest, NULL, &npdu_data);
|
||||
@@ -548,8 +525,8 @@ static void send_who_is_router_to_network(uint16_t snet, uint16_t dnet)
|
||||
|
||||
datalink_get_broadcast_address(&dest);
|
||||
npdu_encode_npdu_network(&npdu_data,
|
||||
NETWORK_MESSAGE_WHO_IS_ROUTER_TO_NETWORK,
|
||||
data_expecting_reply, MESSAGE_PRIORITY_NORMAL);
|
||||
NETWORK_MESSAGE_WHO_IS_ROUTER_TO_NETWORK, data_expecting_reply,
|
||||
MESSAGE_PRIORITY_NORMAL);
|
||||
pdu_len = npdu_encode_pdu(&Tx_Buffer[0], &dest, NULL, &npdu_data);
|
||||
if (dnet) {
|
||||
len = encode_unsigned16(&Tx_Buffer[pdu_len], dnet);
|
||||
@@ -615,9 +592,11 @@ static void send_who_is_router_to_network(uint16_t snet, uint16_t dnet)
|
||||
* bytes that have already been decoded.
|
||||
* @param npdu_len [in] The length of the remaining NPDU message in npdu[].
|
||||
*/
|
||||
static void who_is_router_to_network_handler(uint16_t snet, BACNET_ADDRESS *src,
|
||||
static void who_is_router_to_network_handler(uint16_t snet,
|
||||
BACNET_ADDRESS *src,
|
||||
BACNET_NPDU_DATA *npdu_data,
|
||||
uint8_t *npdu, uint16_t npdu_len)
|
||||
uint8_t *npdu,
|
||||
uint16_t npdu_len)
|
||||
{
|
||||
DNET *port = NULL;
|
||||
uint16_t network = 0;
|
||||
@@ -664,8 +643,10 @@ static void who_is_router_to_network_handler(uint16_t snet, BACNET_ADDRESS *src,
|
||||
* bytes that have already been decoded.
|
||||
* @param npdu_len [in] The length of the remaining NPDU message in npdu[].
|
||||
*/
|
||||
static void network_control_handler(uint16_t snet, BACNET_ADDRESS *src,
|
||||
BACNET_NPDU_DATA *npdu_data, uint8_t *npdu,
|
||||
static void network_control_handler(uint16_t snet,
|
||||
BACNET_ADDRESS *src,
|
||||
BACNET_NPDU_DATA *npdu_data,
|
||||
uint8_t *npdu,
|
||||
uint16_t npdu_len)
|
||||
{
|
||||
uint16_t npdu_offset = 0;
|
||||
@@ -677,8 +658,8 @@ static void network_control_handler(uint16_t snet, BACNET_ADDRESS *src,
|
||||
fprintf(stderr, "Received %s\n", msg_name);
|
||||
switch (npdu_data->network_message_type) {
|
||||
case NETWORK_MESSAGE_WHO_IS_ROUTER_TO_NETWORK:
|
||||
who_is_router_to_network_handler(snet, src, npdu_data, npdu,
|
||||
npdu_len);
|
||||
who_is_router_to_network_handler(
|
||||
snet, src, npdu_data, npdu, npdu_len);
|
||||
break;
|
||||
case NETWORK_MESSAGE_I_AM_ROUTER_TO_NETWORK:
|
||||
/* add its DNETs to our routing table */
|
||||
@@ -713,8 +694,8 @@ static void network_control_handler(uint16_t snet, BACNET_ADDRESS *src,
|
||||
fprintf(stderr, "Reason: Network is busy.\n");
|
||||
break;
|
||||
case 3:
|
||||
fprintf(stderr,
|
||||
"Reason: Unknown network message type.\n");
|
||||
fprintf(
|
||||
stderr, "Reason: Unknown network message type.\n");
|
||||
break;
|
||||
case 4:
|
||||
fprintf(stderr, "Reason: Message too long.\n");
|
||||
@@ -789,8 +770,8 @@ static void network_control_handler(uint16_t snet, BACNET_ADDRESS *src,
|
||||
* @param snet [in] The source network port where the message came from
|
||||
* @param src [in] The BACNET_ADDRESS of the message's original src.
|
||||
*/
|
||||
static void routed_src_address(BACNET_ADDRESS *router_src, uint16_t snet,
|
||||
BACNET_ADDRESS *src)
|
||||
static void routed_src_address(
|
||||
BACNET_ADDRESS *router_src, uint16_t snet, BACNET_ADDRESS *src)
|
||||
{
|
||||
unsigned int i = 0;
|
||||
|
||||
@@ -837,9 +818,12 @@ static void routed_src_address(BACNET_ADDRESS *router_src, uint16_t snet,
|
||||
* @param apdu [in] The apdu portion of the request, to be processed.
|
||||
* @param apdu_len [in] The total (remaining) length of the apdu.
|
||||
*/
|
||||
static void routed_apdu_handler(uint16_t snet, BACNET_NPDU_DATA *npdu,
|
||||
BACNET_ADDRESS *src, BACNET_ADDRESS *dest,
|
||||
uint8_t *apdu, uint16_t apdu_len)
|
||||
static void routed_apdu_handler(uint16_t snet,
|
||||
BACNET_NPDU_DATA *npdu,
|
||||
BACNET_ADDRESS *src,
|
||||
BACNET_ADDRESS *dest,
|
||||
uint8_t *apdu,
|
||||
uint16_t apdu_len)
|
||||
{
|
||||
DNET *port = NULL;
|
||||
BACNET_ADDRESS local_dest;
|
||||
@@ -902,8 +886,8 @@ static void routed_apdu_handler(uint16_t snet, BACNET_NPDU_DATA *npdu,
|
||||
datalink_send_pdu(port->net, &local_dest, npdu, &Tx_Buffer[0],
|
||||
npdu_len + apdu_len);
|
||||
} else {
|
||||
debug_printf("Routing to another Router %u\n",
|
||||
(unsigned)remote_dest.net);
|
||||
debug_printf(
|
||||
"Routing to another Router %u\n", (unsigned)remote_dest.net);
|
||||
/* Case 2: the message must be
|
||||
relayed to another router for further transmission */
|
||||
/* In the second case, if the Hop Count is greater than zero,
|
||||
@@ -928,8 +912,8 @@ static void routed_apdu_handler(uint16_t snet, BACNET_NPDU_DATA *npdu,
|
||||
routed_src_address(&router_src, snet, src);
|
||||
npdu_len = npdu_encode_pdu(&Tx_Buffer[0], dest, &router_src, npdu);
|
||||
memmove(&Tx_Buffer[npdu_len], apdu, apdu_len);
|
||||
datalink_send_pdu(port->net, dest, npdu, &Tx_Buffer[0],
|
||||
npdu_len + apdu_len);
|
||||
datalink_send_pdu(
|
||||
port->net, dest, npdu, &Tx_Buffer[0], npdu_len + apdu_len);
|
||||
/* If the next router is unknown, an attempt shall be made to
|
||||
identify it using a Who-Is-Router-To-Network message. */
|
||||
send_who_is_router_to_network(0, dest->net);
|
||||
@@ -951,12 +935,12 @@ static void routed_apdu_handler(uint16_t snet, BACNET_NPDU_DATA *npdu,
|
||||
* @param pdu [in] Buffer containing the NPDU and APDU of the received packet.
|
||||
* @param pdu_len [in] The size of the received message in the pdu[] buffer.
|
||||
*/
|
||||
static void my_routing_npdu_handler(uint16_t snet, BACNET_ADDRESS *src,
|
||||
uint8_t *pdu, uint16_t pdu_len)
|
||||
static void my_routing_npdu_handler(
|
||||
uint16_t snet, BACNET_ADDRESS *src, uint8_t *pdu, uint16_t pdu_len)
|
||||
{
|
||||
int apdu_offset = 0;
|
||||
BACNET_ADDRESS dest = {0};
|
||||
BACNET_NPDU_DATA npdu_data = {0};
|
||||
BACNET_ADDRESS dest = { 0 };
|
||||
BACNET_NPDU_DATA npdu_data = { 0 };
|
||||
|
||||
if (!pdu) {
|
||||
/* no packet */
|
||||
@@ -967,8 +951,7 @@ static void my_routing_npdu_handler(uint16_t snet, BACNET_ADDRESS *src,
|
||||
} else if (npdu_data.network_layer_message) {
|
||||
if ((dest.net == 0) || (dest.net == BACNET_BROADCAST_NETWORK)) {
|
||||
network_control_handler(snet, src, &npdu_data,
|
||||
&pdu[apdu_offset],
|
||||
(uint16_t)(pdu_len - apdu_offset));
|
||||
&pdu[apdu_offset], (uint16_t)(pdu_len - apdu_offset));
|
||||
} else {
|
||||
/* The DNET is set, but we don't support downstream routers,
|
||||
* so we just silently drop this network layer message,
|
||||
@@ -988,8 +971,7 @@ static void my_routing_npdu_handler(uint16_t snet, BACNET_ADDRESS *src,
|
||||
/* then enter IDLE - ignore the PDU */
|
||||
} else {
|
||||
routed_apdu_handler(snet, &npdu_data, src, &dest,
|
||||
&pdu[apdu_offset],
|
||||
(uint16_t)(pdu_len - apdu_offset));
|
||||
&pdu[apdu_offset], (uint16_t)(pdu_len - apdu_offset));
|
||||
/* add a Device object and application layer */
|
||||
if ((dest.net == 0) ||
|
||||
(dest.net == BACNET_BROADCAST_NETWORK)) {
|
||||
@@ -998,8 +980,8 @@ static void my_routing_npdu_handler(uint16_t snet, BACNET_ADDRESS *src,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "NPDU: DNET=%u. Discarded!\n",
|
||||
(unsigned)dest.net);
|
||||
fprintf(
|
||||
stderr, "NPDU: DNET=%u. Discarded!\n", (unsigned)dest.net);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -1015,7 +997,7 @@ static void my_routing_npdu_handler(uint16_t snet, BACNET_ADDRESS *src,
|
||||
static void datalink_init(void)
|
||||
{
|
||||
char *pEnv = NULL;
|
||||
BACNET_ADDRESS my_address = {0};
|
||||
BACNET_ADDRESS my_address = { 0 };
|
||||
extern bool BIP_Debug;
|
||||
|
||||
/* BACnet/IP Initialization */
|
||||
@@ -1110,7 +1092,7 @@ static BOOL WINAPI CtrlCHandler(DWORD dwCtrlType)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void control_c_hooks(void)
|
||||
static void control_c_hooks(void)
|
||||
{
|
||||
SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), ENABLE_PROCESSED_INPUT);
|
||||
SetConsoleCtrlHandler((PHANDLER_ROUTINE)CtrlCHandler, TRUE);
|
||||
@@ -1123,14 +1105,14 @@ static void sig_int(int signo)
|
||||
exit(0);
|
||||
}
|
||||
|
||||
void signal_init(void)
|
||||
static void signal_init(void)
|
||||
{
|
||||
signal(SIGINT, sig_int);
|
||||
signal(SIGHUP, sig_int);
|
||||
signal(SIGTERM, sig_int);
|
||||
}
|
||||
|
||||
void control_c_hooks(void)
|
||||
static void control_c_hooks(void)
|
||||
{
|
||||
signal_init();
|
||||
}
|
||||
@@ -1145,7 +1127,7 @@ void control_c_hooks(void)
|
||||
*/
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
BACNET_ADDRESS src = {0}; /* address where message came from */
|
||||
BACNET_ADDRESS src = { 0 }; /* address where message came from */
|
||||
uint16_t pdu_len = 0;
|
||||
time_t last_seconds = 0;
|
||||
time_t current_seconds = 0;
|
||||
@@ -1179,8 +1161,8 @@ int main(int argc, char *argv[])
|
||||
/* process */
|
||||
if (pdu_len) {
|
||||
debug_printf("BACnet/IPv6 Received packet\n");
|
||||
my_routing_npdu_handler(BIP6_Net, &src, &BIP6_Rx_Buffer[0],
|
||||
pdu_len);
|
||||
my_routing_npdu_handler(
|
||||
BIP6_Net, &src, &BIP6_Rx_Buffer[0], pdu_len);
|
||||
}
|
||||
/* at least one second has passed */
|
||||
elapsed_seconds = (uint32_t)(current_seconds - last_seconds);
|
||||
@@ -30,17 +30,17 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "ipmodule.h"
|
||||
#include "bacint.h"
|
||||
#include "bacnet/bacint.h"
|
||||
|
||||
#ifdef TEST_PACKET
|
||||
uint8_t test_packet[] = {0x81, 0x0a, 0x00, 0x16, /* BVLC header */
|
||||
uint8_t test_packet[] = { 0x81, 0x0a, 0x00, 0x16, /* BVLC header */
|
||||
0x01, 0x24, 0x00, 0x01, 0x01, 0x0b, 0xff, /* NPDU */
|
||||
0x00, 0x03, 0x01, 0x0c, 0x0c, 0x00, 0x00,
|
||||
0x00, 0x02, 0x19, 0x55}; /* APDU */
|
||||
0x00, 0x03, 0x01, 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x19,
|
||||
0x55 }; /* APDU */
|
||||
#endif
|
||||
|
||||
extern int get_local_address_ioctl(char *ifname, struct in_addr *addr,
|
||||
int request);
|
||||
extern int get_local_address_ioctl(
|
||||
char *ifname, struct in_addr *addr, int request);
|
||||
|
||||
void *dl_ip_thread(void *pArgs)
|
||||
{
|
||||
@@ -49,7 +49,7 @@ void *dl_ip_thread(void *pArgs)
|
||||
MSG_DATA *msg_data;
|
||||
ROUTER_PORT *port = (ROUTER_PORT *)pArgs;
|
||||
IP_DATA ip_data; /* port specific parameters */
|
||||
BACNET_ADDRESS address = {0};
|
||||
BACNET_ADDRESS address = { 0 };
|
||||
int status;
|
||||
uint8_t shutdown = 0;
|
||||
|
||||
@@ -88,11 +88,11 @@ void *dl_ip_thread(void *pArgs)
|
||||
msg_data = (MSG_DATA *)bacmsg->data;
|
||||
memmove(&address.net, &msg_data->dest.net, 2);
|
||||
memmove(&address.mac_len, &msg_data->dest.len, 1);
|
||||
memmove(&address.mac[0], &msg_data->dest.adr[0],
|
||||
MAX_MAC_LEN);
|
||||
memmove(
|
||||
&address.mac[0], &msg_data->dest.adr[0], MAX_MAC_LEN);
|
||||
|
||||
dl_ip_send(&ip_data, &address, msg_data->pdu,
|
||||
msg_data->pdu_len);
|
||||
dl_ip_send(
|
||||
&ip_data, &address, msg_data->pdu, msg_data->pdu_len);
|
||||
|
||||
check_data(msg_data);
|
||||
|
||||
@@ -152,15 +152,16 @@ bool dl_ip_init(ROUTER_PORT *port, IP_DATA *ip_data)
|
||||
return false;
|
||||
}
|
||||
/* get broadcast address */
|
||||
status = get_local_address_ioctl(port->iface, &ip_data->broadcast_addr,
|
||||
SIOCGIFBRDADDR);
|
||||
status = get_local_address_ioctl(
|
||||
port->iface, &ip_data->broadcast_addr, SIOCGIFBRDADDR);
|
||||
if (status < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ip_data->socket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
||||
if (ip_data->socket < 0)
|
||||
if (ip_data->socket < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* setup socket options */
|
||||
|
||||
@@ -200,23 +201,24 @@ bool dl_ip_init(ROUTER_PORT *port, IP_DATA *ip_data)
|
||||
|
||||
PRINT(INFO, "Interface: %s\n", port->iface);
|
||||
PRINT(INFO, "IP Address: %s\n", inet_ntoa(ip_data->local_addr));
|
||||
PRINT(INFO, "IP Broadcast Address: %s\n",
|
||||
inet_ntoa(ip_data->broadcast_addr));
|
||||
PRINT(
|
||||
INFO, "IP Broadcast Address: %s\n", inet_ntoa(ip_data->broadcast_addr));
|
||||
PRINT(INFO, "UDP Port: 0x%04X [%hu]\n", (port->params.bip_params.port),
|
||||
(port->params.bip_params.port));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int dl_ip_send(IP_DATA *data, BACNET_ADDRESS *dest, uint8_t *pdu,
|
||||
unsigned pdu_len)
|
||||
int dl_ip_send(
|
||||
IP_DATA *data, BACNET_ADDRESS *dest, uint8_t *pdu, unsigned pdu_len)
|
||||
{
|
||||
struct sockaddr_in bip_dest = {0};
|
||||
struct sockaddr_in bip_dest = { 0 };
|
||||
int buff_len = 0;
|
||||
int bytes_sent = 0;
|
||||
|
||||
if (data->socket < 0)
|
||||
if (data->socket < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
data->buff[0] = BVLL_TYPE_BACNET_IP;
|
||||
bip_dest.sin_family = AF_INET;
|
||||
@@ -235,8 +237,8 @@ int dl_ip_send(IP_DATA *data, BACNET_ADDRESS *dest, uint8_t *pdu,
|
||||
}
|
||||
|
||||
buff_len = 2;
|
||||
buff_len += encode_unsigned16(&data->buff[buff_len],
|
||||
(uint16_t)(pdu_len + 4 /*inclusive */));
|
||||
buff_len += encode_unsigned16(
|
||||
&data->buff[buff_len], (uint16_t)(pdu_len + 4 /*inclusive */));
|
||||
memcpy(&data->buff[buff_len], pdu, pdu_len);
|
||||
buff_len += pdu_len;
|
||||
|
||||
@@ -249,19 +251,20 @@ int dl_ip_send(IP_DATA *data, BACNET_ADDRESS *dest, uint8_t *pdu,
|
||||
return bytes_sent;
|
||||
}
|
||||
|
||||
int dl_ip_recv(IP_DATA *data, MSG_DATA **msg_data, BACNET_ADDRESS *src,
|
||||
unsigned timeout)
|
||||
int dl_ip_recv(
|
||||
IP_DATA *data, MSG_DATA **msg_data, BACNET_ADDRESS *src, unsigned timeout)
|
||||
{
|
||||
int received_bytes = 0;
|
||||
uint16_t buff_len = 0; /* return value */
|
||||
fd_set read_fds;
|
||||
struct timeval select_timeout;
|
||||
struct sockaddr_in sin = {0};
|
||||
struct sockaddr_in sin = { 0 };
|
||||
socklen_t sin_len = sizeof(sin);
|
||||
|
||||
/* make sure the socket is open */
|
||||
if (data->socket < 0)
|
||||
if (data->socket < 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (timeout >= 1000) {
|
||||
select_timeout.tv_sec = timeout / 1000;
|
||||
@@ -283,12 +286,12 @@ int dl_ip_recv(IP_DATA *data, MSG_DATA **msg_data, BACNET_ADDRESS *src,
|
||||
#else
|
||||
int ret = select(data->socket + 1, &read_fds, NULL, NULL, &select_timeout);
|
||||
/* see if there is a packet for us */
|
||||
if (ret > 0)
|
||||
received_bytes =
|
||||
recvfrom(data->socket, (char *)&data->buff[0], data->max_buff, 0,
|
||||
(struct sockaddr *)&sin, &sin_len);
|
||||
else
|
||||
if (ret > 0) {
|
||||
received_bytes = recvfrom(data->socket, (char *)&data->buff[0],
|
||||
data->max_buff, 0, (struct sockaddr *)&sin, &sin_len);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
PRINT(DEBUG, "received from %s\n", inet_ntoa(sin.sin_addr));
|
||||
|
||||
@@ -378,10 +381,12 @@ int dl_ip_recv(IP_DATA *data, MSG_DATA **msg_data, BACNET_ADDRESS *src,
|
||||
void dl_ip_cleanup(IP_DATA *ip_data)
|
||||
{
|
||||
/* free buffer */
|
||||
if (ip_data->buff)
|
||||
if (ip_data->buff) {
|
||||
free(ip_data->buff);
|
||||
}
|
||||
/* close socket */
|
||||
if (ip_data->socket > 0)
|
||||
if (ip_data->socket > 0) {
|
||||
close(ip_data->socket);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -32,7 +32,7 @@
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "portthread.h"
|
||||
#include "bip.h"
|
||||
#include "bacnet/datalink/bip.h"
|
||||
|
||||
#define MAX_BIP_APDU 1476
|
||||
#define MAX_BIP_PDU (MAX_NPDU + MAX_BIP_APDU)
|
||||
@@ -103,8 +103,8 @@ int main(int argc, char *argv[])
|
||||
return -1;
|
||||
}
|
||||
|
||||
send_network_message(NETWORK_MESSAGE_I_AM_ROUTER_TO_NETWORK, msg_data,
|
||||
&buff, NULL);
|
||||
send_network_message(
|
||||
NETWORK_MESSAGE_I_AM_ROUTER_TO_NETWORK, msg_data, &buff, NULL);
|
||||
|
||||
while (true) {
|
||||
if (kbhit()) {
|
||||
@@ -338,15 +338,15 @@ bool read_config(char *filepath)
|
||||
current->route_info.mac[0] = 127;
|
||||
current->route_info.mac_len = 1;
|
||||
}
|
||||
result = config_setting_lookup_int(port, "max_master",
|
||||
(int *)¶m);
|
||||
result = config_setting_lookup_int(
|
||||
port, "max_master", (int *)¶m);
|
||||
if (result) {
|
||||
current->params.mstp_params.max_master = param;
|
||||
} else {
|
||||
current->params.mstp_params.max_master = 127;
|
||||
}
|
||||
result = config_setting_lookup_int(port, "max_frames",
|
||||
(int *)¶m);
|
||||
result = config_setting_lookup_int(
|
||||
port, "max_frames", (int *)¶m);
|
||||
if (result) {
|
||||
current->params.mstp_params.max_frames = param;
|
||||
} else {
|
||||
@@ -418,17 +418,17 @@ bool parse_cmd(int argc, char *argv[])
|
||||
const char *bipString = "p:n:D:";
|
||||
const char *mstpString = "m:b:p:d:s:n:D:";
|
||||
const struct option Options[] = {
|
||||
{"config", required_argument, NULL, 'c'},
|
||||
{"device", required_argument, NULL, 'D'},
|
||||
{"network", required_argument, NULL, 'n'},
|
||||
{"port", required_argument, NULL, 'P'},
|
||||
{"mac", required_argument, NULL, 'm'},
|
||||
{"baud", required_argument, NULL, 'b'},
|
||||
{"parity", required_argument, NULL, 'p'},
|
||||
{"databits", required_argument, NULL, 'd'},
|
||||
{"stopbits", required_argument, NULL, 's'},
|
||||
{"help", no_argument, NULL, 'h'},
|
||||
{NULL, no_argument, NULL, 0},
|
||||
{ "config", required_argument, NULL, 'c' },
|
||||
{ "device", required_argument, NULL, 'D' },
|
||||
{ "network", required_argument, NULL, 'n' },
|
||||
{ "port", required_argument, NULL, 'P' },
|
||||
{ "mac", required_argument, NULL, 'm' },
|
||||
{ "baud", required_argument, NULL, 'b' },
|
||||
{ "parity", required_argument, NULL, 'p' },
|
||||
{ "databits", required_argument, NULL, 'd' },
|
||||
{ "stopbits", required_argument, NULL, 's' },
|
||||
{ "help", no_argument, NULL, 'h' },
|
||||
{ NULL, no_argument, NULL, 0 },
|
||||
};
|
||||
|
||||
int opt, dev_opt, index, result, fd;
|
||||
@@ -621,8 +621,8 @@ bool parse_cmd(int argc, char *argv[])
|
||||
}
|
||||
break;
|
||||
}
|
||||
dev_opt = getopt_long(argc, argv, mstpString, Options,
|
||||
&index);
|
||||
dev_opt = getopt_long(
|
||||
argc, argv, mstpString, Options, &index);
|
||||
}
|
||||
opt = dev_opt;
|
||||
} else {
|
||||
@@ -666,8 +666,9 @@ bool init_router()
|
||||
ROUTER_PORT *port;
|
||||
|
||||
msgboxid = create_msgbox();
|
||||
if (msgboxid == INVALID_MSGBOX_ID)
|
||||
if (msgboxid == INVALID_MSGBOX_ID) {
|
||||
return false;
|
||||
}
|
||||
|
||||
port = head;
|
||||
/* add main message box id to all ports */
|
||||
@@ -702,8 +703,9 @@ void cleanup()
|
||||
ROUTER_PORT *port;
|
||||
BACMSG msg;
|
||||
|
||||
if (head == NULL)
|
||||
if (head == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
msg.origin = head->main_id;
|
||||
msg.type = SERVICE;
|
||||
@@ -714,8 +716,9 @@ void cleanup()
|
||||
/* send shutdown message to all router ports */
|
||||
port = head;
|
||||
while (port != NULL) {
|
||||
if (port->state == RUNNING)
|
||||
if (port->state == RUNNING) {
|
||||
send_to_msgbox(port->port_id, &msg);
|
||||
}
|
||||
port = port->next;
|
||||
}
|
||||
|
||||
@@ -741,8 +744,9 @@ void print_msg(BACMSG *msg)
|
||||
|
||||
if (data->pdu_len) {
|
||||
PRINT(DEBUG, "Message PDU: ");
|
||||
for (i = 0; i < data->pdu_len; i++)
|
||||
for (i = 0; i < data->pdu_len; i++) {
|
||||
PRINT(DEBUG, "%02X ", data->pdu[i]);
|
||||
}
|
||||
PRINT(DEBUG, "\n");
|
||||
}
|
||||
}
|
||||
@@ -73,10 +73,11 @@ BACMSG *recv_from_msgbox(MSGBOX_ID src, BACMSG *msg)
|
||||
|
||||
void del_msgbox(MSGBOX_ID msgboxid)
|
||||
{
|
||||
if (msgboxid == INVALID_MSGBOX_ID)
|
||||
if (msgboxid == INVALID_MSGBOX_ID) {
|
||||
return;
|
||||
else
|
||||
} else {
|
||||
msgctl(msgboxid, IPC_RMID, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void free_data(MSG_DATA *data)
|
||||
@@ -34,8 +34,8 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/msg.h>
|
||||
#include "bacdef.h"
|
||||
#include "npdu.h"
|
||||
#include "bacnet/bacdef.h"
|
||||
#include "bacnet/npdu.h"
|
||||
|
||||
extern pthread_mutex_t msg_lock;
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "mstpmodule.h"
|
||||
#include "bacint.h"
|
||||
#include "bacnet/bacint.h"
|
||||
#include "dlmstp_linux.h"
|
||||
#include <termios.h>
|
||||
|
||||
@@ -44,8 +44,8 @@
|
||||
void *dl_mstp_thread(void *pArgs)
|
||||
{
|
||||
ROUTER_PORT *port = (ROUTER_PORT *)pArgs;
|
||||
struct mstp_port_struct_t mstp_port = {(MSTP_RECEIVE_STATE)0};
|
||||
volatile SHARED_MSTP_DATA shared_port_data = {0};
|
||||
struct mstp_port_struct_t mstp_port = { (MSTP_RECEIVE_STATE)0 };
|
||||
volatile SHARED_MSTP_DATA shared_port_data = { 0 };
|
||||
uint16_t pdu_len;
|
||||
uint8_t shutdown = 0;
|
||||
|
||||
@@ -144,8 +144,7 @@ void *dl_mstp_thread(void *pArgs)
|
||||
|
||||
if (pdu_len > 0) {
|
||||
msg_data = (MSG_DATA *)malloc(sizeof(MSG_DATA));
|
||||
memmove(
|
||||
&(msg_data->src),
|
||||
memmove(&(msg_data->src),
|
||||
(const void *)&(shared_port_data.Receive_Packet.address),
|
||||
sizeof(shared_port_data.Receive_Packet.address));
|
||||
msg_data->src.adr[0] = msg_data->src.mac[0];
|
||||
@@ -30,7 +30,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "network_layer.h"
|
||||
#include "bacint.h"
|
||||
#include "bacnet/bacint.h"
|
||||
|
||||
uint16_t process_network_message(BACMSG *msg, MSG_DATA *data, uint8_t **buff)
|
||||
{
|
||||
@@ -180,8 +180,8 @@ uint16_t process_network_message(BACMSG *msg, MSG_DATA *data, uint8_t **buff)
|
||||
/* security messages */
|
||||
break;
|
||||
case NETWORK_MESSAGE_WHAT_IS_NETWORK_NUMBER:
|
||||
buff_len = create_network_message(NETWORK_MESSAGE_NETWORK_NUMBER_IS,
|
||||
data, buff, &buff);
|
||||
buff_len = create_network_message(
|
||||
NETWORK_MESSAGE_NETWORK_NUMBER_IS, data, buff, &buff);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -193,8 +193,10 @@ uint16_t process_network_message(BACMSG *msg, MSG_DATA *data, uint8_t **buff)
|
||||
}
|
||||
|
||||
uint16_t create_network_message(
|
||||
BACNET_NETWORK_MESSAGE_TYPE network_message_type, MSG_DATA *data,
|
||||
uint8_t **buff, void *val)
|
||||
BACNET_NETWORK_MESSAGE_TYPE network_message_type,
|
||||
MSG_DATA *data,
|
||||
uint8_t **buff,
|
||||
void *val)
|
||||
{
|
||||
int16_t buff_len;
|
||||
bool data_expecting_reply = false;
|
||||
@@ -229,8 +231,8 @@ uint16_t create_network_message(
|
||||
DNET *dnet;
|
||||
while (port != NULL) {
|
||||
if (port->route_info.net != data->src.net) {
|
||||
buff_len += encode_unsigned16(*buff + buff_len,
|
||||
port->route_info.net);
|
||||
buff_len += encode_unsigned16(
|
||||
*buff + buff_len, port->route_info.net);
|
||||
dnet = port->route_info.dnets;
|
||||
while (dnet != NULL) {
|
||||
buff_len +=
|
||||
@@ -267,8 +269,8 @@ uint16_t create_network_message(
|
||||
uint8_t portID = 1;
|
||||
|
||||
while (port != NULL) {
|
||||
buff_len += encode_unsigned16(*buff + buff_len,
|
||||
port->route_info.net);
|
||||
buff_len += encode_unsigned16(
|
||||
*buff + buff_len, port->route_info.net);
|
||||
(*buff)[buff_len++] = portID++;
|
||||
(*buff)[buff_len++] = 0;
|
||||
port = port->next;
|
||||
@@ -307,7 +309,9 @@ uint16_t create_network_message(
|
||||
}
|
||||
|
||||
void send_network_message(BACNET_NETWORK_MESSAGE_TYPE network_message_type,
|
||||
MSG_DATA *data, uint8_t **buff, void *val)
|
||||
MSG_DATA *data,
|
||||
uint8_t **buff,
|
||||
void *val)
|
||||
{
|
||||
BACMSG msg;
|
||||
ROUTER_PORT *port = head;
|
||||
@@ -34,10 +34,10 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "bacenum.h"
|
||||
#include "bacdef.h"
|
||||
#include "npdu.h"
|
||||
#include "net.h"
|
||||
#include "bacnet/bacenum.h"
|
||||
#include "bacnet/bacdef.h"
|
||||
#include "bacnet/npdu.h"
|
||||
#include "bacport.h"
|
||||
#include "portthread.h"
|
||||
|
||||
uint16_t process_network_message(
|
||||
@@ -36,8 +36,9 @@ ROUTER_PORT *find_snet(MSGBOX_ID id)
|
||||
ROUTER_PORT *port = head;
|
||||
|
||||
while (port != NULL) {
|
||||
if (port->port_id == id)
|
||||
if (port->port_id == id) {
|
||||
return port;
|
||||
}
|
||||
port = port->next;
|
||||
}
|
||||
|
||||
@@ -92,8 +93,9 @@ void add_dnet(RT_ENTRY *route_info, uint16_t net, BACNET_ADDRESS addr)
|
||||
route_info->dnets->next = NULL;
|
||||
} else {
|
||||
while (dnet != NULL) {
|
||||
if (dnet->net == net) /* make sure NETs are not repeated */
|
||||
if (dnet->net == net) { /* make sure NETs are not repeated */
|
||||
return;
|
||||
}
|
||||
tmp = dnet;
|
||||
dnet = dnet->next;
|
||||
}
|
||||
@@ -33,8 +33,8 @@
|
||||
#include <stdbool.h>
|
||||
#include <pthread.h>
|
||||
#include "msgqueue.h"
|
||||
#include "bacdef.h"
|
||||
#include "npdu.h"
|
||||
#include "bacnet/bacdef.h"
|
||||
#include "bacnet/npdu.h"
|
||||
|
||||
#define ERROR 1
|
||||
#define INFO 2
|
||||
@@ -0,0 +1,51 @@
|
||||
#Makefile to build BACnet Application using GCC compiler
|
||||
|
||||
# Executable file name
|
||||
TARGET = bacscov
|
||||
# BACnet objects that are used with this app
|
||||
BACNET_OBJECT_DIR = $(BACNET_SRC_DIR)/bacnet/basic/object
|
||||
SRC = main.c \
|
||||
$(BACNET_OBJECT_DIR)/client/device-client.c \
|
||||
$(BACNET_OBJECT_DIR)/netport.c
|
||||
BACNET_BASIC_SRC += \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_apdu.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_ccov.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_ucov.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_iam.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_noserv.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_rp.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/h_whois.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/s_cov.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/s_iam.c \
|
||||
$(BACNET_SRC_DIR)/bacnet/basic/service/s_whois.c
|
||||
|
||||
# TARGET_EXT is defined in apps/Makefile as .exe or nothing
|
||||
TARGET_BIN = ${TARGET}$(TARGET_EXT)
|
||||
|
||||
SRCS = $(SRC) $(BACNET_SRC) $(BACNET_BASIC_SRC) $(BACNET_PORT_SRC)
|
||||
|
||||
OBJS += ${SRCS:.c=.o}
|
||||
|
||||
.PHONY: all
|
||||
all: Makefile ${TARGET_BIN}
|
||||
|
||||
${TARGET_BIN}: ${OBJS}
|
||||
${CC} ${PFLAGS} ${OBJS} ${LFLAGS} -o $@
|
||||
size $@
|
||||
cp $@ ../../bin
|
||||
|
||||
.c.o:
|
||||
${CC} -c ${CFLAGS} $*.c -o $@
|
||||
|
||||
.PHONY: depend
|
||||
depend:
|
||||
rm -f .depend
|
||||
${CC} -MM ${CFLAGS} *.c >> .depend
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f core ${TARGET_BIN} ${OBJS} $(TARGET).map
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
@@ -33,29 +33,29 @@
|
||||
|
||||
#define PRINT_ENABLED 1
|
||||
|
||||
#include "bacdef.h"
|
||||
#include "config.h"
|
||||
#include "bactext.h"
|
||||
#include "bacerror.h"
|
||||
#include "iam.h"
|
||||
#include "arf.h"
|
||||
#include "tsm.h"
|
||||
#include "address.h"
|
||||
#include "npdu.h"
|
||||
#include "apdu.h"
|
||||
#include "device.h"
|
||||
#include "net.h"
|
||||
#include "datalink.h"
|
||||
#include "whois.h"
|
||||
#include "bacnet/bacdef.h"
|
||||
#include "bacnet/config.h"
|
||||
#include "bacnet/bactext.h"
|
||||
#include "bacnet/bacerror.h"
|
||||
#include "bacnet/iam.h"
|
||||
#include "bacnet/arf.h"
|
||||
#include "bacnet/basic/tsm/tsm.h"
|
||||
#include "bacnet/basic/binding/address.h"
|
||||
#include "bacnet/npdu.h"
|
||||
#include "bacnet/apdu.h"
|
||||
#include "bacnet/basic/object/device.h"
|
||||
#include "bacport.h"
|
||||
#include "bacnet/datalink/datalink.h"
|
||||
#include "bacnet/whois.h"
|
||||
/* some demo stuff needed */
|
||||
#include "filename.h"
|
||||
#include "handlers.h"
|
||||
#include "client.h"
|
||||
#include "txbuf.h"
|
||||
#include "dlenv.h"
|
||||
#include "bacnet/basic/sys/filename.h"
|
||||
#include "bacnet/basic/services.h"
|
||||
#include "bacnet/basic/services.h"
|
||||
#include "bacnet/basic/tsm/tsm.h"
|
||||
#include "bacnet/datalink/dlenv.h"
|
||||
|
||||
/* buffer used for receive */
|
||||
static uint8_t Rx_Buf[MAX_MPDU] = {0};
|
||||
static uint8_t Rx_Buf[MAX_MPDU] = { 0 };
|
||||
|
||||
/* converted command line arguments */
|
||||
static uint32_t Target_Device_Object_Instance = BACNET_MAX_INSTANCE;
|
||||
@@ -73,7 +73,8 @@ BACNET_SUBSCRIBE_COV_DATA *COV_Subscribe_Data = NULL;
|
||||
static bool Simple_Ack_Detected = false;
|
||||
static bool Cancel_Requested = false;
|
||||
|
||||
static void MyErrorHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
static void MyErrorHandler(BACNET_ADDRESS *src,
|
||||
uint8_t invoke_id,
|
||||
BACNET_ERROR_CLASS error_class,
|
||||
BACNET_ERROR_CODE error_code)
|
||||
{
|
||||
@@ -86,8 +87,8 @@ static void MyErrorHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
}
|
||||
}
|
||||
|
||||
void MyAbortHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
uint8_t abort_reason, bool server)
|
||||
static void MyAbortHandler(
|
||||
BACNET_ADDRESS *src, uint8_t invoke_id, uint8_t abort_reason, bool server)
|
||||
{
|
||||
(void)server;
|
||||
if (address_match(&Target_Address, src) &&
|
||||
@@ -98,8 +99,8 @@ void MyAbortHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
}
|
||||
}
|
||||
|
||||
void MyRejectHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
uint8_t reject_reason)
|
||||
static void MyRejectHandler(
|
||||
BACNET_ADDRESS *src, uint8_t invoke_id, uint8_t reject_reason)
|
||||
{
|
||||
if (address_match(&Target_Address, src) &&
|
||||
(invoke_id == Request_Invoke_ID)) {
|
||||
@@ -109,21 +110,22 @@ void MyRejectHandler(BACNET_ADDRESS *src, uint8_t invoke_id,
|
||||
}
|
||||
}
|
||||
|
||||
void My_Unconfirmed_COV_Notification_Handler(uint8_t *service_request,
|
||||
uint16_t service_len,
|
||||
BACNET_ADDRESS *src)
|
||||
static void My_Unconfirmed_COV_Notification_Handler(
|
||||
uint8_t *service_request, uint16_t service_len, BACNET_ADDRESS *src)
|
||||
{
|
||||
handler_ucov_notification(service_request, service_len, src);
|
||||
}
|
||||
|
||||
void My_Confirmed_COV_Notification_Handler(
|
||||
uint8_t *service_request, uint16_t service_len, BACNET_ADDRESS *src,
|
||||
static void My_Confirmed_COV_Notification_Handler(uint8_t *service_request,
|
||||
uint16_t service_len,
|
||||
BACNET_ADDRESS *src,
|
||||
BACNET_CONFIRMED_SERVICE_DATA *service_data)
|
||||
{
|
||||
handler_ccov_notification(service_request, service_len, src, service_data);
|
||||
}
|
||||
|
||||
void MyWritePropertySimpleAckHandler(BACNET_ADDRESS *src, uint8_t invoke_id)
|
||||
static void MyWritePropertySimpleAckHandler(
|
||||
BACNET_ADDRESS *src, uint8_t invoke_id)
|
||||
{
|
||||
if (address_match(&Target_Address, src) &&
|
||||
(invoke_id == Request_Invoke_ID)) {
|
||||
@@ -144,23 +146,23 @@ static void Init_Service_Handlers(void)
|
||||
It is required to send the proper reject message... */
|
||||
apdu_set_unrecognized_service_handler_handler(handler_unrecognized_service);
|
||||
/* we must implement read property - it's required! */
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_PROPERTY,
|
||||
handler_read_property);
|
||||
apdu_set_confirmed_handler(
|
||||
SERVICE_CONFIRMED_READ_PROPERTY, handler_read_property);
|
||||
/* handle the data coming back from COV subscriptions */
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_COV_NOTIFICATION,
|
||||
My_Confirmed_COV_Notification_Handler);
|
||||
apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_COV_NOTIFICATION,
|
||||
My_Unconfirmed_COV_Notification_Handler);
|
||||
/* handle the Simple ack coming back from SubscribeCOV */
|
||||
apdu_set_confirmed_simple_ack_handler(SERVICE_CONFIRMED_SUBSCRIBE_COV,
|
||||
MyWritePropertySimpleAckHandler);
|
||||
apdu_set_confirmed_simple_ack_handler(
|
||||
SERVICE_CONFIRMED_SUBSCRIBE_COV, MyWritePropertySimpleAckHandler);
|
||||
/* handle any errors coming back */
|
||||
apdu_set_error_handler(SERVICE_CONFIRMED_SUBSCRIBE_COV, MyErrorHandler);
|
||||
apdu_set_abort_handler(MyAbortHandler);
|
||||
apdu_set_reject_handler(MyRejectHandler);
|
||||
}
|
||||
|
||||
void cleanup(void)
|
||||
static void cleanup(void)
|
||||
{
|
||||
BACNET_SUBSCRIBE_COV_DATA *cov_data = NULL;
|
||||
BACNET_SUBSCRIBE_COV_DATA *cov_data_old = NULL;
|
||||
@@ -175,7 +177,7 @@ void cleanup(void)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
BACNET_ADDRESS src = {0}; /* address where message came from */
|
||||
BACNET_ADDRESS src = { 0 }; /* address where message came from */
|
||||
uint16_t pdu_len = 0;
|
||||
unsigned timeout = 100; /* milliseconds */
|
||||
unsigned max_apdu = 0;
|
||||
@@ -201,8 +203,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
if (print_usage_terse) {
|
||||
filename = filename_remove_path(argv[0]);
|
||||
printf(
|
||||
"Usage: %s device-id object-type object-instance "
|
||||
printf("Usage: %s device-id object-type object-instance "
|
||||
"process-id <[un]confirmed lifetime|cancel>\r\n",
|
||||
filename);
|
||||
if (!print_usage_verbose) {
|
||||
@@ -210,8 +211,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
if (print_usage_verbose) {
|
||||
printf(
|
||||
"\r\n"
|
||||
printf("\r\n"
|
||||
"device-id:\r\n"
|
||||
"The subscriber BACnet Device Object Instance number.\r\n"
|
||||
"\r\n"
|
||||
@@ -325,11 +325,11 @@ int main(int argc, char *argv[])
|
||||
last_seconds = time(NULL);
|
||||
timeout_seconds = (apdu_timeout() / 1000) * apdu_retries();
|
||||
/* try to bind with the device */
|
||||
found = address_bind_request(Target_Device_Object_Instance, &max_apdu,
|
||||
&Target_Address);
|
||||
found = address_bind_request(
|
||||
Target_Device_Object_Instance, &max_apdu, &Target_Address);
|
||||
if (!found) {
|
||||
Send_WhoIs(Target_Device_Object_Instance,
|
||||
Target_Device_Object_Instance);
|
||||
Send_WhoIs(
|
||||
Target_Device_Object_Instance, Target_Device_Object_Instance);
|
||||
}
|
||||
/* start at the beginning of the subscribe list */
|
||||
cov_data = COV_Subscribe_Data;
|
||||
@@ -351,8 +351,8 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
/* wait until the device is bound, or timeout and quit */
|
||||
if (!found) {
|
||||
found = address_bind_request(Target_Device_Object_Instance,
|
||||
&max_apdu, &Target_Address);
|
||||
found = address_bind_request(
|
||||
Target_Device_Object_Instance, &max_apdu, &Target_Address);
|
||||
}
|
||||
if (found) {
|
||||
if (Request_Invoke_ID == 0) {
|
||||
@@ -371,8 +371,7 @@ int main(int argc, char *argv[])
|
||||
/* increase the timeout to the longest lifetime */
|
||||
timeout_seconds = cov_data->lifetime;
|
||||
}
|
||||
printf(
|
||||
"Sent SubscribeCOV request. "
|
||||
printf("Sent SubscribeCOV request. "
|
||||
" Waiting up to %u seconds....\r\n",
|
||||
(unsigned)(timeout_seconds - elapsed_seconds));
|
||||
} else if (tsm_invoke_id_free(Request_Invoke_ID)) {
|
||||
@@ -0,0 +1,71 @@
|
||||
#Makefile to build BACnet Application for the GCC port
|
||||
|
||||
# Executable file name
|
||||
TARGET = bacserv
|
||||
BACNET_OBJECT_DIR = $(BACNET_SRC_DIR)/bacnet/basic/object
|
||||
SRC = main.c \
|
||||
$(BACNET_OBJECT_DIR)/device.c \
|
||||
$(BACNET_OBJECT_DIR)/ai.c \
|
||||
$(BACNET_OBJECT_DIR)/ao.c \
|
||||
$(BACNET_OBJECT_DIR)/av.c \
|
||||
$(BACNET_OBJECT_DIR)/bi.c \
|
||||
$(BACNET_OBJECT_DIR)/bo.c \
|
||||
$(BACNET_OBJECT_DIR)/bv.c \
|
||||
$(BACNET_OBJECT_DIR)/channel.c \
|
||||
$(BACNET_OBJECT_DIR)/command.c \
|
||||
$(BACNET_OBJECT_DIR)/csv.c \
|
||||
$(BACNET_OBJECT_DIR)/iv.c \
|
||||
$(BACNET_OBJECT_DIR)/lc.c \
|
||||
$(BACNET_OBJECT_DIR)/lo.c \
|
||||
$(BACNET_OBJECT_DIR)/lsp.c \
|
||||
$(BACNET_OBJECT_DIR)/ms-input.c \
|
||||
$(BACNET_OBJECT_DIR)/mso.c \
|
||||
$(BACNET_OBJECT_DIR)/msv.c \
|
||||
$(BACNET_OBJECT_DIR)/osv.c \
|
||||
$(BACNET_OBJECT_DIR)/piv.c \
|
||||
$(BACNET_OBJECT_DIR)/nc.c \
|
||||
$(BACNET_OBJECT_DIR)/netport.c \
|
||||
$(BACNET_OBJECT_DIR)/trendlog.c \
|
||||
$(BACNET_OBJECT_DIR)/schedule.c \
|
||||
$(BACNET_OBJECT_DIR)/access_credential.c \
|
||||
$(BACNET_OBJECT_DIR)/access_door.c \
|
||||
$(BACNET_OBJECT_DIR)/access_point.c \
|
||||
$(BACNET_OBJECT_DIR)/access_rights.c \
|
||||
$(BACNET_OBJECT_DIR)/access_user.c \
|
||||
$(BACNET_OBJECT_DIR)/access_zone.c \
|
||||
$(BACNET_OBJECT_DIR)/credential_data_input.c \
|
||||
$(BACNET_OBJECT_DIR)/bacfile.c
|
||||
|
||||
BACNET_BASIC_SRC += \
|
||||
$(wildcard $(BACNET_SRC_DIR)/bacnet/basic/service/*.c) \
|
||||
|
||||
# TARGET_EXT is defined in apps/Makefile as .exe or nothing
|
||||
TARGET_BIN = ${TARGET}$(TARGET_EXT)
|
||||
|
||||
SRCS = $(SRC) $(BACNET_SRC) $(BACNET_BASIC_SRC) $(BACNET_PORT_SRC)
|
||||
|
||||
OBJS += ${SRCS:.c=.o}
|
||||
|
||||
.PHONY: all
|
||||
all: Makefile ${TARGET_BIN}
|
||||
|
||||
${TARGET_BIN}: ${OBJS}
|
||||
${CC} ${PFLAGS} ${OBJS} ${LFLAGS} -o $@
|
||||
size $@
|
||||
cp $@ ../../bin
|
||||
|
||||
.c.o:
|
||||
${CC} -c ${CFLAGS} $*.c -o $@
|
||||
|
||||
.PHONY: depend
|
||||
depend:
|
||||
rm -f .depend
|
||||
${CC} -MM ${CFLAGS} *.c >> .depend
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f core ${TARGET_BIN} ${OBJS} $(TARGET).map
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
@@ -0,0 +1,673 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<CodeBlocks_project_file>
|
||||
<FileVersion major="1" minor="6" />
|
||||
<Project>
|
||||
<Option title="BACnet Server Demo" />
|
||||
<Option pch_mode="2" />
|
||||
<Option compiler="gcc" />
|
||||
<Build>
|
||||
<Target title="Debug">
|
||||
<Option output="bin/Debug/bacserv" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj/Debug/" />
|
||||
<Option type="1" />
|
||||
<Option compiler="gcc" />
|
||||
<Compiler>
|
||||
<Add option="-Wall" />
|
||||
<Add option="-g" />
|
||||
<Add directory="../../ports/linux" />
|
||||
<Add directory="../../src" />
|
||||
</Compiler>
|
||||
</Target>
|
||||
<Target title="Release">
|
||||
<Option output="bin/Release/bacserv" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj/Release/" />
|
||||
<Option type="1" />
|
||||
<Option compiler="gcc" />
|
||||
<Compiler>
|
||||
<Add option="-O2" />
|
||||
<Add option="-Wall" />
|
||||
<Add directory="." />
|
||||
<Add directory="../../ports/linux" />
|
||||
<Add directory="../../src" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add option="-s" />
|
||||
</Linker>
|
||||
</Target>
|
||||
</Build>
|
||||
<Compiler>
|
||||
<Add option="-O" />
|
||||
<Add option="-Wall" />
|
||||
<Add option="-fexceptions" />
|
||||
<Add option="-DBACDL_BIP" />
|
||||
<Add option="-DPRINT_ENABLED=1" />
|
||||
<Add option="-DBACAPP_ALL" />
|
||||
<Add directory="../../ports/linux" />
|
||||
<Add directory="../../src" />
|
||||
</Compiler>
|
||||
<Unit filename="../../ports/linux/bacport.h" />
|
||||
<Unit filename="../../ports/linux/bip-init.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../ports/linux/datetime-init.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../ports/linux/mstimer-init.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/abort.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/abort.h" />
|
||||
<Unit filename="../../src/bacnet/access_rule.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/access_rule.h" />
|
||||
<Unit filename="../../src/bacnet/alarm_ack.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/alarm_ack.h" />
|
||||
<Unit filename="../../src/bacnet/apdu.h" />
|
||||
<Unit filename="../../src/bacnet/arf.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/arf.h" />
|
||||
<Unit filename="../../src/bacnet/assigned_access_rights.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/assigned_access_rights.h" />
|
||||
<Unit filename="../../src/bacnet/authentication_factor.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/authentication_factor.h" />
|
||||
<Unit filename="../../src/bacnet/authentication_factor_format.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/authentication_factor_format.h" />
|
||||
<Unit filename="../../src/bacnet/awf.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/awf.h" />
|
||||
<Unit filename="../../src/bacnet/bacaddr.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/bacaddr.h" />
|
||||
<Unit filename="../../src/bacnet/bacapp.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/bacapp.h" />
|
||||
<Unit filename="../../src/bacnet/bacdcode.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/bacdcode.h" />
|
||||
<Unit filename="../../src/bacnet/bacdef.h" />
|
||||
<Unit filename="../../src/bacnet/bacdevobjpropref.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/bacdevobjpropref.h" />
|
||||
<Unit filename="../../src/bacnet/bacenum.h" />
|
||||
<Unit filename="../../src/bacnet/bacerror.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/bacerror.h" />
|
||||
<Unit filename="../../src/bacnet/bacint.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/bacint.h" />
|
||||
<Unit filename="../../src/bacnet/bacprop.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/bacprop.h" />
|
||||
<Unit filename="../../src/bacnet/bacpropstates.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/bacpropstates.h" />
|
||||
<Unit filename="../../src/bacnet/bacreal.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/bacreal.h" />
|
||||
<Unit filename="../../src/bacnet/bacstr.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/bacstr.h" />
|
||||
<Unit filename="../../src/bacnet/bactext.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/bactext.h" />
|
||||
<Unit filename="../../src/bacnet/bactimevalue.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/bactimevalue.h" />
|
||||
<Unit filename="../../src/bacnet/basic/binding/address.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/binding/address.h" />
|
||||
<Unit filename="../../src/bacnet/basic/npdu/h_npdu.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/npdu/h_npdu.h" />
|
||||
<Unit filename="../../src/bacnet/basic/object/access_credential.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/object/access_credential.h" />
|
||||
<Unit filename="../../src/bacnet/basic/object/access_door.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/object/access_door.h" />
|
||||
<Unit filename="../../src/bacnet/basic/object/access_point.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/object/access_point.h" />
|
||||
<Unit filename="../../src/bacnet/basic/object/access_rights.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/object/access_rights.h" />
|
||||
<Unit filename="../../src/bacnet/basic/object/access_user.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/object/access_user.h" />
|
||||
<Unit filename="../../src/bacnet/basic/object/access_zone.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/object/access_zone.h" />
|
||||
<Unit filename="../../src/bacnet/basic/object/ai.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/object/ai.h" />
|
||||
<Unit filename="../../src/bacnet/basic/object/ao.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/object/ao.h" />
|
||||
<Unit filename="../../src/bacnet/basic/object/av.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/object/av.h" />
|
||||
<Unit filename="../../src/bacnet/basic/object/bacfile.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/object/bacfile.h" />
|
||||
<Unit filename="../../src/bacnet/basic/object/bi.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/object/bi.h" />
|
||||
<Unit filename="../../src/bacnet/basic/object/bo.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/object/bo.h" />
|
||||
<Unit filename="../../src/bacnet/basic/object/bv.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/object/bv.h" />
|
||||
<Unit filename="../../src/bacnet/basic/object/channel.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/object/channel.h" />
|
||||
<Unit filename="../../src/bacnet/basic/object/command.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/object/command.h" />
|
||||
<Unit filename="../../src/bacnet/basic/object/credential_data_input.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/object/credential_data_input.h" />
|
||||
<Unit filename="../../src/bacnet/basic/object/csv.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/object/csv.h" />
|
||||
<Unit filename="../../src/bacnet/basic/object/device.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/object/device.h" />
|
||||
<Unit filename="../../src/bacnet/basic/object/iv.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/object/iv.h" />
|
||||
<Unit filename="../../src/bacnet/basic/object/lc.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/object/lc.h" />
|
||||
<Unit filename="../../src/bacnet/basic/object/lo.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/object/lo.h" />
|
||||
<Unit filename="../../src/bacnet/basic/object/lsp.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/object/lsp.h" />
|
||||
<Unit filename="../../src/bacnet/basic/object/ms-input.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/object/ms-input.h" />
|
||||
<Unit filename="../../src/bacnet/basic/object/mso.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/object/mso.h" />
|
||||
<Unit filename="../../src/bacnet/basic/object/msv.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/object/msv.h" />
|
||||
<Unit filename="../../src/bacnet/basic/object/nc.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/object/nc.h" />
|
||||
<Unit filename="../../src/bacnet/basic/object/netport.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/object/netport.h" />
|
||||
<Unit filename="../../src/bacnet/basic/object/objects.h" />
|
||||
<Unit filename="../../src/bacnet/basic/object/osv.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/object/osv.h" />
|
||||
<Unit filename="../../src/bacnet/basic/object/piv.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/object/piv.h" />
|
||||
<Unit filename="../../src/bacnet/basic/object/schedule.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/object/schedule.h" />
|
||||
<Unit filename="../../src/bacnet/basic/object/trendlog.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/object/trendlog.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/h_alarm_ack.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/h_alarm_ack.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/h_apdu.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/h_apdu.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/h_arf.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/h_arf.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/h_arf_a.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/h_arf_a.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/h_awf.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/h_awf.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/h_ccov.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/h_ccov.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/h_cov.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/h_cov.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/h_dcc.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/h_dcc.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/h_gas_a.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/h_gas_a.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/h_get_alarm_sum.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/h_get_alarm_sum.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/h_getevent.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/h_getevent.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/h_getevent_a.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/h_getevent_a.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/h_iam.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/h_iam.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/h_ihave.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/h_ihave.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/h_lso.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/h_lso.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/h_noserv.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/h_noserv.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/h_rd.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/h_rd.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/h_rp.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/h_rp.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/h_rp_a.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/h_rp_a.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/h_rpm.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/h_rpm.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/h_rpm_a.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/h_rpm_a.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/h_rr.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/h_rr.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/h_rr_a.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/h_rr_a.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/h_ts.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/h_ts.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/h_ucov.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/h_ucov.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/h_upt.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/h_upt.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/h_whohas.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/h_whohas.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/h_whois.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/h_whois.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/h_wp.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/h_wp.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/h_wpm.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/h_wpm.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/s_abort.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/s_abort.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/s_ack_alarm.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/s_ack_alarm.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/s_arfs.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/s_arfs.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/s_awfs.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/s_awfs.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/s_cevent.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/s_cevent.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/s_cov.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/s_cov.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/s_dcc.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/s_dcc.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/s_error.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/s_error.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/s_get_alarm_sum.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/s_get_alarm_sum.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/s_get_event.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/s_get_event.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/s_getevent.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/s_getevent.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/s_iam.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/s_iam.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/s_ihave.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/s_ihave.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/s_lso.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/s_lso.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/s_rd.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/s_rd.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/s_readrange.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/s_readrange.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/s_rp.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/s_rp.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/s_rpm.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/s_rpm.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/s_ts.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/s_ts.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/s_uevent.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/s_uevent.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/s_upt.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/s_upt.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/s_whohas.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/s_whohas.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/s_whois.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/s_whois.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/s_wp.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/s_wp.h" />
|
||||
<Unit filename="../../src/bacnet/basic/service/s_wpm.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/service/s_wpm.h" />
|
||||
<Unit filename="../../src/bacnet/basic/services.h" />
|
||||
<Unit filename="../../src/bacnet/basic/sys/bigend.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/sys/bigend.h" />
|
||||
<Unit filename="../../src/bacnet/basic/sys/debug.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/sys/debug.h" />
|
||||
<Unit filename="../../src/bacnet/basic/sys/fifo.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/sys/fifo.h" />
|
||||
<Unit filename="../../src/bacnet/basic/sys/filename.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/sys/filename.h" />
|
||||
<Unit filename="../../src/bacnet/basic/sys/key.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/sys/key.h" />
|
||||
<Unit filename="../../src/bacnet/basic/sys/keylist.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/sys/keylist.h" />
|
||||
<Unit filename="../../src/bacnet/basic/sys/mstimer.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/sys/mstimer.h" />
|
||||
<Unit filename="../../src/bacnet/basic/sys/ringbuf.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/sys/ringbuf.h" />
|
||||
<Unit filename="../../src/bacnet/basic/sys/sbuf.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/sys/sbuf.h" />
|
||||
<Unit filename="../../src/bacnet/basic/tsm/tsm.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/basic/tsm/tsm.h" />
|
||||
<Unit filename="../../src/bacnet/bits.h" />
|
||||
<Unit filename="../../src/bacnet/bytes.h" />
|
||||
<Unit filename="../../src/bacnet/config.h" />
|
||||
<Unit filename="../../src/bacnet/cov.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/cov.h" />
|
||||
<Unit filename="../../src/bacnet/credential_authentication_factor.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/credential_authentication_factor.h" />
|
||||
<Unit filename="../../src/bacnet/datalink/bip.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/datalink/bip.h" />
|
||||
<Unit filename="../../src/bacnet/datalink/bvlc.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/datalink/bvlc.h" />
|
||||
<Unit filename="../../src/bacnet/datalink/datalink.h" />
|
||||
<Unit filename="../../src/bacnet/datalink/dlenv.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/datalink/dlenv.h" />
|
||||
<Unit filename="../../src/bacnet/datetime.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/datetime.h" />
|
||||
<Unit filename="../../src/bacnet/dcc.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/dcc.h" />
|
||||
<Unit filename="../../src/bacnet/event.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/event.h" />
|
||||
<Unit filename="../../src/bacnet/get_alarm_sum.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/get_alarm_sum.h" />
|
||||
<Unit filename="../../src/bacnet/getevent.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/getevent.h" />
|
||||
<Unit filename="../../src/bacnet/iam.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/iam.h" />
|
||||
<Unit filename="../../src/bacnet/ihave.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/ihave.h" />
|
||||
<Unit filename="../../src/bacnet/indtext.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/indtext.h" />
|
||||
<Unit filename="../../src/bacnet/lighting.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/lighting.h" />
|
||||
<Unit filename="../../src/bacnet/lso.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/lso.h" />
|
||||
<Unit filename="../../src/bacnet/memcopy.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/memcopy.h" />
|
||||
<Unit filename="../../src/bacnet/npdu.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/npdu.h" />
|
||||
<Unit filename="../../src/bacnet/property.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/property.h" />
|
||||
<Unit filename="../../src/bacnet/proplist.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/proplist.h" />
|
||||
<Unit filename="../../src/bacnet/ptransfer.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/ptransfer.h" />
|
||||
<Unit filename="../../src/bacnet/rd.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/rd.h" />
|
||||
<Unit filename="../../src/bacnet/readrange.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/readrange.h" />
|
||||
<Unit filename="../../src/bacnet/reject.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/reject.h" />
|
||||
<Unit filename="../../src/bacnet/rp.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/rp.h" />
|
||||
<Unit filename="../../src/bacnet/rpm.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/rpm.h" />
|
||||
<Unit filename="../../src/bacnet/timestamp.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/timestamp.h" />
|
||||
<Unit filename="../../src/bacnet/timesync.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/timesync.h" />
|
||||
<Unit filename="../../src/bacnet/version.h" />
|
||||
<Unit filename="../../src/bacnet/whohas.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/whohas.h" />
|
||||
<Unit filename="../../src/bacnet/whois.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/whois.h" />
|
||||
<Unit filename="../../src/bacnet/wp.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/wp.h" />
|
||||
<Unit filename="../../src/bacnet/wpm.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../../src/bacnet/wpm.h" />
|
||||
<Unit filename="main.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Extensions>
|
||||
<code_completion />
|
||||
<envvars />
|
||||
<debugger />
|
||||
</Extensions>
|
||||
</Project>
|
||||
</CodeBlocks_project_file>
|
||||
@@ -0,0 +1,676 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<CodeBlocks_project_file>
|
||||
<FileVersion major="1" minor="6" />
|
||||
<Project>
|
||||
<Option title="BACnet Server Demo" />
|
||||
<Option pch_mode="2" />
|
||||
<Option compiler="gcc" />
|
||||
<Build>
|
||||
<Target title="Debug">
|
||||
<Option output="bin\Debug\bacserv" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj\Debug\" />
|
||||
<Option type="1" />
|
||||
<Option compiler="gcc" />
|
||||
<Compiler>
|
||||
<Add option="-Wall" />
|
||||
<Add option="-g" />
|
||||
<Add directory="..\..\ports\win32" />
|
||||
<Add directory="..\..\src" />
|
||||
</Compiler>
|
||||
</Target>
|
||||
<Target title="Release">
|
||||
<Option output="bin\Release\bacserv" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj\Release\" />
|
||||
<Option type="1" />
|
||||
<Option compiler="gcc" />
|
||||
<Compiler>
|
||||
<Add option="-O2" />
|
||||
<Add option="-Wall" />
|
||||
<Add directory="..\..\ports\win32" />
|
||||
<Add directory="..\..\src" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add option="-s" />
|
||||
</Linker>
|
||||
</Target>
|
||||
</Build>
|
||||
<Compiler>
|
||||
<Add option="-O" />
|
||||
<Add option="-Wall" />
|
||||
<Add option="-fexceptions" />
|
||||
<Add option="-DBACDL_BIP" />
|
||||
<Add option="-DPRINT_ENABLED=1" />
|
||||
<Add option="-DBACAPP_ALL" />
|
||||
<Add directory="..\..\ports\win32" />
|
||||
<Add directory="..\..\src" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add library="ws2_32" />
|
||||
<Add library="iphlpapi" />
|
||||
</Linker>
|
||||
<Unit filename="..\..\ports\win32\bacport.h" />
|
||||
<Unit filename="..\..\ports\win32\bip-init.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\ports\win32\datetime-init.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\ports\win32\mstimer-init.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\abort.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\abort.h" />
|
||||
<Unit filename="..\..\src\bacnet\access_rule.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\access_rule.h" />
|
||||
<Unit filename="..\..\src\bacnet\alarm_ack.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\alarm_ack.h" />
|
||||
<Unit filename="..\..\src\bacnet\apdu.h" />
|
||||
<Unit filename="..\..\src\bacnet\arf.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\arf.h" />
|
||||
<Unit filename="..\..\src\bacnet\assigned_access_rights.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\assigned_access_rights.h" />
|
||||
<Unit filename="..\..\src\bacnet\authentication_factor.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\authentication_factor.h" />
|
||||
<Unit filename="..\..\src\bacnet\authentication_factor_format.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\authentication_factor_format.h" />
|
||||
<Unit filename="..\..\src\bacnet\awf.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\awf.h" />
|
||||
<Unit filename="..\..\src\bacnet\bacaddr.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\bacaddr.h" />
|
||||
<Unit filename="..\..\src\bacnet\bacapp.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\bacapp.h" />
|
||||
<Unit filename="..\..\src\bacnet\bacdcode.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\bacdcode.h" />
|
||||
<Unit filename="..\..\src\bacnet\bacdef.h" />
|
||||
<Unit filename="..\..\src\bacnet\bacdevobjpropref.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\bacdevobjpropref.h" />
|
||||
<Unit filename="..\..\src\bacnet\bacenum.h" />
|
||||
<Unit filename="..\..\src\bacnet\bacerror.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\bacerror.h" />
|
||||
<Unit filename="..\..\src\bacnet\bacint.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\bacint.h" />
|
||||
<Unit filename="..\..\src\bacnet\bacprop.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\bacprop.h" />
|
||||
<Unit filename="..\..\src\bacnet\bacpropstates.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\bacpropstates.h" />
|
||||
<Unit filename="..\..\src\bacnet\bacreal.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\bacreal.h" />
|
||||
<Unit filename="..\..\src\bacnet\bacstr.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\bacstr.h" />
|
||||
<Unit filename="..\..\src\bacnet\bactext.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\bactext.h" />
|
||||
<Unit filename="..\..\src\bacnet\bactimevalue.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\bactimevalue.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\binding\address.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\binding\address.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\npdu\h_npdu.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\npdu\h_npdu.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\object\access_credential.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\object\access_credential.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\object\access_door.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\object\access_door.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\object\access_point.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\object\access_point.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\object\access_rights.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\object\access_rights.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\object\access_user.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\object\access_user.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\object\access_zone.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\object\access_zone.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\object\ai.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\object\ai.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\object\ao.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\object\ao.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\object\av.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\object\av.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\object\bacfile.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\object\bacfile.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\object\bi.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\object\bi.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\object\bo.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\object\bo.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\object\bv.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\object\bv.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\object\channel.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\object\channel.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\object\command.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\object\command.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\object\credential_data_input.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\object\credential_data_input.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\object\csv.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\object\csv.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\object\device.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\object\device.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\object\iv.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\object\iv.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\object\lc.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\object\lc.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\object\lo.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\object\lo.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\object\lsp.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\object\lsp.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\object\ms-input.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\object\ms-input.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\object\mso.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\object\mso.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\object\msv.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\object\msv.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\object\nc.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\object\nc.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\object\netport.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\object\netport.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\object\objects.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\object\osv.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\object\osv.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\object\piv.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\object\piv.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\object\schedule.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\object\schedule.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\object\trendlog.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\object\trendlog.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_alarm_ack.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_alarm_ack.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_apdu.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_apdu.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_arf.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_arf.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_arf_a.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_arf_a.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_awf.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_awf.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_ccov.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_ccov.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_cov.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_cov.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_dcc.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_dcc.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_gas_a.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_gas_a.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_get_alarm_sum.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_get_alarm_sum.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_getevent.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_getevent.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_getevent_a.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_getevent_a.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_iam.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_iam.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_ihave.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_ihave.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_lso.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_lso.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_noserv.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_noserv.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_rd.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_rd.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_rp.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_rp.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_rp_a.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_rp_a.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_rpm.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_rpm.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_rpm_a.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_rpm_a.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_rr.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_rr.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_rr_a.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_rr_a.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_ts.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_ts.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_ucov.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_ucov.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_upt.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_upt.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_whohas.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_whohas.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_whois.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_whois.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_wp.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_wp.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_wpm.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\h_wpm.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_abort.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_abort.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_ack_alarm.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_ack_alarm.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_arfs.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_arfs.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_awfs.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_awfs.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_cevent.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_cevent.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_cov.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_cov.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_dcc.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_dcc.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_error.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_error.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_get_alarm_sum.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_get_alarm_sum.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_get_event.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_get_event.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_getevent.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_getevent.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_iam.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_iam.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_ihave.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_ihave.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_lso.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_lso.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_rd.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_rd.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_readrange.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_readrange.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_rp.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_rp.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_rpm.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_rpm.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_ts.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_ts.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_uevent.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_uevent.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_upt.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_upt.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_whohas.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_whohas.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_whois.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_whois.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_wp.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_wp.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_wpm.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\service\s_wpm.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic/services.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\sys\bigend.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\sys\bigend.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\sys\debug.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\sys\debug.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\sys\fifo.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\sys\fifo.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\sys\filename.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\sys\filename.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\sys\key.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\sys\key.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\sys\keylist.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\sys\keylist.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\sys\mstimer.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\sys\mstimer.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\sys\ringbuf.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\sys\ringbuf.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\sys\sbuf.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\sys\sbuf.h" />
|
||||
<Unit filename="..\..\src\bacnet\basic\tsm\tsm.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\basic\tsm\tsm.h" />
|
||||
<Unit filename="..\..\src\bacnet\bits.h" />
|
||||
<Unit filename="..\..\src\bacnet\bytes.h" />
|
||||
<Unit filename="..\..\src\bacnet\config.h" />
|
||||
<Unit filename="..\..\src\bacnet\cov.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\cov.h" />
|
||||
<Unit filename="..\..\src\bacnet\credential_authentication_factor.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\credential_authentication_factor.h" />
|
||||
<Unit filename="..\..\src\bacnet\datalink\bip.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\datalink\bip.h" />
|
||||
<Unit filename="..\..\src\bacnet\datalink\bvlc.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\datalink\bvlc.h" />
|
||||
<Unit filename="..\..\src\bacnet\datalink\datalink.h" />
|
||||
<Unit filename="..\..\src\bacnet\datalink\dlenv.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\datalink\dlenv.h" />
|
||||
<Unit filename="..\..\src\bacnet\datetime.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\datetime.h" />
|
||||
<Unit filename="..\..\src\bacnet\dcc.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\dcc.h" />
|
||||
<Unit filename="..\..\src\bacnet\event.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\event.h" />
|
||||
<Unit filename="..\..\src\bacnet\get_alarm_sum.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\get_alarm_sum.h" />
|
||||
<Unit filename="..\..\src\bacnet\getevent.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\getevent.h" />
|
||||
<Unit filename="..\..\src\bacnet\iam.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\iam.h" />
|
||||
<Unit filename="..\..\src\bacnet\ihave.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\ihave.h" />
|
||||
<Unit filename="..\..\src\bacnet\indtext.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\indtext.h" />
|
||||
<Unit filename="..\..\src\bacnet\lighting.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\lighting.h" />
|
||||
<Unit filename="..\..\src\bacnet\lso.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\lso.h" />
|
||||
<Unit filename="..\..\src\bacnet\memcopy.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\memcopy.h" />
|
||||
<Unit filename="..\..\src\bacnet\npdu.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\npdu.h" />
|
||||
<Unit filename="..\..\src\bacnet\property.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\property.h" />
|
||||
<Unit filename="..\..\src\bacnet\proplist.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\proplist.h" />
|
||||
<Unit filename="..\..\src\bacnet\ptransfer.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\ptransfer.h" />
|
||||
<Unit filename="..\..\src\bacnet\rd.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\rd.h" />
|
||||
<Unit filename="..\..\src\bacnet\readrange.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\readrange.h" />
|
||||
<Unit filename="..\..\src\bacnet\reject.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\reject.h" />
|
||||
<Unit filename="..\..\src\bacnet\rp.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\rp.h" />
|
||||
<Unit filename="..\..\src\bacnet\rpm.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\rpm.h" />
|
||||
<Unit filename="..\..\src\bacnet\timestamp.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\timestamp.h" />
|
||||
<Unit filename="..\..\src\bacnet\timesync.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\timesync.h" />
|
||||
<Unit filename="..\..\src\bacnet\version.h" />
|
||||
<Unit filename="..\..\src\bacnet\whohas.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\whohas.h" />
|
||||
<Unit filename="..\..\src\bacnet\whois.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\whois.h" />
|
||||
<Unit filename="..\..\src\bacnet\wp.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\wp.h" />
|
||||
<Unit filename="..\..\src\bacnet\wpm.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\..\src\bacnet\wpm.h" />
|
||||
<Unit filename="main.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Extensions>
|
||||
<code_completion />
|
||||
<envvars />
|
||||
<debugger />
|
||||
</Extensions>
|
||||
</Project>
|
||||
</CodeBlocks_project_file>
|
||||
Executable
BIN
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user