os/mm/devsoundextensions/telephonyaudiorouting/Server/src/TelephonyAudioRoutingServerSession.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). 
sl@0
     3
* All rights reserved.
sl@0
     4
* This component and the accompanying materials are made available
sl@0
     5
* under the terms of "Eclipse Public License v1.0"
sl@0
     6
* which accompanies this distribution, and is available
sl@0
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     8
*
sl@0
     9
* Initial Contributors:
sl@0
    10
* Nokia Corporation - initial contribution.
sl@0
    11
*
sl@0
    12
* Contributors:
sl@0
    13
*
sl@0
    14
* Description:   Server-side session implementation
sl@0
    15
*
sl@0
    16
*/
sl@0
    17
sl@0
    18
sl@0
    19
sl@0
    20
#include <e32std.h>
sl@0
    21
#include <e32svr.h>
sl@0
    22
#include <s32mem.h>  // for stream classes
sl@0
    23
#include "TelephonyAudioRoutingServerSession.h"
sl@0
    24
sl@0
    25
const TInt KMaxNumberOfOutputs = 100; 
sl@0
    26
sl@0
    27
// ============================ MEMBER FUNCTIONS ===============================
sl@0
    28
sl@0
    29
// -----------------------------------------------------------------------------
sl@0
    30
// CTelephonyAudioRoutingServerSession::CTelephonyAudioRoutingServerSession
sl@0
    31
// C++ default constructor can NOT contain any code, that
sl@0
    32
// might leave.
sl@0
    33
// -----------------------------------------------------------------------------
sl@0
    34
//
sl@0
    35
CTelephonyAudioRoutingServerSession::CTelephonyAudioRoutingServerSession(
sl@0
    36
	TInt aSessionId)
sl@0
    37
    :iSessionId(aSessionId), 
sl@0
    38
    iMessageArray()
sl@0
    39
	{
sl@0
    40
	TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession[%x]::CTelephonyAudioRoutingServerSession "),this);
sl@0
    41
	TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t iMessageArrayCount = %d "),iMessageArray.Count());	
sl@0
    42
		
sl@0
    43
	}
sl@0
    44
sl@0
    45
// Destructor
sl@0
    46
CTelephonyAudioRoutingServerSession::~CTelephonyAudioRoutingServerSession()
sl@0
    47
	{
sl@0
    48
	
sl@0
    49
	TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession[%x]::~CTelephonyAudioRoutingServerSession "),this);
sl@0
    50
sl@0
    51
    if	(&Server() != NULL)
sl@0
    52
		{
sl@0
    53
		Server().RemoveSession(iSessionId);
sl@0
    54
		}
sl@0
    55
		
sl@0
    56
	iSessionAvailableOutputs.Close();
sl@0
    57
	iMessageArray.Close();
sl@0
    58
sl@0
    59
	}
sl@0
    60
sl@0
    61
// -----------------------------------------------------------------------------
sl@0
    62
// CTelephonyAudioRoutingServerSession::Server
sl@0
    63
// Creates the server.
sl@0
    64
// (other items were commented in a header).
sl@0
    65
// -----------------------------------------------------------------------------
sl@0
    66
//
sl@0
    67
CTelephonyAudioRoutingServer& CTelephonyAudioRoutingServerSession::Server()
sl@0
    68
	{
sl@0
    69
	return *static_cast<CTelephonyAudioRoutingServer*>(const_cast<CServer2*>(CSession2::Server()));
sl@0
    70
	}
sl@0
    71
sl@0
    72
// -----------------------------------------------------------------------------
sl@0
    73
// CTelephonyAudioRoutingServerSession::ServiceError
sl@0
    74
// Handle an error from ServiceL
sl@0
    75
// (other items were commented in a header).
sl@0
    76
// -----------------------------------------------------------------------------
sl@0
    77
//
sl@0
    78
void CTelephonyAudioRoutingServerSession::ServiceError(
sl@0
    79
	const RMessage2& aMessage,
sl@0
    80
	TInt aError)
sl@0
    81
	{
sl@0
    82
	TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession::ServiceError - %d "), aError);
sl@0
    83
	PanicClient (aMessage, EPanicIllegalFunction); 
sl@0
    84
	}
sl@0
    85
sl@0
    86
// -----------------------------------------------------------------------------
sl@0
    87
// CTelephonyAudioRoutingServerSession::ServiceL
sl@0
    88
// Handles the servicing of a client request that has been passed to the server.
sl@0
    89
// (other items were commented in a header).
sl@0
    90
// -----------------------------------------------------------------------------
sl@0
    91
//
sl@0
    92
void CTelephonyAudioRoutingServerSession::ServiceL (
sl@0
    93
	const RMessage2& aMessage)
