1e03fb4459cd3ace301926bdfda75034becfc79bcChristopher Wiley/* 2e03fb4459cd3ace301926bdfda75034becfc79bcChristopher Wiley * Copyright (C) 2016 The Android Open Source Project 3e03fb4459cd3ace301926bdfda75034becfc79bcChristopher Wiley * 4e03fb4459cd3ace301926bdfda75034becfc79bcChristopher Wiley * Licensed under the Apache License, Version 2.0 (the "License"); 5e03fb4459cd3ace301926bdfda75034becfc79bcChristopher Wiley * you may not use this file except in compliance with the License. 6e03fb4459cd3ace301926bdfda75034becfc79bcChristopher Wiley * You may obtain a copy of the License at 7e03fb4459cd3ace301926bdfda75034becfc79bcChristopher Wiley * 8e03fb4459cd3ace301926bdfda75034becfc79bcChristopher Wiley * http://www.apache.org/licenses/LICENSE-2.0 9e03fb4459cd3ace301926bdfda75034becfc79bcChristopher Wiley * 10e03fb4459cd3ace301926bdfda75034becfc79bcChristopher Wiley * Unless required by applicable law or agreed to in writing, software 11e03fb4459cd3ace301926bdfda75034becfc79bcChristopher Wiley * distributed under the License is distributed on an "AS IS" BASIS, 12e03fb4459cd3ace301926bdfda75034becfc79bcChristopher Wiley * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13e03fb4459cd3ace301926bdfda75034becfc79bcChristopher Wiley * See the License for the specific language governing permissions and 14e03fb4459cd3ace301926bdfda75034becfc79bcChristopher Wiley * limitations under the License. 15e03fb4459cd3ace301926bdfda75034becfc79bcChristopher Wiley */ 16e03fb4459cd3ace301926bdfda75034becfc79bcChristopher Wiley 17e03fb4459cd3ace301926bdfda75034becfc79bcChristopher Wileypackage com.android.server.connectivity.tethering; 18e03fb4459cd3ace301926bdfda75034becfc79bcChristopher Wiley 19ab6439b0f8dd0a67c81235a3fc4d9c149de3780dErik Klineimport android.net.LinkProperties; 20ab6439b0f8dd0a67c81235a3fc4d9c149de3780dErik Kline 21e03fb4459cd3ace301926bdfda75034becfc79bcChristopher Wiley/** 22e03fb4459cd3ace301926bdfda75034becfc79bcChristopher Wiley * @hide 23e03fb4459cd3ace301926bdfda75034becfc79bcChristopher Wiley * 24e03fb4459cd3ace301926bdfda75034becfc79bcChristopher Wiley * Interface with methods necessary to notify that a given interface is ready for tethering. 25ab6439b0f8dd0a67c81235a3fc4d9c149de3780dErik Kline * 26ab6439b0f8dd0a67c81235a3fc4d9c149de3780dErik Kline * Rename to something more representative, e.g. IpServingControlCallback. 27ab6439b0f8dd0a67c81235a3fc4d9c149de3780dErik Kline * 28ab6439b0f8dd0a67c81235a3fc4d9c149de3780dErik Kline * All methods MUST be called on the TetherMasterSM main Looper's thread. 29e03fb4459cd3ace301926bdfda75034becfc79bcChristopher Wiley */ 30ab6439b0f8dd0a67c81235a3fc4d9c149de3780dErik Klinepublic class IControlsTethering { 31ab6439b0f8dd0a67c81235a3fc4d9c149de3780dErik Kline public static final int STATE_UNAVAILABLE = 0; 32ab6439b0f8dd0a67c81235a3fc4d9c149de3780dErik Kline public static final int STATE_AVAILABLE = 1; 33ab6439b0f8dd0a67c81235a3fc4d9c149de3780dErik Kline public static final int STATE_TETHERED = 2; 34ab6439b0f8dd0a67c81235a3fc4d9c149de3780dErik Kline public static final int STATE_LOCAL_ONLY = 3; 35d985dde8ccfd38a50377a8ab2378b36c92b0d7c7Christopher Wiley 36dd4d5820344205085c19dc142aec252ea9ac220bErik Kline public static String getStateString(int state) { 37dd4d5820344205085c19dc142aec252ea9ac220bErik Kline switch (state) { 38dd4d5820344205085c19dc142aec252ea9ac220bErik Kline case STATE_UNAVAILABLE: return "UNAVAILABLE"; 39dd4d5820344205085c19dc142aec252ea9ac220bErik Kline case STATE_AVAILABLE: return "AVAILABLE"; 40dd4d5820344205085c19dc142aec252ea9ac220bErik Kline case STATE_TETHERED: return "TETHERED"; 41dd4d5820344205085c19dc142aec252ea9ac220bErik Kline case STATE_LOCAL_ONLY: return "LOCAL_ONLY"; 42dd4d5820344205085c19dc142aec252ea9ac220bErik Kline } 43dd4d5820344205085c19dc142aec252ea9ac220bErik Kline return "UNKNOWN: " + state; 44dd4d5820344205085c19dc142aec252ea9ac220bErik Kline } 45dd4d5820344205085c19dc142aec252ea9ac220bErik Kline 46d985dde8ccfd38a50377a8ab2378b36c92b0d7c7Christopher Wiley /** 47ab6439b0f8dd0a67c81235a3fc4d9c149de3780dErik Kline * Notify that |who| has changed its tethering state. 48ab6439b0f8dd0a67c81235a3fc4d9c149de3780dErik Kline * 49ab6439b0f8dd0a67c81235a3fc4d9c149de3780dErik Kline * TODO: Remove the need for the |who| argument. 50d985dde8ccfd38a50377a8ab2378b36c92b0d7c7Christopher Wiley * 51d985dde8ccfd38a50377a8ab2378b36c92b0d7c7Christopher Wiley * @param who corresponding instance of a TetherInterfaceStateMachine 52d985dde8ccfd38a50377a8ab2378b36c92b0d7c7Christopher Wiley * @param state one of IControlsTethering.STATE_* 53d985dde8ccfd38a50377a8ab2378b36c92b0d7c7Christopher Wiley * @param lastError one of ConnectivityManager.TETHER_ERROR_* 54d985dde8ccfd38a50377a8ab2378b36c92b0d7c7Christopher Wiley */ 55ab6439b0f8dd0a67c81235a3fc4d9c149de3780dErik Kline public void updateInterfaceState(TetherInterfaceStateMachine who, int state, int lastError) {} 56ab6439b0f8dd0a67c81235a3fc4d9c149de3780dErik Kline 57ab6439b0f8dd0a67c81235a3fc4d9c149de3780dErik Kline /** 58ab6439b0f8dd0a67c81235a3fc4d9c149de3780dErik Kline * Notify that |who| has new LinkProperties. 59ab6439b0f8dd0a67c81235a3fc4d9c149de3780dErik Kline * 60ab6439b0f8dd0a67c81235a3fc4d9c149de3780dErik Kline * TODO: Remove the need for the |who| argument. 61ab6439b0f8dd0a67c81235a3fc4d9c149de3780dErik Kline * 62ab6439b0f8dd0a67c81235a3fc4d9c149de3780dErik Kline * @param who corresponding instance of a TetherInterfaceStateMachine 63ab6439b0f8dd0a67c81235a3fc4d9c149de3780dErik Kline * @param newLp the new LinkProperties to report 64ab6439b0f8dd0a67c81235a3fc4d9c149de3780dErik Kline */ 65ab6439b0f8dd0a67c81235a3fc4d9c149de3780dErik Kline public void updateLinkProperties(TetherInterfaceStateMachine who, LinkProperties newLp) {} 667040b4ebdfc9d4de5c240db6cde9fc245fb7a696Mitchell Wills} 67