1# Copyright 2015 The Chromium OS Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5"""An adapter to remotely access the usb facade on DUT."""
6
7
8class USBFacadeRemoteAdapter(object):
9    """USBFacadeRemoteAdapter is an adapter to remotely control DUT USB.
10
11    The Autotest host object representing the remote DUT, passed to this
12    class on initialization, can be accessed from its _client property.
13
14    """
15    def __init__(self, remote_facade_proxy):
16        """Construct an AudioFacadeRemoteAdapter.
17
18        @param remote_facade_proxy: RemoteFacadeProxy object.
19
20        """
21        self._proxy = remote_facade_proxy
22
23
24    @property
25    def _usb_proxy(self):
26        """Gets the proxy to DUT USB facade.
27
28        @return XML RPC proxy to DUT USB facade.
29
30        """
31        return self._proxy.usb
32
33
34    def plug(self):
35        """Plugs the USB device into the host."""
36        self._usb_proxy.plug()
37
38
39    def unplug(self):
40        """Unplugs the USB device from the host."""
41        self._usb_proxy.unplug()
42