sl@0
    94
	{
sl@0
    95
		    
sl@0
    96
    switch (aMessage.Function())
sl@0
    97
		{
sl@0
    98
		case ETelAudRtngServDoSetOutput:
sl@0
    99
			TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession[%x]::ServiceL - ETelAudRtngServDoSetOutput "),this);
sl@0
   100
			DoSetOutputL(aMessage);
sl@0
   101
			break;
sl@0
   102
			
sl@0
   103
		case ETelAudRtngServNotifyIfOutputChanged:
sl@0
   104
			TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession[%x]::ServiceL - ETelAudRtngServNotifyIfOutputChanged "),this);
sl@0
   105
			NotifyIfOutputChangedL(aMessage);
sl@0
   106
			break;
sl@0
   107
			
sl@0
   108
		case ETelAudRtngServNotifyIfAvailOutputsChanged:
sl@0
   109
			TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession[%x]::ServiceL - ETelAudRtngServNotifyIfAvailOutputsChanged "),this);
sl@0
   110
			NotifyIfAvailOutputsChangedL(aMessage);
sl@0
   111
			break;
sl@0
   112
			
sl@0
   113
		case ETelAudRtngServGetNoOutputs:
sl@0
   114
			TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession[%x]::ServiceL - ETelAudRtngServGetNoOutputs "),this);
sl@0
   115
			GetNoOfAvailableOutputs(aMessage);
sl@0
   116
			break;
sl@0
   117
			
sl@0
   118
		case ETelAudRtngServGetAvailableOutputs:
sl@0
   119
			TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession[%x]::ServiceL - ETelAudRtngServGetAvailableOutputs "),this);
sl@0
   120
			GetAvailableOutputsL(aMessage);
sl@0
   121
			break;
sl@0
   122
			
sl@0
   123
		case ETelAudRtngServMonitorOutputChange:
sl@0
   124
			TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession[%x]::ServiceL - ETelAudRtngServMonitorOutputChange "),this);
sl@0
   125
			MonitorOutputChangeL(aMessage);
sl@0
   126
			break;
sl@0
   127
			
sl@0
   128
		case ETelAudRtngServSetPolicySessionId:
sl@0
   129
			TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession[%x]::ServiceL - ETelAudRtngServSetPolicySessionId "),this);
sl@0
   130
			SetPolicySessionId(aMessage);
sl@0
   131
			break;
sl@0
   132
			
sl@0
   133
		case ETelAudRtngServOutputChangeComplete:
sl@0
   134
			TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession[%x]::ServiceL - ETelAudRtngServOutputChangeComplete "),this);
sl@0
   135
			OutputChangeCompleteL(aMessage);
sl@0
   136
			break;
sl@0
   137
			
sl@0
   138
		case ETelAudRtngDoAvailableOutputsChanged:
sl@0
   139
			TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession[%x]::ServiceL - ETelAudRtngDoAvailableOutputsChanged "),this);
sl@0
   140
			DoAvailableOutputsChangedL(aMessage);
sl@0
   141
			break;
sl@0
   142
			
sl@0
   143
		case ETelAudRtngServCancelRequest:
sl@0
   144
			TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession[%x]::ServiceL - ETelAudRtngServCancelRequest "),this);
sl@0
   145
			CancelRequestL(aMessage);
sl@0
   146
			break;
sl@0
   147
sl@0
   148
		case ETelAudRtngServInitialize:
sl@0
   149
			TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession[%x]::ServiceL - ETelAudRtngServInitialize "),this);
sl@0
   150
			InitializeL(aMessage);
sl@0
   151
			break;
sl@0
   152
			
sl@0
   153
		case ETelAudRtngServOutputChangedByPolicy:
sl@0
   154
			TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession[%x]::ServiceL - ETelAudRtngServOutputChangedByPolicy "),this);
sl@0
   155
			OutputChangedL(aMessage);
sl@0
   156
			break;
sl@0
   157
			
sl@0
   158
		case ETelAudRtngServGetDefaultValues:
sl@0
   159
			TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession[%x]::ServiceL - ETelAudRtngServGetDefaultValues "),this);
sl@0
   160
			GetDefaultValuesL(aMessage);
sl@0
   161
			break;
sl@0
   162
						
sl@0
   163
		default:
sl@0
   164
			TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession[%x]::ServiceL - default !! "),this);
sl@0
   165
			PanicClient (aMessage, EPanicIllegalFunction);
sl@0
   166
		}
sl@0
   167
	TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession[%x]::ServiceL EXIT"), this);		
sl@0
   168
	}
sl@0
   169
sl@0
   170
// -----------------------------------------------------------------------------
sl@0
   171
// CTelephonyAudioRoutingServerSession::InitializeL
sl@0
   172
// Session initialization.
sl@0
   173
// (other items were commented in a header).
sl@0
   174
// -----------------------------------------------------------------------------
sl@0
   175
//
sl@0
   176
void CTelephonyAudioRoutingServerSession::InitializeL(
sl@0
   177
	const RMessage2& aMessage)
sl@0
   178
	{
sl@0
   179
	TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession[%x]::IntitializeL enter"),this);	
sl@0
   180
	iConnected = ETrue;
sl@0
   181
	Server().AddSession();
sl@0
   182
	aMessage.Complete(KErrNone);
sl@0
   183
	TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession[%x]::IntitializeL exit"),this);
sl@0
   184
	}
sl@0
   185
sl@0
   186
// -----------------------------------------------------------------------------
sl@0
   187
// CTelephonyAudioRoutingServerSession::CancelRequestL
sl@0
   188
// Cancel the outstanding request.
sl@0
   189
// (other items were commented in a header).
sl@0
   190
// -----------------------------------------------------------------------------
sl@0
   191
//
sl@0
   192
void CTelephonyAudioRoutingServerSession::CancelRequestL(
sl@0
   193
	const RMessage2& aMessage)
