1/* 2 * Copyright (C) 2014 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 17package com.android.tv.settings.connectivity; 18 19import android.net.IpConfiguration; 20import android.net.wifi.WifiManager; 21import android.os.Parcelable; 22 23/** 24 * Provide unified interface for network configuration that works for both Wi-Fi and Ethernet. 25 */ 26public interface NetworkConfiguration { 27 28 /** 29 * Set IpConfiguration 30 * 31 * @param configuration IpConfiguration to set 32 */ 33 public void setIpConfiguration(IpConfiguration configuration); 34 35 /** 36 * Get IpConfiguration 37 * 38 * @return IpConfiguration 39 */ 40 public IpConfiguration getIpConfiguration(); 41 42 /** 43 * Save current network configuration to system 44 * 45 * @param listener listener to notify the result 46 */ 47 public void save(WifiManager.ActionListener listener); 48 49 /** 50 * Get printable name for this network. 51 * 52 * @return Printable name 53 */ 54 public String getPrintableName(); 55 56 /** 57 * Get parcelable for this configuration 58 * 59 * @return Parcelable 60 */ 61 public Parcelable toParcelable(); 62 63 /** 64 * Set values from a parcelable 65 * 66 * @param Parcelable 67 */ 68 public void fromParcelable(Parcelable parcelable); 69 70 /** 71 * Get network type for this configuration defined in ConnectivityManager 72 */ 73 public int getNetworkType(); 74} 75