os/mm/devsoundextensions/mmfcustominterfaces/SbcEncoderIntfc/SbcEncoderIntfcMsgHdlr/src/SbcEncoderIntfcMsgHdlr.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
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:   Message handler for SBC encoder interface.
sl@0
    15
*
sl@0
    16
*/
sl@0
    17
sl@0
    18
sl@0
    19
sl@0
    20
// INCLUDE FILES
sl@0
    21
#include <SbcEncoderIntfc.h>
sl@0
    22
#include "SbcEncoderIntfcMsgHdlr.h"
sl@0
    23
#include "SbcEncoderIntfcMsgs.h"
sl@0
    24
sl@0
    25
// EXTERNAL DATA STRUCTURES
sl@0
    26
sl@0
    27
// EXTERNAL FUNCTION PROTOTYPES
sl@0
    28
sl@0
    29
// CONSTANTS
sl@0
    30
sl@0
    31
// MACROS
sl@0
    32
sl@0
    33
// LOCAL CONSTANTS AND MACROS
sl@0
    34
sl@0
    35
// MODULE DATA STRUCTURES
sl@0
    36
sl@0
    37
// LOCAL FUNCTION PROTOTYPES
sl@0
    38
sl@0
    39
// FORWARD DECLARATIONS
sl@0
    40
sl@0
    41
// ============================= LOCAL FUNCTIONS ===============================
sl@0
    42
sl@0
    43
// ============================ MEMBER FUNCTIONS ===============================
sl@0
    44
sl@0
    45
/**
sl@0
    46
 * CSbcEncoderIntfcMsgHdlr::CSbcEncoderIntfcMsgHdlr
sl@0
    47
 * C++ default constructor can NOT contain any code, that might leave.
sl@0
    48
 */
sl@0
    49
CSbcEncoderIntfcMsgHdlr::CSbcEncoderIntfcMsgHdlr(
sl@0
    50
                         CSbcEncoderIntfc* aSbcEncoderIntfcCI) :
sl@0
    51
	CMMFObject(KUidSbcEncoderIntfc)
sl@0
    52
    {
sl@0
    53
    iSbcEncoderIntfcCI = aSbcEncoderIntfcCI;
sl@0
    54
    }
sl@0
    55
sl@0
    56
/**
sl@0
    57
 * CSbcEncoderIntfcMsgHdlr::ConstructL
sl@0
    58
 * Symbian 2nd phase constructor can leave.
sl@0
    59
 */
sl@0
    60
void CSbcEncoderIntfcMsgHdlr::ConstructL()
sl@0
    61
    {
sl@0
    62
    }
sl@0
    63
sl@0
    64
/**
sl@0
    65
 * CSbcEncoderIntfcMsgHdlr::NewL
sl@0
    66
 * Two-phased constructor.
sl@0
    67
 */
sl@0
    68
EXPORT_C CSbcEncoderIntfcMsgHdlr* CSbcEncoderIntfcMsgHdlr::NewL(
sl@0
    69
                                  TAny* aSbcEncoderIntfcCI)
sl@0
    70
    {
sl@0
    71
    CSbcEncoderIntfc* SbcEncoderIntfcCI =
sl@0
    72
                      (CSbcEncoderIntfc*)aSbcEncoderIntfcCI;
sl@0
    73
    CSbcEncoderIntfcMsgHdlr* self =
sl@0
    74
        new (ELeave) CSbcEncoderIntfcMsgHdlr(SbcEncoderIntfcCI);
sl@0
    75
    CleanupStack::PushL( self );
sl@0
    76
    self->ConstructL();
sl@0
    77
    CleanupStack::Pop( self );
sl@0
    78
    return self;
sl@0
    79
    }
sl@0
    80
sl@0
    81
/**
sl@0
    82
 * Destructor
sl@0
    83
 */
sl@0
    84
