当前位置: 首页>>代码示例>>Python>>正文


Python ReadPropertyRequest.pduDestination方法代码示例

本文整理汇总了Python中bacpypes.apdu.ReadPropertyRequest.pduDestination方法的典型用法代码示例。如果您正苦于以下问题:Python ReadPropertyRequest.pduDestination方法的具体用法?Python ReadPropertyRequest.pduDestination怎么用?Python ReadPropertyRequest.pduDestination使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在bacpypes.apdu.ReadPropertyRequest的用法示例。


在下文中一共展示了ReadPropertyRequest.pduDestination方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: do_read

# 需要导入模块: from bacpypes.apdu import ReadPropertyRequest [as 别名]
# 或者: from bacpypes.apdu.ReadPropertyRequest import pduDestination [as 别名]
    def do_read(self, args):
        """read <addr> <type> <inst> <prop> [ <indx> ]"""
        args = args.split()
        if _debug: ReadWritePropertyConsoleCmd._debug("do_read %r", args)

        try:
            addr, obj_type, obj_inst, prop_id = args[:4]

            if obj_type.isdigit():
                obj_type = int(obj_type)
            elif not get_object_class(obj_type):
                raise ValueError, "unknown object type"

            obj_inst = int(obj_inst)

            datatype = get_datatype(obj_type, prop_id)
            if not datatype:
                raise ValueError, "invalid property for object type"

            # build a request
            request = ReadPropertyRequest(
                objectIdentifier=(obj_type, obj_inst),
                propertyIdentifier=prop_id,
                )
            request.pduDestination = Address(addr)

            if len(args) == 5:
                request.propertyArrayIndex = int(args[4])
            if _debug: ReadWritePropertyConsoleCmd._debug("    - request: %r", request)

            # give it to the application
            this_application.request(request)

        except Exception, e:
            ReadWritePropertyConsoleCmd._exception("exception: %r", e)
开发者ID:matthewhelt,项目名称:bacpypes,代码行数:37,代码来源:ReadWriteProperty.py

示例2: build_rp_request

# 需要导入模块: from bacpypes.apdu import ReadPropertyRequest [as 别名]
# 或者: from bacpypes.apdu.ReadPropertyRequest import pduDestination [as 别名]
    def build_rp_request(self, args, arr_index=None, vendor_id=0, bacoid=None):
        addr, obj_type, obj_inst, prop_id = args[:4]
        vendor_id = vendor_id
        bacoid = bacoid

        if obj_type.isdigit():
            obj_type = int(obj_type)
        elif not get_object_class(obj_type):
            raise ValueError("unknown object type")

        obj_inst = int(obj_inst)

        if prop_id.isdigit():
            prop_id = int(prop_id)
        datatype = get_datatype(obj_type, prop_id, vendor_id=vendor_id)
        if not datatype:
            raise ValueError("invalid property for object type")

        # build a request
        request = ReadPropertyRequest(
            objectIdentifier=(obj_type, obj_inst),
            propertyIdentifier=prop_id,
            propertyArrayIndex=arr_index,
        )
        request.pduDestination = Address(addr)

        if len(args) == 5:
            request.propertyArrayIndex = int(args[4])
        self._log.debug("{:<20} {!r}".format("REQUEST", request))
        return request
开发者ID:ChristianTremblay,项目名称:BAC0,代码行数:32,代码来源:Read.py

示例3: build_rp_request

# 需要导入模块: from bacpypes.apdu import ReadPropertyRequest [as 别名]
# 或者: from bacpypes.apdu.ReadPropertyRequest import pduDestination [as 别名]
    def build_rp_request(self, args, arr_index = None):
        addr, obj_type, obj_inst, prop_id = args[:4]

        if obj_type.isdigit():
            obj_type = int(obj_type)
        elif not get_object_class(obj_type):
            raise ValueError("unknown object type")

        obj_inst = int(obj_inst)

        datatype = get_datatype(obj_type, prop_id)
        if not datatype:
            raise ValueError("invalid property for object type")

        # build a request
        request = ReadPropertyRequest(
            objectIdentifier=(obj_type, obj_inst),
            propertyIdentifier=prop_id,
            propertyArrayIndex=arr_index,
        )
        request.pduDestination = Address(addr)

        if len(args) == 5:
            request.propertyArrayIndex = int(args[4])
        log_debug(ReadProperty, "    - request: %r", request)

        return request              
