• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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     private final String mCountryCode;
38 
39     /**
40      * SoftApConfiguration for internal use, or null if it hasn't been generated yet.
41      */
42     private final @Nullable SoftApConfiguration mSoftApConfig;
43 
SoftApModeConfiguration(int targetMode, @Nullable SoftApConfiguration config, SoftApCapability capability, @Nullable String countryCode)44     SoftApModeConfiguration(int targetMode, @Nullable SoftApConfiguration config,
45             SoftApCapability capability, @Nullable String countryCode) {
46         Preconditions.checkArgument(
47                 targetMode == WifiManager.IFACE_IP_MODE_TETHERED
48                         || targetMode == WifiManager.IFACE_IP_MODE_LOCAL_ONLY);
49 
50         mTargetMode = targetMode;
51         mSoftApConfig = config;
52         mCapability = capability;
53         mCountryCode = countryCode;
54     }
55 
getTargetMode()56     public int getTargetMode() {
57         return mTargetMode;
58     }
59 
getSoftApConfiguration()60     public SoftApConfiguration getSoftApConfiguration() {
61         return mSoftApConfig;
62     }
63 
getCapability()64     public SoftApCapability getCapability() {
65         return mCapability;
66     }
67 
getCountryCode()68     public String getCountryCode() {
69         return mCountryCode;
70     }
71 }
72