EXPORT_C CSbcEncoderIntfcMsgHdlr::~CSbcEncoderIntfcMsgHdlr()
sl@0
    85
	{
sl@0
    86
	delete iDataCopyBuffer;
sl@0
    87
	delete iSbcEncoderIntfcCI;
sl@0
    88
	}
sl@0
    89
sl@0
    90
/**
sl@0
    91
 * CSbcEncoderIntfcMsgHdlr::HandleRequest
sl@0
    92
 * Handles the messages from the proxy.
sl@0
    93
 * Calls a subfunction which determines which custom interface to call.
sl@0
    94
 * A subfunction is used to contain multiple leaving functions for a
sl@0
    95
 * single trap.
sl@0
    96
 * (other items were commented in a header).
sl@0
    97
 */
sl@0
    98
EXPORT_C void CSbcEncoderIntfcMsgHdlr::HandleRequest(TMMFMessage& aMessage)
sl@0
    99
	{
sl@0
   100
    // debug panic
sl@0
   101
	ASSERT(aMessage.Destination().InterfaceId() == KUidSbcEncoderIntfc);
sl@0
   102
	TRAPD(error, DoHandleRequestL(aMessage));
sl@0
   103
	if(error)
sl@0
   104
		{
sl@0
   105
		aMessage.Complete(error);
sl@0
   106
		}
sl@0
   107
	}
sl@0
   108
sl@0
   109
/**
sl@0
   110
 * CSbcEncoderIntfcMsgHdlr::DoHandleRequestL
sl@0
   111
 * Determines which custom interface to call.
sl@0
   112
 * (other items were commented in a header).
sl@0
   113
 */
sl@0
   114
void CSbcEncoderIntfcMsgHdlr::DoHandleRequestL(TMMFMessage& aMessage)
sl@0
   115
	{
sl@0
   116
	switch(aMessage.Function())
sl@0
   117
		{
sl@0
   118
		case ESbceimGetNumOfSupportedSamplingFrequencies:
sl@0
   119
			{
sl@0
   120
			DoGetNumOfSupportedSamplingFrequenciesL(aMessage);
sl@0
   121
			break;
sl@0
   122
			}
sl@0
   123
		case ESbceimGetSupportedSamplingFrequencies:
sl@0
   124
			{
sl@0
   125
			DoGetSupportedSamplingFrequenciesL(aMessage);
sl@0
   126
			break;
sl@0
   127
			}
sl@0
   128
		case ESbceimGetNumOfSupportedChannelModes:
sl@0
   129
			{
sl@0
   130
			DoGetNumOfSupportedChannelModesL(aMessage);
sl@0
   131
			break;
sl@0
   132
			}
sl@0
   133
		case ESbceimGetSupportedChannelModes:
sl@0
   134
			{
sl@0
   135
			DoGetSupportedChannelModesL(aMessage);
sl@0
   136
			break;
sl@0
   137
			}
sl@0
   138
		case ESbceimGetNumOfSupportedNumOfSubbands:
sl@0
   139
			{
sl@0
   140
			DoGetNumOfSupportedNumOfSubbandsL(aMessage);
sl@0
   141
			break;
sl@0
   142
			}
sl@0
   143
		case ESbceimGetSupportedNumOfSubbands:
sl@0
   144
			{
sl@0
   145
			DoGetSupportedNumOfSubbandsL(aMessage);
sl@0
   146
			break;
sl@0
   147
			}
sl@0
   148
		case ESbceimGetNumOfSupportedBlocks:
sl@0
   149
			{
sl@0
   150
			DoGetNumOfSupportedBlocksL(aMessage);
sl@0
   151
			break;
sl@0
   152
			}
sl@0
   153
		case ESbceimGetSupportedBlocks:
sl@0
   154
			{
sl@0
   155
			DoGetSupportedBlocksL(aMessage);
sl@0
   156
			break;
sl@0
   157
			}
sl@0
   158
		case ESbceimGetNumOfSupportedAllocationMethods:
sl@0
   159
			{
sl@0
   160
			DoGetNumOfSupportedAllocationMethodsL(aMessage);
sl@0
   161
			break;
sl@0
   162
			}
sl@0
   163
		case ESbceimGetSupportedAllocationMethods:
sl@0
   164
			{
sl@0
   165
			DoGetSupportedAllocationMethodsL(aMessage);
sl@0
   166
			break;
sl@0
   167
			}
sl@0
   168
		case ESbceimGetSupportedBitpoolRange:
sl@0
   169
			{
sl@0
   170
			DoGetSupportedBitpoolRangeL(aMessage);
sl@0
   171
			break;
sl@0
   172
			}
sl@0
   173
		case ESbceimApplyConfig:
sl@0
   174
			{
sl@0
   175
			DoApplyConfigL(aMessage);
sl@0
   176
			break;
sl@0
   177
			}
sl@0
   178
		default:
sl@0
   179
			{
sl@0
   180
			aMessage.Complete(KErrNotSupported);
sl@0
   181
			}
sl@0
   182
		}
sl@0
   183
	}