开发者ID:duck-hunt,项目名称:BAC0,代码行数:29,代码来源:Read.py

示例4: do_read

# 需要导入模块: from bacpypes.apdu import ReadPropertyRequest [as 别名]
# 或者: from bacpypes.apdu.ReadPropertyRequest import pduDestination [as 别名]
    def do_read(self):
        try:
            # query the present value of 'MLNTZ.PNL.J.DEMAND'
            obj_type = datapoints[point_count]['obj_type']
            obj_inst = datapoints[point_count]['obj_inst']
            prop_id =  datapoints[point_count]['prop_id']
            
            if not get_object_class(obj_type):
                raise ValueError, "unknown object type: " + obj_type

            datatype = get_datatype(obj_type, prop_id)
            if not datatype:
                raise ValueError, "invalid property for object type: " + prop_id

            # build a request
            request = ReadPropertyRequest(
                objectIdentifier=(obj_type, obj_inst),
                propertyIdentifier=prop_id,
                )
            request.pduDestination = Address(self.foreign_addr)

            # give it to the application
            self.app.request(request)

        except Exception, e:
            _log.exception("exception: %r", e)
开发者ID:wentaoshang,项目名称:ndn-sensor,代码行数:28,代码来源:publish_bacnet.py

示例5: next_request

# 需要导入模块: from bacpypes.apdu import ReadPropertyRequest [as 别名]
# 或者: from bacpypes.apdu.ReadPropertyRequest import pduDestination [as 别名]
    def next_request(self):
        if _debug: ReadPointListApplication._debug("next_request")

        # check to see if we're done
        if not self.point_queue:
            if _debug: ReadPointListApplication._debug("    - done")
            stop()
            return

        # get the next request
        addr, obj_type, obj_inst, prop_id = self.point_queue.popleft()

        # build a request
        request = ReadPropertyRequest(
            objectIdentifier=(obj_type, obj_inst),
            propertyIdentifier=prop_id,
            )
        request.pduDestination = Address(addr)
        if _debug: ReadPointListApplication._debug("    - request: %r", request)

        # make an IOCB
        iocb = IOCB(request)

        # set a callback for the response
        iocb.add_callback(self.complete_request)
        if _debug: ReadPointListApplication._debug("    - iocb: %r", iocb)

        # send the request
        this_application.request_io(iocb)
开发者ID:DemandLogic,项目名称:bacpypes,代码行数:31,代码来源:MultipleReadProperty.py

示例6: _do_read

# 需要导入模块: from bacpypes.apdu import ReadPropertyRequest [as 别名]
# 或者: from bacpypes.apdu.ReadPropertyRequest import pduDestination [as 别名]
	def _do_read(self, objtype, objinst, propname):

		try:
			addr, obj_type, obj_inst, prop_id = self._remote_addr, objtype, objinst, propname

			if obj_type.isdigit():
				obj_type = int(obj_type)
			elif not get_object_class(obj_type):
				raise ValueError, "unknown object type"

			obj_inst = int(obj_inst)

			datatype = get_datatype(obj_type, prop_id)
			if not datatype:
				raise ValueError, "invalid property for object type"

			# build a request
			request = ReadPropertyRequest(
				objectIdentifier=(obj_type, obj_inst),
				propertyIdentifier=prop_id,
				)
			if self._debug: print("requesting")
			request.pduDestination = Address(addr)

			#if len(args) == 5:
			#	request.propertyArrayIndex = int(args[4])
			#if _debug: ReadPropertyConsoleCmd._debug("	- request: %r", request)

			# give it to the application
			self._app.request(request)

		except Exception, e:
			print "exception:" + repr(e)
