1 //
2 // Copyright (C) 2015 The Android Open Source Project
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //      http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #ifndef SHILL_WIFI_WIFI_DRIVER_HAL_H_
18 #define SHILL_WIFI_WIFI_DRIVER_HAL_H_
19 
20 #include <string>
21 
22 #include <base/lazy_instance.h>
23 #include <base/macros.h>
24 
25 namespace shill {
26 
27 // This is a singleton class for invoking calls to WiFi driver HAL,
28 // mainly for configuring device operation mode (station vs AP mode).
29 class WiFiDriverHal {
30  public:
31   virtual ~WiFiDriverHal();
32 
33   // Since this is a singleton, use WiFiDriverHal::GetInstance()->Foo().
34   static WiFiDriverHal* GetInstance();
35 
36   // Setup WiFi interface in station mode. Return an |interface_name| if
37   // success. Otherwise, return an empty string.
38   // This will attempt to initialize the WiFi driver before configuring
39   // the interface mode. It will be a noop in the driver if it is already
40   // initialized. So there won't be any performance penalty for doing it.
41   virtual std::string SetupStationModeInterface();
42 
43   // Setup WiFi interface in AP mode. Return an |interface_name| if
44   // success. Otherwise, return an empty string.
45   // This will attempt to initialize the WiFi driver before configuring
46   // the interface mode. It will be a noop in the driver if it is already
47   // initialized. So there won't be any performance penalty for doing it.
48   virtual std::string SetupApModeInterface();
49 
50  protected:
51   WiFiDriverHal();
52 
53  private:
54   friend struct base::DefaultLazyInstanceTraits<WiFiDriverHal>;
55 
56   DISALLOW_COPY_AND_ASSIGN(WiFiDriverHal);
57 };
58 
59 }  // namespace shill
60 
61 #endif  // SHILL_WIFI_WIFI_DRIVER_HAL_H_
62