sl@0
   184
sl@0
   185
/**
sl@0
   186
 * CSbcEncoderIntfcMsgHdlr::DoGetNumOfSupportedSamplingFrequenciesL
sl@0
   187
 * Handles the message from the proxy and calls the custom interface.
sl@0
   188
 * The custom interface returns the data requested and this function writes
sl@0
   189
 * it back to the proxy. It also creates a buffer and fills the sampling
sl@0
   190
 * frequencies data to be returned in the subsequent call to
sl@0
   191
 * DoGetSupportedSamplingFrequenciesL().
sl@0
   192
 * (other items were commented in a header).
sl@0
   193
 */
sl@0
   194
void CSbcEncoderIntfcMsgHdlr::DoGetNumOfSupportedSamplingFrequenciesL(
sl@0
   195
                              TMMFMessage& aMessage)
sl@0
   196
	{
sl@0
   197
	RArray<TUint> supSamplingFrequencies;
sl@0
   198
    CleanupClosePushL(supSamplingFrequencies);
sl@0
   199
sl@0
   200
	TInt status = iSbcEncoderIntfcCI->GetSupportedSamplingFrequencies(
sl@0
   201
	                                  supSamplingFrequencies);
sl@0
   202
sl@0
   203
    // store array in iDataCopyBuffer
sl@0
   204
	CreateBufFromUintArrayL(supSamplingFrequencies);
sl@0
   205
sl@0
   206
	if (status == KErrNone)
sl@0
   207
    	{
sl@0
   208
	    TPckgBuf<TUint> pckg;
sl@0
   209
    	pckg() = supSamplingFrequencies.Count();
sl@0
   210
	    aMessage.WriteDataToClientL(pckg);
sl@0
   211
	    }
sl@0
   212
sl@0
   213
    CleanupStack::PopAndDestroy(&supSamplingFrequencies);
sl@0
   214
    aMessage.Complete(status);
sl@0
   215
	}
sl@0
   216
sl@0
   217
/**
sl@0
   218
 * CSbcEncoderIntfcMsgHdlr::DoGetSupportedSamplingFrequenciesL
sl@0
   219
 * Sends the sampling frequency data returned from the custom interface
sl@0
   220
 * implementation to the client.
sl@0
   221
 * (other items were commented in a header).
sl@0
   222
 */
sl@0
   223
void CSbcEncoderIntfcMsgHdlr::DoGetSupportedSamplingFrequenciesL(
sl@0
   224
                              TMMFMessage& aMessage)
sl@0
   225
	{
sl@0
   226
    SendDataBufferToClientL(aMessage);
sl@0
   227
	}
sl@0
   228
sl@0
   229