开发者ID:johnmoore,项目名称:SeniorDesign,代码行数:35,代码来源:HMIBacNETClient.py

示例7: create_ReadPropertyRequest

# 需要导入模块: from bacpypes.apdu import ReadPropertyRequest [as 别名]
# 或者: from bacpypes.apdu.ReadPropertyRequest import pduDestination [as 别名]
def create_ReadPropertyRequest(args):
    """
    Create a ReadPropertyRequest from a string
    """
    args = args.split()
    addr, obj_type, obj_inst, prop_id = args[:4]
    print(addr)

    if obj_type.isdigit():
        obj_type = int(obj_type)
    elif not get_object_class(obj_type):
        raise ValueError("unknown object type")

    obj_inst = int(obj_inst)

    datatype = get_datatype(obj_type, prop_id)
    if not datatype:
        raise ValueError("invalid property for object type")

    # build a request
    request = ReadPropertyRequest(
        objectIdentifier=(obj_type, obj_inst),
        propertyIdentifier=prop_id,
    )
    request.pduDestination = Address(addr)

    if len(args) == 5:
        request.propertyArrayIndex = int(args[4])

    return request
开发者ID:duck-hunt,项目名称:BAC0,代码行数:32,代码来源:test_ReadProperty.py

示例8: get_state_async

# 需要导入模块: from bacpypes.apdu import ReadPropertyRequest [as 别名]
# 或者: from bacpypes.apdu.ReadPropertyRequest import pduDestination [as 别名]
 def get_state_async(self, bac_app, address):
     request = ReadPropertyRequest(
             objectIdentifier=(self.object_type, self.instance_number),
             propertyIdentifier=self.property)        
     request.pduDestination = address
     iocb = IOCB(request)
     bac_app.request(iocb)
     return iocb.ioDefered
开发者ID:StephenCzarnecki,项目名称:volttron,代码行数:10,代码来源:bacnet.py

示例9: read_property

# 需要导入模块: from bacpypes.apdu import ReadPropertyRequest [as 别名]
# 或者: from bacpypes.apdu.ReadPropertyRequest import pduDestination [as 别名]
 def read_property(self, target_address, object_type, instance_number, property_name, property_index=None):
     request = ReadPropertyRequest(
         objectIdentifier=(object_type, instance_number),
         propertyIdentifier=property_name,
         propertyArrayIndex=property_index)
     request.pduDestination = Address(target_address)
     iocb = self.iocb_class(request)
     self.this_application.submit_request(iocb)
     bacnet_results = iocb.ioResult.get(10)
     return bacnet_results
开发者ID:schandrika,项目名称:volttron,代码行数:12,代码来源:agent.py

示例10: run

# 需要导入模块: from bacpypes.apdu import ReadPropertyRequest [as 别名]
# 或者: from bacpypes.apdu.ReadPropertyRequest import pduDestination [as 别名]
    def run(self):
        if _debug: ReadPointListThread._debug("run")
        global this_application

        # loop through the points
        for addr, obj_type, obj_inst, prop_id in self.point_queue:
            # build a request
            request = ReadPropertyRequest(
                objectIdentifier=(obj_type, obj_inst),
                propertyIdentifier=prop_id,
                )
            request.pduDestination = Address(addr)
            if _debug: ReadPointListThread._debug("    - request: %r", request)

            # make an IOCB
            iocb = IOCB(request)
            if _debug: ReadPointListThread._debug("    - iocb: %r", iocb)

            # give it to the application
            this_application.request_io(iocb)

            # wait for the response
            iocb.wait()

            if iocb.ioResponse:
                apdu = iocb.ioResponse

                # find the datatype
                datatype = get_datatype(apdu.objectIdentifier[0], apdu.propertyIdentifier)
                if _debug: ReadPointListThread._debug("    - datatype: %r", datatype)
                if not datatype:
                    raise TypeError("unknown datatype")

                # special case for array parts, others are managed by cast_out
                if issubclass(datatype, Array) and (apdu.propertyArrayIndex is not None):
                    if apdu.propertyArrayIndex == 0:
                        value = apdu.propertyValue.cast_out(Unsigned)
                    else:
                        value = apdu.propertyValue.cast_out(datatype.subtype)
                else:
                    value = apdu.propertyValue.cast_out(datatype)
                if _debug: ReadPointListThread._debug("    - value: %r", value)

                # save the value
                self.response_values.append(value)

            if iocb.ioError:
                if _debug: ReadPointListThread._debug("    - error: %r", iocb.ioError)
                self.response_values.append(iocb.ioError)

        # done
        stop()
