The BFR project is a C++ application that typically runs unattended and provides BACnet routing between two or more BACnet networks. The source code is divided up into three directories; the BACnet directory for encoding and decoding BACnet network traffic, a BFR directory for building an application that can be configured in a wide variety of different ways, and an XML parser for parsing configuration files.
The BACnet library can be used for special purpose applications where size is more important than a flexible configuration, for example, in an embedded device. The BFR application is essentially a wrapper around the library.
For building and running the sample applications the developer will need...
a development workstation running some flavor of Linux with a C++ compiler. The library is written in ISO C++, with no dependancies on libraries or includes other than those that are available for C applications such as stdio.h and socket.h and compiles with a variety of C++ compilers.
a collection of small hubs or switches to build a variety of networking topologies
a check out of the project directory from SourceForge:
$ svn checkout svn://svn.code.sf.net/p/bfr/code/trunk bfr
Building the BFR¶
Because of the wide variety of platforms and compilers, the project does not currently come with a pre-built version of the BFR executable. The build shell scripts assume that the developer is going to be using GNU C++ compiler and a debugger such as gdb:
$ cd bfr/ $ ./build.sh
For a debug version, the script simply instructs the compiler to turn on debugging and sets the _DEBUG compiler directive flag:
In the source code of the BACnet library there are a series #if statements such as these:
#if _DEBUG_TASK printf("Springboard::~Springboard\n"); #endif
So turning on one or more of the _DEBUG flags will generate a stream of messages to stdout as the application runs which is sometimes more suitable for debugging in an embedded system where an interactive debugger is not easily accessible.
Running the BFR¶
Running the application from a shell window will print out usage information:
$ bfr Usage: BFR [-h] [-v] [-d] file [ parm... ]\n" ); -h help -v version information -d list program arguments and environment file settings file
The application can take advantage of environment variables passed in from the shell when parsing the configuration file. Getting the variables set correctly can sometimes be difficult, running with the -d flag will print those out:
$ bfr -d argv = "./BFR" argv = "-d" envp = "XDG_VTNR=7" envp = "XDG_SESSION_ID=c4" ... envp = "TERM=xterm" envp = "SHELL=/bin/bash" ...