1 /* 2 * Copyright (C) 2020 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.annotation.NonNull; 20 21 import java.util.BitSet; 22 23 /** 24 * Used to respond to calls to ClientMode interface when ClientModeImpl is not up 25 * i.e. in scan only mode. 26 */ 27 public class ScanOnlyModeImpl implements ClientModeDefaults { 28 29 private final long mId; 30 private final WifiNative mWifiNative; 31 private final String mIfaceName; 32 ScanOnlyModeImpl(long id, @NonNull WifiNative wifiNative, @NonNull String ifaceName)33 public ScanOnlyModeImpl(long id, @NonNull WifiNative wifiNative, @NonNull String ifaceName) { 34 mId = id; 35 mWifiNative = wifiNative; 36 mIfaceName = ifaceName; 37 } 38 39 @Override getId()40 public long getId() { 41 return mId; 42 } 43 44 @Override getSupportedFeaturesBitSet()45 public @NonNull BitSet getSupportedFeaturesBitSet() { 46 return mWifiNative.getSupportedFeatureSet(mIfaceName); 47 } 48 49 @Override isWifiStandardSupported(int standard)50 public boolean isWifiStandardSupported(int standard) { 51 return mWifiNative.isWifiStandardSupported(mIfaceName, standard); 52 } 53 54 @Override setCountryCode(String countryCode)55 public boolean setCountryCode(String countryCode) { 56 return mWifiNative.setChipCountryCode(countryCode); 57 } 58 59 @Override toString()60 public String toString() { 61 return "ScanOnlyModeImpl{" 62 + "id=" + mId 63 + " iface=" + mIfaceName 64 + '}'; 65 } 66 } 67