/**
sl@0
   230
 * CSbcEncoderIntfcMsgHdlr::DoGetNumOfSupportedChannelModesL
sl@0
   231
 * Handles the message from the proxy and calls the custom interface.
sl@0
   232
 * The custom interface returns the data requested and this function writes
sl@0
   233
 * it back to the proxy. It also creates a buffer and fills the sampling
sl@0
   234
 * frequencies data to be returned in the subsequent call to
sl@0
   235
 * DoGetSupportedChannelModesL().
sl@0
   236
 * (other items were commented in a header).
sl@0
   237
 */
sl@0
   238
void CSbcEncoderIntfcMsgHdlr::DoGetNumOfSupportedChannelModesL(
sl@0
   239
                              TMMFMessage& aMessage)
sl@0
   240
    {
sl@0
   241
    RArray<CSbcEncoderIntfc::TSbcChannelMode> supChannelModes;
sl@0
   242
    CleanupClosePushL(supChannelModes);
sl@0
   243
	TInt status =
sl@0
   244
	     iSbcEncoderIntfcCI->GetSupportedChannelModes(supChannelModes);
sl@0
   245
sl@0
   246
    // store array in iDataCopyBuffer
sl@0
   247
	CreateBufFromUintArrayL(reinterpret_cast<RArray<TUint>&>(supChannelModes));
sl@0
   248
sl@0
   249
	if (status == KErrNone)
sl@0
   250
    	{
sl@0
   251
	    TPckgBuf<TUint> pckg;
sl@0
   252
    	pckg() = supChannelModes.Count();
sl@0
   253
	    aMessage.WriteDataToClientL(pckg);
sl@0
   254
	    }
sl@0
   255
sl@0
   256
    CleanupStack::PopAndDestroy(&supChannelModes);
sl@0
   257
    aMessage.Complete(status);
sl@0
   258
    }
sl@0
   259
sl@0
   260
/**
sl@0
   261
 * CSbcEncoderIntfcMsgHdlr::DoGetSupportedChannelModesL
sl@0
   262
 * Sends the channel modes data returned from the custom interface
sl@0
   263
 * implementation to the client.
sl@0
   264
 * (other items were commented in a header).
sl@0
   265
 */
sl@0
   266
void CSbcEncoderIntfcMsgHdlr::DoGetSupportedChannelModesL(
sl@0
   267
                              TMMFMessage& aMessage)
sl@0
   268
    {
sl@0
   269
    SendDataBufferToClientL(aMessage);
sl@0
   270
    }
sl@0
   271
sl@0
   272
/**
sl@0
   273
 * CSbcEncoderIntfcMsgHdlr::DoGetNumOfSupportedBlocksL
sl@0
   274
 * Handles the message from the proxy and calls the custom interface.
sl@0
   275
 * The custom interface returns the data requested and this function writes
sl@0
   276
 * it back to the proxy. It also creates a buffer and fills the supported
sl@0
   277
 * blocks data to be returned in the subsequent call to
sl@0
   278
 * DoGetSupportedBlocksL().
sl@0
   279
 * (other items were commented in a header).
sl@0
   280
 */
sl@0
   281
void CSbcEncoderIntfcMsgHdlr::DoGetNumOfSupportedBlocksL(
sl@0
   282
                              TMMFMessage& aMessage)
sl@0
   283
    {
sl@0
   284
	RArray<TUint> supNumBlocks;
sl@0
   285
    CleanupClosePushL(supNumBlocks);
sl@0
   286
    
sl@0
   287
	TInt status = iSbcEncoderIntfcCI->GetSupportedNumOfBlocks(supNumBlocks);
sl@0
   288
sl@0
   289
	CreateBufFromUintArrayL(supNumBlocks);
sl@0
   290
sl@0
   291
	if (status == KErrNone)
sl@0
   292
    	{
sl@0
   293
	    TPckgBuf<TUint> pckg;
sl@0
   294
    	pckg() = supNumBlocks.Count();
sl@0
   295
	    aMessage.WriteDataToClientL(pckg);
sl@0
   296
	    }
sl@0
   297
sl@0
   298
    CleanupStack::PopAndDestroy(&supNumBlocks);
sl@0
   299
    aMessage.Complete(status);
sl@0
   300
    }
