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); |
|
29 break; |
|
30 case UnregisterScreenshotMessage: |
|
31 TsDataTask::UnregisterScreenshotL(dataStorage, msg); |
|
32 break; |
|
33 case VisibilityChange: |
|
34 VisibilityChangeL(dataStorage, msg); |
|
35 break; |
|
36 } |
|
37 |
|
38 msg.Complete(KErrNone); |
|
39 } |
|
40 |
|
41 void TsDataTask::RegisterScreenshotL(MTsDataStorage& dataStorage, |
|
42 const RMessage2& msg) |
|
43 { |
|
44 TPckgBuf<TInt> wgId, fbsHdl, param, priority; |
|
45 |
|
46 msg.ReadL(WindowsGroup, wgId); |
|
47 msg.ReadL(ScreenshotHandle, fbsHdl); |
|
48 msg.ReadL(AdditionalParameters, param); |
|
49 msg.Read(Priority, priority); |
|
50 |
|
51 //convert and provide data |
|
52 CFbsBitmap* bitmap = new(ELeave) CFbsBitmap(); |
|
53 CleanupStack::PushL(bitmap); |
|
54 User::LeaveIfError(bitmap->Duplicate(fbsHdl())); |
|
55 dataStorage.UpdateL(wgId(), *bitmap, param(), priority()); |
|
56 CleanupStack::PopAndDestroy(bitmap); |
|
57 } |
|
58 |
|
59 void TsDataTask::UnregisterScreenshotL(MTsDataStorage& dataStorage, |
|
60 const RMessage2& msg) |
|
61 { |
|
62 TPckgBuf<TInt> wgId, param; |
|
63 |
|
64 msg.ReadL(WindowsGroup, wgId); |
|
65 msg.ReadL(AdditionalParameters, param); |
|
66 |
|
67 dataStorage.RemoveL(wgId(), param()); |
|
68 } |
|
69 |
|
70 void TsDataTask::VisibilityChangeL(MTsDataStorage& dataStorage, |
|
71 const RMessage2& msg) |
|
72 { |
|
73 TPckgBuf<TInt> wgId, visibility, param; |
|
74 |
|
75 msg.ReadL(0, wgId); |
|
76 msg.ReadL(1, visibility); |
|
77 |
|
78 dataStorage.UpdateL(wgId(), static_cast<Visibility>(visibility()), 0); |
|
79 } |
|