/* 
 * Copyright 2014 by AVM GmbH <info@avm.de>
 *
 * This software contains free software; you can redistribute it and/or modify 
 * it under the terms of the GNU General Public License ("License") as 
 * published by the Free Software Foundation  (version 3 of the License). 
 * This software is distributed in the hope that it will be useful, but 
 * WITHOUT ANY WARRANTY; without even the implied warranty of 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the copy of the 
 * License you received along with this software for more details.
 */

package de.avm.android.tr064.soap.myfritz;

import java.io.IOException;
import de.avm.android.tr064.exceptions.BaseException;
import de.avm.android.tr064.exceptions.DataMisformatException;
import de.avm.android.tr064.model.MyFritzInfo;
import de.avm.android.tr064.soap.ISoapCredentials;

public class GetInfo extends MyFritzSoapHelper<MyFritzInfo>
{
	public GetInfo(ISoapCredentials soapCredentials)
	{
		super(soapCredentials);
	}

	@Override
	public MyFritzInfo getQualifiedResult()
			throws DataMisformatException, BaseException, IOException
	{
		String input = getSoapBody();

		MyFritzInfo fritzInfo = new MyFritzInfo();
		fritzInfo.setEnabled(getBooleanByName("NewEnabled", input));
		fritzInfo.setDynDNSName(getValueByName("NewDynDNSName", input));
		fritzInfo.setPort(getIntByName("NewPort", input));
		fritzInfo.setDeviceRegistered(getBooleanByName("NewDeviceRegistered", input));

		return fritzInfo;
	}

	@Override
	public String getSoapMethod()
	{
		return "GetInfo";
	}
}