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


Python Message._mid方法代码示例

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


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

示例1: _test_with_client_observe

# 需要导入模块: from coapthon.messages.message import Message [as 别名]
# 或者: from coapthon.messages.message.Message import _mid [as 别名]
 def _test_with_client_observe(self, message_list, callback):
     client = HelperClient(self.server_address)
     token = None
     last_mid = 0
     for message, expected in message_list:
         if message is not None:
             token = message.token
             client.send_request(message, callback)
         received_message = self.queue.get()
         if expected is not None:
             last_mid = expected.mid
             if expected.type is not None:
                 self.assertEqual(received_message.type, expected.type)
             if expected.mid is not None:
                 self.assertEqual(received_message.mid, expected.mid)
             self.assertEqual(received_message.code, expected.code)
             if expected.source is not None:
                 self.assertEqual(received_message.source, self.server_address)
             if expected.token is not None:
                 self.assertEqual(received_message.token, expected.token)
             if expected.payload is not None:
                 self.assertEqual(received_message.payload, expected.payload)
             if expected.options is not None:
                 self.assertEqual(received_message.options, expected.options)
     message = Message()
     message.type = defines.Types["RST"]
     message.token = token
     message._mid = last_mid
     message.destination = self.server_address
     client.send_empty(message)
     client.stop()
开发者ID:yukusu,项目名称:IoT-Rasp,代码行数:33,代码来源:plugtest.py


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