本文整理汇总了Python中Device.Device.name方法的典型用法代码示例。如果您正苦于以下问题:Python Device.name方法的具体用法?Python Device.name怎么用?Python Device.name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Device.Device
的用法示例。
在下文中一共展示了Device.name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build_device
# 需要导入模块: from Device import Device [as 别名]
# 或者: from Device.Device import name [as 别名]
def build_device(self, the_json):
d = Device()
if "name" in the_json:
d.name = the_json["name"]
if "sensors" in the_json:
for sensor in the_json["sensors"]:
if '__type__' in sensor and sensor['__type__'] == 'Sensor':
self.build_sensor(d, sensor)
if "actuator" in the_json:
self.build_actuator(d, the_json["actuator"])
return d
示例2: scan_response_handler
# 需要导入模块: from Device import Device [as 别名]
# 或者: from Device.Device import name [as 别名]
def scan_response_handler(self, sender, args):
'''
Handles all of the scan response data and stores it in a list of device objects
:param sender:
:param args:
:return:
'''
addr = args['sender']
if not self.find_device(addr):
d = Device(self.bglib, self.cmd_q, addr)
self.devices.append(d)
ad_data = parse_scan_response_data(args['data'])
if 'name' in ad_data:
d.name = ad_data['name']