adjust root folder

This commit is contained in:
Steve Karg
2019-10-08 23:47:53 -05:00
parent b6fc50ddea
commit a42e8f507c
1258 changed files with 26 additions and 214 deletions
Binary file not shown.
Binary file not shown.
+13
View File
@@ -0,0 +1,13 @@
BACnet Stack
Developer Build
This BACnet Stack is designed as a library for an embedded product.
However, there are a number of example applications in the demo/ directory
that show how it can be used for client and server applications.
The demos can be built using makefiles in the root directory, or by
using individual makefiles in the demo directories.
Launch the demo/server/bacserv example. Use the client demos to query
the server. Note that the server should be on a different computer or
virtual machine.
+17
View File
@@ -0,0 +1,17 @@
BACnet Stack @ SourceForge.net
Build using Code Blocks
Q1: GNU GCC Compiler, undefined reference to closesocket
A1: Under Project->Build Options->Linker settings,
add "ws2_32" to Link Libraries.
Q2: GNU GCC Compiler, creating a DLL
A2: Under Project->Build Options->Linker settings,
add "user32" to Link Libraries.
Q3: GNU GCC Compiler, undefined reference to _GetAdaptersInfo
A3: Under Project->Build Options->Linker settings,
add "iphlpapi" to Link Libraries.
+163
View File
@@ -0,0 +1,163 @@
This BACnet stack is service driven. It handles the services (BACnet requests
like WhoIs, I-Am, ReadProperty, etc) to/from the network layer to functions that
handle the application layer. There are a bunch of functions that facilitate
encoding and decoding to/from the network message data to/from something
meaningful in the program.
A BACnet device is supposed to support, at a minimum, ReadProperty service
(server) and a single Device Object. This even applies to a BACnet client on a
PC that is used for reading other BACnet devices.
There are a number of core files that you will need. Services such as
ReadProperty, I-Am, and Reject are consided core files. After determining
which services you want in your device, add files to your project or makefile
from the following BACnet services (messages) provided by this BACnet stack:
* abort.c - BACnet Abort service encode/decode
* bacerror.c - BACnet Error service encode/decode
* reject.c - BACnet Reject service encode/decode
* arf.c - AtomicReadFile service encode/decode
* awf.c - AtomicWriteFile service encode/decode
* rp.c - BACnet ReadProperty service encode/decode
* rpm.c - ReadPropertyMultiple service encode/decode
* iam.c - I-Am service encode/decode
* whois.c - WhoIs service encode/decode
* wp.c - WriteProperty service encode/decode
* wpm.c - WritePropertyMultiple service encode/decode
* dcc.c - DeviceCommunicationControl service encode/decode
* ihave.c - I-Have service encode/decode
* rd.c - ReinitializedDevice service encode/decode
* timesync.c - TimeSynchronization service encode/decode
* whohas.c - WhoHas service encode/decode
* event.c - EventNotification service encode/decode
* get_alarm_sum.c - GetAlarmSummary service encode/decode
* getevent.c - GetEventInformation service encode/decode
* lso.c - LifeSafetyOperation service encode/decode
* ptransfer.c - PrivateTransfer service encode/deco
* readrange.c - ReadRange service encode/decode
Adding additional services is a matter of adding the encoding and decoding for
the service into/from meaningful data, and I like to add unit testing, a demo
handler and send function, as well as a demo command line example.
For each service that you add to your project or makefile, you will need to
add a handler and possibly a sending function. There are example handlers
and send functions for all the services that the stack supports:
* demo/handler/h_alarm_ack.c - Alarm ACK service handler example
* demo/handler/h_arf.c - AtomicReadFile service handler example
* demo/handler/h_arf_a.c - AtomicReadFile ACK service handler example
* demo/handler/h_awf.c - AtomicWriteFile service handler example
* demo/handler/h_ccov.c - ConfirmedCOVNotification service handler example
* demo/handler/h_cov.c - SubscribeCOV service handler example
* demo/handler/h_dcc.c - DeviceCommuncationControl service handler example
* demo/handler/h_get_alarm_sum.c - GetAlarmSummary service handler example
* demo/handler/h_get_event.c - GetEventInformation service handler example
* demo/handler/h_iam.c - I-Am service handler example
* demo/handler/h_ihave.c - I-Have service handler example
* demo/handler/h_lso.c - LifeSafetyOperation service handler example
* demo/handler/h_pt.c - PrivateTransfer service handler example
* demo/handler/h_pt_a.c - PrivateTransfer ACK service handler example
* demo/handler/h_rp.c - ReadProperty service handler example
* demo/handler/h_rp_a.c - ReadProperty ACK service handler example
* demo/handler/h_rpm.c - ReadPropertyMultiple service handler example
* demo/handler/h_rpm_a.c - ReadPropertyMultiple ACK service handler example
* demo/handler/h_rr.c - ReadRange service handler example
* demo/handler/h_rr_a.c - ReadRange ACK service handler example
* demo/handler/h_ts.c - TimeSynchronization service handler example
* demo/handler/h_ucov.c - UnconfirmedCOV service handler example
* demo/handler/h_upt.c - UnconfirmedPrivateTransfer service handler example
* demo/handler/h_whohas.c - WhoHas service handler example
* demo/handler/h_whois.c - Who-Is service handler example
* demo/handler/h_wp.c - WriteProperty ACK service handler example
* demo/handler/h_wpm.c - WritePropertyMultiple service handler example
* demo/handler/h_noserv.c - unrecognized service handler example
The BACnet stack also includes files for handling client functionality, which
requires Confirmed messages, and utilizes something called binding. Binding is a
way of acquiring a Device Object Instance's MAC address by sending a broadcast
Who-Is to that Device Object and waiting for the I-Am from that Device Object.
When the I-Am arrives, the MAC address can be stored and used to send unicast
messages to that Device Object and its member objects or properties. Here are
the files that handle BACnet binding:
* address.c - This module is used to handle the address binding that occurs
in BACnet. A device id is bound to a MAC address. The normal method is using
Who-Is, and binding with the data from I-Am. This is needed for client
functionality.
* tsm.c - Transaction State Machine handles resending messages if a timeout
occurs, and is needed for client functionality. The transaction state machine is
used for Confirmed messages and segmentation. For confirmed messages, it
automatically (via tsm_timer_milliseconds) handles the retries and the timeout.
It uses the InvokeID as the unique key (although officially it should be the
combination of InvokeID, DeviceID, and service). So if you tried to send a
confirmed request to a device that was taken offline, you would see the retry go
out after every apdu_timeout until apdu retries had completed. Then the
transaction would self-delete (free). The stack as it is written (and most
stacks are written this way) has a limited amount of transactions, and if you
are sending alot of confirmed data, it can be a bottleneck if they are not freed
in a timely manner.
This BACnet stack includes a number of example objects. The reason that they are
examples is because your device and its objects and their properties will
undoubtedly be unique to your product. The example objects in this BACnet stack
are the same and contiguous for each object represented - but this is not
required. This stack does not include an example of every type of BACnet object
or property - but have no fear! Adding a new object type is mostly just a matter
of adding all the data encoding/decoding for that object for each service and
property supported. When a new object is added, it must also add some API hooks
in the Device Object, since the Device Object contains an object list. The
example object files in the BACnet stack include:
* demo/object/ai.c - analog input object demo
* demo/object/ao.c - analog output object demo
* demo/object/av.c - analog value object demo
* demo/object/bacfile.c - File object demo
* demo/object/device.c - device object demo
* demo/object/bi.c - binary input object demo
* demo/object/bo.c - binary output object demo
* demo/object/bv.c - binary value object demo
* demo/object/lc.c - load control object demo
* demo/object/lsp.c - life safety point object demo
* demo/object/mso.c - multi-step output object demo
The BACnet stack includes a number of core files that handle the service
packets that come in from the datalink layer. The core files include:
* apdu.c - handles dispatching the services to the proper handlers
* bacdcode.c - primitive BACnet datatype encoding and decoding
* bacint.c - primitive BACnet integer datatype encoding and decoding
* bacreal.c - primitive BACnet REAL datatype encoding and decoding
* bacstr.c - primative BACnet string datatype encoding and decoding
* bacapp.c - application data encoding and decoding
* npdu.c - encoding and decoding of the NPDU layer data
* demo/handler/h_npdu.c - handles dispatching of the network message
to the apdu dispatcher.
The DataLink Layer controls orderly access to the physical medium.
The stack currently supports one datalink layer at a time, and uses a
macro defined in config.h or your makefile/project to choose the macro
functions defined in datalink.h. The following files are used for the
datalink handling in this BACnet stack, and may have to be developed for
your particular hardware:
* bip.c - BACnet/IP functionality - depends on bip_init.c in port/xx
* dllmstp.c - MS/TP datalink layer, also in port/xx
* mstp.c - MS/TP master and receive state machine
* crc.c - computes CRC checksum for MS/TP
* ringbuf.c - MS/TP ring buffer used for testing
* arcnet.c - ARCNET datalink layer functionality, in port/xx
* ethernet.c - BACnet Ethernet datalink layer functionality, in port/xx
There are a dozen demonstration applications in the demo directory,
along with many demonstation objects and handlers. All the demos accept
command line options and have been tested under Win32 and Linux.
There is a makefile in the respective demo directory for Linux and
for Borland C++ compilers, and a master makefile at the root level
(Makefile=Linux, makefile.b32=Borland).
The simplest demonstration is to run demo/server/bacserv on one PC (or
virtual PC), and run the other client demonstration applications one
at time on another PC (or virtual PC). Monitor the network communcations
using Wireshark protocol analyzer, or test the BACnet server using
BACnet Visual Test Shell VTS3.
+56
View File
@@ -0,0 +1,56 @@
To build the Doxygen documentation for the BACnet Stack:
- Install doxygen as described at
http://www.stack.nl/~dimitri/doxygen/install.html
- If you want to generate call graphs (recommended - very nice! - but takes
signficantly longer to build the documents), you must also have
graphviz installed.
- To build from the command line, just enter
doxygen BACnet-stack.doxyfile
- Output is built in doc/output/html, and there is a convenient
starting point at doc/output/BAC_stack.html.
- If you use Eclipse,
- install the eClox plugin to support doxygen within Eclipse
- Build the documents by right clicking on BACnet-stack.doxyfile,
and selecting "@ Build Documentation"
- Feel free to tweak the doxygen output to your tastes, interests, and
choice of output formats.
- The Latex output could be converted into a PDF (see doxygen manual,
and google for your issues).
- I have tried the PDF, man, and RTF outputs and not liked the results
for any of them (500+ pages). I recommend the HTML output, as it is
well organized and has an obvious flow, both of which the others lack.
The doxygen output is not checked into this project because it consists of
over 5,000 little files (for HTML with call graphs), and it is easily
regenerated.
For speed, the function call graphs are not enabled in the SVN version
of the doxyfile. To enable them, edit BACnet-stack.doxyfile (with a
text editor or with GUI-based editors in Eclipse or using the
doxywizard application) and change
HAVE_DOT = YES
CALLER_GRAPH = YES
Following the doxygen website's lead, I found the D-Bus project to be a good
example of the sort of documentation we needed to have here.
http://dbus.freedesktop.org/doc/dbus/api/html/index.html
Output Formats:
The default output is HTML, which works well and looks good, but as mentioned,
consists of 5000 files.
The compiled help format (*.chm) also looks pretty good, and is packed into a
single file. Just a big, single file.
I tried the latex-to-pdf route, but did not like the output (far too much
whitespace, like a function per page, ~600 pages, not usefully organized).
Ditto for RTF and man output.
I could not find a linux-based compiled help compiler, so I resorted to using
Microsoft's. They seem to be pushing some later generation tools, and
maybe someone knows if that's a good thing, but I opted for their now
fairly old HTML Help Workshop, version 4.74.
Doxygen nicely arranges the html input, so pretty much all you have to do
is point HTML Help Workshop at BACnet-stack\doc\output\html\index.hhp and
let the compiler run.
+154
View File
@@ -0,0 +1,154 @@
FAQ - Frequently Asked Questions about the BACnet Stack
Q-1: Do you know the typical footprint of the stack (MS/TP use)?
A-1a: It fits on a PIC18F6720 (128K bytes flash 3840 bytes RAM) and there is lots of room for the application - see ports/pic18f6720 project. In one device with 8 Binary Value objects, 8 Binary Input objects, 1 Analog Input object, and supporting ReadProperty, WriteProperty, DeviceCommunicationControl, TimeSync, ReinitializeDevice, Who-Is, I-Am services, the BACnet stack used about 32K words of the code space.
A-1b: It fits on a ATmega168 (16K bytes flash, 1024 bytes RAM) - see ports/atmega168 project. The BACnet Capabilities include WhoIs, I-Am, ReadProperty, and WriteProperty support. The BACnet objects include a Device object, 10 Binary Value objects, and 10 Analog Value objects. An LED is controlled by Binary Value object instance 0. All required object properties can be retrieved using ReadProperty. The Present_Value property of the Analog Value and Binary Value objects can be written using WriteProperty. The Object_Identifier, Object_Name, Max_Info_Frames, Max_Master, and baud rate (property 9600) of the Device object can be written using WriteProperty.
With full optimization, the statistics on the demo are: IAR Atmel AVR C/C++ Compiler V5.10A/W32
12 732 bytes of CODE memory (+ 36 range fill )
955 bytes of DATA memory (+ 24 absolute ) (includes CStack=512)
avr-gcc (GCC) 4.2.2 (WinAVR 20071221rc1)
Program: 15790 bytes (96.4% Full)
Data: 414 bytes (40.4% Full) (does not include CStack=0×262)
A-1c: It fits easily on an ATmega644p (64K bytes flash, 4096 bytes RAM) - see ports/bdk-atxx4-mstp/ project. The BACnet Capabilities of an Application Specific Controller include WhoIs, I-Am, WhoHas, I-Have, ReadProperty, ReadPropertyMultiple, WriteProperty, and DeviceCommunicationControl support. The BACnet objects include a Device object, 2 Analog Input objects, 2 Analog Value objects, 5 Binary Input objects, and 2 Binary Output objects. Two LEDs are controlled by Binary Output objects. All required object properties can be retrieved using ReadProperty or ReadPropertyMultiple. Most of the Present_Value properties of the objects can be written. The Object_Identifier, Object_Name, Max_Info_Frames, Max_Master, and baud rate (property 9600) of the Device object can be written using WriteProperty. The APDU size is 256 bytes.
With full optimization, the statistics on this port are:
avr-gcc (GCC) 4.3.4
Program (.text+.data): 34172 bytes (52.1% Full)
Data (.data+.bss+.noinit): 2501 (61.1% Full) (not including CStack=1594 bytes)
CStack usage (from painting): 772 bytes
IAR C/C++ Compiler V5.40.2.50249/W32 for Atmel AVR
IAR Universal Linker V4.61L/W32
28 770 bytes of CODE memory (+ 8 range fill )
3 250 bytes of DATA memory (+ 44 absolute ) (includes CStack=1024)
Q-2: The homepage used to say that the MS/TP code does not work. Still true?
A-2: MS/TP works correctly as of the 0.2.6 release. I spent a several days correcting it while working on the RTOS-32 port, and then a full day fine-tuning it while working on the PIC18F6720 that I used at the 2006 BACnet International Plugfest. I also successfully used MS/TP with the 0.4.0 release at the 2007 BACnet International Plugfest on an Atmel AVR ATmega168.
Q-3: Does the stack have some specific requirements regarding the hardware (e.g. non-volatile memory, 32-bit CPU, ...)?
A-3: Not really. The specific stuff is in the ports/ directory, and that is expected to be modified by the end user if necessary. Big Endian and Little Endian used to be automatic, but that took up too much code space, so there is a BIG_ENDIAN define in the makefile. Most of the variables are defined using the ANSI C-99 uint8_t, uint16_t, uint32_t, int8_t, int16_t, int32_t from stdint.h, along with bool from stdbool.h. Most of the APDU size returns are int.
Q-4: Does the stack have some specific requirements regarding OS? What OS features are used (threads, timers, semaphors, events, mutexes...)?
A-4: No, I did not use any OS features (except for the the ports to specific OS's: port/rtos32/, port/win32/ and port/linux/ which uses some tasks or threads for the MS/TP datalink layer or sockets for the BACnet/IP layers). Since my target was embedded, I kept every thing single-threaded (but multithread safe except where noted) to keep it easy to follow and easy to implement in a microcontroller just running a main() loop.
Q-5: What is the difference between the two datalink layers BACnet/IP and BACnet Ethernet? In BACnet/IP, is the MAC address needed?
A-5: The BACnet/IP datalink layer uses the BACnet Virtual Link Control (BVLC) for networking using UDP/IP. The IPv4 address (x.x.x.x) and the port number (0xBAC0) is stored as the MAC address. IPv6 will utilize a virtual MAC address which will be the Device ID. See Annex J or bip.c in the BACnet stack.
BACnet Ethernet uses the Ethernet MAC address, and communicates using the IEEE 802.2/802.3 (see ANSI/ASHRAE 135-2004-7 Data Link/Physical Layers: ISO 8802-3 ("Ethernet") LAN). See ethernet.c in the port/linux/ directory of the BACnet stack.
Q-6: What do I need to do to learn about BACnet? Can this project help?
A-6: Open source projects are great since they allow you to look over the internals of a program or library. However, sometimes you just want to see something work. I created about a dozen example applications for testing. One of the applications is demo/server/bacserv that acts like a BACnet server device. Run it on one PC or hardware platform, and then use the other example applications on another PC to interact with it. Monitor the BACnet network activity with the WireShark protocol analyzer. Modify the example applications - "Take chances, make mistakes, get messy." Have fun! Join the BACnet developers mailing list and ask lots of questions so others can learn and help too!
Q-7: The stack is working fine with demo/server/bacserv. But in the WireShark protocol analyzer, I am able to see only 'Who-Is' and 'I -Am' query/responses. The ReadProperty query/responses are not there in the capture viewer. Why?
A-7: If you are only able to see broadcast messages like Who-Is and I-Am, then you are probably networking using an Ethernet switch (bridge) to connect WireShark to the devices. The Ethernet switch (bridge) actually routes the unicast messages between ports and does not send them to all ports (unless configured to do so). If you use an Ethernet Hub or run WireShark from one of the devices under test, you will then see the ReadProperty messages.
Q-8: I intend to write a little program to implement the comunication between Bacnet devices and tcp/ip devices, but not use PAD and BACnet/IP. Can I do that in a standard way?
A-8: You describe what the BACnet committee just published recently: Addendum 135-2004c, BACnet Web Services, which has been approved by ASHRAE and ANSI.
I don't have web services implemented in the BACnet stack at SourceForge, but you could certainly use the stack do so.
Q-9: How do I create the required objects (analog inputs, analog outputs, binary inputs, binary outputs) to support the hardware on my board?
A-9: See the example application demo/server for an example of a server application with objects included. The simple answer is that they exist in the Device object in the Object_List property. Every BACnet device is required to have a Device Object, and one of the required properties is the Object_List property.
The example objects are in demo/object and those that are included in the device are in demo/object/device.c as defined in 5 locations in the file. For each object type:
1. #include the header file for the object
2. Device_Object_List_Count() needs to include a call to a count function from the object type.
3. Device_Object_List_Identifier() needs to include some code to get the object instance for each object.
4. Device_Valid_Object_Id() needs to get the object name for each object.
5. PROP_PROTOCOL_OBJECT_TYPES_SUPPORTED needs to set a bit for each object type supported.
Additionally, for each service that interacts with objects, you will need to include handling for that object. See demo/handler/h_rp.c to see how the different objects are accessed for the ReadProperty service. See demo/handler/h_wp.c to see how the different objects are accessed for the WriteProperty service. If those are the only services that you are going to use, then most of the work has been done other than selecting which object types you are going to support.
As for how many of what object, see the individual object files for examples of how that works (see demo/object directory). Also note that there are optional properties of some objects that may or may not have an example included in this demo code. For example, a Binary Value object optionally includes a Priority_Array. There is an example in the demo/object that includes a Priority_Array, and an example in ports/pic18f6720 that does not have the Priority_Array.
You can read/write to the properties using demo/readprop and demo/writeprop example client applications that run under Windows or Linux command line.
Q-10: Since each Device object must have an object identifier that is unique internetwork-wide, how is this ID determined?
A-10: Device object instance number is normally configured on site after the device is installed. Therefore, the Device object instance number should be configurable between 0 and 4194303 inclusive (see bacdef.h for BACNET_MAX_INSTANCE). If your hardware does not have any user interface, you can have the device default to 4194303 and implement WriteProperty service to the Object_Identifier of the Device object. You could also have some other method for configuring the Device Object instance number such as an RS-232 terminal interface or HTTP screen configuration like a home internet router.
Note that 4194303 is known as "unconfigured" and is not really a valid device instance number. Also, all devices are required to respond with their own Device object instance number when 4194303 is requested.
Q-11: For the objects supported by the device, they are required to be unique within the BACnet device that maintains them. Can I start with an object instance number of 0 or 1 and increment accordingly for each new object created within the device?
A-11: For each object type, you can create any object instance numbers between 0 and 4194302 inclusive. How you choose to number them is up to you.
In the example object in demo/object/ I numbered them sequentially starting at 0. If you do choose to use some other numbering scheme, be sure to update the Index_To_Instance(), Valid_Instance(), Count(), and Name() functions of each object type to correctly handle your numbering scheme.
Q-12: For the object names, do you really use AV-## or ANALOG VALUE # in your system? All of our AV values have unique names like "ACTIVE_ALARM", "REVISION", "DUCT_STATIC".
A-12: As long as your names are unique in your device (i.e. no duplicate names) you can use your names. In the demo objects, I just use "AV-1" or "ANALOG VALUE 1" as the Object_Name where 1 is the object instance number. Update the Name() function for each object type if you change from the default names.
Q-13: I need to have about 100 Analog Value objects and 100 Binary Value objects in my device. When I try to define over 15 objects I get a memory error from the PIC compiler. What is the problem?
A-13: If you are using the unmodified Analog Value or Binary Value objects from demo/objects, they include a priority array. That means that each object has 16 Present_Values stored for each object, plus an Out_Of_Service status. Each object would consume about 17 bytes. 15*17=255 bytes. Limit for udata = 255 bytes on the PIC using the Microchip compiler.
Output and value objects are not required to have Out_Of_Service writable. Value objects are not required to have a priority array. If you need or want to have priority arrays for your objects, then you might consider storing the Binary Value object Present_Value in some smaller form (currently it is stored as enumeration which consumes a byte on a PIC). There are Binary Value and Analog Value object examples that do not include a priority array in the ports/pic18f6720/ directory.
Q-14: What do I have to do to reduce the size of the firmware made from this BACnet stack?
A-14: Here are the things that you can do to shrink the firmware size:
1. For MS/TP, change the state machine to use a fixed memory structure rather than a pointer to a structure. Some microcontroller compilers generate more code when having to dereference the structure. This limits you to a single MS/TP datalink.
2. Remove unused services by
* remove the service C file from the makefile
* remove the function call to setup the service
* remove the service handler
3. Remove unnecessary objects by:
* Remove the demo/object C file from the makefile
* remove function calls to the demo/object C file.
* Change the number of objects that you have.
* Only a Device object is required.
* Update the Device object PROP_PROTOCOL_OBJECT_TYPES_SUPPORTED
4. Remove unused function calls by:
* #if 0 and #endif around the unused functions (especially in bacdcode.c)
* Compile and Link. If the linker fails, then that function was needed.
* Some compilers, like GCC, have garbage collection for unused functions and code. If enabled, the linker will eliminate the unused functions and code. Use the GCC compiler and linker directive to enable this feature.
Q-15: I have downloaded the BACnet stack but can't get demo/server to work. I am using a single computer. In one console window I run demo/server/bacserv. In another console window I run demo/whois/bacwi. When I capture packets with WireShark, I see the I-Am broadcast packet being sent by demo/server/bacserv when it starts. I also see the Who-Is broadcast packet sent by demo/whois/bacwi. But demo/server/bacserv never receives any message. How do I make it work?
A-15: This is a common issue with BACnet/IP. The server application binds to the BACnet/IP UDP port 47808 on that computer, and therefore, the client application is unable to receive broadcast messages on port 47808 since those packets are only going to the server application. You can use the netstat tool to see if the port is in use:
$ netstat -p udp -a -n | grep 47808
UDP 10.87.225.118:47808 *:*
The correct solution is to use BVLC (BACnet Virtual Link Control) where the client applications use BACnet Foreign Device Registration, and some application (probably the server) runs a BBMD (BACnet Broadcast Management Device).
You can do one of the following:
1. Use QEMU or Bochs or VMWare or some other virtual machine to simulate another computer, and run server or client on a virtual computer.
2. Use the BACnet/IP BACnet Virtual Link Control (BVLC) features. The client demo applications are configured to use environment variables to establish a BBMD connection as a foreign device. Set the BACNET_BBMD_PORT and BACNET_BBMD_ADDRESS of the BBMD, and use a non-standard BACNET_IP_PORT value. Note that the demo/server application is configured as a BBMD, and there are helper scripts /bin/bvlc.sh or bin/bvlc.bat to assist.
3. Write npdu router code to route from BACnet/IP to another datalink layer. Make server application on one datalink layer and make client applications on another datalink layer.
4. Add external BACnet router or BACnet devices. Run a BACnet demo/server on another PC.
Q-16: My Linux computer doesn't use eth0 for for the BACnet connection. My Windows computer has more than one network connnection. How can I choose the interface to use for the demo applications?
A-16: Set the environment variable BACNET_IFACE. For Windows, set BACNET_IFACE=169.254.119.240 or whatever the address of the interface returned by ipconfig command. For Linux, use BACNET_IFACE=eth0 or whatever the name of the interface returned by the ifconfig command. Setting the environment variable under Windows can be done on the command line:
> set BACNET_IFACE=169.254.119.240
Setting the environment variable under Linux can be done from the command line:
$ BACNET_IFACE=ath0
$ export BACNET_IFACE
Q-17: I need to communicate with an MS/TP Slave Node. Can I configure the demo applications to use a static address binding?
A-17: Yes, static address binding is supported as of version 0.4.3. Use a file called address_cache (which is defined in src/address.c). The file format is record based as follows:
;DeviceID MAC SNET SADR MAX-APDU
4194302 05 0 0 50
55555 C0:A8:00:18:BA:C0 26001 19 50
+146
View File
@@ -0,0 +1,146 @@
BACnet Stack - SourceForge.net
Build for Visual C++ 6.0
When building the BACnet stack using Visual C++ compiler,
there are some settings that are important.
Q. Are there some global configuration options for this BACnet stack?
A. The BACnet stack uses some preprocessor defines to configure
a number of subtle personalities.
PRINT_ENABLED=1 - enables printing to stdio
BIG_ENDIAN=0 - chooses the BACnet encoding and decoding order
BACDL_BIP=1 - chooses BACnet/IP for the datalink layer
BACDL_ETHERNET=0 - chooses BACnet Ethernet for the datalink layer
BACDL_ARCNET=0 - chooses BACnet ARCNET for the datalink layer
BACDL_MSTP=0 - chooses BACnet MS/TP for the datalink layer
USE_INADDR=1 - uses INADDR_BROADCAST for broadcast rather than CLASSx
TSM_ENABLED=1 - enables the Transaction State Machine for clients
BIP_DEBUG=1 - enables print statements for debugging
In Visual C++, add a Preprocessor Definition by:
1. Select "Project" menu
2. Select "Settings..."
3. Select the "C/C++" tab (3rd Tab)
4. Select the Category: General
5. You can see the "Preprocessor Definitions:" box
6. Type OPTION_NAME=1 or OPTION_NAME=0 in that edit box
using a comma to separate multiple options.
7. Press OK
8. Compile the entire project again...
Q. MSVC refuses to open bacnet.dsw and bacnet.dsp.
A. bacnet.dsw and bacnet.dsp are text files that were retrieved
from CVS on a unix client and are now in unix text file format since
they end with a "\r\n" rather than "\n". Use the unix2dos commandline
tool to convert them back to dos:
unix2dos bacnet.dsw
unix2dos bacnet.dsp
Q. error LNK2001: unresolved external symbol _WinMain@16
A. The demo ports/win32/main.c was designed as a Win32 Console
Application. If you want to change it to a Windows GUI application,
you will have to add all the Windows GUI code, including WinMain().
I recommend that you use a framework, such as WxWidgets/WxWindows,
but this has not been done yet.
Q. error C1083: Cannot open include file: 'stdint.h': No such file
A. The BACnet stack uses some header files, and Visual C++ needs to know
where they are:
1. Select "Project" menu
2. Select "Settings..."
3. Select the "C/C++" tab (3rd Tab)
4. Select the Category: Preprocessor
5. You can see the "Additional include directories:" box
6. Type the path to stdint.h in that edit box (using a comma if necessary)
7. Type the path to bacdcode.h in that edit box (using a comma if necessary)
In my system, the paths look like:
c:\code\bacnet-stack\,c:\code\bacnet-stack\ports\win32\,
c:\code\bacnet-stack\demo\handler\,c:\code\bacnet-stack\demo\object\
8. Press OK
9. Compile the project again...
Q. error C2065: 'MAX_MPDU' : undeclared identifier
A. The BACnet stack uses a preprocessor define to configure
its datalink layer. In Visual C++, add a Preprocessor Definition by:
1. Select "Project" menu
2. Select "Settings..."
3. Select the "C/C++" tab (3rd Tab)
4. Select the Category: General
5. You can see the "Preprocessor Definitions:" box
6. Type BACDL_BIP=1 in that edit box (using a comma if necessary)
7. Press OK
8. Compile the entire project again...
Q. error LNK2001: unresolved external symbol _bacapp_print
A. The BACnet stack uses a preprocessor define to configure
printing to stdio. In Visual C++, add a Preprocessor Definition by:
1. Select "Project" menu
2. Select "Settings..."
3. Select the "C/C++" tab (3rd Tab)
4. Select the Category: General
5. You can see the "Preprocessor Definitions:" box
6. Type PRINT_ENABLED=1 in that edit box (using a comma if necessary)
7. Press OK
8. Compile the entire project again...
Q. error LNK2001: unresolved external symbol __imp__closesocket@4
A. Visual C++ needs to have the Winsock library to be happy:
1. Select "Project" menu
2. Select "Settings..."
3. Select the "Link" tab (4th Tab)
4. You can see "Object/library modules:" edit box
5. Type Wsock32.LIB in that edit box
6. Press OK
7. Compile the entire project again...
Q. error C2061: in file tsm.c
A. The BACnet stack uses a preprocessor define to configure
client functionality in the Transaction State Machine (TSM).
In Visual C++, add a Preprocessor Definition by:
1. Select "Project" menu
2. Select "Settings..."
3. Select the "C/C++" tab (3rd Tab)
4. Select the Category: General
5. You can see the "Preprocessor Definitions:" box
6. Type MAX_TSM_TRANSACTIONS=0 in that edit box (using a comma if necessary)
7. Press OK
8. Compile the entire project again...
Q. error LNK2001: unresolved external symbol __beginthread
A. Visual C++ needs to have the multithreaded library when compiled
with MS/TP datalink enabled (BACDL_MSTP instead of BACDL_BIP):
1. Select "Project" menu
2. Select "Settings..."
3. Select the "C/C++" tab (3rd Tab)
4. Select the Category: Code Generation
5. Select the Multithreaded from the "Use runtime library" box options
Q. warning C4013: '_beginthreadex' undefined; assuming extern returning int
A. Visual C++ needs to have the multithreaded library when compiled
with MS/TP datalink enabled (BACDL_MSTP instead of BACDL_BIP):
1. Select "Project" menu
2. Select "Settings..."
3. Select the "C/C++" tab (3rd Tab)
4. Select the Category: Code Generation
5. Select the Multithreaded from the "Use runtime library" box options
Q. error LNK2019: Verweis auf nicht aufgelöstes externes Symbol
"_GetAdaptersInfo@8" in Funktion "_getIpMaskForIpAddress".
A. There is the Iphlpapi.lib library missing from the VC++ project
(for the GetAdaptersInfo error) that you need to add:
http://msdn2.microsoft.com/en-us/library/aa916102.aspx
Note that Iphlpapi.lib/.h is not included with Visual C++ 6.0;
you would need to download the platform SDK to get it.
1. Select "Project" menu
2. Select "Settings..."
3. Select the "Link" tab (4th Tab)
4. You can see "Object/library modules:" edit box
5. Type Iphlpapi.lib in that edit box
6. Press OK
7. Compile the entire project again...
+7
View File
@@ -0,0 +1,7 @@
BACnet Stack - SourceForge.net
Build for Visual Studio 2005 Express Edition
Q1: Cannot open include file: 'winsock2.h'
A1: Install the Microsoft Platform SDK:
http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/default.aspx
+41
View File
@@ -0,0 +1,41 @@
SourceForge Release Checklist for the BACnet Embedded Stack Project
written by Steve Karg (using a similar doc by Kim Gräsman as a guide)
Verify that the test build is clean. Test code with clean directory.
Get a clean build (no warnings or errors).
The program must be functional (it works).
Clean up the object files and binaries to prepare for tar
$ make clean
Make the source code look the same
$ ./indent.sh
$ ./comment.sh
$ ./fixup.sh
Verify that the code compiles and runs the demos without error or
warnings:
$ make all
$ demo/server 123 (etc)
Verify that the unit tests compile and pass:
$ ./unittest.sh
$ cat test.log | grep Failed
Commit any changes to subversion.
$ svn commit
$ svn update
Run the release script:
$ ./release.sh 0.0.0
Go to file manager at http://sourceforge.net/projects/bacnet/
Admin -> File Manager
Tag the files for the various platforms
Tag the ChangeLog as release notes.
Update the website (if necessary)
Add release notes under What's New on SourceForge.
The release notes should include project details
for someone unfamiliar with the project or BACnet.
+40
View File
@@ -0,0 +1,40 @@
SLOC Directory SLOC-by-Language (Sorted)
39094 ports ansic=35270,cpp=3339,xml=214,sh=154,asm=117
30563 demo ansic=30100,perl=463
23732 src_top_dir ansic=23732
5580 include ansic=5580
2189 nbproject xml=2137,sh=52
757 bin sh=757
428 top_dir sh=428
234 test ansic=234
37 lib cpp=37
0 doc (none)
0 license (none)
0 obj (none)
Totals grouped by language (dominant language first):
ansic: 94916 (92.50%)
cpp: 3376 (3.29%)
xml: 2351 (2.29%)
sh: 1391 (1.36%)
perl: 463 (0.45%)
asm: 117 (0.11%)
Total Physical Source Lines of Code (SLOC) = 102,614
Development Effort Estimate, Person-Years (Person-Months) = 25.87 (310.44)
(Basic COCOMO model, Person-Months = 2.4 * (KSLOC**1.05))
Schedule Estimate, Years (Months) = 1.84 (22.13)
(Basic COCOMO model, Months = 2.5 * (person-months**0.38))
Estimated Average Number of Developers (Effort/Schedule) = 14.03
Total Estimated Cost to Develop = $ 3,494,689
(average salary = $56,286/year, overhead = 2.40).
SLOCCount, Copyright (C) 2001-2004 David A. Wheeler
SLOCCount is Open Source Software/Free Software, licensed under the GNU GPL.
SLOCCount comes with ABSOLUTELY NO WARRANTY, and you are welcome to
redistribute it under certain conditions as specified by the GNU GPL license;
see the documentation for details.
Please credit this data as "generated using David A. Wheeler's 'SLOCCount'."
+138
View File
@@ -0,0 +1,138 @@
========== Using Subversion to get the BACnet Stack source code ==========
To check out the trunk from the subversion repository,
use "svn co", e.g.
svn checkout https://svn.code.sf.net/p/bacnet/code/trunk/bacnet-stack/
or for the stable releases:
svn checkout https://svn.code.sf.net/p/bacnet/code/tags/bacnet-stack-0-7-1/
for Anonymous checkout, use http vs. https.
========== Configure your Subversion Client for EOL properties ==========
Committers need to properly configure their svn client so that
the appropriate subversion properties are set on newly added files.
One of the most important properties is the eol-style property
that configures OS-specific line-endings for text files.
Add the configuration text below to your subversion client
configuration file that is normally in the following location:
Windows: %USERPROFILE%\Application Data\Subversion\config
or %appdata%\subversion\config
or Click the 'edit' button for 'Subversion configuration file' in
the TortoiseSVN settings dialog under General.
Linux: ~/.subversion/config or /etc/subversion/config
Warning: Make sure the settings are merged into the appropriate
section if it already exists, as duplicate section names can
cause problems.
[auto-props]
### The format of the entries is:
### file-name-pattern = propname[=value][;propname[=value]...]
### The file-name-pattern can contain wildcards (such as '*' and
### '?'). All entries which match will be applied to the file.
### Note that auto-props functionality must be enabled, which
### is typically done by setting the 'enable-auto-props' option.
*.c = svn:eol-style=native
*.cpp = svn:eol-style=native
*.h = svn:eol-style=native
*.dsp = svn:eol-style=CRLF
*.dsw = svn:eol-style=CRLF
*.sh = svn:executable;svn:eol-style=native
*.cmd = svn:mime-type=text/plain;svn:eol-style=CRLF
*.bat = svn:mime-type=text/plain;svn:eol-style=CRLF
Makefile = svn:eol-style=native
*.obj = svn:mime-type=application/octet-stream
*.bin = svn:mime-type=application/octet-stream
*.bmp = svn:mime-type=image/bmp
*.class = svn:mime-type=application/java
*.doc = svn:mime-type=application/msword
*.exe = svn:mime-type=application/octet-stream
*.gif = svn:mime-type=image/gif
*.gz = svn:mime-type=application/x-gzip
*.jar = svn:mime-type=application/java-archive
*.jelly = svn:mime-type=text/plain;svn:eol-style=native
*.jpg = svn:mime-type=image/jpeg
*.jpeg = svn:mime-type=image/jpeg
*.pdf = svn:mime-type=application/pdf
*.png = svn:mime-type=image/png
*.tgz = svn:mime-type=application/octet-stream
*.tif = svn:mime-type=image/tiff
*.tiff = svn:mime-type=image/tiff
*.zip = svn:mime-type=application/zip
*.txt = svn:mime-type=text/plain;svn:eol-style=native
*.xml = svn:mime-type=text/xml;svn:eol-style=native
*.ent = svn:mime-type=text/plain;svn:eol-style=native
*.dtd = svn:mime-type=text/plain;svn:eol-style=native
*.vsl = svn:mime-type=text/plain;svn:eol-style=native
*.xsd = svn:mime-type=text/xml;svn:eol-style=native
*.xsl = svn:mime-type=text/xml;svn:eol-style=native
*.wsdl = svn:mime-type=text/xml;svn:eol-style=native
*.htm = svn:mime-type=text/html;svn:eol-style=native
*.html = svn:mime-type=text/html;svn:eol-style=native
*.css = svn:mime-type=text/css;svn:eol-style=native
*.js = svn:mime-type=text/plain;svn:eol-style=native
*.jsp = svn:mime-type=text/plain;svn:eol-style=native
*.txt = svn:mime-type=text/plain;svn:eol-style=native
*.java = svn:mime-type=text/plain;svn:eol-style=native
*.properties = svn:mime-type=text/plain;svn:eol-style=native
*.sql = svn:mime-type=text/plain;svn:eol-style=native
*.sln = svn:eol-style=CRLF
*.vcproj = svn:eol-style=CRLF
To test the properties of a file:
$ svn proplist
If a file slips into subversion without the eol-style property set,
you can periodically run:
$ svn propset svn:eol-style native *
$ svn commit -m "changed eol-style"
========== BACnet Stack source code management workflow ==========
From http://stackoverflow.com/questions/16142/what-do-branch-tag-and-trunk-really-mean
Paraphrased and copied from gregmac:
We are working on what will be 1.0.0 in trunk. Once 1.0.0 is finished,
branch trunk into a new "bacnet-stack-1.0.0" branch,
and create a "1.0.0" tag. Work on what will eventually be 1.1.0 continues
in trunk.
When you come across some bugs in the code, fix them in the trunk.
Then merge the fixes over to the 1.0.0 branch. You may also get bug
reports for 1.0.0, and fix the bugs in the 1.0.0 branch, and then merge
them back to trunk. Sometimes a bug can only be fixed in 1.0.0 because
it is obsolete in 1.1.0. It doesn't really matter, the only thing is
you want to make sure that you don't release 1.1.0 with the same bugs
that have been fixed in 1.0.0. Once you find enough bugs
(or maybe one critical bug), you decide to do a 1.0.1 release.
So you make a tag "1.0.1" from the 1.0.0 branch, and release the code.
At this point, trunk sill contains what will be 1.1.0, and
the "1.0.0" branch contains 1.0.1 code. The next time you release an
update to 1.0.0, it would be 1.0.2.
Eventually you are almost ready to release 1.1.0, but you want to do
a beta first. In this case, you likely do a "1.1.0" branch, and
a "1.1beta1" tag. Now, work on what will be 1.2.0 (or 2.0.0 maybe)
continues in trunk, but work on 1.1.0 continues in the "1.1.0" branch.
Once you release 1.1.0 final, you do a "1.1.0" tag from the "1.1.0" branch.
You can also continue to maintain 1.0.0 if you'd like, porting bug fixes
between all 3 branches (1.0.0, 1.1.0, and trunk). The important take
away is that for every main version of the software you are maintaining,
you have a branch that contains the latest version of code for that version.
Another use of branches is for features. This is where you branch trunk
(or one of your release branches) and work on a new feature in isolation.
Once the feature is completed, you merge it back in and remove the branch.
The idea of this is when you're working on something disruptive
(that would hold up or interfere with other people from doing their work),
something experimental (that may not even make it in), or possibly just
something that takes a long time (and you're afraid if it holding up a
1.2.0 release when you're ready to branch 1.2.0 from trunk), you can do
it in isolation in branch. Generally you keep it up to date with trunk by
merging changes into it all the time, which makes it easier to re-integrate
(merge back to trunk) when you're finished.
+36
View File
@@ -0,0 +1,36 @@
To Do List - BACnet Stack at SourceForge
Here are some things to do:
A. Finish demo/epics/main.c - EPICS demo. Use object property lists.
B. Update demo/object/lo.c - Lighting Output object demo - match addendum
C. Add storage hooks to bvlc.c for BDT and FDT.
D. Merge blvc.c network variable storage (ntohl, htonl) to bip.c.
E. Add HTTP demo like bacnet4linux
F. Add SubscribeCOVProperty support in server demo.
G. Add hooks to increment Database_Revision property
H. Change demo objects and WhoHas to use CharacterString for Object_Name.
I. Change core encode/decode to pass length for safe handling
J. Change bip.c to not use extra buffer (shift data)
K. Add Visual Studio makefiles, projects, or solutions for demos.
L. Add Code::Blocks projects for demos.
M. Add function headers to each module and function with
doc-tags for document generator doxygen (in progress).
N. Add option to address module that use file store address cache
instead of having to send who-is for each query.
This will make scripting cleaner/effecient.
O. Convert object methods to use an array of object methods
for ReadProperty and Device object counts, ids, and names.
P. Convert datalink methods to use function pointers that can be
overridden in main.c.
Q. Create BACnet router code that uses more than one datalink.
R. splint more of the code. Make intelligent fixes.
S. Fix src/mstp.c so that indent can parse it correctly.
T. Add "inline" to static functions that are only used once.
U. Modify code to compile with MISRA C rules.
V. Change OBJECT_ID to only be 32 bits, and add macro handlers.
W. Add #ifdef for all MAX_ defines so they can be overridden.
X. Change WhoIs demo to list all I-Am's received such that duplicate
IDs with different MAC addresses can be detected.
Y. Add tsm_alloc to allocate memory and invoke ID for sending.
Z. Make alternate TSM that handles segmentation.
AA. Create debug.c module for PC ports which replace printf and fix line end.
+17
View File
@@ -0,0 +1,17 @@
Add the ability to compile, edit, and maintain code
Here are the compilers and their documents
$ sudo apt-get install build-essential subversion-tools gcc-4.2-doc glibc-doc manpages-dev
$ sudo apt-get install mingw32 mingw32-binutils mingw32-runtime
I need access to subversion and XSLT ChangeLog tools
$ sudo apt-get install subversion-tools
$ sudo apt-get install xsltproc
I install a couple of editors, useful for various things. Kate is already installed.
$ sudo apt-get install scite
$ sudo apt-get install vim-full
Useful tools for cleaning up code, converting comments and line endings, and code statistics:
$ sudo apt-get install splint
$ sudo apt-get install sloccount
$ sudo apt-get install indent
$ sudo apt-get install liwc
$ sudo apt-get install tofrodos
+48
View File
@@ -0,0 +1,48 @@
There are a dozen or so demo applications that are built
with the default makefiles. These demo applications are
copied to the bin/ directory. They can be used in
scripts and batch files to test BACnet devices or query
information on the BACnet network, as well as simulate
a BACnet device.
The demo applications make use of Environment Variables
to configure the network.
BACNET_IFACE - interface to use for the datalink layer
For Linux, this is something like eth0 or /dev/ttyS0.
For Windows, this is something like 192.168.0.1 or COM4
Defaults to NULL.
BACNET_IP_PORT - BACnet/IP port number.
Defaults to 47808.
BACNET_BBMD_PORT - BACnet/IP BBMD port number.
Defaults to 47808.
BACNET_BBMD_TIMETOLIVE - BACnet/IP BBMD time-to-live seconds.
Defaults to 0xFFFF.
BACNET_BBMD_ADDRESS - dotted IP address or domain name of BBMD.
Attempts to register with the BBMD if this variable is present.
BACNET_MAX_INFO_FRAMES - BACnet MS/TP max-info-frames parameter.
Defaults to 127.
BACNET_MSTP_BAUD - BACnet MS/TP baud rate.
Defaults to 38400.
BACNET_MSTP_MAC - BACnet MS/TP MAC address.
Defaults to 127.
The demo client applications can also perform static
address binding using the file "address_cache" in the
directory where the application is called (defined
in src/address.c file). The format of the address_cache
is a line by line of device ids and addresses:
55555 AC:10:56:06:BA:C0 26001 19 50
where:
55555=device id in decimal
AC:10:56:06:BA:C0=MAC address (router address) in hex
26001=DNET network number in decimal
19=DADR MAC address in hex. Use colon to separate multibyte address.
50=Max APDU
Binary file not shown.
+7
View File
@@ -0,0 +1,7 @@
<hr size="1"/><address style="text-align: right;"><small>
<img class="footer" src="BACnet_sm.png" alt="BACnet logo"/>
<!-- Break the small and then resume it -->
</small><b>BACnet-stack API documentation</b><small><br>
Generated on $datetime for $projectname by&nbsp;<a href="http://www.doxygen.org/index.html"><img class="footer" src="doxygen.png" alt="doxygen"/></a> $doxygenversion</small></address>
</body>
</html>
+12
View File
@@ -0,0 +1,12 @@
<!-- This comment will put IE 6, 7 and 8 in quirks mode -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>$title</title>
<link href="$relpath$tabs.css" rel="stylesheet" type="text/css"/>
<link href="$relpath$search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javaScript" src="$relpath$search/search.js"></script>
<link href="$relpath$doxygen.css" rel="stylesheet" type="text/css">
</head>
<body onload='searchBox.OnSelectItem(0);'>
+235
View File
@@ -0,0 +1,235 @@
This software runs on many platforms, and can be compiled with a number of
different compilers; here are some rules for writing code that will work
on multiple platforms.
Regarding tabs, indenting, and code style, we run:
$ indent -kr -nut -nlp -ip4 -cli4 -bfda -nbc -nbbo -c0 -cd0 -cp0 -di0 -l79 filename.c
on the code prior to releasing it. This ensures a standard look and feel
to the code regardless of the authors preferred style. You may certainly
adjust the code to your preferred style using an indent tool. We use the
script indent.sh to adjust all the .c and .h files.
For variable names, separate words within the variables by underscores.
Do not use capital letters as separators. Consider how much harder
IcantReadThis is on the eyes versus I_can_read_this.
Variable and function names are defined with the first words being
descriptive of broad ideas, and later words narrowing down to specifics.
For instance: Universe_Galaxy_System_Planet. Consider the following names:
Timer_0_Data, Timer_0_Overflow, and Timer_0_Capture. This convention
quickly narrows variables to particular segments of the program.
Never assume that a verb must be first, as often seen when naming functions.
Open_Serial_Port and Close_Serial_Port do a much poorer job of grouping
than the better alternative of Serial_Port_Open and Serial_Port_Close.
Don't use C++-style comments (comments beginning with "//" and running
to the end of the line) for modules that are written in C. The module
may run through C rather than C++ compilers, and not all C compilers
support C++-style comments (GCC does, but IBM's C compiler for AIX, for
example, doesn't do so by default). Note: there is an application
called usr/bin/ccmtcnvt in the liwc package that converts the C++
comments to C comments. There is a script utilizing ccmtcnvt called
comment.sh created for this project that searches all the c and h files
for C++ headers and converts them.
Don't initialize variables in their declaration with non-constant
values. Not all compilers support this. E.g. don't use
uint32_t i = somearray[2];
use
uint32_t i;
i = somearray[2];
instead.
Don't use zero-length arrays; not all compilers support them. If an
array would have no members, just leave it out.
Don't declare variables in the middle of executable code; not all C
compilers support that. Variables should be declared at the beginning
of a function or compound statement, or outside a function
Don't use "inline"; not all compilers support it.
Use the C99 stdint.h and stdbool.h definitions for declaring variables
when needed. If they are not defined for your compiler, put those files
into the ports directory for your compiler with the proper definitions.
Sometimes scalable code should just use an int or unsigned declaration.
8-bit unsigned = uint8_t
8-bit signed = int8_t
16-bit unsigned = uint16_t
16-bit signed = int16_t
32-bit unsigned = uint32_t
32-bit signed = int32_t
boolean = bool
Don't use "long" to mean "signed 32-bit integer", and don't use
"unsigned long" to mean "unsigned 32-bit integer"; "long"s are 64 bits
long on many platforms. Use "int32_t" for signed 32-bit integers and use
"uint32_t" for unsigned 32-bit integers.
Don't use "long" to mean "signed 64-bit integer" and don't use "unsigned
long" to mean "unsigned 64-bit integer"; "long"s are 32 bits long on
many other platforms. Don't use "long long" or "unsigned long long",
either, as not all platforms support them; use "int64_t" or "uint64_t",
which need to be defined as the appropriate types for 64-bit signed and
unsigned integers.
Don't use a label without a statement following it. For example,
something such as
if (...) {
...
done:
}
will not work with all compilers - you have to do
if (...) {
...
done:
;
}
with some statements, even if it's a null statement, after the label.
Don't use "bzero()", "bcopy()", or "bcmp()"; instead, use the ANSI C
routines
"memset()" (with zero as the second argument, so that it sets
all the bytes to zero);
"memcpy()" or "memmove()" (note that the first and second
arguments to "memcpy()" are in the reverse order to the
arguments to "bcopy()"; note also that "bcopy()" is typically
guaranteed to work on overlapping memory regions, while
"memcpy()" isn't, so if you may be copying from one region to a
region that overlaps it, use "memmove()", not "memcpy()" - but
"memcpy()" might be faster as a result of not guaranteeing
correct operation on overlapping memory regions);
and "memcmp()" (note that "memcmp()" returns 0, 1, or -1, doing
an ordered comparison, rather than just returning 0 for "equal"
and 1 for "not equal", as "bcmp()" does).
Not all platforms necessarily have "bzero()"/"bcopy()"/"bcmp()", and
those that do might not declare them in the header file on which they're
declared on your platform.
Don't use "index()" or "rindex()"; instead, use the ANSI C equivalents,
"strchr()" and "strrchr()". Not all platforms necessarily have
"index()" or "rindex()", and those that do might not declare them in the
header file on which they're declared on your platform.
Don't fetch data from packets by getting a pointer to data in the
packet, casting that pointer to a pointer to a structure,
and dereferencing that pointer. That pointer won't necessarily be aligned
on the proper boundary, which can cause crashes on some platforms (even
if it doesn't crash on an x86-based PC). This means that you cannot
safely cast it to any data type other than a pointer to "char",
"unsigned char", "uint8_t", or other one-byte data types. You cannot,
for example, safely cast it to a pointer to a structure, and then access
the structure members directly; on some systems, unaligned accesses to
integral data types larger than 1 byte, and floating-point data types,
cause a trap, which will, at best, result in the OS slowly performing an
unaligned access for you, and will, on at least some platforms, cause
the program to be terminated.
The data in a packet is not necessarily in the byte order of
the machine on which this software is running. Make use of
big_endian() which returns non-zero on big_endian machines.
Use "ntohs()", "ntohl()", "htons()", or "htonl()" only in the ports
directories since the header files required to define or declare
them differ between platforms. There are some common functions in
the bacdcode library for converting to and from long and short.
Don't put a comma after the last element of an enum - some compilers may
either warn about it (producing extra noise) or refuse to accept it.
When opening a file with "fopen()", "freopen()", or "fdopen()", if the
file contains ASCII text, use "r", "w", "a", and so on as the open mode
- but if it contains binary data, use "rb", "wb", and so on. On
Windows, if a file is opened in a text mode, writing a byte with the
value of octal 12 (newline) to the file causes two bytes, one with the
value octal 15 (carriage return) and one with the value octal 12, to be
written to the file, and causes bytes with the value octal 15 to be
discarded when reading the file (to translate between C's UNIX-style
lines that end with newline and Windows' DEC-style lines that end with
carriage return/line feed).
In addition, that also means that when opening or creating a binary
file, you must use "open()" (with O_CREAT and possibly O_TRUNC if the
file is to be created if it doesn't exist), and OR in the O_BINARY flag.
That flag is not present on most, if not all, UNIX systems, so you must
also do
#ifndef O_BINARY
#define O_BINARY 0
#endif
to properly define it for UNIX (it's not necessary on UNIX).
Don't use forward declarations of static arrays without a specified size
in a fashion such as this:
static const value_string foo_vals[];
...
static const value_string foo_vals[] = {
{ 0, "Red" },
{ 1, "Green" },
{ 2, "Blue" },
{ 0, NULL }
};
as some compilers will reject the first of those statements. Instead,
initialize the array at the point at which it's first declared, so that
the size is known.
Don't put declarations in the middle of a block; put them before all
code. Not all compilers support declarations in the middle of code,
such as
int i;
i = foo();
int j;
For #define names and enum member names, prefix the names with a tag so
as to avoid collisions with other names - this might be more of an issue
on Windows, as it appears to #define names such as DELETE and
OPTIONAL.
Don't use "variadic macros", such as
#define DBG(format, args...) fprintf(stderr, format, ## args)
as not all C compilers support them. Use macros that take a fixed
number of arguments, such as
#define DBG0(format) fprintf(stderr, format)
#define DBG1(format, arg1) fprintf(stderr, format, arg1)
#define DBG2(format, arg1, arg2) fprintf(stderr, format, arg1, arg2)
...
or something such as
#define DBG(args) printf args
Instead of tmpnam(), use mkstemp(). tmpnam is insecure and should
not be used any more. Note: mkstemp does not accept NULL as a parameter.
Try to write code portably whenever possible, however; note that
there are some routines in the software that are platform-dependent
implementations. The platform independent API is declared in the
header file, and the dependent routine is placed in a ports directory.
Reference: The cross platform aspect of this coding standard is based
on the developer coding standard for Ethereal/Wireshark and has been
modified by Steve Karg for this project. Thank you, Ethereal/Wireshark!
Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

+884
View File
@@ -0,0 +1,884 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1252">
<TITLE>BACnet stack - open source BACnet protocol stack</TITLE>
</HEAD>
<BODY LANG="en-US">
<img src="images/BACnet.png" align=right>
<h1>BACnet Stack</h1>
<h2>An open source BACnet protocol stack for embedded systems</h2>
<hr>
<h2>About this Project</h2>
<P><a href="http://sourceforge.net/projects/bacnet/">This BACnet protocol stack library</a>
provides a BACnet application layer, network layer and media access (MAC)
layer communications services. It is an open source, royalty-free library
for an embedded system, Windows, Linux, or other operating system. <a href="https://sourceforge.net/projects/bacnet/files/bacnet-tools/">Example
BACnet client and server applications</a> are included.</p>
<P>BACnet - A Data Communication Protocol for Building
Automation and Control Networks - see <a
href="http://www.bacnet.org/">bacnet.org</a>. BACnet is a standard data
communication protocol for Building Automation and Control Networks. BACnet
is an open protocol, which means anyone can contribute to the standard, and
anyone may use it. The only caveat is that the BACnet standard document
itself is copyrighted by ASHRAE, and they sell the document to help defray
costs of developing and maintaining the standard (just like IEEE or ANSI or
ISO).</P>
<P>For software developers, the BACnet protocol is a standard way to send and
receive messages on the wire containing data that is understood by other
BACnet compliant devices. The BACnet standard defines a standard way to
communicate over a number of wires, known as Data Link/Physical Layers:
Ethernet, EIA-485, EIA-232, ARCNET, and LonTalk. The BACnet standard also
defines a standard way to communicate using UDP, IP and HTTP (Web
Services).</P>
There are other open source projects for BACnet:</p>
<ul>
<li><a href="http://vts.sourceforge.net/">VTS</a> - visual test shell for
Win32, used for Visually testing a BACnet implementation. It also includes
a detailed network sniffer for BACnet messages, and the ability to send
any BACnet services. The source code is in the public domain. </li>
<li><a href="http://www.wireshark.org/">Wireshark</a> - an open source,
cross platform protocol analyzer with BACnet support. The detailed BACnet
support began in version 0.10.11 released on May 4, 2005 when Wireshark
was known as Ethereal.</li>
<li><a href="http://bacnet4linux.sourceforge.net/">BACnet4Linux</a> - an
LGPL BACnet application that requires Linux as the OS.</li>
<li><a href="http://bfr.sourceforge.net/">BACnet Firewall Router</a> -an
application that combines BACnet routing capability with traffic management
functions to carefully control access to building automation and control
networks.</li>
<li><a href="http://bacpypes.sourceforge.net/">BACpypes</a> - a
BACnet stack written in Python.</li>
<li><a href="http://bacsharp.sourceforge.net/">BACsharp</a> - a
BACnet/IP stack written in C#.</li>
<li><a href="http://bacnet4j.sourceforge.net/">BACnet4J</a> - a
BACnet/IP stack written in Java that serves as the BACnet layer for
<a href="http://mango.serotoninsoftware.com/">Mango</a>.
Mango is open source Machine-to-Machine software
(aka Industrial Control, SCADA, HMI, or domotics).</li>
</ul>
<p>There are also commercial BACnet protocol source code libraries for BACnet
that are designed for embedded use:</p>
<ul>
<li><a href="http://www.cimetrics.com">Cimetrics</a><font
size="-2"><sup>TM</sup></font> - has a source library
called BACstac/32 as part of their BACNet Protocol Stack SDK.</li>
<li><a href="http://www.polarsoft.biz">Polarsoft</a> - has a
protocol stack source library for embedded use called FreeRange<font
size="-2"><sup>TM</sup></font> and PolarSoft&#174; FreeRange VSB (Very
Small BACnet stack).</li>
<li><a href="http://www.scadaengine.com/">SCADA Engine</a> - The BACnet
Linux Server is a complete BACnet Device running on the linux platform.
The entire source code is available for custom applications and has been
written in ANSI C which has been succesfully ported to Unix,
VxWorks etc. </li>
<li><a href="http://bacnetstack.com/">BACnet Stack</a> - Chipkin
automation systems BACnet stack is an application layer BACnet
library for an embedded system and application development.</li>
</ul>
<h2>Licensing</h2>
<p>Our BACnet protocol stack implementation is specifically designed for the
embedded BACnet appliance, using a GPL with exception license (like <a
href="http://ecos.sourceware.org/">eCos</a>),
which means that any changes to the core code that are distributed are
made available, but the BACnet library can be linked to
proprietary code without it becoming licensed under the GPL.
See the <a href="http://ecos.sourceware.org/license-overview.html">eCos license overview</a> for
easy to read details about this exception to the GPL.
The license does <i>not</i> require users to release the source code of any
<i>applications</i> that are developed with this BACnet stack - only portions of
the BACnet stack that have been modified. Note that those files in this
BACnet stack that are expected to be modified are licensed using the
<a href="http://en.wikipedia.org/wiki/MIT_License">MIT License</a>.<p>
<p>The text of the GPL exception included in each source file is as
follows:</p>
<blockquote>
<p>"As a special exception, if other files instantiate templates or
use macros or inline functions from this file, or you compile
this file and link it with other works to produce a work based
on this file, this file does not by itself cause the resulting
work to be covered by the GNU General Public License. However
the source code for this file must still be made available in
accordance with section (3) of the GNU General Public License."<p>
</blockquote>
<h2>The source code</h2>
<p>The source code is written in C for portability, and includes
unit tests (PC based unit tests) and example application code.
Since the code is designed to be
portable, it compiles with GCC as well as other compilers,
such as Borland C++, Visual C++, MinGW, Code Warrior, IAR, or MicroChip C18.
The source code is also designed to be high quality, readable,
understandable, and easy to use.</p>
<p>The BACnet protocol is an ASHRAE/ANSI/ISO standard, so this library
adheres to that standard. BACnet has no royalties or licensing restrictions,
and <a href="http://www.bacnet.org/VendorID/">registration for a BACnet
vendor ID</a> is free.</p>
<h2>What the code does</h2>
<p>The BACnet stack comes with example applications
that can be run under Linux, Win32, RTOS-32, and just about any embedded
microcontroller.</p>
<p>The BACnet stack includes unit tests can be run in a command shell on Linux using the
unittest.sh script, or using individual .mak files. They were tested under
<a href="http://www.debian.org/">Debian GNU/Linux</a> and <a href="http://www.ubuntu.com/">Ubuntu Linux</a>.</p>
<p>The BACnet stack was functionally tested
using <a href="http://vts.sourceforge.net/">VTS (Visual Test Shell)</a>,
another project hosted on SourceForge, as well as various BACnet controllers,
BACnet workstations, and through BACnet routers. Some versions of the
BACnet stack were BTL tested.<p>
<h2>Demo BACnet Applications</h2>
<p>Using a master Makefile in the project root directory, a dozen
demo applications can be created that run under Linux or Win32.
Linux supports BACnet Ethernet, BACnet/IP, or ARCNET data link layer
for communication, and BACnet/IP is supported under Win32. BACnet Ethernet
can also be used under Win32 with the <a href="http://www.winpcap.org/">WinPcap library</a>.
Root priveleges are required to run the Ethernet or ARCNET interfaces
on Linux, but are not needed to run BACnet/IP.
MS/TP support under Windows or Linux using a USB to RS-485 device is a
work in progress. </p>
<p>To build all the demo applications under linux using the
BACnet/IP datalink layer, use the familiar make command:</p>
<code>
$ make clean all<br>
</code>
<p>You can also modify the Makefile variabiles from the command line to build
with the BACnet MS/TP datalink layer, for example:</p>
<code>
$ make BACDL_DEFINE=-DBACDL_MSTP=1 clean all<br>
</code>
<p>To build all the demo applications under Windows with the
BACnet/IP datalink layer and utilizing the
<a href="http://www.mingw.org/">MinGW tools</a>,
use the <code>build.bat</code> file provided in the root directory.
Note that you may have to
copy the <code>mingw-make.exe</code> to <code>make.exe</code>
to enable the compile.</p>
<code>
$ build.bat<br>
</code>
<p>To build all the demo applications under Windows with the
BACnet/IP datalink layer and utilizing the
<a href=http://www.borland.com/>Borland tools</a>, use the
<code>borland.bat</code> file provided in the root directory.</p>
<code>
$ borland.bat<br>
</code>
<p>To build all the demo applications under Windows using the
BACnet/IP datalink layer utilizing the
<a href="http://codeblocks.org/">Code::Blocks</a> tools, use the
<code>BACnetDemo.workspace</code> file provided in the
<a href="http://bacnet.svn.sourceforge.net/viewvc/bacnet/trunk/bacnet-stack/demo">demo</a>
directory.</p>
<p>The demo application accept command line arguments.
To specify an array index of ALL, use "-1".
To make a priority optional, use "0".
The applications also use environment variables to set
datalink layer preferences.
Use <code>--help</code> on the command line to see more options.</p>
<code>
$ demo/server/bacsrv 123<br>
BACnet Server Demo - Device #123<br>
<br>
$ demo/readprop/bacrp<br>
bacrp device-instance object-type object-instance property [index]<br>
<br>
$ demo/writeprop/bacwp<br>
bacwp device-instance object-type object-instance property priority index tag value [tag value...]<br>
<br>
$ demo/readfile/bacarf<br>
bacarf device-instance file-instance local-name<br>
<br>
$ demo/writefile/bacawf<br>
bacawf device-instance file-instance local-name<br>
<br>
$ demo/reinit/bacrd<br>
Usage: bacrd device-instance state [password]<br>
Send BACnet ReinitializeDevice service to device.<br>
<br>
$ demo/whohas/bacwh<br>
Usage: bacwh object-type object-instance | object-name<br>
Send BACnet WhoHas request to devices, and wait for responses.<br>
<br>
$ demo/dcc/bacdcc<br>
Usage: bacdcc device-instance state timeout [password]<br>
Send BACnet DeviceCommunicationControl service to device.<br>
<br>
$ demo/timesync/bacts<br>
Received TimeSyncronization Request<br>
2006/8/30 07:10:45.00<br>
<br>
$ demo/ucov/bacucov<br>
Usage: bacucov pid device-id object-type object-instance time property tag value [priority] [index]<br>
<br>
$ demo/whois/bacwi<br>
Usage: bacwi device-instance | device-instance-min device-instance-max<br>
Send BACnet WhoIs request to devices, and wait for responses.<br>
<br>
The device-instance can be 0 to 4194303, or -1 for ALL.<br>
The device-instance can also be specified as a range.<br>
<br>
</code>
<p>The demos can be compiled under Win32 using <a href="http://www.mingw.org/">MinGW - Minimalist GNU for Windows</a>,
<a href="http://www.borland.com/bcppbuilder/freecompiler/">Borland C++</a>, or
<a href="http://msdn.microsoft.com/visualc/vctoolkit2003/">Microsoft Visual C++</a>, which
are free command line compilers. Be sure to pick up the free
<a href="http://info.borland.com/devsupport/bcppbuilder/patches/#freecompiler55">patches (service packs) for the Borland C++ compiler</a>
(<a href="http://info.borland.com/devsupport/bcppbuilder/patches/bcc55/bcc55sp1.zip">SP1</a>,
<a href="http://info.borland.com/devsupport/bcppbuilder/patches/bcc55/bcc55sp2.exe">SP2</a>),
as well as the free turbo debugger.
It is also possible to create Win32 projects using the
free <a href="http://msdn.microsoft.com/vstudio/express/">Visual Studio Express Edition</a> after
downloading the platform development kit for your operating system.
You can also use <a href="http://www.mingw.org/">MinGW - Minimalist GNU for Windows</a> which comes with Code::Blocks.
I frequently use <a href="http://codeblocks.org/">Code::Blocks</a> for
compiling the unit tests using the MinGW compiler and
created some Code::Block projects for some of the demos.
I have also used <a href="http://codeblocks.org/">Code::Blocks</a> with
the Borland C++ compiler and it successfully compiles and runs the code.</p>
<p><a href="https://sourceforge.net/projects/bacnet/files/bacnet-tools/">BACnet-Tools</a> -
the example applications are compiled for Windows and can be downloaded from
SourceForge.</p>
<p>To build the demo applications under Linux, such as
<a href="http://ubuntu.com/">Ubuntu</a>, you may need to install
some build tools.</p>
<code>
$ sudo apt-get install build-essential subversion-tools
</code>
<h2>Example BACnet Server Ported to Various Architectures</h2>
<p>There is a Makefile in the
<a href="http://bacnet.svn.sourceforge.net/viewvc/bacnet/trunk/bacnet-stack/ports/rtos32">ports/rtos32</a>
directory, and a sample application that runs
under <a href="http://www.on-time.com/">RTOS-32</a>.
It currently uses the BACnet/IP data link layer for communication, and also
has an MS/TP datalink layer sample application.
It compiles using <a href="http://borland.com/">Borland C++</a>.</p>
<p>There is a project in the
<a href="http://bacnet.svn.sourceforge.net/viewvc/bacnet/trunk/bacnet-stack/ports/pic18f6720">ports/pic18f6720</a>
directory, and a sample
application that can be built using <a href="http://microchip.com">MP-Lab</a>
and the Microchip compiler MCC18. The datalink layer uses BACnet MS/TP
and the example uses several different objects and services.</p>
<p>There is a project in the
<a href="http://bacnet.svn.sourceforge.net/viewvc/bacnet/trunk/bacnet-stack/ports/at91sam7s">ports/at91sam7s</a>
directory for the AT91SAM7S-EK
demo board. There is a server application that can be built using
the GNU ARM tools, such as
<a href="http://www.codesourcery.com/gnu_toolchains/arm">GNU Toolchain for ARM</a>,
<a href="http://www.gnuarm.com/">GNU ARM</a>,
<a href="http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects/">WinARM</a>,
<a href="http://www.yagarto.de/">YAGARTO</a>,
or <a href="http://www.rowley.co.uk/arm/">Rowley Crossworks for ARM</a> toolchains on the Windows platform.
The datalink layer uses BACnet MS/TP
and the example uses several different objects and services.</p>
<p>There is a project in the
<a href="http://bacnet.svn.sourceforge.net/viewvc/bacnet/trunk/bacnet-stack/ports/atmega168">ports/atmega168</a>
directory, and a sample
server application that can be built using
<a href="http://www.avrfreaks.net/wiki/index.php/Documentation:AVR_GCC/AVR_GCC_Tool_Collection">GCC-AVR</a> or
<a href="http://winavr.sourceforge.net/">WinAVR</a> for Atmel AVR series of microcontrollers.
There is also a project in the
<a href="http://bacnet.svn.sourceforge.net/viewvc/bacnet/trunk/bacnet-stack/ports/bdk-atxx4-mstp">ports/bdk-atxx4-mstp</a>
directory which works on the <a href="http://bacnetdevelopmentkit.com/">ATmega644 based BACnet Development Kit</a>.</p>
<p>Both projects use the BACnet MS/TP datalink layer
and the example uses several different objects and services.
In additional to the free tools listed above, the AVR projects
can be developed using the commercial
<a href="http://www.rowley.co.uk/avr/">Rowley Crossworks for AVR</a>
on the Windows, MAC OS X, Linux, or Solaris platform. CrossWorks is a complete
development environment.
The AVR projects can also be developed using the commercial
<a href="http://www.iar.com/en/Products/IAR-Embedded-Workbench/AVR/">IAR Embedded Workbench for Atmel AVR</a>
environment on Windows.</p>
<p>There is a project in the
<a href="http://bacnet.svn.sourceforge.net/viewvc/bacnet/trunk/bacnet-stack/ports/stm32f10x">ports/stm32f10x</a>
directory, and a sample server application that can be built using
<a href="http://www.iar.com/">IAR Embedded Workbench for ARM</a>.
It was written for the 2011
<a href="http://www.stm32challenge.com/">STM32 Design Challenge,</a>
and was one of the finalists.
The Target is an ARM Cortex-M3 microcontroller, and the design utilizes
the <a href="http://www.arm.com/products/processors/cortex-m/cortex-microcontroller-software-interface-standard.php">CMSIS</a> and
STM32 Peripheral Driver Library.
The port uses the BACnet MS/TP datalink layer
and the example uses several different objects and services.</p>
<TABLE border="1" width="100%" cellpadding="1" cellspacing="0"
summary="BACnet services supported matrix">
<TBODY>
<TR><H2>BACnet services supported matrix</H2>
<p>The BACnet stack currently implements the following services listed in the
the table. We plan to add the rest of the services as we go.
With the services that are implemented, you could build a BACnet device
that meets the standardized profile for a BACnet Smart Sensor,
BACnet Smart Actuator, or a BACnet Application Specific Controller.</p></TR>
<TR>
<TD bgcolor="#CCF6F6" width="50%" valign="top"><b>BACnet Service</b></td>
<TD bgcolor="#CCF6F6" width="25%" align="center" valign="top"><b>Initiate</b></td>
<TD bgcolor="#CCF6F6" width="25%" align="center" valign="top"><b>Execute</b></td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="50%" valign="top">Who Is</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="50%" valign="top">I Am</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="50%" valign="top">Who Has</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="50%" valign="top">I Have</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="50%" valign="top">Read Property</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="50%" valign="top">Write Property</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="50%" valign="top">Device Communication Control</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="50%" valign="top">ReinitializeDevice</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="50%" valign="top">Atomic Read File</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="50%" valign="top">Atomic Write File</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="50%" valign="top">Time Synchronization</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="50%" valign="top">UTC Time Synchronization</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="50%" valign="top">Subscribe COV</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="50%" valign="top">Confirmed COV Notification</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="50%" valign="top">Unconfirmed COV Notification</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="50%" valign="top">Read Property Multiple</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="50%" valign="top">Read Property Conditional</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="50%" valign="top">Read Range</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="50%" valign="top">Write Property Multiple</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="50%" valign="top">Get Alarm Summary</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="50%" valign="top">Get Event Information</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="50%" valign="top">Get Enrollment Summary</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="50%" valign="top">Acknowledge Alarm</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="50%" valign="top">Confirmed Event Notification</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="50%" valign="top">Unconfirmed Event Notification</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="50%" valign="top">Unconfirmed Text Message</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="50%" valign="top">Confirmed Text Message</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="50%" valign="top">Add List Element</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="50%" valign="top">Remove List Element</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="50%" valign="top">Create Object</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="50%" valign="top">Delete Object</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="50%" valign="top">Unconfirmed Private Transfer</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="50%" valign="top">Confirmed Private Transfer</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="50%" valign="top">VT Open</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="50%" valign="top">VT Data</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="50%" valign="top">VT Close</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
</TBODY>
</TABLE>
<TABLE border="1" width="100%" cellpadding="1" cellspacing="0"
summary="BACnet Objects">
<TBODY>
<TR><H2>BACnet Objects</H2>
<p>The BACnet stack currently implements an example Device Object, and
handles all of the ReadProperty and ReadPropertyMultiple inquiries for
the required Device Object properties. The stack handles Who-Is inquiries
with an I-Am, WhoHas with I-Have, and handles reject messages for
services not currently supported or implemented by your device.
There is built-in handling for DeviceCommunicationControl.</p>
<p>The example handlers interact with example objects by way of the Device
object. There are example objects for the developer to use as a template
when customizing the objects for their device.</p>
<p>File Objects are conditionally included in the demonstation
applications. The files can be accessed using WriteProperty,
ReadProperty, Who-Has, AtomicWriteFile, or AtomicReadFile services.</p></TR>
<TR>
<TD bgcolor="#CCF6F6" width="75%" valign="top"><b>BACnet Object</b></td>
<TD bgcolor="#CCF6F6" width="25%" align="center" valign="top"><b>Code Example</b></td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">Accumulator</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">Analog Input</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">Analog Output</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">Analog Value</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">Averaging</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">Binary Input</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">Binary Output</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">Binary Value</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">Calendar</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">Command</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">Device</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">Event Enrollment</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">File</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">Group</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">Life Safety Point</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">Life Safety Zone</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">Loop</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">Multi-state Input</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">Multi-state Output</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">Multi-state Value</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">Notification Class</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">Program</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">Pulse Converter</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">Schedule</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">Trend Log</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">Access Door</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">Event Log</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">Load Control</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">Yes</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">Structured View</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">Trend Log Multiple</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">Access Point</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">Access Zone</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">Access User</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">Access Rights</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">Access Credential</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">Credential Data Input</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">CharacterString Value</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">DateTime Value</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">Large Analog Value</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">BitString Value</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">OctetString Value</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">Time Value</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">Integer Value</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">Positive Integer Value</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">Date Value</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">DateTime Pattern Value</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">Time Pattern Value</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">Date Pattern Value</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">Network Security</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
<TR>
<TD bgcolor="#FFFFDD" width="75%" valign="top">Global Group</td>
<TD bgcolor="#FFFFDD" width="25%" align="center" valign="top">-</td>
</TR>
</TBODY>
</TABLE>
<h2>Getting Involved</h2>
<p>If you want to help out on this project, join the <a href="http://lists.sourceforge.net/mailman/listinfo/bacnet-developers">developers mailing list</a>, introduce yourself, and tell us what you would like to do.
If you are trying to implement a BACnet device or service using this project,
you are welcome to join the same <a href="http://lists.sourceforge.net/mailman/listinfo/bacnet-developers">developers mailing list</a> as well.</p>
<p>More details about the project can be found on
the <a href="http://sourceforge.net/projects/bacnet/">BACnet Source Forge Project Page</a></p>
<p>There is documentation that <a href="http://bacnet.svn.sourceforge.net/viewvc/bacnet/trunk/bacnet-stack/doc/README.developer">describes the mechanisms in the BACnet Stack</a>.
I wrote up some <a href="http://bacnet.svn.sourceforge.net/viewvc/bacnet/trunk/bacnet-stack/doc/README.faq">answers to some frequently asked questions</a>.
Of course, there are a handful of text files in the doc directory of
the project with more useful information.</p>
<p><a
href="http://sourceforge.net/project/showfiles.php?group_id=117598&package_id=140172">BACnet
Stack released files download</a></p>
<p>You can get the latest BACnet protocol stack source code using
the <a href="http://subversion.tigris.org/">Subversion</a> version control system.
The main development branch is
at: <a href="https://bacnet.svn.sourceforge.net/svnroot/bacnet/trunk/bacnet-stack/">https://bacnet.svn.sourceforge.net/svnroot/bacnet/trunk/bacnet-stack/</a>. This
has the absolute latest code and features. Anyone doing development on the BACnet protocol stack
should be using this branch. The stable releases are
at: <a href="https://bacnet.svn.sourceforge.net/svnroot/bacnet/tags/">https://bacnet.svn.sourceforge.net/svnroot/bacnet/tags/</a>. This
matches the released version downloadable through SourceForge. Anyone doing project development using
the BACnet protocol stack should be using the tags branch and an appropriate version tag.
The custom and vendor branches are
at: <a href="https://bacnet.svn.sourceforge.net/svnroot/bacnet/branches/">https://bacnet.svn.sourceforge.net/svnroot/bacnet/branches/</a>.
The <a href="https://bacnet.svn.sourceforge.net/svnroot/bacnet/branches/jbennet/">JBennet branch</a> includes a
derivative project that is designed for a BACnet Client.</p>
<p>To check out the trunk, use "svn co", e.g.</p>
<blockquote>
<code>svn co https://bacnet.svn.sourceforge.net/svnroot/bacnet/trunk/bacnet-stack/</code><br />
or for the stable releases:<br />
<code>svn co https://bacnet.svn.sourceforge.net/svnroot/bacnet/tags/bacnet-stack-0-5-0/</code><br />
or for the JBennet branch:<br />
<code>svn co https://bacnet.svn.sourceforge.net/svnroot/bacnet/branches/jbennet/</code>
</blockquote>
<h2>BACnet Developer Resources</h2>
There are a number of resources that can help you develop a BACnet product or project.
<ul>
<li><a href="http://vts.sourceforge.net/">VTS</a> - visual test shell for
Win32, used for Visually testing a BACnet implementation. It also includes
a detailed network sniffer for BACnet messages, and the ability to send
any BACnet services. The source code is in the public domain. </li>
<li><a href="http://www.wireshark.org/">Wireshark</a> - an open source,
cross platform protocol analyzer with BACnet support. The detailed BACnet
support in began in version 0.10.11 released on May 4, 2005 when Wireshark
was known as Ethereal. Also, BACnet MS/TP capture support was added
in Wireshark version 1.1.0.
The <a href=http://steve.kargs.net/bacnet/wireshark-and-bacnet-mstp/>demo application mstpcap</a>
can be used to capture BACnet MS/TP using an RS-485 converter,
and save the data to a capture file that can be viewed with Wireshark.</li>
<li><a href="http://www.ubuntu.com/">Ubuntu Linux</a> or
<a href="http://www.debian.org/">Debian Linux</a> - my
development platforms of choice.
Linux makes a great development platform
because all the necessary development tools are included.</li>
<li><a href="http://www.codeblocks.org/">Code::Blocks</a> - a free cross-platform
open source C/C++ IDE. Includes the MinGW compiler for Win32.</li>
<li>Win32 development can use <a href="http://www.borland.com/bcppbuilder/freecompiler/">Borland C++</a> or
<a href="http://msdn.microsoft.com/visualc/vctoolkit2003/">Microsoft Visual C++</a>,
both of which are free (as in beer) command line compilers. Be sure to pick up the free
<a href="http://info.borland.com/devsupport/bcppbuilder/patches/#freecompiler55">patches (service packs) for the Borland C++ compiler</a>
(<a href="http://info.borland.com/devsupport/bcppbuilder/patches/bcc55/bcc55sp1.zip">SP1</a>,
<a href="http://info.borland.com/devsupport/bcppbuilder/patches/bcc55/bcc55sp2.exe">SP2</a>),
as well as the free turbo debugger.</li>
</ul>
<p><a href="http://www.bacnet.org/Developer/index.html">BACnet
Developer Help</a></p>
<p><a href="http://www.bacnetinternational.org/associations/8066/btl/?page=47">BACnet
International Developer Resources</a></p>
<h2>Products and Projects that use this BACnet Stack</h2>
<p>Did you develop a product using this BACnet stack? <a href="http://kargs.net/contacts.html">Let us know</a>, and you
can get a little recognition for your hard work!</p>
<p><a href="http://bacnetdevelopmentkit.com/">BACnet Development Kit</a> - An
Atmel ATmega644 based development kit designed to kickstart BACnet MS/TP
development.</p>
<p><a href="http://wattstopper.com/DLM/">Digital Lighting Management</a> -
offers connectivity without complexity for remote system management and
control of lights and plug loads. Just one device in each room network has to
be connected to a BACnet MS/TP segment for centralized control.</p>
<p><a href="http://www.controlsystemworks.com/">CSWorks</a> - a development
framework for building web-based HMI (Human Machine Interface),
SCADA (Supervisory Control And Data Acquisition),
EMI (Enterprise Manufacturing Intelligence) and
M2M (Machine to Machine) software applications.</p>
<p><a href="http://sensors.scinterface.com/">SCInterface&trade; = Sensor Control Interface</a> - middleware
platform for managing legacy and modern-day sensors through a centralized
interface.</p>
<p><a href="http://sourceforge.net/projects/bacnet-sim/">BACnetSim</a> - a
portable implementation of the BACnet data communication protocol.
BACnetSim is meant for embedded devices and use MS/TP as the media
access layer. BACnetSim is a fork of bacnet-stack-0.0.1</p>
<p><a href="http://simulationresearch.lbl.gov/bcvtb">Building Controls Virtual Test Bed</a> - a
software environment that allows coupling different simulation programs
including Dymola, EnergyPlus, MATLAB/Simulink and Radiance for co-simulation,
and to couple these programs to control systems.</p>
<p><a href="http://linde.caltech.edu/articles/the-prodigal-sun-returns-the-coelostat-in-the-linde-robinson-laboratory">The coelostat in the Linde + Robinson Laboratory</a> at Caltech.</p>
<hr>
<A href="http://sourceforge.net"> <IMG
src="http://sourceforge.net/sflogo.php?group_id=117598&amp;type=5"
width="210" height="62" border="0" alt="SourceForge.net Logo" /></A>
<p><font size="-2"><b>ASHRAE<sup>&reg;</sup></b> and
<b>BACnet<sup>&reg;</sup></b> are registered trademarks of the American
Society of Heating, Refrigerating and Air-Conditioning Engineers, Inc.,
1791 Tullie Circle NE, Atlanta, GA 30329.</font> </p>
<p>Website updated 19-December-2011 by <a href="http://steve.kargs.net/">Steve Karg</a>.</p>
</BODY>
</HTML>
+127
View File
@@ -0,0 +1,127 @@
.\" Process this file with
.\" groff -man -Tascii bacrp.1
.\" Contact <skarg@users.sourceforge.net> to correct errors or ommissions
.TH bacrp 1 "July 2008" "0.4.5" "BACnet Stack at SourceForge Tool Manual"
.SH NAME
bacrp \- send BACnet ReadProperty service request to BACnet devices
.SH SYNOPSIS
.B bacrp device-instance object-type object-instance property [index]
.SH DESCRIPTION
.B bacrp uses the BACnet ReadProperty service request to elicit
a ReadPropertyAck or BACnet Error service response from a BACnet
device on the network. WhoIs and I-Am are used for device binding.
The property value or error message is returned to stdio.
.SH OPTIONS
.IP device-instance
Device object instance number that you are trying to
send a ReadProperty service request. The value should be in
the range of 0 to 4194303.
.IP "object-type"
The object type is the integer value of the enumeration
BACNET_OBJECT_TYPE in bacenum.h. It is the object
that you are reading. For example if you were
reading Analog Output 2, the object-type would be 1.
.IP "object-instance"
This is the object instance number of the object that
you are reading. For example, if you were reading
Analog Output 2, the object-instance would be 2.
.IP "property"
The property is an integer value of the enumeration
BACNET_PROPERTY_ID in bacenum.h. It is the property
you are reading. For example, if you were reading the
Present Value property, use 85 as the property.
.IP "index"
This integer parameter is the index number of an array.
If the property is a BACnetARRAY, individual elements can
be read. If this parameter is missing and the property
is an array, the entire array will be read.
.SH EXAMPLES
If you want read the Present-Value of Analog Output 101
in Device 123, you could send the following command:
$ bacrp 123 1 101 85
If you want read the Priority-Array of Analog Output 101
in Device 123, you could send the following command:
$ bacrp 123 1 101 87
If you want read the length of Priority-Array of Analog
Output 101 in Device 123, you could send the following command:
$ bacrp 123 1 101 87 0
.SH FILES
.I address_cache
.RS
A cache that is read for static binding. See
.BR address_cache (5)
for further details.
.SH ENVIRONMENT
.IP BACNET_IP_PORT
If non-null, the number of the UDP port for BACnet/IP datalink.
The default UDP port number is 47808 (0xBAC0).
.IP BACNET_IFACE
If non-null, the device name for the datalink.
The default is "eth0".
.IP BACNET_BBMD_PORT
If non-null, the number of the UDP port that the BBMD is using.
The default UDP port number is 47808 (0xBAC0).
Used for BACnet/IP datalink only.
.IP BACNET_BBMD_TIMETOLIVE
If non-null, the number of seconds used in the Foreign Device
Registration. A 16-bit unsigned value of 0 to 65535 is expected.
The default number of seconds is 65535 (0xFFFF).
Used for BACnet/IP datalink only.
.IP BACNET_BBMD_ADDRESS
If non-null, the IP address of the BBMD that is handling the
Foreign Device Registration. If this environment variable is
missing or NULL, then Foreign Device Registration does not occur.
Used for BACnet/IP datalink only.
.IP BACNET_MAX_INFO_FRAMES
If non-null, the Max-Info-Frames value between 1 and 255.
The default number of frames is 1.
Used for BACnet MS/TP datalink only.
.IP BACNET_MAX_MASTER
If non-null, the Max-Master value between 1 and 127.
The default Max-Master is 127.
Used for BACnet MS/TP datalink only.
.IP BACNET_MSTP_BAUD
If non-null, a value baud rate of 9600, 19200, 38400, 57600,
and 115200.
The default baud rate is 9600.
Used for BACnet MS/TP datalink only.
.IP BACNET_MSTP_MAC
If non-null, the MS/TP MAC address value between 0 and 127.
The default MAC address is 0.
Used for BACnet MS/TP datalink only.
.SH DIAGNOSTICS
The following diagnostics may be issued on stderr:
device-instance=x - it must be less than 4194304
object-type=x - it must be less than 1024
object-instance=x - it must be less than 4194304
property=x - it must be less than 4194304
Error: TSM Timeout!
Error: APDU Timeout!
.SH BUGS
No bugs are known to exist at this time.
.SH AUTHOR
Steve Karg <skarg@users.sourceforge.net>
.SH "SEE ALSO"
.BR bacarf (1),
.BR bacawf (1),
.BR bacdcc (1),
.BR bacepics (1),
.BR bacrd (1),
.BR bacserv (1),
.BR bacts (1),
.BR bacucov (1),
.BR bacwh (1),
.BR bacwp (1),
.BR address_cache (5)
+103
View File
@@ -0,0 +1,103 @@
.\" Process this file with
.\" groff -man -Tascii bacwi.1
.\" Contact <skarg@users.sourceforge.net> to correct errors or ommissions
.TH bacwi 1 "May 2008" "0.4.5" "BACnet Stack at SourceForge Tool Manual"
.SH NAME
bacwi \- send BACnet WhoIs service request to BACnet devices
.SH SYNOPSIS
.B bacwi device-instance | device-instance-min device-instance-max
.SH DESCRIPTION
.B bacwi uses the BACnet WhoIs service request to elicit
an I-Am service response from one or more BACnet devices
on the network. I-Am responses include a Device Object-Identifier,
a Vendor-Identifier, a Max-APDU size, and segmentation information.
By its nature, I-Am responses include the source address and
any network layer information necessary to communicate with the
device.
.SH OPTIONS
.IP device-instance
Device object instance number that you are trying to
send a Who-Is service request. The value should be in
the range of 0 to 4194303. A range of values can also be
specified by using a minimum value and a maximum value
option.
.IP "device-instance-min"
For specifying a range of Device object instance numbers,
this is the starting value.
.IP "device-instance-max"
For specifying a range of Device object instance numbers,
this is the ending value.
.SH FILES
.I address_cache
.RS
A cache that is read for static binding. See
.BR address_cache (5)
for further details.
.SH ENVIRONMENT
.IP BACNET_IP_PORT
If non-null, the number of the UDP port for BACnet/IP datalink.
The default UDP port number is 47808 (0xBAC0).
.IP BACNET_IFACE
If non-null, the device name for the datalink.
The default is "eth0".
.IP BACNET_BBMD_PORT
If non-null, the number of the UDP port that the BBMD is using.
The default UDP port number is 47808 (0xBAC0).
Used for BACnet/IP datalink only.
.IP BACNET_BBMD_TIMETOLIVE
If non-null, the number of seconds used in the Foreign Device
Registration. A 16-bit unsigned value of 0 to 65535 is expected.
The default number of seconds is 65535 (0xFFFF).
Used for BACnet/IP datalink only.
.IP BACNET_BBMD_ADDRESS
If non-null, the IP address of the BBMD that is handling the
Foreign Device Registration. If this environment variable is
missing or NULL, then Foreign Device Registration does not occur.
Used for BACnet/IP datalink only.
.IP BACNET_MAX_INFO_FRAMES
If non-null, the Max-Info-Frames value between 1 and 255.
The default number of frames is 1.
Used for BACnet MS/TP datalink only.
.IP BACNET_MAX_MASTER
If non-null, the Max-Master value between 1 and 127.
The default Max-Master is 127.
Used for BACnet MS/TP datalink only.
.IP BACNET_MSTP_BAUD
If non-null, a value baud rate of 9600, 19200, 38400, 57600,
and 115200.
The default baud rate is 9600.
Used for BACnet MS/TP datalink only.
.IP BACNET_MSTP_MAC
If non-null, the MS/TP MAC address value between 0 and 127.
The default MAC address is 0.
Used for BACnet MS/TP datalink only.
.SH DIAGNOSTICS
The following diagnostics may be issued on stderr:
device-instance=x - it must be less than 4194304
object-type=x - it must be less than 1024
object-instance=x - it must be less than 4194304
property=%u - it must be less than 4194304
.SH BUGS
No bugs are known to exist at this time.
.SH AUTHOR
Steve Karg <skarg@users.sourceforge.net>
.SH "SEE ALSO"
.BR bacarf (1),
.BR bacawf (1),
.BR bacdcc (1),
.BR bacepics (1),
.BR bacrd (1),
.BR bacrp (1),
.BR bacserv (1),
.BR bacts (1),
.BR bacucov (1),
.BR bacwh (1),
.BR bacwp (1),
.BR address_cache (5)
+167
View File
@@ -0,0 +1,167 @@
.\" Process this file with
.\" groff -man -Tascii bacwp.1
.\" Contact <skarg@users.sourceforge.net> to correct errors or ommissions
.TH bacwp 1 "Sept 16 2011" "0.7.0" "BACnet Stack at SourceForge Tool Manual"
.SH NAME
bacwp \- send BACnet WriteProperty service request to a BACnet device
.SH SYNOPSIS
.B bacwp device-instance object-type object-instance property priority index tag value [tag value...]
.SH DESCRIPTION
.B bacrp uses the BACnet WriteProperty service request to write
a property value to a BACnet device on the network. WhoIs and
I-Am are used for device binding. A simple Ack or error message
is returned to stdio.
.SH OPTIONS
.IP device-instance
Device object instance number that you are trying to
send a WriteProperty service request. The value should be in
the range of 0 to 4194303.
.IP "object-type"
The object type is the integer value of the enumeration
BACNET_OBJECT_TYPE in bacenum.h. It is the object
that you are writing. For example if you were
writing Analog Output 2, the object-type would be 1.
.IP "object-instance"
This is the object instance number of the object that
you are writing. For example, if you were writing
Analog Output 2, the object-instance would be 2.
.IP "property"
The property is an integer value of the enumeration
BACNET_PROPERTY_ID in bacenum.h. It is the property
you are writing. For example, if you were writing the
Present Value property, the property is 85.
.IP "priority"
This parameter is used for setting the priority of the
write. If Priority 0 is given, no priority is sent. The BACnet
standard states that the value is written at the lowest
priority (16) if the object property supports priorities
when no priority is sent.
.IP "index"
This integer parameter is the index number of an array.
If the property is a BACnetARRAY and writable, individual
elements can be written. If this parameter value is -1,
it is omitted when writing to the property.
.IP "tag"
Tag is the integer value of the enumeration BACNET_APPLICATION_TAG
in bacenum.h. It is the data type of the value that you are
writing. For example, if you were writing a REAL value, you would
use a tag of 4.
Context tags are created using two tags in a row. The context tag
is preceded by a C. Ctag tag. C2 4 creates a context 2 tagged REAL.
.IP "value"
The value is an ASCII representation of some type of data that you
are writing. It is encoded using the tag information provided. For
example, if you were writing a REAL value of 100.0, you would use
100.0 as the value. If you were writing an Object-Identifier such
as Device object 1, you would use 8:1 as the value. If you were
writing a Boolean, a value of 0 would indicate false, and a non-zero
value would indicate true.
.SH BACnet Tags
Here is a brief overview of BACnet property and tags:
Certain properties are expected to be written with certain
application tags, so you probably need to know which ones to use
with each property of each object. It is almost safe to say that
given a property and an object and a table, the tag could be looked
up automatically. There may be a few exceptions to this, such as
the Any property type in the schedule object and the Present Value
accepting REAL, BOOLEAN, NULL, etc. Perhaps it would be simpler for
the demo to use this kind of table - but I also wanted to be able
to do negative testing by passing the wrong tag and have the server
return a reject message.
.SH EXAMPLES
If you want send a value of 100 to the Present-Value in
Analog Output 0 of Device 123 at priority 16,
send the following command:
$ bacwp 123 1 0 85 16 -1 4 100
To send a relinquish command to the same object:
$ bacwp 123 1 0 85 16 -1 0 0
.SH FILES
.I address_cache
.RS
A cache that is read for static binding. See
.BR address_cache (5)
for further details.
.SH ENVIRONMENT
.IP BACNET_IP_PORT
If non-null, the number of the UDP port for BACnet/IP datalink.
The default UDP port number is 47808 (0xBAC0).
.IP BACNET_IFACE
If non-null, the device name for the datalink.
The default is "eth0".
.IP BACNET_BBMD_PORT
If non-null, the number of the UDP port that the BBMD is using.
The default UDP port number is 47808 (0xBAC0).
Used for BACnet/IP datalink only.
.IP BACNET_BBMD_TIMETOLIVE
If non-null, the number of seconds used in the Foreign Device
Registration. A 16-bit unsigned value of 0 to 65535 is expected.
The default number of seconds is 65535 (0xFFFF).
Used for BACnet/IP datalink only.
.IP BACNET_BBMD_ADDRESS
If non-null, the IP address of the BBMD that is handling the
Foreign Device Registration. If this environment variable is
missing or NULL, then Foreign Device Registration does not occur.
Used for BACnet/IP datalink only.
.IP BACNET_MAX_INFO_FRAMES
If non-null, the Max-Info-Frames value between 1 and 255.
The default number of frames is 1.
Used for BACnet MS/TP datalink only.
.IP BACNET_MAX_MASTER
If non-null, the Max-Master value between 1 and 127.
The default Max-Master is 127.
Used for BACnet MS/TP datalink only.
.IP BACNET_MSTP_BAUD
If non-null, a value baud rate of 9600, 19200, 38400, 57600,
and 115200.
The default baud rate is 9600.
Used for BACnet MS/TP datalink only.
.IP BACNET_MSTP_MAC
If non-null, the MS/TP MAC address value between 0 and 127.
The default MAC address is 0.
Used for BACnet MS/TP datalink only.
.SH DIAGNOSTICS
The following diagnostics may be issued on stderr:
device-instance=x - it must be less than 4194304
object-type=x - it must be less than 1024
object-instance=x - it must be less than 4194304
property=x - it must be less than 4194304
Error: not enough tag-value pairs
Error: tag=x - it must be less than 15
Error: unable to parse the tag value
Error: Exceeded 64 tag-value pairs.
Error: TSM Timeout!
Error: APDU Timeout!
.SH BUGS
No bugs are known to exist at this time.
.SH AUTHOR
Steve Karg <skarg@users.sourceforge.net>
.SH "SEE ALSO"
.BR bacarf (1),
.BR bacawf (1),
.BR bacdcc (1),
.BR bacepics (1),
.BR bacrd (1),
.BR bacrp (1),
.BR bacserv (1),
.BR bacts (1),
.BR bacucov (1),
.BR bacwh (1),
.BR address_cache (5)
+16
View File
@@ -0,0 +1,16 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>BAC-stack</title>
</head>
<frameset cols="250,*">
<frame src="html/tree.html" name="treefrm"/>
<frame src="html/main.html" name="basefrm"/>
<noframes>
<body>
<a href="html/main.html">Frames are disabled. Click here to go to the main page.</a>
</body>
</noframes>
</frameset>
</html>
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB