Skip to content

Commit

Permalink
port bacnet-stack 0.8.3
Browse files Browse the repository at this point in the history
  • Loading branch information
yuanyoujun committed Apr 18, 2017
0 parents commit 9e5367b
Show file tree
Hide file tree
Showing 967 changed files with 264,267 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .astylerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#--indent-cases
--indent-classes
--indent-switches
--indent=spaces=4
#--max-instatement-indent=4
#--min-conditional-indent=0
--brackets=linux
--convert-tabs
--mode=c
4 changes: 4 additions & 0 deletions .gdbinit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
set print pretty on
set print union on
set print address on
list
1 change: 1 addition & 0 deletions .indent.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-kr -nut -nlp -ip4 -cli4 -bfda -nbc -nbbo -c0 -cd0 -cp0 -di0 -l79 -nhnl
1 change: 1 addition & 0 deletions .splintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-Iinclude -Idemo/object -Iports/linux -castfcnptr -fullinitblock -initallelements -weak +posixlib
1,349 changes: 1,349 additions & 0 deletions BACnet-stack.doxyfile

Large diffs are not rendered by default.

90 changes: 90 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# 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_PROPERTY_LISTS=1
BACNET_DEFINES ?= $(MY_BACNET_DEFINES)

#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)

# 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
.PHONY : all library demos clean

library:
$(MAKE) -s -C lib all

demos:
$(MAKE) -s -C demo all

gateway:
$(MAKE) -B -s -C demo gateway

router:
$(MAKE) -s -C demo router

# Add "ports" to the build, if desired
ports: atmega168 bdk-atxx4-mstp at91sam7s
@echo "Built the ARM7 and AVR ports"

atmega168: ports/atmega168/Makefile
$(MAKE) -s -C ports/atmega168 clean all

at91sam7s: ports/at91sam7s/makefile
$(MAKE) -s -C ports/at91sam7s clean all

bdk-atxx4-mstp: ports/bdk-atxx4-mstp/Makefile
$(MAKE) -s -C ports/bdk-atxx4-mstp clean all

clean:
$(MAKE) -s -C lib clean
$(MAKE) -s -C demo clean
$(MAKE) -s -C demo/router clean
$(MAKE) -s -C demo/gateway clean
50 changes: 50 additions & 0 deletions bin/bacrpd.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
@echo off
:Test_Start
echo Test: Read Required Properties of Device Object %1
bacrp.exe %1 8 %1 75
bacrp.exe %1 8 %1 77
bacrp.exe %1 8 %1 79
bacrp.exe %1 8 %1 112
bacrp.exe %1 8 %1 121
bacrp.exe %1 8 %1 120
bacrp.exe %1 8 %1 70
bacrp.exe %1 8 %1 44
bacrp.exe %1 8 %1 12
bacrp.exe %1 8 %1 98
bacrp.exe %1 8 %1 139
bacrp.exe %1 8 %1 97
bacrp.exe %1 8 %1 96
bacrp.exe %1 8 %1 76 0
bacrp.exe %1 8 %1 76
bacrp.exe %1 8 %1 62
bacrp.exe %1 8 %1 107
bacrp.exe %1 8 %1 11
bacrp.exe %1 8 %1 73
bacrp.exe %1 8 %1 30
bacrp.exe %1 8 %1 155

echo Test: Read Optional Properties of Device Object %1
bacrp.exe %1 8 %1 58
bacrp.exe %1 8 %1 28
bacrp.exe %1 8 %1 167
bacrp.exe %1 8 %1 122
bacrp.exe %1 8 %1 5
bacrp.exe %1 8 %1 57
bacrp.exe %1 8 %1 56
bacrp.exe %1 8 %1 119
bacrp.exe %1 8 %1 24
bacrp.exe %1 8 %1 10
bacrp.exe %1 8 %1 55
bacrp.exe %1 8 %1 116
bacrp.exe %1 8 %1 64
bacrp.exe %1 8 %1 63
bacrp.exe %1 8 %1 1
bacrp.exe %1 8 %1 154
bacrp.exe %1 8 %1 157
bacrp.exe %1 8 %1 153
bacrp.exe %1 8 %1 152
bacrp.exe %1 8 %1 172
bacrp.exe %1 8 %1 170
bacrp.exe %1 8 %1 169
bacrp.exe %1 8 %1 171
bacrp.exe %1 8 %1 168
147 changes: 147 additions & 0 deletions bin/bacrpd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
#!/bin/bash

PROG=`basename $0`
OPTIONAL=0

usage()
{
echo "usage: $PROG [OPTIONS] <<BACnetID>> [ <<BACnetID>> ... ]
Will return Required and Optional property values
from the requested device.
-o Display optional properties [default behavior]
-O Supress display of optional properties
-h Display this help
"
}

while getopts ":oOh" opt; do
case $opt in
o ) OPTIONAL=1
;;
O ) OPTIONAL=0
;;
h ) usage
exit 1
;;
\? ) usage
exit 1
esac
done
shift $(($OPTIND -1))

