def _link(self, dev_type): """ 尝试将系统中的设备链接进来 :return: 成功 'ok', self, 'no error' 失败 'error', None, reason """ status, dev, fail_reason = api.device_get_profile(dev_type) if status != api.OK: return api.return_warning_payload(fail_reason) if dev is None: return api.return_warning_payload( "类型<{}>对应的设备驱动可能还没有启动!".format(dev_type)) try: vendor = dev['vendor'] model = dev['model'] version = dev['version'] except KeyError: return api.return_warning_payload( "类型<{}>对应的设备驱动参数内容错误!".format(dev_type)) supported = self.is_device_supported(dev_type, vendor, model, version) if not supported: return api.return_warning_payload( "类型<{}/{}/{}/{}>对应的设备驱动不受支持!".format(dev_type, vendor, model, version)) else: return api.return_ok_payload(self)
def get_EC_device_pair_information(): info = ["02-环境箱页面"] status, pr, reason = api.device_get_profile(dev_type) if status != api.OK: return api.return_error_payload(info) info.append(pr['vendor']) info.append(pr['model']) info.append(pr['version']) return api.return_ok_payload(info)