1package com.android.hotspot2.osu.commands; 2 3import android.net.wifi.PasspointManagementObjectDefinition; 4 5import com.android.hotspot2.omadm.MOTree; 6import com.android.hotspot2.omadm.OMAConstants; 7import com.android.hotspot2.omadm.OMAParser; 8import com.android.hotspot2.omadm.XMLNode; 9 10import org.xml.sax.SAXException; 11 12import java.io.IOException; 13 14public class MOData implements OSUCommandData { 15 private final String mBaseURI; 16 private final String mURN; 17 private final MOTree mMOTree; 18 19 public MOData(XMLNode root) { 20 mBaseURI = root.getAttributeValue("spp:managementTreeURI"); 21 mURN = root.getAttributeValue("spp:moURN"); 22 mMOTree = root.getMOTree(); 23 } 24 25 public MOData(PasspointManagementObjectDefinition moDef) throws IOException, SAXException { 26 mBaseURI = ""; //moDef.getmBaseUri(); 27 mURN = ""; // moDef.getmUrn(); 28 /* 29 OMAParser omaParser = new OMAParser(); 30 mMOTree = omaParser.parse(moDef.getmMoTree(), OMAConstants.PPS_URN); 31 */ 32 mMOTree = null; 33 } 34 35 public String getBaseURI() { 36 return mBaseURI; 37 } 38 39 public String getURN() { 40 return mURN; 41 } 42 43 public MOTree getMOTree() { 44 return mMOTree; 45 } 46 47 @Override 48 public String toString() { 49 return "Base URI: " + mBaseURI + ", MO: " + mMOTree; 50 } 51} 52