/* 
 * Copyright 2012 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.sax;

import de.avm.android.tr064.Tr064Capabilities;

/*
 * SAX-Handler for FRITZ!Box X_AVM-DE_OnTel1 description
 */
public class SAXOnTelScpdHandler extends SAXScpdHandler
{
	public boolean isCapabilitiyOfInterface(Tr064Capabilities cap)
	{
		return cap.has(Tr064Capabilities.Capability.CALLLIST) ||
				cap.has(Tr064Capabilities.Capability.PHONEBOOK);
	}
	
	/**
	 * Instantiates a new sAX FRITZ!Box X_AVM-DE_OnTel1 description handler.
	 */
	public SAXOnTelScpdHandler()
	{
		initActionsArray(new String[]
		{
			"GetCallList",
			"GetPhonebookList",
			"GetPhonebook"
		});
	}

	@Override
	public Tr064Capabilities getCapabilities()
	{
		Tr064Capabilities result = new Tr064Capabilities();
		
		if (mActions[0].mIsAvailable)
			result.add(Tr064Capabilities.Capability.CALLLIST);
		if (mActions[1].mIsAvailable && mActions[2].mIsAvailable)
			result.add(Tr064Capabilities.Capability.PHONEBOOK);
		
		return result;
	}
}