sl@0
   194
	{
sl@0
   195
	TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession[%x]::CancelRequestL"),this);	
sl@0
   196
	TTelAudRtngServRqst req;
sl@0
   197
	req = (TTelAudRtngServRqst) aMessage.Int1();
sl@0
   198
	TPckgBuf<TInt> count;
sl@0
   199
	aMessage.ReadL( 0, count);
sl@0
   200
	req = (TTelAudRtngServRqst)count();
sl@0
   201
	aMessage.Complete(KErrNone);
sl@0
   202
	TInt messageCount = iMessageArray.Count();
sl@0
   203
	TInt messageIndex = 0;
sl@0
   204
	
sl@0
   205
	if(messageCount > 0)
sl@0
   206
		{
sl@0
   207
		for(TInt i=0;i< messageCount; i++)
sl@0
   208
			{
sl@0
   209
			if(iMessageArray[i].Function()== req)
sl@0
   210
				{
sl@0
   211
				messageIndex=i;
sl@0
   212
				break;
sl@0
   213
				}
sl@0
   214
			
sl@0
   215
			}
sl@0
   216
		iMessageArray[messageIndex].Complete(KErrCancel);
sl@0
   217
		iMessageArray.Remove(messageIndex);
sl@0
   218
		}
sl@0
   219
	}
sl@0
   220
sl@0
   221
// -----------------------------------------------------------------------------
sl@0
   222
// CTelephonyAudioRoutingServerSession::DoSetOutputL 
sl@0
   223
// Send a request to audio policy to set audio output.
sl@0
   224
// (other items were commented in a header).
sl@0
   225
// -----------------------------------------------------------------------------
sl@0
   226
//
sl@0
   227
void CTelephonyAudioRoutingServerSession::DoSetOutputL (
sl@0
   228
	const RMessage2& aMessage)
sl@0
   229
	{
sl@0
   230
	TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession[%x]::DoSetOutputL "),this);
sl@0
   231
	TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t Appending aMessage to iMessageArray. Current count = %d "),iMessageArray.Count());	
sl@0
   232
	iMessageArray.AppendL(aMessage);
sl@0
   233
	Server().DoSetOutputL(iSessionId,aMessage);
sl@0
   234
    }
sl@0
   235
sl@0
   236
// -----------------------------------------------------------------------------
sl@0
   237
// CTelephonyAudioRoutingServerSession::NotifyIfOutputChangedL 
sl@0
   238
// Add a message to message queue. Complete the message when output changes
sl@0
   239
// (other items were commented in a header).
sl@0
   240
// -----------------------------------------------------------------------------
sl@0
   241
//
sl@0
   242
void CTelephonyAudioRoutingServerSession::NotifyIfOutputChangedL (
sl@0
   243
	const RMessage2& aMessage)
sl@0
   244
	{
sl@0
   245
	TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession[%x]::NotifyIfOutputChangedL "),this);
sl@0
   246
	TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t Appending aMessage to iMessageArray. Current count = %d "),iMessageArray.Count());		
sl@0
   247
    iMessageArray.AppendL(aMessage);
sl@0
   248
	}
sl@0
   249
sl@0
   250
// -----------------------------------------------------------------------------
sl@0
   251
// CTelephonyAudioRoutingServerSession::NotifyIfAvailOutputsChangedL
sl@0
   252
// Add a message to message queue. Complete the message when available audio 
sl@0
   253
// outputs change
sl@0
   254
// (other items were commented in a header).
sl@0
   255
// -----------------------------------------------------------------------------
sl@0
   256
//
sl@0
   257
void CTelephonyAudioRoutingServerSession::NotifyIfAvailOutputsChangedL (
sl@0
   258
	const RMessage2& aMessage)
sl@0
   259
	{
sl@0
   260
	TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession[%x]::NotifyIfAvailOutputsChangedL "),this);
sl@0
   261
	TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t Appending aMessage to iMessageArray. Current count = %d "),iMessageArray.Count());			
sl@0
   262
    iMessageArray.AppendL(aMessage);
sl@0
   263
	}
sl@0
   264
sl@0
   265
// -----------------------------------------------------------------------------
sl@0
   266
// CTelephonyAudioRoutingServerSession::SetPolicySessionId
sl@0
   267
// Set the policy session Id.
sl@0
   268
// (other items were commented in a header).
sl@0
   269
// -----------------------------------------------------------------------------
sl@0
   270
//
sl@0
   271
void CTelephonyAudioRoutingServerSession::SetPolicySessionId(
sl@0
   272
	const RMessage2& aMessage)
sl@0
   273
	{
sl@0
   274
	if(!iPolicyFlag)
sl@0
   275
		{
sl@0
   276
		Server().SetPolicySessionId(iSessionId);
sl@0
   277
		iPolicyFlag = ETrue;
sl@0
   278
		}
sl@0
   279
sl@0
   280
	aMessage.Complete(KErrNone);
sl@0
   281
	}
sl@0
   282
sl@0
   283
// -----------------------------------------------------------------------------
sl@0
   284
// CTelephonyAudioRoutingServerSession::OutputChangeCompleteL
sl@0
   285
// Used by policy session to indicate that the SetOutput request is complete.
sl@0
   286
// (other items were commented in a header).
sl@0
   287
// -----------------------------------------------------------------------------
sl@0
   288
//
sl@0
   289
void CTelephonyAudioRoutingServerSession::OutputChangeCompleteL(
sl@0
   290
	const RMessage2& aMessage)
