本文整理汇总了Python中hbmqtt.client.MQTTClient.acknowledge_delivery方法的典型用法代码示例。如果您正苦于以下问题:Python MQTTClient.acknowledge_delivery方法的具体用法?Python MQTTClient.acknowledge_delivery怎么用?Python MQTTClient.acknowledge_delivery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hbmqtt.client.MQTTClient
的用法示例。
在下文中一共展示了MQTTClient.acknowledge_delivery方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from hbmqtt.client import MQTTClient [as 别名]
# 或者: from hbmqtt.client.MQTTClient import acknowledge_delivery [as 别名]
def main(self):
client = MQTTClient()
yield from client.connect('mqtt://localhost:1883/')
for key in self.__registry.keys():
yield from client.subscribe([{'filter': key, 'qos': 0x00}])
while True:
packet = yield from client.deliver_message()
log.debug("%s : %s" % (packet.variable_header.topic_name, str(packet.payload.data)))
try:
#yield from self.getSensor("pressure-main").setValue(float(packet.payload.data))
self.update(packet.variable_header.topic_name, packet.payload.data)
except Exception as exception:
log.exception(exception)
yield from client.acknowledge_delivery(packet.variable_header.packet_id)
for key in self.__registry.keys():
yield from client.unsubscribe([key])
yield from client.disconnect()