1 /*
2  * Copyright (C) 2011 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 import android.net.wifi.SupplicantState;
21 import android.net.wifi.WifiSsid;
22 
23 import java.util.Objects;
24 
25 /**
26  * Stores supplicant state change information passed from WifiMonitor to
27  * a state machine. ClientModeImpl, SupplicantStateTracker and WpsStateMachine
28  * are example state machines that handle it.
29  */
30 public class StateChangeResult {
StateChangeResult(int networkId, @NonNull WifiSsid wifiSsid, @NonNull String bssid, SupplicantState state)31     StateChangeResult(int networkId, @NonNull WifiSsid wifiSsid, @NonNull String bssid,
32             SupplicantState state) {
33         this.state = state;
34         this.wifiSsid = Objects.requireNonNull(wifiSsid);
35         this.bssid = Objects.requireNonNull(bssid);
36         this.networkId = networkId;
37     }
38 
39     public final int networkId;
40     @NonNull public final WifiSsid wifiSsid;
41     @NonNull public final String bssid;
42     public final SupplicantState state;
43 
44     @Override
toString()45     public String toString() {
46         StringBuffer sb = new StringBuffer();
47         sb.append(" ssid: ").append(wifiSsid);
48         sb.append(" bssid: ").append(bssid);
49         sb.append(" nid: ").append(networkId);
50         sb.append(" state: ").append(state);
51         return sb.toString();
52     }
53 }
54