tstaskmonitor/server/src/tsdatatask.cpp
changeset 96 5d243a69bdda
child 99 7aaf39b772ac
equal deleted inserted replaced
95:c739008478cc 96:5d243a69bdda
       
     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 <fbs.h>
       
    18 #include "tsdatatask.h"
       
    19 
       
    20 // -----------------------------------------------------------------------------
       
    21 //
       
    22 // -----------------------------------------------------------------------------
       
    23 //
       
    24 void TsDataTask::ExecuteL(MTsDataStorage& dataStorage, const RMessage2& msg)
       
    25 {
       
    26     switch(msg.Function()) {
       
    27     case RegisterScreenshotMessage:
       
    28         TsDataTask::RegisterScreenshotL(dataStorage, msg); break;
       
    29     case UnregisterScreenshotMessage:
       
    30         TsDataTask::UnregisterScreenshotL(dataStorage, msg); break;
       
    31     }
       
    32     
       
    33     msg.Complete(KErrNone);
       
    34 }
       
    35 
       
    36 void TsDataTask::RegisterScreenshotL(MTsDataStorage& dataStorage, 
       
    37                                            const RMessage2& msg)
       
    38 {
       
    39     TPckgBuf<TInt> wgId, fbsHdl, param, priority;
       
    40     
       
    41     msg.ReadL(WindowsGroup, wgId);
       
    42     msg.ReadL(ScreenshotHandle, fbsHdl);
       
    43     msg.ReadL(AdditionalParameters, param);
       
    44     msg.Read(Priority, priority);
       
    45     
       
    46     //convert and provide data
       
    47     CFbsBitmap* bitmap = new(ELeave) CFbsBitmap();
       
    48     CleanupStack::PushL(bitmap);
       
    49     User::LeaveIfError(bitmap->Duplicate(fbsHdl()));
       
    50     dataStorage.UpdateL(wgId(), *bitmap, param(), priority());
       
    51     CleanupStack::PopAndDestroy(bitmap);
       
    52 }
       
    53     
       
    54 void TsDataTask::UnregisterScreenshotL(MTsDataStorage& dataStorage, 
       
    55                                        const RMessage2& msg)
       
    56 {
       
    57     TPckgBuf<TInt> wgId, param;
       
    58     
       
    59     msg.ReadL(WindowsGroup, wgId);
       
    60     msg.ReadL(AdditionalParameters, param);
       
    61     
       
    62     dataStorage.RemoveL(wgId(), param());
       
    63 }