taskswitcher/server/src/tsdatatask.cpp
changeset 116 305818acdca4
equal deleted inserted replaced
112:dbfb5e38438b 116:305818acdca4
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 #include "tsdatatask.h"
       
    18 #include <s32mem.h>
       
    19 // -----------------------------------------------------------------------------
       
    20 void TsDataTask::ExecuteL(const TArray<MTsDataStorage*>& dataStorages, const RMessage2& msg)
       
    21     {
       
    22     TInt responseCode(KErrNotSupported);
       
    23     for( TInt iter(0); iter < dataStorages.Count() && KErrNone != responseCode; ++iter )
       
    24         {
       
    25         if(dataStorages[iter]->IsSupported( msg.Function() ) ) 
       
    26             {
       
    27             HBufC8 *data = HBufC8::NewLC(msg.GetDesLength(0));
       
    28             TPtr8 des(data->Des());
       
    29             msg.ReadL(0, des);
       
    30             RDesReadStream dataStream(*data);
       
    31             CleanupClosePushL(dataStream);
       
    32             dataStorages[iter]->HandleDataL(msg.Function(), dataStream);
       
    33             CleanupStack::PopAndDestroy(&dataStream);
       
    34             CleanupStack::PopAndDestroy(data);
       
    35             responseCode = KErrNone;
       
    36             }
       
    37         }
       
    38     User::LeaveIfError(responseCode);
       
    39     msg.Complete(responseCode);
       
    40     }