microsoft/vscode-react-native
Publicmirrored from https://github.com/microsoft/vscode-react-nativeAvailable
src/extension/networkInspector/devices/baseClientDevice.ts
55lines · modeblame
4bb0956eRedMickey5 years ago | 1 | // Copyright (c) Microsoft Corporation. All rights reserved. |
| 2 | // Licensed under the MIT license. See LICENSE file in the project root for details. | |
| 3 | | |
| 4 | import { DeviceType } from "../../launchArgs"; | |
| 5 | import { ClientOS } from "../clientUtils"; | |
| 6 | import { IVirtualDevice } from "../../VirtualDeviceManager"; | |
| 7 | | |
| 8 | export enum DeviceStatus { | |
| 9 | Prepared, | |
| 10 | NotPrepared, | |
| 11 | } | |
| 12 | | |
| 13 | export class BaseClientDevice implements IVirtualDevice { | |
| 14 | // operating system of this device | |
| 15 | private _os: ClientOS; | |
| 16 | // human readable name for this device | |
| 17 | private _name?: string; | |
| 18 | // type of this device | |
| 19 | private _deviceType: DeviceType; | |
| 20 | // serial number for this device | |
| 21 | private _id: string; | |
| 22 | private _deviceStatus: DeviceStatus; | |
| 23 | | |
| 24 | constructor(id: string, deviceType: DeviceType, os: ClientOS, name?: string) { | |
| 25 | this._id = id; | |
| 26 | this._name = name; | |
| 27 | this._deviceType = deviceType; | |
| 28 | this._os = os; | |
| 29 | this._deviceStatus = DeviceStatus.NotPrepared; | |
| 30 | } | |
| 31 | | |
| 32 | get id(): string { | |
| 33 | return this._id; | |
| 34 | } | |
| 35 | | |
| 36 | get os(): ClientOS { | |
| 37 | return this._os; | |
| 38 | } | |
| 39 | | |
| 40 | get name(): string | undefined { | |
| 41 | return this._name; | |
| 42 | } | |
| 43 | | |
| 44 | get deviceType(): DeviceType { | |
| 45 | return this._deviceType; | |
| 46 | } | |
| 47 | | |
| 48 | get deviceStatus(): DeviceStatus { | |
| 49 | return this._deviceStatus; | |
| 50 | } | |
| 51 | | |
| 52 | set deviceStatus(deviceStatus: DeviceStatus) { | |
| 53 | this._deviceStatus = deviceStatus; | |
| 54 | } | |
| 55 | } |