开发者ID:DemandLogic,项目名称:bacpypes,代码行数:54,代码来源:MultipleReadPropertyThreaded.py

示例11: read

# 需要导入模块: from bacpypes.apdu import ReadPropertyRequest [as 别名]
# 或者: from bacpypes.apdu.ReadPropertyRequest import pduDestination [as 别名]
def read(device, portObject): 
    global this_application
    request_addr = device.getRequestAddress()    
    obj_type = portObject.getType()
    port = portObject.getPortNum()
    prop_id = portObject.getProp()
    maximumWait = 6  #seconds
    
    try: 

        #Jordan Trying to open thread in application

        #--------------------------read property request
        #verify datatype
       # print "Reading..."
        print request_addr, obj_type, port, prop_id
        
        if obj_type.isdigit():
            obj_type = int(obj_type)
        elif not get_object_class(obj_type):
            raise ValueError, "unknown object type"
            
                
        datatype = get_datatype(obj_type, prop_id)
        if not datatype:
            print ValueError, ": invalid property for object type"
        
        port = int(port)
        
        #build request
        request = ReadPropertyRequest(
            objectIdentifier=(obj_type, port),
            propertyIdentifier=prop_id,
            )
        request.pduDestination = Address(request_addr)
        time.sleep(.01)  #I dont know why, but this makes the code work correctly.
        #submit request
        this_application.request(request)
  #      print "Waiting for reply..."
        
        #wait for request
        wait = 0
        while this_application._Application__response_value == None and wait <= maximumWait:
            wait = wait + .01
            time.sleep(.01)
        returnVal = this_application._Application__response_value
    except Exception, e:
        returnVal = None
        print 'An error has happened (CPLRW 126): ' + str(e) + "\n"
开发者ID:als0062,项目名称:MECH4240,代码行数:51,代码来源:cplReadWrite.py

示例12: read_prop

# 需要导入模块: from bacpypes.apdu import ReadPropertyRequest [as 别名]
# 或者: from bacpypes.apdu.ReadPropertyRequest import pduDestination [as 别名]
def read_prop(app, address, obj_type, obj_inst, prop_id):
    request = ReadPropertyRequest(
                objectIdentifier=(obj_type, obj_inst),
                propertyIdentifier=prop_id)
    request.pduDestination = address
    
    result = this_application.make_request(request)
    if not isinstance(result, ReadPropertyACK):
        result.debug_contents(file=sys.stderr)
        raise TypeError("Error reading property")
    
    # find the datatype
    datatype = get_datatype(obj_type, prop_id)
    
    return result.propertyValue.cast_out(datatype)
开发者ID:StephenCzarnecki,项目名称:volttron,代码行数:17,代码来源:grab_bacnet_config.py

示例13: ReadProperty