sl@0
   291
	{
sl@0
   292
	TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession[%x]::OutputChangeCompleteL "),this);
sl@0
   293
	TPckgBuf<CTelephonyAudioRouting::TAudioOutput> xPackage;
sl@0
   294
	aMessage.ReadL( 0, xPackage);		
sl@0
   295
   	CTelephonyAudioRouting::TAudioOutput audioOutput = xPackage();
sl@0
   296
   	
sl@0
   297
	TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession::OutputChangeComplete: AudioOutput = %d"), audioOutput);      	
sl@0
   298
	   	
sl@0
   299
 	TPckgBuf<TInt> errPkg;
sl@0
   300
  	aMessage.ReadL(1, errPkg);
sl@0
   301
   	TInt err = errPkg();	
sl@0
   302
sl@0
   303
  	if (Server().CurrentAudioOutput() != CTelephonyAudioRouting::ENone)
sl@0
   304
	{
sl@0
   305
		Server().PreviousAudioOutput() = Server().CurrentAudioOutput();
sl@0
   306
		
sl@0
   307
		TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession::OutputChangeComplete: iPreviousAudioOutput set to: %d"), Server().PreviousAudioOutput());	
sl@0
   308
	}
sl@0
   309
	
sl@0
   310
	Server().CurrentAudioOutput() = audioOutput; 	
sl@0
   311
   	   	
sl@0
   312
   	TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession::OutputChangeCompleteL: Server will be sent audioOutput = %d"), audioOutput);
sl@0
   313
	TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession::OutputChangeCompleteL: previousAudioOutput = %d"), Server().PreviousAudioOutput());   	
sl@0
   314
	aMessage.Complete(KErrNone);
sl@0
   315
	Server().SetOutputCompleteL(audioOutput, err); 		
sl@0
   316
	}
sl@0
   317
	
sl@0
   318
// -----------------------------------------------------------------------------
sl@0
   319
// CTelephonyAudioRoutingServerSession::MonitorOutputChangeL
sl@0
   320
// Used by policy session to listen to any SetOutput request from other sessions.
sl@0
   321
// (other items were commented in a header).
sl@0
   322
// -----------------------------------------------------------------------------
sl@0
   323
//
sl@0
   324
void CTelephonyAudioRoutingServerSession::MonitorOutputChangeL (
sl@0
   325
	const RMessage2& aMessage)
sl@0
   326
	{
sl@0
   327
		TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession[%x]::MonitorOutputChangeL "),this);
sl@0
   328
		TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t Appending aMessage to iMessageArray. Current count = %d "),iMessageArray.Count());
sl@0
   329
			
sl@0
   330
		TRAPD(err, iMessageArray.AppendL(aMessage));
sl@0
   331
		if (err != KErrNone)
sl@0
   332
		{
sl@0
   333
			TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t MonitorOutputChangeL ERROR: %d "),err);	
sl@0
   334
			PanicClient (aMessage, EPanicIllegalFunction); 	
sl@0
   335
		}	
sl@0
   336
	}
sl@0
   337
	
sl@0
   338
// -----------------------------------------------------------------------------
sl@0
   339
// CTelephonyAudioRoutingServerSession::GetNoOfAvailableOutputs
sl@0
   340
// Returns the number of available outputs to client-side session.
sl@0
   341
// (other items were commented in a header).
sl@0
   342
// -----------------------------------------------------------------------------
sl@0
   343
//
sl@0
   344
void CTelephonyAudioRoutingServerSession::GetNoOfAvailableOutputs (
sl@0
   345
	const RMessage2& aMessage)
sl@0
   346
	{
sl@0
   347
	TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession[%x]::GetNoOfAvailableOutputs"),this);
sl@0
   348
	TPckgBuf<TInt> xPackage;
sl@0
   349
	xPackage() = (Server().AvailableOutputs()).Count();
sl@0
   350
sl@0
   351
	TInt res = aMessage.Write(0, xPackage);	
sl@0
   352
    if (res != KErrNone)
sl@0
   353
    	{
sl@0
   354
		TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t GetNoOfAvailableOutputs WRITE ERROR: %d"),res);
sl@0
   355
    	PanicClient(aMessage, EPanicIllegalFunction);
sl@0
   356
    	}
sl@0
   357
       
sl@0
   358
    else   
sl@0
   359
 		aMessage.Complete(KErrNone);
sl@0
   360
sl@0
   361
	}
sl@0
   362
sl@0
   363
// -----------------------------------------------------------------------------
sl@0
   364
// CTelephonyAudioRoutingServerSession::GetAvailableOutputsL
sl@0
   365
// Returns the available audio outputs to client-side session.
sl@0
   366
// (other items were commented in a header).
sl@0
   367
// -----------------------------------------------------------------------------
sl@0
   368
//
sl@0
   369
void CTelephonyAudioRoutingServerSession::GetAvailableOutputsL (
sl@0
   370
	const RMessage2& aMessage)
sl@0
   371
	{
sl@0
   372
	TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession[%x]::GetAvailableOutputsL "),this);
sl@0
   373
	TInt KBufExpandSize8 = 8;//two TInts
sl@0
   374
	CBufFlat* dataCopyBuffer = CBufFlat::NewL(KBufExpandSize8);
sl@0
   375
	CleanupStack::PushL(dataCopyBuffer);
sl@0
   376
	RBufWriteStream stream;
sl@0
   377
	stream.Open(*dataCopyBuffer);
sl@0
   378
	CleanupClosePushL(stream);
sl@0
   379
	
sl@0
   380
	// Write out server's available outputs to caller:
sl@0
   381
	CTelephonyAudioRouting::TAudioOutput output;
sl@0
   382
	TInt count = (Server().AvailableOutputs()).Count();
sl@0
   383
	for (TInt i=0;i<count;i++)
sl@0
   384
		{
sl@0
   385
		output = ( Server().AvailableOutputs() )[i];
sl@0
   386
		stream.WriteInt32L(output);
sl@0
   387
		}
sl@0
   388
	aMessage.WriteL(0, dataCopyBuffer->Ptr(0));
sl@0
   389
	stream.Close();
sl@0
   390
	CleanupStack::PopAndDestroy(2); // dataCopyBuffer, stream
sl@0
   391
sl@0
   392
	aMessage.Complete(KErrNone);
sl@0
   393
	
sl@0
   394
	}
