os/mm/mmresourcemgmt/mmresctrl/src/mmrcclient/mmrcclient.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/mmresourcemgmt/mmresctrl/src/mmrcclient/mmrcclient.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,248 @@
     1.4 +//mmrcclient.cpp
     1.5 +
     1.6 +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.7 +// All rights reserved.
     1.8 +// This component and the accompanying materials are made available
     1.9 +// under the terms of "Eclipse Public License v1.0"
    1.10 +// which accompanies this distribution, and is available
    1.11 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.12 +//
    1.13 +// Initial Contributors:
    1.14 +// Nokia Corporation - initial contribution.
    1.15 +//
    1.16 +// Contributors:
    1.17 +//
    1.18 +// Description:
    1.19 +//
    1.20 +
    1.21 +#include "mmrcclient.h"
    1.22 +#include "mmrcclientimplementation.h"
    1.23 +#include "audiocontext.h"
    1.24 +#include <a3f/a3f_trace_utils.h>
    1.25 +
    1.26 +/**
    1.27 + * 
    1.28 + */
    1.29 +EXPORT_C RMMRCClient::RMMRCClient():
    1.30 +		iImplementation(NULL)
    1.31 +	{
    1.32 +	TRACE_CREATE();
    1.33 +	DP_CONTEXT(----> RMMRCClient::RMMRCClient *CD1*, CtxDevSound, DPLOCAL);
    1.34 +	DP_IN();
    1.35 +	DP_OUT();
    1.36 +	}
    1.37 +
    1.38 +/**
    1.39 + * 
    1.40 + */
    1.41 +EXPORT_C RMMRCClient::~RMMRCClient()
    1.42 +	{
    1.43 +	DP_CONTEXT(----> RMMRCClient::~RMMRCClient *CD1*, CtxDevSound, DPLOCAL);
    1.44 +	DP_IN();
    1.45 +	delete iImplementation;
    1.46 +	iImplementation = NULL;
    1.47 +	DP_OUT();
    1.48 +	}
    1.49 +
    1.50 +/**
    1.51 + * 
    1.52 + */
    1.53 +EXPORT_C TInt RMMRCClient::Open(MMultimediaResourceControlObserver& aCallback)
    1.54 +	{
    1.55 +	DP_CONTEXT(----> RMMRCClient::Open *CD1*, CtxDevSound, DPLOCAL);
    1.56 +	DP_IN();
    1.57 +	TInt err = KErrNone;
    1.58 +
    1.59 +	if(iImplementation)
    1.60 +		{
    1.61 +		#ifdef _DEBUG	
    1.62 +			RDebug::Print(_L("!!!!RMMRCClient::Open -  iImplementation already created"));
    1.63 +		#endif
    1.64 +		DP0_RET(KErrCompletion, "error = %d");
    1.65 +		}
    1.66 +		
    1.67 +	TRAP( err, iImplementation = CMMRCClientImplementation::NewL(aCallback) );
    1.68 +	if(err)
    1.69 +		{
    1.70 +		Close();
    1.71 +		}
    1.72 +	DP0_RET(err, "error = %d");
    1.73 +	}
    1.74 +
    1.75 +/**
    1.76 + * 
    1.77 + */
    1.78 +EXPORT_C void RMMRCClient::Close()
    1.79 +	{
    1.80 +	DP_CONTEXT(----> RMMRCClient::Close *CD1*, CtxDevSound, DPLOCAL);
    1.81 +	DP_IN();
    1.82 +	
    1.83 +	#ifdef _DEBUG	
    1.84 +	if(	NULL == iImplementation )
    1.85 +		{
    1.86 +		RDebug::Print(_L("!!!!RMMRCClient::Close -  iImplementation NULL"));
    1.87 +		}
    1.88 +	#endif
    1.89 +	
    1.90 +	if(iImplementation)
    1.91 +		{
    1.92 +		iImplementation->Close();
    1.93 +		delete iImplementation;
    1.94 +		iImplementation = NULL;
    1.95 +		}
    1.96 +	
    1.97 +	DP_OUT();
    1.98 +	}
    1.99 +
   1.100 +/**
   1.101 + * 
   1.102 + */
   1.103 +EXPORT_C TUint64 RMMRCClient::LogOn(TProcessId aProcessId)
   1.104 +	{
   1.105 +	DP_CONTEXT(----> RMMRCClient::LogOn *CD1*, CtxDevSound, DPLOCAL);
   1.106 +	DP_IN();
   1.107 +	
   1.108 +	#ifdef _DEBUG	
   1.109 +	if(	NULL == iImplementation )
   1.110 +		{
   1.111 +		RDebug::Print(_L("!!!!RMMRCClient::LogOn -  iImplementation NULL"));
   1.112 +		}
   1.113 +	#endif
   1.114 +
   1.115 +	TUint64 contextId = 0;
   1.116 +	if(iImplementation)
   1.117 +		{
   1.118 +		contextId = iImplementation->LogOn(aProcessId);
   1.119 +		}
   1.120 +	
   1.121 +	DP0_RET(contextId, "contextId = %d");
   1.122 +	}
   1.123 +
   1.124 +/**
   1.125 + * 
   1.126 + */
   1.127 +EXPORT_C TInt RMMRCClient::SendResourceRequest(MLogicalChain* aLogicalChainLastCommited, MLogicalChain* aLogicalChainRequested, CAudioContext* aContext)
   1.128 +	{
   1.129 +	DP_CONTEXT(----> RMMRCClient::SendResourceRequest *CD1*, CtxDevSound, DPLOCAL);
   1.130 +	DP_IN();
   1.131 +
   1.132 +	if(	NULL == iImplementation )
   1.133 +		{
   1.134 +		#ifdef _DEBUG	
   1.135 +			RDebug::Print(_L("!!!!RMMRCClient::SendResourceRequest -  iImplementation NULL"));
   1.136 +		#endif
   1.137 +		DP0_RET(KErrCompletion, "error = %d");
   1.138 +		}
   1.139 +	
   1.140 +	TInt error = iImplementation->SendResourceRequest(aLogicalChainLastCommited, aLogicalChainRequested, aContext);
   1.141 +
   1.142 +	DP0_RET(error, "error = %d");
   1.143 +	}
   1.144 +
   1.145 +/**
   1.146 + * 
   1.147 + */
   1.148 +EXPORT_C TInt RMMRCClient::SendResourceConfirmation()
   1.149 +	{
   1.150 +	DP_CONTEXT(----> RMMRCClient::SendResourceConfirmation *CD1*, CtxDevSound, DPLOCAL);
   1.151 +	DP_IN();
   1.152 +	TInt err = KErrNotSupported;
   1.153 +	DP0_RET(err, "%d");
   1.154 +	}
   1.155 +
   1.156 +/**
   1.157 + * 
   1.158 + */
   1.159 +EXPORT_C TInt RMMRCClient::SendResourceUpdateResult()
   1.160 +	{
   1.161 +	DP_CONTEXT(----> RMMRCClient::SendResourceUpdateResult *CD1*, CtxDevSound, DPLOCAL);
   1.162 +	DP_IN();
   1.163 +	TInt err = KErrNotSupported;
   1.164 +	DP0_RET(err, "%d");
   1.165 +	}
   1.166 +
   1.167 +/**
   1.168 + * 
   1.169 + */
   1.170 +EXPORT_C TInt RMMRCClient::SendResourceErrorNotification()
   1.171 +	{
   1.172 +	DP_CONTEXT(----> RMMRCClient::SendResourceErrorNotification *CD1*, CtxDevSound, DPLOCAL);
   1.173 +	DP_IN();
   1.174 +	DP_IN();
   1.175 +	TInt err = KErrNotSupported;
   1.176 +	DP0_RET(err, "%d");
   1.177 +	}
   1.178 +
   1.179 +/**
   1.180 + * 
   1.181 + */
   1.182 +EXPORT_C TInt RMMRCClient::RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData)
   1.183 +	{
   1.184 +	DP_CONTEXT(RMMRCClient::RegisterAsClient *CD1*, CtxDevSound, DPLOCAL);
   1.185 +	DP_IN();
   1.186 +	
   1.187 +		if(	NULL == iImplementation )
   1.188 +		{
   1.189 +		#ifdef _DEBUG	
   1.190 +			RDebug::Print(_L("!!!!RMMRCClient::RegisterAsClient -  iImplementation NULL"));
   1.191 +		#endif
   1.192 +		DP0_RET(KErrCompletion, "error = %d");
   1.193 +		}
   1.194 +	
   1.195 +	TInt err = iImplementation->RegisterAsClient(aEventType, aNotificationRegistrationData);
   1.196 +	
   1.197 +	DP0_RET(err, "%d");
   1.198 +	}
   1.199 +
   1.200 +/**
   1.201 + * 
   1.202 + */
   1.203 +EXPORT_C TInt RMMRCClient::CancelRegisterAsClient(TUid aEventType)
   1.204 +	{
   1.205 +	DP_CONTEXT(RMMRCClient::CancelRegisterAsClient *CD1*, CtxDevSound, DPLOCAL);
   1.206 +	DP_IN();
   1.207 +	
   1.208 +		if(	NULL == iImplementation )
   1.209 +		{
   1.210 +		#ifdef _DEBUG	
   1.211 +			RDebug::Print(_L("!!!!RMMRCClient::CancelRegisterAsClient -  iImplementation NULL"));
   1.212 +		#endif
   1.213 +		DP0_RET(KErrCompletion, "error = %d");
   1.214 +		}
   1.215 +	
   1.216 +	TInt err = iImplementation->CancelRegisterAsClient(aEventType);
   1.217 +	
   1.218 +	DP0_RET(err, "%d");
   1.219 +	}
   1.220 +	
   1.221 +/**
   1.222 + * 
   1.223 + */
   1.224 +EXPORT_C TInt RMMRCClient::WillResumePlay()
   1.225 +	{
   1.226 +	DP_CONTEXT(RMMRCClient::WillResumePlay *CD1*, CtxDevSound, DPLOCAL);
   1.227 +	DP_IN();
   1.228 +	
   1.229 +		if(	NULL == iImplementation )
   1.230 +		{
   1.231 +		#ifdef _DEBUG	
   1.232 +			RDebug::Print(_L("!!!!RMMRCClient::WillResumePlay -  iImplementation NULL"));
   1.233 +		#endif
   1.234 +		DP0_RET(KErrCompletion, "error = %d");
   1.235 +		}
   1.236 +	
   1.237 +	TInt err = iImplementation->WillResumePlay();
   1.238 +	
   1.239 +	DP0_RET(err, "%d");
   1.240 +	}
   1.241 +	
   1.242 +EXPORT_C void RMMRCClient::ResetMessages()
   1.243 +	{
   1.244 +	DP_CONTEXT(RMMRCClient::ResetMessages *CD1*, CtxDevSound, DPLOCAL);
   1.245 +	DP_IN();
   1.246 +	
   1.247 +	iImplementation->ResetMessages();
   1.248 +	
   1.249 +	DP_OUT();
   1.250 +	}
   1.251 +//EOF