本文整理匯總了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']