sl@0
   395
sl@0
   396
// -----------------------------------------------------------------------------
sl@0
   397
// CTelephonyAudioRoutingServerSession::DoAvailableOutputsChangedL
sl@0
   398
// Notify the client-side session that available outputs have changed.
sl@0
   399
// (other items were commented in a header).
sl@0
   400
// -----------------------------------------------------------------------------
sl@0
   401
//
sl@0
   402
void CTelephonyAudioRoutingServerSession::DoAvailableOutputsChangedL (
sl@0
   403
	const RMessage2& aMessage)
sl@0
   404
{
sl@0
   405
	TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession[%x]::DoAvailableOutputsChangedL"),this);
sl@0
   406
	TInt err(KErrNone);
sl@0
   407
	TBool validData(ETrue);
sl@0
   408
	TPckgBuf<TInt> count;
sl@0
   409
	TRAP(err,aMessage.ReadL( 0, count));
sl@0
   410
	if (err != KErrNone)
sl@0
   411
	{
sl@0
   412
		TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t DoAvailableOutputsChangedL(1) ERROR: %d "),err);	
sl@0
   413
		PanicClient (aMessage, EPanicIllegalFunction); 
sl@0
   414
		return;		
sl@0
   415
	}
sl@0
   416
	
sl@0
   417
	if ((count() <0) || (count() > KMaxNumberOfOutputs))
sl@0
   418
	{	
sl@0
   419
		validData = EFalse;	
sl@0
   420
		iSessionAvailableOutputs.Reset();		
sl@0
   421
	}
sl@0
   422
		
sl@0
   423
	if (validData)
sl@0
   424
	{
sl@0
   425
		HBufC8* buf = HBufC8::NewLC(count()*sizeof(CTelephonyAudioRouting::TAudioOutput));	
sl@0
   426
		TPtr8 ptr = buf->Des();
sl@0
   427
sl@0
   428
		TRAP(err,aMessage.ReadL(1, ptr ));
sl@0
   429
		if (err != KErrNone)
sl@0
   430
		{
sl@0
   431
			TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t DoAvailableOutputsChangedL(2) ERROR: %d "),err);	
sl@0
   432
			PanicClient (aMessage, EPanicIllegalFunction); 
sl@0
   433
			return;		
sl@0
   434
		}
sl@0
   435
		
sl@0
   436
		RDesReadStream stream(ptr);
sl@0
   437
		CleanupClosePushL(stream);
sl@0
   438
		iSessionAvailableOutputs.Reset();
sl@0
   439
		TInt element(0);
sl@0
   440
			
sl@0
   441
		for (TInt i=0; i<count(); i++)
sl@0
   442
		{
sl@0
   443
	   
sl@0
   444
	   		TRAP(err, element = stream.ReadInt16L());
sl@0
   445
			if (err != KErrNone)
sl@0
   446
			{
sl@0
   447
				TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t DoAvailableOutputsChangedL(3) ERROR: %d "),err);	
sl@0
   448
				PanicClient (aMessage, EPanicIllegalFunction); 
sl@0
   449
				return;	
sl@0
   450
			}	   	
sl@0
   451
			
sl@0
   452
			err = iSessionAvailableOutputs.Append((CTelephonyAudioRouting::TAudioOutput)element);
sl@0
   453
			if (err)
sl@0
   454
			{
sl@0
   455
				TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t DoAvailableOutputsChangedL(4) ERROR: %d "),err);			
sl@0
   456
				iSessionAvailableOutputs.Reset();
sl@0
   457
				PanicClient (aMessage, EPanicIllegalFunction); 
sl@0
   458
				return;
sl@0
   459
			}
sl@0
   460
			
sl@0
   461
			TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t DoAvailableOutputsChanged: Avail Outputs to be sent to server: iSessionAvailableOutputs[i] = %d "),iSessionAvailableOutputs[i]);			
sl@0
   462
		} // end For
sl@0
   463
				
sl@0
   464
		stream.Close();
sl@0
   465
		CleanupStack::PopAndDestroy(2); // buf, stream
sl@0
   466
				
sl@0
   467
	} // end if
sl@0
   468
	
sl@0
   469
	aMessage.Complete(KErrNone);
sl@0
   470
	TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t [%x]DoAvailableOutputsChangedL: calling Server::AvailableOutputsChanged"),this);	
sl@0
   471
	Server().AvailableOutputsChangedL(iSessionAvailableOutputs.Array());	
sl@0
   472
}
sl@0
   473
sl@0
   474
// -----------------------------------------------------------------------------
sl@0
   475
// CTelephonyAudioRoutingServerSession::SetOutputComplete
sl@0
   476
// Notifies the client-side session that the SetOutput request is complete.
sl@0
   477
// (other items were commented in a header).
sl@0
   478
// -----------------------------------------------------------------------------
sl@0
   479
//
sl@0
   480
void CTelephonyAudioRoutingServerSession::SetOutputComplete(
sl@0
   481
	CTelephonyAudioRouting::TAudioOutput aOutput,
sl@0
   482
	TInt aError,
sl@0
   483
	TBool aShowNote)
