diff --git a/bacnet-stack/demo/readprop/main.c b/bacnet-stack/demo/readprop/main.c index 5ec9ec5c..f67ff262 100644 --- a/bacnet-stack/demo/readprop/main.c +++ b/bacnet-stack/demo/readprop/main.c @@ -1,5 +1,4 @@ -/************************************************************************** -* +/************************************************************************* * Copyright (C) 2006 Steve Karg * * Permission is hereby granted, free of charge, to any person obtaining @@ -232,9 +231,46 @@ int main(int argc, char *argv[]) { bool found = false; if (argc < 5) { - printf - ("%s device-instance object-type object-instance property [index]\r\n", + printf( + "Usage: %s device-instance object-type object-instance " + "property [index]\r\n", filename_remove_path(argv[0])); + if ((argc > 1) && (strcmp(argv[1], "--help") == 0)) { + printf("device-instance:\r\n" + "BACnet Device Object Instance number that you are\r\n" + "trying to communicate to. This number will be used\r\n" + "to try and bind with the device using Who-Is and\r\n" + "I-Am services. For example, if you were reading\r\n" + "Device Object 123, the device-instance would be 123.\r\n" + "\r\nobject-type:\r\n" + "The object type is the integer value of the enumeration\r\n" + "BACNET_OBJECT_TYPE in bacenum.h. It is the object\r\n" + "that you are reading. For example if you were\r\n" + "reading Analog Output 2, the object-type would be 1.\r\n" + "\r\nobject-instance:\r\n" + "This is the object instance number of the object that\r\n" + "you are reading. For example, if you were reading\r\n" + "Analog Output 2, the object-instance would be 2.\r\n" + "\r\nproperty:\r\n" + "The property is an integer value of the enumeration\r\n" + "BACNET_PROPERTY_ID in bacenum.h. It is the property\r\n" + "you are reading. For example, if you were reading the\r\n" + "Present Value property, use 85 as the property.\r\n" + "\r\nindex:\r\n" + "This integer parameter is the index number of an array.\r\n" + "If the property is an array, individual elements can\r\n" + "be read. If this parameter is missing and the property\r\n" + "is an array, the entire array will be read.\r\n" + "\r\nExample:\r\n" + "If you want read the Present-Value of Analog Output 101\r\n" + "in Device 123, you could send the following command:\r\n" + "%s 123 1 101 85\r\n" + "If you want read the Priority-Array of Analog Output 101\r\n" + "in Device 123, you could send the following command:\r\n" + "%s 123 1 101 87\r\n", + filename_remove_path(argv[0]), + filename_remove_path(argv[0])); + } return 0; } /* decode the command line parameters */ @@ -260,7 +296,7 @@ int main(int argc, char *argv[]) { return 1; } if (Target_Object_Property > MAX_BACNET_PROPERTY_ID) { - fprintf(stderr, "object-type=%u - it must be less than %u\r\n", + fprintf(stderr, "property=%u - it must be less than %u\r\n", Target_Object_Property, MAX_BACNET_PROPERTY_ID + 1); return 1; } diff --git a/bacnet-stack/demo/whois/main.c b/bacnet-stack/demo/whois/main.c index a6fbc158..2365b8b8 100644 --- a/bacnet-stack/demo/whois/main.c +++ b/bacnet-stack/demo/whois/main.c @@ -239,11 +239,33 @@ int main(int argc, char *argv[]) { if (argc < 2) { printf - ("Usage: %s device-instance | device-instance-min device-instance-max\r\n" - "Send BACnet WhoIs request to devices, and wait for responses.\r\n" - "\r\n" "The device-instance can be 0 to %d, or -1 for ALL.\r\n" - "The device-instance can also be specified as a range.\r\n", - filename_remove_path(argv[0]), BACNET_MAX_INSTANCE); + ("Usage: %s device-instance | " + "device-instance-min device-instance-max\r\n", + filename_remove_path(argv[0])); + return 0; + } + if ((argc > 1) && (strcmp(argv[1], "--help") == 0)) { + printf( + "Send BACnet WhoIs service request to a device or\r\n" + "multiple devices, and wait for responses. Displays\r\n" + "any devices found and their network information.\r\n" + "\r\ndevice-instance:\r\n" + "BACnet Device Object Instance number that you are trying to\r\n" + "send a Who-Is service request. The value should be in\r\n" + "the range of 0 to 4194303. A range of values can also be\r\n" + "specified by using a minimum value and a maximum value.\r\n" + "\r\nExample:\r\n" + "To send a WhoIs request to Device 123\r\n" + "use the following command:\r\n" + "%s 123\r\n" + "To send a WhoIs request to Devices from 1000 to 9000:\r\n" + "%s 1000 9000\r\n" + "To send a WhoIs request to all devices\r\n" + "use the following command:\r\n" + "%s -1\r\n", + filename_remove_path(argv[0]), + filename_remove_path(argv[0]), + filename_remove_path(argv[0])); return 0; } /* decode the command line parameters */ diff --git a/bacnet-stack/demo/writeprop/main.c b/bacnet-stack/demo/writeprop/main.c index dd7885f7..c6838eb9 100644 --- a/bacnet-stack/demo/writeprop/main.c +++ b/bacnet-stack/demo/writeprop/main.c @@ -304,12 +304,15 @@ int main(int argc, char *argv[]) { "accepting REAL, BOOLEAN, NULL, etc. Perhaps it would be simpler for\r\n" "the demo to use this kind of table - but I also wanted to be able\r\n" "to do negative testing by passing the wrong tag and have the server\r\n" - "return a reject message.\r\n" "\r\n" "Example:\r\n" - "If you want send a 100 to the Present-Value in the Analog Output\r\n" - "at priority 16, you could send the following command:\r\n" - "%s 123 1 0 85 4 100\r\n" - "You could also send a relinquish command:\r\n" - "%s 123 1 0 85 0 0\r\n", filename_remove_path(argv[0]), + "return a reject message.\r\n" + "\r\nExample:\r\n" + "If you want send a value of 100 to the Present-Value in\r\n" + "Analog Output 0 of Device 123 at priority 16,\r\n" + "send the following command:\r\n" + "%s 123 1 0 85 16 -1 4 100\r\n" + "To send a relinquish command to the same object:\r\n" + "%s 123 1 0 85 16 -1 0 0\r\n", + filename_remove_path(argv[0]), filename_remove_path(argv[0])); } return 0; diff --git a/bacnet-stack/doc/htdocs/index.html b/bacnet-stack/doc/htdocs/index.html index ca31ecd3..48cd420b 100644 --- a/bacnet-stack/doc/htdocs/index.html +++ b/bacnet-stack/doc/htdocs/index.html @@ -130,16 +130,23 @@ another project hosted on SourceForge, as well as various BACnet controllers, BACnet workstations, and through BACnet routers.

-

Using a master Makefile in the project root directory, a dozen or so +

Demo BACnet Applications

+

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 WinPcap library. Root priveleges are required to run the Ethernet or ARCNET interfaces - on Linux, but not needed to run BACnet/IP. + 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.

+

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.

+ $ make clean all
$ demo/server/bacsrv 123
@@ -149,7 +156,7 @@ bacrp device-instance object-type object-instance property [index]

$ demo/writeprop/bacwp
- bacwp device-instance object-type object-instance property tag value [priority] [index]
+ bacwp device-instance object-type object-instance property priority index tag value [tag value...]

$ demo/readfile/bacarf
bacarf device-instance file-instance local-name
@@ -185,10 +192,18 @@
-

The demos can be compiled under Win32 using Borland C++ or - Microsoft Visual C++, both of which - are free (as in beer) command line compilers. Be sure to pick up the free - patches (service packs) for the Borland C++ compiler (SP1, SP2), as well as the free turbo debugger. It is also possible to create Win32 projects using the free Visual Studio Express Edition after downloading the platform development kit for your operating system. You can also use MinGW - Minimalist GNU for Windows which comes with Code::Blocks. I frequently use Code::Blocks for compiling the unit tests using the MinGW compiler and created some Code::Block projects for some of the demos. I have also used Code::Blocks with the Borland C++ compiler and it successfully compiles and runs the code.

+

The demos can be compiled under Win32 using MinGW - Minimalist GNU for Windows, + Borland C++, or + Microsoft Visual C++, which + are free command line compilers. Be sure to pick up the free + patches (service packs) for the Borland C++ compiler + (SP1, SP2), as well as the free turbo debugger. It is also possible to create Win32 projects using the free Visual Studio Express Edition after downloading the platform development kit for your operating system. + You can also use MinGW - Minimalist GNU for Windows which comes with Code::Blocks. + I frequently use Code::Blocks for + compiling the unit tests using the MinGW compiler and + created some Code::Block projects for some of the demos. + I have also used Code::Blocks with + the Borland C++ compiler and it successfully compiles and runs the code.

There is a Makefile in the ports/rtos32 directory, and a sample application that runs under RTOS-32. @@ -211,14 +226,12 @@ The datalink layer uses BACnet MS/TP and the example uses several different objects and services.

- @@ -419,11 +432,11 @@

BACnet Objects

-

The BACnet stack currently implements a Device Object, and +

The BACnet stack currently implements an example Device Object, and handles all of the ReadProperty 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. There is built in handling for + services not currently supported. There is built-in handling for DeviceCommunicationControl.

The example handlers interact with example objects, including @@ -450,8 +463,9 @@ the BACnet Source Forge Project Page

There is documentation that describes the mechanisms in the BACnet Stack. - I wrote up some answers to some frequently asked questions. Of course, - there are a handful of text files in the doc directory of the project.

+ I wrote up some answers to some frequently asked questions. +Of course, there are a handful of text files in the doc directory of +the project.

BACnet @@ -471,7 +485,7 @@

svn co https://bacnet.svn.sourceforge.net/svnroot/bacnet/trunk/bacnet-stack/
or for the stable releases:
- svn co https://bacnet.svn.sourceforge.net/svnroot/bacnet/tags/bacnet-stack-0-3-3/ + svn co https://bacnet.svn.sourceforge.net/svnroot/bacnet/tags/bacnet-stack-0-4-4/

BACnet Developer Resources

@@ -531,6 +545,6 @@ access layer. BACnetSim is a fork of bacnet-stack-0.0.1

BACnet® are registered trademarks of the American Society of Heating, Refrigerating and Air-Conditioning Engineers, Inc., 1791 Tullie Circle NE, Atlanta, GA 30329.

-

Website updated 27-Jan-2008 by Steve Karg.

+

Website updated 17-May-2008 by Steve Karg.

diff --git a/bacnet-stack/doc/man/bacwi.1 b/bacnet-stack/doc/man/bacwi.1 new file mode 100644 index 00000000..ae167399 --- /dev/null +++ b/bacnet-stack/doc/man/bacwi.1 @@ -0,0 +1,103 @@ +.\" Process this file with +.\" groff -man -Tascii bacwi.1 +.\" Contact 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 +.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) \ No newline at end of file diff --git a/bacnet-stack/include/version.h b/bacnet-stack/include/version.h index d1bbe305..fc82074a 100644 --- a/bacnet-stack/include/version.h +++ b/bacnet-stack/include/version.h @@ -39,8 +39,8 @@ #define BACNET_VERSION(x,y,z) (((x)<<16)+((y)<<8)+(z)) #endif -#define BACNET_VERSION_TEXT "0.4.4" -#define BACNET_VERSION_CODE BACNET_VERSION(0,4,4) +#define BACNET_VERSION_TEXT "0.4.5" +#define BACNET_VERSION_CODE BACNET_VERSION(0,4,5) #define BACNET_VERSION_MAJOR ((BACNET_VERSION_CODE>>16)&0xFF) #define BACNET_VERSION_MINOR ((BACNET_VERSION_CODE>>8)&0xFF) #define BACNET_VERSION_MAINTENANCE (BACNET_VERSION_CODE&0xFF)