100aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wiley/*
200aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wiley * Copyright (C) 2016 The Android Open Source Project
300aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wiley *
400aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wiley * Licensed under the Apache License, Version 2.0 (the "License");
500aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wiley * you may not use this file except in compliance with the License.
600aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wiley * You may obtain a copy of the License at
700aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wiley *
800aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wiley *      http://www.apache.org/licenses/LICENSE-2.0
900aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wiley *
1000aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wiley * Unless required by applicable law or agreed to in writing, software
1100aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wiley * distributed under the License is distributed on an "AS IS" BASIS,
1200aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wiley * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1300aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wiley * See the License for the specific language governing permissions and
1400aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wiley * limitations under the License.
1500aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wiley */
1600aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wiley
1700aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wiley#ifndef ANDROID_WIFI_SYSTEM_DRIVER_TOOL_H
1800aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wiley#define ANDROID_WIFI_SYSTEM_DRIVER_TOOL_H
1900aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wiley
2000aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wileynamespace android {
2100aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wileynamespace wifi_hal {
2200aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wiley
2300aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wiley// Utilities for interacting with the driver.
2400aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wileyclass DriverTool {
2500aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wiley public:
2600aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wiley  static const int kFirmwareModeSta;
2700aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wiley  static const int kFirmwareModeAp;
2800aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wiley  static const int kFirmwareModeP2p;
2900aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wiley
30f41e52f5ad89310d867a00c12f2cf146703ad574Christopher Wiley  // Change the owner of the firmware reload path to wifi:wifi if
31f41e52f5ad89310d867a00c12f2cf146703ad574Christopher Wiley  // firmware reload is supported.
32f41e52f5ad89310d867a00c12f2cf146703ad574Christopher Wiley  static bool TakeOwnershipOfFirmwareReload();
331d3a41b9b46eb573058fdd7422d4ebc5b4f1108fChristopher Wiley
3400aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wiley  DriverTool() = default;
3500aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wiley  virtual ~DriverTool() = default;
3600aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wiley
3700aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wiley  // These methods allow manipulation of the WiFi driver.
3800aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wiley  // They all return true on success, and false otherwise.
3900aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wiley  virtual bool LoadDriver();
4000aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wiley  virtual bool UnloadDriver();
4100aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wiley  virtual bool IsDriverLoaded();
4200aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wiley
436ce7173a9bab425b9760d880b3ebed46d2cd6a2bRoshan Pius  // Check if we need to invoke |ChangeFirmwareMode| to configure
446ce7173a9bab425b9760d880b3ebed46d2cd6a2bRoshan Pius  // the firmware for the provided mode.
456ce7173a9bab425b9760d880b3ebed46d2cd6a2bRoshan Pius  // |mode| is one of the kFirmwareMode* constants defined above.
466ce7173a9bab425b9760d880b3ebed46d2cd6a2bRoshan Pius  // Returns true if needed, and false otherwise.
476ce7173a9bab425b9760d880b3ebed46d2cd6a2bRoshan Pius  virtual bool IsFirmwareModeChangeNeeded(int mode);
486ce7173a9bab425b9760d880b3ebed46d2cd6a2bRoshan Pius
4900aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wiley  // Change the firmware mode.
5000aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wiley  // |mode| is one of the kFirmwareMode* constants defined above.
5100aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wiley  // Returns true on success, and false otherwise.
5200aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wiley  virtual bool ChangeFirmwareMode(int mode);
5300aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wiley
5400aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wiley};  // class DriverTool
5500aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wiley
5600aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wiley}  // namespace wifi_hal
5700aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wiley}  // namespace android
5800aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wiley
5900aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wiley#endif  // ANDROID_WIFI_SYSTEM_DRIVER_TOOL_H
6000aa56eb2fb48a1097abbf35b2a58234477672e5Christopher Wiley
61