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_INTERFACE_TOOL_H 18#define ANDROID_WIFI_SYSTEM_INTERFACE_TOOL_H 19 20namespace android { 21namespace wifi_system { 22 23class InterfaceTool { 24 public: 25 InterfaceTool() = default; 26 virtual ~InterfaceTool() = default; 27 28 // Get the interface state of |if_name|. 29 // Returns true iff the interface is up. 30 virtual bool GetUpState(const char* if_name); 31 32 // Set the interface named by |if_name| up or down. 33 // Returns true on success, false otherwise. 34 virtual bool SetUpState(const char* if_name, bool request_up); 35 36 // A helpful alias for SetUpState() that assumes there is a single system 37 // WiFi interface. Prefer this form if you're hardcoding "wlan0" to help us 38 // identify all the places we are hardcoding the name of the wifi interface. 39 virtual bool SetWifiUpState(bool request_up); 40 41}; // class InterfaceTool 42 43} // namespace wifi_system 44} // namespace android 45 46#endif // ANDROID_WIFI_SYSTEM_INTERFACE_TOOL_H 47