42
|
1 |
/*
|
|
2 |
* ============================================================================
|
|
3 |
* Name : glxscreensavermonitor.cpp
|
|
4 |
* Part of : GLX / Collection Data Source Framework
|
|
5 |
* Description :
|
|
6 |
* Version : %version: 1 %
|
|
7 |
*
|
|
8 |
* Copyright © 2006-2007 Nokia. All rights reserved.
|
|
9 |
* This material, including documentation and any related computer
|
|
10 |
* programs, is protected by copyright controlled by Nokia. All
|
|
11 |
* rights are reserved. Copying, including reproducing, storing,
|
|
12 |
* adapting or translating, any or all of this material requires the
|
|
13 |
* prior written consent of Nokia. This material also contains
|
|
14 |
* confidential information which may not be disclosed to others
|
|
15 |
* without the prior written consent of Nokia.
|
|
16 |
* ============================================================================
|
|
17 |
*/
|
|
18 |
|
|
19 |
#include "glxtnmonitor.h"
|
|
20 |
#include <glxlog.h>
|
|
21 |
|
|
22 |
//#include <ScreenSaverInternalPSKeys.h>
|
|
23 |
#include <e32debug.h>
|
|
24 |
|
|
25 |
const TUid KTAGDPSNotification = { 0x2001FD51 };
|
|
26 |
//const TInt KForceBackgroundGeneration = 0x00000010;
|
|
27 |
const TInt KItemsleft = 0x00000008;
|
|
28 |
|
|
29 |
CGlxTNMonitor::CGlxTNMonitor( MGlxTNObserver *observer )
|
|
30 |
: CActive( CActive::EPriorityHigh ),
|
|
31 |
iObserver( observer )
|
|
32 |
{
|
|
33 |
}
|
|
34 |
|
|
35 |
// ---------------------------------------------------------------------------
|
|
36 |
// ~CGlxPauseMonitor.
|
|
37 |
// Destructor.
|
|
38 |
// ---------------------------------------------------------------------------
|
|
39 |
//
|
|
40 |
CGlxTNMonitor::~CGlxTNMonitor()
|
|
41 |
{
|
|
42 |
Cancel();
|
|
43 |
iScreenSaverProperty.Close();
|
|
44 |
}
|
|
45 |
|
|
46 |
// ---------------------------------------------------------------------------
|
|
47 |
// NewL
|
|
48 |
// ---------------------------------------------------------------------------
|
|
49 |
//
|
|
50 |
EXPORT_C CGlxTNMonitor* CGlxTNMonitor::NewL( MGlxTNObserver *observer )
|
|
51 |
{
|
|
52 |
//GLX_LOG_ENTRY_EXIT("CGlxTNMonitor::NewL");
|
|
53 |
CGlxTNMonitor* self = new (ELeave) CGlxTNMonitor( observer );
|
|
54 |
CleanupStack::PushL( self );
|
|
55 |
self->ConstructL();
|
|
56 |
CleanupStack::Pop( self );
|
|
57 |
return self;
|
|
58 |
}
|
|
59 |
|
|
60 |
// ---------------------------------------------------------------------------
|
|
61 |
// ConstructL.
|
|
62 |
// Second-phase constructor.
|
|
63 |
// ---------------------------------------------------------------------------
|
|
64 |
//
|
|
65 |
void CGlxTNMonitor::ConstructL()
|
|
66 |
{
|
|
67 |
iScreenSaverProperty.Attach( KTAGDPSNotification, KItemsleft );
|
|
68 |
CActiveScheduler::Add( this );
|
|
69 |
RunL();
|
|
70 |
}
|
|
71 |
|
|
72 |
void CGlxTNMonitor::RunL()
|
|
73 |
{
|
|
74 |
GLX_LOG_ENTRY_EXIT("CGlxTNMonitor::RunL");
|
|
75 |
// resubscribe before processing new value to prevent missing updates
|
|
76 |
iScreenSaverProperty.Subscribe( iStatus );
|
|
77 |
SetActive();
|
|
78 |
//User::WaitForRequest(iStatus);
|
|
79 |
TInt intValue;
|
|
80 |
TInt err = iScreenSaverProperty.Get( intValue ) ;
|
|
81 |
if ( err != KErrNotFound ){
|
|
82 |
iObserver->updateTNCount( intValue );
|
|
83 |
}
|
|
84 |
}
|
|
85 |
|
|
86 |
// ---------------------------------------------------------------------------
|
|
87 |
// DoCancel
|
|
88 |
// ---------------------------------------------------------------------------
|
|
89 |
//
|
|
90 |
void CGlxTNMonitor::DoCancel()
|
|
91 |
{
|
|
92 |
iScreenSaverProperty.Cancel();
|
|
93 |
}
|
|
94 |
|
|
95 |
// ---------------------------------------------------------------------------
|
|
96 |
// RunError
|
|
97 |
// ---------------------------------------------------------------------------
|
|
98 |
//
|
|
99 |
TInt CGlxTNMonitor::RunError( TInt )
|
|
100 |
{
|
|
101 |
GLX_LOG_ENTRY_EXIT("CGlxTNMonitor::RunError");
|
|
102 |
return KErrNone;
|
|
103 |
}
|
|
104 |
|
|
105 |
|