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;