blob: 2eeca78c8b97b116d91b0f0513032deb7a653794 [file] [log] [blame]
Roshan Piusa26a6e02016-11-17 14:55:58 -08001/*
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
24namespace android {
25namespace hardware {
26namespace wifi {
Jimmy Chend460df32019-11-29 17:31:22 +020027namespace V1_5 {
Roshan Piusa26a6e02016-11-17 14:55:58 -080028namespace implementation {
29namespace mode_controller {
Roshan Piusdbd83ef2017-06-20 12:05:40 -070030using namespace android::hardware::wifi::V1_0;
31
Roshan Piusa26a6e02016-11-17 14:55:58 -080032/**
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 */
37class WifiModeController {
Roshan Piusabcf78f2017-10-06 16:30:38 -070038 public:
39 WifiModeController();
Roshan Pius200a17d2017-11-01 13:03:35 -070040 virtual ~WifiModeController() = default;
Roshan Piusa26a6e02016-11-17 14:55:58 -080041
Roshan Piusabcf78f2017-10-06 16:30:38 -070042 // Checks if a firmware mode change is necessary to support the specified
43 // iface type operations.
Roshan Pius200a17d2017-11-01 13:03:35 -070044 virtual bool isFirmwareModeChangeNeeded(IfaceType type);
Roshan Pius8fc6d172017-11-27 16:08:27 -080045 virtual bool initialize();
Roshan Piusabcf78f2017-10-06 16:30:38 -070046 // Change the firmware mode to support the specified iface type operations.
Roshan Pius200a17d2017-11-01 13:03:35 -070047 virtual bool changeFirmwareMode(IfaceType type);
Roshan Piusabcf78f2017-10-06 16:30:38 -070048 // Unload the driver. This should be invoked whenever |IWifi.stop()| is
49 // invoked.
Roshan Pius200a17d2017-11-01 13:03:35 -070050 virtual bool deinitialize();
Roshan Piusa26a6e02016-11-17 14:55:58 -080051
Roshan Piusabcf78f2017-10-06 16:30:38 -070052 private:
53 std::unique_ptr<wifi_hal::DriverTool> driver_tool_;
Roshan Piusa26a6e02016-11-17 14:55:58 -080054};
55
56} // namespace mode_controller
57} // namespace implementation
Jimmy Chend460df32019-11-29 17:31:22 +020058} // namespace V1_5
Roshan Piusa26a6e02016-11-17 14:55:58 -080059} // namespace wifi
60} // namespace hardware
61} // namespace android
62
63#endif // WIFI_MODE_CONTROLLER_H_