1 /*
2  * Copyright (C) 2016 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 ANDROID_WIFI_SYSTEM_DRIVER_TOOL_H
18 #define ANDROID_WIFI_SYSTEM_DRIVER_TOOL_H
19 
20 namespace android {
21 namespace wifi_hal {
22 
23 // Utilities for interacting with the driver.
24 class DriverTool {
25  public:
26   static const int kFirmwareModeSta;
27   static const int kFirmwareModeAp;
28   static const int kFirmwareModeP2p;
29 
30   DriverTool() = default;
31   virtual ~DriverTool() = default;
32 
33   // These methods allow manipulation of the WiFi driver.
34   // They all return true on success, and false otherwise.
35   virtual bool LoadDriver();
36   virtual bool UnloadDriver();
37   virtual bool IsDriverLoaded();
38 
39   // Check if we need to invoke |ChangeFirmwareMode| to configure
40   // the firmware for the provided mode.
41   // |mode| is one of the kFirmwareMode* constants defined above.
42   // Returns true if needed, and false otherwise.
43   virtual bool IsFirmwareModeChangeNeeded(int mode);
44 
45   // Change the firmware mode.
46   // |mode| is one of the kFirmwareMode* constants defined above.
47   // Returns true on success, and false otherwise.
48   virtual bool ChangeFirmwareMode(int mode);
49 
50 };  // class DriverTool
51 
52 }  // namespace wifi_hal
53 }  // namespace android
54 
55 #endif  // ANDROID_WIFI_SYSTEM_DRIVER_TOOL_H
56 
57