NetworkUpdateResult.java revision cdd56a55709407c9efe2a24b4ed25666e2e8318e
1/*
2 * Copyright (C) 2010 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.server.wifi;
18
19import static android.net.wifi.WifiConfiguration.INVALID_NETWORK_ID;
20
21public class NetworkUpdateResult {
22    int netId;
23    boolean ipChanged;
24    boolean proxyChanged;
25    boolean credentialChanged;
26    boolean isNewNetwork = false;
27
28    public NetworkUpdateResult(int id) {
29        netId = id;
30        ipChanged = false;
31        proxyChanged = false;
32        credentialChanged = false;
33    }
34
35    public NetworkUpdateResult(boolean ip, boolean proxy, boolean credential) {
36        netId = INVALID_NETWORK_ID;
37        ipChanged = ip;
38        proxyChanged = proxy;
39        credentialChanged = credential;
40    }
41
42    public void setNetworkId(int id) {
43        netId = id;
44    }
45
46    public int getNetworkId() {
47        return netId;
48    }
49
50    public boolean hasIpChanged() {
51        return ipChanged;
52    }
53
54    public boolean hasProxyChanged() {
55        return proxyChanged;
56    }
57
58    public boolean hasCredentialChanged() {
59        return credentialChanged;
60    }
61
62    public boolean isNewNetwork() {
63        return isNewNetwork;
64    }
65
66    public void setIsNewNetwork(boolean isNew) {
67        isNewNetwork = isNew;
68    }
69
70    public boolean isSuccess() {
71        return netId != INVALID_NETWORK_ID;
72    }
73
74}
75