Shell Programming to Implement multiple attributes of a BACnet Device

Source: Internet
Author: User

#! /Bin/bash

Prog = 'basename $0'
Optional = 0

Usage ()
{
Echo "Usage: $ prog [Options] <bacnetid> [<bacnetid>...]

Will return required and optional property values
From the requested device.

-O display optional properties [default behavior]
-O supress display of optional Properties
-H display this help
"
}

// Obtain Command Line Parameter options

While getopts ": Oh" opt; do
Case $ opt in
O) Optional = 1
;;
O) Optional = 0
;;
H) Usage
Exit 1
;;
\? ) Usage
Exit 1
Esac
Done
Shift $ ($ optind-1 ))

// Handle errors

If [$ #-EQ 0] | ["$1" = "]; then
Usage
Exit
Fi

Run_test ()
{
Echo-e "test: Read required properties of device object $1 \ r"
Echo-n "object identifier :"
./Bacrp $1 8 $1 75
Echo-n "Object Name :"
./Bacrp $1 8 $1 77
Echo-n "Object Type :"
./Bacrp $1 8 $1 79
Echo-n "system status :"
./Bacrp $1 8 $1 112
Echo-n "vendor name :"
./Bacrp $1 8 $1 121
Echo-n "vendor identifier :"
./Bacrp $1 8 $1 120
Echo-n "model name :"
./Bacrp $1 8 $1 70
Echo-n "firmware revision :"
./Bacrp $1 8 $1 44
Echo-n "Application Software Version :"
./Bacrp $1 8 $1 12
Echo-n "Protocol Version :"
./Bacrp $1 8 $1 98
Echo-n "Protocol revision :"
./Bacrp $1 8 $1 139
Echo-n "protocol services supported :"
./Bacrp $1 8 $1 97
Echo-n "object types supported :"
./Bacrp $1 8 $1 96
Echo-n "Object List length :"
./Bacrp $1 8 $1 76 0
Echo-n "Object List :"
./Bacrp $1 8 $1 76
Echo-n "Max APDU length accepted :"
./Bacrp $1 8 $1 62
Echo-n "segmentation supported :"
./Bacrp $1 8 $1 107
Echo-n "APDU Timeout :"
./Bacrp $1 8 $1 11
Echo-n "numger of APDU entries :"
./Bacrp $1 8 $1 73
Echo-n "device Address binding :"
./Bacrp $1 8 $1 30
Echo-n "database revision :"
./Bacrp $1 8 $1 155
If [$ optional-EQ 1]; then
Echo-e "test: Read optional properties of device object $1 \ r"
Echo-n "Location :"
./Bacrp $1 8 $1 58
Echo-n "Description :"
./Bacrp $1 8 $1 28
Echo-n "Max segments supported :"
./Bacrp $1 8 $1 167
Echo-n "VT classes supported :"
./Bacrp $1 8 $1 122
Echo-n "active VT sessions :"
./Bacrp $1 8 $1 5
Echo-n "local time :"
./Bacrp $1 8 $1 57
Echo-n "local date :"
./Bacrp $1 8 $1 56
Echo-n "UTC offset :"
./Bacrp $1 8 $1 119
Echo-n "Daylight Savings status :"
./Bacrp $1 8 $1 24
Echo-n "APDU segment Timeout :"
./Bacrp $1 8 $1 10
Echo-n "List of session keys :"
./Bacrp $1 8 $1 55
Echo-n "Time Synchronization recipients :"
./Bacrp $1 8 $1 116
Echo-n "Max master :"
./Bacrp $1 8 $1 64
Echo-n "Max info frames :"
./Bacrp $1 8 $1 63
Echo-n "Ack required :"
./Bacrp $1 8 $1 1
Echo-n "configuration files :"
./Bacrp $1 8 $1 154
Echo-n "last restore time :"
./Bacrp $1 8 $1 157
Echo-n "backup failure Timeout :"
./Bacrp $1 8 $1 153
Echo-n "active cov subscriptions :"
./Bacrp $1 8 $1 152
Echo-n "Slave proxy enable :"
./Bacrp $1 8 $1 172
Echo-n "manual slave Address binding :"
./Bacrp $1 8 $1 170
Echo-n "auto slave discovery :"
./Bacrp $1 8 $1 169
Echo-n "Slave Address binding :"
./Bacrp $1 8 $1 171
Echo-n "profile name :"
./Bacrp $1 8 $1 168
Fi
Echo-e "\ r"
}

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

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.