176e6818aSopenharmony_ci#!/usr/bin/env python3 276e6818aSopenharmony_ci# coding=utf-8 376e6818aSopenharmony_ci 476e6818aSopenharmony_ci# 576e6818aSopenharmony_ci# Copyright (c) 2022 Huawei Device Co., Ltd. 676e6818aSopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License"); 776e6818aSopenharmony_ci# you may not use this file except in compliance with the License. 876e6818aSopenharmony_ci# You may obtain a copy of the License at 976e6818aSopenharmony_ci# 1076e6818aSopenharmony_ci# http://www.apache.org/licenses/LICENSE-2.0 1176e6818aSopenharmony_ci# 1276e6818aSopenharmony_ci# Unless required by applicable law or agreed to in writing, software 1376e6818aSopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS, 1476e6818aSopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1576e6818aSopenharmony_ci# See the License for the specific language governing permissions and 1676e6818aSopenharmony_ci# limitations under the License. 1776e6818aSopenharmony_ci# 1876e6818aSopenharmony_ci 1976e6818aSopenharmony_cifrom xdevice import IDevice 2076e6818aSopenharmony_cifrom xdevice import platform_logger 2176e6818aSopenharmony_cifrom xdevice import DeviceAllocationState 2276e6818aSopenharmony_cifrom xdevice import TestDeviceState 2376e6818aSopenharmony_ci 2476e6818aSopenharmony_ciLOG = platform_logger("Emulator") 2576e6818aSopenharmony_ci 2676e6818aSopenharmony_ci 2776e6818aSopenharmony_ciclass Emulator(IDevice): 2876e6818aSopenharmony_ci """ 2976e6818aSopenharmony_ci Class representing an emulator. 3076e6818aSopenharmony_ci 3176e6818aSopenharmony_ci Each object of this class represents one emulator in xDevice. 3276e6818aSopenharmony_ci 3376e6818aSopenharmony_ci Attributes: 3476e6818aSopenharmony_ci device_sn: A string that's the serial number of the emulator. 3576e6818aSopenharmony_ci """ 3676e6818aSopenharmony_ci 3776e6818aSopenharmony_ci def __get_serial__(self): 3876e6818aSopenharmony_ci pass 3976e6818aSopenharmony_ci 4076e6818aSopenharmony_ci def __set_serial__(self, device_sn=""): 4176e6818aSopenharmony_ci pass 4276e6818aSopenharmony_ci 4376e6818aSopenharmony_ci def __init__(self, device_sn=""): 4476e6818aSopenharmony_ci self.device_sn = device_sn 4576e6818aSopenharmony_ci self.is_timeout = False 4676e6818aSopenharmony_ci self.device_log_proc = None 4776e6818aSopenharmony_ci self.test_device_state = TestDeviceState.ONLINE 4876e6818aSopenharmony_ci self.device_allocation_state = DeviceAllocationState.available 4976e6818aSopenharmony_ci 5076e6818aSopenharmony_ci def __serial__(self): 5176e6818aSopenharmony_ci return self.device_sn 5276e6818aSopenharmony_ci 5376e6818aSopenharmony_ci def get_device_sn(self): 5476e6818aSopenharmony_ci """ 5576e6818aSopenharmony_ci Returns the serial number of the device. 5676e6818aSopenharmony_ci """ 5776e6818aSopenharmony_ci return self.device_sn 58