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 // Change the owner of the firmware reload path to wifi:wifi if 31 // firmware reload is supported. 32 static bool TakeOwnershipOfFirmwareReload(); 33 34 DriverTool() = default; 35 virtual ~DriverTool() = default; 36 37 // These methods allow manipulation of the WiFi driver. 38 // They all return true on success, and false otherwise. 39 virtual bool LoadDriver(); 40 virtual bool UnloadDriver(); 41 virtual bool IsDriverLoaded(); 42 43 // Check if we need to invoke |ChangeFirmwareMode| to configure 44 // the firmware for the provided mode. 45 // |mode| is one of the kFirmwareMode* constants defined above. 46 // Returns true if needed, and false otherwise. 47 virtual bool IsFirmwareModeChangeNeeded(int mode); 48 49 // Change the firmware mode. 50 // |mode| is one of the kFirmwareMode* constants defined above. 51 // Returns true on success, and false otherwise. 52 virtual bool ChangeFirmwareMode(int mode); 53 54 }; // class DriverTool 55 56 } // namespace wifi_hal 57 } // namespace android 58 59 #endif // ANDROID_WIFI_SYSTEM_DRIVER_TOOL_H 60 61