summaryrefslogtreecommitdiffstats
path: root/service/java/com/android/server/wifi/hotspot2/AnqpEvent.java
blob: 0fe8a3a250a18f5eb02b012247c7fae211f608c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
 * Copyright (C) 2016 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.server.wifi.hotspot2;

import com.android.server.wifi.hotspot2.anqp.ANQPElement;
import com.android.server.wifi.hotspot2.anqp.Constants;

import java.util.HashMap;
import java.util.Map;

/**
 * This class carries the response of an ANQP request.
 */
public class AnqpEvent {
    private static final String TAG = "AnqpEvent";
    private static final Map<String, Constants.ANQPElementType> sWpsNames = new HashMap<>();

    static {
        sWpsNames.put("anqp_venue_name", Constants.ANQPElementType.ANQPVenueName);
        sWpsNames.put("anqp_roaming_consortium", Constants.ANQPElementType.ANQPRoamingConsortium);
        sWpsNames.put("anqp_ip_addr_type_availability",
                Constants.ANQPElementType.ANQPIPAddrAvailability);
        sWpsNames.put("anqp_nai_realm", Constants.ANQPElementType.ANQPNAIRealm);
        sWpsNames.put("anqp_3gpp", Constants.ANQPElementType.ANQP3GPPNetwork);
        sWpsNames.put("anqp_domain_name", Constants.ANQPElementType.ANQPDomName);
        sWpsNames.put("hs20_operator_friendly_name", Constants.ANQPElementType.HSFriendlyName);
        sWpsNames.put("hs20_wan_metrics", Constants.ANQPElementType.HSWANMetrics);
        sWpsNames.put("hs20_connection_capability", Constants.ANQPElementType.HSConnCapability);
        sWpsNames.put("hs20_osu_providers_list", Constants.ANQPElementType.HSOSUProviders);
    }

    /**
     * Bssid of the access point.
     */
    private final long mBssid;

    /**
     * Map of ANQP element type to the data retrieved from the access point.
     */
    private final Map<Constants.ANQPElementType, ANQPElement> mElements;

    public AnqpEvent(long bssid, Map<Constants.ANQPElementType, ANQPElement> elements) {
        mBssid = bssid;
        mElements = elements;
    }

    /**
     * Get the bssid of the access point from which this ANQP result was created.
     */
    public long getBssid() {
        return mBssid;
    }

    /**
     * Get the map of ANQP elements retrieved from the access point.
     */
    public Map<Constants.ANQPElementType, ANQPElement> getElements() {
        return mElements;
    }

}