activityfw/activitydatabase/hsactivitydbserver/src/activitydataprovidertask.cpp
changeset 93 82b66994846c
child 80 397d00875918
equal deleted inserted replaced
92:782e3408c2ab 93:82b66994846c
       
     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 "activitydataprovidertask.h"
       
    18 #include "activitycmd.h"
       
    19 
       
    20 // -----------------------------------------------------------------------------
       
    21 //
       
    22 // -----------------------------------------------------------------------------
       
    23 //
       
    24 void ActivityDataProviderTask::ExecuteL(MActivityTaskStorage& storage, 
       
    25                                        const RMessage2& msg)
       
    26 {
       
    27     TPckgBuf<void*> requestId;
       
    28     CActivityTask* taskPtr(0);
       
    29     msg.Read(KRequestIdOffset, requestId);
       
    30     
       
    31     for (TInt iter(0);iter <storage.StorageData().Count();++iter) {
       
    32         taskPtr = storage.StorageData()[iter];
       
    33         if (taskPtr == requestId()) {//compare requested task address with storage objects
       
    34             ProvideDataL(msg, *taskPtr);
       
    35             storage.Pop(taskPtr);
       
    36             delete taskPtr;
       
    37             return;
       
    38         }
       
    39     }
       
    40     User::Leave(KErrNotFound);
       
    41 }
       
    42 
       
    43 // -----------------------------------------------------------------------------
       
    44 //
       
    45 // -----------------------------------------------------------------------------
       
    46 //
       
    47 void ActivityDataProviderTask::ProvideDataL(const RMessage2& msg, 
       
    48                                             const CActivityTask& src)
       
    49 {
       
    50     msg.WriteL(KResponseDataOffset, src.Data());
       
    51     msg.Complete(KErrNone);
       
    52 }