taskswitcher/server/src/tsdataprovidertask.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 "tsdataprovidertask.h"
       
    18 #include "tstaskmonitorglobals.h"
       
    19 
       
    20 // -----------------------------------------------------------------------------
       
    21 /**
       
    22  * Task handle data reqest. Function analyse reqest parameters and generate valid response.
       
    23  * @param aProvider - serialized data provider
       
    24  * @param aMsg - request message
       
    25  */
       
    26 void TsDataProviderTask::ExecuteL( const MTsDataProvider& aProvider, 
       
    27                                    const RMessage2& aMsg )
       
    28     {
       
    29     switch( aMsg.Function() ) 
       
    30         {
       
    31     case GetRunningAppInfo:
       
    32         aMsg.WriteL( KRequestDataSizeOffset, 
       
    33                      TPckgBuf<TInt>( aProvider.Data().Length() ) );
       
    34         aMsg.Complete( KErrNone );
       
    35         break;
       
    36     
       
    37     case FlushData:
       
    38         if ( aProvider.Data().Length() > aMsg.GetDesMaxLengthL(KRequestDataBufferOffset) )
       
    39             {
       
    40             User::Leave( KErrCorrupt );
       
    41             }
       
    42         aMsg.WriteL( KRequestDataBufferOffset, aProvider.Data() );
       
    43         aMsg.Complete( KErrNone );
       
    44         break;
       
    45         }
       
    46     }