Home | History | Annotate | Download | only in hotspot2
      1 /*
      2  * Copyright (C) 2016 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.hotspot2;
     18 
     19 import com.android.server.wifi.hotspot2.anqp.ANQPElement;
     20 import com.android.server.wifi.hotspot2.anqp.Constants;
     21 
     22 import java.util.HashMap;
     23 import java.util.Map;
     24 
     25 /**
     26  * This class carries the response of an ANQP request.
     27  */
     28 public class AnqpEvent {
     29     private static final String TAG = "AnqpEvent";
     30     private static final Map<String, Constants.ANQPElementType> sWpsNames = new HashMap<>();
     31 
     32     static {
     33         sWpsNames.put("anqp_venue_name", Constants.ANQPElementType.ANQPVenueName);
     34         sWpsNames.put("anqp_roaming_consortium", Constants.ANQPElementType.ANQPRoamingConsortium);
     35         sWpsNames.put("anqp_ip_addr_type_availability",
     36                 Constants.ANQPElementType.ANQPIPAddrAvailability);
     37         sWpsNames.put("anqp_nai_realm", Constants.ANQPElementType.ANQPNAIRealm);
     38         sWpsNames.put("anqp_3gpp", Constants.ANQPElementType.ANQP3GPPNetwork);
     39         sWpsNames.put("anqp_domain_name", Constants.ANQPElementType.ANQPDomName);
     40         sWpsNames.put("hs20_operator_friendly_name", Constants.ANQPElementType.HSFriendlyName);
     41         sWpsNames.put("hs20_wan_metrics", Constants.ANQPElementType.HSWANMetrics);
     42         sWpsNames.put("hs20_connection_capability", Constants.ANQPElementType.HSConnCapability);
     43         sWpsNames.put("hs20_osu_providers_list", Constants.ANQPElementType.HSOSUProviders);
     44     }
     45 
     46     /**
     47      * Bssid of the access point.
     48      */
     49     private final long mBssid;
     50 
     51     /**
     52      * Map of ANQP element type to the data retrieved from the access point.
     53      */
     54     private final Map<Constants.ANQPElementType, ANQPElement> mElements;
     55 
     56     public AnqpEvent(long bssid, Map<Constants.ANQPElementType, ANQPElement> elements) {
     57         mBssid = bssid;
     58         mElements = elements;
     59     }
     60 
     61     /**
     62      * Get the bssid of the access point from which this ANQP result was created.
     63      */
     64     public long getBssid() {
     65         return mBssid;
     66     }
     67 
     68     /**
     69      * Get the map of ANQP elements retrieved from the access point.
     70      */
     71     public Map<Constants.ANQPElementType, ANQPElement> getElements() {
     72         return mElements;
     73     }
     74 
     75 }
     76