sl@0
|
1 |
// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
#include <graphics/surfaceupdateclient.h>
|
sl@0
|
17 |
#include <graphics/surface.h>
|
sl@0
|
18 |
#include <graphics/suerror.h>
|
sl@0
|
19 |
#include "testgceharness.h"
|
sl@0
|
20 |
|
sl@0
|
21 |
inline void SurfaceUpdateAssert(TInt aCond) {__ASSERT_ALWAYS(aCond, User::Panic(_L("surfaceupdateclient.cpp; assertion failed"), __LINE__));}
|
sl@0
|
22 |
|
sl@0
|
23 |
EXPORT_C RSurfaceUpdateSession::RSurfaceUpdateSession() :
|
sl@0
|
24 |
RSessionBase(),
|
sl@0
|
25 |
iStatusAvailable(NULL), iStatusDisplayed(NULL), iStatusDisplayedXTimes(NULL)
|
sl@0
|
26 |
{
|
sl@0
|
27 |
}
|
sl@0
|
28 |
|
sl@0
|
29 |
EXPORT_C TInt RSurfaceUpdateSession::Connect(TInt /*aMessageSlots*/)
|
sl@0
|
30 |
{
|
sl@0
|
31 |
iStatusAvailable = NULL;
|
sl@0
|
32 |
iStatusDisplayed = NULL;
|
sl@0
|
33 |
iStatusDisplayedXTimes = NULL;
|
sl@0
|
34 |
|
sl@0
|
35 |
CTestGCEHarness* gceHarness = NULL;
|
sl@0
|
36 |
TRAPD(err, gceHarness = CTestGCEHarness::RetrieveL());
|
sl@0
|
37 |
if(err != KErrNone)
|
sl@0
|
38 |
{
|
sl@0
|
39 |
return err;
|
sl@0
|
40 |
}
|
sl@0
|
41 |
return gceHarness->Connect();
|
sl@0
|
42 |
}
|
sl@0
|
43 |
|
sl@0
|
44 |
EXPORT_C void RSurfaceUpdateSession::Close()
|
sl@0
|
45 |
{
|
sl@0
|
46 |
iStatusAvailable = NULL;
|
sl@0
|
47 |
iStatusDisplayed = NULL;
|
sl@0
|
48 |
iStatusDisplayedXTimes = NULL;
|
sl@0
|
49 |
|
sl@0
|
50 |
CTestGCEHarness* gceHarness = NULL;
|
sl@0
|
51 |
TRAPD(err, gceHarness = CTestGCEHarness::RetrieveL());
|
sl@0
|
52 |
if(err != KErrNone)
|
sl@0
|
53 |
{
|
sl@0
|
54 |
return;
|
sl@0
|
55 |
}
|
sl@0
|
56 |
gceHarness->Close();
|
sl@0
|
57 |
}
|
sl@0
|
58 |
|
sl@0
|
59 |
EXPORT_C TInt RSurfaceUpdateSession::SubmitUpdate(TInt aScreen, const TSurfaceId& aSurfaceId,
|
sl@0
|
60 |
TInt aBuffer, const TRegion* /*aDirtyRegion*/)
|
sl@0
|
61 |
{
|
sl@0
|
62 |
if(aScreen != KAllScreens || aBuffer < 0 || aSurfaceId.IsNull())
|
sl@0
|
63 |
{
|
sl@0
|
64 |
IssueRequestComplete(KErrArgument);
|
sl@0
|
65 |
return KErrArgument;
|
sl@0
|
66 |
}
|
sl@0
|
67 |
|
sl@0
|
68 |
CTestGCEHarness* gceHarness = NULL;
|
sl@0
|
69 |
TRAPD(err, gceHarness = CTestGCEHarness::RetrieveL());
|
sl@0
|
70 |
if(err != KErrNone)
|
sl@0
|
71 |
{
|
sl@0
|
72 |
return err;
|
sl@0
|
73 |
}
|
sl@0
|
74 |
return gceHarness->SubmitUpdate(aBuffer);
|
sl@0
|
75 |
}
|
sl@0
|
76 |
|
sl@0
|
77 |
EXPORT_C void RSurfaceUpdateSession::NotifyWhenAvailable(TRequestStatus& aStatus)
|
sl@0
|
78 |
{
|
sl@0
|
79 |
CTestGCEHarness* gceHarness = NULL;
|
sl@0
|
80 |
TRAPD(err, gceHarness = CTestGCEHarness::RetrieveL());
|
sl@0
|
81 |
|
sl@0
|
82 |
if(err != KErrNone)
|
sl@0
|
83 |
{
|
sl@0
|
84 |
return;
|
sl@0
|
85 |
}
|
sl@0
|
86 |
|
sl@0
|
87 |
gceHarness->NotifyWhenAvailable(aStatus);
|
sl@0
|
88 |
}
|
sl@0
|
89 |
|
sl@0
|
90 |
EXPORT_C void RSurfaceUpdateSession::NotifyWhenDisplayed(TRequestStatus& aStatus, TTimeStamp& aTimeStamp)
|
sl@0
|
91 |
{
|
sl@0
|
92 |
CTestGCEHarness* gceHarness = NULL;
|
sl@0
|
93 |
TRAPD(err, gceHarness = CTestGCEHarness::RetrieveL());
|
sl@0
|
94 |
|
sl@0
|
95 |
if(err != KErrNone)
|
sl@0
|
96 |
{
|
sl@0
|
97 |
return;
|
sl@0
|
98 |
}
|
sl@0
|
99 |
|
sl@0
|
100 |
gceHarness->NotifyWhenDisplayed(aStatus, aTimeStamp);
|
sl@0
|
101 |
}
|
sl@0
|
102 |
|
sl@0
|
103 |
EXPORT_C void RSurfaceUpdateSession::NotifyWhenDisplayedXTimes(TInt aCount, TRequestStatus &aStatus)
|
sl@0
|
104 |
{
|
sl@0
|
105 |
iStatusDisplayedXTimes = &aStatus;
|
sl@0
|
106 |
//we will check aCount validity at submission time (in SubmitUpdate)
|
sl@0
|
107 |
iCount = aCount;
|
sl@0
|
108 |
}
|
sl@0
|
109 |
|
sl@0
|
110 |
EXPORT_C void RSurfaceUpdateSession::CancelAllUpdateNotifications()
|
sl@0
|
111 |
{
|
sl@0
|
112 |
CTestGCEHarness* gceHarness = NULL;
|
sl@0
|
113 |
TRAPD(err, gceHarness = CTestGCEHarness::RetrieveL());
|
sl@0
|
114 |
if(err != KErrNone)
|
sl@0
|
115 |
{
|
sl@0
|
116 |
return;
|
sl@0
|
117 |
}
|
sl@0
|
118 |
gceHarness->CancelAllNotifications();
|
sl@0
|
119 |
}
|
sl@0
|
120 |
|
sl@0
|
121 |
TVersion RSurfaceUpdateSession::Version() const
|
sl@0
|
122 |
{
|
sl@0
|
123 |
return (TVersion(1, 1, 1));
|
sl@0
|
124 |
}
|
sl@0
|
125 |
|
sl@0
|
126 |
void RSurfaceUpdateSession::IssueRequestComplete(TInt /*aErr*/)
|
sl@0
|
127 |
{
|
sl@0
|
128 |
}
|