Updated documentation for WhoIs command line tool. Created a man page.

This commit is contained in:
skarg
2008-05-20 04:33:01 +00:00
parent 3728b74f85
commit dc5b3e63fe
6 changed files with 211 additions and 33 deletions
+41 -5
View File
@@ -1,5 +1,4 @@
/**************************************************************************
*
/*************************************************************************
* Copyright (C) 2006 Steve Karg <skarg@users.sourceforge.net>
*
* 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;
}
+27 -5
View File
@@ -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 */
+9 -6
View File
@@ -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;
+29 -15
View File
@@ -130,16 +130,23 @@
another project hosted on SourceForge, as well as various BACnet controllers,
BACnet workstations, and through BACnet routers.<p>
<p>Using a master Makefile in the project root directory, a dozen or so
<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 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. </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.</p>
<code>
$ make clean all<br>
$ demo/server/bacsrv 123<br>
@@ -149,7 +156,7 @@
bacrp device-instance object-type object-instance property [index]<br>
<br>
$ demo/writeprop/bacwp<br>
bacwp device-instance object-type object-instance property tag value [priority] [index]<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>
@@ -185,10 +192,18 @@
<br>
</code>
<p>The demos can be compiled under Win32 using <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. 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>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>There is a Makefile in the ports/rtos32 directory, and a sample
application that runs under <a href="http://www.on-time.com/">RTOS-32</a>.
@@ -211,14 +226,12 @@
The datalink layer uses BACnet MS/TP
and the example uses several different objects and services.</p>
<!--
<p>There is a project in the ports/atmega168 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.
The datalink layer uses BACnet MS/TP
and the example uses several different objects and services.</p>
-->
<TABLE border="1" width="100%" cellpadding="1" cellspacing="0"
summary="BACnet services supported matrix">
@@ -419,11 +432,11 @@
<h2>BACnet Objects</h2>
<p>The BACnet stack currently implements a Device Object, and
<p>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.</p>
<p>The example handlers interact with example objects, including
@@ -450,8 +463,9 @@
the <a href="http://sourceforge.net/projects/bacnet/">BACnet Source Forge Project Page</a></p>
<p>There is documentation that <a href="http://sourceforge.net/docman/display_doc.php?docid=33182&group_id=117598">describes the mechanisms in the BACnet Stack</a>.
I wrote up some <a href="http://sourceforge.net/docman/display_doc.php?docid=35583&group_id=117598">answers to some frequently asked questions</a>. Of course,
there are a handful of text files in the doc directory of the project.</p>
I wrote up some <a href="http://sourceforge.net/docman/display_doc.php?docid=35583&group_id=117598">answers to some frequently asked questions</a>.
Of course, there are a handful of text files in the doc directory of
the project.</p>
<p><a
href="http://sourceforge.net/project/showfiles.php?group_id=117598&package_id=140172">BACnet
@@ -471,7 +485,7 @@
<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-3-3/</code>
<code>svn co https://bacnet.svn.sourceforge.net/svnroot/bacnet/tags/bacnet-stack-0-4-4/</code>
</blockquote>
<h2>BACnet Developer Resources</h2>
@@ -531,6 +545,6 @@ access layer. BACnetSim is a fork of bacnet-stack-0.0.1</p>
<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 27-Jan-2008 by <a href="http://kargs.net/">Steve Karg</a>.</p>
<p>Website updated 17-May-2008 by <a href="http://steve.kargs.net/">Steve Karg</a>.</p>
</BODY>
</HTML>
+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)
+2 -2
View File
@@ -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)