sl@0
   301
sl@0
   302
/**
sl@0
   303
 * CSbcEncoderIntfcMsgHdlr::DoGetSupportedBlocksL
sl@0
   304
 * Sends the supported blocks data returned from the custom interface
sl@0
   305
 * implementation to the client.
sl@0
   306
 * (other items were commented in a header).
sl@0
   307
 */
sl@0
   308
void CSbcEncoderIntfcMsgHdlr::DoGetSupportedBlocksL(TMMFMessage& aMessage)
sl@0
   309
    {
sl@0
   310
    SendDataBufferToClientL(aMessage);
sl@0
   311
    }
sl@0
   312
sl@0
   313
/**
sl@0
   314
 * CSbcEncoderIntfcMsgHdlr::DoGetNumOfSupportedNumOfSubbandsL
sl@0
   315
 * Handles the message from the proxy and calls the custom interface.
sl@0
   316
 * The custom interface returns the data requested and this function writes
sl@0
   317
 * it back to the proxy. It also creates a buffer and fills the supported
sl@0
   318
 * subbands data to be returned in the subsequent call to
sl@0
   319
 * DoGetSupportedNumOfSubbandsL().
sl@0
   320
 * (other items were commented in a header).
sl@0
   321
 */
sl@0
   322
void CSbcEncoderIntfcMsgHdlr::DoGetNumOfSupportedNumOfSubbandsL(
sl@0
   323
                              TMMFMessage& aMessage)
sl@0
   324
    {
sl@0
   325
	RArray<TUint> supNumSubbands;
sl@0
   326
	CleanupClosePushL(supNumSubbands);
sl@0
   327
sl@0
   328
	TInt status = iSbcEncoderIntfcCI->GetSupportedNumOfSubbands(supNumSubbands);
sl@0
   329
sl@0
   330
	CreateBufFromUintArrayL(supNumSubbands);
sl@0
   331
sl@0
   332
	if (status == KErrNone)
sl@0
   333
    	{
sl@0
   334
	    TPckgBuf<TUint> pckg;
sl@0
   335
    	pckg() = supNumSubbands.Count();
sl@0
   336
	    aMessage.WriteDataToClientL(pckg);
sl@0
   337
	    }
sl@0
   338
sl@0
   339
    CleanupStack::PopAndDestroy(&supNumSubbands);
sl@0
   340
    aMessage.Complete(status);
sl@0
   341
    }
sl@0
   342
sl@0
   343
/**
sl@0
   344
 * CSbcEncoderIntfcMsgHdlr::DoGetSupportedNumOfSubbandsL
sl@0
   345
 * Sends the supported subbands data returned from the custom interface
sl@0
   346
 * implementation to the client.
sl@0
   347
 * (other items were commented in a header).
sl@0
   348
 */
sl@0
   349
void CSbcEncoderIntfcMsgHdlr::DoGetSupportedNumOfSubbandsL(
sl@0
   350
                              TMMFMessage& aMessage)
sl@0
   351
    {
sl@0
   352
    SendDataBufferToClientL(aMessage);
sl@0
   353
    }
sl@0
   354
sl@0
   355
/**
sl@0
   356
 * CSbcEncoderIntfcMsgHdlr::DoGetNumOfSupportedAllocationMethodsL
sl@0
   357
 * Handles the message from the proxy and calls the custom interface.
sl@0
   358
 * The custom interface returns the data requested and this function writes
sl@0
   359
 * it back to the proxy. It also creates a buffer and fills the supported
sl@0
   360
 * allocation methods data to be returned in the subsequent call to
sl@0
   361
 * DoGetSupportedAllocationMethodsL().
sl@0
   362
 * (other items were commented in a header).
sl@0
   363
 */
sl@0
   364
