Home | History | Annotate | Download | only in multimedia
      1 # Copyright 2016 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 CFM facade on DUT."""
      6 
      7 
      8 class CFMFacadeRemoteAdapter(object):
      9     """CFMFacadeRemoteAdapter is an adapter to remotely control CFM on DUT.
     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, host, remote_facade_proxy):
     16         """Construct a CFMFacadeRemoteAdapter.
     17 
     18         @param host: Host object representing a remote host.
     19         @param remote_facade_proxy: RemoteFacadeProxy object.
     20         """
     21         self._client = host
     22         self._proxy = remote_facade_proxy
     23 
     24 
     25     @property
     26     def _cfm_proxy(self):
     27         return self._proxy.cfm
     28 
     29 
     30     def enroll_device(self):
     31         """Enroll device into CFM."""
     32         self._cfm_proxy.enroll_device()
     33 
     34 
     35     def restart_chrome_for_cfm(self):
     36         """Restart chrome for CFM."""
     37         self._cfm_proxy.restart_chrome_for_cfm()
     38 
     39 
     40     def wait_for_telemetry_commands(self):
     41         """Wait for telemetry commands."""
     42         self._cfm_proxy.wait_for_telemetry_commands()
     43 
     44 
     45     # UI commands/functions
     46     def wait_for_oobe_start_page(self):
     47         """Wait for oobe start screen to launch."""
     48         self._cfm_proxy.wait_for_oobe_start_page()
     49 
     50 
     51     def skip_oobe_screen(self):
     52         """Skip Chromebox for Meetings oobe screen."""
     53         self._cfm_proxy.skip_oobe_screen()
     54 
     55 
     56     def is_oobe_start_page(self):
     57         """Check if device is on CFM oobe start screen.
     58 
     59         @return a boolean, based on oobe start page status.
     60         """
     61         return self._cfm_proxy.is_oobe_start_page()
     62 
     63 
     64     # Hangouts commands/functions
     65     def start_new_hangout_session(self, session_name):
     66         """Start a new hangout session.
     67 
     68         @param session_name: Name of the hangout session.
     69         """
     70         self._cfm_proxy.start_new_hangout_session(session_name)
     71 
     72 
     73     def end_hangout_session(self):
     74         """End current hangout session."""
     75         self._cfm_proxy.end_hangout_session()
     76 
     77 
     78     def is_in_hangout_session(self):
     79         """Check if device is in hangout session.
     80 
     81         @return a boolean, for hangout session state.
     82         """
     83         return self._cfm_proxy.is_in_hangout_session()
     84 
     85 
     86     def is_ready_to_start_hangout_session(self):
     87         """Check if device is ready to start a new hangout session.
     88 
     89         @return a boolean for hangout session ready state.
     90         """
     91         return self._cfm_proxy.is_ready_to_start_hangout_session()
     92 
     93 
     94     # Diagnostics commands/functions
     95     def is_diagnostic_run_in_progress(self):
     96         """Check if hotrod diagnostics is running.
     97 
     98         @return a boolean for diagnostic run state.
     99         """
    100         return self._cfm_proxy.is_diagnostic_run_in_progress()
    101 
    102 
    103     def wait_for_diagnostic_run_to_complete(self):
    104         """Wait for hotrod diagnostics to complete."""
    105         self._cfm_proxy.wait_for_diagnostic_run_to_complete()
    106 
    107 
    108     def run_diagnostics(self):
    109         """Run hotrod diagnostics."""
    110         self._cfm_proxy.run_diagnostics()
    111 
    112 
    113     def get_last_diagnostics_results(self):
    114         """Get latest hotrod diagnostics results.
    115 
    116         @return a dict with diagnostic test results.
    117         """
    118         return self._cfm_proxy.get_last_diagnostics_results()
    119 
    120 
    121     # Mic audio commands/functions
    122     def is_mic_muted(self):
    123         """Check if mic is muted.
    124 
    125         @return a boolean for mic mute state.
    126         """
    127         return self._cfm_proxy.is_mic_muted()
    128 
    129 
    130     def mute_mic(self):
    131         """Local mic mute from toolbar."""
    132         self._cfm_proxy.mute_mic()
    133 
    134 
    135     def unmute_mic(self):
    136         """Local mic unmute from toolbar."""
    137         self._cfm_proxy.unmute_mic()
    138 
    139 
    140     def remote_mute_mic(self):
    141         """Remote mic mute request from cPanel."""
    142         self._cfm_proxy.remote_mute_mic()
    143 
    144 
    145     def remote_unmute_mic(self):
    146         """Remote mic unmute request from cPanel."""
    147         self._cfm_proxy.remote_unmute_mic()
    148 
    149 
    150     def get_mic_devices(self):
    151         """Get all mic devices detected by hotrod."""
    152         return self._cfm_proxy.get_mic_devices()
    153 
    154 
    155     def get_preferred_mic(self):
    156         """Get mic preferred for hotrod.
    157 
    158         @return a str with preferred mic name.
    159         """
    160         return self._cfm_proxy.get_preferred_mic()
    161 
    162 
    163     def set_preferred_mic(self, mic):
    164         """Set preferred mic for hotrod.
    165 
    166         @param mic: String with mic name.
    167         """
    168         self._cfm_proxy.set_preferred_mic(mic)
    169 
    170 
    171     # Speaker commands/functions
    172     def get_speaker_devices(self):
    173         """Get all speaker devices detected by hotrod.
    174 
    175         @return a list of speaker devices.
    176         """
    177         return self._cfm_proxy.get_speaker_devices()
    178 
    179 
    180     def get_preferred_speaker(self):
    181         """Get speaker preferred for hotrod.
    182 
    183         @return a str with preferred speaker name.
    184         """
    185         return self._cfm_proxy.get_preferred_speaker()
    186 
    187 
    188     def set_preferred_speaker(self, speaker):
    189         """Set preferred speaker for hotrod.
    190 
    191         @param speaker: String with speaker name.
    192         """
    193         self._cfm_proxy.set_preferred_speaker(speaker)
    194 
    195 
    196     def set_speaker_volume(self, volume_level):
    197         """Set speaker volume.
    198 
    199         @param volume_level: String value ranging from 0-100 to set volume to.
    200         """
    201         self._cfm_proxy.set_speaker_volume(volume_level)
    202 
    203 
    204     def get_speaker_volume(self):
    205         """Get current speaker volume.
    206 
    207         @return a str value with speaker volume level 0-100.
    208         """
    209         return self._cfm_proxy.get_speaker_volume()
    210 
    211 
    212     def play_test_sound(self):
    213         """Play test sound."""
    214         self._cfm_proxy.play_test_sound()
    215 
    216 
    217     # Camera commands/functions
    218     def get_camera_devices(self):
    219         """Get all camera devices detected by hotrod.
    220 
    221         @return a list of camera devices.
    222         """
    223         return self._cfm_proxy.get_camera_devices()
    224 
    225 
    226     def get_preferred_camera(self):
    227         """Get camera preferred for hotrod.
    228 
    229         @return a str with preferred camera name.
    230         """
    231         return self._cfm_proxy.get_preferred_camera()
    232 
    233 
    234     def set_preferred_camera(self, camera):
    235         """Set preferred camera for hotrod.
    236 
    237         @param camera: String with camera name.
    238         """
    239         self._cfm_proxy.set_preferred_camera(camera)
    240 
    241 
    242     def is_camera_muted(self):
    243         """Check if camera is muted (turned off).
    244 
    245         @return a boolean for camera muted state.
    246         """
    247         return self._cfm_proxy.is_camera_muted()
    248 
    249 
    250     def mute_camera(self):
    251         """Turned camera off."""
    252         self._cfm_proxy.mute_camera()
    253 
    254 
    255     def unmute_camera(self):
    256         """Turned camera on."""
    257         self._cfm_proxy.unmute_camera()
    258