sl@0
   484
	{
sl@0
   485
	TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession[%x]::SetOutputComplete "),this);
sl@0
   486
	
sl@0
   487
	TPckgBuf<CTelephonyAudioRouting::TAudioOutput> xPackage;
sl@0
   488
	xPackage() = aOutput;
sl@0
   489
	
sl@0
   490
	
sl@0
   491
	TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession::SetOutputComplete: iPreviousAudioOutput Write out: %d"), Server().PreviousAudioOutput());		
sl@0
   492
		
sl@0
   493
	TPckgBuf<CTelephonyAudioRouting::TAudioOutput> yPackage;
sl@0
   494
	yPackage() = Server().PreviousAudioOutput();	
sl@0
   495
	
sl@0
   496
	TPckgBuf<TInt> errorPackage;
sl@0
   497
	errorPackage() = aError;
sl@0
   498
	
sl@0
   499
	TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession::SetOutputComplete: ShowNote Val to pass to client: %d"), aShowNote);	
sl@0
   500
	TPckgBuf<TBool> showNotePackage;
sl@0
   501
	showNotePackage() = aShowNote;	
sl@0
   502
	
sl@0
   503
	TInt messageCount = iMessageArray.Count();
sl@0
   504
	TInt messageIndex = -1;
sl@0
   505
	TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t iMessageArrayCount = %d "),iMessageArray.Count());	
sl@0
   506
	
sl@0
   507
	for(TInt i=0;i< messageCount; i++)
sl@0
   508
		{
sl@0
   509
		if(iMessageArray[i].Function()== ETelAudRtngServDoSetOutput)
sl@0
   510
			{
sl@0
   511
				messageIndex = i;
sl@0
   512
				break;
sl@0
   513
			}
sl@0
   514
		}		
sl@0
   515
sl@0
   516
	if (messageIndex != -1)
sl@0
   517
		{
sl@0
   518
			TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t Current Index = %d "), messageIndex);	
sl@0
   519
		
sl@0
   520
			TInt res = iMessageArray[messageIndex].Write(0, xPackage);
sl@0
   521
			TInt res2 = iMessageArray[messageIndex].Write(1, yPackage);
sl@0
   522
			TInt res3 = iMessageArray[messageIndex].Write(2, errorPackage);	
sl@0
   523
			TInt res4 = iMessageArray[messageIndex].Write(3, showNotePackage);								
sl@0
   524
	
sl@0
   525
			if ( (res != KErrNone) || (res2 != KErrNone) || (res3 != KErrNone) || (res4 != KErrNone))
sl@0
   526
    			{	
sl@0
   527
    				PanicClient(iMessageArray[messageIndex], EPanicIllegalFunction);
sl@0
   528
    			}
sl@0
   529
    		else
sl@0
   530
    		{
sl@0
   531
    			iMessageArray[messageIndex].Complete(ETelAudRtngServSetOutputComplete);
sl@0
   532
    			iMessageArray.Remove(messageIndex);
sl@0
   533
    		}
sl@0
   534
    	}
sl@0
   535
	}
sl@0
   536
	
sl@0
   537
// -----------------------------------------------------------------------------
sl@0
   538
// CTelephonyAudioRoutingServerSession::OutputChangeRequested
sl@0
   539
// Notification that client is requesting to change audio output
sl@0
   540
// (other items were commented in a header).
sl@0
   541
// -----------------------------------------------------------------------------
sl@0
   542
//
sl@0
   543
void CTelephonyAudioRoutingServerSession::OutputChangeRequested(
sl@0
   544
	CTelephonyAudioRouting::TAudioOutput aOutput)
sl@0
   545
	{
sl@0
   546
	TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession[%x]::OutputChangeRequested"),this);
sl@0
   547
		
sl@0
   548
	TPckgBuf<CTelephonyAudioRouting::TAudioOutput> xPackage;
sl@0
   549
	xPackage() = aOutput;
sl@0
   550
	
sl@0
   551
	TInt messageCount = iMessageArray.Count();
sl@0
   552
	TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t iMessageArrayCount = %d "),iMessageArray.Count());	
sl@0
   553
	
sl@0
   554
	TInt messageIndex = -1;
sl@0
   555
	
sl@0
   556
	for(TInt i=0;i< messageCount; i++)
sl@0
   557
		{
sl@0
   558
		if(iMessageArray[i].Function()== ETelAudRtngServNotifyIfOutputChanged && !iPolicyFlag)
sl@0
   559
			{
sl@0
   560
				messageIndex=i;
sl@0
   561
				break;
sl@0
   562
			}
sl@0
   563
			
sl@0
   564
		if(iMessageArray[i].Function()== ETelAudRtngServMonitorOutputChange && iPolicyFlag)
sl@0
   565
			{
sl@0
   566
				messageIndex=i;
sl@0
   567
				break;
sl@0
   568
			}
sl@0
   569
		}
sl@0
   570
		
sl@0
   571
	if (messageIndex != -1) // Don't perform if message not found 		
sl@0
   572
		{
sl@0
   573
			TInt res = iMessageArray[messageIndex].Write(0, xPackage);	
sl@0
   574
			if (res != KErrNone)			
sl@0
   575
    			{
sl@0
   576
     				PanicClient(iMessageArray[messageIndex], EPanicIllegalFunction);
sl@0
   577
    			}
sl@0
   578
    	
sl@0
   579
    		else
sl@0
   580
    		{
sl@0
   581
				iMessageArray[messageIndex].Complete(ETelAudRtngServOutputChangeRequested);
sl@0
   582
    			iMessageArray.Remove(messageIndex);  
sl@0
   583
    		}
sl@0
   584
		}
sl@0
   585
#ifdef  _DEBUG		
sl@0
   586
	else
sl@0
   587
		{
sl@0
   588
			TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession[%x]::OutputChangeRequested: ServerSession NOT Handling this msg! "),this);		
sl@0
   589
		}
sl@0
   590
#endif
sl@0
   591
		
sl@0
   592
	}
sl@0
   593
sl@0
   594
// -----------------------------------------------------------------------------
sl@0
   595
