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 package android.net.wifi; 18 19 // IApInterface represents a network interface configured to act as a 20 // WiFi access point. 21 interface IApInterface { 22 23 const int ENCRYPTION_TYPE_NONE = 0; 24 const int ENCRYPTION_TYPE_WPA = 1; 25 const int ENCRYPTION_TYPE_WPA2 = 2; 26 27 // Start up an instance of hostapd associated with this interface. 28 // @return true on success. startHostapd()29 boolean startHostapd(); 30 31 // Stop a previously started instance of hostapd. 32 // @return true on success. stopHostapd()33 boolean stopHostapd(); 34 35 // Write out a configuration file for hostapd. This will be used on the next 36 // successful call to StartHostapd(). Returns true on success. 37 // 38 // @param ssid string of <=32 bytes to use as the SSID for this AP. 39 // @param isHidden True iff the AP should not broadcast its SSID. 40 // @param channel WiFi channel to expose the AP on. 41 // @param encryptionType one of ENCRYPTION_TYPE* above. 42 // @param passphrase string of bytes to use as the passphrase for this AP. 43 // Ignored if encryptionType is None. 44 // @return true on success. writeHostapdConfig(in byte[] ssid, boolean isHidden, int channel, int encryptionType, in byte[] passphrase)45 boolean writeHostapdConfig(in byte[] ssid, boolean isHidden, int channel, 46 int encryptionType, in byte[] passphrase); 47 48 // Retrieve the name of the network interface corresponding to this 49 // IApInterface instance (e.g. "wlan0") 50 @utf8InCpp getInterfaceName()51 String getInterfaceName(); 52 53 // @return Returns the number of associated devices to this hotspot. 54 // Returns -1 on failure. getNumberOfAssociatedStations()55 int getNumberOfAssociatedStations(); 56 57 } 58