sl@0: // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0: // All rights reserved.
sl@0: // This component and the accompanying materials are made available
sl@0: // under the terms of "Eclipse Public License v1.0"
sl@0: // which accompanies this distribution, and is available
sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0: //
sl@0: // Initial Contributors:
sl@0: // Nokia Corporation - initial contribution.
sl@0: //
sl@0: // Contributors:
sl@0: //
sl@0: // Description:
sl@0: //
sl@0: 
sl@0: #include "MdaHwInfo.h"
sl@0: #include <e32svr.h>
sl@0: 
sl@0: #ifndef SYMBIAN_MDF_SHAREDCHUNK_SOUNDDRIVER
sl@0: 	_LIT(KPddFileName,"ESDRV.PDD");
sl@0: 	_LIT(KLddFileName,"ESOUND.LDD");
sl@0: #endif
sl@0: 
sl@0: CMdaHwInfo::~CMdaHwInfo()
sl@0: 	{
sl@0: 	}
sl@0: 
sl@0: void CMdaHwInfo::ConstructL()
sl@0: 	{
sl@0: 	GetHwInfoL();
sl@0: 	}
sl@0: 
sl@0: CMdaHwInfo* CMdaHwInfo::NewL()
sl@0: 	{	
sl@0: 	CMdaHwInfo* self = new(ELeave)CMdaHwInfo();
sl@0: 	CleanupStack::PushL(self);
sl@0: 	self->ConstructL();
sl@0: 	CleanupStack::Pop();
sl@0: 	return(self);
sl@0: 	}
sl@0: 
sl@0: CMdaHwInfo::CMdaHwInfo()
sl@0: 	{
sl@0: 	}
sl@0: 
sl@0: void CMdaHwInfo::GetHwInfoL()
sl@0: 	{
sl@0: //#ifdef __WINS__ @@@ Sound drivers must be present!!!
sl@0: #ifndef SYMBIAN_MDF_SHAREDCHUNK_SOUNDDRIVER
sl@0: 	TInt ret = User::LoadPhysicalDevice(KPddFileName);
sl@0: 	if ((ret!=KErrNone) && (ret!=KErrAlreadyExists))
sl@0: 		User::Leave(ret);
sl@0: 	ret = User::LoadLogicalDevice(KLddFileName);
sl@0: 	if ((ret!=KErrNone) && (ret!=KErrAlreadyExists))
sl@0: 		User::Leave(ret);
sl@0: #endif//Adapter loads the drivers too.
sl@0: 	User::LeaveIfError(iDevice.Open());
sl@0: 	if (!iDevice.Handle())
sl@0: 		User::Leave(KErrBadHandle);
sl@0: 
sl@0: 	iDevice.PlayFormatsSupported(iPlayFormatsSupported);
sl@0: 	iDevice.GetPlayFormat(iPlayFormat);
sl@0: 	iDevice.RecordFormatsSupported(iRecordFormatsSupported);
sl@0: 	iDevice.GetRecordFormat(iRecordFormat);
sl@0: 
sl@0: 	iDevice.Close();
sl@0: 
sl@0: //#endif
sl@0: 
sl@0: 	}