// CTelephonyAudioRoutingServerSession::OutputChangedL
sl@0
   596
// Telephony Audio Routing Manager uses to notify TAR that policy has initiated an output change.
sl@0
   597
// (other items were commented in a header).
sl@0
   598
// -----------------------------------------------------------------------------
sl@0
   599
//
sl@0
   600
void CTelephonyAudioRoutingServerSession::OutputChangedL(
sl@0
   601
	const RMessage2& aMessage)
sl@0
   602
	{
sl@0
   603
	TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession[%x]::OutputChangedL Enter"),this);
sl@0
   604
		
sl@0
   605
	TPckgBuf<CTelephonyAudioRouting::TAudioOutput> xPackage;
sl@0
   606
sl@0
   607
	aMessage.ReadL( 0, xPackage);
sl@0
   608
   	CTelephonyAudioRouting::TAudioOutput audioOutput = xPackage();
sl@0
   609
   		
sl@0
   610
	Server().PreviousAudioOutput() = Server().CurrentAudioOutput();
sl@0
   611
		
sl@0
   612
	TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession::OutputChangedL: iCurrentAudioOutput was: %d"), Server().CurrentAudioOutput());		
sl@0
   613
	TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession::OutputChangedL: iPreviousAudioOutput set to: %d"), Server().PreviousAudioOutput());	
sl@0
   614
		
sl@0
   615
	TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession::OutputChangedL: iCurrentAudioOutput set to: %d"), audioOutput);	
sl@0
   616
	Server().CurrentAudioOutput() = audioOutput; 
sl@0
   617
	Server().SetShowNoteMode(ETrue);  // Always set if output changes initiated by adaptation
sl@0
   618
	
sl@0
   619
    aMessage.Complete(KErrNone);
sl@0
   620
    
sl@0
   621
  	// Server needs to send notification of output change to clients
sl@0
   622
	Server().OutputChanged(audioOutput); 
sl@0
   623
	  	
sl@0
   624
	TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession[%x]::OutputChangedL Exit"),this);    	
sl@0
   625
	
sl@0
   626
	}
sl@0
   627
	
sl@0
   628
// -----------------------------------------------------------------------------
sl@0
   629
// CTelephonyAudioRoutingServerSession::OutputChanged
sl@0
   630
// Notification to be sent to all clients about the change of audio output.
sl@0
   631
// (other items were commented in a header).
sl@0
   632
// -----------------------------------------------------------------------------
sl@0
   633
//
sl@0
   634
void CTelephonyAudioRoutingServerSession::OutputChanged(
sl@0
   635
	CTelephonyAudioRouting::TAudioOutput aOutput,
sl@0
   636
	TBool aShowNote)
sl@0
   637
	{
sl@0
   638
	TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession[%x]::OutputChanged"), this);
sl@0
   639
sl@0
   640
	TPckgBuf<CTelephonyAudioRouting::TAudioOutput> xPackage;
sl@0
   641
	TPckgBuf<CTelephonyAudioRouting::TAudioOutput> yPackage;
sl@0
   642
	
sl@0
   643
	TPckgBuf<TInt> errorPackage;
sl@0
   644
	errorPackage() = KErrNone;
sl@0
   645
	
sl@0
   646
	TPckgBuf<TBool> zPackage;
sl@0
   647
				
sl@0
   648
	xPackage() = aOutput;
sl@0
   649
	
sl@0
   650
	// Provide client with previous output value:
sl@0
   651
	CTelephonyAudioRouting::TAudioOutput prevOutput = Server().PreviousAudioOutput();	
sl@0
   652
	yPackage() = prevOutput;
sl@0
   653
	
sl@0
   654
	// Provide client with showNote:	
sl@0
   655
	zPackage() = aShowNote;	
sl@0
   656
	
sl@0
   657
	TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession::OutputChanged Current output: %d"), aOutput);
sl@0
   658
	TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession::OutputChanged Previous output: %d"), yPackage());
sl@0
   659
	TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession::OutputChanged aShowNote: %d"), zPackage());		
sl@0
   660
		
sl@0
   661
	TInt messageCount = iMessageArray.Count();
sl@0
   662
	TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t iMessageArrayCount = %d "),iMessageArray.Count());	
sl@0
   663
	
sl@0
   664
	TInt messageIndex = -1;
sl@0
   665
		
sl@0
   666
	for(TInt i=0;i< messageCount; i++)
sl@0
   667
		{
sl@0
   668
		if(iMessageArray[i].Function()== ETelAudRtngServNotifyIfOutputChanged)
sl@0
   669
			{
sl@0
   670
				messageIndex = i;
sl@0
   671
				break;
sl@0
   672
			}
sl@0
   673
		}		
sl@0
   674
sl@0
   675
	if (messageIndex != -1)
sl@0
   676
	{
sl@0
   677
		TInt res = iMessageArray[messageIndex].Write(0, xPackage);
sl@0
   678
		TInt res2 = iMessageArray[messageIndex].Write(1, yPackage);
sl@0
   679
		TInt res3 = iMessageArray[messageIndex].Write(2, errorPackage);	
sl@0
   680
		TInt res4 = iMessageArray[messageIndex].Write(3, zPackage);			
sl@0
   681
	
sl@0
   682
		if ( (res != KErrNone) || (res2 != KErrNone) || (res3 != KErrNone) || (res3 != KErrNone) )
sl@0
   683
    	{
sl@0
   684
    		PanicClient(iMessageArray[messageIndex], EPanicIllegalFunction);
sl@0
   685
    	}
sl@0
   686
sl@0
   687
		else
sl@0
   688
		{
sl@0
   689
    		iMessageArray[messageIndex].Complete(ETelAudRtngServOutputChanged);
sl@0
   690
    		iMessageArray.Remove(messageIndex);
sl@0
   691
		}
sl@0
   692
	}
sl@0
   693
#ifdef _DEBUG				
sl@0
   694
	else
sl@0
   695
		{
sl@0
   696
			TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession[%x]::OutputChanged: ServerSession NOT Handling this msg! "),this);		
sl@0
   697
		}
sl@0
   698
#endif		
sl@0
   699
sl@0
   700
	TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession[%x]::OutputChanged Exit"), this);    				
sl@0
   701
	}	
