OLD | NEW |
| (Empty) |
1 # Copyright (c) 2012 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 | |
5 import os | |
6 | |
7 import dlink_ap_configurator | |
8 import linksys_ap_configurator | |
9 | |
10 import pyauto_ap_configurator # must preceed pyauto | |
11 import pyauto | |
12 | |
13 | |
14 class APConfiguratorFactory(object): | |
15 """Class that instantiates all available APConfigurators.""" | |
16 | |
17 def __init__(self, pyauto_instance, config_dict_file_path=None): | |
18 if not config_dict_file_path: | |
19 # Load the default dictionary file | |
20 config_dict_file_path = os.path.join(pyauto_instance.DataDir(), | |
21 'pyauto_private', 'chromeos', | |
22 'network', 'wifi_compat_config') | |
23 assert os.path.exists(config_dict_file_path), ('%s missing' % | |
24 config_dict_file_path) | |
25 ap_dict = pyauto_instance.EvalDataFrom(config_dict_file_path) | |
26 self.ap_list = [] | |
27 self.ap_list.append(linksys_ap_configurator.LinksysAPConfigurator( | |
28 pyauto_instance, ap_dict['LinksysAPConfigurator'])) | |
29 self.ap_list.append(dlink_ap_configurator.DLinkAPConfigurator( | |
30 pyauto_instance, ap_dict['DLinkAPConfigurator'])) | |
31 | |
32 def GetAPConfigurators(self): | |
33 return self.ap_list | |
34 | |
35 def GetAPConfiguratorByShortName(self, name): | |
36 for ap in self.ap_list: | |
37 if ap.GetRouterShortName() == name: | |
38 return ap | |
39 return None | |
OLD | NEW |