• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2014 The Chromium 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
5import ap_spec
6import linksyse2100_ap_configurator
7
8
9class Linksyse1500APConfigurator(linksyse2100_ap_configurator.
10                                 Linksyse2100APConfigurator):
11    """Derived class to control Linksys E1500 router."""
12
13    def _set_mode(self, mode, band=None):
14        mode_mapping = {ap_spec.MODE_M:'Mixed',
15                        ap_spec.MODE_B | ap_spec.MODE_G:'Wireless-B/G Only',
16                        ap_spec.MODE_G:'Wireless-G Only',
17                        ap_spec.MODE_B:'Wireless-B Only',
18                        ap_spec.MODE_N:'Wireless-N Only',
19                        'Disabled':'Disabled'}
20        mode_name = mode_mapping.get(mode)
21        if not mode_name:
22            raise RuntimeError('The mode %d not supported by router %s. ',
23                               hex(mode), self.name)
24        xpath = '//select[@name="wl_net_mode"]'
25        self.select_item_from_popup_by_xpath(mode_name, xpath,
26                                             alert_handler=self._sec_alert)
27
28
29    def _set_channel(self, channel):
30        position = self._get_channel_popup_position(channel)
31        xpath = '//select[@name="wl_schannel"]'
32        channels = ['Auto', '1', '2', '3', '4', '5', '6', '7', '8',
33                    '9', '10', '11']
34        self.select_item_from_popup_by_xpath(channels[position], xpath)
35