| # Copyright 2011 The ChromiumOS Authors |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| from cros.factory.test.rf import lan_scpi |
| |
| |
| class AgilentSCPI(lan_scpi.LANSCPI): |
| """An Agilent device that supports SCPI.""" |
| |
| def __init__(self, expected_model, *args, **kwargs): |
| super().__init__(*args, **kwargs) |
| # yapf: disable |
| self.id_fields = [x.strip() for x in self.id.split(b',')] # type: ignore #TODO(b/338318729) Fixit! # pylint: disable=line-too-long |
| # yapf: enable |
| model = self.id_fields[1].decode('utf-8') |
| if model != expected_model: |
| raise lan_scpi.Error(f'Expected model {expected_model} but got {model}') |
| |
| def GetSerialNumber(self): |
| """Returns the serial number of the device.""" |
| return self.id_fields[2] |