本文整理汇总了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)
示例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")