xref: /aosp_15_r20/hardware/interfaces/wifi/aidl/default/wifi_mode_controller.h (revision 4d7e907c777eeecc4c5bd7cf640a754fac206ff7)
1 /*
2  * Copyright (C) 2022 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 <aidl/android/hardware/wifi/IWifi.h>
21 #include <wifi_hal/driver_tool.h>
22 
23 namespace aidl {
24 namespace android {
25 namespace hardware {
26 namespace wifi {
27 namespace mode_controller {
28 
29 /**
30  * Class that encapsulates all firmware mode configuration.
31  * This class will perform the necessary firmware reloads to put the chip in the
32  * required state (essentially a wrapper over DriverTool).
33  */
34 class WifiModeController {
35   public:
36     WifiModeController();
37     virtual ~WifiModeController() = default;
38 
39     // Checks if a firmware mode change is necessary to support the specified
40     // iface type operations.
41     virtual bool isFirmwareModeChangeNeeded(IfaceType type);
42     virtual bool initialize();
43     // Change the firmware mode to support the specified iface type operations.
44     virtual bool changeFirmwareMode(IfaceType type);
45     // Unload the driver. This should be invoked whenever |IWifi.stop()| is
46     // invoked.
47     virtual bool deinitialize();
48 
49   private:
50     std::unique_ptr<::android::wifi_hal::DriverTool> driver_tool_;
51 };
52 
53 }  // namespace mode_controller
54 }  // namespace wifi
55 }  // namespace hardware
56 }  // namespace android
57 }  // namespace aidl
58 
59 #endif  // WIFI_MODE_CONTROLLER_H_
60