Roshan Pius | a26a6e0 | 2016-11-17 14:55:58 -0800 | [diff] [blame] | 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 WIFI_MODE_CONTROLLER_H_ |
| 18 | #define WIFI_MODE_CONTROLLER_H_ |
| 19 | |
| 20 | #include <wifi_hal/driver_tool.h> |
| 21 | |
| 22 | #include <android/hardware/wifi/1.0/IWifi.h> |
| 23 | |
| 24 | namespace android { |
| 25 | namespace hardware { |
| 26 | namespace wifi { |
Etan Cohen | 6ce5090 | 2017-09-14 07:30:57 -0700 | [diff] [blame^] | 27 | namespace V1_2 { |
Roshan Pius | a26a6e0 | 2016-11-17 14:55:58 -0800 | [diff] [blame] | 28 | namespace implementation { |
| 29 | namespace mode_controller { |
Roshan Pius | dbd83ef | 2017-06-20 12:05:40 -0700 | [diff] [blame] | 30 | using namespace android::hardware::wifi::V1_0; |
| 31 | |
Roshan Pius | a26a6e0 | 2016-11-17 14:55:58 -0800 | [diff] [blame] | 32 | /** |
| 33 | * Class that encapsulates all firmware mode configuration. |
| 34 | * This class will perform the necessary firmware reloads to put the chip in the |
| 35 | * required state (essentially a wrapper over DriverTool). |
| 36 | */ |
| 37 | class WifiModeController { |
| 38 | public: |
| 39 | WifiModeController(); |
| 40 | |
| 41 | // Checks if a firmware mode change is necessary to support the specified |
| 42 | // iface type operations. |
| 43 | bool isFirmwareModeChangeNeeded(IfaceType type); |
| 44 | // Change the firmware mode to support the specified iface type operations. |
| 45 | bool changeFirmwareMode(IfaceType type); |
| 46 | // Unload the driver. This should be invoked whenever |IWifi.stop()| is |
| 47 | // invoked. |
| 48 | bool deinitialize(); |
| 49 | |
| 50 | private: |
| 51 | std::unique_ptr<wifi_hal::DriverTool> driver_tool_; |
| 52 | }; |
| 53 | |
| 54 | } // namespace mode_controller |
| 55 | } // namespace implementation |
Etan Cohen | 6ce5090 | 2017-09-14 07:30:57 -0700 | [diff] [blame^] | 56 | } // namespace V1_2 |
Roshan Pius | a26a6e0 | 2016-11-17 14:55:58 -0800 | [diff] [blame] | 57 | } // namespace wifi |
| 58 | } // namespace hardware |
| 59 | } // namespace android |
| 60 | |
| 61 | #endif // WIFI_MODE_CONTROLLER_H_ |