1 package com.android.server.wifi.anqp; 2 3 import java.net.ProtocolException; 4 import java.nio.ByteBuffer; 5 import java.util.Arrays; 6 7 /** 8 * The HS Capability list vendor specific ANQP Element, 9 * Wi-Fi Alliance Hotspot 2.0 (Release 2) Technical Specification - Version 5.00, 10 * section 4.2 11 */ 12 public class HSCapabilityListElement extends ANQPElement { 13 private final Constants.ANQPElementType[] mCapabilities; 14 15 public HSCapabilityListElement(Constants.ANQPElementType infoID, ByteBuffer payload) 16 throws ProtocolException { 17 super(infoID); 18 19 mCapabilities = new Constants.ANQPElementType[payload.remaining()]; 20 21 int index = 0; 22 while (payload.hasRemaining()) { 23 int capID = payload.get() & Constants.BYTE_MASK; 24 Constants.ANQPElementType capability = Constants.mapHS20Element(capID); 25 if (capability == null) { 26 throw new ProtocolException("Unknown capability: " + capID); 27 } 28 mCapabilities[index++] = capability; 29 } 30 } 31 32 public Constants.ANQPElementType[] getCapabilities() { 33 return mCapabilities; 34 } 35 36 @Override 37 public String toString() { 38 return "HSCapabilityList{" + 39 "mCapabilities=" + Arrays.toString(mCapabilities) + 40 '}'; 41 } 42 } 43