1 /* 2 * Copyright (C) 2017 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 com.android.server.wifi; 18 19 import android.net.wifi.SoftApCapability; 20 import android.net.wifi.SoftApConfiguration; 21 import android.net.wifi.WifiManager; 22 23 import com.android.internal.util.Preconditions; 24 25 import javax.annotation.Nullable; 26 27 /** 28 * Object holding the parameters needed to start SoftAp mode. 29 */ 30 class SoftApModeConfiguration { 31 /** 32 * Routing mode. Either {@link android.net.wifi.WifiManager#IFACE_IP_MODE_TETHERED} 33 * or {@link android.net.wifi.WifiManager#IFACE_IP_MODE_LOCAL_ONLY}. 34 */ 35 private final int mTargetMode; 36 private final SoftApCapability mCapability; 37 38 /** 39 * SoftApConfiguration for internal use, or null if it hasn't been generated yet. 40 */ 41 private final @Nullable SoftApConfiguration mSoftApConfig; 42 SoftApModeConfiguration(int targetMode, @Nullable SoftApConfiguration config, SoftApCapability capability)43 SoftApModeConfiguration(int targetMode, @Nullable SoftApConfiguration config, 44 SoftApCapability capability) { 45 Preconditions.checkArgument( 46 targetMode == WifiManager.IFACE_IP_MODE_TETHERED 47 || targetMode == WifiManager.IFACE_IP_MODE_LOCAL_ONLY); 48 49 mTargetMode = targetMode; 50 mSoftApConfig = config; 51 mCapability = capability; 52 } 53 getTargetMode()54 public int getTargetMode() { 55 return mTargetMode; 56 } 57 getSoftApConfiguration()58 public SoftApConfiguration getSoftApConfiguration() { 59 return mSoftApConfig; 60 } 61 getCapability()62 public SoftApCapability getCapability() { 63 return mCapability; 64 } 65 } 66