def main(): # parse the command line arguments parser = ConfigArgumentParser(description=__doc__) # add an argument for interval parser.add_argument( 'interval', type=int, help='repeat rate in seconds', ) # now parse the arguments args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # make a device object this_device = LocalDeviceObject(ini=args.ini) if _debug: _log.debug(" - this_device: %r", this_device) # make a dog this_application = PrairieDog(args.interval, this_device, args.ini.address) if _debug: _log.debug(" - this_application: %r", this_application) _log.debug("running") run() _log.debug("fini")
def getData(collection): global this_application, device_address, object_identifier, property_list # 清空数组 global result, tag_list, tag_keys, count print collection result = [] tag_list = [] tag_keys = {} count = 0 parser = ConfigArgumentParser(description=__doc__) args = parser.parse_args() tag_list = collection["bacnet_items"] try: this_device = LocalDeviceObject(ini=args.ini) this_application = ReadPropertyApplication(this_device, args.ini.address) deferred(this_application.requests) run() this_application.close_socket() except Exception as e: print str(e) return {"data": "采集失败", "success": "false"} import datetime dt = datetime.datetime.now() timestamp = dt.strftime("%Y-%m-%d %H:%M:%S") for item in tag_keys: result.append({ "timestamp": timestamp, "value": None, "item": tag_keys[item]['tag'], "quality": "Error" }) return {"data": result, "success": "true"}
def main(): global args, this_application # parse the command line arguments parser = ConfigArgumentParser(description=__doc__) # add an option to override the interval time parser.add_argument( '--interval', type=float, help="amount of time between intervals", default=INTERVAL, ) # parse the command line arguments args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # make a device object this_device = LocalDeviceObject(ini=args.ini) if _debug: _log.debug(" - this_device: %r", this_device) # make a simple application this_application = ReadPointListApplication(this_device, args.ini.address) _log.debug("running") run() _log.debug("fini")
def main(): global this_application, context # parse the command line arguments parser = ConfigArgumentParser(description=__doc__) parser.add_argument( "address", help="address of server", ) parser.add_argument( "objtype", help="object type", ) parser.add_argument( "objinst", type=int, help="object instance", ) args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # set the context, the collection of the above parameters context = args.address, args.objtype, args.objinst if _debug: _log.debug(" - context: %r", context) # make a device object this_device = LocalDeviceObject( objectName=args.ini.objectname, objectIdentifier=int(args.ini.objectidentifier), maxApduLengthAccepted=int(args.ini.maxapdulengthaccepted), segmentationSupported=args.ini.segmentationsupported, vendorIdentifier=int(args.ini.vendoridentifier), ) # make a simple application this_application = BIPSimpleApplication(this_device, args.ini.address) # get the services supported services_supported = this_application.get_services_supported() if _debug: _log.debug(" - services_supported: %r", services_supported) # let the device object know this_device.protocolServicesSupported = services_supported.value # make a console this_console = ReadWritePropertyConsoleCmd() if _debug: _log.debug(" - this_console: %r", this_console) # enable sleeping will help with threads enable_sleeping() _log.debug("running") run() _log.debug("fini")
def main(): global test_av, test_bv, test_application # make a parser parser = ConfigArgumentParser(description=__doc__) # parse the command line arguments args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # make a device object this_device = LocalDeviceObject(ini=args.ini) if _debug: _log.debug(" - this_device: %r", this_device) # make a sample application test_application = SampleApplication(this_device, args.ini.address) # make an analog value object test_av = AnalogValueObject( objectIdentifier=("analogValue", 1), objectName="av", presentValue=0.0, statusFlags=[0, 0, 0, 0], covIncrement=1.0, ) _log.debug(" - test_av: %r", test_av) # add it to the device test_application.add_object(test_av) _log.debug(" - object list: %r", this_device.objectList) # make a binary value object test_bv = BinaryValueObject( objectIdentifier=("binaryValue", 1), objectName="bv", presentValue="inactive", statusFlags=[0, 0, 0, 0], ) _log.debug(" - test_bv: %r", test_bv) # add it to the device test_application.add_object(test_bv) # binary value task do_something_task = DoSomething(INTERVAL) do_something_task.install_task() _log.debug("running") run() _log.debug("fini")
def main(): global args # parse the command line arguments parser = ConfigArgumentParser(description=__doc__) # add an option to override the sleep time parser.add_argument( '--sleep', type=float, help="sleep before returning the value", default=SLEEP_TIME, ) # parse the command line arguments args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # make a device object this_device = LocalDeviceObject( objectName=args.ini.objectname, objectIdentifier=('device', int(args.ini.objectidentifier)), maxApduLengthAccepted=int(args.ini.maxapdulengthaccepted), segmentationSupported=args.ini.segmentationsupported, vendorIdentifier=int(args.ini.vendoridentifier), ) # make a sample application this_application = BIPSimpleApplication(this_device, args.ini.address) # get the services supported services_supported = this_application.get_services_supported() if _debug: _log.debug(" - services_supported: %r", services_supported) # let the device object know this_device.protocolServicesSupported = services_supported.value # make some random input objects for i in range(1, RANDOM_OBJECT_COUNT + 1): ravo = RandomAnalogValueObject( objectIdentifier=('analogValue', i), objectName='Random-%d' % (i, ), ) _log.debug(" - ravo: %r", ravo) this_application.add_object(ravo) # make sure they are all there _log.debug(" - object list: %r", this_device.objectList) _log.debug("running") run() _log.debug("fini")
def main(): global args, schedule_objects # parse the command line arguments parser = ConfigArgumentParser(description=__doc__) # parse the command line arguments args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # set up testing setup_module() # reset the time machine reset_time_machine(start_time="1970-01-01") # # Simple daily schedule (actually a weekly schedule with every day # being identical. # so = LocalScheduleObject( objectIdentifier=('schedule', 1), objectName='Schedule 1', presentValue=Integer(5), effectivePeriod=DateRange( startDate=(0, 1, 1, 1), endDate=(254, 12, 31, 2), ), weeklySchedule=ArrayOf(DailySchedule)([ DailySchedule(daySchedule=[ TimeValue(time=(8, 0, 0, 0), value=Integer(8)), TimeValue(time=(14, 0, 0, 0), value=Null()), TimeValue(time=(17, 0, 0, 0), value=Integer(42)), # TimeValue(time=(0,0,0,0), value=Null()), ]), ] * 7), scheduleDefault=Integer(0), ) _log.debug(" - so: %r", so) schedule_objects.append(so) print("{} @ {}".format(so.presentValue.value, Time().now())) for i in range(1, 25): hr = "{}:00:01".format(i) # let it run until just after midnight run_time_machine(stop_time=hr) print("{} @ {}".format(so.presentValue.value, Time().now())) # done testing teardown_module()
def main(): global args, this_application # parse the command line arguments parser = ConfigArgumentParser(description=__doc__) # add an argument for seconds per dog parser.add_argument("daddr", help="destination address") parser.add_argument("objid", help="object identifier") parser.add_argument("propid", help="property identifier") # list of values to write parser.add_argument("values", metavar="N", nargs="+", help="values to write") # add an argument for seconds between writes parser.add_argument("--delay", type=float, help="delay between writes in seconds", default=5.0) # now parse the arguments args = parser.parse_args() # convert the parameters args.daddr = Address(args.daddr) args.objid = ObjectIdentifier(args.objid).value args.propid = PropertyIdentifier(args.propid).value if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # make a device object this_device = LocalDeviceObject(ini=args.ini) if _debug: _log.debug(" - this_device: %r", this_device) # make a simple application this_application = BIPSimpleApplication(this_device, args.ini.address) # make a dog, task scheduling is in milliseconds dog = PrairieDog(args.delay * 1000) if _debug: _log.debug(" - dog: %r", dog) _log.debug("running") run() _log.debug("fini")
def main(): global this_application, device_address, object_identifier, property_list # parse the command line arguments parser = ConfigArgumentParser(description=__doc__) parser.add_argument( "address", help="device address", ) parser.add_argument( "objtype", help="object types, e.g., analogInput", ) parser.add_argument( "objinstance", type=int, help="object instance", ) args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # interpret the address device_address = Address(args.address) if _debug: _log.debug(" - device_address: %r", device_address) # build an identifier object_identifier = (args.objtype, args.objinstance) if _debug: _log.debug(" - object_identifier: %r", object_identifier) # get the object class object_class = get_object_class(args.objtype) if _debug: _log.debug(" - object_class: %r", object_class) # make a queue of the properties property_list = deque(prop.identifier for prop in object_class.properties) if _debug: _log.debug(" - property_list: %r", property_list) # make a device object this_device = LocalDeviceObject(ini=args.ini) if _debug: _log.debug(" - this_device: %r", this_device) # make a simple application this_application = ReadPropertyApplication(this_device, args.ini.address) # fire off a request when the core has a chance deferred(this_application.next_request) _log.debug("running") run() _log.debug("fini")
def main(): global this_device global this_application # parse the command line arguments parser = ConfigArgumentParser(description=__doc__) # add an argument for interval parser.add_argument( 'device_id', type=int, help='device identifier', ) # add an argument for interval parser.add_argument( 'device_addr', type=str, help='device address', ) # parse the args args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # make a device object this_device = LocalDeviceObject(ini=args.ini) if _debug: _log.debug(" - this_device: %r", this_device) # make a simple application this_application = ReadObjectListApplication(this_device, args.ini.address) # build a device object identifier device_id = ('device', args.device_id) # translate the address device_addr = Address(args.device_addr) # kick off the process after the core is up and running deferred(this_application.read_object_list, device_id, device_addr) _log.debug("running") run() _log.debug("fini")
def main(): global this_application, context # parse the command line arguments parser = ConfigArgumentParser(description=__doc__) parser.add_argument( "address", help="address of server", ) parser.add_argument( "objtype", help="object type", ) parser.add_argument( "objinst", type=int, help="object instance", ) args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # set the context, the collection of the above parameters context = args.address, args.objtype, args.objinst if _debug: _log.debug(" - context: %r", context) # make a device object this_device = LocalDeviceObject(ini=args.ini) if _debug: _log.debug(" - this_device: %r", this_device) # make a simple application this_application = BIPSimpleApplication(this_device, args.ini.address) # make a console this_console = ReadWritePropertyConsoleCmd() if _debug: _log.debug(" - this_console: %r", this_console) # enable sleeping will help with threads enable_sleeping() _log.debug("running") run() _log.debug("fini")
def setUp(self): global server, server_thread, this_application # parse the command line arguments parser = ConfigArgumentParser(description=__doc__) # add an option for the server host parser.add_argument("--host", type=str, help="server host", default=HOST) # add an option for the server port parser.add_argument("--port", type=int, help="server port", default=PORT) # Adding arguments to the argument parser config_path = "./bacnet_client.ini" args = parser.parse_args(['--ini', config_path]) # Make a HTTP Server server = ThreadedTCPServer((args.host, args.port), HTTPRequestHandler) # Start a thread with the server -- that thread will then start a thread for each request server_thread = threading.Thread(target=server.serve_forever) # exit the server thread when the main thread terminates server_thread.daemon = True # Exit when program terminates server_thread.start() print("HTTP Server Thread is Alive : ", server_thread.is_alive()) # Make a device object this_device = LocalDeviceObject(ini=args.ini) # Make a simple application this_application = BIPSimpleApplication(this_device, args.ini.address) BACnetHTTPServer.this_application = this_application # Start the BACnet application in a child thread # Child threads do not receive signals SIGTERM or SIGUSR1 bac_thread = threading.Thread(target=run) bac_thread.daemon = True # Exit when program terminates bac_thread.start() print("BACnet client Thread is Alive : ", bac_thread.is_alive()) return
def main(): global args, this_application # parse the command line arguments parser = ConfigArgumentParser(description=__doc__) # add an option to override the interval time parser.add_argument( '--interval', type=float, help="amount of time between intervals", default=INTERVAL, ) # parse the command line arguments args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # make a device object this_device = LocalDeviceObject( objectName=args.ini.objectname, objectIdentifier=int(args.ini.objectidentifier), maxApduLengthAccepted=int(args.ini.maxapdulengthaccepted), segmentationSupported=args.ini.segmentationsupported, vendorIdentifier=int(args.ini.vendoridentifier), ) # make a simple application this_application = ReadPointListApplication(this_device, args.ini.address) # get the services supported services_supported = this_application.get_services_supported() if _debug: _log.debug(" - services_supported: %r", services_supported) # let the device object know this_device.protocolServicesSupported = services_supported.value _log.debug("running") run() _log.debug("fini")
def main(): # parse the command line arguments parser = ConfigArgumentParser(description=__doc__) # add an argument for interval parser.add_argument( 'interval', type=int, help='repeat rate in seconds', ) # now parse the arguments args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # make a device object this_device = LocalDeviceObject( objectName=args.ini.objectname, objectIdentifier=int(args.ini.objectidentifier), maxApduLengthAccepted=int(args.ini.maxapdulengthaccepted), segmentationSupported=args.ini.segmentationsupported, vendorIdentifier=int(args.ini.vendoridentifier), ) # make a dog this_application = PrairieDog(args.interval, this_device, args.ini.address) if _debug: _log.debug(" - this_application: %r", this_application) # get the services supported services_supported = this_application.get_services_supported() if _debug: _log.debug(" - services_supported: %r", services_supported) # let the device object know this_device.protocolServicesSupported = services_supported.value _log.debug("running") run() _log.debug("fini")
def main(): global args parser = ConfigArgumentParser(description=__doc__) args = parser.parse_args() this_device = LocalDeviceObject(ini=args.ini) this_application = BIPSimpleApplication(this_device, args.ini.address) global realValue global booleanValue booleanValue = False realValue = int(input("Inserire un numero ")) analog = MyAnalogValueObject(objectIdentifier=('analogValue', 123), objectName='hea') averaging = MyAveragingObject(objectIdentifier=('averaging', 70), objectName='averagingTest') this_application.add_object(analog) this_application.add_object(averaging) run()
def main(): global this_application, device_address, object_identifier, property_list # parse the command line arguments parser = ConfigArgumentParser(description=__doc__) parser.add_argument( "address", help="device address", ) parser.add_argument( "objtype", help="object types, e.g., analogInput", ) parser.add_argument( "objinstance", type=int, help="object instance", ) args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # interpret the address device_address = Address(args.address) if _debug: _log.debug(" - device_address: %r", device_address) # build an identifier object_identifier = (args.objtype, args.objinstance) if _debug: _log.debug(" - object_identifier: %r", object_identifier) # get the object class object_class = get_object_class(args.objtype) if _debug: _log.debug(" - object_class: %r", object_class) # make a queue of the properties property_list = deque(prop.identifier for prop in object_class.properties) if _debug: _log.debug(" - property_list: %r", property_list) # make a device object this_device = LocalDeviceObject( objectName=args.ini.objectname, objectIdentifier=int(args.ini.objectidentifier), maxApduLengthAccepted=int(args.ini.maxapdulengthaccepted), segmentationSupported=args.ini.segmentationsupported, vendorIdentifier=int(args.ini.vendoridentifier), ) # make a simple application this_application = ReadPropertyApplication(this_device, args.ini.address) # get the services supported services_supported = this_application.get_services_supported() if _debug: _log.debug(" - services_supported: %r", services_supported) # let the device object know this_device.protocolServicesSupported = services_supported.value # fire off a request when the core has a chance deferred(this_application.next_request) _log.debug("running") run() _log.debug("fini")
def main(): global args, test_analog_value, test_schedule # parse the command line arguments parser = ConfigArgumentParser(description=__doc__) # parse the command line arguments args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # make a device object this_device = LocalDeviceObject(ini=args.ini) if _debug: _log.debug(" - this_device: %r", this_device) # make a sample application this_application = BIPSimpleApplication(this_device, args.ini.address) # create a writeable analog value object test_analog_value = WritableAnalogValueObject( objectIdentifier=("analogValue", 1), objectName="Test Analog Value", presentValue=0.0, ) _log.debug(" - test_analog_value: %r", test_analog_value) this_application.add_object(test_analog_value) # print when the value changes test_analog_value._property_monitors["presentValue"].append( analog_value_changed) # # Simple daily schedule (actually a weekly schedule with every day # being identical. # test_schedule = LocalScheduleObject( objectIdentifier=("schedule", 1), objectName="Test Schedule", presentValue=Real(8.0), effectivePeriod=DateRange(startDate=(0, 1, 1, 1), endDate=(254, 12, 31, 2)), weeklySchedule=ArrayOf(DailySchedule, 7)([ DailySchedule(daySchedule=[ TimeValue(time=(8, 0, 0, 0), value=Real(8.0)), TimeValue(time=(14, 0, 0, 0), value=Null()), TimeValue(time=(17, 0, 0, 0), value=Real(42.0)), ]) ] * 7), listOfObjectPropertyReferences=ListOf(DeviceObjectPropertyReference)([ DeviceObjectPropertyReference( objectIdentifier=("analogValue", 1), propertyIdentifier="presentValue", ) ]), scheduleDefault=Real(0.0), ) _log.debug(" - test_schedule: %r", test_schedule) this_application.add_object(test_schedule) TestConsoleCmd() _log.debug("running") run() _log.debug("fini")
def main(): global args, this_device, this_application, snapshot # parse the command line arguments parser = ConfigArgumentParser(description=__doc__) # input file for exiting configuration parser.add_argument( "infile", default="-", help="input file", ) # output file for discovered configuration parser.add_argument( "outfile", nargs='?', default='-unspecified-', help="output file", ) args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # make a device object this_device = LocalDeviceObject(ini=args.ini) if _debug: _log.debug(" - this_device: %r", this_device) # make a simple application this_application = DiscoverApplication( this_device, args.ini.address, ) if _debug: _log.debug(" - this_application: %r", this_application) # make a snapshot 'database' snapshot = Snapshot() # read in an existing snapshot if args.infile != '-': snapshot.read_file(args.infile) # make a console this_console = DiscoverConsoleCmd() _log.debug(" - this_console: %r", this_console) # enable sleeping will help with threads enable_sleeping() _log.debug("running") run() _log.debug("fini") # write out the snapshot, outfile defaults to infile if not specified if args.outfile == '-unspecified-': args.outfile = args.infile if args.outfile != '-': snapshot.write_file(args.outfile)
def main(): global args, this_device, this_application # build a parser, add some options parser = ConfigArgumentParser(description=__doc__) parser.add_argument( '--lan', type=str, default=bacpypes_mqtt.default_lan_name, help='lan name', ) parser.add_argument( '--host', type=str, default=bacpypes_mqtt.default_broker_host, help='broker host address', ) parser.add_argument( '--port', type=int, default=bacpypes_mqtt.default_broker_port, help='broker port', ) parser.add_argument( '--keepalive', type=int, default=bacpypes_mqtt.default_broker_keepalive, help= "maximum period in seconds allowed between communications with the broker", ) # parse the command line arguments args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # make a device object this_device = LocalDeviceObject(ini=args.ini) if _debug: _log.debug(" - this_device: %r", this_device) # make a simple application this_application = MQTTApplication(this_device, args.lan, args.ini.address) # make a console this_console = ClientConsoleCmd() if _debug: _log.debug(" - this_console: %r", this_console) # enable sleeping will help with threads enable_sleeping() # start up the client this_application.mse.startup() _log.debug("running") run() # shutdown the client this_application.mse.shutdown() _log.debug("fini")
pass # # __main__ # try: # parse the command line arguments parser = ConfigArgumentParser(description=__doc__) # add an option for the server host parser.add_argument("--host", type=str, help="server host", default=HOST) # add an option for the server port parser.add_argument("--port", type=int, help="server port", default=PORT) args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # make a device object this_device = LocalDeviceObject(ini=args.ini) if _debug: _log.debug(" - this_device: %r", this_device) # make a simple application this_application = BIPSimpleApplication(this_device, args.ini.address) # local host, special port
def main(): global test_ai, test_application # make a parser parser = ConfigArgumentParser(description=__doc__) parser.add_argument( "--console", action="store_true", default=False, help="create a console", ) # analog value task and thread parser.add_argument( "--aitask", type=float, help="analog input recurring task", ) parser.add_argument( "--aithread", type=float, help="analog input thread", ) # analog value task and thread parser.add_argument( "--bvtask", type=float, help="binary value recurring task", ) parser.add_argument( "--bvthread", type=float, help="binary value thread", ) # provide a different spin value parser.add_argument( "--spin", type=float, help="spin time", default=1.0, ) # parse the command line arguments args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # make a device object this_device = LocalDeviceObject(ini=args.ini) if _debug: _log.debug(" - this_device: %r", this_device) # make a sample application test_application = SubscribeCOVApplication(this_device, args.ini.address) # make an analog value object test_ai = AnalogInputObject( objectIdentifier=("analogInput", 1), objectName="ai", presentValue=0.0, covIncrement=0.5, eventDetectionEnable=True, eventEnable=[1, 1, 1], ackedTransitions=[1, 1, 1], notifyType=1, reliability=1, outOfService=False, eventState=0, statusFlags=[0, 0, 0, 0], units=19, ) _log.debug(" - test_ai: %r", test_ai) # add it to the device test_application.add_object(test_ai) _log.debug(" - object list: %r", this_device.objectList) # make a console if args.console: test_console = COVConsoleCmd() _log.debug(" - test_console: %r", test_console) # enable sleeping will help with threads enable_sleeping() # analog input task if args.aitask: test_ai_task = TestAnalogInputTask(args.aitask) test_ai_task.install_task() # analog input thread if args.aithread: test_ai_thread = TestAnalogInputThread(args.aithread) deferred(test_ai_thread.start) _log.debug("running") run(args.spin) _log.debug("fini")
# # __main__ # try: # parse the command line arguments parser = ConfigArgumentParser(description=__doc__) # add an argument for seconds per dog parser.add_argument('seconds', metavar='N', type=int, nargs='+', help='number of seconds for each dog', ) # now parse the arguments args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # make some dogs for i, sec in enumerate(args.seconds): dog = PrairieDog(i, sec * 1000) if _debug: _log.debug(" - dog: %r", dog) _log.debug("running") run() except Exception, e: _log.exception("an error has occurred: %s", e)
def main(): global test_application # make a parser parser = ConfigArgumentParser(description=__doc__) parser.add_argument( "--console", action="store_true", default=False, help="create a console", ) # parse the command line arguments args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # make a device object test_device = LocalDeviceObject( objectName=args.ini.objectname, objectIdentifier=int(args.ini.objectidentifier), maxApduLengthAccepted=int(args.ini.maxapdulengthaccepted), segmentationSupported=args.ini.segmentationsupported, vendorIdentifier=int(args.ini.vendoridentifier), ) # make a sample application test_application = SubscribeCOVApplication(test_device, args.ini.address) # make a binary value object test_bv = BinaryValueObject( objectIdentifier=('binaryValue', 1), objectName='bv', presentValue='inactive', statusFlags=[0, 0, 0, 0], ) _log.debug(" - test_bv: %r", test_bv) # add it to the device test_application.add_object(test_bv) # make an analog value object test_av = AnalogValueObject( objectIdentifier=('analogValue', 1), objectName='av', presentValue=0.0, statusFlags=[0, 0, 0, 0], covIncrement=1.0, ) _log.debug(" - test_av: %r", test_av) # add it to the device test_application.add_object(test_av) _log.debug(" - object list: %r", test_device.objectList) # get the services supported services_supported = test_application.get_services_supported() if _debug: _log.debug(" - services_supported: %r", services_supported) # let the device object know test_device.protocolServicesSupported = services_supported.value # make a console if args.console: test_console = COVConsoleCmd() _log.debug(" - test_console: %r", test_console) # enable sleeping will help with threads enable_sleeping() _log.debug("running") run() _log.debug("fini")
def main(): global args, schedule_objects # parse the command line arguments parser = ConfigArgumentParser(description=__doc__) # parse the command line arguments args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # set up testing setup_module() # reset the time machine reset_time_machine(start_time="1970-01-01") # make a device object this_device = LocalDeviceObject( objectName=args.ini.objectname, objectIdentifier=('device', int(args.ini.objectidentifier)), maxApduLengthAccepted=int(args.ini.maxapdulengthaccepted), segmentationSupported=args.ini.segmentationsupported, vendorIdentifier=int(args.ini.vendoridentifier), ) # make a floating application, no network interface this_application = Application(this_device) # # Simple daily schedule (actually a weekly schedule with every day # being identical. # so = LocalScheduleObject( objectIdentifier=('schedule', 1), objectName='Schedule 1', presentValue=Real(-1.0), effectivePeriod=DateRange( startDate=(0, 1, 1, 1), endDate=(254, 12, 31, 2), ), weeklySchedule=ArrayOf(DailySchedule)([ DailySchedule( daySchedule=[ TimeValue(time=(8,0,0,0), value=Real(8)), TimeValue(time=(14,0,0,0), value=Null()), TimeValue(time=(17,0,0,0), value=Real(42)), # TimeValue(time=(0,0,0,0), value=Null()), ] ), ] * 7), listOfObjectPropertyReferences=[ DeviceObjectPropertyReference( objectIdentifier=('analogValue', 1), propertyIdentifier='presentValue', # propertyArrayIndex=5, # deviceIdentifier=('device', 999), ), ], priorityForWriting=7, scheduleDefault=Real(0.0), ) _log.debug(" - so: %r", so) this_application.add_object(so) # add an analog value object avo = WritableAnalogValueObject( objectIdentifier=('analogValue', 1), objectName='analog value 1', presentValue=0.0, ) _log.debug(" - avo: %r", avo) this_application.add_object(avo) print("{} @ {}".format(so.presentValue.value, Time().now())) for i in range(1, 25): hr = "{}:00:01".format(i) # let it run until just after midnight run_time_machine(stop_time=hr) print("{}, {} @ {}".format( so.presentValue.value, avo.presentValue, Time().now(), )) # done testing teardown_module()
def main(): global args, this_device, this_application # parse the command line arguments parser = ConfigArgumentParser( description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter, ) # add an argument for interval parser.add_argument('net1', type=int, help='network number of IPv4 network', ) # add an argument for interval parser.add_argument('net2', type=int, help='network number of VLAN network', ) # add an argument for interval parser.add_argument('addr2', type=str, help='address on the VLAN network', ) # now parse the arguments args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) local_network = args.net1 local_address = Address(args.ini.address) if _debug: _log.debug(" - local_network, local_address: %r, %r", local_network, local_address) vlan_network = args.net2 vlan_address = Address(args.addr2) if _debug: _log.debug(" - vlan_network, vlan_address: %r, %r", vlan_network, vlan_address) # create the VLAN router, bind it to the local network router = VLANRouter(local_address, local_network) # create a VLAN vlan = Network(broadcast_address=LocalBroadcast()) # create a node for the router, address 1 on the VLAN router_node = Node(Address(1)) vlan.add_node(router_node) # bind the router stack to the vlan network through this node router.nsap.bind(router_node, vlan_network) # send network topology deferred(router.nse.i_am_router_to_network) # make a vlan device object this_device = \ LocalDeviceObject( objectName=args.ini.objectname, objectIdentifier=("device", int(args.ini.objectidentifier)), maxApduLengthAccepted=1024, segmentationSupported='noSegmentation', vendorIdentifier=15, ) _log.debug(" - this_device: %r", this_device) # make the application, add it to the network this_application = VLANApplication(this_device, vlan_address) vlan.add_node(this_application.vlan_node) _log.debug(" - this_application: %r", this_application) # make a console this_console = WhoIsIAmConsoleCmd() if _debug: _log.debug(" - this_console: %r", this_console) _log.debug("running") run() _log.debug("fini")
try: # parse the command line arguments arg_parser = ConfigArgumentParser(description=__doc__) arg_parser.add_argument("--address", help="Target only device(s) at <address> for request" ) arg_parser.add_argument("--range", type=int, nargs=2, metavar=('LOW', 'HIGH'), help="Lower and upper limit on device ID in results" ) arg_parser.add_argument("--timeout", type=int, metavar=('SECONDS'), help="Time, in seconds, to wait for responses. Default: %(default)s", default = 5) args = arg_parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # make a device object this_device = LocalDeviceObject( objectName=args.ini.objectname, objectIdentifier=int(args.ini.objectidentifier), maxApduLengthAccepted=int(args.ini.maxapdulengthaccepted), segmentationSupported=args.ini.segmentationsupported, vendorIdentifier=int(args.ini.vendoridentifier), ) # build a bit string that knows about the bit names pss = ServicesSupported()
def main(): global test_application # make a parser parser = ConfigArgumentParser(description=__doc__) parser.add_argument("--console", action="store_true", default=False, help="create a console", ) # parse the command line arguments args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # make a device object test_device = LocalDeviceObject( objectName=args.ini.objectname, objectIdentifier=int(args.ini.objectidentifier), maxApduLengthAccepted=int(args.ini.maxapdulengthaccepted), segmentationSupported=args.ini.segmentationsupported, vendorIdentifier=int(args.ini.vendoridentifier), ) # make a sample application test_application = SubscribeCOVApplication(test_device, args.ini.address) # make a binary value object test_bv = BinaryValueObject( objectIdentifier=('binaryValue', 1), objectName='bv', presentValue='inactive', statusFlags=[0, 0, 0, 0], ) _log.debug(" - test_bv: %r", test_bv) # add it to the device test_application.add_object(test_bv) # make an analog value object test_av = AnalogValueObject( objectIdentifier=('analogValue', 1), objectName='av', presentValue=0.0, statusFlags=[0, 0, 0, 0], covIncrement=1.0, ) _log.debug(" - test_av: %r", test_av) # add it to the device test_application.add_object(test_av) _log.debug(" - object list: %r", test_device.objectList) # get the services supported services_supported = test_application.get_services_supported() if _debug: _log.debug(" - services_supported: %r", services_supported) # let the device object know test_device.protocolServicesSupported = services_supported.value # make a console if args.console: test_console = COVConsoleCmd() _log.debug(" - test_console: %r", test_console) # enable sleeping will help with threads enable_sleeping() _log.debug("running") run() _log.debug("fini")
def main(): # parse the command line arguments arg_parser = ConfigArgumentParser(description=__doc__) arg_parser.add_argument("device_id", type=int, help="Device ID of the target device" ) arg_parser.add_argument("--address", help="Address of target device, may be needed to help route initial request to device." ) arg_parser.add_argument("--registry-out-file", type=argparse.FileType('wb'), help="Output registry to CSV file", default=sys.stdout ) arg_parser.add_argument("--driver-out-file", type=argparse.FileType('wb'), help="Output driver configuration to JSON file.", default=sys.stdout) arg_parser.add_argument("--max-range-report", nargs='?', type=float, help='Affects how very large numbers are reported in the "Unit Details" column of the output. ' 'Does not affect driver behavior.', default=1.0e+20 ) args = arg_parser.parse_args() _log.debug("initialization") _log.debug(" - args: %r", args) # make a device object this_device = LocalDeviceObject( objectName=args.ini.objectname, objectIdentifier=int(args.ini.objectidentifier), maxApduLengthAccepted=int(args.ini.maxapdulengthaccepted), segmentationSupported=args.ini.segmentationsupported, vendorIdentifier=int(args.ini.vendoridentifier), ) # make a simple application this_application = SynchronousApplication(this_device, args.ini.address) _log.debug("starting build") result = get_iam(this_application, args.device_id, args.address) # request = WhoIsRequest() # request.pduDestination = target_address # result = this_application.make_request(request, expect_confirmation = False) # if not isinstance(result, IAmRequest): # result.debug_contents() # raise TypeError("Error making WhoIs request, try running again.") # device_type, device_instance = result.iAmDeviceIdentifier # if device_type != 'device': # raise DecodingError("invalid object type") target_address = result.pduSource device_id = result.iAmDeviceIdentifier[1] _log.debug('pduSource = ' + repr(result.pduSource)) _log.debug('iAmDeviceIdentifier = ' + str(result.iAmDeviceIdentifier)) _log.debug('maxAPDULengthAccepted = ' + str(result.maxAPDULengthAccepted)) _log.debug('segmentationSupported = ' + str(result.segmentationSupported)) _log.debug('vendorID = ' + str(result.vendorID)) config_file_name = basename(args.registry_out_file.name) config = { "driver_config":{"device_address":str(target_address), "device_id": device_id}, "driver_type":"bacnet", "registry_config":"config://registry_configs/{}".format(config_file_name) } json.dump(config, args.driver_out_file,indent=4) try: device_name = read_prop(this_application, target_address, "device", device_id, "objectName") _log.debug('device_name = ' + str(device_name)) except TypeError: _log.debug('device missing objectName') try: device_description = read_prop(this_application, target_address, "device", device_id, "description") _log.debug('description = ' + str(device_description)) except TypeError: _log.debug('device missing description') config_writer = DictWriter(args.registry_out_file, ('Reference Point Name', 'Volttron Point Name', 'Units', 'Unit Details', 'BACnet Object Type', 'Property', 'Writable', 'Index', 'Write Priority', 'Notes')) config_writer.writeheader() try: objectCount = read_prop(this_application, target_address, "device", device_id, "objectList", index=0) list_property = "objectList" except TypeError: objectCount = read_prop(this_application, target_address, "device", device_id, "structuredObjectList", index=0) list_property = "structuredObjectList" _log.debug('objectCount = ' + str(objectCount)) for object_index in xrange(1,objectCount+1): _log.debug('object_device_index = ' + repr(object_index)) bac_object = read_prop(this_application, target_address, "device", device_id, list_property, index=object_index) obj_type, index = bac_object try: process_object(this_application, target_address, obj_type, index, args.max_range_report, config_writer) except: _log.debug("Unexpected error processing object: {} {}".format(obj_type, index)) _log.debug(traceback.format_exc())
def main(): global args, this_application # parse the command line arguments parser = ConfigArgumentParser(description=__doc__) parser.add_argument( "host", nargs='?', help="listening address of server or 'any' (default %r)" % (SERVER_HOST,), default=SERVER_HOST, ) parser.add_argument( "port", nargs='?', type=int, help="server port (default %r)" % (SERVER_PORT,), default=SERVER_PORT, ) parser.add_argument( "--idle-timeout", nargs='?', type=int, help="idle connection timeout", default=IDLE_TIMEOUT, ) parser.add_argument( "--hello", action="store_true", default=False, help="send a hello message to a client when it connects", ) args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # make a device object this_device = LocalDeviceObject(ini=args.ini) if _debug: _log.debug(" - this_device: %r", this_device) # make a simple application this_application = BIPSimpleApplication(this_device, args.ini.address) # extract the server address and port host = args.host if host == "any": host = '' server_address = (host, args.port) if _debug: _log.debug(" - server_address: %r", server_address) # create a director listening to the address this_director = TCPServerDirector(server_address, idle_timeout=args.idle_timeout) if _debug: _log.debug(" - this_director: %r", this_director) # create a client write_property_client = WritePropertyClient() if _debug: _log.debug(" - write_property_client: %r", write_property_client) # bind everything together bind(write_property_client, this_director) bind(WritePropertyASE(), this_director) _log.debug("running") run() _log.debug("fini")
def main(): global test_av, test_bv, test_application # make a parser parser = ConfigArgumentParser(description=__doc__) parser.add_argument( "--console", action="store_true", default=False, help="create a console", ) # analog value task and thread parser.add_argument( "--avtask", type=float, help="analog value recurring task", ) parser.add_argument( "--avthread", type=float, help="analog value thread", ) # analog value task and thread parser.add_argument( "--bvtask", type=float, help="binary value recurring task", ) parser.add_argument( "--bvthread", type=float, help="binary value thread", ) # provide a different spin value parser.add_argument( "--spin", type=float, help="spin time", default=1.0, ) # parse the command line arguments args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # make a device object this_device = LocalDeviceObject(ini=args.ini) if _debug: _log.debug(" - this_device: %r", this_device) # make a sample application test_application = SubscribeCOVApplication(this_device, args.ini.address) # make an analog value object test_av = WritableAnalogValueObject( objectIdentifier=("analogValue", 1), objectName="av", presentValue=0.0, statusFlags=[0, 0, 0, 0], covIncrement=1.0, ) _log.debug(" - test_av: %r", test_av) # add it to the device test_application.add_object(test_av) _log.debug(" - object list: %r", this_device.objectList) # make a binary value object test_bv = BinaryValueObject( objectIdentifier=("binaryValue", 1), objectName="bv", presentValue="inactive", statusFlags=[0, 0, 0, 0], ) _log.debug(" - test_bv: %r", test_bv) # add it to the device test_application.add_object(test_bv) # make a console if args.console: test_console = COVConsoleCmd() _log.debug(" - test_console: %r", test_console) # enable sleeping will help with threads enable_sleeping() # analog value task if args.avtask: test_av_task = TestAnalogValueTask(args.avtask) test_av_task.install_task() # analog value thread if args.avthread: test_av_thread = TestAnalogValueThread(args.avthread) deferred(test_av_thread.start) # binary value task if args.bvtask: test_bv_task = TestBinaryValueTask(args.bvtask) test_bv_task.install_task() # binary value thread if args.bvthread: test_bv_thread = TestBinaryValueThread(args.bvthread) deferred(test_bv_thread.start) _log.debug("running") run(args.spin) _log.debug("fini")
def main(): global args, schedule_objects # parse the command line arguments parser = ConfigArgumentParser(description=__doc__) # parse the command line arguments args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # make a device object this_device = LocalDeviceObject(ini=args.ini) if _debug: _log.debug(" - this_device: %r", this_device) # make a sample application this_application = BIPSimpleApplication(this_device, args.ini.address) # # Simple daily schedule (actually a weekly schedule with every day # being identical. # so = LocalScheduleObject( objectIdentifier=('schedule', 1), objectName='Schedule 1', presentValue=Integer(8), effectivePeriod=DateRange( startDate=(0, 1, 1, 1), endDate=(254, 12, 31, 2), ), weeklySchedule=ArrayOf(DailySchedule)([ DailySchedule(daySchedule=[ TimeValue(time=(8, 0, 0, 0), value=Integer(8)), TimeValue(time=(14, 0, 0, 0), value=Null()), TimeValue(time=(17, 0, 0, 0), value=Integer(42)), # TimeValue(time=(0,0,0,0), value=Null()), ]), ] * 7), scheduleDefault=Integer(0), ) _log.debug(" - so: %r", so) this_application.add_object(so) schedule_objects.append(so) # # A special schedule when the Year 2000 problem was supposed to collapse # systems, the panic clears ten minutes later when it didn't. # so = LocalScheduleObject( objectIdentifier=('schedule', 2), objectName='Schedule 2', presentValue=CharacterString(""), effectivePeriod=DateRange( startDate=(0, 1, 1, 1), endDate=(254, 12, 31, 2), ), exceptionSchedule=ArrayOf(SpecialEvent)([ SpecialEvent( period=SpecialEventPeriod(calendarEntry=CalendarEntry( date=Date("2000-01-01").value, ), ), listOfTimeValues=[ TimeValue(time=(0, 0, 0, 0), value=CharacterString("Panic!")), TimeValue(time=(0, 10, 0, 0), value=Null()), ], eventPriority=1, ), ]), scheduleDefault=CharacterString("Don't panic."), ) _log.debug(" - so: %r", so) this_application.add_object(so) schedule_objects.append(so) # # A special schedule to celebrate Friday. # so = LocalScheduleObject( objectIdentifier=('schedule', 3), objectName='Schedule 3', presentValue=CharacterString(""), effectivePeriod=DateRange( startDate=(0, 1, 1, 1), endDate=(254, 12, 31, 2), ), exceptionSchedule=ArrayOf(SpecialEvent)([ SpecialEvent( period=SpecialEventPeriod(calendarEntry=CalendarEntry( weekNDay=xtob("FF.FF.05"), ), ), listOfTimeValues=[ TimeValue(time=(0, 0, 0, 0), value=CharacterString("It's Friday!")), ], eventPriority=1, ), ]), scheduleDefault=CharacterString("Keep working."), ) _log.debug(" - so: %r", so) this_application.add_object(so) schedule_objects.append(so) # # A schedule object that refers to an AnalogValueObject in the test # device. # so = LocalScheduleObject( objectIdentifier=('schedule', 4), objectName='Schedule 4', presentValue=Real(73.5), effectivePeriod=DateRange( startDate=(0, 1, 1, 1), endDate=(254, 12, 31, 2), ), weeklySchedule=ArrayOf(DailySchedule)([ DailySchedule(daySchedule=[ TimeValue(time=(9, 0, 0, 0), value=Real(78.0)), TimeValue(time=(10, 0, 0, 0), value=Null()), ]), ] * 7), scheduleDefault=Real(72.0), listOfObjectPropertyReferences=SequenceOf( DeviceObjectPropertyReference)([ DeviceObjectPropertyReference( objectIdentifier=('analogValue', 1), propertyIdentifier='presentValue', ), ]), ) _log.debug(" - so: %r", so) this_application.add_object(so) schedule_objects.append(so) # # The beast # so = LocalScheduleObject( objectIdentifier=('schedule', 5), objectName='Schedule 5', presentValue=Integer(0), effectivePeriod=DateRange( startDate=(0, 1, 1, 1), endDate=(254, 12, 31, 2), ), exceptionSchedule=ArrayOf(SpecialEvent)([ SpecialEvent( period=SpecialEventPeriod(calendarEntry=CalendarEntry( weekNDay=xtob("FF.FF.FF"), ), ), listOfTimeValues=[ TimeValue(time=(5, 0, 0, 0), value=Integer(5)), TimeValue(time=(6, 0, 0, 0), value=Null()), ], eventPriority=1, ), SpecialEvent( period=SpecialEventPeriod(calendarEntry=CalendarEntry( weekNDay=xtob("FF.FF.FF"), ), ), listOfTimeValues=[ TimeValue(time=(4, 0, 0, 0), value=Integer(4)), TimeValue(time=(7, 0, 0, 0), value=Null()), ], eventPriority=2, ), SpecialEvent( period=SpecialEventPeriod(calendarEntry=CalendarEntry( weekNDay=xtob("FF.FF.FF"), ), ), listOfTimeValues=[ TimeValue(time=(3, 0, 0, 0), value=Integer(3)), TimeValue(time=(8, 0, 0, 0), value=Null()), ], eventPriority=3, ), SpecialEvent( period=SpecialEventPeriod(calendarEntry=CalendarEntry( weekNDay=xtob("FF.FF.FF"), ), ), listOfTimeValues=[ TimeValue(time=(2, 0, 0, 0), value=Integer(2)), TimeValue(time=(9, 0, 0, 0), value=Null()), ], eventPriority=4, ), SpecialEvent( period=SpecialEventPeriod(calendarEntry=CalendarEntry( weekNDay=xtob("FF.FF.FF"), ), ), listOfTimeValues=[ TimeValue(time=(1, 0, 0, 0), value=Integer(1)), ], eventPriority=5, ), ]), scheduleDefault=Integer(0), ) _log.debug(" - so: %r", so) this_application.add_object(so) schedule_objects.append(so) # list of time values for every five minutes ltv = [] for hr in range(24): for mn in range(0, 60, 5): ltv.append( TimeValue(time=(hr, mn, 0, 0), value=Integer(hr * 100 + mn))) so = LocalScheduleObject( objectIdentifier=('schedule', 6), objectName='Schedule 6', presentValue=Integer(0), effectivePeriod=DateRange( startDate=(0, 1, 1, 1), endDate=(254, 12, 31, 2), ), exceptionSchedule=ArrayOf(SpecialEvent)([ SpecialEvent( period=SpecialEventPeriod(calendarEntry=CalendarEntry( weekNDay=xtob("FF.FF.FF"), ), ), listOfTimeValues=ltv, eventPriority=1, ), ]), scheduleDefault=Integer(0), ) _log.debug(" - so: %r", so) this_application.add_object(so) schedule_objects.append(so) # make sure they are all there _log.debug(" - object list: %r", this_device.objectList) TestConsoleCmd() _log.debug("running") run() _log.debug("fini")
try: # parse the command line arguments arg_parser = ConfigArgumentParser(description=__doc__) arg_parser.add_argument("address", help="Address of target device" ) arg_parser.add_argument("out_file", nargs='?', type=argparse.FileType('wb'), help="Optional output file for configuration", default=sys.stdout ) arg_parser.add_argument("--max_range_report", nargs='?', type=float, help='Affects how very large numbers are reported in the "Unit Details" column of the output. ' 'Does not affect sMap driver behavior.', default=1.0e+20 ) args = arg_parser.parse_args() _log.debug("initialization") _log.debug(" - args: %r", args) # make a device object this_device = LocalDeviceObject( objectName=args.ini.objectname, objectIdentifier=int(args.ini.objectidentifier), maxApduLengthAccepted=int(args.ini.maxapdulengthaccepted), segmentationSupported=args.ini.segmentationsupported, vendorIdentifier=int(args.ini.vendoridentifier), ) # make a simple application
def main(): # parse the command line arguments arg_parser = ConfigArgumentParser(description=__doc__) arg_parser.add_argument("device_id", type=int, help="Device ID of the target device") arg_parser.add_argument( "--address", help= "Address of target device, may be needed to help route initial request to device." ) arg_parser.add_argument("--out-file", type=argparse.FileType('wb'), help="Optional output file for configuration", default=sys.stdout) arg_parser.add_argument( "--max_range_report", nargs='?', type=float, help= 'Affects how very large numbers are reported in the "Unit Details" column of the output. ' 'Does not affect driver behavior.', default=1.0e+20) args = arg_parser.parse_args() _log.debug("initialization") _log.debug(" - args: %r", args) ips = getIPs() print "found local ip as ", ips device_address = ips[0] + "/24" # make a device object this_device = LocalDeviceObject( objectName="BEMOSS", objectIdentifier=int(599), maxApduLengthAccepted=int(1024), segmentationSupported=args.ini.segmentationsupported, vendorIdentifier=int(args.ini.vendoridentifier), ) # make a simple application this_application = SynchronousApplication(this_device, device_address) _log.debug("starting build") result = get_iam(this_application, args.device_id, args.address) target_address = result.pduSource _log.debug('pduSource = ' + repr(result.pduSource)) _log.debug('iAmDeviceIdentifier = ' + str(result.iAmDeviceIdentifier)) _log.debug('maxAPDULengthAccepted = ' + str(result.maxAPDULengthAccepted)) _log.debug('segmentationSupported = ' + str(result.segmentationSupported)) _log.debug('vendorID = ' + str(result.vendorID)) device_id = result.iAmDeviceIdentifier[1] try: device_name = read_prop(this_application, target_address, "device", device_id, "objectName") _log.debug('device_name = ' + str(device_name)) except TypeError: _log.debug('device missing objectName') try: device_description = read_prop(this_application, target_address, "device", device_id, "description") _log.debug('description = ' + str(device_description)) except TypeError: _log.debug('device missing description') config_writer = DictWriter( args.out_file, ('Reference Point Name', 'Volttron Point Name', 'Units', 'Unit Details', 'BACnet Object Type', 'Property', 'Writable', 'Index', 'Write Priority', 'Notes')) config_writer.writeheader() try: objectCount = read_prop(this_application, target_address, "device", device_id, "objectList", index=0) list_property = "objectList" except TypeError: objectCount = read_prop(this_application, target_address, "device", device_id, "structuredObjectList", index=0) list_property = "structuredObjectList" _log.debug('objectCount = ' + str(objectCount)) for object_index in xrange(1, objectCount + 1): _log.debug('object_device_index = ' + repr(object_index)) bac_object = read_prop(this_application, target_address, "device", device_id, list_property, index=object_index) obj_type, index = bac_object print object_index print print process_object(this_application, target_address, obj_type, index, args.max_range_report, config_writer)