taskswitcher/server/src/tsdatatask.cpp
changeset 117 c63ee96dbe5f
equal deleted inserted replaced
115:3ab5c078b490 117:c63ee96dbe5f
       
     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         if (dataStorages[iter]->isSupported(msg.Function())) {
       
    25             HBufC8 *data = HBufC8::NewLC(msg.GetDesLength(0));
       
    26             TPtr8 des(data->Des());
       
    27             msg.ReadL(0, des);
       
    28             RDesReadStream dataStream(*data);
       
    29             CleanupClosePushL(dataStream);
       
    30             dataStorages[iter]->handleDataL(msg.Function(), dataStream);
       
    31             CleanupStack::PopAndDestroy(&dataStream);
       
    32             CleanupStack::PopAndDestroy(data);
       
    33             
       
    34             responseCode = KErrNone;
       
    35         }
       
    36     }
       
    37     User::LeaveIfError(responseCode);
       
    38     msg.Complete(responseCode);
       
    39 }