void CSbcEncoderIntfcMsgHdlr::DoGetNumOfSupportedAllocationMethodsL(
sl@0
   365
                              TMMFMessage& aMessage)
sl@0
   366
    {
sl@0
   367
    RArray<CSbcEncoderIntfc::TSbcAllocationMethod> supAllocMethods;
sl@0
   368
	CleanupClosePushL(supAllocMethods);
sl@0
   369
sl@0
   370
	TInt status =
sl@0
   371
	     iSbcEncoderIntfcCI->GetSupportedAllocationMethods(supAllocMethods);
sl@0
   372
sl@0
   373
    // store array in iDataCopyBuffer
sl@0
   374
	CreateBufFromUintArrayL(reinterpret_cast<RArray<TUint>&>(supAllocMethods));
sl@0
   375
sl@0
   376
	if (status == KErrNone)
sl@0
   377
    	{
sl@0
   378
	    TPckgBuf<TUint> pckg;
sl@0
   379
    	pckg() = supAllocMethods.Count();
sl@0
   380
	    aMessage.WriteDataToClientL(pckg);
sl@0
   381
	    }
sl@0
   382
sl@0
   383
    CleanupStack::PopAndDestroy(&supAllocMethods);
sl@0
   384
    aMessage.Complete(status);
sl@0
   385
    }
sl@0
   386
sl@0
   387
/**
sl@0
   388
 * CSbcEncoderIntfcMsgHdlr::DoGetSupportedAllocationMethodsL
sl@0
   389
 * Sends the supported allocation methods data returned from the custom
sl@0
   390
 * interface implementation to the client.
sl@0
   391
 * (other items were commented in a header).
sl@0
   392
 */
sl@0
   393
void CSbcEncoderIntfcMsgHdlr::DoGetSupportedAllocationMethodsL(
sl@0
   394
                              TMMFMessage& aMessage)
sl@0
   395
    {
sl@0
   396
    SendDataBufferToClientL(aMessage);
sl@0
   397
    }
sl@0
   398
sl@0
   399
/**
sl@0
   400
 * CSbcEncoderIntfcMsgHdlr::DoGetSupportedBitpoolRangeL
sl@0
   401
 * Handles the message from the proxy and calls the custom interface.
sl@0
   402
 * The custom interface returns the requested bitpool range and this function
sl@0
   403
 * writes it back to the proxy.
sl@0
   404
 * (other items were commented in a header).
sl@0
   405
 */
sl@0
   406
void CSbcEncoderIntfcMsgHdlr::DoGetSupportedBitpoolRangeL(
sl@0
   407
                              TMMFMessage& aMessage)
sl@0
   408
    {
sl@0
   409
    TSbcEncoderBitpoolRange bitPoolRange;
sl@0
   410
    bitPoolRange.iMinSupportedBitpoolSize = 0;
sl@0
   411
    bitPoolRange.iMaxSupportedBitpoolSize = 0;
sl@0
   412
sl@0
   413
	TInt status = iSbcEncoderIntfcCI->GetSupportedBitpoolRange(
sl@0
   414
	                                  bitPoolRange.iMinSupportedBitpoolSize,
sl@0
   415
	                                  bitPoolRange.iMaxSupportedBitpoolSize);
sl@0
   416
sl@0
   417
	if (status == KErrNone)
sl@0
   418
    	{
sl@0
   419
	    TPckgBuf<TSbcEncoderBitpoolRange> pckg;
sl@0
   420
    	pckg() = bitPoolRange;
sl@0
   421
	    aMessage.WriteDataToClientL(pckg);
sl@0
   422
	    }
sl@0
   423
sl@0
   424
    aMessage.Complete(status);
sl@0
   425
    }
sl@0
   426
sl@0
   427
