mmresourcemgmt/mmresctrl/src/mmrcclient/mmrcclient.cpp
changeset 0 40261b775718
equal deleted inserted replaced
-1:000000000000 0:40261b775718
       
     1 //mmrcclient.cpp
       
     2 
       
     3 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     4 // All rights reserved.
       
     5 // This component and the accompanying materials are made available
       
     6 // under the terms of "Eclipse Public License v1.0"
       
     7 // which accompanies this distribution, and is available
       
     8 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     9 //
       
    10 // Initial Contributors:
       
    11 // Nokia Corporation - initial contribution.
       
    12 //
       
    13 // Contributors:
       
    14 //
       
    15 // Description:
       
    16 //
       
    17 
       
    18 #include "mmrcclient.h"
       
    19 #include "mmrcclientimplementation.h"
       
    20 #include "audiocontext.h"
       
    21 #include <a3f/a3f_trace_utils.h>
       
    22 
       
    23 /**
       
    24  * 
       
    25  */
       
    26 EXPORT_C RMMRCClient::RMMRCClient():
       
    27 		iImplementation(NULL)
       
    28 	{
       
    29 	TRACE_CREATE();
       
    30 	DP_CONTEXT(----> RMMRCClient::RMMRCClient *CD1*, CtxDevSound, DPLOCAL);
       
    31 	DP_IN();
       
    32 	DP_OUT();
       
    33 	}
       
    34 
       
    35 /**
       
    36  * 
       
    37  */
       
    38 EXPORT_C RMMRCClient::~RMMRCClient()
       
    39 	{
       
    40 	DP_CONTEXT(----> RMMRCClient::~RMMRCClient *CD1*, CtxDevSound, DPLOCAL);
       
    41 	DP_IN();
       
    42 	delete iImplementation;
       
    43 	iImplementation = NULL;
       
    44 	DP_OUT();
       
    45 	}
       
    46 
       
    47 /**
       
    48  * 
       
    49  */
       
    50 EXPORT_C TInt RMMRCClient::Open(MMultimediaResourceControlObserver& aCallback)
       
    51 	{
       
    52 	DP_CONTEXT(----> RMMRCClient::Open *CD1*, CtxDevSound, DPLOCAL);
       
    53 	DP_IN();
       
    54 	TInt err = KErrNone;
       
    55 
       
    56 	if(iImplementation)
       
    57 		{
       
    58 		#ifdef _DEBUG	
       
    59 			RDebug::Print(_L("!!!!RMMRCClient::Open -  iImplementation already created"));
       
    60 		#endif
       
    61 		DP0_RET(KErrCompletion, "error = %d");
       
    62 		}
       
    63 		
       
    64 	TRAP( err, iImplementation = CMMRCClientImplementation::NewL(aCallback) );
       
    65 	if(err)
       
    66 		{
       
    67 		Close();
       
    68 		}
       
    69 	DP0_RET(err, "error = %d");
       
    70 	}
       
    71 
       
    72 /**
       
    73  * 
       
    74  */
       
    75 EXPORT_C void RMMRCClient::Close()
       
    76 	{
       
    77 	DP_CONTEXT(----> RMMRCClient::Close *CD1*, CtxDevSound, DPLOCAL);
       
    78 	DP_IN();
       
    79 	
       
    80 	#ifdef _DEBUG	
       
    81 	if(	NULL == iImplementation )
       
    82 		{
       
    83 		RDebug::Print(_L("!!!!RMMRCClient::Close -  iImplementation NULL"));
       
    84 		}
       
    85 	#endif
       
    86 	
       
    87 	if(iImplementation)
       
    88 		{
       
    89 		iImplementation->Close();
       
    90 		delete iImplementation;
       
    91 		iImplementation = NULL;
       
    92 		}
       
    93 	
       
    94 	DP_OUT();
       
    95 	}
       
    96 
       
    97 /**
       
    98  * 
       
    99  */
       
   100 EXPORT_C TUint64 RMMRCClient::LogOn(TProcessId aProcessId)
       
   101 	{
       
   102 	DP_CONTEXT(----> RMMRCClient::LogOn *CD1*, CtxDevSound, DPLOCAL);
       
   103 	DP_IN();
       
   104 	
       
   105 	#ifdef _DEBUG	
       
   106 	if(	NULL == iImplementation )
       
   107 		{
       
   108 		RDebug::Print(_L("!!!!RMMRCClient::LogOn -  iImplementation NULL"));
       
   109 		}
       
   110 	#endif
       
   111 
       
   112 	TUint64 contextId = 0;
       
   113 	if(iImplementation)
       
   114 		{
       
   115 		contextId = iImplementation->LogOn(aProcessId);
       
   116 		}
       
   117 	
       
   118 	DP0_RET(contextId, "contextId = %d");
       
   119 	}
       
   120 
       
   121 /**
       
   122  * 
       
   123  */
       
   124 EXPORT_C TInt RMMRCClient::SendResourceRequest(MLogicalChain* aLogicalChainLastCommited, MLogicalChain* aLogicalChainRequested, CAudioContext* aContext)
       
   125 	{
       
   126 	DP_CONTEXT(----> RMMRCClient::SendResourceRequest *CD1*, CtxDevSound, DPLOCAL);
       
   127 	DP_IN();
       
   128 
       
   129 	if(	NULL == iImplementation )
       
   130 		{
       
   131 		#ifdef _DEBUG	
       
   132 			RDebug::Print(_L("!!!!RMMRCClient::SendResourceRequest -  iImplementation NULL"));
       
   133 		#endif
       
   134 		DP0_RET(KErrCompletion, "error = %d");
       
   135 		}
       
   136 	
       
   137 	TInt error = iImplementation->SendResourceRequest(aLogicalChainLastCommited, aLogicalChainRequested, aContext);
       
   138 
       
   139 	DP0_RET(error, "error = %d");
       
   140 	}
       
   141 
       
   142 /**
       
   143  * 
       
   144  */
       
   145 EXPORT_C TInt RMMRCClient::SendResourceConfirmation()
       
   146 	{
       
   147 	DP_CONTEXT(----> RMMRCClient::SendResourceConfirmation *CD1*, CtxDevSound, DPLOCAL);
       
   148 	DP_IN();
       
   149 	TInt err = KErrNotSupported;
       
   150 	DP0_RET(err, "%d");
       
   151 	}
       
   152 
       
   153 /**
       
   154  * 
       
   155  */
       
   156 EXPORT_C TInt RMMRCClient::SendResourceUpdateResult()
       
   157 	{
       
   158 	DP_CONTEXT(----> RMMRCClient::SendResourceUpdateResult *CD1*, CtxDevSound, DPLOCAL);
       
   159 	DP_IN();
       
   160 	TInt err = KErrNotSupported;
       
   161 	DP0_RET(err, "%d");
       
   162 	}
       
   163 
       
   164 /**
       
   165  * 
       
   166  */
       
   167 EXPORT_C TInt RMMRCClient::SendResourceErrorNotification()
       
   168 	{
       
   169 	DP_CONTEXT(----> RMMRCClient::SendResourceErrorNotification *CD1*, CtxDevSound, DPLOCAL);
       
   170 	DP_IN();
       
   171 	DP_IN();
       
   172 	TInt err = KErrNotSupported;
       
   173 	DP0_RET(err, "%d");
       
   174 	}
       
   175 
       
   176 /**
       
   177  * 
       
   178  */
       
   179 EXPORT_C TInt RMMRCClient::RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData)
       
   180 	{
       
   181 	DP_CONTEXT(RMMRCClient::RegisterAsClient *CD1*, CtxDevSound, DPLOCAL);
       
   182 	DP_IN();
       
   183 	
       
   184 		if(	NULL == iImplementation )
       
   185 		{
       
   186 		#ifdef _DEBUG	
       
   187 			RDebug::Print(_L("!!!!RMMRCClient::RegisterAsClient -  iImplementation NULL"));
       
   188 		#endif
       
   189 		DP0_RET(KErrCompletion, "error = %d");
       
   190 		}
       
   191 	
       
   192 	TInt err = iImplementation->RegisterAsClient(aEventType, aNotificationRegistrationData);
       
   193 	
       
   194 	DP0_RET(err, "%d");
       
   195 	}
       
   196 
       
   197 /**
       
   198  * 
       
   199  */
       
   200 EXPORT_C TInt RMMRCClient::CancelRegisterAsClient(TUid aEventType)
       
   201 	{
       
   202 	DP_CONTEXT(RMMRCClient::CancelRegisterAsClient *CD1*, CtxDevSound, DPLOCAL);
       
   203 	DP_IN();
       
   204 	
       
   205 		if(	NULL == iImplementation )
       
   206 		{
       
   207 		#ifdef _DEBUG	
       
   208 			RDebug::Print(_L("!!!!RMMRCClient::CancelRegisterAsClient -  iImplementation NULL"));
       
   209 		#endif
       
   210 		DP0_RET(KErrCompletion, "error = %d");
       
   211 		}
       
   212 	
       
   213 	TInt err = iImplementation->CancelRegisterAsClient(aEventType);
       
   214 	
       
   215 	DP0_RET(err, "%d");
       
   216 	}
       
   217 	
       
   218 /**
       
   219  * 
       
   220  */
       
   221 EXPORT_C TInt RMMRCClient::WillResumePlay()
       
   222 	{
       
   223 	DP_CONTEXT(RMMRCClient::WillResumePlay *CD1*, CtxDevSound, DPLOCAL);
       
   224 	DP_IN();
       
   225 	
       
   226 		if(	NULL == iImplementation )
       
   227 		{
       
   228 		#ifdef _DEBUG	
       
   229 			RDebug::Print(_L("!!!!RMMRCClient::WillResumePlay -  iImplementation NULL"));
       
   230 		#endif
       
   231 		DP0_RET(KErrCompletion, "error = %d");
       
   232 		}
       
   233 	
       
   234 	TInt err = iImplementation->WillResumePlay();
       
   235 	
       
   236 	DP0_RET(err, "%d");
       
   237 	}
       
   238 	
       
   239 EXPORT_C void RMMRCClient::ResetMessages()
       
   240 	{
       
   241 	DP_CONTEXT(RMMRCClient::ResetMessages *CD1*, CtxDevSound, DPLOCAL);
       
   242 	DP_IN();
       
   243 	
       
   244 	iImplementation->ResetMessages();
       
   245 	
       
   246 	DP_OUT();
       
   247 	}
       
   248 //EOF