Added ability to scan muiltiple Device IDs passed on the command line

Added -O parameter to supress optional property scan
This commit is contained in:
brayra
2009-07-16 19:04:07 +00:00
parent 6a811d32e1
commit fb1b2a9c90
+39 -7
View File
@@ -1,25 +1,43 @@
#!/bin/bash #!/bin/bash
PROG=`basename $0` PROG=`basename $0`
OPTIONAL=1
usage() usage()
{ {
echo "usage: $PROG <<BACnetID>> echo "usage: $PROG [OPTIONS] <<BACnetID>> [ <<BACnetID>> ... ]
Will return Required and Optional property values Will return Required and Optional property values
from the requested device. from the requested device.
-o Display optional properties [default behavior]
-O Supress display of optional properties
-h Display this help
" "
} }
while getopts ":oOh" opt; do
case $opt in
o ) OPTIONAL=1
;;
O ) OPTIONAL=0
;;
h ) usage
exit 1
;;
\? ) usage
exit 1
esac
done
shift $(($OPTIND -1))
if [ $# -eq 0 ] || [ "$1" = "" ] ; then if [ $# -eq 0 ] || [ "$1" = "" ] ; then
usage usage
exit exit
fi fi
if [ $(( $1 + 0 )) -eq 0 ] ; then
echo "ERROR: ID must be an integer!!" >&2
usage
exit
fi
run_test()
{
echo "Test: Read Required Properties of Device Object $1" echo "Test: Read Required Properties of Device Object $1"
echo -n "OBJECT IDENTIFIER:" echo -n "OBJECT IDENTIFIER:"
./bacrp $1 8 $1 75 ./bacrp $1 8 $1 75
@@ -63,7 +81,7 @@ echo -n "DEVICE ADDRESS BINDING:"
./bacrp $1 8 $1 30 ./bacrp $1 8 $1 30
echo -n "DATABASE REVISION:" echo -n "DATABASE REVISION:"
./bacrp $1 8 $1 155 ./bacrp $1 8 $1 155
echo "" if [ $OPTIONAL -eq 1 ] ; then
echo "Test: Read Optional Properties of Device Object $1" echo "Test: Read Optional Properties of Device Object $1"
echo -n "LOCATION:" echo -n "LOCATION:"
./bacrp $1 8 $1 58 ./bacrp $1 8 $1 58
@@ -113,3 +131,17 @@ echo -n "SLAVE ADDRESS BINDING:"
./bacrp $1 8 $1 171 ./bacrp $1 8 $1 171
echo -n "PROFILE NAME:" echo -n "PROFILE NAME:"
./bacrp $1 8 $1 168 ./bacrp $1 8 $1 168
fi
echo " "
}
while [ $# -gt 0 ] ; do
ID=$(( $1 + 0 ))
shift
if [ $ID -eq 0 ] ; then
echo "ERROR: Device ID must be an integer!! [ID=$ID]" >&2
fi
run_test $ID
done