devsound/devsoundrefplugin/src/server/Policy/MdaHwInfo.cpp
changeset 0 40261b775718
equal deleted inserted replaced
-1:000000000000 0:40261b775718
       
     1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include "MdaHwInfo.h"
       
    17 #include <e32svr.h>
       
    18 
       
    19 #ifndef SYMBIAN_MDF_SHAREDCHUNK_SOUNDDRIVER
       
    20 	_LIT(KPddFileName,"ESDRV.PDD");
       
    21 	_LIT(KLddFileName,"ESOUND.LDD");
       
    22 #endif
       
    23 
       
    24 CMdaHwInfo::~CMdaHwInfo()
       
    25 	{
       
    26 	}
       
    27 
       
    28 void CMdaHwInfo::ConstructL()
       
    29 	{
       
    30 	GetHwInfoL();
       
    31 	}
       
    32 
       
    33 CMdaHwInfo* CMdaHwInfo::NewL()
       
    34 	{	
       
    35 	CMdaHwInfo* self = new(ELeave)CMdaHwInfo();
       
    36 	CleanupStack::PushL(self);
       
    37 	self->ConstructL();
       
    38 	CleanupStack::Pop();
       
    39 	return(self);
       
    40 	}
       
    41 
       
    42 CMdaHwInfo::CMdaHwInfo()
       
    43 	{
       
    44 	}
       
    45 
       
    46 void CMdaHwInfo::GetHwInfoL()
       
    47 	{
       
    48 //#ifdef __WINS__ @@@ Sound drivers must be present!!!
       
    49 #ifndef SYMBIAN_MDF_SHAREDCHUNK_SOUNDDRIVER
       
    50 	TInt ret = User::LoadPhysicalDevice(KPddFileName);
       
    51 	if ((ret!=KErrNone) && (ret!=KErrAlreadyExists))
       
    52 		User::Leave(ret);
       
    53 	ret = User::LoadLogicalDevice(KLddFileName);
       
    54 	if ((ret!=KErrNone) && (ret!=KErrAlreadyExists))
       
    55 		User::Leave(ret);
       
    56 #endif//Adapter loads the drivers too.
       
    57 	User::LeaveIfError(iDevice.Open());
       
    58 	if (!iDevice.Handle())
       
    59 		User::Leave(KErrBadHandle);
       
    60 
       
    61 	iDevice.PlayFormatsSupported(iPlayFormatsSupported);
       
    62 	iDevice.GetPlayFormat(iPlayFormat);
       
    63 	iDevice.RecordFormatsSupported(iRecordFormatsSupported);
       
    64 	iDevice.GetRecordFormat(iRecordFormat);
       
    65 
       
    66 	iDevice.Close();
       
    67 
       
    68 //#endif
       
    69 
       
    70 	}