68
|
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 |
|
|
18 |
|
|
19 |
// INCLUDE FILES
|
|
20 |
#include "GSNetworkPlugin.h"
|
|
21 |
#include "GSNetworkPluginAO.h"
|
|
22 |
#include "GsLogger.h"
|
|
23 |
#include <psmsrvdomaincrkeys.h>
|
|
24 |
|
|
25 |
// EXTERNAL DATA STRUCTURES
|
|
26 |
|
|
27 |
// EXTERNAL FUNCTION PROTOTYPES
|
|
28 |
|
|
29 |
// CONSTANTS
|
|
30 |
|
|
31 |
// ----------------------------------------------------------------------------------
|
|
32 |
// CGSNetworkPluginAO::CGSNetworkPluginAO
|
|
33 |
// ----------------------------------------------------------------------------------
|
|
34 |
CGSNetworkPluginAO::CGSNetworkPluginAO() :
|
|
35 |
CActive( EPriorityStandard ),
|
|
36 |
iPsmRepository( NULL ),
|
|
37 |
iPsmMode( -1 ),
|
|
38 |
iNetworkPluginView( NULL )
|
|
39 |
|
|
40 |
{
|
|
41 |
|
|
42 |
}
|
|
43 |
|
|
44 |
|
|
45 |
// ----------------------------------------------------------------------------------
|
|
46 |
// CGSNetworkPluginAO::~CGSNetworkPluginAO
|
|
47 |
// ----------------------------------------------------------------------------------
|
|
48 |
CGSNetworkPluginAO::~CGSNetworkPluginAO()
|
|
49 |
{
|
|
50 |
Cancel();
|
|
51 |
delete iPsmRepository;
|
|
52 |
iPsmRepository = NULL;
|
|
53 |
}
|
|
54 |
|
|
55 |
|
|
56 |
// ----------------------------------------------------------------------------------
|
|
57 |
// CGSNetworkPluginAO::DoCancel
|
|
58 |
// ----------------------------------------------------------------------------------
|
|
59 |
void CGSNetworkPluginAO::DoCancel()
|
|
60 |
{
|
|
61 |
iPsmRepository->NotifyCancel( KPsmCurrentMode );
|
|
62 |
}
|
|
63 |
|
|
64 |
// ----------------------------------------------------------------------------------
|
|
65 |
// CGSNetworkPluginAO::RunL
|
|
66 |
// ----------------------------------------------------------------------------------
|
|
67 |
void CGSNetworkPluginAO::RunL()
|
|
68 |
{
|
|
69 |
// Request complete, notify request again and get new value
|
|
70 |
iPsmRepository->Get( KPsmCurrentMode, iPsmMode );
|
|
71 |
iPsmRepository->NotifyRequest( KPsmCurrentMode, iStatus );
|
|
72 |
|
|
73 |
SetActive();
|
|
74 |
|
|
75 |
__GSLOGSTRING1( "[CGSNetworkPluginAO::RunL] iPsmMode:%d", iPsmMode );
|
|
76 |
|
|
77 |
// Update network plugin view when PSM mode has changed
|
|
78 |
if ( iNetworkPluginView )
|
|
79 |
{
|
|
80 |
iNetworkPluginView->UpdateOnPsmChangedL();
|
|
81 |
}
|
|
82 |
}
|
|
83 |
|
|
84 |
// ----------------------------------------------------------------------------------
|
|
85 |
// CGSNetworkPluginAO::RunError
|
|
86 |
// ----------------------------------------------------------------------------------
|
|
87 |
TInt CGSNetworkPluginAO::RunError( TInt /*aError*/ )
|
|
88 |
{
|
|
89 |
return KErrNone;
|
|
90 |
}
|
|
91 |
|
|
92 |
|
|
93 |
// ----------------------------------------------------------------------------------
|
|
94 |
// CGSNetworkPluginAO::NewL
|
|
95 |
// ----------------------------------------------------------------------------------
|
|
96 |
CGSNetworkPluginAO* CGSNetworkPluginAO::NewL()
|
|
97 |
{
|
|
98 |
CGSNetworkPluginAO* self = new( ELeave ) CGSNetworkPluginAO();
|
|
99 |
CleanupStack::PushL( self );
|
|
100 |
self->ConstructL();
|
|
101 |
CleanupStack::Pop( self );
|
|
102 |
return self;
|
|
103 |
}
|
|
104 |
|
|
105 |
|
|
106 |
// ----------------------------------------------------------------------------------
|
|
107 |
// CGSNetworkPluginAO::ConstructL
|
|
108 |
// ----------------------------------------------------------------------------------
|
|
109 |
void CGSNetworkPluginAO::ConstructL()
|
|
110 |
{
|
|
111 |
CActiveScheduler::Add ( this );
|
|
112 |
iPsmRepository = CRepository::NewL( KCRUidPowerSaveMode );
|
|
113 |
// Read from CenRep so iPsmMode gets correct init value
|
|
114 |
iPsmRepository->Get( KPsmCurrentMode, iPsmMode );
|
|
115 |
iPsmRepository->NotifyRequest( KPsmCurrentMode, iStatus );
|
|
116 |
|
|
117 |
SetActive();
|
|
118 |
}
|
|
119 |
|
|
120 |
|
|
121 |
// ----------------------------------------------------------------------------------
|
|
122 |
// CGSNetworkPluginAO::SetView
|
|
123 |
// ----------------------------------------------------------------------------------
|
|
124 |
void CGSNetworkPluginAO::SetView( CGSNetworkPlugin* aNetworkPluginView )
|
|
125 |
{
|
|
126 |
iNetworkPluginView = aNetworkPluginView;
|
|
127 |
}
|
|
128 |
|
|
129 |
|
|
130 |
// ----------------------------------------------------------------------------------
|
|
131 |
// CGSNetworkPluginAO::Mode
|
|
132 |
// ----------------------------------------------------------------------------------
|
|
133 |
TInt CGSNetworkPluginAO::Mode() const
|
|
134 |
{
|
|
135 |
return iPsmMode;
|
|
136 |
}
|
|
137 |
|
|
138 |
// End of File
|
|
139 |
|
|
140 |
|