# 需要导入模块: from bacpypes.apdu import ReadPropertyRequest [as 别名]
# 或者: from bacpypes.apdu.ReadPropertyRequest import pduDestination [as 别名]
def ReadProperty(
    object_type,
    object_instance,
    property_id,
    address,
    ):
    
    global application
    if (application == None):
        local_address = bacpypesip
        routers = None
        application = SynchronousApplication(local_address, routers)
    
    request = ReadPropertyRequest(objectIdentifier=(object_type,
                                  int(object_instance)),
                                  propertyIdentifier=property_id)
    request.pduDestination = Address(address)
    apdu = application.make_request(request)

    if isinstance(apdu, Error):
        sys.stdout.write('error: %s\n' % (apdu.errorCode, ))
        sys.stdout.flush()
        return 'Error!'
    elif isinstance(apdu, AbortPDU):

        apdu.debug_contents()
        return 'Error: AbortPDU'
    elif isinstance(request, ReadPropertyRequest) and isinstance(apdu,
            ReadPropertyACK):

        datatype = get_datatype(apdu.objectIdentifier[0],
                                apdu.propertyIdentifier)
        if not datatype:
            raise TypeError, 'unknown datatype'

        if issubclass(datatype, Array) and apdu.propertyArrayIndex\
             is not None:
            if apdu.propertyArrayIndex == 0:
                value = apdu.propertyValue.cast_out(Unsigned)
            else:
                value = apdu.propertyValue.cast_out(datatype.subtype)
        else:
            value = apdu.propertyValue.cast_out(datatype)
        if(value=="inactive"):
            value=0.0
        if (value=="active"):
            value=1.0
        return value
开发者ID:amarjeet-iiitd,项目名称:IIITD-Pervasive,代码行数:50,代码来源:SmapBacnetUtils.py

示例14: read

# 需要导入模块: from bacpypes.apdu import ReadPropertyRequest [as 别名]
# 或者: from bacpypes.apdu.ReadPropertyRequest import pduDestination [as 别名]
def read(obj_type, port, prop_id):

	try: 
		#--------------------------read property request
		#verify datatype
		print "Reading..."
		print obj_type, port, prop_id
		
		if obj_type.isdigit():
		    obj_type = int(obj_type)
		elif not get_object_class(obj_type):
		    raise ValueError, "unknown object type"
		    
		          
		datatype = get_datatype(obj_type, prop_id)
		if not datatype:
			print ValueError, ": invalid property for object type"
		
		port = int(port)	
		
		#build request
		request = ReadPropertyRequest(
		    objectIdentifier=(obj_type, port), 
		    propertyIdentifier=prop_id,
		    )
		request.pduDestination = Address(request_addr)
		
		#submit request
		
		print request.pduDestination
		
		
		this_application.request(request)
		print "Waiting for reply..."
		#wait for request
		wait = 0
		while this_application._Application__response_value == None:
		    wait = wait + .01
		    time.sleep(.01)
		returnVal = this_application._Application__response_value
        
        
	except Exception, e:
		returnVal = None
		print 'An error has happened (CPLRW 127): ' + str(e) + "\n"
开发者ID:adamlblood,项目名称:Russel-Hospital-Senior-Design,代码行数:47,代码来源:cplReadWrite.py

示例15: read_prop

# 需要导入模块: from bacpypes.apdu import ReadPropertyRequest [as 别名]
# 或者: from bacpypes.apdu.ReadPropertyRequest import pduDestination [as 别名]
def read_prop(app, address, obj_type, obj_inst, prop_id, index=None):
    request = ReadPropertyRequest(
        objectIdentifier=(obj_type, obj_inst), propertyIdentifier=prop_id, propertyArrayIndex=index
    )
    request.pduDestination = address

    result = this_application.make_request(request)
    if not isinstance(result, ReadPropertyACK):
        result.debug_contents(file=sys.stderr)
        raise TypeError("Error reading property")

    # find the datatype
    datatype = get_datatype(obj_type, prop_id)
    if issubclass(datatype, Array) and (result.propertyArrayIndex is not None):
        if result.propertyArrayIndex == 0:
            value = result.propertyValue.cast_out(Unsigned)
        else:
            value = result.propertyValue.cast_out(datatype.subtype)
    else:
        value = result.propertyValue.cast_out(datatype)

    return value
开发者ID:pelamlio,项目名称:volttron,代码行数:24,代码来源:grab_bacnet_config.py


注:本文中的bacpypes.apdu.ReadPropertyRequest.pduDestination方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。