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