1 /*
2  * Copyright (C) 2018 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.car.settings.wifi.details;
18 
19 import android.net.LinkProperties;
20 import android.net.Network;
21 import android.net.NetworkCapabilities;
22 import android.net.NetworkInfo;
23 import android.net.wifi.WifiConfiguration;
24 import android.net.wifi.WifiInfo;
25 
26 import androidx.lifecycle.LifecycleObserver;
27 
28 /**
29  * Provides Wifi related info.
30  */
31 public interface WifiInfoProvider extends LifecycleObserver {
32     /**
33      * Observers of Wifi info changes.
34      */
35     public interface Listener {
36         /**
37          * Called when NetworkInfo and/or WifiInfo is changed.
38          */
onWifiChanged(NetworkInfo networkInfo, WifiInfo wifiInfo)39         void onWifiChanged(NetworkInfo networkInfo, WifiInfo wifiInfo);
40 
41         /**
42          * Called when network is lost.
43          */
onLost(Network network)44         void onLost(Network network);
45 
46         /**
47          * Called when NetworkCapabilities changed.
48          */
onCapabilitiesChanged(Network network, NetworkCapabilities nc)49         void onCapabilitiesChanged(Network network, NetworkCapabilities nc);
50 
51         /**
52          * Called when WifiConfiguration changed.
53          */
onWifiConfigurationChanged(WifiConfiguration wifiConfiguration, NetworkInfo networkInfo, WifiInfo wifiInfo)54         void onWifiConfigurationChanged(WifiConfiguration wifiConfiguration,
55                 NetworkInfo networkInfo, WifiInfo wifiInfo);
56 
57         /**
58          * Called when LinkProperties changed.
59          */
onLinkPropertiesChanged(Network network, LinkProperties lp)60         void onLinkPropertiesChanged(Network network, LinkProperties lp);
61     }
62 
63     /**
64      * Adds the listener.
65      */
addListener(Listener listener)66     void addListener(Listener listener);
67 
68     /**
69      * Removes the listener.
70      */
removeListener(Listener listener)71     void removeListener(Listener listener);
72 
73     /**
74      * Removes all listeners.
75      */
clearListeners()76     void clearListeners();
77 
78     /**
79      * Getter for NetworkInfo
80      */
getNetworkInfo()81     NetworkInfo getNetworkInfo();
82 
83     /**
84      * Getter for WifiInfo
85      */
getWifiInfo()86     WifiInfo getWifiInfo();
87 
88     /**
89      * Getter for Network
90      */
getNetwork()91     Network getNetwork();
92 
93     /**
94      * Getter for NetworkCapabilities.
95      */
getNetworkCapabilities()96     NetworkCapabilities getNetworkCapabilities();
97 
98     /**
99      * Getter for NetworkConfiguration.
100      */
getNetworkConfiguration()101     WifiConfiguration getNetworkConfiguration();
102 
103     /**
104      * Getter for LinkProperties.
105      */
getLinkProperties()106     LinkProperties getLinkProperties();
107 }
108