sl@0
   702
// -----------------------------------------------------------------------------
sl@0
   703
// CTelephonyAudioRoutingServerSession::AvailableOutputsChanged
sl@0
   704
// Notifies the client-side session that available audio outputs have changed.
sl@0
   705
// (other items were commented in a header).
sl@0
   706
// -----------------------------------------------------------------------------
sl@0
   707
//
sl@0
   708
void CTelephonyAudioRoutingServerSession::AvailableOutputsChanged( 
sl@0
   709
	const TArray<CTelephonyAudioRouting::TAudioOutput>& aOutputs)
sl@0
   710
	{
sl@0
   711
	TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession[%x]::AvailableOutputsChanged Enter "),this);	 
sl@0
   712
    TInt count = aOutputs.Count();
sl@0
   713
    iSessionAvailableOutputs.Reset();
sl@0
   714
    
sl@0
   715
    for(TInt i=0;i<count;i++)
sl@0
   716
    	iSessionAvailableOutputs.Append(aOutputs[i]);
sl@0
   717
    	
sl@0
   718
	TInt messageCount = iMessageArray.Count();
sl@0
   719
	TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t iMessageArrayCount = %d "),iMessageArray.Count());	
sl@0
   720
	
sl@0
   721
	TInt messageIndex = -1;
sl@0
   722
	
sl@0
   723
	TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession[%x]::AvailableOutputsChanged: Find msg "),this);	
sl@0
   724
	
sl@0
   725
	for(TInt i=0;i< messageCount; i++)
sl@0
   726
		{
sl@0
   727
		if(iMessageArray[i].Function()== ETelAudRtngServNotifyIfAvailOutputsChanged)
sl@0
   728
			{
sl@0
   729
				messageIndex=i;
sl@0
   730
				break;
sl@0
   731
			}
sl@0
   732
		}
sl@0
   733
		
sl@0
   734
	if (messageIndex != -1) // Don't perform if message not found
sl@0
   735
		{
sl@0
   736
			iMessageArray[messageIndex].Complete(ETelAudRtngServAvailableOutputsChanged);
sl@0
   737
    		iMessageArray.Remove(messageIndex);		
sl@0
   738
		}
sl@0
   739
		
sl@0
   740
#ifdef _DEBUG		
sl@0
   741
	else
sl@0
   742
		{
sl@0
   743
			TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession[%x]::AvailableOutputsChanged: ServerSession NOT Handling this msg! "),this);		
sl@0
   744
		}
sl@0
   745
#endif
sl@0
   746
sl@0
   747
	TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession[%x]::AvailableOutputsChanged Exit "),this);
sl@0
   748
			
sl@0
   749
	}
sl@0
   750
sl@0
   751
TInt CTelephonyAudioRoutingServerSession::SessionId()
sl@0
   752
	{
sl@0
   753
	return iSessionId;
sl@0
   754
	}
sl@0
   755
	
sl@0
   756
// -----------------------------------------------------------------------------
sl@0
   757
// CTelephonyAudioRoutingServerSession::GetDefaultValuesL
sl@0
   758
// Gets default values from server for the client-side session 
sl@0
   759
// (other items were commented in a header).
sl@0
   760
// -----------------------------------------------------------------------------
sl@0
   761
//
sl@0
   762
void CTelephonyAudioRoutingServerSession::GetDefaultValuesL(
sl@0
   763
	const RMessage2& aMessage)
sl@0
   764
	{
sl@0
   765
	TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingServerSession[%x]::GetDefaultValuesL "),this);		
sl@0
   766
		
sl@0
   767
	TTelephonyAudioRoutingDefaultParams defaultParams;
sl@0
   768
	
sl@0
   769
	// Fill class with default values from server:
sl@0
   770
	defaultParams.iCurrentAudio = Server().CurrentAudioOutput();
sl@0
   771
	TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t GetDefaultValuesL: Current audio output = %d"),defaultParams.iCurrentAudio);	
sl@0
   772
	
sl@0
   773
	defaultParams.iPreviousAudio = Server().PreviousAudioOutput();
sl@0
   774
	TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t GetDefaultValuesL: Previous audio output = %d"),defaultParams.iPreviousAudio);
sl@0
   775
		
sl@0
   776
	defaultParams.iShowNoteMode = Server().ShowNoteMode();
sl@0
   777
	TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t GetDefaultValuesL: Show Note Mode = %d"),defaultParams.iShowNoteMode);
sl@0
   778
	
sl@0
   779
	// Package default params and write out:
sl@0
   780
	TPckgBuf<TTelephonyAudioRoutingDefaultParams> defaultParamsPkg;
sl@0
   781
	defaultParamsPkg() = defaultParams;	
sl@0
   782
	aMessage.WriteL(0, defaultParamsPkg);
sl@0
   783
	aMessage.Complete(KErrNone);
sl@0
   784
	
sl@0
   785
	}
sl@0
   786
	
sl@0
   787
	
sl@0
   788
// End of file.