if [ $# -eq 0 ] || [ "$1" = "" ] ; then
usage
exit
fi

run_test()
{
echo -e -e "Test: Read Required Properties of Device Object $1\r"
echo -n "OBJECT IDENTIFIER:"
./bacrp $1 8 $1 75
echo -n "OBJECT NAME:"
./bacrp $1 8 $1 77
echo -n "OBJECT TYPE:"
./bacrp $1 8 $1 79
echo -n "SYSTEM STATUS:"
./bacrp $1 8 $1 112
echo -n "VENDOR NAME:"
./bacrp $1 8 $1 121
echo -n "VENDOR IDENTIFIER:"
./bacrp $1 8 $1 120
echo -n "MODEL NAME:"
./bacrp $1 8 $1 70
echo -n "FIRMWARE REVISION:"
./bacrp $1 8 $1 44
echo -n "APPLICATION SOFTWARE VERSION:"
./bacrp $1 8 $1 12
echo -n "PROTOCOL VERSION:"
./bacrp $1 8 $1 98
echo -n "PROTOCOL REVISION:"
./bacrp $1 8 $1 139
echo -n "PROTOCOL SERVICES SUPPORTED:"
./bacrp $1 8 $1 97
echo -n "OBJECT TYPES SUPPORTED:"
./bacrp $1 8 $1 96
echo -n "OBJECT LIST LENGTH:"
./bacrp $1 8 $1 76 0
echo -n "OBJECT LIST:"
./bacrp $1 8 $1 76
echo -n "MAX APDU LENGTH ACCEPTED:"
./bacrp $1 8 $1 62
echo -n "SEGMENTATION SUPPORTED:"
./bacrp $1 8 $1 107
echo -n "APDU TIMEOUT:"
./bacrp $1 8 $1 11
echo -n "NUMGER OF APDU ENTRIES:"
./bacrp $1 8 $1 73
echo -n "DEVICE ADDRESS BINDING:"
./bacrp $1 8 $1 30
echo -n "DATABASE REVISION:"
./bacrp $1 8 $1 155
if [ $OPTIONAL -eq 1 ] ; then
echo -e "Test: Read Optional Properties of Device Object $1\r"
echo -n "LOCATION:"
./bacrp $1 8 $1 58
echo -n "DESCRIPTION:"
./bacrp $1 8 $1 28
echo -n "MAX SEGMENTS SUPPORTED:"
./bacrp $1 8 $1 167
echo -n "VT CLASSES SUPPORTED:"
./bacrp $1 8 $1 122
echo -n "ACTIVE VT SESSIONS:"
./bacrp $1 8 $1 5
echo -n "LOCAL TIME:"
./bacrp $1 8 $1 57
echo -n "LOCAL DATE:"
./bacrp $1 8 $1 56
echo -n "UTC OFFSET:"
./bacrp $1 8 $1 119
echo -n "DAYLIGHT SAVINGS STATUS:"
./bacrp $1 8 $1 24
echo -n "APDU SEGMENT TIMEOUT:"
./bacrp $1 8 $1 10
echo -n "LIST OF SESSION KEYS:"
./bacrp $1 8 $1 55
echo -n "TIME SYNCHRONIZATION RECIPIENTS:"
./bacrp $1 8 $1 116
echo -n "MAX MASTER:"
./bacrp $1 8 $1 64
echo -n "MAX INFO FRAMES:"
./bacrp $1 8 $1 63
echo -n "ACK REQUIRED:"
./bacrp $1 8 $1 1
echo -n "CONFIGURATION FILES:"
./bacrp $1 8 $1 154
echo -n "LAST RESTORE TIME:"
./bacrp $1 8 $1 157
echo -n "BACKUP FAILURE TIMEOUT:"
./bacrp $1 8 $1 153
echo -n "ACTIVE COV SUBSCRIPTIONS:"
./bacrp $1 8 $1 152
echo -n "SLAVE PROXY ENABLE:"
./bacrp $1 8 $1 172
echo -n "MANUAL SLAVE ADDRESS BINDING:"
./bacrp $1 8 $1 170
echo -n "AUTO SLAVE DISCOVERY:"
./bacrp $1 8 $1 169
echo -n "SLAVE ADDRESS BINDING:"
./bacrp $1 8 $1 171
echo -n "PROFILE NAME:"
./bacrp $1 8 $1 168
fi
echo -e " \r"
}

while [ $# -gt 0 ] ; do
ID=$(( $1 + 0 ))
shift
if [ $ID -eq 0 ] ; then
echo "ERROR: Device ID must be an integer!! [ID=$ID]" >&2
fi
run_test $ID
done


14 changes: 14 additions & 0 deletions bin/bvlc.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@echo off
echo Example of parameters for Foreign Device Registration
echo This CMD window will use port 47809 to communicate
@echo on
set BACNET_IP_PORT=47809
@echo off
echo The BBMD is located at the standard port 47808 and at
echo the dotted IP address passed in on the command line.
echo When the demo client applications see the BBMD address,
echo they register as a Foreign Device to it.
@echo on
set BACNET_BBMD_PORT=47808
set BACNET_BBMD_ADDRESS=%1

18 changes: 18 additions & 0 deletions bin/bvlc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
echo Example of parameters for Foreign Device Registration
BACNET_IP_PORT=47809
export BACNET_IP_PORT
echo This console will use port ${BACNET_IP_PORT} to communicate.
echo
BACNET_BBMD_PORT=47808
export BACNET_BBMD_PORT
echo The BBMD is located at the port ${BACNET_BBMD_PORT} and
echo is at the dotted IP address passed on the command line.
BACNET_BBMD_ADDRESS=${1}
export BACNET_BBMD_ADDRESS
echo The BBMD IP address is ${BACNET_BBMD_ADDRESS}
echo When the demo client applications see the BBMD address,
echo they register as a Foreign Device to it.
echo
echo Launching new shell using the BBMD environment...
/bin/bash
Loading

0 comments on commit 9e5367b

Please sign in to comment.