/**
sl@0
   428
 * CSbcEncoderIntfcMsgHdlr::DoApplyConfigL
sl@0
   429
 * Handles the message from the proxy to commit configuration settings and
sl@0
   430
 * calls the custom interface method. The data passed from the proxy is read
sl@0
   431
 * from the message and passed to the custom interface.
sl@0
   432
 * (other items were commented in a header).
sl@0
   433
 */
sl@0
   434
void CSbcEncoderIntfcMsgHdlr::DoApplyConfigL(TMMFMessage& aMessage)
sl@0
   435
	{
sl@0
   436
	TPckgBuf<TSbcEncoderConfig> pckgBuf;
sl@0
   437
	aMessage.ReadData1FromClientL(pckgBuf);
sl@0
   438
sl@0
   439
	iSbcEncoderIntfcCI->SetSamplingFrequency(pckgBuf().iSamplingFrequency);
sl@0
   440
	iSbcEncoderIntfcCI->SetChannelMode(pckgBuf().iChannelMode);
sl@0
   441
	iSbcEncoderIntfcCI->SetNumOfSubbands(pckgBuf().iNumOfSubbands);
sl@0
   442
	iSbcEncoderIntfcCI->SetNumOfBlocks(pckgBuf().iNumOfBlocks);
sl@0
   443
	iSbcEncoderIntfcCI->SetAllocationMethod(pckgBuf().iAllocationMethod);
sl@0
   444
	iSbcEncoderIntfcCI->SetBitpoolSize(pckgBuf().iBitpoolSize);
sl@0
   445
sl@0
   446
	TInt status = iSbcEncoderIntfcCI->ApplyConfig();
sl@0
   447
    aMessage.Complete(status);
sl@0
   448
	}
sl@0
   449
sl@0
   450
/**
sl@0
   451
 * CSbcEncoderIntfcMsgHdlr::CreateBufFromUintArrayL
sl@0
   452
 * Utility function used to create a buffer and fill it with data from the
sl@0
   453
 * array passed in.
sl@0
   454
 * (other items were commented in a header).
sl@0
   455
 */
sl@0
   456
void CSbcEncoderIntfcMsgHdlr::CreateBufFromUintArrayL(RArray<TUint>& aArray)
sl@0
   457
	{
sl@0
   458
	delete iDataCopyBuffer;
sl@0
   459
	iDataCopyBuffer = NULL;
sl@0
   460
	iDataCopyBuffer = CBufFlat::NewL(8);
sl@0
   461
sl@0
   462
	RBufWriteStream stream;
sl@0
   463
	stream.Open(*iDataCopyBuffer);
sl@0
   464
	CleanupClosePushL(stream);
sl@0
   465
sl@0
   466
	for (TInt i = 0; i < aArray.Count(); i++)
sl@0
   467
	    {	    	    
sl@0
   468
		stream.WriteUint32L(aArray[i]);
sl@0
   469
	    }
sl@0
   470
	    
sl@0
   471
	CleanupStack::PopAndDestroy(&stream);
sl@0
   472
	}	
sl@0
   473
sl@0
   474
/**
sl@0
   475
 * CSbcEncoderIntfcMsgHdlr::SendDataBufferToClientL
sl@0
   476
 * Sends message with requested configuration data back to the client.
sl@0
   477
 * (other items were commented in a header).
sl@0
   478
 */
sl@0
   479
void CSbcEncoderIntfcMsgHdlr::SendDataBufferToClientL(TMMFMessage& aMessage)
sl@0
   480
    {
sl@0
   481
	if (!iDataCopyBuffer)
sl@0
   482
	    {
sl@0
   483
		User::Leave(KErrNotReady);
sl@0
   484
	    }
sl@0
   485
sl@0
   486
	aMessage.WriteDataToClientL(iDataCopyBuffer->Ptr(0));
sl@0
   487
    aMessage.Complete(KErrNone);
sl@0
   488
    }
sl@0
   489
sl@0
   490
sl@0
   491
// ========================== OTHER EXPORTED FUNCTIONS =========================
sl@0
   492
sl@0
   493
// End of File