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


Python ReadPropertyRequest.encode方法代码示例

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


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

示例1: test_readProperty

# 需要导入模块: from bacpypes.apdu import ReadPropertyRequest [as 别名]
# 或者: from bacpypes.apdu.ReadPropertyRequest import encode [as 别名]
    def test_readProperty(self):

        request = ReadPropertyRequest(objectIdentifier=('analogInput', 14), propertyIdentifier=85)
        request.apduMaxResp = 1024
        request.apduInvokeID = 101
        apdu = APDU()
        request.encode(apdu)
        pdu = PDU()
        apdu.encode(pdu)
        buf_size = 1024
        s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        s.sendto(pdu.pduData, ('127.0.0.1', self.bacnet_server.server.server_port))
        data = s.recvfrom(buf_size)

        received_data = data[0]

        expected = ReadPropertyACK()
        expected.pduDestination = GlobalBroadcast()
        expected.apduInvokeID = 101
        expected.objectIdentifier = 14
        expected.objectName = 'AI 01'
        expected.propertyIdentifier = 85
        expected.propertyValue = Any(Real(68.0))

        exp_apdu = APDU()
        expected.encode(exp_apdu)
        exp_pdu = PDU()
        exp_apdu.encode(exp_pdu)

        self.assertEquals(exp_pdu.pduData, received_data)
开发者ID:jlthames2,项目名称:conpot,代码行数:32,代码来源:test_bacnet_server.py

示例2: ReadPropertyRequest

# 需要导入模块: from bacpypes.apdu import ReadPropertyRequest [as 别名]
# 或者: from bacpypes.apdu.ReadPropertyRequest import encode [as 别名]
# ==============================================================================

read_property_request = ReadPropertyRequest(
    objectIdentifier=('device', 100),
    propertyIdentifier='objectName',
    )
read_property_request.pduSource = Address(2)
# read_property_request.pduDestination = Address(1)
read_property_request.apduInvokeID = 1

print("read_property_request")
read_property_request.debug_contents()
print("")

test_apdu = APDU()
read_property_request.encode(test_apdu)

print("test_apdu")
test_apdu.debug_contents()
print("")

if 0:
    print("modify test_apdu")
    test_apdu.pduData = test_apdu.pduData[:5]
    test_apdu.debug_contents()
    print("")

# make a send transition from start to success
start_state = test_server.start_state.doc("start_state")
response_state = start_state.send(test_apdu).doc("response_state")
success_state = response_state.receive(ComplexAckPDU).doc("success_state")
开发者ID:DemandLogic,项目名称:bacpypes,代码行数:33,代码来源:read_property_reject_test_x.py


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